index.440cd0bd.js 766 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835
  1. 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 kc(t,e){const n=Object.create(null),i=t.split(",");for(let s=0;s<i.length;s++)n[i[s]]=!0;return e?s=>!!n[s.toLowerCase()]:s=>!!n[s]}const Qp="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",em=kc(Qp);function Xh(t){return!!t||t===""}function fo(t){if($e(t)){const e={};for(let n=0;n<t.length;n++){const i=t[n],s=zt(i)?im(i):fo(i);if(s)for(const o in s)e[o]=s[o]}return e}else{if(zt(t))return t;if(Ft(t))return t}}const tm=/;(?![^(]*\))/g,nm=/:(.+)/;function im(t){const e={};return t.split(tm).forEach(n=>{if(n){const i=n.split(nm);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function je(t){let e="";if(zt(t))e=t;else if($e(t))for(let n=0;n<t.length;n++){const i=je(t[n]);i&&(e+=i+" ")}else if(Ft(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}function sm(t){if(!t)return null;let{class:e,style:n}=t;return e&&!zt(e)&&(t.class=je(e)),n&&(t.style=fo(n)),t}function om(t,e){if(t.length!==e.length)return!1;let n=!0;for(let i=0;n&&i<t.length;i++)n=dr(t[i],e[i]);return n}function dr(t,e){if(t===e)return!0;let n=Fd(t),i=Fd(e);if(n||i)return n&&i?t.getTime()===e.getTime():!1;if(n=Zo(t),i=Zo(e),n||i)return t===e;if(n=$e(t),i=$e(e),n||i)return n&&i?om(t,e):!1;if(n=Ft(t),i=Ft(e),n||i){if(!n||!i)return!1;const s=Object.keys(t).length,o=Object.keys(e).length;if(s!==o)return!1;for(const r in t){const a=t.hasOwnProperty(r),l=e.hasOwnProperty(r);if(a&&!l||!a&&l||!dr(t[r],e[r]))return!1}}return String(t)===String(e)}function Bc(t,e){return t.findIndex(n=>dr(n,e))}const ze=t=>zt(t)?t:t==null?"":$e(t)||Ft(t)&&(t.toString===qh||!nt(t.toString))?JSON.stringify(t,jh,2):String(t),jh=(t,e)=>e&&e.__v_isRef?jh(t,e.value):Zs(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((n,[i,s])=>(n[`${i} =>`]=s,n),{})}:po(e)?{[`Set(${e.size})`]:[...e.values()]}:Ft(e)&&!$e(e)&&!Zh(e)?String(e):e,Mt={},qs=[],Bn=()=>{},rm=()=>!1,am=/^on[^a-z]/,ya=t=>am.test(t),Vc=t=>t.startsWith("onUpdate:"),jt=Object.assign,$c=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},lm=Object.prototype.hasOwnProperty,dt=(t,e)=>lm.call(t,e),$e=Array.isArray,Zs=t=>ur(t)==="[object Map]",po=t=>ur(t)==="[object Set]",Fd=t=>ur(t)==="[object Date]",nt=t=>typeof t=="function",zt=t=>typeof t=="string",Zo=t=>typeof t=="symbol",Ft=t=>t!==null&&typeof t=="object",Yh=t=>Ft(t)&&nt(t.then)&&nt(t.catch),qh=Object.prototype.toString,ur=t=>qh.call(t),cm=t=>ur(t).slice(8,-1),Zh=t=>ur(t)==="[object Object]",Hc=t=>zt(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Zr=kc(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),xa=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},dm=/-(\w)/g,ei=xa(t=>t.replace(dm,(e,n)=>n?n.toUpperCase():"")),um=/\B([A-Z])/g,xs=xa(t=>t.replace(um,"-$1").toLowerCase()),Sa=xa(t=>t.charAt(0).toUpperCase()+t.slice(1)),Wa=xa(t=>t?`on${Sa(t)}`:""),Ko=(t,e)=>!Object.is(t,e),Kr=(t,e)=>{for(let n=0;n<t.length;n++)t[n](e)},la=(t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})},Jo=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Ld;const hm=()=>Ld||(Ld=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});let Xn;class fm{constructor(e=!1){this.active=!0,this.effects=[],this.cleanups=[],!e&&Xn&&(this.parent=Xn,this.index=(Xn.scopes||(Xn.scopes=[])).push(this)-1)}run(e){if(this.active){const n=Xn;try{return Xn=this,e()}finally{Xn=n}}}on(){Xn=this}off(){Xn=this.parent}stop(e){if(this.active){let n,i;for(n=0,i=this.effects.length;n<i;n++)this.effects[n].stop();for(n=0,i=this.cleanups.length;n<i;n++)this.cleanups[n]();if(this.scopes)for(n=0,i=this.scopes.length;n<i;n++)this.scopes[n].stop(!0);if(this.parent&&!e){const s=this.parent.scopes.pop();s&&s!==this&&(this.parent.scopes[this.index]=s,s.index=this.index)}this.active=!1}}}function pm(t,e=Xn){e&&e.active&&e.effects.push(t)}const Gc=t=>{const e=new Set(t);return e.w=0,e.n=0,e},Kh=t=>(t.w&Bi)>0,Jh=t=>(t.n&Bi)>0,mm=({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=Bi},_m=t=>{const{deps:e}=t;if(e.length){let n=0;for(let i=0;i<e.length;i++){const s=e[i];Kh(s)&&!Jh(s)?s.delete(t):e[n++]=s,s.w&=~Bi,s.n&=~Bi}e.length=n}},Fl=new WeakMap;let Lo=0,Bi=1;const Ll=30;let Ln;const _s=Symbol(""),Ul=Symbol("");class Wc{constructor(e,n=null,i){this.fn=e,this.scheduler=n,this.active=!0,this.deps=[],this.parent=void 0,pm(this,i)}run(){if(!this.active)return this.fn();let e=Ln,n=Ui;for(;e;){if(e===this)return;e=e.parent}try{return this.parent=Ln,Ln=this,Ui=!0,Bi=1<<++Lo,Lo<=Ll?mm(this):Ud(this),this.fn()}finally{Lo<=Ll&&_m(this),Bi=1<<--Lo,Ln=this.parent,Ui=n,this.parent=void 0,this.deferStop&&this.stop()}}stop(){Ln===this?this.deferStop=!0:this.active&&(Ud(this),this.onStop&&this.onStop(),this.active=!1)}}function Ud(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let Ui=!0;const Qh=[];function mo(){Qh.push(Ui),Ui=!1}function _o(){const t=Qh.pop();Ui=t===void 0?!0:t}function bn(t,e,n){if(Ui&&Ln){let i=Fl.get(t);i||Fl.set(t,i=new Map);let s=i.get(n);s||i.set(n,s=Gc()),ef(s)}}function ef(t,e){let n=!1;Lo<=Ll?Jh(t)||(t.n|=Bi,n=!Kh(t)):n=!t.has(Ln),n&&(t.add(Ln),Ln.deps.push(t))}function mi(t,e,n,i,s,o){const r=Fl.get(t);if(!r)return;let a=[];if(e==="clear")a=[...r.values()];else if(n==="length"&&$e(t))r.forEach((l,d)=>{(d==="length"||d>=i)&&a.push(l)});else switch(n!==void 0&&a.push(r.get(n)),e){case"add":$e(t)?Hc(n)&&a.push(r.get("length")):(a.push(r.get(_s)),Zs(t)&&a.push(r.get(Ul)));break;case"delete":$e(t)||(a.push(r.get(_s)),Zs(t)&&a.push(r.get(Ul)));break;case"set":Zs(t)&&a.push(r.get(_s));break}if(a.length===1)a[0]&&Ol(a[0]);else{const l=[];for(const d of a)d&&l.push(...d);Ol(Gc(l))}}function Ol(t,e){const n=$e(t)?t:[...t];for(const i of n)i.computed&&Od(i);for(const i of n)i.computed||Od(i)}function Od(t,e){(t!==Ln||t.allowRecurse)&&(t.scheduler?t.scheduler():t.run())}const gm=kc("__proto__,__v_isRef,__isVue"),tf=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Zo)),vm=Xc(),bm=Xc(!1,!0),ym=Xc(!0),Nd=xm();function xm(){const t={};return["includes","indexOf","lastIndexOf"].forEach(e=>{t[e]=function(...n){const i=pt(this);for(let o=0,r=this.length;o<r;o++)bn(i,"get",o+"");const s=i[e](...n);return s===-1||s===!1?i[e](...n.map(pt)):s}}),["push","pop","shift","unshift","splice"].forEach(e=>{t[e]=function(...n){mo();const i=pt(this)[e].apply(this,n);return _o(),i}}),t}function Xc(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?Nm:af:e?rf:of).get(i))return i;const r=$e(i);if(!t&&r&&dt(Nd,s))return Reflect.get(Nd,s,o);const a=Reflect.get(i,s,o);return(Zo(s)?tf.has(s):gm(s))||(t||bn(i,"get",s),e)?a:Qt(a)?r&&Hc(s)?a:a.value:Ft(a)?t?lf(a):hr(a):a}}const Sm=nf(),Mm=nf(!0);function nf(t=!1){return function(n,i,s,o){let r=n[i];if(Qo(r)&&Qt(r)&&!Qt(s))return!1;if(!t&&!Qo(s)&&(Nl(s)||(s=pt(s),r=pt(r)),!$e(n)&&Qt(r)&&!Qt(s)))return r.value=s,!0;const a=$e(n)&&Hc(i)?Number(i)<n.length:dt(n,i),l=Reflect.set(n,i,s,o);return n===pt(o)&&(a?Ko(s,r)&&mi(n,"set",i,s):mi(n,"add",i,s)),l}}function Em(t,e){const n=dt(t,e);t[e];const i=Reflect.deleteProperty(t,e);return i&&n&&mi(t,"delete",e,void 0),i}function wm(t,e){const n=Reflect.has(t,e);return(!Zo(e)||!tf.has(e))&&bn(t,"has",e),n}function Tm(t){return bn(t,"iterate",$e(t)?"length":_s),Reflect.ownKeys(t)}const sf={get:vm,set:Sm,deleteProperty:Em,has:wm,ownKeys:Tm},Cm={get:ym,set(t,e){return!0},deleteProperty(t,e){return!0}},Am=jt({},sf,{get:bm,set:Mm}),jc=t=>t,Ma=t=>Reflect.getPrototypeOf(t);function vr(t,e,n=!1,i=!1){t=t.__v_raw;const s=pt(t),o=pt(e);n||(e!==o&&bn(s,"get",e),bn(s,"get",o));const{has:r}=Ma(s),a=i?jc:n?Zc:er;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 br(t,e=!1){const n=this.__v_raw,i=pt(n),s=pt(t);return e||(t!==s&&bn(i,"has",t),bn(i,"has",s)),t===s?n.has(t):n.has(t)||n.has(s)}function yr(t,e=!1){return t=t.__v_raw,!e&&bn(pt(t),"iterate",_s),Reflect.get(t,"size",t)}function zd(t){t=pt(t);const e=pt(this);return Ma(e).has.call(e,t)||(e.add(t),mi(e,"add",t,t)),this}function kd(t,e){e=pt(e);const n=pt(this),{has:i,get:s}=Ma(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?Ko(e,r)&&mi(n,"set",t,e):mi(n,"add",t,e),this}function Bd(t){const e=pt(this),{has:n,get:i}=Ma(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&&mi(e,"delete",t,void 0),o}function Vd(){const t=pt(this),e=t.size!==0,n=t.clear();return e&&mi(t,"clear",void 0,void 0),n}function xr(t,e){return function(i,s){const o=this,r=o.__v_raw,a=pt(r),l=e?jc:t?Zc:er;return!t&&bn(a,"iterate",_s),r.forEach((d,u)=>i.call(s,l(d),l(u),o))}}function Sr(t,e,n){return function(...i){const s=this.__v_raw,o=pt(s),r=Zs(o),a=t==="entries"||t===Symbol.iterator&&r,l=t==="keys"&&r,d=s[t](...i),u=n?jc:e?Zc:er;return!e&&bn(o,"iterate",l?Ul:_s),{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 gi(t){return function(...e){return t==="delete"?!1:this}}function Pm(){const t={get(o){return vr(this,o)},get size(){return yr(this)},has:br,add:zd,set:kd,delete:Bd,clear:Vd,forEach:xr(!1,!1)},e={get(o){return vr(this,o,!1,!0)},get size(){return yr(this)},has:br,add:zd,set:kd,delete:Bd,clear:Vd,forEach:xr(!1,!0)},n={get(o){return vr(this,o,!0)},get size(){return yr(this,!0)},has(o){return br.call(this,o,!0)},add:gi("add"),set:gi("set"),delete:gi("delete"),clear:gi("clear"),forEach:xr(!0,!1)},i={get(o){return vr(this,o,!0,!0)},get size(){return yr(this,!0)},has(o){return br.call(this,o,!0)},add:gi("add"),set:gi("set"),delete:gi("delete"),clear:gi("clear"),forEach:xr(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(o=>{t[o]=Sr(o,!1,!1),n[o]=Sr(o,!0,!1),e[o]=Sr(o,!1,!0),i[o]=Sr(o,!0,!0)}),[t,n,e,i]}const[Rm,Dm,Im,Fm]=Pm();function Yc(t,e){const n=e?t?Fm:Im:t?Dm:Rm;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 Lm={get:Yc(!1,!1)},Um={get:Yc(!1,!0)},Om={get:Yc(!0,!1)},of=new WeakMap,rf=new WeakMap,af=new WeakMap,Nm=new WeakMap;function zm(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function km(t){return t.__v_skip||!Object.isExtensible(t)?0:zm(cm(t))}function hr(t){return Qo(t)?t:qc(t,!1,sf,Lm,of)}function Bm(t){return qc(t,!1,Am,Um,rf)}function lf(t){return qc(t,!0,Cm,Om,af)}function qc(t,e,n,i,s){if(!Ft(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const o=s.get(t);if(o)return o;const r=km(t);if(r===0)return t;const a=new Proxy(t,r===2?i:n);return s.set(t,a),a}function Ks(t){return Qo(t)?Ks(t.__v_raw):!!(t&&t.__v_isReactive)}function Qo(t){return!!(t&&t.__v_isReadonly)}function Nl(t){return!!(t&&t.__v_isShallow)}function cf(t){return Ks(t)||Qo(t)}function pt(t){const e=t&&t.__v_raw;return e?pt(e):t}function df(t){return la(t,"__v_skip",!0),t}const er=t=>Ft(t)?hr(t):t,Zc=t=>Ft(t)?lf(t):t;function uf(t){Ui&&Ln&&(t=pt(t),ef(t.dep||(t.dep=Gc())))}function hf(t,e){t=pt(t),t.dep&&Ol(t.dep)}function Qt(t){return!!(t&&t.__v_isRef===!0)}function ff(t){return mf(t,!1)}function pf(t){return mf(t,!0)}function mf(t,e){return Qt(t)?t:new Vm(t,e)}class Vm{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:er(e)}get value(){return uf(this),this._value}set value(e){e=this.__v_isShallow?e:pt(e),Ko(e,this._rawValue)&&(this._rawValue=e,this._value=this.__v_isShallow?e:er(e),hf(this))}}function Bo(t){return Qt(t)?t.value:t}const $m={get:(t,e,n)=>Bo(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 _f(t){return Ks(t)?t:new Proxy(t,$m)}class Hm{constructor(e,n,i,s){this._setter=n,this.dep=void 0,this.__v_isRef=!0,this._dirty=!0,this.effect=new Wc(e,()=>{this._dirty||(this._dirty=!0,hf(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!s,this.__v_isReadonly=i}get value(){const e=pt(this);return uf(e),(e._dirty||!e._cacheable)&&(e._dirty=!1,e._value=e.effect.run()),e._value}set value(e){this._setter(e)}}function Gm(t,e,n=!1){let i,s;const o=nt(t);return o?(i=t,s=Bn):(i=t.get,s=t.set),new Hm(i,s,o||!s,n)}function Oi(t,e,n,i){let s;try{s=i?t(...i):t()}catch(o){Ea(o,e,n)}return s}function Tn(t,e,n,i){if(nt(t)){const o=Oi(t,e,n,i);return o&&Yh(o)&&o.catch(r=>{Ea(r,e,n)}),o}const s=[];for(let o=0;o<t.length;o++)s.push(Tn(t[o],e,n,i));return s}function Ea(t,e,n,i=!0){const s=e?e.vnode:null;if(e){let o=e.parent;const r=e.proxy,a=n;for(;o;){const d=o.ec;if(d){for(let u=0;u<d.length;u++)if(d[u](t,r,a)===!1)return}o=o.parent}const l=e.appContext.config.errorHandler;if(l){Oi(l,null,10,[t,r,a]);return}}Wm(t,n,s,i)}function Wm(t,e,n,i=!0){console.error(t)}let ca=!1,zl=!1;const vn=[];let ui=0;const Vo=[];let Uo=null,$s=0;const $o=[];let Pi=null,Hs=0;const gf=Promise.resolve();let Kc=null,kl=null;function vf(t){const e=Kc||gf;return t?e.then(this?t.bind(this):t):e}function Xm(t){let e=ui+1,n=vn.length;for(;e<n;){const i=e+n>>>1;tr(vn[i])<t?e=i+1:n=i}return e}function bf(t){(!vn.length||!vn.includes(t,ca&&t.allowRecurse?ui+1:ui))&&t!==kl&&(t.id==null?vn.push(t):vn.splice(Xm(t.id),0,t),yf())}function yf(){!ca&&!zl&&(zl=!0,Kc=gf.then(Mf))}function jm(t){const e=vn.indexOf(t);e>ui&&vn.splice(e,1)}function xf(t,e,n,i){$e(t)?n.push(...t):(!e||!e.includes(t,t.allowRecurse?i+1:i))&&n.push(t),yf()}function Ym(t){xf(t,Uo,Vo,$s)}function qm(t){xf(t,Pi,$o,Hs)}function wa(t,e=null){if(Vo.length){for(kl=e,Uo=[...new Set(Vo)],Vo.length=0,$s=0;$s<Uo.length;$s++)Uo[$s]();Uo=null,$s=0,kl=null,wa(t,e)}}function Sf(t){if(wa(),$o.length){const e=[...new Set($o)];if($o.length=0,Pi){Pi.push(...e);return}for(Pi=e,Pi.sort((n,i)=>tr(n)-tr(i)),Hs=0;Hs<Pi.length;Hs++)Pi[Hs]();Pi=null,Hs=0}}const tr=t=>t.id==null?1/0:t.id;function Mf(t){zl=!1,ca=!0,wa(t),vn.sort((n,i)=>tr(n)-tr(i));const e=Bn;try{for(ui=0;ui<vn.length;ui++){const n=vn[ui];n&&n.active!==!1&&Oi(n,null,14)}}finally{ui=0,vn.length=0,Sf(),ca=!1,Kc=null,(vn.length||Vo.length||$o.length)&&Mf(t)}}function Zm(t,e,...n){if(t.isUnmounted)return;const i=t.vnode.props||Mt;let s=n;const o=e.startsWith("update:"),r=o&&e.slice(7);if(r&&r in i){const u=`${r==="modelValue"?"model":r}Modifiers`,{number:f,trim:h}=i[u]||Mt;h&&(s=n.map(m=>m.trim())),f&&(s=n.map(Jo))}let a,l=i[a=Wa(e)]||i[a=Wa(ei(e))];!l&&o&&(l=i[a=Wa(xs(e))]),l&&Tn(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,Tn(d,t,6,s)}}function Ef(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=Ef(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):($e(o)?o.forEach(l=>r[l]=null):jt(r,o),i.set(t,r),r)}function Ta(t,e){return!t||!ya(e)?!1:(e=e.slice(2).replace(/Once$/,""),dt(t,e[0].toLowerCase()+e.slice(1))||dt(t,xs(e))||dt(t,e))}let en=null,Ca=null;function da(t){const e=en;return en=t,Ca=t&&t.type.__scopeId||null,e}function Aa(t){Ca=t}function Pa(){Ca=null}function Ct(t,e=en,n){if(!e||t._n)return t;const i=(...s)=>{i._d&&Jd(-1);const o=da(e),r=t(...s);return da(o),i._d&&Jd(1),r};return i._n=!0,i._c=!0,i._d=!0,i}function Xa(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=da(t);try{if(n.shapeFlag&4){const S=s||i;_=jn(u.call(S,S,f,o,m,h,b)),p=l}else{const S=e;_=jn(S.length>1?S(o,{attrs:l,slots:a,emit:d}):S(o,null)),p=e.props?l:Km(l)}}catch(S){Wo.length=0,Ea(S,t,1),_=ke(Cn)}let w=_;if(p&&y!==!1){const S=Object.keys(p),{shapeFlag:I}=w;S.length&&I&7&&(r&&S.some(Vc)&&(p=Jm(p,r)),w=Vi(w,p))}return n.dirs&&(w=Vi(w),w.dirs=w.dirs?w.dirs.concat(n.dirs):n.dirs),n.transition&&(w.transition=n.transition),_=w,da(T),_}const Km=t=>{let e;for(const n in t)(n==="class"||n==="style"||ya(n))&&((e||(e={}))[n]=t[n]);return e},Jm=(t,e)=>{const n={};for(const i in t)(!Vc(i)||!(i.slice(9)in e))&&(n[i]=t[i]);return n};function Qm(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?$d(i,r,d):!!r;if(l&8){const u=e.dynamicProps;for(let f=0;f<u.length;f++){const h=u[f];if(r[h]!==i[h]&&!Ta(d,h))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:i===r?!1:i?r?$d(i,r,d):!0:!!r;return!1}function $d(t,e,n){const i=Object.keys(e);if(i.length!==Object.keys(t).length)return!0;for(let s=0;s<i.length;s++){const o=i[s];if(e[o]!==t[o]&&!Ta(n,o))return!0}return!1}function e_({vnode:t,parent:e},n){for(;e&&e.subTree===t;)(t=e.vnode).el=n,e=e.parent}const t_=t=>t.__isSuspense;function n_(t,e){e&&e.pendingBranch?$e(t)?e.effects.push(...t):e.effects.push(t):qm(t)}function Jr(t,e){if(Ht){let n=Ht.provides;const i=Ht.parent&&Ht.parent.provides;i===n&&(n=Ht.provides=Object.create(i)),n[t]=e}}function Ni(t,e,n=!1){const i=Ht||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 Hd={};function Ho(t,e,n){return wf(t,e,n)}function wf(t,e,{immediate:n,deep:i,flush:s,onTrack:o,onTrigger:r}=Mt){const a=Ht;let l,d=!1,u=!1;if(Qt(t)?(l=()=>t.value,d=Nl(t)):Ks(t)?(l=()=>t,i=!0):$e(t)?(u=!0,d=t.some(p=>Ks(p)||Nl(p)),l=()=>t.map(p=>{if(Qt(p))return p.value;if(Ks(p))return fs(p);if(nt(p))return Oi(p,a,2)})):nt(t)?e?l=()=>Oi(t,a,2):l=()=>{if(!(a&&a.isUnmounted))return f&&f(),Tn(t,a,3,[h])}:l=Bn,e&&i){const p=l;l=()=>fs(p())}let f,h=p=>{f=_.onStop=()=>{Oi(p,a,4)}};if(ir)return h=Bn,e?n&&Tn(e,a,3,[l(),u?[]:void 0,h]):l(),Bn;let m=u?[]:Hd;const b=()=>{if(!!_.active)if(e){const p=_.run();(i||d||(u?p.some((T,w)=>Ko(T,m[w])):Ko(p,m)))&&(f&&f(),Tn(e,a,3,[p,m===Hd?void 0:m,h]),m=p)}else _.run()};b.allowRecurse=!!e;let y;s==="sync"?y=b:s==="post"?y=()=>un(b,a&&a.suspense):y=()=>Ym(b);const _=new Wc(l,y);return e?n?b():m=_.run():s==="post"?un(_.run.bind(_),a&&a.suspense):_.run(),()=>{_.stop(),a&&a.scope&&$c(a.scope.effects,_)}}function i_(t,e,n){const i=this.proxy,s=zt(t)?t.includes(".")?Tf(i,t):()=>i[t]:t.bind(i,i);let o;nt(e)?o=e:(o=e.handler,n=e);const r=Ht;no(this);const a=wf(s,o.bind(i),n);return r?no(r):gs(),a}function Tf(t,e){const n=e.split(".");return()=>{let i=t;for(let s=0;s<n.length&&i;s++)i=i[n[s]];return i}}function fs(t,e){if(!Ft(t)||t.__v_skip||(e=e||new Set,e.has(t)))return t;if(e.add(t),Qt(t))fs(t.value,e);else if($e(t))for(let n=0;n<t.length;n++)fs(t[n],e);else if(po(t)||Zs(t))t.forEach(n=>{fs(n,e)});else if(Zh(t))for(const n in t)fs(t[n],e);return t}function s_(){const t={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Df(()=>{t.isMounted=!0}),If(()=>{t.isUnmounting=!0}),t}const Sn=[Function,Array],o_={name:"BaseTransition",props:{mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Sn,onEnter:Sn,onAfterEnter:Sn,onEnterCancelled:Sn,onBeforeLeave:Sn,onLeave:Sn,onAfterLeave:Sn,onLeaveCancelled:Sn,onBeforeAppear:Sn,onAppear:Sn,onAfterAppear:Sn,onAppearCancelled:Sn},setup(t,{slots:e}){const n=k_(),i=s_();let s;return()=>{const o=e.default&&Pf(e.default(),!0);if(!o||!o.length)return;let r=o[0];if(o.length>1){for(const y of o)if(y.type!==Cn){r=y;break}}const a=pt(t),{mode:l}=a;if(i.isLeaving)return ja(r);const d=Gd(r);if(!d)return ja(r);const u=Bl(d,a,i,n);Vl(d,u);const f=n.subTree,h=f&&Gd(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!==Cn&&(!ls(d,h)||m)){const y=Bl(h,a,i,n);if(Vl(h,y),l==="out-in")return i.isLeaving=!0,y.afterLeave=()=>{i.isLeaving=!1,n.update()},ja(r);l==="in-out"&&d.type!==Cn&&(y.delayLeave=(_,p,T)=>{const w=Af(i,h);w[String(h.key)]=h,_._leaveCb=()=>{p(),_._leaveCb=void 0,delete u.delayedLeave},u.delayedLeave=T})}return r}}},Cf=o_;function Af(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 Bl(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=Af(n,t),I=(R,E)=>{R&&Tn(R,i,9,E)},P=(R,E)=>{const g=E[1];I(R,E),$e(R)?R.every(F=>F.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&&ls(t,g)&&g.el._leaveCb&&g.el._leaveCb(),I(E,[R])},enter(R){let E=l,g=d,F=u;if(!n.isMounted)if(s)E=_||l,g=p||d,F=T||u;else return;let O=!1;const $=R._enterCb=j=>{O||(O=!0,j?I(F,[R]):I(g,[R]),D.delayedLeave&&D.delayedLeave(),R._enterCb=void 0)};E?P(E,[R,$]):$()},leave(R,E){const g=String(t.key);if(R._enterCb&&R._enterCb(!0),n.isUnmounting)return E();I(f,[R]);let F=!1;const O=R._leaveCb=$=>{F||(F=!0,E(),$?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 Bl(R,e,n,i)}};return D}function ja(t){if(Ra(t))return t=Vi(t),t.children=null,t}function Gd(t){return Ra(t)?t.children?t.children[0]:void 0:t}function Vl(t,e){t.shapeFlag&6&&t.component?Vl(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 Pf(t,e=!1,n){let i=[],s=0;for(let o=0;o<t.length;o++){let r=t[o];const a=n==null?r.key:String(n)+String(r.key!=null?r.key:o);r.type===at?(r.patchFlag&128&&s++,i=i.concat(Pf(r.children,e,a))):(e||r.type!==Cn)&&i.push(a!=null?Vi(r,{key:a}):r)}if(s>1)for(let o=0;o<i.length;o++)i[o].patchFlag=-2;return i}function go(t){return nt(t)?{setup:t,name:t.name}:t}const Go=t=>!!t.type.__asyncLoader,Ra=t=>t.type.__isKeepAlive;function r_(t,e){Rf(t,"a",e)}function a_(t,e){Rf(t,"da",e)}function Rf(t,e,n=Ht){const i=t.__wdc||(t.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return t()});if(Da(e,i,n),n){let s=n.parent;for(;s&&s.parent;)Ra(s.parent.vnode)&&l_(i,e,n,s),s=s.parent}}function l_(t,e,n,i){const s=Da(e,t,i,!0);Ff(()=>{$c(i[e],s)},n)}function Da(t,e,n=Ht,i=!1){if(n){const s=n[t]||(n[t]=[]),o=e.__weh||(e.__weh=(...r)=>{if(n.isUnmounted)return;mo(),no(n);const a=Tn(e,n,t,r);return gs(),_o(),a});return i?s.unshift(o):s.push(o),o}}const _i=t=>(e,n=Ht)=>(!ir||t==="sp")&&Da(t,e,n),c_=_i("bm"),Df=_i("m"),d_=_i("bu"),u_=_i("u"),If=_i("bum"),Ff=_i("um"),h_=_i("sp"),f_=_i("rtg"),p_=_i("rtc");function m_(t,e=Ht){Da("ec",t,e)}function se(t,e){const n=en;if(n===null)return t;const i=Fa(n)||n.proxy,s=t.dirs||(t.dirs=[]);for(let o=0;o<e.length;o++){let[r,a,l,d=Mt]=e[o];nt(r)&&(r={mounted:r,updated:r}),r.deep&&fs(a),s.push({dir:r,instance:i,value:a,oldValue:void 0,arg:l,modifiers:d})}return t}function ji(t,e,n,i){const s=t.dirs,o=e&&e.dirs;for(let r=0;r<s.length;r++){const a=s[r];o&&(a.oldValue=o[r].value);let l=a.dir[i];l&&(mo(),Tn(l,n,8,[t.el,a,t,e]),_o())}}const Jc="components";function et(t,e){return Uf(Jc,t,!0,e)||t}const Lf=Symbol();function __(t){return zt(t)?Uf(Jc,t,!1)||t:t||Lf}function Uf(t,e,n=!0,i=!1){const s=en||Ht;if(s){const o=s.type;if(t===Jc){const a=G_(o,!1);if(a&&(a===e||a===ei(e)||a===Sa(ei(e))))return o}const r=Wd(s[t]||o[t],e)||Wd(s.appContext[t],e);return!r&&i?o:r}}function Wd(t,e){return t&&(t[e]||t[ei(e)]||t[Sa(ei(e))])}function wt(t,e,n,i){let s;const o=n&&n[i];if($e(t)||zt(t)){s=new Array(t.length);for(let r=0,a=t.length;r<a;r++)s[r]=e(t[r],r,void 0,o&&o[r])}else if(typeof t=="number"){s=new Array(t);for(let r=0;r<t;r++)s[r]=e(r+1,r,void 0,o&&o[r])}else if(Ft(t))if(t[Symbol.iterator])s=Array.from(t,(r,a)=>e(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;a<l;a++){const d=r[a];s[a]=e(t[d],d,a,o&&o[a])}}else s=[];return n&&(n[i]=s),s}function to(t,e,n={},i,s){if(en.isCE||en.parent&&Go(en.parent)&&en.parent.isCE)return ke("slot",e==="default"?null:{name:e},i&&i());let o=t[e];o&&o._c&&(o._d=!1),W();const r=o&&Of(o(n)),a=Jt(at,{key:n.key||`_${e}`},r||(i?i():[]),r&&t._===1?64:-2);return!s&&a.scopeId&&(a.slotScopeIds=[a.scopeId+"-s"]),o&&o._c&&(o._d=!0),a}function Of(t){return t.some(e=>fa(e)?!(e.type===Cn||e.type===at&&!Of(e.children)):!0)?t:null}const $l=t=>t?Zf(t)?Fa(t)||t.proxy:$l(t.parent):null,ua=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=>$l(t.parent),$root:t=>$l(t.root),$emit:t=>t.emit,$options:t=>zf(t),$forceUpdate:t=>t.f||(t.f=()=>bf(t.update)),$nextTick:t=>t.n||(t.n=vf.bind(t.proxy)),$watch:t=>i_.bind(t)}),g_={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];Hl&&(r[e]=0)}}const u=ua[e];let f,h;if(u)return e==="$attrs"&&bn(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(ua,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 Hl=!0;function v_(t){const e=zf(t),n=t.proxy,i=t.ctx;Hl=!1,e.beforeCreate&&Xd(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:F,components:O,directives:$,filters:j}=e;if(d&&b_(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);Ft(ae)&&(t.data=hr(ae))}if(Hl=!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):Bn,ye=!nt(G)&&nt(G.set)?G.set.bind(n):Bn,De=qn({get:fe,set:ye});Object.defineProperty(i,ae,{enumerable:!0,configurable:!0,get:()=>De.value,set:Be=>De.value=Be})}if(a)for(const ae in a)Nf(a[ae],i,n,ae);if(l){const ae=nt(l)?l.call(n):l;Reflect.ownKeys(ae).forEach(G=>{Jr(G,ae[G])})}u&&Xd(u,t,"c");function q(ae,G){$e(G)?G.forEach(fe=>ae(fe.bind(n))):G&&ae(G.bind(n))}if(q(c_,f),q(Df,h),q(d_,m),q(u_,b),q(r_,y),q(a_,_),q(m_,R),q(p_,P),q(f_,D),q(If,T),q(Ff,S),q(h_,E),$e(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===Bn&&(t.render=I),F!=null&&(t.inheritAttrs=F),O&&(t.components=O),$&&(t.directives=$)}function b_(t,e,n=Bn,i=!1){$e(t)&&(t=Gl(t));for(const s in t){const o=t[s];let r;Ft(o)?"default"in o?r=Ni(o.from||s,o.default,!0):r=Ni(o.from||s):r=Ni(o),Qt(r)&&i?Object.defineProperty(e,s,{enumerable:!0,configurable:!0,get:()=>r.value,set:a=>r.value=a}):e[s]=r}}function Xd(t,e,n){Tn($e(t)?t.map(i=>i.bind(e.proxy)):t.bind(e.proxy),e,n)}function Nf(t,e,n,i){const s=i.includes(".")?Tf(n,i):()=>n[i];if(zt(t)){const o=e[t];nt(o)&&Ho(s,o)}else if(nt(t))Ho(s,t.bind(n));else if(Ft(t))if($e(t))t.forEach(o=>Nf(o,e,n,i));else{const o=nt(t.handler)?t.handler.bind(n):e[t.handler];nt(o)&&Ho(s,o,t)}}function zf(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=>ha(l,d,r,!0)),ha(l,e,r)),o.set(e,l),l}function ha(t,e,n,i=!1){const{mixins:s,extends:o}=e;o&&ha(t,o,n,!0),s&&s.forEach(r=>ha(t,r,n,!0));for(const r in e)if(!(i&&r==="expose")){const a=y_[r]||n&&n[r];t[r]=a?a(t[r],e[r]):e[r]}return t}const y_={data:jd,props:os,emits:os,methods:os,computed:os,beforeCreate:on,created:on,beforeMount:on,mounted:on,beforeUpdate:on,updated:on,beforeDestroy:on,beforeUnmount:on,destroyed:on,unmounted:on,activated:on,deactivated:on,errorCaptured:on,serverPrefetch:on,components:os,directives:os,watch:S_,provide:jd,inject:x_};function jd(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 x_(t,e){return os(Gl(t),Gl(e))}function Gl(t){if($e(t)){const e={};for(let n=0;n<t.length;n++)e[t[n]]=t[n];return e}return t}function on(t,e){return t?[...new Set([].concat(t,e))]:e}function os(t,e){return t?jt(jt(Object.create(null),t),e):e}function S_(t,e){if(!t)return e;if(!e)return t;const n=jt(Object.create(null),t);for(const i in e)n[i]=on(t[i],e[i]);return n}function M_(t,e,n,i=!1){const s={},o={};la(o,Ia,1),t.propsDefaults=Object.create(null),kf(t,e,s,o);for(const r in t.propsOptions[0])r in s||(s[r]=void 0);n?t.props=i?s:Bm(s):t.type.props?t.props=s:t.props=o,t.attrs=o}function E_(t,e,n,i){const{props:s,attrs:o,vnode:{patchFlag:r}}=t,a=pt(s),[l]=t.propsOptions;let d=!1;if((i||r>0)&&!(r&16)){if(r&8){const u=t.vnode.dynamicProps;for(let f=0;f<u.length;f++){let h=u[f];if(Ta(t.emitsOptions,h))continue;const m=e[h];if(l)if(dt(o,h))m!==o[h]&&(o[h]=m,d=!0);else{const b=ei(h);s[b]=Wl(l,a,b,m,t,!1)}else m!==o[h]&&(o[h]=m,d=!0)}}}else{kf(t,e,s,o)&&(d=!0);let u;for(const f in a)(!e||!dt(e,f)&&((u=xs(f))===f||!dt(e,u)))&&(l?n&&(n[f]!==void 0||n[u]!==void 0)&&(s[f]=Wl(l,a,f,void 0,t,!0)):delete s[f]);if(o!==a)for(const f in o)(!e||!dt(e,f)&&!0)&&(delete o[f],d=!0)}d&&mi(t,"set","$attrs")}function kf(t,e,n,i){const[s,o]=t.propsOptions;let r=!1,a;if(e)for(let l in e){if(Zr(l))continue;const d=e[l];let u;s&&dt(s,u=ei(l))?!o||!o.includes(u)?n[u]=d:(a||(a={}))[u]=d:Ta(t.emitsOptions,l)||(!(l in i)||d!==i[l])&&(i[l]=d,r=!0)}if(o){const l=pt(n),d=a||Mt;for(let u=0;u<o.length;u++){const f=o[u];n[f]=Wl(s,l,f,d[f],t,!dt(d,f))}}return r}function Wl(t,e,n,i,s,o){const r=t[n];if(r!=null){const a=dt(r,"default");if(a&&i===void 0){const l=r.default;if(r.type!==Function&&nt(l)){const{propsDefaults:d}=s;n in d?i=d[n]:(no(s),i=d[n]=l.call(null,e),gs())}else i=l}r[0]&&(o&&!a?i=!1:r[1]&&(i===""||i===xs(n))&&(i=!0))}return i}function Bf(t,e,n=!1){const i=e.propsCache,s=i.get(t);if(s)return s;const o=t.props,r={},a=[];let l=!1;if(!nt(t)){const u=f=>{l=!0;const[h,m]=Bf(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,qs),qs;if($e(o))for(let u=0;u<o.length;u++){const f=ei(o[u]);Yd(f)&&(r[f]=Mt)}else if(o)for(const u in o){const f=ei(u);if(Yd(f)){const h=o[u],m=r[f]=$e(h)||nt(h)?{type:h}:h;if(m){const b=Kd(Boolean,m.type),y=Kd(String,m.type);m[0]=b>-1,m[1]=y<0||b<y,(b>-1||dt(m,"default"))&&a.push(f)}}}const d=[r,a];return i.set(t,d),d}function Yd(t){return t[0]!=="$"}function qd(t){const e=t&&t.toString().match(/^\s*function (\w+)/);return e?e[1]:t===null?"null":""}function Zd(t,e){return qd(t)===qd(e)}function Kd(t,e){return $e(e)?e.findIndex(n=>Zd(n,t)):nt(e)&&Zd(e,t)?0:-1}const Vf=t=>t[0]==="_"||t==="$stable",Qc=t=>$e(t)?t.map(jn):[jn(t)],w_=(t,e,n)=>{if(e._n)return e;const i=Ct((...s)=>Qc(e(...s)),n);return i._c=!1,i},$f=(t,e,n)=>{const i=t._ctx;for(const s in t){if(Vf(s))continue;const o=t[s];if(nt(o))e[s]=w_(s,o,i);else if(o!=null){const r=Qc(o);e[s]=()=>r}}},Hf=(t,e)=>{const n=Qc(e);t.slots.default=()=>n},T_=(t,e)=>{if(t.vnode.shapeFlag&32){const n=e._;n?(t.slots=pt(e),la(e,"_",n)):$f(e,t.slots={})}else t.slots={},e&&Hf(t,e);la(t.slots,Ia,1)},C_=(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,$f(e,s)),r=e}else e&&(Hf(t,e),r={default:1});if(o)for(const a in s)!Vf(a)&&!(a in r)&&delete s[a]};function Gf(){return{app:null,config:{isNativeTag:rm,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 A_=0;function P_(t,e){return function(i,s=null){nt(i)||(i=Object.assign({},i)),s!=null&&!Ft(s)&&(s=null);const o=Gf(),r=new Set;let a=!1;const l=o.app={_uid:A_++,_component:i,_props:s,_container:null,_context:o,_instance:null,version:X_,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,Fa(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 Xl(t,e,n,i,s=!1){if($e(t)){t.forEach((h,m)=>Xl(h,e&&($e(e)?e[m]:e),n,i,s));return}if(Go(i)&&!s)return;const o=i.shapeFlag&4?Fa(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))Oi(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?$e(y)&&$c(y,o):$e(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,un(b,n)):b()}}}const un=n_;function R_(t){return D_(t)}function D_(t,e){const n=hm();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=Bn,cloneNode:b,insertStaticContent:y}=t,_=(A,x,Z,ie=null,te=null,ne=null,_e=!1,Q=null,M=!!x.dynamicChildren)=>{if(A===x)return;A&&!ls(A,x)&&(ie=ue(A),Je(A,te,ne,!0),A=null),x.patchFlag===-2&&(M=!1,x.dynamicChildren=null);const{type:v,ref:U,shapeFlag:B}=x;switch(v){case ed:p(A,x,Z,ie);break;case Cn:T(A,x,Z,ie);break;case Ya:A==null&&w(x,Z,ie,_e);break;case at:$(A,x,Z,ie,te,ne,_e,Q,M);break;default:B&1?P(A,x,Z,ie,te,ne,_e,Q,M):B&6?j(A,x,Z,ie,te,ne,_e,Q,M):(B&64||B&128)&&v.process(A,x,Z,ie,te,ne,_e,Q,M,Se)}U!=null&&te&&Xl(U,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,_e,Q,M)=>{_e=_e||x.type==="svg",A==null?D(x,Z,ie,te,ne,_e,Q,M):g(A,x,te,ne,_e,Q,M)},D=(A,x,Z,ie,te,ne,_e,Q)=>{let M,v;const{type:U,props:B,shapeFlag:X,transition:H,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&&U!=="foreignObject",_e,Q),pe&&ji(A,null,ie,"created"),B){for(const Me in B)Me!=="value"&&!Zr(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)&&Gn(v,ie,A)}R(M,A,A.scopeId,_e,ie)}pe&&ji(A,null,ie,"beforeMount");const be=(!te||te&&!te.pendingBranch)&&H&&!H.persisted;be&&H.beforeEnter(M),i(M,x,Z),((v=B&&B.onVnodeMounted)||be||pe)&&un(()=>{v&&Gn(v,ie,A),be&&H.enter(M),pe&&ji(A,null,ie,"mounted")},te)},R=(A,x,Z,ie,te)=>{if(Z&&m(A,Z),ie)for(let ne=0;ne<ie.length;ne++)m(A,ie[ne]);if(te){let ne=te.subTree;if(x===ne){const _e=te.vnode;R(A,_e,_e.scopeId,_e.slotScopeIds,te.parent)}}},E=(A,x,Z,ie,te,ne,_e,Q,M=0)=>{for(let v=M;v<A.length;v++){const U=A[v]=Q?Ri(A[v]):jn(A[v]);_(null,U,x,Z,ie,te,ne,_e,Q)}},g=(A,x,Z,ie,te,ne,_e)=>{const Q=x.el=A.el;let{patchFlag:M,dynamicChildren:v,dirs:U}=x;M|=A.patchFlag&16;const B=A.props||Mt,X=x.props||Mt;let H;Z&&Yi(Z,!1),(H=X.onVnodeBeforeUpdate)&&Gn(H,Z,x,A),U&&ji(x,A,Z,"beforeUpdate"),Z&&Yi(Z,!0);const ge=te&&x.type!=="foreignObject";if(v?F(A.dynamicChildren,v,Q,Z,ie,ge,ne):_e||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<pe.length;be++){const Me=pe[be],he=B[Me],Ae=X[Me];(Ae!==he||Me==="value")&&o(Q,Me,he,Ae,te,A.children,Z,ie,Y)}}M&1&&A.children!==x.children&&u(Q,x.children)}else!_e&&v==null&&O(Q,x,B,X,Z,ie,te);((H=X.onVnodeUpdated)||U)&&un(()=>{H&&Gn(H,Z,x,A),U&&ji(x,A,Z,"updated")},ie)},F=(A,x,Z,ie,te,ne,_e)=>{for(let Q=0;Q<x.length;Q++){const M=A[Q],v=x[Q],U=M.el&&(M.type===at||!ls(M,v)||M.shapeFlag&70)?f(M.el):Z;_(M,v,U,null,ie,te,ne,_e,!0)}},O=(A,x,Z,ie,te,ne,_e)=>{if(Z!==ie){for(const Q in ie){if(Zr(Q))continue;const M=ie[Q],v=Z[Q];M!==v&&Q!=="value"&&o(A,Q,v,M,_e,x.children,te,ne,Y)}if(Z!==Mt)for(const Q in Z)!Zr(Q)&&!(Q in ie)&&o(A,Q,Z[Q],null,_e,x.children,te,ne,Y);"value"in ie&&o(A,"value",Z.value,ie.value)}},$=(A,x,Z,ie,te,ne,_e,Q,M)=>{const v=x.el=A?A.el:a(""),U=x.anchor=A?A.anchor:a("");let{patchFlag:B,dynamicChildren:X,slotScopeIds:H}=x;H&&(Q=Q?Q.concat(H):H),A==null?(i(v,Z,ie),i(U,Z,ie),E(x.children,Z,U,te,ne,_e,Q,M)):B>0&&B&64&&X&&A.dynamicChildren?(F(A.dynamicChildren,X,Z,te,ne,_e,Q),(x.key!=null||te&&x===te.subTree)&&Wf(A,x,!0)):fe(A,x,Z,U,te,ne,_e,Q,M)},j=(A,x,Z,ie,te,ne,_e,Q,M)=>{x.slotScopeIds=Q,A==null?x.shapeFlag&512?te.ctx.activate(x,Z,ie,_e,M):re(x,Z,ie,te,ne,_e,M):q(A,x,M)},re=(A,x,Z,ie,te,ne,_e)=>{const Q=A.component=z_(A,ie,te);if(Ra(A)&&(Q.ctx.renderer=Se),B_(Q),Q.asyncDep){if(te&&te.registerDep(Q,ae),!A.el){const M=Q.subTree=ke(Cn);T(null,M,x,Z)}return}ae(Q,A,x,Z,te,ne,_e)},q=(A,x,Z)=>{const ie=x.component=A.component;if(Qm(A,x,Z))if(ie.asyncDep&&!ie.asyncResolved){G(ie,x,Z);return}else ie.next=x,jm(ie.update),ie.update();else x.el=A.el,ie.vnode=x},ae=(A,x,Z,ie,te,ne,_e)=>{const Q=()=>{if(A.isMounted){let{next:U,bu:B,u:X,parent:H,vnode:ge}=A,pe=U,be;Yi(A,!1),U?(U.el=ge.el,G(A,U,_e)):U=ge,B&&Kr(B),(be=U.props&&U.props.onVnodeBeforeUpdate)&&Gn(be,H,U,ge),Yi(A,!0);const Me=Xa(A),he=A.subTree;A.subTree=Me,_(he,Me,f(he.el),ue(he),A,te,ne),U.el=Me.el,pe===null&&e_(A,Me.el),X&&un(X,te),(be=U.props&&U.props.onVnodeUpdated)&&un(()=>Gn(be,H,U,ge),te)}else{let U;const{el:B,props:X}=x,{bm:H,m:ge,parent:pe}=A,be=Go(x);if(Yi(A,!1),H&&Kr(H),!be&&(U=X&&X.onVnodeBeforeMount)&&Gn(U,pe,x),Yi(A,!0),B&&Le){const Me=()=>{A.subTree=Xa(A),Le(B,A.subTree,A,te,null)};be?x.type.__asyncLoader().then(()=>!A.isUnmounted&&Me()):Me()}else{const Me=A.subTree=Xa(A);_(null,Me,Z,ie,A,te,ne),x.el=Me.el}if(ge&&un(ge,te),!be&&(U=X&&X.onVnodeMounted)){const Me=x;un(()=>Gn(U,pe,Me),te)}(x.shapeFlag&256||pe&&Go(pe.vnode)&&pe.vnode.shapeFlag&256)&&A.a&&un(A.a,te),A.isMounted=!0,x=Z=ie=null}},M=A.effect=new Wc(Q,()=>bf(v),A.scope),v=A.update=()=>M.run();v.id=A.uid,Yi(A,!0),v()},G=(A,x,Z)=>{x.component=A;const ie=A.vnode.props;A.vnode=x,A.next=null,E_(A,x.props,ie,Z),C_(A,x.children,Z),mo(),wa(void 0,A.update),_o()},fe=(A,x,Z,ie,te,ne,_e,Q,M=!1)=>{const v=A&&A.children,U=A?A.shapeFlag:0,B=x.children,{patchFlag:X,shapeFlag:H}=x;if(X>0){if(X&128){De(v,B,Z,ie,te,ne,_e,Q,M);return}else if(X&256){ye(v,B,Z,ie,te,ne,_e,Q,M);return}}H&8?(U&16&&Y(v,te,ne),B!==v&&u(Z,B)):U&16?H&16?De(v,B,Z,ie,te,ne,_e,Q,M):Y(v,te,ne,!0):(U&8&&u(Z,""),H&16&&E(B,Z,ie,te,ne,_e,Q,M))},ye=(A,x,Z,ie,te,ne,_e,Q,M)=>{A=A||qs,x=x||qs;const v=A.length,U=x.length,B=Math.min(v,U);let X;for(X=0;X<B;X++){const H=x[X]=M?Ri(x[X]):jn(x[X]);_(A[X],H,Z,null,te,ne,_e,Q,M)}v>U?Y(A,te,ne,!0,!1,B):E(x,Z,ie,te,ne,_e,Q,M,B)},De=(A,x,Z,ie,te,ne,_e,Q,M)=>{let v=0;const U=x.length;let B=A.length-1,X=U-1;for(;v<=B&&v<=X;){const H=A[v],ge=x[v]=M?Ri(x[v]):jn(x[v]);if(ls(H,ge))_(H,ge,Z,null,te,ne,_e,Q,M);else break;v++}for(;v<=B&&v<=X;){const H=A[B],ge=x[X]=M?Ri(x[X]):jn(x[X]);if(ls(H,ge))_(H,ge,Z,null,te,ne,_e,Q,M);else break;B--,X--}if(v>B){if(v<=X){const H=X+1,ge=H<U?x[H].el:ie;for(;v<=X;)_(null,x[v]=M?Ri(x[v]):jn(x[v]),Z,ge,te,ne,_e,Q,M),v++}}else if(v>X)for(;v<=B;)Je(A[v],te,ne,!0),v++;else{const H=v,ge=v,pe=new Map;for(v=ge;v<=X;v++){const Ye=x[v]=M?Ri(x[v]):jn(x[v]);Ye.key!=null&&pe.set(Ye.key,v)}let be,Me=0;const he=X-ge+1;let Ae=!1,Xe=0;const He=new Array(he);for(v=0;v<he;v++)He[v]=0;for(v=H;v<=B;v++){const Ye=A[v];if(Me>=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(He[be-ge]===0&&ls(Ye,x[be])){Ge=be;break}Ge===void 0?Je(Ye,te,ne,!0):(He[Ge-ge]=v+1,Ge>=Xe?Xe=Ge:Ae=!0,_(Ye,x[Ge],Z,null,te,ne,_e,Q,M),Me++)}const Ie=Ae?I_(He):qs;for(be=Ie.length-1,v=he-1;v>=0;v--){const Ye=ge+v,Ge=x[Ye],gt=Ye+1<U?x[Ye+1].el:ie;He[v]===0?_(null,Ge,Z,gt,te,ne,_e,Q,M):Ae&&(be<0||v!==Ie[be]?Be(Ge,Z,gt,2):be--)}}},Be=(A,x,Z,ie,te=null)=>{const{el:ne,type:_e,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){_e.move(A,x,Z,Se);return}if(_e===at){i(ne,x,Z);for(let B=0;B<M.length;B++)Be(M[B],x,Z,ie);i(A.anchor,x,Z);return}if(_e===Ya){S(A,x,Z);return}if(ie!==2&&v&1&&Q)if(ie===0)Q.beforeEnter(ne),i(ne,x,Z),un(()=>Q.enter(ne),te);else{const{leave:B,delayLeave:X,afterLeave:H}=Q,ge=()=>i(ne,x,Z),pe=()=>{B(ne,()=>{ge(),H&&H()})};X?X(ne,ge,pe):pe()}else i(ne,x,Z)},Je=(A,x,Z,ie=!1,te=!1)=>{const{type:ne,props:_e,ref:Q,children:M,dynamicChildren:v,shapeFlag:U,patchFlag:B,dirs:X}=A;if(Q!=null&&Xl(Q,null,Z,A,!0),U&256){x.ctx.deactivate(A);return}const H=U&1&&X,ge=!Go(A);let pe;if(ge&&(pe=_e&&_e.onVnodeBeforeUnmount)&&Gn(pe,x,A),U&6)le(A.component,Z,ie);else{if(U&128){A.suspense.unmount(Z,ie);return}H&&ji(A,null,x,"beforeUnmount"),U&64?A.type.remove(A,x,Z,te,Se,ie):v&&(ne!==at||B>0&&B&64)?Y(v,x,Z,!1,!0):(ne===at&&B&384||!te&&U&16)&&Y(M,x,Z),ie&&ce(A)}(ge&&(pe=_e&&_e.onVnodeUnmounted)||H)&&un(()=>{pe&&Gn(pe,x,A),H&&ji(A,null,x,"unmounted")},Z)},ce=A=>{const{type:x,el:Z,anchor:ie,transition:te}=A;if(x===at){N(Z,ie);return}if(x===Ya){I(A);return}const ne=()=>{s(Z),te&&!te.persisted&&te.afterLeave&&te.afterLeave()};if(A.shapeFlag&1&&te&&!te.persisted){const{leave:_e,delayLeave:Q}=te,M=()=>_e(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:_e,um:Q}=A;ie&&Kr(ie),te.stop(),ne&&(ne.active=!1,Je(_e,A,x,Z)),Q&&un(Q,x),un(()=>{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 _e=ne;_e<A.length;_e++)Je(A[_e],x,Z,ie,te)},ue=A=>A.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),Sf(),x._vnode=A},Se={p:_,um:Je,m:Be,r:ce,mt:re,mc:E,pc:fe,pbc:F,n:ue,o:t};let Ne,Le;return e&&([Ne,Le]=e(Se)),{render:Oe,hydrate:Ne,createApp:P_(Oe,Ne)}}function Yi({effect:t,update:e},n){t.allowRecurse=e.allowRecurse=n}function Wf(t,e,n=!1){const i=t.children,s=e.children;if($e(i)&&$e(s))for(let o=0;o<i.length;o++){const r=i[o];let a=s[o];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=s[o]=Ri(s[o]),a.el=r.el),n||Wf(r,a))}}function I_(t){const e=t.slice(),n=[0];let i,s,o,r,a;const l=t.length;for(i=0;i<l;i++){const d=t[i];if(d!==0){if(s=n[n.length-1],t[s]<d){e[i]=s,n.push(i);continue}for(o=0,r=n.length-1;o<r;)a=o+r>>1,t[n[a]]<d?o=a+1:r=a;d<t[n[o]]&&(o>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 F_=t=>t.__isTeleport,at=Symbol(void 0),ed=Symbol(void 0),Cn=Symbol(void 0),Ya=Symbol(void 0),Wo=[];let zn=null;function W(t=!1){Wo.push(zn=t?null:[])}function L_(){Wo.pop(),zn=Wo[Wo.length-1]||null}let nr=1;function Jd(t){nr+=t}function Xf(t){return t.dynamicChildren=nr>0?zn||qs:null,L_(),nr>0&&zn&&zn.push(t),t}function ee(t,e,n,i,s,o){return Xf(c(t,e,n,i,s,o,!0))}function Jt(t,e,n,i,s){return Xf(ke(t,e,n,i,s,!0))}function fa(t){return t?t.__v_isVNode===!0:!1}function ls(t,e){return t.type===e.type&&t.key===e.key}const Ia="__vInternal",jf=({key:t})=>t!=null?t:null,Qr=({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===at?0:1,r=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&jf(e),ref:e&&Qr(e),scopeId:Ca,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?(td(l,n),o&128&&t.normalize(l)):n&&(l.shapeFlag|=zt(n)?8:16),nr>0&&!r&&zn&&(l.patchFlag>0||o&6)&&l.patchFlag!==32&&zn.push(l),l}const ke=U_;function U_(t,e=null,n=null,i=0,s=null,o=!1){if((!t||t===Lf)&&(t=Cn),fa(t)){const a=Vi(t,e,!0);return n&&td(a,n),nr>0&&!o&&zn&&(a.shapeFlag&6?zn[zn.indexOf(t)]=a:zn.push(a)),a.patchFlag|=-2,a}if(W_(t)&&(t=t.__vccOpts),e){e=Yf(e);let{class:a,style:l}=e;a&&!zt(a)&&(e.class=je(a)),Ft(l)&&(cf(l)&&!$e(l)&&(l=jt({},l)),e.style=fo(l))}const r=zt(t)?1:t_(t)?128:F_(t)?64:Ft(t)?4:nt(t)?2:0;return c(t,e,n,i,s,r,o,!0)}function Yf(t){return t?cf(t)||Ia in t?jt({},t):t:null}function Vi(t,e,n=!1){const{props:i,ref:s,patchFlag:o,children:r}=t,a=e?qf(i||{},e):i;return{__v_isVNode:!0,__v_skip:!0,type:t.type,props:a,key:a&&jf(a),ref:e&&e.ref?n&&s?$e(s)?s.concat(Qr(e)):[s,Qr(e)]:Qr(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!==at?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&&Vi(t.ssContent),ssFallback:t.ssFallback&&Vi(t.ssFallback),el:t.el,anchor:t.anchor}}function we(t=" ",e=0){return ke(ed,null,t,e)}function ot(t="",e=!1){return e?(W(),Jt(Cn,null,t)):ke(Cn,null,t)}function jn(t){return t==null||typeof t=="boolean"?ke(Cn):$e(t)?ke(at,null,t.slice()):typeof t=="object"?Ri(t):ke(ed,null,String(t))}function Ri(t){return t.el===null||t.memo?t:Vi(t)}function td(t,e){let n=0;const{shapeFlag:i}=t;if(e==null)e=null;else if($e(e))n=16;else if(typeof e=="object")if(i&65){const s=e.default;s&&(s._c&&(s._d=!1),td(t,s()),s._c&&(s._d=!0));return}else{n=32;const s=e._;!s&&!(Ia 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=[we(e)]):n=8);t.children=e,t.shapeFlag|=n}function qf(...t){const e={};for(let n=0;n<t.length;n++){const i=t[n];for(const s in i)if(s==="class")e.class!==i.class&&(e.class=je([e.class,i.class]));else if(s==="style")e.style=fo([e.style,i.style]);else if(ya(s)){const o=e[s],r=i[s];r&&o!==r&&!($e(o)&&o.includes(r))&&(e[s]=o?[].concat(o,r):r)}else s!==""&&(e[s]=i[s])}return e}function Gn(t,e,n,i=null){Tn(t,e,7,[n,i])}const O_=Gf();let N_=0;function z_(t,e,n){const i=t.type,s=(e?e.appContext:t.appContext)||O_,o={uid:N_++,vnode:t,type:i,parent:e,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,scope:new fm(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(s.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Bf(i,s),emitsOptions:Ef(i,s),emit:null,emitted:null,propsDefaults:Mt,inheritAttrs:i.inheritAttrs,ctx:Mt,data:Mt,props:Mt,attrs:Mt,slots:Mt,refs:Mt,setupState:Mt,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return o.ctx={_:o},o.root=e?e.root:o,o.emit=Zm.bind(null,o),t.ce&&t.ce(o),o}let Ht=null;const k_=()=>Ht||en,no=t=>{Ht=t,t.scope.on()},gs=()=>{Ht&&Ht.scope.off(),Ht=null};function Zf(t){return t.vnode.shapeFlag&4}let ir=!1;function B_(t,e=!1){ir=e;const{props:n,children:i}=t.vnode,s=Zf(t);M_(t,n,s,e),T_(t,i);const o=s?V_(t,e):void 0;return ir=!1,o}function V_(t,e){const n=t.type;t.accessCache=Object.create(null),t.proxy=df(new Proxy(t.ctx,g_));const{setup:i}=n;if(i){const s=t.setupContext=i.length>1?H_(t):null;no(t),mo();const o=Oi(i,t,0,[t.props,s]);if(_o(),gs(),Yh(o)){if(o.then(gs,gs),e)return o.then(r=>{Qd(t,r,e)}).catch(r=>{Ea(r,t,0)});t.asyncDep=o}else Qd(t,o,e)}else Kf(t,e)}function Qd(t,e,n){nt(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:Ft(e)&&(t.setupState=_f(e)),Kf(t,n)}let eu;function Kf(t,e,n){const i=t.type;if(!t.render){if(!e&&eu&&!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=eu(s,d)}}t.render=i.render||Bn}no(t),mo(),v_(t),_o(),gs()}function $_(t){return new Proxy(t.attrs,{get(e,n){return bn(t,"get","$attrs"),e[n]}})}function H_(t){const e=i=>{t.exposed=i||{}};let n;return{get attrs(){return n||(n=$_(t))},slots:t.slots,emit:t.emit,expose:e}}function Fa(t){if(t.exposed)return t.exposeProxy||(t.exposeProxy=new Proxy(_f(df(t.exposed)),{get(e,n){if(n in e)return e[n];if(n in ua)return ua[n](t)}}))}function G_(t,e=!0){return nt(t)?t.displayName||t.name:t.name||e&&t.__name}function W_(t){return nt(t)&&"__vccOpts"in t}const qn=(t,e)=>Gm(t,e,ir);function nd(t,e,n){const i=arguments.length;return i===2?Ft(e)&&!$e(e)?fa(e)?ke(t,null,[e]):ke(t,e):ke(t,null,e):(i>3?n=Array.prototype.slice.call(arguments,2):i===3&&fa(n)&&(n=[n]),ke(t,e,n))}const X_="3.2.37",j_="http://www.w3.org/2000/svg",cs=typeof document!="undefined"?document:null,tu=cs&&cs.createElement("template"),Y_={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?cs.createElementNS(j_,t):cs.createElement(t,n?{is:n}:void 0);return t==="select"&&i&&i.multiple!=null&&s.setAttribute("multiple",i.multiple),s},createText:t=>cs.createTextNode(t),createComment:t=>cs.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>cs.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{tu.innerHTML=i?`<svg>${t}</svg>`:t;const a=tu.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 q_(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 Z_(t,e,n){const i=t.style,s=zt(n);if(n&&!s){for(const o in n)jl(i,o,n[o]);if(e&&!zt(e))for(const o in e)n[o]==null&&jl(i,o,"")}else{const o=i.display;s?e!==n&&(i.cssText=n):e&&t.removeAttribute("style"),"_vod"in t&&(i.display=o)}}const nu=/\s*!important$/;function jl(t,e,n){if($e(n))n.forEach(i=>jl(t,e,i));else if(n==null&&(n=""),e.startsWith("--"))t.setProperty(e,n);else{const i=K_(t,e);nu.test(n)?t.setProperty(xs(i),n.replace(nu,""),"important"):t[i]=n}}const iu=["Webkit","Moz","ms"],qa={};function K_(t,e){const n=qa[e];if(n)return n;let i=ei(e);if(i!=="filter"&&i in t)return qa[e]=i;i=Sa(i);for(let s=0;s<iu.length;s++){const o=iu[s]+i;if(o in t)return qa[e]=o}return e}const su="http://www.w3.org/1999/xlink";function J_(t,e,n,i,s){if(i&&e.startsWith("xlink:"))n==null?t.removeAttributeNS(su,e.slice(6,e.length)):t.setAttributeNS(su,e,n);else{const o=em(e);n==null||o&&!Xh(n)?t.removeAttribute(e):t.setAttribute(e,o?"":n)}}function Q_(t,e,n,i,s,o,r){if(e==="innerHTML"||e==="textContent"){i&&r(i,s,o),t[e]=n==null?"":n;return}if(e==="value"&&t.tagName!=="PROGRESS"&&!t.tagName.includes("-")){t._value=n;const l=n==null?"":n;(t.value!==l||t.tagName==="OPTION")&&(t.value=l),n==null&&t.removeAttribute(e);return}let a=!1;if(n===""||n==null){const l=typeof t[e];l==="boolean"?n=Xh(n):n==null&&l==="string"?(n="",a=!0):l==="number"&&(n=0,a=!0)}try{t[e]=n}catch{}a&&t.removeAttribute(e)}const[Jf,eg]=(()=>{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 Yl=0;const tg=Promise.resolve(),ng=()=>{Yl=0},ig=()=>Yl||(tg.then(ng),Yl=Jf());function Fi(t,e,n,i){t.addEventListener(e,n,i)}function sg(t,e,n,i){t.removeEventListener(e,n,i)}function og(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]=rg(e);if(i){const d=o[e]=ag(i,s);Fi(t,a,d,l)}else r&&(sg(t,a,r,l),o[e]=void 0)}}const ou=/(?:Once|Passive|Capture)$/;function rg(t){let e;if(ou.test(t)){e={};let n;for(;n=t.match(ou);)t=t.slice(0,t.length-n[0].length),e[n[0].toLowerCase()]=!0}return[xs(t.slice(2)),e]}function ag(t,e){const n=i=>{const s=i.timeStamp||Jf();(eg||s>=n.attached-1)&&Tn(lg(i,n.value),e,5,[i])};return n.value=t,n.attached=ig(),n}function lg(t,e){if($e(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 ru=/^on[a-z]/,cg=(t,e,n,i,s=!1,o,r,a,l)=>{e==="class"?q_(t,i,s):e==="style"?Z_(t,n,i):ya(e)?Vc(e)||og(t,e,n,i,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):dg(t,e,i,s))?Q_(t,e,i,o,r,a,l):(e==="true-value"?t._trueValue=i:e==="false-value"&&(t._falseValue=i),J_(t,e,i,s))};function dg(t,e,n,i){return i?!!(e==="innerHTML"||e==="textContent"||e in t&&ru.test(e)&&nt(n)):e==="spellcheck"||e==="draggable"||e==="translate"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA"||ru.test(e)&&zt(n)?!1:e in t}const vi="transition",Eo="animation",id=(t,{slots:e})=>nd(Cf,ug(t),e);id.displayName="Transition";const Qf={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};id.props=jt({},Cf.props,Qf);const qi=(t,e=[])=>{$e(t)?t.forEach(n=>n(...e)):t&&t(...e)},au=t=>t?$e(t)?t.some(e=>e.length>1):t.length>1:!1;function ug(t){const e={};for(const O in t)O in Qf||(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=hg(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,$,j)=>{Zi(O,$?u:a),Zi(O,$?d:r),j&&j()},g=(O,$)=>{O._isLeaving=!1,Zi(O,f),Zi(O,m),Zi(O,h),$&&$()},F=O=>($,j)=>{const re=O?D:T,q=()=>E($,O,j);qi(re,[$,q]),lu(()=>{Zi($,O?l:o),bi($,O?u:a),au(re)||cu($,i,y,q)})};return jt(e,{onBeforeEnter(O){qi(p,[O]),bi(O,o),bi(O,r)},onBeforeAppear(O){qi(P,[O]),bi(O,l),bi(O,d)},onEnter:F(!1),onAppear:F(!0),onLeave(O,$){O._isLeaving=!0;const j=()=>g(O,$);bi(O,f),mg(),bi(O,h),lu(()=>{!O._isLeaving||(Zi(O,f),bi(O,m),au(S)||cu(O,i,_,j))}),qi(S,[O,j])},onEnterCancelled(O){E(O,!1),qi(w,[O])},onAppearCancelled(O){E(O,!0),qi(R,[O])},onLeaveCancelled(O){g(O),qi(I,[O])}})}function hg(t){if(t==null)return null;if(Ft(t))return[Za(t.enter),Za(t.leave)];{const e=Za(t);return[e,e]}}function Za(t){return Jo(t)}function bi(t,e){e.split(/\s+/).forEach(n=>n&&t.classList.add(n)),(t._vtc||(t._vtc=new Set)).add(e)}function Zi(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 lu(t){requestAnimationFrame(()=>{requestAnimationFrame(t)})}let fg=0;function cu(t,e,n,i){const s=t._endId=++fg,o=()=>{s===t._endId&&i()};if(n)return setTimeout(o,n);const{type:r,timeout:a,propCount:l}=pg(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<l&&f()},a+1),t.addEventListener(d,h)}function pg(t,e){const n=window.getComputedStyle(t),i=b=>(n[b]||"").split(", "),s=i(vi+"Delay"),o=i(vi+"Duration"),r=du(s,o),a=i(Eo+"Delay"),l=i(Eo+"Duration"),d=du(a,l);let u=null,f=0,h=0;e===vi?r>0&&(u=vi,f=r,h=o.length):e===Eo?d>0&&(u=Eo,f=d,h=l.length):(f=Math.max(r,d),u=f>0?r>d?vi:Eo:null,h=u?u===vi?o.length:l.length:0);const m=u===vi&&/\b(transform|all)(,|$)/.test(n[vi+"Property"]);return{type:u,timeout:f,propCount:h,hasTransform:m}}function du(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max(...e.map((n,i)=>uu(n)+uu(t[i])))}function uu(t){return Number(t.slice(0,-1).replace(",","."))*1e3}function mg(){return document.body.offsetHeight}const io=t=>{const e=t.props["onUpdate:modelValue"]||!1;return $e(e)?n=>Kr(e,n):e};function _g(t){t.target.composing=!0}function hu(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const me={created(t,{modifiers:{lazy:e,trim:n,number:i}},s){t._assign=io(s);const o=i||s.props&&s.props.type==="number";Fi(t,e?"change":"input",r=>{if(r.target.composing)return;let a=t.value;n&&(a=a.trim()),o&&(a=Jo(a)),t._assign(a)}),n&&Fi(t,"change",()=>{t.value=t.value.trim()}),e||(Fi(t,"compositionstart",_g),Fi(t,"compositionend",hu),Fi(t,"change",hu))},mounted(t,{value:e}){t.value=e==null?"":e},beforeUpdate(t,{value:e,modifiers:{lazy:n,trim:i,number:s}},o){if(t._assign=io(o),t.composing||document.activeElement===t&&t.type!=="range"&&(n||i&&t.value.trim()===e||(s||t.type==="number")&&Jo(t.value)===e))return;const r=e==null?"":e;t.value!==r&&(t.value=r)}},Kn={deep:!0,created(t,e,n){t._assign=io(n),Fi(t,"change",()=>{const i=t._modelValue,s=sr(t),o=t.checked,r=t._assign;if($e(i)){const a=Bc(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(po(i)){const a=new Set(i);o?a.add(s):a.delete(s),r(a)}else r(ep(t,o))})},mounted:fu,beforeUpdate(t,e,n){t._assign=io(n),fu(t,e,n)}};function fu(t,{value:e,oldValue:n},i){t._modelValue=e,$e(e)?t.checked=Bc(e,i.props.value)>-1:po(e)?t.checked=e.has(i.props.value):e!==n&&(t.checked=dr(e,ep(t,!0)))}const Jn={deep:!0,created(t,{value:e,modifiers:{number:n}},i){const s=po(e);Fi(t,"change",()=>{const o=Array.prototype.filter.call(t.options,r=>r.selected).map(r=>n?Jo(sr(r)):sr(r));t._assign(t.multiple?s?new Set(o):o:o[0])}),t._assign=io(i)},mounted(t,{value:e}){pu(t,e)},beforeUpdate(t,e,n){t._assign=io(n)},updated(t,{value:e}){pu(t,e)}};function pu(t,e){const n=t.multiple;if(!(n&&!$e(e)&&!po(e))){for(let i=0,s=t.options.length;i<s;i++){const o=t.options[i],r=sr(o);if(n)$e(e)?o.selected=Bc(e,r)>-1:o.selected=e.has(r);else if(dr(sr(o),e)){t.selectedIndex!==i&&(t.selectedIndex=i);return}}!n&&t.selectedIndex!==-1&&(t.selectedIndex=-1)}}function sr(t){return"_value"in t?t._value:t.value}function ep(t,e){const n=e?"_trueValue":"_falseValue";return n in t?t[n]:e}const gg={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},tp=(t,e)=>n=>{if(!("key"in n))return;const i=xs(n.key);if(e.some(s=>s===i||gg[s]===i))return t(n)},ln={beforeMount(t,{value:e},{transition:n}){t._vod=t.style.display==="none"?"":t.style.display,n&&e?n.beforeEnter(t):wo(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),wo(t,!0),i.enter(t)):i.leave(t,()=>{wo(t,!1)}):wo(t,e))},beforeUnmount(t,{value:e}){wo(t,e)}};function wo(t,e){t.style.display=e?t._vod:"none"}const vg=jt({patchProp:cg},Y_);let mu;function bg(){return mu||(mu=R_(vg))}const yg=(...t)=>{const e=bg().createApp(...t),{mount:n}=e;return e.mount=i=>{const s=xg(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 xg(t){return zt(t)?document.querySelector(t):t}/*!
  2. * vue-router v4.0.16
  3. * (c) 2022 Eduardo San Martin Morote
  4. * @license MIT
  5. */const np=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",vo=t=>np?Symbol(t):"_vr_"+t,Sg=vo("rvlm"),_u=vo("rvd"),sd=vo("r"),ip=vo("rl"),ql=vo("rvl"),Gs=typeof window!="undefined";function Mg(t){return t.__esModule||np&&t[Symbol.toStringTag]==="Module"}const St=Object.assign;function Ka(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 Xo=()=>{},Eg=/\/$/,wg=t=>t.replace(Eg,"");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=Pg(i!=null?i:e,n),{fullPath:i+(o&&"?")+o+r,path:i,query:s,hash:r}}function Tg(t,e){const n=e.query?t(e.query):"";return e.path+(n&&"?")+n+(e.hash||"")}function gu(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function Cg(t,e,n){const i=e.matched.length-1,s=n.matched.length-1;return i>-1&&i===s&&so(e.matched[i],n.matched[s])&&sp(e.params,n.params)&&t(e.query)===t(n.query)&&e.hash===n.hash}function so(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function sp(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(!Ag(t[n],e[n]))return!1;return!0}function Ag(t,e){return Array.isArray(t)?vu(t,e):Array.isArray(e)?vu(e,t):t===e}function vu(t,e){return Array.isArray(e)?t.length===e.length&&t.every((n,i)=>n===e[i]):t.length===1&&t[0]===e}function Pg(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<i.length;o++)if(r=i[o],!(s===1||r==="."))if(r==="..")s--;else break;return n.slice(0,s).join("/")+"/"+i.slice(o-(o===i.length?1:0)).join("/")}var or;(function(t){t.pop="pop",t.push="push"})(or||(or={}));var jo;(function(t){t.back="back",t.forward="forward",t.unknown=""})(jo||(jo={}));function Rg(t){if(!t)if(Gs){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),wg(t)}const Dg=/^[^#]+#/;function Ig(t,e){return t.replace(Dg,"#")+e}function Fg(t,e){const n=document.documentElement.getBoundingClientRect(),i=t.getBoundingClientRect();return{behavior:e.behavior,left:i.left-n.left-(e.left||0),top:i.top-n.top-(e.top||0)}}const La=()=>({left:window.pageXOffset,top:window.pageYOffset});function Lg(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=Fg(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 bu(t,e){return(history.state?history.state.position-e:-1)+t}const Zl=new Map;function Ug(t,e){Zl.set(t,e)}function Og(t){const e=Zl.get(t);return Zl.delete(t),e}let Ng=()=>location.protocol+"//"+location.host;function op(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),gu(l,"")}return gu(n,t)+i+s}function zg(t,e,n,i){let s=[],o=[],r=null;const a=({state:h})=>{const m=op(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:or.pop,direction:_?_>0?jo.forward:jo.back:jo.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:La()}),"")}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 yu(t,e,n,i=!1,s=!1){return{back:t,current:e,forward:n,replaced:i,position:window.history.length,scroll:s?La():null}}function kg(t){const{history:e,location:n}=window,i={value:op(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:Ng()+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,yu(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:La()});o(u.current,u,!0);const f=St({},yu(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 Bg(t){t=Rg(t);const e=kg(t),n=zg(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:Ig.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 Vg(t){return t=location.host?t||location.pathname+location.search:"",t.includes("#")||(t+="#"),Bg(t)}function $g(t){return typeof t=="string"||t&&typeof t=="object"}function rp(t){return typeof t=="string"||typeof t=="symbol"}const yi={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},ap=vo("nf");var xu;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(xu||(xu={}));function oo(t,e){return St(new Error,{type:t,[ap]:!0},e)}function xi(t,e){return t instanceof Error&&ap in t&&(e==null||!!(t.type&e))}const Su="[^/]+?",Hg={sensitive:!1,strict:!1,start:!0,end:!0},Gg=/[.+*?^${}()[\]/\\]/g;function Wg(t,e){const n=St({},Hg,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;f<d.length;f++){const h=d[f];let m=40+(n.sensitive?.25:0);if(h.type===0)f||(s+="/"),s+=h.value.replace(Gg,"\\$&"),m+=40;else if(h.type===1){const{value:b,repeatable:y,optional:_,regexp:p}=h;o.push({name:b,repeatable:y,optional:_});const T=p||Su;if(T!==Su){m+=10;try{new RegExp(`(${T})`)}catch(S){throw new Error(`Invalid custom RegExp for param "${b}" (${T}): `+S.message)}}let w=y?`((?:${T})(?:/(?:${T}))*)`:`(${T})`;f||(w=_&&d.length<2?`(?:/${w})`:"/"+w),_&&(w+="?"),s+=w,m+=20,_&&(m+=-8),y&&(m+=-20),T===".*"&&(m+=-50)}u.push(m)}i.push(u)}if(n.strict&&n.end){const d=i.length-1;i[d][i[d].length-1]+=.7000000000000001}n.strict||(s+="/?"),n.end?s+="$":n.strict&&(s+="(?:/|$)");const r=new RegExp(s,n.sensitive?"":"i");function a(d){const u=d.match(r),f={};if(!u)return null;for(let h=1;h<u.length;h++){const m=u[h]||"",b=o[h-1];f[b.name]=m&&b.repeatable?m.split("/"):m}return f}function l(d){let u="",f=!1;for(const h of t){(!f||!u.endsWith("/"))&&(u+="/"),f=!1;for(const m of h)if(m.type===0)u+=m.value;else if(m.type===1){const{value:b,repeatable:y,optional:_}=m,p=b in d?d[b]:"";if(Array.isArray(p)&&!y)throw new Error(`Provided param "${b}" is an array but it is not repeatable (* or + modifiers)`);const T=Array.isArray(p)?p.join("/"):p;if(!T)if(_)h.length<2&&t.length>1&&(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 Xg(t,e){let n=0;for(;n<t.length&&n<e.length;){const i=e[n]-t[n];if(i)return i;n++}return t.length<e.length?t.length===1&&t[0]===40+40?-1:1:t.length>e.length?e.length===1&&e[0]===40+40?1:-1:0}function jg(t,e){let n=0;const i=t.score,s=e.score;for(;n<i.length&&n<s.length;){const o=Xg(i[n],s[n]);if(o)return o;n++}if(Math.abs(s.length-i.length)===1){if(Mu(i))return 1;if(Mu(s))return-1}return s.length-i.length}function Mu(t){const e=t[t.length-1];return t.length>0&&e[e.length-1]<0}const Yg={type:0,value:""},qg=/[a-zA-Z0-9_]/;function Zg(t){if(!t)return[[]];if(t==="/")return[[Yg]];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<t.length;){if(l=t[a++],l==="\\"&&n!==2){i=n,n=4;continue}switch(n){case 0:l==="/"?(d&&f(),r()):l===":"?(f(),n=1):h();break;case 4:h(),n=i;break;case 1:l==="("?n=2:qg.test(l)?h():(f(),n=0,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case 2:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:n=3:u+=l;break;case 3:f(),n=0,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:e("Unknown state");break}}return n===2&&e(`Unfinished custom RegExp for param "${d}"`),f(),r(),s}function Kg(t,e,n){const i=Wg(Zg(t.path),n),s=St(i,{record:t,parent:e,children:[],alias:[]});return e&&!s.record.aliasOf==!e.record.aliasOf&&e.children.push(s),s}function Jg(t,e){const n=[],i=new Map;e=wu({strict:!1,end:!0,sensitive:!1},e);function s(u){return i.get(u)}function o(u,f,h){const m=!h,b=e0(u);b.aliasOf=h&&h.record;const y=wu(e,u),_=[b];if("alias"in u){const w=typeof u.alias=="string"?[u.alias]:u.alias;for(const S of w)_.push(St({},b,{components:h?h.record.components:b.components,path:S,aliasOf:h?h.record:b}))}let p,T;for(const w of _){const{path:S}=w;if(f&&S[0]!=="/"){const I=f.record.path,P=I[I.length-1]==="/"?"":"/";w.path=f.record.path+(S&&P+S)}if(p=Kg(w,f,y),h?h.alias.push(p):(T=T||p,T!==p&&T.alias.push(p),m&&u.name&&!Eu(p)&&r(u.name)),"children"in b){const I=b.children;for(let P=0;P<I.length;P++)o(I[P],p,h&&h.children[P])}h=h||p,l(p)}return T?()=>{r(T)}:Xo}function r(u){if(rp(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<n.length&&jg(u,n[f])>=0&&(u.record.path!==n[f].record.path||!lp(u,n[f]));)f++;n.splice(f,0,u),u.record.name&&!Eu(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 oo(1,{location:u});y=h.record.name,m=St(Qg(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 oo(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:n0(_)}}return t.forEach(u=>o(u)),{addRoute:o,resolve:d,removeRoute:r,getRoutes:a,getRecordMatcher:s}}function Qg(t,e){const n={};for(const i of e)i in t&&(n[i]=t[i]);return n}function e0(t){return{path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:void 0,beforeEnter:t.beforeEnter,props:t0(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||{}:{default:t.component}}}function t0(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 Eu(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function n0(t){return t.reduce((e,n)=>St(e,n.meta),{})}function wu(t,e){const n={};for(const i in t)n[i]=i in e?e[i]:t[i];return n}function lp(t,e){return e.children.some(n=>n===t||lp(t,n))}const cp=/#/g,i0=/&/g,s0=/\//g,o0=/=/g,r0=/\?/g,dp=/\+/g,a0=/%5B/g,l0=/%5D/g,up=/%5E/g,c0=/%60/g,hp=/%7B/g,d0=/%7C/g,fp=/%7D/g,u0=/%20/g;function od(t){return encodeURI(""+t).replace(d0,"|").replace(a0,"[").replace(l0,"]")}function h0(t){return od(t).replace(hp,"{").replace(fp,"}").replace(up,"^")}function Kl(t){return od(t).replace(dp,"%2B").replace(u0,"+").replace(cp,"%23").replace(i0,"%26").replace(c0,"`").replace(hp,"{").replace(fp,"}").replace(up,"^")}function f0(t){return Kl(t).replace(o0,"%3D")}function p0(t){return od(t).replace(cp,"%23").replace(r0,"%3F")}function m0(t){return t==null?"":p0(t).replace(s0,"%2F")}function pa(t){try{return decodeURIComponent(""+t)}catch{}return""+t}function _0(t){const e={};if(t===""||t==="?")return e;const i=(t[0]==="?"?t.slice(1):t).split("&");for(let s=0;s<i.length;++s){const o=i[s].replace(dp," "),r=o.indexOf("="),a=pa(r<0?o:o.slice(0,r)),l=r<0?null:pa(o.slice(r+1));if(a in e){let d=e[a];Array.isArray(d)||(d=e[a]=[d]),d.push(l)}else e[a]=l}return e}function Tu(t){let e="";for(let n in t){const i=t[n];if(n=f0(n),i==null){i!==void 0&&(e+=(e.length?"&":"")+n);continue}(Array.isArray(i)?i.map(o=>o&&Kl(o)):[i&&Kl(i)]).forEach(o=>{o!==void 0&&(e+=(e.length?"&":"")+n,o!=null&&(e+="="+o))})}return e}function g0(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 To(){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 Di(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(oo(4,{from:n,to:e})):f instanceof Error?a(f):$g(f)?a(oo(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 Qa(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(v0(a)){const d=(a.__vccOpts||a)[e];d&&s.push(Di(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=Mg(d)?d.default:d;o.components[r]=u;const h=(u.__vccOpts||u)[e];return h&&Di(h,n,i,o,r)()}))}}return s}function v0(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Cu(t){const e=Ni(sd),n=Ni(ip),i=qn(()=>e.resolve(Bo(t.to))),s=qn(()=>{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(so.bind(null,u));if(h>-1)return h;const m=Au(l[d-2]);return d>1&&Au(u)===m&&f[f.length-1].path!==m?f.findIndex(so.bind(null,l[d-2])):h}),o=qn(()=>s.value>-1&&S0(n.params,i.value.params)),r=qn(()=>s.value>-1&&s.value===n.matched.length-1&&sp(n.params,i.value.params));function a(l={}){return x0(l)?e[Bo(t.replace)?"replace":"push"](Bo(t.to)).catch(Xo):Promise.resolve()}return{route:i,href:qn(()=>i.value.href),isActive:o,isExactActive:r,navigate:a}}const b0=go({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:Cu,setup(t,{slots:e}){const n=hr(Cu(t)),{options:i}=Ni(sd),s=qn(()=>({[Pu(t.activeClass,i.linkActiveClass,"router-link-active")]:n.isActive,[Pu(t.exactActiveClass,i.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=e.default&&e.default(n);return t.custom?o:nd("a",{"aria-current":n.isExactActive?t.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},o)}}}),y0=b0;function x0(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 S0(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 Au(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Pu=(t,e,n)=>t!=null?t:e!=null?e:n,M0=go({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:n}){const i=Ni(ql),s=qn(()=>t.route||i.value),o=Ni(_u,0),r=qn(()=>s.value.matched[o]);Jr(_u,o+1),Jr(Sg,r),Jr(ql,s);const a=ff();return Ho(()=>[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||!so(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 Ru(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=nd(u,St({},m,e,{onVnodeUnmounted:_=>{_.component.isUnmounted&&(d.instances[f]=null)},ref:a}));return Ru(n.default,{Component:y,route:l})||y}}});function Ru(t,e){if(!t)return null;const n=t(e);return n.length===1?n[0]:n}const E0=M0;function w0(t){const e=Jg(t.routes,t),n=t.parseQuery||_0,i=t.stringifyQuery||Tu,s=t.history,o=To(),r=To(),a=To(),l=pf(yi);let d=yi;Gs&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=Ka.bind(null,N=>""+N),f=Ka.bind(null,m0),h=Ka.bind(null,pa);function m(N,le){let Y,ue;return rp(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 Le=Ja(n,N,le.path),A=e.resolve({path:Le.path},le),x=s.createHref(Le.fullPath);return St(Le,A,{params:h(A.params),hash:pa(Le.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 Le=St({},N.params);for(const A in Le)Le[A]==null&&delete Le[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=Tg(i,St({},N,{hash:h0(Oe),path:ue.path})),Ne=s.createHref(Se);return St({fullPath:Se,hash:Oe,query:i===Tu?g0(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 oo(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,Le=P(Y);if(Le)return D(St(T(Le),{state:Oe,force:Se,replace:Ne}),le||Y);const A=Y;A.redirectedFrom=le;let x;return!Se&&Cg(i,ue,Y)&&(x=oo(16,{to:A,from:ue}),ye(ue,ue,!0,!1)),(x?Promise.resolve(x):E(A,ue)).catch(Z=>xi(Z)?xi(Z,2)?Z:fe(Z):ae(Z,A,ue)).then(Z=>{if(Z){if(xi(Z,2))return D(St(T(Z.to),{state:Oe,force:Se,replace:Ne}),le||A)}else Z=F(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]=T0(N,le);Y=Qa(ue.reverse(),"beforeRouteLeave",N,le);for(const Le of ue)Le.leaveGuards.forEach(A=>{Y.push(Di(A,N,le))});const Ne=R.bind(null,N,le);return Y.push(Ne),Cs(Y).then(()=>{Y=[];for(const Le of o.list())Y.push(Di(Le,N,le));return Y.push(Ne),Cs(Y)}).then(()=>{Y=Qa(Oe,"beforeRouteUpdate",N,le);for(const Le of Oe)Le.updateGuards.forEach(A=>{Y.push(Di(A,N,le))});return Y.push(Ne),Cs(Y)}).then(()=>{Y=[];for(const Le of N.matched)if(Le.beforeEnter&&!le.matched.includes(Le))if(Array.isArray(Le.beforeEnter))for(const A of Le.beforeEnter)Y.push(Di(A,N,le));else Y.push(Di(Le.beforeEnter,N,le));return Y.push(Ne),Cs(Y)}).then(()=>(N.matched.forEach(Le=>Le.enterCallbacks={}),Y=Qa(Se,"beforeRouteEnter",N,le),Y.push(Ne),Cs(Y))).then(()=>{Y=[];for(const Le of r.list())Y.push(Di(Le,N,le));return Y.push(Ne),Cs(Y)}).catch(Le=>xi(Le,8)?Le:Promise.reject(Le))}function g(N,le,Y){for(const ue of a.list())ue(N,le,Y)}function F(N,le,Y,ue,Oe){const Se=w(N,le);if(Se)return Se;const Ne=le===yi,Le=Gs?history.state:{};Y&&(ue||Ne?s.replace(N.fullPath,St({scroll:Ne&&Le&&Le.scroll},Oe)):s.push(N.fullPath,Oe)),l.value=N,ye(N,le,Y,Ne),fe()}let O;function $(){O||(O=s.listen((N,le,Y)=>{const ue=p(N),Oe=P(ue);if(Oe){D(St(Oe,{replace:!0}),ue).catch(Xo);return}d=ue;const Se=l.value;Gs&&Ug(bu(Se.fullPath,Y.delta),La()),E(ue,Se).catch(Ne=>xi(Ne,12)?Ne:xi(Ne,2)?(D(Ne.to,ue).then(Le=>{xi(Le,20)&&!Y.delta&&Y.type===or.pop&&s.go(-1,!1)}).catch(Xo),Promise.reject()):(Y.delta&&s.go(-Y.delta,!1),ae(Ne,ue,Se))).then(Ne=>{Ne=Ne||F(ue,Se,!1),Ne&&(Y.delta?s.go(-Y.delta,!1):Y.type===or.pop&&xi(Ne,20)&&s.go(-1,!1)),g(ue,Se,Ne)}).catch(Xo)}))}let j=To(),re=To(),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!==yi?Promise.resolve():new Promise((N,le)=>{j.add([N,le])})}function fe(N){return q||(q=!N,$(),j.list().forEach(([le,Y])=>N?Y(N):le()),j.reset()),N}function ye(N,le,Y,ue){const{scrollBehavior:Oe}=t;if(!Gs||!Oe)return Promise.resolve();const Se=!Y&&Og(bu(N.fullPath,0))||(ue||!Y)&&history.state&&history.state.scroll||null;return vf().then(()=>Oe(N,le,Se)).then(Ne=>Ne&&Lg(Ne)).catch(Ne=>ae(Ne,N,le))}const De=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:De,back:()=>De(-1),forward:()=>De(1),beforeEach:o.add,beforeResolve:r.add,afterEach:a.add,onError:re.add,isReady:G,install(N){const le=this;N.component("RouterLink",y0),N.component("RouterView",E0),N.config.globalProperties.$router=le,Object.defineProperty(N.config.globalProperties,"$route",{enumerable:!0,get:()=>Bo(l)}),Gs&&!Be&&l.value===yi&&(Be=!0,S(s.location).catch(Oe=>{}));const Y={};for(const Oe in yi)Y[Oe]=qn(()=>l.value[Oe]);N.provide(sd,le),N.provide(ip,hr(Y)),N.provide(ql,l);const ue=N.unmount;Je.add(N),N.unmount=function(){Je.delete(N),Je.size<1&&(d=yi,O&&O(),O=null,l.value=yi,Be=!1,q=!1),ue()}}}}function Cs(t){return t.reduce((e,n)=>e.then(()=>n()),Promise.resolve())}function T0(t,e){const n=[],i=[],s=[],o=Math.max(e.matched.length,t.matched.length);for(let r=0;r<o;r++){const a=e.matched[r];a&&(t.matched.find(d=>so(d,a))?i.push(a):n.push(a));const l=t.matched[r];l&&(e.matched.find(d=>so(d,l))||s.push(l))}return[n,i,s]}class C0{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 A0={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 C0({baudRate:115200},()=>{console.log("Device connected")},()=>{this.serialPortHandler.isOpened=!1,console.log("Device disconnected")})}},P0={class:"container"},R0={class:"navbar navbar-expand-lg navbar-light bg-light"},D0={class:"container-fluid"},I0=c("div",null,null,-1),F0={class:"text-danger p-1 m-0",role:"alert"},L0={key:0},U0={class:"row"},O0=c("div",{class:"col"},null,-1),N0={class:"col-auto text-center"},z0=["title"],k0={class:"col-auto"};function B0(t,e,n,i,s,o){const r=et("RouterView");return W(),ee("div",P0,[c("header",null,[c("nav",R0,[c("div",D0,[I0,c("div",F0,[s.lastMessage!=""?(W(),ee("span",L0,"\u26A0 "+ze(s.lastMessage),1)):ot("",!0)]),c("div",null,[c("form",null,[c("div",U0,[O0,c("div",N0,[c("span",{class:je(o.isOpened==!0?"fs-4 text-success":"fs-4 text-secondary"),title:o.isOpened==!0?"Connected":"Disconnected"},"\u25CF \u2699",10,z0)]),c("div",k0,[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")):ot("",!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")):ot("",!0)])])])])])])]),ke(r)])}var V0=ct(A0,[["render",B0]]);const $0="modulepreload",Du={},H0="/",G0=function(e,n){return!n||n.length===0?e():Promise.all(n.map(i=>{if(i=`${H0}${i}`,i in Du)return;Du[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":$0,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())},W0={props:{state:Boolean}},X0={key:0,class:"badge bg-success"},j0={key:1,class:"badge bg-danger"};function Y0(t,e,n,i,s,o){return W(),ee("span",null,[n.state==!0?(W(),ee("span",X0," On ")):(W(),ee("span",j0," Off "))])}var q0=ct(W0,[["render",Y0]]);const Z0={components:{OnOff:q0},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}}},K0={class:"card"},J0=c("div",{class:"card-header"},"Controller state",-1),Q0={class:"card-body"},ev={class:"row"},tv={class:"col text-center"},nv={class:"row"},iv=c("div",{class:"col-auto"},"X",-1),sv={class:"col text-end"},ov={class:"row"},rv=c("div",{class:"col-auto"},"Y",-1),av={class:"col text-end"},lv={class:"row"},cv=c("div",{class:"col-auto"},"Z",-1),dv={class:"col text-end"},uv={class:"row"},hv=c("div",{class:"col-auto"},"A",-1),fv={class:"col text-end"},pv={class:"row"},mv=c("div",{class:"col-auto"},"Pump",-1),_v={class:"col text-end"},gv={class:"row"},vv={class:"col-auto"},bv={class:"col text-end"};function yv(t,e,n,i,s,o){const r=et("OnOff");return W(),ee("div",K0,[J0,c("div",Q0,[c("div",ev,[c("div",tv,[c("h3",{class:je("Status "+o.statusString)},ze(o.statusString),3)])]),c("div",nv,[iv,c("div",sv,ze(n.state.pos.x),1)]),c("div",ov,[rv,c("div",av,ze(n.state.pos.y),1)]),c("div",lv,[cv,c("div",dv,ze(n.state.pos.z),1)]),c("div",uv,[hv,c("div",fv,ze(n.state.pos.a),1)]),c("div",pv,[mv,c("div",_v,[ke(r,{state:n.pumpState},null,8,["state"])])]),(W(!0),ee(at,null,wt(n.valvesState,(a,l)=>(W(),ee("div",gv,[c("div",vv,"Valve "+ze(l+1),1),c("div",bv,[ke(r,{state:a},null,8,["state"])])]))),256))])])}var xv=ct(Z0,[["render",yv]]);const Sv={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}}},Mv={class:"border p-3 mt-1"},Ev={class:"nav nav-tabs"},wv={class:"nav-item"},Tv={class:"nav-item"},Cv={key:0,class:"p-2"},Av={class:"row"},Pv={class:"col p-1"},Rv=["disabled"],Dv={class:"col p-1"},Iv=["disabled"],Fv={class:"col p-1"},Lv=["disabled"],Uv={class:"col p-1"},Ov=["disabled"],Nv={class:"row"},zv={class:"col p-1"},kv=["disabled"],Bv={class:"col p-1 text-nowrap"},Vv={class:"row p-0 m-0"},$v={class:"col p-0 m-0"},Hv=["disabled"],Gv=c("div",{class:"col-auto p-1 m-0"},null,-1),Wv={class:"col p-0 m-0"},Xv=["disabled"],jv={class:"col p-1"},Yv=["disabled"],qv={class:"col p-1"},Zv=["disabled"],Kv={class:"row"},Jv={class:"col p-1"},Qv=["disabled"],eb={class:"col p-1"},tb=["disabled"],nb={class:"col p-1"},ib=["disabled"],sb={class:"col p-1"},ob=["disabled"],rb={class:"row"},ab={class:"col p-1"},lb=we(" Step size XYZ (mm): "),cb={class:"row"},db={class:"col p-1"},ub=we(" Feed rate XYZ: "),hb=c("hr",null,null,-1),fb={class:"row"},pb={class:"col p-1"},mb=we(" Steps A (1.0 setep = 1 turn): "),_b={class:"row"},gb={class:"col p-1"},vb=we(" Feed rate A: "),bb={key:0,class:"row mt-4"},yb={class:"col p-1"},xb={class:"form-check form-switch"},Sb=["disabled"],Mb=c("label",{class:"form-check-label",for:"pump"},"Pump",-1),Eb={key:1,class:"row mt-4"},wb={class:"col p-1"},Tb={class:"form-check form-switch"},Cb=["onUpdate:modelValue","onClick","disabled","id"],Ab=["for"],Pb={key:1},Rb={class:"row"},Db={class:"col p-1"},Ib=["disabled"],Fb={class:"col p-1"},Lb=["disabled"],Ub={class:"col p-1"},Ob=["disabled"],Nb={class:"row"},zb={class:"col p-1"},kb=["disabled"],Bb={class:"col p-1"},Vb=["disabled"],$b={class:"row"},Hb={class:"col p-1"},Gb=["disabled"],Wb={class:"row"},Xb={class:"col p-1"},jb=["disabled"],Yb={class:"col p-1"},qb=["disabled"],Zb={class:"row"},Kb={class:"col p-1"},Jb=["disabled"],Qb={key:0},ey=we(" Camera \u21D2 Nozzle"),ty=c("br",null,null,-1),ny=we("Toggle Position "),iy=[ey,ty,ny],sy={key:1},oy=we(" Nozzle \u21D2 Camera"),ry=c("br",null,null,-1),ay=we("Toggle Position "),ly=[oy,ry,ay];function cy(t,e,n,i,s,o){return W(),ee("div",Mv,[c("ul",Ev,[c("li",wv,[c("a",{class:je("nav-link"+(t.tab==0?" active":"")),onClick:e[0]||(e[0]=r=>t.tab=0)},"Jog Controller",2)]),c("li",Tv,[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",Cv,[c("div",Av,[c("div",Pv,[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,Rv)]),c("div",Dv,[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,Iv)]),c("div",Fv,[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,Lv)]),c("div",Uv,[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,Ov)])]),c("div",Nv,[c("div",zv,[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,kv)]),c("div",Bv,[c("div",Vv,[c("div",$v,[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,Hv)]),Gv,c("div",Wv,[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,Xv)])])]),c("div",jv,[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,Yv)]),c("div",qv,[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,Zv)])]),c("div",Kv,[c("div",Jv,[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,Qv)]),c("div",eb,[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,tb)]),c("div",nb,[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,ib)]),c("div",sb,[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,ob)])]),c("div",rb,[c("div",ab,[lb,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),[[me,n.movingOptions.stepSize]])])]),c("div",cb,[c("div",db,[ub,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),[[me,n.movingOptions.feedRateXYZ]])])]),hb,c("div",fb,[c("div",pb,[mb,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),[[me,n.movingOptions.rotateStep]])])]),c("div",_b,[c("div",gb,[vb,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),[[me,n.movingOptions.feedRateA]])])]),n.settings.pump?(W(),ee("div",bb,[c("div",yb,[c("div",xb,[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,Sb),[[Kn,t.pump]]),Mb])])])):ot("",!0),n.settings.heads?(W(),ee("div",Eb,[(W(!0),ee(at,null,wt(n.settings.heads,(r,a)=>(W(),ee("div",wb,[c("div",Tb,[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,Cb),[[Kn,t.valves[a]]]),c("label",{class:"form-check-label",for:"valve"+a},"Valve "+ze(a+1),9,Ab)])]))),256))])):ot("",!0)])):ot("",!0),t.tab==1?(W(),ee("div",Pb,[c("div",Rb,[c("div",Db,[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,Ib)]),c("div",Fb,[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,Lb)]),c("div",Ub,[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,Ob)])]),c("div",Nb,[c("div",zb,[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,kb)]),c("div",Bb,[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,Vb)])]),c("div",$b,[c("div",Hb,[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,Gb)])]),c("div",Wb,[c("div",Xb,[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,jb)]),c("div",Yb,[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,qb)])]),c("div",Zb,[c("div",Kb,[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",Qb,iy)):(W(),ee("span",sy,ly))],10,Jb)])])])):ot("",!0)])}var dy=ct(Sv,[["render",cy]]);const uy={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<this.history.length&&(this.historyIndex++,this.command=this.history[this.historyIndex])}},watch:{async consoleLog(){setTimeout(()=>{let t=this.$refs.console;t.scrollTop=t.scrollHeight},100)}}},hy={class:"card mt-1"},fy=c("div",{class:"card-header"},"Console",-1),py={class:"card-body"},my={class:"row"},_y={class:"col"},gy={class:"row"},vy={class:"col mt-1"},by=["disabled"];function yy(t,e,n,i,s,o){return W(),ee("div",hy,[fy,c("div",py,[c("div",my,[c("div",_y,[c("textarea",{readonly:"",rows:"10",ref:"console",class:"form-control form-control-sm"},ze(n.consoleLog),513)])]),c("div",gy,[c("div",vy,[se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>t.command=r),disabled:n.disabled,onKeyup:[e[1]||(e[1]=tp(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,by),[[me,t.command]])])])])])}var xy=ct(uy,[["render",yy]]);const vs=pf();function Ua(t){t===void 0&&(t=vs.value.comp.returnValue()),vs.value.resolve(t),vs.value=null}function rd(t,e,n="default"){return new Promise(i=>{vs.value={dialog:t,props:e,wrapper:n,resolve:i}})}const Sy={install:(t,e)=>{t.config.globalProperties.$close=(n,i)=>{Ua(i)}}};var My=(t,e)=>{const n=t.__vccOpts||t;for(const[i,s]of e)n[i]=s;return n};const Ey=go({name:"DialogWrapper",components:{},props:{name:{type:String,default:"default"},transitionAttrs:Object},setup(){const t=ff();return Ho(t,()=>{vs.value&&(vs.value.comp=t.value)}),{dialogRef:vs,dialogInstance:t}}});function wy(t,e,n,i,s,o){return W(),Jt(id,sm(Yf(t.transitionAttrs)),{default:Ct(()=>[t.dialogRef&&t.dialogRef.wrapper===t.name?(W(),Jt(__(t.dialogRef.dialog),qf({key:0},t.dialogRef.props,{ref:"dialogInstance"}),null,16)):ot("",!0)]),_:1},16)}var Ty=My(Ey,[["render",wy]]);const Cy=go({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:Ua}}}),Ay={class:"dialog"},Py={class:"center"},Ry={class:"title"},Dy={class:"text"},Iy={class:"p-3 text-center"};function Fy(t,e,n,i,s,o){return W(),ee("div",Ay,[c("div",Py,[c("div",Ry,ze(t.title),1),c("div",Dy,ze(t.text),1),c("div",Iy,[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 Ly=ct(Cy,[["render",Fy],["__scopeId","data-v-cd0635e6"]]);const Uy=go({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:Ua}}}),Oy={class:"dialog"},Ny={class:"center"},zy={class:"text"},ky={class:"p-3 text-center"};function By(t,e,n,i,s,o){return W(),ee("div",Oy,[c("div",Ny,[c("div",{class:je("title "+t.type)},ze(t.title),3),c("div",zy,ze(t.text),1),c("div",ky,[c("button",{onClick:e[0]||(e[0]=r=>t.closeDialog()),ref:"btn_yes",class:"btn bt-sm btn-dark mb-1"},"OK",512)])])])}var Vy=ct(Uy,[["render",By],["__scopeId","data-v-7fc707e0"]]);const $y=go({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:Ua}}}),Hy={class:"dialog"},Gy={class:"center"},Wy={class:"title"},Xy={class:"text"},jy={class:"p-3 text-center"};function Yy(t,e,n,i,s,o){return W(),ee("div",Hy,[c("div",Gy,[c("div",Wy,ze(t.title),1),c("div",Xy,[we(ze(t.text)+" ",1),se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>t.inputValue=r),class:"form-control"},null,512),[[me,t.inputValue]])]),c("div",jy,[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 qy=ct($y,[["render",Yy],["__scopeId","data-v-8751a8c8"]]);async function Un(t,e=""){return await rd(Ly,{text:t,title:e})}async function st(t,e="",n=""){return await rd(Vy,{text:t,title:e,type:n})}async function Zy(t,e="",n=""){return await rd(qy,{text:t,title:e,value:n})}const Ky={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),st("Can't read file '"+t.name+"'","Error","error")}}},run(){let t=this.gCode.split(`
  6. `);this.$emit("run",t)},stop(){this.$emit("stop")},pause(){this.$emit("pause")}}},Jy={class:"card"},Qy=c("div",{class:"card-header"},"G Code",-1),ex={class:"card-body"},tx={class:"row"},nx={class:"col"},ix=["disabled"],sx=we(" | "),ox=["disabled"],rx=["disabled"],ax=["disabled"],lx={class:"row"},cx={class:"col"};function dx(t,e,n,i,s,o){return W(),ee("div",Jy,[Qy,c("div",ex,[c("div",tx,[c("div",nx,[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,ix),sx,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,ox),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,rx),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,ax)])]),c("div",lx,[c("div",cx,[se(c("textarea",{"onUpdate:modelValue":e[5]||(e[5]=r=>t.gCode=r),rows:"15",class:"form-control form-control-sm"},null,512),[[me,t.gCode]])])])])])}var ux=ct(Ky,[["render",dx]]);const hx={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)}}},fx={class:"card"},px=c("div",{class:"card-header"},"Controller Settings",-1),mx={class:"card-body"},_x={class:"row mb-1"},gx={class:"col-1"},vx={class:"col-auto"},bx=["onUpdate:modelValue"],yx={class:"col-auto"},xx={key:0},Sx=["disabled","onClick"],Mx={class:"col"};function Ex(t,e,n,i,s,o){return W(),ee("div",fx,[px,c("div",mx,[(W(!0),ee(at,null,wt(o.settingsList,(r,a)=>(W(),ee("div",_x,[c("div",gx,ze(a),1),c("div",vx,[se(c("input",{"onUpdate:modelValue":l=>t.values[a]=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,bx),[[me,t.values[a]]])]),c("div",yx,[t.values[a]!==n.settings[a]?(W(),ee("span",xx,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary",onClick:l=>o.saveSetting(a)},"Save",8,Sx)])):ot("",!0)]),c("div",Mx,ze(t.description[a]),1)]))),256))])])}var wx=ct(hx,[["render",Ex]]),Hn={methods:{machineStateIsOK(){if(this.machineState){if(this.machineState.status=="Idle")return!0;st("Controller status is wrong","Error","error")}else st("Controller state is wrong","Error","error");return!1}}};const Tx={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")}}},Cx={class:"card"},Ax=c("div",{class:"card-header"},"Cameras Settings",-1),Px={class:"card-body"},Rx={class:"row"},Dx={class:"card"},Ix={class:"card-header"},Fx={class:"card-body"},Lx={class:"row"},Ux={class:"col"},Ox={class:"mb-3"},Nx=c("label",{class:"form-label"},"ID",-1),zx=["onClick"],kx=["onUpdate:modelValue"],Bx=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),Vx=c("div",{class:"form-text"},[we("Use command '"),c("b",null,"ls /dev/v4l/by-id/"),we("' to view USB cameras list")],-1),$x={class:"mb-3"},Hx=c("label",{class:"form-label"},"Capture frame size",-1),Gx={class:"row mb-2"},Wx={class:"col"},Xx={class:"row"},jx=c("div",{class:"col-auto pt-1"},"Width:",-1),Yx={class:"col"},qx=["onUpdate:modelValue"],Zx={class:"col"},Kx={class:"row"},Jx=c("div",{class:"col-auto pt-1"},"Height:",-1),Qx={class:"col"},eS=["onUpdate:modelValue"],tS={class:"mb-3"},nS=c("label",{class:"form-label"},"Undistorting method",-1),iS={class:"row mb-2"},sS={class:"col"},oS=["onUpdate:modelValue"],rS=c("option",{value:0},"Distortion factor",-1),aS=c("option",{value:1},"Calibration data",-1),lS=[rS,aS],cS={key:0,class:"mb-3"},dS=c("label",{class:"form-label"},"Distortion factor",-1),uS={class:"row mb-2"},hS={class:"col"},fS=["onUpdate:modelValue"],pS=c("div",{class:"form-text"},'Positive and negative value available. After changing pleas press "Applay settings"',-1),mS={key:1,class:"mb-3"},_S=c("label",{class:"form-label"},"Calibration data",-1),gS={key:0,class:"row"},vS=c("div",{class:"col-auto"},"matrix:",-1),bS={class:"col-auto"},yS=c("div",{class:"col-auto"},"distortion:",-1),xS={class:"col-auto"},SS={class:"col text-end"},MS=["onClick"],ES={key:1,class:"row"},wS={class:"col"},TS=we("[Hiden] "),CS=["onClick"],AS=c("div",{class:"form-text"},[we("Please print "),c("a",{href:"images/calibration.svg",target:"_blank"},"this"),we(" picture, put it under cams focus then press button 'Calibration'")],-1),PS=["onClick"],RS={key:2,class:"mb-3"},DS=c("label",{class:"form-label"},"Offset from nozzle of head #1",-1),IS={class:"pb-2"},FS=["disabled"],LS=we(" Then move camera to Nozzle position and press "),US=["disabled","onClick"],OS={class:"row mb-2"},NS={class:"col"},zS={class:"row"},kS=c("div",{class:"col-auto pt-1"},"X:",-1),BS={class:"col"},VS=["onUpdate:modelValue"],$S={class:"col"},HS={class:"row"},GS=c("div",{class:"col-auto pt-1"},"Y:",-1),WS={class:"col"},XS=["onUpdate:modelValue"],jS=c("div",{class:"col-auto"},null,-1),YS=c("div",{class:"form-text"},"Top camera offset from nozzle of first head",-1),qS={key:3,class:"mb-3"},ZS=c("label",{class:"form-label"},"Position",-1),KS={class:"row mb-2"},JS={class:"col"},QS={class:"row"},e1=c("div",{class:"col-auto pt-1"},"X:",-1),t1={class:"col"},n1=["onUpdate:modelValue"],i1={class:"col"},s1={class:"row"},o1=c("div",{class:"col-auto pt-1"},"Y:",-1),r1={class:"col"},a1=["onUpdate:modelValue"],l1={class:"col"},c1={class:"row"},d1=c("div",{class:"col-auto pt-1"},"Z:",-1),u1={class:"col"},h1=["onUpdate:modelValue"],f1={class:"col-auto"},p1=["disabled","onClick"],m1=c("div",{class:"form-text"},"Nozzle position over Bottom camera",-1),_1=["disabled"],g1={class:"card mt-1"},v1=c("div",{class:"card-header"},"Image Transform",-1),b1={class:"card-body"},y1={class:"mb-3"},x1=c("label",{class:"form-label"},"Rotation",-1),S1={class:"row mb-2"},M1={class:"col"},E1=["onUpdate:modelValue"],w1=c("option",{value:0},"No",-1),T1=c("option",{value:90},"90",-1),C1=c("option",{value:180},"180",-1),A1=c("option",{value:-90},"-90",-1),P1=[w1,T1,C1,A1],R1={class:"mb-3"},D1=c("label",{class:"form-label"},"Scale",-1),I1={class:"row mb-2"},F1={class:"col"},L1={class:"row"},U1=c("div",{class:"col-auto pt-1"},"Width:",-1),O1={class:"col"},N1=["onUpdate:modelValue"],z1={class:"col"},k1={class:"row"},B1=c("div",{class:"col-auto pt-1"},"Height:",-1),V1={class:"col"},$1=["onUpdate:modelValue"],H1={class:"card mt-1"},G1=c("div",{class:"card-header"},"Resolution",-1),W1={class:"card-body"},X1={class:"mb-3"},j1=c("label",{class:"form-label"},"Resolution (pixels per millimeter)",-1),Y1=["onClick"],q1=["onUpdate:modelValue","onChange"],Z1=c("div",{class:"form-text"},[we("Please print "),c("a",{href:"images/calibration.svg",target:"_blank"},"this"),we(" picture, put it under center of cams focus then change the resolution until the marker matches the image of square.")],-1),K1={class:"card mt-1"},J1=c("div",{class:"card-header"},"Light",-1),Q1={class:"card-body"},eM={class:"mb-3"},tM=c("label",{class:"form-label"},"Light on command",-1),nM=["onUpdate:modelValue"],iM={class:"mb-3"},sM=c("label",{class:"form-label"},"Light off command",-1),oM=["onUpdate:modelValue"],rM={class:"row mt-2"},aM={class:"col"},lM=["disabled"];function cM(t,e,n,i,s,o){return W(),ee("div",Cx,[Ax,c("div",Px,[c("div",Rx,[(W(!0),ee(at,null,wt(n.cams,(r,a)=>(W(),ee("div",{class:"col",key:a},[c("div",Dx,[c("div",Ix,"Camera "+ze(r.name),1),c("div",Fx,[c("div",Lx,[c("div",Ux,[c("div",Ox,[Nx,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,zx),se(c("input",{"onUpdate:modelValue":l=>r.id=l,type:"text",class:"form-control form-control-sm"},null,8,kx),[[me,r.id]]),Bx,Vx]),c("div",$x,[Hx,c("div",Gx,[c("div",Wx,[c("div",Xx,[jx,c("div",Yx,[se(c("input",{"onUpdate:modelValue":l=>r.size.width=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,qx),[[me,r.size.width]])])])]),c("div",Zx,[c("div",Kx,[Jx,c("div",Qx,[se(c("input",{"onUpdate:modelValue":l=>r.size.height=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,eS),[[me,r.size.height]])])])])])]),c("div",tS,[nS,c("div",iS,[c("div",sS,[se(c("select",{"onUpdate:modelValue":l=>r.undistort.type=l,class:"form-control form-control-sm"},lS,8,oS),[[Jn,r.undistort.type]])])])]),r.undistort.type==0?(W(),ee("div",cS,[dS,c("div",uS,[c("div",hS,[se(c("input",{"onUpdate:modelValue":l=>r.undistort.distortion_f=l,type:"number",step:"0.001",class:"form-control form-control-sm"},null,8,fS),[[me,r.undistort.distortion_f]])])]),pS])):ot("",!0),r.undistort.type==1?(W(),ee("div",mS,[_S,t.calibrationShow[a]==!0?(W(),ee("div",gS,[vS,c("div",bS,ze(r.calibration.matrix),1),yS,c("div",xS,ze(r.calibration.distortion),1),c("div",SS,[c("button",{class:"btn btn-sm btn-link p-0 ps-1 pe-1",onClick:l=>t.calibrationShow[a]=!1},"Hide",8,MS)])])):(W(),ee("div",ES,[c("div",wS,[TS,c("button",{class:"btn btn-sm btn-link p-0 ps-1 pe-1",onClick:l=>t.calibrationShow[a]=!0},"Show",8,CS)])])),AS,c("button",{class:"btn btn-sm btn-outline-secondary",onClick:l=>o.calibrate(a)},"Calibrate",8,PS)])):ot("",!0),a==0?(W(),ee("div",RS,[DS,c("div",IS,[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,FS),LS,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,US)]),c("div",OS,[c("div",NS,[c("div",zS,[kS,c("div",BS,[se(c("input",{"onUpdate:modelValue":l=>r.offset.x=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,VS),[[me,r.offset.x]])])])]),c("div",$S,[c("div",HS,[GS,c("div",WS,[se(c("input",{"onUpdate:modelValue":l=>r.offset.y=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,XS),[[me,r.offset.y]])])])]),jS]),YS])):ot("",!0),a==1?(W(),ee("div",qS,[ZS,c("div",KS,[c("div",JS,[c("div",QS,[e1,c("div",t1,[se(c("input",{"onUpdate:modelValue":l=>r.pos.x=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,n1),[[me,r.pos.x]])])])]),c("div",i1,[c("div",s1,[o1,c("div",r1,[se(c("input",{"onUpdate:modelValue":l=>r.pos.y=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,a1),[[me,r.pos.y]])])])]),c("div",l1,[c("div",c1,[d1,c("div",u1,[se(c("input",{"onUpdate:modelValue":l=>r.pos.z=l,type:"number",step:"0.01",class:"form-control form-control-sm"},null,8,h1),[[me,r.pos.z]])])])]),c("div",f1,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary",onClick:l=>o.setPosition(a)},"Set current controller position",8,p1)])]),m1,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,_1)])):ot("",!0)])])])]),c("div",g1,[v1,c("div",b1,[c("div",y1,[x1,c("div",S1,[c("div",M1,[se(c("select",{"onUpdate:modelValue":l=>r.image_transform.rotation=l,class:"form-control form-control-sm"},P1,8,E1),[[Jn,r.image_transform.rotation]])])])]),c("div",R1,[D1,c("div",I1,[c("div",F1,[c("div",L1,[U1,c("div",O1,[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,N1),[[me,r.image_transform.scale_x]])])])]),c("div",z1,[c("div",k1,[B1,c("div",V1,[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,$1),[[me,r.image_transform.scale_y]])])])])])])])]),c("div",H1,[G1,c("div",W1,[c("div",X1,[j1,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,Y1),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,q1),[[me,r.ppmm]]),Z1])])]),c("div",K1,[J1,c("div",Q1,[c("div",eM,[tM,se(c("input",{"onUpdate:modelValue":l=>r.lightOn=l,type:"text",class:"form-control form-control-sm"},null,8,nM),[[me,r.lightOn]])]),c("div",iM,[sM,se(c("input",{"onUpdate:modelValue":l=>r.lightOff=l,type:"text",class:"form-control form-control-sm"},null,8,oM),[[me,r.lightOff]])])])])]))),128))]),c("div",rM,[c("div",aM,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[2]||(e[2]=r=>o.applaySettings())},"Applay settings",8,lM)])])])])}var dM=ct(Tx,[["render",cM]]);const uM={props:{cvSettings:Object,showWindow:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")},toggleCV(t){this.$emit("toggleCV",t)}}},hM={class:"card"},fM=c("div",{class:"card-header"},"Computer Vision Settings",-1),pM={class:"card-body"},mM={class:"row"},_M={class:"card"},gM={class:"card-header"},vM={class:"card-body"},bM={class:"row"},yM={class:"col"},xM={class:"mb-3"},SM=c("label",{class:"form-label"},"Contrast",-1),MM=["onUpdate:modelValue"],EM=c("div",{class:"form-text"},"The default value is 1, meaning no scaling is applied. This parameter controls the contrast of the image.",-1),wM={class:"mb-3"},TM=c("label",{class:"form-label"},"Brightness",-1),CM=["onUpdate:modelValue"],AM=c("div",{class:"form-text"},"The default value is 0, meaning no shift is applied. This parameter controls the brightness of the image.",-1),PM={class:"mb-3"},RM=c("label",{class:"form-label"},"Blur",-1),DM={class:"row"},IM={class:"col-auto"},FM=["onUpdate:modelValue"],LM=c("div",{class:"col-auto mt-1"},"x",-1),UM={class:"col-auto"},OM=["onUpdate:modelValue"],NM=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),zM={class:"mb-3"},kM=c("label",{class:"form-label"},"Adaptive Threshold block size",-1),BM=["onUpdate:modelValue"],VM=c("div",{class:"form-text"},"The size of the pixel neighborhood used to calculate the threshold, it must be an odd number.",-1),$M={class:"mb-3"},HM=c("label",{class:"form-label"},"Adaptive Threshold C",-1),GM=["onUpdate:modelValue"],WM=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),XM=["onClick"],jM={class:"card mt-2"},YM=c("div",{class:"card-header"},"Objects parameters (default)",-1),qM={class:"card-body"},ZM={class:"mb-3"},KM={class:"form-label capitalize"},JM=["onUpdate:modelValue"],QM={class:"card mt-2"},eE=c("div",{class:"card-header"},"Misc Settings",-1),tE={class:"card-body"},nE={class:"mb-3"},iE=c("label",{class:"form-label capitalize"},"Delay before image processing:",-1),sE=["onUpdate:modelValue"],oE={class:"row mt-2"},rE={class:"col"},aE=["disabled"];function lE(t,e,n,i,s,o){return W(),ee("div",hM,[fM,c("div",pM,[c("div",mM,[(W(!0),ee(at,null,wt(n.cvSettings,(r,a)=>(W(),ee("div",{class:"col",key:a},[c("div",_M,[c("div",gM,"Camera "+ze(r.name)+" image transform",1),c("div",vM,[c("div",bM,[c("div",yM,[c("div",xM,[SM,se(c("input",{"onUpdate:modelValue":l=>r.contrast=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,MM),[[me,r.contrast]]),EM]),c("div",wM,[TM,se(c("input",{"onUpdate:modelValue":l=>r.brightness=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,CM),[[me,r.brightness]]),AM]),c("div",PM,[RM,c("div",DM,[c("div",IM,[se(c("input",{"onUpdate:modelValue":l=>r.blur[0]=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,FM),[[me,r.blur[0]]])]),LM,c("div",UM,[se(c("input",{"onUpdate:modelValue":l=>r.blur[1]=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,OM),[[me,r.blur[1]]])])]),NM]),c("div",zM,[kM,se(c("input",{"onUpdate:modelValue":l=>r.adaptiveThreshold_blockSize=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,BM),[[me,r.adaptiveThreshold_blockSize]]),VM]),c("div",$M,[HM,se(c("input",{"onUpdate:modelValue":l=>r.adaptiveThreshold_C=l,type:"number",step:"1",class:"form-control form-control-sm"},null,8,GM),[[me,r.adaptiveThreshold_C]]),WM]),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,XM)])])])]),c("div",jM,[YM,c("div",qM,[(W(!0),ee(at,null,wt(r.objects,(l,d)=>(W(),ee("div",ZM,[c("label",KM,ze(d),1),c("div",null,[(W(!0),ee(at,null,wt(l,(u,f)=>(W(),ee("span",null,[we(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,JM),[[me,r.objects[d][f]]])]))),256))])]))),256))])]),c("div",QM,[eE,c("div",tE,[c("div",nE,[iE,se(c("input",{"onUpdate:modelValue":l=>r.pauseBefore=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,sE),[[me,r.pauseBefore]])])])])]))),128))]),c("div",oE,[c("div",rE,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[0]||(e[0]=r=>o.applaySettings())},"Applay settings",8,aE)])])])])}var cE=ct(uM,[["render",lE]]);const dE={props:{heads:Object,nozzles:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")}}},uE={class:"card"},hE=c("div",{class:"card-header"},"Heads Settings",-1),fE={class:"card-body"},pE={class:"row"},mE={class:"card"},_E={class:"card-header"},gE={class:"card-body"},vE={class:"mb-3"},bE=c("label",{class:"form-label"},"Safety Z position",-1),yE=["onUpdate:modelValue"],xE=c("div",{class:"form-text"},"Position Z to safety moving head over the table",-1),SE={class:"mb-3"},ME=c("label",{class:"form-label"},"Valve On command",-1),EE=["onUpdate:modelValue"],wE={class:"mb-3"},TE={class:"row"},CE={class:"col"},AE=we(" Pause Before On: "),PE=["onUpdate:modelValue"],RE={class:"col"},DE=we(" Pause After On: "),IE=["onUpdate:modelValue"],FE={class:"mb-3"},LE=c("label",{class:"form-label"},"Valve Off command",-1),UE=["onUpdate:modelValue"],OE={class:"mb-3"},NE={class:"row"},zE={class:"col"},kE=we(" Pause Before Off: "),BE=["onUpdate:modelValue"],VE={class:"col"},$E=we(" Pause After Off: "),HE=["onUpdate:modelValue"],GE={class:"mb-3"},WE=c("label",{class:"form-label"},"Output name in GC",-1),XE=["onUpdate:modelValue"],jE={class:"mb-3"},YE=c("label",{class:"form-label"},"Nozzle default",-1),qE=["onUpdate:modelValue"],ZE=c("option",{value:-1},"Empty",-1),KE=["value"],JE={class:"row mt-2"},QE={class:"col"},ew=["disabled"];function tw(t,e,n,i,s,o){return W(),ee("div",uE,[hE,c("div",fE,[c("div",pE,[(W(!0),ee(at,null,wt(n.heads,(r,a)=>(W(),ee("div",{class:"col",key:a},[c("div",mE,[c("div",_E,"Head "+ze(r.name),1),c("div",gE,[c("div",vE,[bE,se(c("input",{"onUpdate:modelValue":l=>r.safePosZ=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,yE),[[me,r.safePosZ]]),xE]),c("div",SE,[ME,se(c("input",{"onUpdate:modelValue":l=>r.valveOn=l,type:"text",class:"form-control form-control-sm"},null,8,EE),[[me,r.valveOn]])]),c("div",wE,[c("div",TE,[c("div",CE,[AE,se(c("input",{"onUpdate:modelValue":l=>r.pauseBeforeOn=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,PE),[[me,r.pauseBeforeOn]])]),c("div",RE,[DE,se(c("input",{"onUpdate:modelValue":l=>r.pauseAfterOn=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,IE),[[me,r.pauseAfterOn]])])])]),c("div",FE,[LE,se(c("input",{"onUpdate:modelValue":l=>r.valveOff=l,type:"text",class:"form-control form-control-sm"},null,8,UE),[[me,r.valveOff]])]),c("div",OE,[c("div",NE,[c("div",zE,[kE,se(c("input",{"onUpdate:modelValue":l=>r.pauseBeforeOff=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,BE),[[me,r.pauseBeforeOff]])]),c("div",VE,[$E,se(c("input",{"onUpdate:modelValue":l=>r.pauseAfterOff=l,type:"number",step:"0.1",class:"form-control form-control-sm"},null,8,HE),[[me,r.pauseAfterOff]])])])]),c("div",GE,[WE,se(c("input",{"onUpdate:modelValue":l=>r.inGC=l,type:"text",class:"form-control form-control-sm"},null,8,XE),[[me,r.inGC]])]),c("div",jE,[YE,se(c("select",{"onUpdate:modelValue":l=>r.nozzle=l,class:"form-control form-control-sm"},[ZE,(W(!0),ee(at,null,wt(n.nozzles,l=>(W(),ee("option",{value:l.id},ze(l.name),9,KE))),256))],8,qE),[[Jn,r.nozzle]])])])])]))),128))]),c("div",JE,[c("div",QE,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[0]||(e[0]=r=>o.applaySettings())},"Applay settings",8,ew)])])])])}var nw=ct(dE,[["render",tw]]);const iw={mixins:[Hn],props:{pump:Object,loading:Boolean},methods:{applaySettings(){this.$emit("applaySettings")}}},sw={class:"card"},ow=c("div",{class:"card-header"},"Pump Settings",-1),rw={class:"card-body"},aw={class:"mb-3"},lw=c("label",{class:"form-label"},"Pump On command",-1),cw={class:"mb-3"},dw=c("label",{class:"form-label"},"Pump Off command",-1),uw={class:"mb-3"},hw=c("label",{class:"form-label"},"Output name in GC",-1),fw={class:"row mt-2"},pw={class:"col"},mw=["disabled"];function _w(t,e,n,i,s,o){return W(),ee("div",sw,[ow,c("div",rw,[c("div",aw,[lw,se(c("input",{"onUpdate:modelValue":e[0]||(e[0]=r=>n.pump.On=r),type:"text",class:"form-control form-control-sm"},null,512),[[me,n.pump.On]])]),c("div",cw,[dw,se(c("input",{"onUpdate:modelValue":e[1]||(e[1]=r=>n.pump.Off=r),type:"text",class:"form-control form-control-sm"},null,512),[[me,n.pump.Off]])]),c("div",uw,[hw,se(c("input",{"onUpdate:modelValue":e[2]||(e[2]=r=>n.pump.inGC=r),type:"text",class:"form-control form-control-sm"},null,512),[[me,n.pump.inGC]])]),c("div",fw,[c("div",pw,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[3]||(e[3]=r=>o.applaySettings())},"Applay settings",8,mw)])])])])}var gw=ct(iw,[["render",_w]]),Oa={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<t.length-1&&this.array_move(t,n,n+1)},rowDelete(t,e){Un("Do you really want to delete?","Confirm").then(n=>{if(n==!0){let i=t.indexOf(e);t.splice(i,1)}})}}},Ss={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<this.rows.length-1&&(e=e+1),this.$emit("set",this.rows[e])}}},setCurrentRow(t){this.currentRow!=t&&this.$emit("set",t)},setFocus(){if(this.$refs){let t=this.rows.indexOf(this.currentRow);t>-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<t.length-1&&this.array_move(t,n,n+1)},rowDelete(t,e){Un("Do you really want to delete?","Confirm").then(n=>{if(n==!0){let i=t.indexOf(e);t.splice(i,1)}})}},watch:{currentRow(){this.setFocus()}}};const vw={props:{machinePos:Object},mixins:[Ss],data:function(){return{currentField:"dx"}}},bw={class:"scroll"},yw={class:"table",ref:"table"},xw=c("thead",null,[c("tr",null,[c("th"),c("th",null,"a"),c("th",null,"dx"),c("th",null,"dy")])],-1),Sw=["onMousedown"],Mw={key:0},Ew={key:1},ww=["onUpdate:modelValue"],Tw=["onUpdate:modelValue"],Cw={nowrap:""},Aw=["onClick","hidden"];function Pw(t,e,n,i,s,o){return W(),ee("div",bw,[c("table",yw,[xw,c("tbody",null,[(W(!0),ee(at,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",Mw,"\u2BC8")):(W(),ee("span",Ew,"\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,ww),[[me,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,Tw),[[me,r.dy]])]),c("th",Cw,[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,Aw)])],42,Sw))),256))])],512)])}var Rw=ct(vw,[["render",Pw]]);const Dw={data:function(){return{showMenu:this.showMenu}}},Iw={class:"dropdown show"};function Fw(t,e,n,i,s,o){return W(),ee("div",Iw,[c("a",{onClick:e[0]||(e[0]=r=>t.showMenu=!t.showMenu)},[to(t.$slots,"menubutton")]),c("div",{class:je("dropdown-menu"+(t.showMenu==!0?" show":"")),onClick:e[1]||(e[1]=r=>t.showMenu=!1)},[to(t.$slots,"menuitems")],2)])}var pp=ct(Dw,[["render",Fw]]);const Lw={props:{disabled:Boolean}},Uw=["disabled"];function Ow(t,e,n,i,s,o){return W(),ee("button",{class:"dropdown-item",disabled:n.disabled,type:"button"},[to(t.$slots,"default")],8,Uw)}var mp=ct(Lw,[["render",Ow]]);const Nw={components:{PopupMenu:pp,PopupMenuItem:mp},props:{row:Object,clipboard:Object}},zw=we("Copy"),kw=we("Paste");function Bw(t,e,n,i,s,o){const r=et("PopupMenuItem"),a=et("PopupMenu");return W(),Jt(a,null,{menubutton:Ct(()=>[to(t.$slots,"default")]),menuitems:Ct(()=>[ke(r,{onClick:e[0]||(e[0]=l=>t.$emit("copy",n.row))},{default:Ct(()=>[zw]),_:1}),ke(r,{disabled:!n.clipboard,onClick:e[1]||(e[1]=l=>t.$emit("paste",n.row))},{default:Ct(()=>[kw]),_:1},8,["disabled"])]),_:3})}var bo=ct(Nw,[["render",Bw]]),Ms={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 Vw={mixins:[Ss,Ms],props:{settings:Object,machineState:Object,machinePos:Object,disabled:Boolean},components:{NozzlesCalibrateTable:Rw,CopyPasteMenu:bo},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))}}},Na=t=>(Aa("data-v-644ea80b"),t=t(),Pa(),t),$w={class:"row"},Hw={class:"col"},Gw={class:"scroll"},Ww={class:"table mb-5",ref:"table"},Xw=Na(()=>c("thead",null,[c("tr",null,[c("th"),c("th",null,"Name"),c("th",null,"Caption"),c("th")])],-1)),jw=["onMousedown"],Yw={key:0},qw=we("\u2BC8"),Zw={key:1},Kw=["onUpdate:modelValue"],Jw=["onUpdate:modelValue"],Qw={nowrap:""},eT=["onClick"],tT=["onClick"],nT=["onClick"],iT={class:"text-end"},sT={key:0,class:"col"},oT={class:"card"},rT={class:"card-header"},aT={class:"card-body"},lT={class:"mb-3"},cT=Na(()=>c("label",{class:"form-label"},"Name",-1)),dT={class:"row mb-2"},uT={class:"col"},hT={class:"mb-3"},fT=Na(()=>c("label",{class:"form-label"},"Caption",-1)),pT={class:"row mb-2"},mT={class:"col"},_T={class:"card mt-1"},gT=Na(()=>c("div",{class:"card-header"},"Nozzle calibration table",-1)),vT={class:"card-body"},bT=["disabled"];function yT(t,e,n,i,s,o){const r=et("CopyPasteMenu"),a=et("NozzlesCalibrateTable");return W(),ee("div",$w,[c("div",Hw,[c("div",Gw,[c("table",Ww,[Xw,c("tbody",null,[(W(!0),ee(at,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",Yw,[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(()=>[qw]),_:2},1032,["row","clipboard"])])):(W(),ee("span",Zw,"\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,Kw),[[me,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,Jw),[[me,l.caption]])]),c("th",Qw,[c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:u=>t.$emit("up",l)},"\u2BC5",8,eT),c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:u=>t.$emit("down",l)},"\u2BC6",8,tT),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:u=>t.$emit("delete",l)},"\u2BBF",8,nT)])],42,jw))),256))])],512),c("div",iT,[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",sT,[c("div",oT,[c("div",rT,"Nozzle "+ze(t.currentRow.name)+" (#"+ze(t.currentRow.id)+")",1),c("div",aT,[c("div",lT,[cT,c("div",dT,[c("div",uT,[se(c("input",{"onUpdate:modelValue":e[5]||(e[5]=l=>t.currentRow.name=l),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.name]])])])]),c("div",hT,[fT,c("div",pT,[c("div",mT,[se(c("input",{"onUpdate:modelValue":e[6]||(e[6]=l=>t.currentRow.caption=l),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.caption]])])])])])]),c("div",_T,[gT,c("div",vT,[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,bT)])])])):ot("",!0)])}var xT=ct(Vw,[["render",yT],["__scopeId","data-v-644ea80b"]]);const ST={mixins:[Oa,Hn],props:{nozzles:Object,machineState:Object,machinePos:Object,settings:Object,disabled:Boolean,loading:Boolean},components:{NozzlesTable:xT},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)})}}},MT={class:"card"},ET=c("div",{class:"card-header"},"Nozzles Settings",-1),wT={class:"card-body"},TT={class:"row mt-2"},CT={class:"col"},AT=["disabled"];function PT(t,e,n,i,s,o){const r=et("NozzlesTable");return W(),ee("div",MT,[ET,c("div",wT,[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",TT,[c("div",CT,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[7]||(e[7]=a=>o.applaySettings())},"Applay settings",8,AT)])])])])}var RT=ct(ST,[["render",PT]]);const DT={mixins:[Ss,Ms],components:{CopyPasteMenu:bo},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))}}},IT={class:"scroll"},FT={class:"table mb-5",ref:"table"},LT=c("thead",null,[c("tr",null,[c("th"),c("th",null,"x"),c("th",null,"y"),c("th",null,"z")])],-1),UT=["onMousedown"],OT={key:0},NT=we("\u2BC8"),zT={key:1},kT=["onUpdate:modelValue"],BT=["onUpdate:modelValue"],VT=["onUpdate:modelValue"],$T={nowrap:""},HT=["onClick"],GT=["onClick"],WT={class:"text-end"};function XT(t,e,n,i,s,o){const r=et("CopyPasteMenu");return W(),ee("div",IT,[c("table",FT,[LT,c("tbody",null,[(W(!0),ee(at,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",OT,[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(()=>[NT]),_:2},1032,["row","clipboard"])])):(W(),ee("span",zT,"\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,kT),[[me,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,BT),[[me,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,VT),[[me,a.z]])]),c("th",$T,[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,HT),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:d=>t.$emit("delete",a)},"\u2BBF",8,GT)])],42,UT))),256))])],512),c("div",WT,[c("button",{onClick:e[5]||(e[5]=a=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary"},"Add point")])])}var jT=ct(DT,[["render",XT]]);const YT={mixins:[Ss,Hn,Ms],props:{settings:Object,machineState:Object,machinePos:Object,disabled:Boolean},components:{NozzlesHolderPlacePointsTable:jT,CopyPasteMenu:bo},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))}}},Gi=t=>(Aa("data-v-104bd4cb"),t=t(),Pa(),t),qT={class:"row"},ZT={class:"col"},KT={class:"scroll"},JT={class:"table mb-5",ref:"table"},QT=Gi(()=>c("thead",null,[c("tr",null,[c("th"),c("th",null,"Name"),c("th",null,"Nozzle"),c("th")])],-1)),eC=["onMousedown"],tC={key:0},nC=we("\u2BC8"),iC={key:1},sC=["onUpdate:modelValue"],oC=["onUpdate:modelValue"],rC=Gi(()=>c("option",{value:-1},"Empty",-1)),aC=["value"],lC={nowrap:""},cC=["onClick"],dC=["onClick"],uC=["onClick"],hC={class:"text-end"},fC={key:0,class:"col"},pC={class:"card"},mC={class:"card-header"},_C={class:"card-body"},gC={class:"mb-3"},vC=Gi(()=>c("label",{class:"form-label"},"Name",-1)),bC={class:"row mb-2"},yC={class:"col"},xC={class:"mb-3"},SC=Gi(()=>c("label",{class:"form-label"},"Nozzle",-1)),MC={class:"row mb-2"},EC={class:"col"},wC=Gi(()=>c("option",{value:-1},"Empty",-1)),TC=["value"],CC={class:"mb-3"},AC=Gi(()=>c("label",{class:"form-label"},"Feed",-1)),PC={class:"row mb-2"},RC={class:"col"},DC={class:"card mt-1"},IC=Gi(()=>c("div",{class:"card-header"},"Path to take nozzle",-1)),FC={class:"card-body"},LC={class:"card mt-1"},UC=Gi(()=>c("div",{class:"card-header"},"Actions",-1)),OC={class:"card-body"},NC=["disabled"];function zC(t,e,n,i,s,o){const r=et("CopyPasteMenu"),a=et("NozzlesHolderPlacePointsTable");return W(),ee("div",qT,[c("div",ZT,[c("div",KT,[c("table",JT,[QT,c("tbody",null,[(W(!0),ee(at,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",tC,[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(()=>[nC]),_:2},1032,["row","clipboard"])])):(W(),ee("span",iC,"\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,sC),[[me,l.name]])]),c("td",null,[se(c("select",{"onUpdate:modelValue":d=>l.nozzleId=d,class:"form-control form-control-sm"},[rC,(W(!0),ee(at,null,wt(n.settings.nozzles,d=>(W(),ee("option",{value:d.id},ze(d.name),9,aC))),256))],8,oC),[[Jn,l.nozzleId]])]),c("th",lC,[c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:d=>t.$emit("up",l)},"\u2BC5",8,cC),c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:d=>t.$emit("down",l)},"\u2BC6",8,dC),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:d=>t.$emit("delete",l)},"\u2BBF",8,uC)])],42,eC))),256))])],512),c("div",hC,[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",fC,[c("div",pC,[c("div",mC,"Nozzle "+ze(t.currentRow.name)+" (#"+ze(t.currentRow.id)+")",1),c("div",_C,[c("div",gC,[vC,c("div",bC,[c("div",yC,[se(c("input",{"onUpdate:modelValue":e[4]||(e[4]=l=>t.currentRow.name=l),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.name]])])])]),c("div",xC,[SC,c("div",MC,[c("div",EC,[se(c("select",{"onUpdate:modelValue":e[5]||(e[5]=l=>t.currentRow.nozzleId=l),class:"form-control form-control-sm"},[wC,(W(!0),ee(at,null,wt(n.settings.nozzles,l=>(W(),ee("option",{value:l.id},ze(l.name),9,TC))),256))],512),[[Jn,t.currentRow.nozzleId]])])])]),c("div",CC,[AC,c("div",PC,[c("div",RC,[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),[[me,t.currentRow.feed]])])])])])]),c("div",DC,[IC,c("div",FC,[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",LC,[UC,c("div",OC,[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,NC)])])])):ot("",!0)])}var kC=ct(YT,[["render",zC],["__scopeId","data-v-104bd4cb"]]);const BC={mixins:[Oa,Hn],props:{nozzlesHolder:Object,machineState:Object,machinePos:Object,settings:Object,disabled:Boolean,loading:Boolean},components:{NozzlesHolderPlaceTable:kC},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"):st("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]}}},VC={class:"card"},$C=c("div",{class:"card-header"},"Nozzles Holder Settings",-1),HC={class:"card-body"},GC={class:"row mt-2"},WC={class:"col"},XC=["disabled"];function jC(t,e,n,i,s,o){const r=et("NozzlesHolderPlaceTable");return W(),ee("div",VC,[$C,c("div",HC,[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",GC,[c("div",WC,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[6]||(e[6]=a=>o.applaySettings())},"Applay settings",8,XC)])])])])}var YC=ct(BC,[["render",jC]]);const qC={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))}}},ZC={class:"card"},KC=c("div",{class:"card-header"},"Basket Settings",-1),JC={class:"card-body"},QC={class:"mb-3"},eA=c("label",{class:"form-label"},"Position",-1),tA={class:"row mb-2"},nA={class:"col"},iA={class:"row"},sA=c("div",{class:"col-auto pt-1"},"X:",-1),oA={class:"col"},rA={class:"col"},aA={class:"row"},lA=c("div",{class:"col-auto pt-1"},"Y:",-1),cA={class:"col"},dA={class:"col"},uA={class:"row"},hA=c("div",{class:"col-auto pt-1"},"Z:",-1),fA={class:"col"},pA={class:"col-auto"},mA={class:"row mt-2"},_A={class:"col"},gA=["disabled"];function vA(t,e,n,i,s,o){return W(),ee("div",ZC,[KC,c("div",JC,[c("div",QC,[eA,c("div",tA,[c("div",nA,[c("div",iA,[sA,c("div",oA,[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),[[me,n.basket.pos.x]])])])]),c("div",rA,[c("div",aA,[lA,c("div",cA,[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),[[me,n.basket.pos.y]])])])]),c("div",dA,[c("div",uA,[hA,c("div",fA,[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),[[me,n.basket.pos.z]])])])]),c("div",pA,[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",mA,[c("div",_A,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[4]||(e[4]=r=>o.applaySettings())},"Applay settings",8,gA)])])])])}var bA=ct(qC,[["render",vA]]);const yA={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))}}},xA={class:"card"},SA=c("div",{class:"card-header"},"Parking Settings",-1),MA={class:"card-body"},EA={class:"mb-3"},wA=c("label",{class:"form-label"},"Position",-1),TA={class:"row mb-2"},CA={class:"col"},AA={class:"row"},PA=c("div",{class:"col-auto pt-1"},"X:",-1),RA={class:"col"},DA={class:"col"},IA={class:"row"},FA=c("div",{class:"col-auto pt-1"},"Y:",-1),LA={class:"col"},UA={class:"col"},OA={class:"row"},NA=c("div",{class:"col-auto pt-1"},"Z:",-1),zA={class:"col"},kA={class:"col-auto"},BA={class:"row mt-2"},VA={class:"col"},$A=["disabled"];function HA(t,e,n,i,s,o){return W(),ee("div",xA,[SA,c("div",MA,[c("div",EA,[wA,c("div",TA,[c("div",CA,[c("div",AA,[PA,c("div",RA,[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),[[me,n.parking.pos.x]])])])]),c("div",DA,[c("div",IA,[FA,c("div",LA,[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),[[me,n.parking.pos.y]])])])]),c("div",UA,[c("div",OA,[NA,c("div",zA,[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),[[me,n.parking.pos.z]])])])]),c("div",kA,[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",BA,[c("div",VA,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[4]||(e[4]=r=>o.applaySettings())},"Applay settings",8,$A)])])])])}var GA=ct(yA,[["render",HA]]);const WA={mixins:[Ss,Ms],components:{CopyPasteMenu:bo},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))}}},XA={class:"scroll"},jA={class:"table mb-5",ref:"table"},YA=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),qA=["onMousedown"],ZA={key:0},KA=we("\u2BC8"),JA={key:1},QA=["onUpdate:modelValue"],eP=["onUpdate:modelValue"],tP=["onUpdate:modelValue"],nP=["onUpdate:modelValue"],iP={nowrap:""},sP=["onClick"],oP=["onClick"],rP={class:"text-end"};function aP(t,e,n,i,s,o){const r=et("CopyPasteMenu");return W(),ee("div",XA,[c("table",jA,[YA,c("tbody",null,[(W(!0),ee(at,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",ZA,[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(()=>[KA]),_:2},1032,["row","clipboard"])])):(W(),ee("span",JA,"\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,QA),[[me,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,eP),[[me,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,tP),[[me,a.z]])]),c("td",null,[se(c("input",{"onUpdate:modelValue":d=>a.pick=d,type:"checkbox",class:"form-check-input"},null,8,nP),[[Kn,a.pick]])]),c("th",iP,[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,sP),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:d=>t.$emit("delete",a)},"\u2BBF",8,oP)])],42,qA))),256))])],512),c("div",rP,[c("button",{onClick:e[5]||(e[5]=a=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary"},"Add point")])])}var lP=ct(WA,[["render",aP]]);const cP={mixins:[Ss,Hn,Ms],props:{settings:Object,cases:Object,feederTypes:Object,machineState:Object,machinePos:Object,disabled:Boolean},components:{FeedersPathPointsTable:lP,CopyPasteMenu:bo,PopupMenu:pp,PopupMenuItem:mp},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)).toFixed(3),t.pos.y=(parseFloat(this.machinePos.y)+parseFloat(this.settings.cams[0].offset.y)).toFixed(3))},setPointPos(t){this.machineStateIsOK()==!0&&(t.x=this.machinePos.x,t.y=this.machinePos.y,t.z=this.machinePos.z)},adjFiderPosByCamPos(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)}}},dP={class:"row"},uP={class:"col"},hP={class:"scroll"},fP={class:"table mb-5",ref:"table"},pP=c("thead",null,[c("tr",null,[c("th"),c("th",null,"Name"),c("th",null,"Caption"),c("th",null,"Type"),c("th")])],-1),mP=["onMousedown"],_P={key:0},gP=we("\u2BC8"),vP={key:1},bP=["onUpdate:modelValue"],yP=["onUpdate:modelValue"],xP=["onUpdate:modelValue"],SP={nowrap:""},MP=["onClick"],EP=["onClick"],wP=["onClick"],TP={class:"text-end"},CP={class:"col"},AP={class:"scroll"},PP={key:0,class:"card"},RP={class:"card-header"},DP={class:"card-body"},IP={class:"mb-3"},FP=c("label",{class:"form-label"},"Name",-1),LP={class:"row mb-2"},UP={class:"col"},OP={class:"mb-3"},NP=c("label",{class:"form-label"},"Caption",-1),zP={class:"row mb-2"},kP={class:"col"},BP={class:"mb-3"},VP=c("label",{class:"form-label"},"Type",-1),$P={class:"row mb-2"},HP={class:"col"},GP=["value"],WP={key:0},XP={class:"mb-3"},jP=c("label",{class:"form-label"},"Position",-1),YP={class:"row mb-2"},qP={class:"col"},ZP=we(" X: "),KP={class:"col"},JP=we(" Y: "),QP={class:"col"},eR=we(" Z: "),tR={class:"col-auto"},nR={class:"mb-3"},iR=c("label",{class:"form-label"},"Step",-1),sR={class:"row mb-2"},oR={class:"col"},rR=we(" X: "),aR={class:"col"},lR=we(" Y: "),cR={class:"col"},dR=we(" Z: "),uR={class:"mb-3"},hR={class:"row mb-2"},fR={class:"col"},pR=we(" Capacity "),mR={class:"col"},_R=we(" Current "),gR={class:"col"},vR={key:1},bR={class:"mb-3"},yR=c("label",{class:"form-label"},"Path points",-1),xR={class:"row mb-2"},SR={class:"col"},MR={key:2},ER={class:"mb-3"},wR=c("label",{class:"form-label"},"Position (center)",-1),TR={class:"row mb-2"},CR={class:"col"},AR=we(" X: "),PR={class:"col"},RR=we(" Y: "),DR={class:"col"},IR=we(" Z: "),FR={class:"col-auto"},LR={class:"mb-3"},UR=c("label",{class:"form-label"},"Size",-1),OR={class:"row mb-2"},NR={class:"col"},zR=we(" Width X: "),kR={class:"col"},BR=we(" Width Y: "),VR={class:"mb-3"},$R=c("label",{class:"form-label"},"Elements height",-1),HR={class:"row mb-2"},GR={class:"col"},WR={class:"mb-3"},XR=c("label",{class:"form-label"},"Nozzle",-1),jR={class:"row mb-2"},YR={class:"col"},qR=["value"],ZR=c("div",{class:"form-text"},"Specify Nozzle to pick up element",-1),KR={class:"mb-3"},JR=c("label",{class:"form-label"},"Case",-1),QR={class:"row mb-2"},e2={class:"col"},t2=["value"],n2={ref:"smdCase",width:"64",height:"64",style:{border:"silver solid 1px"}},i2={class:"mb-3"},s2=c("label",{class:"form-label"},"Orientation in the feeder",-1),o2={class:"row mb-2"},r2={class:"col"},a2=c("div",{class:"form-text"},"Sets elements orientation in the feeder",-1),l2={class:"mb-3"},c2=c("label",{class:"form-label",for:"posCorrection"},"Correct the element's position after pick",-1),d2={class:"row mb-2"},u2={class:"col"},h2={class:"form-check form-switch"},f2=c("div",{class:"form-text"},"Uses bottom camera to correct position of element after pick",-1),p2={class:"mb-3"},m2=c("label",{class:"form-label"},"Active",-1),_2={class:"row mb-2"},g2={class:"col"},v2={class:"form-check form-switch"},b2={key:1,class:"card mt-1"},y2=c("div",{class:"card-header"},"Actions",-1),x2={class:"card-body"},S2=["disabled"],M2=["disabled"],E2=["disabled"],w2=["disabled"],T2=["disabled"],C2=["disabled"],A2=we("X"),P2=we("Y"),R2=we("Both"),D2=["disabled"];function I2(t,e,n,i,s,o){const r=et("CopyPasteMenu"),a=et("FeedersPathPointsTable"),l=et("PopupMenuItem"),d=et("PopupMenu");return W(),ee("div",dP,[c("div",uP,[c("div",hP,[c("table",fP,[pP,c("tbody",null,[(W(!0),ee(at,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",_P,[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(()=>[gP]),_:2},1032,["row","clipboard"])])):(W(),ee("span",vP,"\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,bP),[[me,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,yP),[[me,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,xP),[[Kn,u.active]])]),c("th",SP,[c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:h=>t.$emit("up",u)},"\u2BC5",8,MP),c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:h=>t.$emit("down",u)},"\u2BC6",8,EP),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:h=>t.$emit("delete",u)},"\u2BBF",8,wP)])],42,mP))),256))])],512),c("div",TP,[c("button",{onClick:e[5]||(e[5]=u=>t.$emit("add")),class:"btn btn-sm btn-outline-secondary"},"Add feeder")])])]),c("div",CP,[c("div",AP,[o.isCurrent?(W(),ee("div",PP,[c("div",RP,"Feeder "+ze(t.currentRow.name)+" (#"+ze(t.currentRow.id)+")",1),c("div",DP,[c("div",IP,[FP,c("div",LP,[c("div",UP,[se(c("input",{"onUpdate:modelValue":e[6]||(e[6]=u=>t.currentRow.name=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.name]])])])]),c("div",OP,[NP,c("div",zP,[c("div",kP,[se(c("input",{"onUpdate:modelValue":e[7]||(e[7]=u=>t.currentRow.caption=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.caption]])])])]),c("div",BP,[VP,c("div",$P,[c("div",HP,[se(c("select",{"onUpdate:modelValue":e[8]||(e[8]=u=>t.currentRow.type=u),class:"form-control form-control-sm"},[(W(!0),ee(at,null,wt(n.feederTypes,u=>(W(),ee("option",{value:u.id},ze(u.name),9,GP))),256))],512),[[Jn,t.currentRow.type]])])])]),t.currentRow.type==0?(W(),ee("span",WP,[c("div",XP,[jP,c("div",YP,[c("div",qP,[ZP,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),[[me,t.currentRow.pos.x]])]),c("div",KP,[JP,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),[[me,t.currentRow.pos.y]])]),c("div",QP,[eR,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),[[me,t.currentRow.pos.z]])]),c("div",tR,[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",nR,[iR,c("div",sR,[c("div",oR,[rR,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),[[me,t.currentRow.step.x]])]),c("div",aR,[lR,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),[[me,t.currentRow.step.y]])]),c("div",cR,[dR,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),[[me,t.currentRow.step.z]])])])]),c("div",uR,[c("div",hR,[c("div",fR,[pR,se(c("input",{"onUpdate:modelValue":e[17]||(e[17]=u=>t.currentRow.capacity=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.capacity]])]),c("div",mR,[_R,se(c("input",{"onUpdate:modelValue":e[18]||(e[18]=u=>t.currentRow.current=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.current]])]),c("div",gR,[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")])])])])):ot("",!0),t.currentRow.type==1?(W(),ee("span",vR,[c("div",bR,[yR,c("div",xR,[c("div",SR,[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"])])])])])):ot("",!0),t.currentRow.type==2?(W(),ee("span",MR,[c("div",ER,[wR,c("div",TR,[c("div",CR,[AR,se(c("input",{"onUpdate:modelValue":e[24]||(e[24]=u=>t.currentRow.pos.x=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.pos.x]])]),c("div",PR,[RR,se(c("input",{"onUpdate:modelValue":e[25]||(e[25]=u=>t.currentRow.pos.y=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.pos.y]])]),c("div",DR,[IR,se(c("input",{"onUpdate:modelValue":e[26]||(e[26]=u=>t.currentRow.pos.z=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.pos.z]])]),c("div",FR,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[27]||(e[27]=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[28]||(e[28]=u=>o.setFeederPos(t.currentRow)),title:"Set current position of nozzle (x, y, z)"},"\u{1F78A}")])])]),c("div",LR,[UR,c("div",OR,[c("div",NR,[zR,se(c("input",{"onUpdate:modelValue":e[29]||(e[29]=u=>t.currentRow.pos.wx=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.pos.wx]])]),c("div",kR,[BR,se(c("input",{"onUpdate:modelValue":e[30]||(e[30]=u=>t.currentRow.pos.wy=u),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.pos.wy]])])])])])):ot("",!0),c("div",VR,[$R,c("div",HR,[c("div",GR,[se(c("input",{"onUpdate:modelValue":e[31]||(e[31]=u=>t.currentRow.elementHeight=u),type:"number",step:"0.01",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.elementHeight]])])])]),c("div",WR,[XR,c("div",jR,[c("div",YR,[se(c("select",{"onUpdate:modelValue":e[32]||(e[32]=u=>t.currentRow.nozzle=u),class:"form-control form-control-sm"},[(W(!0),ee(at,null,wt(n.settings.nozzles,u=>(W(),ee("option",{value:u.id},ze(u.name),9,qR))),256))],512),[[Jn,t.currentRow.nozzle]]),ZR])])]),c("div",KR,[JR,c("div",QR,[c("div",e2,[se(c("select",{"onUpdate:modelValue":e[33]||(e[33]=u=>t.currentRow.case=u),class:"form-control form-control-sm",onChange:e[34]||(e[34]=u=>o.drawSMDCase())},[(W(!0),ee(at,null,wt(n.cases,u=>(W(),ee("option",{value:u.name},ze(u.name),9,t2))),256))],544),[[Jn,t.currentRow.case]]),c("canvas",n2,null,512)])])]),c("div",i2,[s2,c("div",o2,[c("div",r2,[se(c("input",{"onUpdate:modelValue":e[35]||(e[35]=u=>t.currentRow.caseRotate=u),type:"number",step:"0.125",class:"form-control form-control-sm",onChange:e[36]||(e[36]=u=>o.drawSMDCase())},null,544),[[me,t.currentRow.caseRotate]])]),a2])]),c("div",l2,[c2,c("div",d2,[c("div",u2,[c("div",h2,[se(c("input",{"onUpdate:modelValue":e[37]||(e[37]=u=>t.currentRow.posCorrection=u),class:"form-check-input",type:"checkbox",role:"switch",id:"posCorrection"},null,512),[[Kn,t.currentRow.posCorrection]])])]),f2])]),c("div",p2,[m2,c("div",_2,[c("div",g2,[c("div",v2,[se(c("input",{"onUpdate:modelValue":e[38]||(e[38]=u=>t.currentRow.active=u),class:"form-check-input",type:"checkbox",role:"switch",id:"posCorrection"},null,512),[[Kn,t.currentRow.active]])])])])])])])):ot("",!0),o.isCurrent?(W(),ee("div",b2,[y2,c("div",x2,[c("div",null,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[39]||(e[39]=u=>t.$emit("pickFromFeeder",t.currentRow))},"Pick element from Feeder",8,S2),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[40]||(e[40]=u=>t.$emit("adjPosition"))},"Adjust position of Picked element",8,M2),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[41]||(e[41]=u=>t.$emit("dropIntoBasket"))},"Drop Picked element into Basket",8,E2)]),c("div",null,[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[42]||(e[42]=u=>t.$emit("goToFeeder",t.currentRow))},"Jog Nozzle to to Feeder position",8,w2),c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[43]||(e[43]=u=>t.$emit("goToFeederCam",t.currentRow))},"Jog Camera to to Feeder position",8,T2)]),c("div",null,[ke(d,null,{menubutton:Ct(()=>[c("button",{disabled:n.disabled,class:"btn btn-sm btn-outline-secondary m-1 dropdown-toggle"},"Manual Adjust feeder's position by top Camera",8,C2)]),menuitems:Ct(()=>[ke(l,{disabled:n.disabled,onClick:e[44]||(e[44]=u=>o.adjFiderPosByCamPos(t.currentRow,"x"))},{default:Ct(()=>[A2]),_:1},8,["disabled"]),ke(l,{disabled:n.disabled,onClick:e[45]||(e[45]=u=>o.adjFiderPosByCamPos(t.currentRow,"y"))},{default:Ct(()=>[P2]),_:1},8,["disabled"]),ke(l,{disabled:n.disabled,onClick:e[46]||(e[46]=u=>o.adjFiderPosByCamPos(t.currentRow,"xy"))},{default:Ct(()=>[R2]),_:1},8,["disabled"])]),_:1}),c("button",{disabled:n.disabled||t.currentRow.type==2,class:"btn btn-sm btn-outline-secondary m-1",onClick:e[47]||(e[47]=u=>t.$emit("adjFeederPositionCV",t.currentRow))},"Adjust Feeder's position by CV",8,D2)])])])):ot("",!0)])])])}var F2=ct(cP,[["render",I2]]);const L2={mixins:[Oa],props:{feeders:Object,settings:Object,cases:Object,machineState:Object,machinePos:Object,disabled:Boolean,loading:Boolean},components:{FeedersTable:F2},data:function(){return{feederTypes:[{id:0,name:"Liner"},{id:1,name:"Push-pull"},{id:2,name:"Heap"}],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()}}},U2={class:"card"},O2=c("div",{class:"card-header"},"Feeders Settings",-1),N2={class:"card-body"},z2={class:"mt-1"},k2=["disabled"];function B2(t,e,n,i,s,o){const r=et("FeedersTable");return W(),ee("div",U2,[O2,c("div",N2,[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)),onAdjPosition:e[3]||(e[3]=a=>t.$emit("adjPosition",a)),onAdjFeederPositionCV:e[4]||(e[4]=a=>t.$emit("adjFeederPositionCV",a)),onDropIntoBasket:e[5]||(e[5]=a=>t.$emit("dropIntoBasket",a)),onAdd:e[6]||(e[6]=a=>o.addFeeder()),onSet:e[7]||(e[7]=a=>t.currentFeeder=a),onUp:e[8]||(e[8]=a=>t.rowUp(n.feeders,a)),onDown:e[9]||(e[9]=a=>t.rowDown(n.feeders,a)),onDelete:e[10]||(e[10]=a=>t.rowDelete(n.feeders,a))},null,8,["rows","currentRow","settings","cases","feederTypes","machineState","machinePos","disabled"]),c("div",z2,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary me-1",onClick:e[11]||(e[11]=a=>o.saveFeeders())},"Save feeders",8,k2)])])])}var _p=ct(L2,[["render",B2]]);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))}}},$2={class:"card"},H2=c("div",{class:"card-header"},"PCB Table Settings",-1),G2={class:"card-body"},W2={class:"mb-3"},X2=c("label",{class:"form-label"},"PCB Table position",-1),j2={class:"row mb-2"},Y2={class:"col"},q2={class:"row"},Z2=c("div",{class:"col-auto pt-1"},"X:",-1),K2={class:"col"},J2={class:"col"},Q2={class:"row"},e3=c("div",{class:"col-auto pt-1"},"Y:",-1),t3={class:"col"},n3={class:"col"},i3={class:"row"},s3=c("div",{class:"col-auto pt-1"},"Z:",-1),o3={class:"col"},r3={class:"col-auto"},a3=c("div",{class:"form-text"},"Left bottom PCB table position",-1),l3={class:"row mt-2"},c3={class:"col"},d3=["disabled"];function u3(t,e,n,i,s,o){return W(),ee("div",$2,[H2,c("div",G2,[c("div",W2,[X2,c("div",j2,[c("div",Y2,[c("div",q2,[Z2,c("div",K2,[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),[[me,n.pcbtable.x]])])])]),c("div",J2,[c("div",Q2,[e3,c("div",t3,[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),[[me,n.pcbtable.y]])])])]),c("div",n3,[c("div",i3,[s3,c("div",o3,[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),[[me,n.pcbtable.z]])])])]),c("div",r3,[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}")])]),a3]),c("div",l3,[c("div",c3,[c("button",{disabled:n.loading,class:"btn btn-sm btn-outline-secondary",onClick:e[4]||(e[4]=r=>o.applaySettings())},"Applay settings",8,d3)])])])])}var h3=ct(V2,[["render",u3]]);const f3={mixins:[Ss,Hn,Ms],props:{settings:Object,machineState:Object,machinePos:Object,feeders:Object,disabled:Boolean},components:{CopyPasteMenu:bo},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))}}},nn=t=>(Aa("data-v-64bc414d"),t=t(),Pa(),t),p3={class:"row"},m3={class:"col mh-100"},_3={class:"scroll"},g3={class:"table mb-5",ref:"table"},v3=nn(()=>c("th",null,null,-1)),b3=nn(()=>c("th",null,"Name",-1)),y3=nn(()=>c("th",null,"Caption",-1)),x3={nowrap:""},S3=we("Feeder "),M3=we(),E3={nowrap:""},w3=we("Nozzle "),T3=we(),C3={nowrap:""},A3=we("X "),P3=we(),R3={nowrap:""},D3=we("Y "),I3=we(),F3=nn(()=>c("th",null,"A",-1)),L3=nn(()=>c("th",null,null,-1)),U3=nn(()=>c("th",null,null,-1)),O3=["onMousedown"],N3={key:0},z3=we("\u2BC8"),k3={key:1},B3=["onUpdate:modelValue"],V3=["onUpdate:modelValue"],$3=["onUpdate:modelValue"],H3=["value"],G3={nowrap:""},W3=["onUpdate:modelValue"],X3=["onUpdate:modelValue"],j3=["onUpdate:modelValue"],Y3=["onUpdate:modelValue"],q3={nowrap:""},Z3=["onClick"],K3=["onClick"],J3=["onClick"],Q3={class:"text-end"},eD={class:"col"},tD={class:"scroll"},nD={key:0,class:"card"},iD={class:"card-header"},sD={class:"card-body"},oD={class:"mb-3"},rD=nn(()=>c("label",{class:"form-label"},"Name",-1)),aD={class:"row mb-2"},lD={class:"col"},cD={class:"mb-3"},dD=nn(()=>c("label",{class:"form-label"},"Caption",-1)),uD={class:"row mb-2"},hD={class:"col"},fD={class:"mb-3"},pD=nn(()=>c("label",{class:"form-label"},"Feeder",-1)),mD={class:"row mb-2"},_D={class:"col"},gD=["value"],vD={class:"mb-3"},bD=nn(()=>c("label",{class:"form-label"},"Position",-1)),yD={class:"row mb-2"},xD={class:"col"},SD=we(" X: "),MD={class:"col"},ED=we(" Y: "),wD={class:"col"},TD=we(" A: "),CD={class:"col-auto"},AD={class:"mb-3"},PD=nn(()=>c("label",{class:"form-label"},"Active",-1)),RD={class:"row mb-2"},DD={class:"col"},ID={class:"form-check form-switch"},FD={key:1,class:"card mt-1"},LD=nn(()=>c("div",{class:"card-header"},"Actions",-1)),UD={class:"card-body"},OD=["disabled"],ND=["disabled"],zD=["disabled"],kD=we("Jog Nozzle to "),BD=nn(()=>c("b",null,"Element",-1)),VD=we(" position"),$D=[kD,BD,VD],HD=["disabled"],GD=we("Jog Nozzle to to "),WD=nn(()=>c("b",null,"Feeder",-1)),XD=we(" position"),jD=[GD,WD,XD],YD=["disabled"],qD=we("Jog Camera to "),ZD=nn(()=>c("b",null,"Element",-1)),KD=we(" position"),JD=[qD,ZD,KD],QD=["disabled"],eI=we("Jog Camera to to "),tI=nn(()=>c("b",null,"Feeder",-1)),nI=we(" position"),iI=[eI,tI,nI];function sI(t,e,n,i,s,o){const r=et("CopyPasteMenu");return W(),ee("div",p3,[c("div",m3,[c("div",_3,[c("table",g3,[c("thead",null,[c("tr",null,[v3,b3,y3,c("th",x3,[S3,c("a",{onClick:e[0]||(e[0]=a=>t.$emit("sortElements",{field:"feeder",order:"up"})),title:"Sort by Feeder"},"\u2BC5"),M3,c("a",{onClick:e[1]||(e[1]=a=>t.$emit("sortElements",{field:"feeder",order:"down"})),title:"Sort by Feeder"},"\u2BC6")]),c("th",E3,[w3,c("a",{onClick:e[2]||(e[2]=a=>t.$emit("sortElements",{field:"nozzle",order:"up"})),title:"Sort by Nozzle"},"\u2BC5"),T3,c("a",{onClick:e[3]||(e[3]=a=>t.$emit("sortElements",{field:"nozzle",order:"down"})),title:"Sort by Nozzle"},"\u2BC6")]),c("th",C3,[A3,c("a",{onClick:e[4]||(e[4]=a=>t.$emit("sortElements",{field:"x",order:"up"})),title:"Sort by X"},"\u2BC5"),P3,c("a",{onClick:e[5]||(e[5]=a=>t.$emit("sortElements",{field:"x",order:"down"})),title:"Sort by X"},"\u2BC6")]),c("th",R3,[D3,c("a",{onClick:e[6]||(e[6]=a=>t.$emit("sortElements",{field:"y",order:"up"})),title:"Sort by Y"},"\u2BC5"),I3,c("a",{onClick:e[7]||(e[7]=a=>t.$emit("sortElements",{field:"y",order:"down"})),title:"Sort by Y"},"\u2BC6")]),F3,L3,U3])]),c("tbody",null,[(W(!0),ee(at,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",N3,[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(()=>[z3]),_:2},1032,["row","clipboard"])])):(W(),ee("span",k3,"\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,B3),[[me,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),[[me,a.caption]])]),c("td",null,[se(c("select",{"onUpdate:modelValue":d=>a.feeder=d,class:"form-control form-control-sm"},[(W(!0),ee(at,null,wt(n.feeders,d=>(W(),ee("option",{value:d.id},ze(d.name)+" ( "+ze(d.caption)+" )",9,H3))),256))],8,$3),[[Jn,a.feeder]])]),c("td",G3,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,W3),[[me,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,X3),[[me,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,j3),[[me,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,Y3),[[Kn,a.active]])]),c("th",q3,[c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:d=>t.$emit("up",a)},"\u2BC5",8,Z3),c("button",{class:"btn btn-sm btn-outline-secondary me-1",onClick:d=>t.$emit("down",a)},"\u2BC6",8,K3),c("button",{class:"btn btn-sm btn-outline-secondary btn-danger",onClick:d=>t.$emit("delete",a)},"\u2BBF",8,J3)])],42,O3))),256))])],512),c("div",Q3,[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",eD,[c("div",tD,[o.isCurrent?(W(),ee("div",nD,[c("div",iD,"Element "+ze(t.currentRow.name)+" (# "+ze(t.currentRow.id)+")",1),c("div",sD,[c("div",oD,[rD,c("div",aD,[c("div",lD,[se(c("input",{"onUpdate:modelValue":e[19]||(e[19]=a=>t.currentRow.name=a),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.name]])])])]),c("div",cD,[dD,c("div",uD,[c("div",hD,[se(c("input",{"onUpdate:modelValue":e[20]||(e[20]=a=>t.currentRow.caption=a),type:"text",class:"form-control form-control-sm"},null,512),[[me,t.currentRow.caption]])])])]),c("div",fD,[pD,c("div",mD,[c("div",_D,[se(c("select",{"onUpdate:modelValue":e[21]||(e[21]=a=>t.currentRow.feeder=a),class:"form-control form-control-sm"},[(W(!0),ee(at,null,wt(n.feeders,a=>(W(),ee("option",{value:a.id},ze(a.name)+" ( "+ze(a.caption)+" )",9,gD))),256))],512),[[Jn,t.currentRow.feeder]])])])]),c("div",vD,[bD,c("div",yD,[c("div",xD,[SD,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),[[me,t.currentRow.pos.x]])]),c("div",MD,[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),[[me,t.currentRow.pos.y]])]),c("div",wD,[TD,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),[[me,t.currentRow.pos.a]])]),c("div",CD,[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",AD,[PD,c("div",RD,[c("div",DD,[c("div",ID,[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),[[Kn,t.currentRow.active]])])])])])])])):ot("",!0),o.isCurrent?(W(),ee("div",FD,[LD,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,OD),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,ND)]),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))},$D,8,zD),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))},jD,8,HD)]),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))},JD,8,YD),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))},iI,8,QD)])])])):ot("",!0)])])])}var oI=ct(f3,[["render",sI],["__scopeId","data-v-64bc414d"]]);const rI={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()}}},aI=t=>(Aa("data-v-c19ddb68"),t=t(),Pa(),t),lI=aI(()=>c("div",{class:"dialog-overlay"},null,-1)),cI={class:"dialogtitle"},dI={class:"title"},uI={class:"content"};function hI(t,e,n,i,s,o){return W(),ee("div",null,[lI,c("div",{class:"dialog",ref:"win"+n.number},[c("div",cI,[c("div",dI,ze(n.title),1),c("div",{class:"btn imgClose",onClick:e[0]||(e[0]=r=>o.close()),title:"Close"})]),c("div",uI,[to(t.$slots,"default",{},void 0,!0)])],512)])}var fI=ct(rI,[["render",hI],["__scopeId","data-v-c19ddb68"]]);const pI={mixins:[Oa,Hn],components:{FeedersSettings:_p,ElementsTable:oI,DialogWindow:fI},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)))})},pnpAdjFeederPositionCV(t){this.$emit("adjFeederPositionCV",t)},pnpAdjFeedersPositionCV(){this.$emit("adjFeedersPositionCV",this.project.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)},pnpAdjPosition(t){this.$emit("adjPosition",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"):st(`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 Zy("Please enter new project name:","Rename",t);e!==null&&e!=!1&&(this.projectsList.indexOf(e)==-1?this.$emit("renameProject",{name:t,newName:e}):st("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"?s<o?-1:s>o?1:0:o<s?-1:o>s?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(`
  7. `);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),st("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]):st("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))},adjPCBPositionCV(){this.$emit("adjPCBPositionCV",this.project)},findElement(){this.setCurrentElement(this.pnpProcessing.element),this.tab=1},run(){this.$emit("run")},pause(){this.$emit("pause")},stop(){this.$emit("stop")}}},mI={style:{"max-height":"400px","overflow-y":"auto"}},_I={class:"table",ref:"table"},gI=c("thead",null,[c("tr",null,[c("th"),c("th",null,"Projects")])],-1),vI=["onClick","onDblclick"],bI={width:"2"},yI={key:0},xI={key:1},SI={class:"float-end",style:{position:"absolute",bottom:"0px"}},MI=["disabled"],EI=["disabled"],wI={size:"20",disabled:"",class:"form-control"},TI={class:"float-end",style:{position:"absolute",bottom:"0px"}},CI=["disabled"],AI=["disabled"],PI={style:{"max-height":"400px","overflow-y":"auto"}},RI={class:"table",ref:"table"},DI=c("thead",null,[c("tr",null,[c("th"),c("th",null,"Project"),c("th")])],-1),II=["onClick"],FI={width:"2"},LI={key:0},UI={key:1},OI={width:"220"},NI=["disabled","onClick"],zI=["disabled","onClick"],kI=["disabled","onClick"],BI={class:"float-end",style:{position:"absolute",bottom:"0px"}},VI=["disabled"],$I={class:"project-name"},HI={class:"row"},GI={class:"col"},WI=we(" Project: "),XI={class:"col-auto"},jI=["disabled"],YI=["disabled"],qI=["disabled"],ZI=["disabled"],KI=["disabled"],JI={class:"nav nav-tabs"},QI={class:"nav-item"},eF={class:"nav-item"},tF={class:"nav-item"},nF={class:"nav-item"},iF={class:"row mt-2"},sF={class:"col project"},oF=["disabled"],rF={class:"row mt-2"},aF={class:"col"},lF={class:"row mt-2"},cF={class:"col"},dF={class:"card mb-4"},uF=c("div",{class:"card-header"},"Manual position Adjustment",-1),hF={class:"card-body"},fF=["disabled"],pF={class:"mb-3"},mF=c("label",{class:"form-label"},"Offset of first element (manual correction)",-1),_F={class:"row mb-2"},gF={class:"col"},vF=we(" X: "),bF={class:"col"},yF=we(" Y: "),xF={class:"col-auto"},SF={class:"mb-3"},MF=c("label",{class:"form-label"},"PCB thickness",-1),EF={class:"card"},wF=c("div",{class:"card-header"},"Automatically position Adjustment",-1),TF={class:"card-body"},CF={class:"mb-3"},AF=["disabled"],PF=c("div",null,"(fiducials are need)",-1),RF={class:"row mt-2"},DF={class:"col"},IF={class:"card mb-4"},FF=c("div",{class:"card-header"},"Before Run Adjustment",-1),LF={class:"card-body"},UF=["disabled"],OF=["disabled"],NF=we(" (fiducials are need) "),zF={class:"card"},kF=c("div",{class:"card-header"},"Run",-1),BF={class:"card-body"},VF=["disabled"],$F=["disabled"],HF={key:0},GF={key:1},WF=["disabled"],XF={key:0,class:"alert alert-success",role:"alert"},jF={key:0};function YF(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",mI,[c("table",_I,[gI,c("tbody",null,[(W(!0),ee(at,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",bI,[s.inpuValue==d?(W(),ee("span",yI,"\u2BC8")):(W(),ee("span",xI,"\xA0\xA0"))]),c("td",null,ze(d),1)],42,vI))),256))])],512)]),c("div",SI,[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,MI),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),[[ln,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]=tp(d=>{n.project.name=s.inpuValue,o.closeDialogSaveAs(),o.saveProject()},["enter"]))},null,544),[[me,s.inpuValue]]),c("div",null,[c("select",wI,[(W(!0),ee(at,null,wt(o.projectsList,d=>(W(),ee("option",null,ze(d),1))),256))])]),c("div",TI,[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,CI),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,AI)])]),_:1},512),[[ln,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",PI,[c("table",RI,[DI,c("tbody",null,[(W(!0),ee(at,null,wt(o.projectsList,d=>(W(),ee("tr",{onClick:u=>s.inpuValue=d,class:je(s.inpuValue==d?"active-row":"")},[c("td",FI,[s.inpuValue==d?(W(),ee("span",LI,"\u2BC8")):(W(),ee("span",UI,"\xA0\xA0"))]),c("td",null,ze(d),1),c("td",OI,[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,NI),c("button",{disabled:n.loading,type:"button",class:"btn btn-sm btn-outline-secondary me-1",onClick:u=>o.renameProject(d)},"Rename",8,zI),c("button",{disabled:n.loading,type:"button",class:"btn btn-sm btn-outline-secondary me-1",onClick:u=>o.deleteProject(d)},"Delete",8,kI)])],10,II))),256))])],512)]),c("div",BI,[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,VI)])]),_:1},512),[[ln,s.showWindow[2]]]),c("div",$I,[c("div",HI,[c("div",GI,[WI,c("b",null,ze(n.project.name),1)]),c("div",XI,[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,jI),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,YI),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,qI),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,ZI),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,KI)])])]),c("ul",JI,[c("li",QI,[c("a",{class:je("nav-link"+(s.tab==0?" active":"")),onClick:e[16]||(e[16]=d=>s.tab=0)},"Feeders",2)]),c("li",eF,[c("a",{class:je("nav-link"+(s.tab==1?" active":"")),onClick:e[17]||(e[17]=d=>s.tab=1)},"Elements",2)]),c("li",tF,[c("a",{class:je("nav-link"+(s.tab==2?" active":"")),onClick:e[18]||(e[18]=d=>s.tab=2)},"PCB",2)]),c("li",nF,[c("a",{class:je("nav-link"+(s.tab==3?" active":"")),onClick:e[19]||(e[19]=d=>s.tab=3)},"Job",2)])]),se(c("div",iF,[c("div",sF,[ke(a,{settings:n.settings,cases:n.cases,machineState:n.machineState,machinePos:n.machinePos,feeders:n.project.feeders,disabled:n.disabled,loading:n.loading,onAdjFeederPositionCV:e[20]||(e[20]=d=>o.pnpAdjFeederPositionCV(d)),onGoToFeeder:e[21]||(e[21]=d=>o.pnpGoToFeeder(d)),onGoToFeederCam:e[22]||(e[22]=d=>o.pnpGoToFeederCam(d)),onPickFromFeeder:e[23]||(e[23]=d=>o.pnpPickFromFeeder(d)),onAdjPosition:e[24]||(e[24]=d=>o.pnpAdjPosition(d)),onDropIntoBasket:e[25]||(e[25]=d=>o.pnpDropIntoBasket(d)),onSaveFeeders:e[26]||(e[26]=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[27]||(e[27]=d=>o.importFeeder())},"Import from settings"),c("button",{disabled:n.disabled,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[28]||(e[28]=d=>o.pnpAdjFeedersPositionCV())},"Adjust position of all active feeders using CV",8,oF)])],512),[[ln,s.tab==0]]),se(c("div",rF,[c("div",aF,[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[29]||(e[29]=d=>o.pnpGoToFeeder(d)),onGoToFeederCam:e[30]||(e[30]=d=>o.pnpGoToFeederCam(d)),onGoToElement:e[31]||(e[31]=d=>o.goToElement(d)),onGoToElementCam:e[32]||(e[32]=d=>o.goToElementCam(d)),onPlaceElement:e[33]||(e[33]=d=>o.placeElement(d)),onSortElements:e[34]||(e[34]=d=>o.sortElements(d)),onRunFrom:e[35]||(e[35]=d=>o.runFrom(d)),onAdd:e[36]||(e[36]=d=>o.addElement()),onImport:e[37]||(e[37]=d=>o.importElements()),onSet:e[38]||(e[38]=d=>o.setCurrentElement(d)),onUp:e[39]||(e[39]=d=>t.rowUp(n.project.elements,d)),onDown:e[40]||(e[40]=d=>t.rowDown(n.project.elements,d)),onDelete:e[41]||(e[41]=d=>t.rowDelete(n.project.elements,d))},null,8,["rows","currentRow","feeders","settings","machineState","machinePos","disabled"])])],512),[[ln,s.tab==1]]),se(c("div",lF,[c("div",cF,[c("div",dF,[uF,c("div",hF,[c("div",null,[c("button",{disabled:n.disabled,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[42]||(e[42]=d=>o.jogFirstElement())},"Jog Camera to first elment",8,fF)]),c("div",pF,[mF,c("div",_F,[c("div",gF,[vF,se(c("input",{"onUpdate:modelValue":e[43]||(e[43]=d=>n.project.pcb.pos.x=d),type:"number",class:"form-control form-control-sm",step:"0.01"},null,512),[[me,n.project.pcb.pos.x]])]),c("div",bF,[yF,se(c("input",{"onUpdate:modelValue":e[44]||(e[44]=d=>n.project.pcb.pos.y=d),type:"number",class:"form-control form-control-sm",step:"0.01"},null,512),[[me,n.project.pcb.pos.y]])]),c("div",xF,[c("button",{class:"btn btn-sm btn-outline-secondary btn-danger me-1 mt-3",onClick:e[45]||(e[45]=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[46]||(e[46]=d=>o.setPCBPos()),title:"Set current position of nozzle"},"\u{1F78A}")])])]),c("div",SF,[MF,se(c("input",{"onUpdate:modelValue":e[47]||(e[47]=d=>n.project.pcb.pos.z=d),type:"number",class:"form-control form-control-sm",step:"0.01"},null,512),[[me,n.project.pcb.pos.z]])])])]),c("div",EF,[wF,c("div",TF,[c("div",CF,[c("button",{disabled:n.disabled,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[48]||(e[48]=d=>o.adjPCBPositionCV())},"Adjust PCB Offsets by CV",8,AF),PF])])])])],512),[[ln,s.tab==2]]),se(c("div",RF,[c("div",DF,[c("div",IF,[FF,c("div",LF,[c("div",null,[c("button",{disabled:n.disabled,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[49]||(e[49]=d=>o.pnpAdjFeedersPositionCV())},"Adjust position of all active feeders using CV",8,UF)]),c("div",null,[c("button",{disabled:n.disabled,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[50]||(e[50]=d=>o.adjPCBPositionCV())},"Adjust PCB Offsets by CV",8,OF),NF])])]),c("div",zF,[kF,c("div",BF,[c("button",{disabled:n.disabled,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[51]||(e[51]=d=>o.run())},"Start",8,VF),c("button",{disabled:n.pnpProcessing.runFlag==!1,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[52]||(e[52]=d=>o.pause())},[n.pnpProcessing.pauseFlag==!1?(W(),ee("span",HF,"Pause")):(W(),ee("span",GF,"Resume"))],8,$F),c("button",{disabled:n.pnpProcessing.runFlag==!1,type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[53]||(e[53]=d=>o.stop())},"Stop",8,WF),n.pnpProcessing.message!=""?(W(),ee("div",XF,[we(ze(n.pnpProcessing.message)+" ",1),this.pnpProcessing.runFlag==!1?(W(),ee("span",jF,[c("button",{type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[54]||(e[54]=d=>o.findElement())},"Find Element in elements list"),c("button",{type:"button",class:"btn btn-sm btn-outline-secondary m-1",onClick:e[55]||(e[55]=d=>o.runFrom(this.pnpProcessing.element))},"Resume Job from this element")])):ot("",!0)])):ot("",!0)])])])],512),[[ln,s.tab==3]])])}var qF=ct(pI,[["render",YF]]);const ZF={props:{loading:Boolean}},KF={key:0,class:"loader-bg"},JF=c("div",{class:"loader-track"},[c("div",{class:"loader-fill"},"\xA0")],-1),QF=[JF];function eL(t,e,n,i,s,o){return n.loading?(W(),ee("div",KF,QF)):ot("",!0)}var tL=ct(ZF,[["render",eL]]);/**
  8. * @license
  9. * Copyright 2010-2025 Three.js Authors
  10. * SPDX-License-Identifier: MIT
  11. */const ad="176",Js={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Xs={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},nL=0,Iu=1,iL=2,gp=1,sL=2,ci=3,$i=0,hn=1,On=2,zi=0,Qs=1,Fu=2,Lu=3,Uu=4,oL=5,ds=100,rL=101,aL=102,lL=103,cL=104,dL=200,uL=201,hL=202,fL=203,Jl=204,Ql=205,pL=206,mL=207,_L=208,gL=209,vL=210,bL=211,yL=212,xL=213,SL=214,ec=0,tc=1,nc=2,ro=3,ic=4,sc=5,oc=6,rc=7,ld=0,ML=1,EL=2,ki=0,wL=1,TL=2,CL=3,AL=4,PL=5,RL=6,DL=7,vp=300,ao=301,lo=302,ac=303,lc=304,za=306,cc=1e3,ps=1001,dc=1002,Vn=1003,IL=1004,Mr=1005,Zn=1006,el=1007,ms=1008,ti=1009,bp=1010,yp=1011,rr=1012,cd=1013,bs=1014,hi=1015,fr=1016,dd=1017,ud=1018,ar=1020,xp=35902,Sp=1021,Mp=1022,kn=1023,lr=1026,cr=1027,Ep=1028,hd=1029,wp=1030,fd=1031,pd=1033,ea=33776,ta=33777,na=33778,ia=33779,uc=35840,hc=35841,fc=35842,pc=35843,mc=36196,_c=37492,gc=37496,vc=37808,bc=37809,yc=37810,xc=37811,Sc=37812,Mc=37813,Ec=37814,wc=37815,Tc=37816,Cc=37817,Ac=37818,Pc=37819,Rc=37820,Dc=37821,sa=36492,Ic=36494,Fc=36495,Tp=36283,Lc=36284,Uc=36285,Oc=36286,FL=3200,LL=3201,Cp=0,UL=1,Li="",wn="srgb",co="srgb-linear",ma="linear",bt="srgb",As=7680,Ou=519,OL=512,NL=513,zL=514,Ap=515,kL=516,BL=517,VL=518,$L=519,Nu=35044,zu="300 es",fi=2e3,_a=2001;class Es{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<r;o++)s[o].call(this,e);e.target=null}}}const qt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let ku=1234567;const Yo=Math.PI/180,uo=180/Math.PI;function yo(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(qt[t&255]+qt[t>>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 rt(t,e,n){return Math.max(e,Math.min(n,t))}function md(t,e){return(t%e+e)%e}function HL(t,e,n,i,s){return i+(t-e)*(s-i)/(n-e)}function GL(t,e,n){return t!==e?(n-t)/(e-t):0}function qo(t,e,n){return(1-n)*t+n*e}function WL(t,e,n,i){return qo(t,e,1-Math.exp(-n*i))}function XL(t,e=1){return e-Math.abs(md(t,e*2)-e)}function jL(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function YL(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function qL(t,e){return t+Math.floor(Math.random()*(e-t+1))}function ZL(t,e){return t+Math.random()*(e-t)}function KL(t){return t*(.5-Math.random())}function JL(t){t!==void 0&&(ku=t);let e=ku+=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 QL(t){return t*Yo}function eU(t){return t*uo}function tU(t){return(t&t-1)===0&&t!==0}function nU(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function iU(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function sU(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 Ws(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 rn(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 oU={DEG2RAD:Yo,RAD2DEG:uo,generateUUID:yo,clamp:rt,euclideanModulo:md,mapLinear:HL,inverseLerp:GL,lerp:qo,damp:WL,pingpong:XL,smoothstep:jL,smootherstep:YL,randInt:qL,randFloat:ZL,randFloatSpread:KL,seededRandom:JL,degToRad:QL,radToDeg:eU,isPowerOfTwo:tU,ceilPowerOfTwo:nU,floorPowerOfTwo:iU,setQuaternionFromProperEuler:sU,normalize:rn,denormalize:Ws};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=rt(this.x,e.x,n.x),this.y=rt(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=rt(this.x,e,n),this.y=rt(this.y,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(rt(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(rt(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(tl.makeScale(e,n)),this}rotate(e){return this.premultiply(tl.makeRotation(-e)),this}translate(e,n){return this.premultiply(tl.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 tl=new tt;function Pp(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function ga(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function rU(){const t=ga("canvas");return t.style.display="block",t}const Bu={};function oa(t){t in Bu||(Bu[t]=!0,console.warn(t))}function aU(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 lU(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 cU(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 Vu=new tt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),$u=new tt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function dU(){const t={enabled:!0,workingColorSpace:co,spaces:{},convert:function(s,o,r){return this.enabled===!1||o===r||!o||!r||(this.spaces[o].transfer===bt&&(s.r=pi(s.r),s.g=pi(s.g),s.b=pi(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=eo(s.r),s.g=eo(s.g),s.b=eo(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?ma: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({[co]:{primaries:e,whitePoint:i,transfer:ma,toXYZ:Vu,fromXYZ:$u,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:wn},outputColorSpaceConfig:{drawingBufferColorSpace:wn}},[wn]:{primaries:e,whitePoint:i,transfer:bt,toXYZ:Vu,fromXYZ:$u,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:wn}}}),t}const ft=dU();function pi(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function eo(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let Ps;class uU{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{Ps===void 0&&(Ps=ga("canvas")),Ps.width=e.width,Ps.height=e.height;const s=Ps.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),i=Ps}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=ga("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;r<o.length;r++)o[r]=pi(o[r]/255)*255;return i.putImageData(s,0,0),n}else if(e.data){const n=e.data.slice(0);for(let i=0;i<n.length;i++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[i]=Math.floor(pi(n[i]/255)*255):n[i]=pi(n[i]);return{data:n,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let hU=0;class _d{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:hU++}),this.uuid=yo(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},s=this.data;if(s!==null){let o;if(Array.isArray(s)){o=[];for(let r=0,a=s.length;r<a;r++)s[r].isDataTexture?o.push(nl(s[r].image)):o.push(nl(s[r]))}else o=nl(s);i.url=o}return n||(e.images[this.uuid]=i),i}}function nl(t){return typeof HTMLImageElement!="undefined"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&t instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap?uU.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let fU=0;class fn extends Es{constructor(e=fn.DEFAULT_IMAGE,n=fn.DEFAULT_MAPPING,i=ps,s=ps,o=Zn,r=ms,a=kn,l=ti,d=fn.DEFAULT_ANISOTROPY,u=Li){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:fU++}),this.uuid=yo(),this.name="",this.source=new _d(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=i,this.wrapT=s,this.magFilter=o,this.minFilter=r,this.anisotropy=d,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Ke(0,0),this.repeat=new Ke(1,1),this.center=new Ke(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new tt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isTextureArray=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isTextureArray=e.isTextureArray,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),n||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==vp)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case cc:e.x=e.x-Math.floor(e.x);break;case ps:e.x=e.x<0?0:1;break;case dc: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 cc:e.y=e.y-Math.floor(e.y);break;case ps:e.y=e.y<0?0:1;break;case dc: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++}}fn.DEFAULT_IMAGE=null;fn.DEFAULT_MAPPING=vp;fn.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=rt(this.x,e.x,n.x),this.y=rt(this.y,e.y,n.y),this.z=rt(this.z,e.z,n.z),this.w=rt(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=rt(this.x,e,n),this.y=rt(this.y,e,n),this.z=rt(this.z,e,n),this.w=rt(this.w,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(rt(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 pU extends Es{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:Zn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,multiview:!1},i);const o=new fn(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<r;a++)this.textures[a]=o.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,n,i=1){if(this.width!==e||this.height!==n||this.depth!==i){this.width=e,this.height=n,this.depth=i;for(let s=0,o=this.textures.length;s<o;s++)this.textures[s].image.width=e,this.textures[s].image.height=n,this.textures[s].image.depth=i;this.dispose()}this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,i=e.textures.length;n<i;n++){this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0,this.textures[n].renderTarget=this;const s=Object.assign({},e.textures[n].image);this.textures[n].source=new _d(s)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ys extends pU{constructor(e=1,n=1,i={}){super(e,n,i),this.isWebGLRenderTarget=!0}}class Rp extends fn{constructor(e=null,n=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:i,depth:s},this.magFilter=Vn,this.minFilter=Vn,this.wrapR=ps,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class mU extends fn{constructor(e=null,n=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:i,depth:s},this.magFilter=Vn,this.minFilter=Vn,this.wrapR=ps,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Xt{constructor(e=0,n=0,i=0,s=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=i,this._w=s}static slerpFlat(e,n,i,s,o,r,a){let l=i[s+0],d=i[s+1],u=i[s+2],f=i[s+3];const h=o[r+0],m=o[r+1],b=o[r+2],y=o[r+3];if(a===0){e[n+0]=l,e[n+1]=d,e[n+2]=u,e[n+3]=f;return}if(a===1){e[n+0]=h,e[n+1]=m,e[n+2]=b,e[n+3]=y;return}if(f!==y||l!==h||d!==m||u!==b){let _=1-a;const p=l*h+d*m+u*b+f*y,T=p>=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 i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.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(rt(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 L{constructor(e=0,n=0,i=0){L.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(Hu.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(Hu.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=rt(this.x,e.x,n.x),this.y=rt(this.y,e.y,n.y),this.z=rt(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=rt(this.x,e,n),this.y=rt(this.y,e,n),this.z=rt(this.z,e,n),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(rt(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 il.copy(this).projectOnVector(e),this.sub(il)}reflect(e){return this.sub(il.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(rt(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 il=new L,Hu=new Xt;class pr{constructor(e=new L(1/0,1/0,1/0),n=new L(-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<i;n+=3)this.expandByPoint(Rn.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,i=e.count;n<i;n++)this.expandByPoint(Rn.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,i=e.length;n<i;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const i=Rn.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,n=!1){return this.makeEmpty(),this.expandByObject(e,n)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,n=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const o=i.getAttribute("position");if(n===!0&&o!==void 0&&e.isInstancedMesh!==!0)for(let r=0,a=o.count;r<a;r++)e.isMesh===!0?e.getVertexPosition(r,Rn):Rn.fromBufferAttribute(o,r),Rn.applyMatrix4(e.matrixWorld),this.expandByPoint(Rn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Er.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Er.copy(i.boundingBox)),Er.applyMatrix4(e.matrixWorld),this.union(Er)}const s=e.children;for(let o=0,r=s.length;o<r;o++)this.expandByObject(s[o],n);return this}containsPoint(e){return e.x>=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,Rn),Rn.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(Co),wr.subVectors(this.max,Co),Rs.subVectors(e.a,Co),Ds.subVectors(e.b,Co),Is.subVectors(e.c,Co),Si.subVectors(Ds,Rs),Mi.subVectors(Is,Ds),Ki.subVectors(Rs,Is);let n=[0,-Si.z,Si.y,0,-Mi.z,Mi.y,0,-Ki.z,Ki.y,Si.z,0,-Si.x,Mi.z,0,-Mi.x,Ki.z,0,-Ki.x,-Si.y,Si.x,0,-Mi.y,Mi.x,0,-Ki.y,Ki.x,0];return!sl(n,Rs,Ds,Is,wr)||(n=[1,0,0,0,1,0,0,0,1],!sl(n,Rs,Ds,Is,wr))?!1:(Tr.crossVectors(Si,Mi),n=[Tr.x,Tr.y,Tr.z],sl(n,Rs,Ds,Is,wr))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Rn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Rn).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:(ii[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ii[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ii[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ii[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ii[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ii[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ii[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ii[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ii),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 ii=[new L,new L,new L,new L,new L,new L,new L,new L],Rn=new L,Er=new pr,Rs=new L,Ds=new L,Is=new L,Si=new L,Mi=new L,Ki=new L,Co=new L,wr=new L,Tr=new L,Ji=new L;function sl(t,e,n,i,s){for(let o=0,r=t.length-3;o<=r;o+=3){Ji.fromArray(t,o);const a=s.x*Math.abs(Ji.x)+s.y*Math.abs(Ji.y)+s.z*Math.abs(Ji.z),l=e.dot(Ji),d=n.dot(Ji),u=i.dot(Ji);if(Math.max(-Math.max(l,d,u),Math.min(l,d,u))>a)return!1}return!0}const _U=new pr,Ao=new L,ol=new L;class ka{constructor(e=new L,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):_U.setFromPoints(e).getCenter(i);let s=0;for(let o=0,r=e.length;o<r;o++)s=Math.max(s,i.distanceToSquared(e[o]));return this.radius=Math.sqrt(s),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const n=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=n*n}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,n){const i=this.center.distanceToSquared(e);return n.copy(e),i>this.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;Ao.subVectors(e,this.center);const n=Ao.lengthSq();if(n>this.radius*this.radius){const i=Math.sqrt(n),s=(i-this.radius)*.5;this.center.addScaledVector(Ao,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):(ol.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ao.copy(e.center).add(ol)),this.expandByPoint(Ao.copy(e.center).sub(ol))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const si=new L,rl=new L,Cr=new L,Ei=new L,al=new L,Ar=new L,ll=new L;class Ba{constructor(e=new L,n=new L(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,si)),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=si.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(si.copy(this.origin).addScaledVector(this.direction,n),si.distanceToSquared(e))}distanceSqToSegment(e,n,i,s){rl.copy(e).add(n).multiplyScalar(.5),Cr.copy(n).sub(e).normalize(),Ei.copy(this.origin).sub(rl);const o=e.distanceTo(n)*.5,r=-this.direction.dot(Cr),a=Ei.dot(this.direction),l=-Ei.dot(Cr),d=Ei.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(rl).addScaledVector(Cr,h),m}intersectSphere(e,n){si.subVectors(e.center,this.origin);const i=si.dot(this.direction),s=si.dot(si)-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<s||isNaN(s))&&(s=r),f>=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<s||s!==s)&&(s=l),s<0)?null:this.at(i>=0?i:s,n)}intersectsBox(e){return this.intersectBox(e,si)!==null}intersectTriangle(e,n,i,s,o){al.subVectors(n,e),Ar.subVectors(i,e),ll.crossVectors(al,Ar);let r=this.direction.dot(ll),a;if(r>0){if(s)return null;a=1}else if(r<0)a=-1,r=-r;else return null;Ei.subVectors(this.origin,e);const l=a*this.direction.dot(Ar.crossVectors(Ei,Ar));if(l<0)return null;const d=a*this.direction.dot(al.cross(Ei));if(d<0||l+d>r)return null;const u=-a*Ei.dot(ll);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/Fs.setFromMatrixColumn(e,0).length(),o=1/Fs.setFromMatrixColumn(e,1).length(),r=1/Fs.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(gU,e,vU)}lookAt(e,n,i){const s=this.elements;return mn.subVectors(e,n),mn.lengthSq()===0&&(mn.z=1),mn.normalize(),wi.crossVectors(i,mn),wi.lengthSq()===0&&(Math.abs(i.z)===1?mn.x+=1e-4:mn.z+=1e-4,mn.normalize(),wi.crossVectors(i,mn)),wi.normalize(),Pr.crossVectors(mn,wi),s[0]=wi.x,s[4]=Pr.x,s[8]=mn.x,s[1]=wi.y,s[5]=Pr.y,s[9]=mn.y,s[2]=wi.z,s[6]=Pr.z,s[10]=mn.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],F=s[5],O=s[9],$=s[13],j=s[2],re=s[6],q=s[10],ae=s[14],G=s[3],fe=s[7],ye=s[11],De=s[15];return o[0]=r*P+a*g+l*j+d*G,o[4]=r*D+a*F+l*re+d*fe,o[8]=r*R+a*O+l*q+d*ye,o[12]=r*E+a*$+l*ae+d*De,o[1]=u*P+f*g+h*j+m*G,o[5]=u*D+f*F+h*re+m*fe,o[9]=u*R+f*O+h*q+m*ye,o[13]=u*E+f*$+h*ae+m*De,o[2]=b*P+y*g+_*j+p*G,o[6]=b*D+y*F+_*re+p*fe,o[10]=b*R+y*O+_*q+p*ye,o[14]=b*E+y*$+_*ae+p*De,o[3]=T*P+w*g+S*j+I*G,o[7]=T*D+w*F+S*re+I*fe,o[11]=T*R+w*O+S*q+I*ye,o[15]=T*E+w*$+S*ae+I*De,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=Fs.set(s[0],s[1],s[2]).length();const r=Fs.set(s[4],s[5],s[6]).length(),a=Fs.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],Dn.copy(this);const d=1/o,u=1/r,f=1/a;return Dn.elements[0]*=d,Dn.elements[1]*=d,Dn.elements[2]*=d,Dn.elements[4]*=u,Dn.elements[5]*=u,Dn.elements[6]*=u,Dn.elements[8]*=f,Dn.elements[9]*=f,Dn.elements[10]*=f,n.setFromRotationMatrix(Dn),i.x=o,i.y=r,i.z=a,this}makePerspective(e,n,i,s,o,r,a=fi){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===fi)m=-(r+o)/(r-o),b=-2*r*o/(r-o);else if(a===_a)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=fi){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===fi)b=(r+o)*f,y=-2*f;else if(a===_a)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 Fs=new L,Dn=new Tt,gU=new L(0,0,0),vU=new L(1,1,1),wi=new L,Pr=new L,mn=new L,Gu=new Tt,Wu=new Xt;class $n{constructor(e=0,n=0,i=0,s=$n.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(rt(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(-rt(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(rt(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(-rt(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(rt(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(-rt(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 Gu.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Gu,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return Wu.setFromEuler(this),this.setFromQuaternion(Wu,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}}$n.DEFAULT_ORDER="XYZ";class gd{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let bU=0;const Xu=new L,Ls=new Xt,oi=new Tt,Rr=new L,Po=new L,yU=new L,xU=new Xt,ju=new L(1,0,0),Yu=new L(0,1,0),qu=new L(0,0,1),Zu={type:"added"},SU={type:"removed"},Us={type:"childadded",child:null},cl={type:"childremoved",child:null};class Nt extends Es{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:bU++}),this.uuid=yo(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Nt.DEFAULT_UP.clone();const e=new L,n=new $n,i=new Xt,s=new L(1,1,1);function o(){i.setFromEuler(n,!1)}function r(){n.setFromQuaternion(i,void 0,!1)}n._onChange(o),i._onChange(r),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new Tt},normalMatrix:{value:new tt}}),this.matrix=new Tt,this.matrixWorld=new Tt,this.matrixAutoUpdate=Nt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new gd,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,n){this.quaternion.setFromAxisAngle(e,n)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,n){return Ls.setFromAxisAngle(e,n),this.quaternion.multiply(Ls),this}rotateOnWorldAxis(e,n){return Ls.setFromAxisAngle(e,n),this.quaternion.premultiply(Ls),this}rotateX(e){return this.rotateOnAxis(ju,e)}rotateY(e){return this.rotateOnAxis(Yu,e)}rotateZ(e){return this.rotateOnAxis(qu,e)}translateOnAxis(e,n){return Xu.copy(e).applyQuaternion(this.quaternion),this.position.add(Xu.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(ju,e)}translateY(e){return this.translateOnAxis(Yu,e)}translateZ(e){return this.translateOnAxis(qu,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(oi.copy(this.matrixWorld).invert())}lookAt(e,n,i){e.isVector3?Rr.copy(e):Rr.set(e,n,i);const s=this.parent;this.updateWorldMatrix(!0,!1),Po.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?oi.lookAt(Po,Rr,this.up):oi.lookAt(Rr,Po,this.up),this.quaternion.setFromRotationMatrix(oi),s&&(oi.extractRotation(s.matrixWorld),Ls.setFromRotationMatrix(oi),this.quaternion.premultiply(Ls.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Zu),Us.child=e,this.dispatchEvent(Us),Us.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(SU),cl.child=e,this.dispatchEvent(cl),cl.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),oi.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),oi.multiply(e.parent.matrixWorld)),e.applyMatrix4(oi),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Zu),Us.child=e,this.dispatchEvent(Us),Us.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,n){if(this[e]===n)return this;for(let i=0,s=this.children.length;i<s;i++){const r=this.children[i].getObjectByProperty(e,n);if(r!==void 0)return r}}getObjectsByProperty(e,n,i=[]){this[e]===n&&i.push(this);const s=this.children;for(let o=0,r=s.length;o<r;o++)s[o].getObjectsByProperty(e,n,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Po,e,yU),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Po,xU,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let i=0,s=n.length;i<s;i++)n[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let i=0,s=n.length;i<s;i++)n[i].traverseVisible(e)}traverseAncestors(e){const n=this.parent;n!==null&&(e(n),n.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const n=this.children;for(let i=0,s=n.length;i<s;i++)n[i].updateMatrixWorld(e)}updateWorldMatrix(e,n){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),n===!0){const s=this.children;for(let o=0,r=s.length;o<r;o++)s[o].updateWorldMatrix(!1,!0)}}toJSON(e){const n=e===void 0||typeof e=="string",i={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const s={};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(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;d<u;d++){const f=l[d];o(e.shapes,f)}else o(e.shapes,l)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(o(e.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,d=this.material.length;l<d;l++)a.push(o(e.materials,this.material[l]));s.material=a}else s.material=o(e.materials,this.material);if(this.children.length>0){s.children=[];for(let a=0;a<this.children.length;a++)s.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){s.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];s.animations.push(o(e.animations,l))}}if(n){const a=r(e.geometries),l=r(e.materials),d=r(e.textures),u=r(e.images),f=r(e.shapes),h=r(e.skeletons),m=r(e.animations),b=r(e.nodes);a.length>0&&(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;i<e.children.length;i++){const s=e.children[i];this.add(s.clone())}return this}}Nt.DEFAULT_UP=new L(0,1,0);Nt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const In=new L,ri=new L,dl=new L,ai=new L,Os=new L,Ns=new L,Ku=new L,ul=new L,hl=new L,fl=new L,pl=new It,ml=new It,_l=new It;class Nn{constructor(e=new L,n=new L,i=new L){this.a=e,this.b=n,this.c=i}static getNormal(e,n,i,s){s.subVectors(i,n),In.subVectors(e,n),s.cross(In);const o=s.lengthSq();return o>0?s.multiplyScalar(1/Math.sqrt(o)):s.set(0,0,0)}static getBarycoord(e,n,i,s,o){In.subVectors(s,n),ri.subVectors(i,n),dl.subVectors(e,n);const r=In.dot(In),a=In.dot(ri),l=In.dot(dl),d=ri.dot(ri),u=ri.dot(dl),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,ai)===null?!1:ai.x>=0&&ai.y>=0&&ai.x+ai.y<=1}static getInterpolation(e,n,i,s,o,r,a,l){return this.getBarycoord(e,n,i,s,ai)===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,ai.x),l.addScaledVector(r,ai.y),l.addScaledVector(a,ai.z),l)}static getInterpolatedAttribute(e,n,i,s,o,r){return pl.setScalar(0),ml.setScalar(0),_l.setScalar(0),pl.fromBufferAttribute(e,n),ml.fromBufferAttribute(e,i),_l.fromBufferAttribute(e,s),r.setScalar(0),r.addScaledVector(pl,o.x),r.addScaledVector(ml,o.y),r.addScaledVector(_l,o.z),r}static isFrontFacing(e,n,i,s){return In.subVectors(i,n),ri.subVectors(e,n),In.cross(ri).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 In.subVectors(this.c,this.b),ri.subVectors(this.a,this.b),In.cross(ri).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Nn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Nn.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,i,s,o){return Nn.getInterpolation(e,this.a,this.b,this.c,n,i,s,o)}containsPoint(e){return Nn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Nn.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;Os.subVectors(s,i),Ns.subVectors(o,i),ul.subVectors(e,i);const l=Os.dot(ul),d=Ns.dot(ul);if(l<=0&&d<=0)return n.copy(i);hl.subVectors(e,s);const u=Os.dot(hl),f=Ns.dot(hl);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(Os,r);fl.subVectors(e,o);const m=Os.dot(fl),b=Ns.dot(fl);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(Ns,a);const _=u*b-m*f;if(_<=0&&f-u>=0&&m-b>=0)return Ku.subVectors(o,s),a=(f-u)/(f-u+(m-b)),n.copy(s).addScaledVector(Ku,a);const p=1/(_+y+h);return r=y*p,a=h*p,n.copy(i).addScaledVector(Os,r).addScaledVector(Ns,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Dp={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},Ti={h:0,s:0,l:0},Dr={h:0,s:0,l:0};function gl(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 lt{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=wn){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=md(e,1),n=rt(n,0,1),i=rt(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=gl(r,o,e+1/3),this.g=gl(r,o,e),this.b=gl(r,o,e-1/3)}return ft.toWorkingColorSpace(this,s),this}setStyle(e,n=wn){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=wn){const i=Dp[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=pi(e.r),this.g=pi(e.g),this.b=pi(e.b),this}copyLinearToSRGB(e){return this.r=eo(e.r),this.g=eo(e.g),this.b=eo(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=wn){return ft.fromWorkingColorSpace(Zt.copy(this),e),Math.round(rt(Zt.r*255,0,255))*65536+Math.round(rt(Zt.g*255,0,255))*256+Math.round(rt(Zt.b*255,0,255))}getHexString(e=wn){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+(s<o?6:0);break;case s:l=(o-i)/f+2;break;case o:l=(i-s)/f+4;break}l/=6}return e.h=l,e.s=d,e.l=u,e}getRGB(e,n=ft.workingColorSpace){return ft.fromWorkingColorSpace(Zt.copy(this),n),e.r=Zt.r,e.g=Zt.g,e.b=Zt.b,e}getStyle(e=wn){ft.fromWorkingColorSpace(Zt.copy(this),e);const n=Zt.r,i=Zt.g,s=Zt.b;return e!==wn?`color(${e} ${n.toFixed(3)} ${i.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(i*255)},${Math.round(s*255)})`}offsetHSL(e,n,i){return this.getHSL(Ti),this.setHSL(Ti.h+e,Ti.s+n,Ti.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,i){return this.r=e.r+(n.r-e.r)*i,this.g=e.g+(n.g-e.g)*i,this.b=e.b+(n.b-e.b)*i,this}lerpHSL(e,n){this.getHSL(Ti),e.getHSL(Dr);const i=qo(Ti.h,Dr.h,n),s=qo(Ti.s,Dr.s,n),o=qo(Ti.l,Dr.l,n);return this.setHSL(i,s,o),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,i=this.g,s=this.b,o=e.elements;return this.r=o[0]*n+o[3]*i+o[6]*s,this.g=o[1]*n+o[4]*i+o[7]*s,this.b=o[2]*n+o[5]*i+o[8]*s,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Zt=new lt;lt.NAMES=Dp;let MU=0;class ws extends Es{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:MU++}),this.uuid=yo(),this.name="",this.type="Material",this.blending=Qs,this.side=$i,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Jl,this.blendDst=Ql,this.blendEquation=ds,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new lt(0,0,0),this.blendAlpha=0,this.depthFunc=ro,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Ou,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=As,this.stencilZFail=As,this.stencilZPass=As,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=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!==Qs&&(i.blending=this.blending),this.side!==$i&&(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!==Ql&&(i.blendDst=this.blendDst),this.blendEquation!==ds&&(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!==ro&&(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!==Ou&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==As&&(i.stencilFail=this.stencilFail),this.stencilZFail!==As&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==As&&(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 Va extends ws{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new lt(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 $n,this.combine=ld,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 Ut=new L,Ir=new Ke;let EU=0;class Qn{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:EU++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=i,this.usage=Nu,this.updateRanges=[],this.gpuType=hi,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;s<o;s++)this.array[e+s]=n.array[i+s];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,i=this.count;n<i;n++)Ir.fromBufferAttribute(this,n),Ir.applyMatrix3(e),this.setXY(n,Ir.x,Ir.y);else if(this.itemSize===3)for(let n=0,i=this.count;n<i;n++)Ut.fromBufferAttribute(this,n),Ut.applyMatrix3(e),this.setXYZ(n,Ut.x,Ut.y,Ut.z);return this}applyMatrix4(e){for(let n=0,i=this.count;n<i;n++)Ut.fromBufferAttribute(this,n),Ut.applyMatrix4(e),this.setXYZ(n,Ut.x,Ut.y,Ut.z);return this}applyNormalMatrix(e){for(let n=0,i=this.count;n<i;n++)Ut.fromBufferAttribute(this,n),Ut.applyNormalMatrix(e),this.setXYZ(n,Ut.x,Ut.y,Ut.z);return this}transformDirection(e){for(let n=0,i=this.count;n<i;n++)Ut.fromBufferAttribute(this,n),Ut.transformDirection(e),this.setXYZ(n,Ut.x,Ut.y,Ut.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let i=this.array[e*this.itemSize+n];return this.normalized&&(i=Ws(i,this.array)),i}setComponent(e,n,i){return this.normalized&&(i=rn(i,this.array)),this.array[e*this.itemSize+n]=i,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=Ws(n,this.array)),n}setX(e,n){return this.normalized&&(n=rn(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=Ws(n,this.array)),n}setY(e,n){return this.normalized&&(n=rn(n,this.array)),this.array[e*this.itemSize+1]=n,this}getZ(e){let n=this.array[e*this.itemSize+2];return this.normalized&&(n=Ws(n,this.array)),n}setZ(e,n){return this.normalized&&(n=rn(n,this.array)),this.array[e*this.itemSize+2]=n,this}getW(e){let n=this.array[e*this.itemSize+3];return this.normalized&&(n=Ws(n,this.array)),n}setW(e,n){return this.normalized&&(n=rn(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,i){return e*=this.itemSize,this.normalized&&(n=rn(n,this.array),i=rn(i,this.array)),this.array[e+0]=n,this.array[e+1]=i,this}setXYZ(e,n,i,s){return e*=this.itemSize,this.normalized&&(n=rn(n,this.array),i=rn(i,this.array),s=rn(s,this.array)),this.array[e+0]=n,this.array[e+1]=i,this.array[e+2]=s,this}setXYZW(e,n,i,s,o){return e*=this.itemSize,this.normalized&&(n=rn(n,this.array),i=rn(i,this.array),s=rn(s,this.array),o=rn(o,this.array)),this.array[e+0]=n,this.array[e+1]=i,this.array[e+2]=s,this.array[e+3]=o,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Nu&&(e.usage=this.usage),e}}class Ip extends Qn{constructor(e,n,i){super(new Uint16Array(e),n,i)}}class Fp extends Qn{constructor(e,n,i){super(new Uint32Array(e),n,i)}}class Et extends Qn{constructor(e,n,i){super(new Float32Array(e),n,i)}}let wU=0;const Mn=new Tt,vl=new Nt,zs=new L,_n=new pr,Ro=new pr,$t=new L;class tn extends Es{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:wU++}),this.uuid=yo(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Pp(e)?Fp:Ip)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,n){return this.attributes[e]=n,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,n,i=0){this.groups.push({start:e,count:n,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}applyMatrix4(e){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(e),n.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const o=new tt().getNormalMatrix(e);i.applyNormalMatrix(o),i.needsUpdate=!0}const s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(e),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Mn.makeRotationFromQuaternion(e),this.applyMatrix4(Mn),this}rotateX(e){return Mn.makeRotationX(e),this.applyMatrix4(Mn),this}rotateY(e){return Mn.makeRotationY(e),this.applyMatrix4(Mn),this}rotateZ(e){return Mn.makeRotationZ(e),this.applyMatrix4(Mn),this}translate(e,n,i){return Mn.makeTranslation(e,n,i),this.applyMatrix4(Mn),this}scale(e,n,i){return Mn.makeScale(e,n,i),this.applyMatrix4(Mn),this}lookAt(e){return vl.lookAt(e),vl.updateMatrix(),this.applyMatrix4(vl.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(zs).negate(),this.translate(zs.x,zs.y,zs.z),this}setFromPoints(e){const n=this.getAttribute("position");if(n===void 0){const i=[];for(let s=0,o=e.length;s<o;s++){const r=e[s];i.push(r.x,r.y,r.z||0)}this.setAttribute("position",new Et(i,3))}else{const i=Math.min(e.length,n.count);for(let s=0;s<i;s++){const o=e[s];n.setXYZ(s,o.x,o.y,o.z||0)}e.length>n.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 pr);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 L(-1/0,-1/0,-1/0),new L(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let i=0,s=n.length;i<s;i++){const o=n[i];_n.setFromBufferAttribute(o),this.morphTargetsRelative?($t.addVectors(this.boundingBox.min,_n.min),this.boundingBox.expandByPoint($t),$t.addVectors(this.boundingBox.max,_n.max),this.boundingBox.expandByPoint($t)):(this.boundingBox.expandByPoint(_n.min),this.boundingBox.expandByPoint(_n.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ka);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new L,1/0);return}if(e){const i=this.boundingSphere.center;if(_n.setFromBufferAttribute(e),n)for(let o=0,r=n.length;o<r;o++){const a=n[o];Ro.setFromBufferAttribute(a),this.morphTargetsRelative?($t.addVectors(_n.min,Ro.min),_n.expandByPoint($t),$t.addVectors(_n.max,Ro.max),_n.expandByPoint($t)):(_n.expandByPoint(Ro.min),_n.expandByPoint(Ro.max))}_n.getCenter(i);let s=0;for(let o=0,r=e.count;o<r;o++)$t.fromBufferAttribute(e,o),s=Math.max(s,i.distanceToSquared($t));if(n)for(let o=0,r=n.length;o<r;o++){const a=n[o],l=this.morphTargetsRelative;for(let d=0,u=a.count;d<u;d++)$t.fromBufferAttribute(a,d),l&&(zs.fromBufferAttribute(e,d),$t.add(zs)),s=Math.max(s,i.distanceToSquared($t))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,n=this.attributes;if(e===null||n.position===void 0||n.normal===void 0||n.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=n.position,s=n.normal,o=n.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Qn(new Float32Array(4*i.count),4));const r=this.getAttribute("tangent"),a=[],l=[];for(let R=0;R<i.count;R++)a[R]=new L,l[R]=new L;const d=new L,u=new L,f=new L,h=new Ke,m=new Ke,b=new Ke,y=new L,_=new L;function p(R,E,g){d.fromBufferAttribute(i,R),u.fromBufferAttribute(i,E),f.fromBufferAttribute(i,g),h.fromBufferAttribute(o,R),m.fromBufferAttribute(o,E),b.fromBufferAttribute(o,g),u.sub(d),f.sub(d),m.sub(h),b.sub(h);const F=1/(m.x*b.y-b.x*m.y);!isFinite(F)||(y.copy(u).multiplyScalar(b.y).addScaledVector(f,-m.y).multiplyScalar(F),_.copy(f).multiplyScalar(m.x).addScaledVector(u,-b.x).multiplyScalar(F),a[R].add(y),a[E].add(y),a[g].add(y),l[R].add(_),l[E].add(_),l[g].add(_))}let T=this.groups;T.length===0&&(T=[{start:0,count:e.count}]);for(let R=0,E=T.length;R<E;++R){const g=T[R],F=g.start,O=g.count;for(let $=F,j=F+O;$<j;$+=3)p(e.getX($+0),e.getX($+1),e.getX($+2))}const w=new L,S=new L,I=new L,P=new L;function D(R){I.fromBufferAttribute(s,R),P.copy(I);const E=a[R];w.copy(E),w.sub(I.multiplyScalar(I.dot(E))).normalize(),S.crossVectors(P,E);const F=S.dot(l[R])<0?-1:1;r.setXYZW(R,w.x,w.y,w.z,F)}for(let R=0,E=T.length;R<E;++R){const g=T[R],F=g.start,O=g.count;for(let $=F,j=F+O;$<j;$+=3)D(e.getX($+0)),D(e.getX($+1)),D(e.getX($+2))}}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Qn(new Float32Array(n.count*3),3),this.setAttribute("normal",i);else for(let h=0,m=i.count;h<m;h++)i.setXYZ(h,0,0,0);const s=new L,o=new L,r=new L,a=new L,l=new L,d=new L,u=new L,f=new L;if(e)for(let h=0,m=e.count;h<m;h+=3){const b=e.getX(h+0),y=e.getX(h+1),_=e.getX(h+2);s.fromBufferAttribute(n,b),o.fromBufferAttribute(n,y),r.fromBufferAttribute(n,_),u.subVectors(r,o),f.subVectors(s,o),u.cross(f),a.fromBufferAttribute(i,b),l.fromBufferAttribute(i,y),d.fromBufferAttribute(i,_),a.add(u),l.add(u),d.add(u),i.setXYZ(b,a.x,a.y,a.z),i.setXYZ(y,l.x,l.y,l.z),i.setXYZ(_,d.x,d.y,d.z)}else for(let h=0,m=n.count;h<m;h+=3)s.fromBufferAttribute(n,h+0),o.fromBufferAttribute(n,h+1),r.fromBufferAttribute(n,h+2),u.subVectors(r,o),f.subVectors(s,o),u.cross(f),i.setXYZ(h+0,u.x,u.y,u.z),i.setXYZ(h+1,u.x,u.y,u.z),i.setXYZ(h+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,i=e.count;n<i;n++)$t.fromBufferAttribute(e,n),$t.normalize(),e.setXYZ(n,$t.x,$t.y,$t.z)}toNonIndexed(){function e(a,l){const d=a.array,u=a.itemSize,f=a.normalized,h=new d.constructor(l.length*u);let m=0,b=0;for(let y=0,_=l.length;y<_;y++){a.isInterleavedBufferAttribute?m=l[y]*a.data.stride+a.offset:m=l[y]*u;for(let p=0;p<u;p++)h[b++]=d[m++]}return new Qn(h,u,f)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new tn,i=this.index.array,s=this.attributes;for(const a in s){const l=s[a],d=e(l,i);n.setAttribute(a,d)}const o=this.morphAttributes;for(const a in o){const l=[],d=o[a];for(let u=0,f=d.length;u<f;u++){const h=d[u],m=e(h,i);l.push(m)}n.morphAttributes[a]=l}n.morphTargetsRelative=this.morphTargetsRelative;const r=this.groups;for(let a=0,l=r.length;a<l;a++){const d=r[a];n.addGroup(d.start,d.count,d.materialIndex)}return n}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(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;f<h;f++){const m=d[f];u.push(m.toJSON(e.data))}u.length>0&&(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;h<m;h++)u.push(f[h].clone(n));this.morphAttributes[d]=u}this.morphTargetsRelative=e.morphTargetsRelative;const r=e.groups;for(let d=0,u=r.length;d<u;d++){const f=r[d];this.addGroup(f.start,f.count,f.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Ju=new Tt,Qi=new Ba,Fr=new ka,Qu=new L,Lr=new L,Ur=new L,Or=new L,bl=new L,Nr=new L,eh=new L,zr=new L;class Pe extends Nt{constructor(e=new tn,n=new Va){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const s=n[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,r=s.length;o<r;o++){const a=s[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=o}}}}getVertexPosition(e,n){const i=this.geometry,s=i.attributes.position,o=i.morphAttributes.position,r=i.morphTargetsRelative;n.fromBufferAttribute(s,e);const a=this.morphTargetInfluences;if(o&&a){Nr.set(0,0,0);for(let l=0,d=o.length;l<d;l++){const u=a[l],f=o[l];u!==0&&(bl.fromBufferAttribute(f,e),r?Nr.addScaledVector(bl,u):Nr.addScaledVector(bl.sub(n),u))}n.add(Nr)}return n}raycast(e,n){const i=this.geometry,s=this.material,o=this.matrixWorld;s!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Fr.copy(i.boundingSphere),Fr.applyMatrix4(o),Qi.copy(e.ray).recast(e.near),!(Fr.containsPoint(Qi.origin)===!1&&(Qi.intersectSphere(Fr,Qu)===null||Qi.origin.distanceToSquared(Qu)>(e.far-e.near)**2))&&(Ju.copy(o).invert(),Qi.copy(e.ray).applyMatrix4(Ju),!(i.boundingBox!==null&&Qi.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,n,Qi)))}_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;b<y;b++){const _=h[b],p=r[_.materialIndex],T=Math.max(_.start,m.start),w=Math.min(a.count,Math.min(_.start+_.count,m.start+m.count));for(let S=T,I=w;S<I;S+=3){const P=a.getX(S),D=a.getX(S+1),R=a.getX(S+2);s=kr(this,p,e,i,d,u,f,P,D,R),s&&(s.faceIndex=Math.floor(S/3),s.face.materialIndex=_.materialIndex,n.push(s))}}else{const b=Math.max(0,m.start),y=Math.min(a.count,m.start+m.count);for(let _=b,p=y;_<p;_+=3){const T=a.getX(_),w=a.getX(_+1),S=a.getX(_+2);s=kr(this,r,e,i,d,u,f,T,w,S),s&&(s.faceIndex=Math.floor(_/3),n.push(s))}}else if(l!==void 0)if(Array.isArray(r))for(let b=0,y=h.length;b<y;b++){const _=h[b],p=r[_.materialIndex],T=Math.max(_.start,m.start),w=Math.min(l.count,Math.min(_.start+_.count,m.start+m.count));for(let S=T,I=w;S<I;S+=3){const P=S,D=S+1,R=S+2;s=kr(this,p,e,i,d,u,f,P,D,R),s&&(s.faceIndex=Math.floor(S/3),s.face.materialIndex=_.materialIndex,n.push(s))}}else{const b=Math.max(0,m.start),y=Math.min(l.count,m.start+m.count);for(let _=b,p=y;_<p;_+=3){const T=_,w=_+1,S=_+2;s=kr(this,r,e,i,d,u,f,T,w,S),s&&(s.faceIndex=Math.floor(_/3),n.push(s))}}}}function TU(t,e,n,i,s,o,r,a){let l;if(e.side===hn?l=i.intersectTriangle(r,o,s,!0,a):l=i.intersectTriangle(s,o,r,e.side===$i,a),l===null)return null;zr.copy(a),zr.applyMatrix4(t.matrixWorld);const d=n.ray.origin.distanceTo(zr);return d<n.near||d>n.far?null:{distance:d,point:zr.clone(),object:t}}function kr(t,e,n,i,s,o,r,a,l,d){t.getVertexPosition(a,Lr),t.getVertexPosition(l,Ur),t.getVertexPosition(d,Or);const u=TU(t,e,n,i,Lr,Ur,Or,eh);if(u){const f=new L;Nn.getBarycoord(eh,Lr,Ur,Or,f),s&&(u.uv=Nn.getInterpolatedAttribute(s,a,l,d,f,new Ke)),o&&(u.uv1=Nn.getInterpolatedAttribute(o,a,l,d,f,new Ke)),r&&(u.normal=Nn.getInterpolatedAttribute(r,a,l,d,f,new L),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:l,c:d,normal:new L,materialIndex:0};Nn.getNormal(Lr,Ur,Or,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,F=I/R,O=S/2,$=I/2,j=P/2,re=D+1,q=R+1;let ae=0,G=0;const fe=new L;for(let ye=0;ye<q;ye++){const De=ye*F-$;for(let Be=0;Be<re;Be++){const Je=Be*g-O;fe[y]=Je*T,fe[_]=De*w,fe[p]=j,d.push(fe.x,fe.y,fe.z),fe[y]=0,fe[_]=0,fe[p]=P>0?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;ye<R;ye++)for(let De=0;De<D;De++){const Be=h+De+re*ye,Je=h+De+re*(ye+1),ce=h+(De+1)+re*(ye+1),N=h+(De+1)+re*ye;l.push(Be,Je,N),l.push(Je,ce,N),G+=6}a.addGroup(m,G,E),m+=G,h+=ae}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ot(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function ho(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const s=t[n][i];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][i]=null):e[n][i]=s.clone():Array.isArray(s)?e[n][i]=s.slice():e[n][i]=s}}return e}function an(t){const e={};for(let n=0;n<t.length;n++){const i=ho(t[n]);for(const s in i)e[s]=i[s]}return e}function CU(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function Lp(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ft.workingColorSpace}const AU={clone:ho,merge:an};var PU=`void main() {
  12. gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
  13. }`,RU=`void main() {
  14. gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
  15. }`;class Hi extends ws{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=PU,this.fragmentShader=RU,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ho(e.uniforms),this.uniformsGroups=CU(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const n=super.toJSON(e);n.glslVersion=this.glslVersion,n.uniforms={};for(const s in this.uniforms){const r=this.uniforms[s].value;r&&r.isTexture?n.uniforms[s]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?n.uniforms[s]={type:"c",value:r.getHex()}:r&&r.isVector2?n.uniforms[s]={type:"v2",value:r.toArray()}:r&&r.isVector3?n.uniforms[s]={type:"v3",value:r.toArray()}:r&&r.isVector4?n.uniforms[s]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?n.uniforms[s]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?n.uniforms[s]={type:"m4",value:r.toArray()}:n.uniforms[s]={value:r}}Object.keys(this.defines).length>0&&(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 Up extends Nt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Tt,this.projectionMatrix=new Tt,this.projectionMatrixInverse=new Tt,this.coordinateSystem=fi}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 Ci=new L,th=new Ke,nh=new Ke;class gn extends Up{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=uo*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Yo*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return uo*2*Math.atan(Math.tan(Yo*.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){Ci.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ci.x,Ci.y).multiplyScalar(-e/Ci.z),Ci.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Ci.x,Ci.y).multiplyScalar(-e/Ci.z)}getViewSize(e,n){return this.getViewBounds(e,th,nh),n.subVectors(nh,th)}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(Yo*.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 ks=-90,Bs=1;class DU extends Nt{constructor(e,n,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new gn(ks,Bs,e,n);s.layers=this.layers,this.add(s);const o=new gn(ks,Bs,e,n);o.layers=this.layers,this.add(o);const r=new gn(ks,Bs,e,n);r.layers=this.layers,this.add(r);const a=new gn(ks,Bs,e,n);a.layers=this.layers,this.add(a);const l=new gn(ks,Bs,e,n);l.layers=this.layers,this.add(l);const d=new gn(ks,Bs,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===fi)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===_a)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 Op extends fn{constructor(e=[],n=ao,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 IU extends ys{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 Op(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:Zn}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:`
  16. varying vec3 vWorldDirection;
  17. vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  18. return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  19. }
  20. void main() {
  21. vWorldDirection = transformDirection( position, modelMatrix );
  22. #include <begin_vertex>
  23. #include <project_vertex>
  24. }
  25. `,fragmentShader:`
  26. uniform sampler2D tEquirect;
  27. varying vec3 vWorldDirection;
  28. #include <common>
  29. void main() {
  30. vec3 direction = normalize( vWorldDirection );
  31. vec2 sampleUV = equirectUv( direction );
  32. gl_FragColor = texture2D( tEquirect, sampleUV );
  33. }
  34. `},s=new Ot(5,5,5),o=new Hi({name:"CubemapFromEquirect",uniforms:ho(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:hn,blending:zi});o.uniforms.tEquirect.value=n;const r=new Pe(s,o),a=n.minFilter;return n.minFilter===ms&&(n.minFilter=Zn),new DU(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 Oo extends Nt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const FU={type:"move"};class yl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Oo,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 Oo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new L,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new L),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Oo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new L,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new L),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(FU)))}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 Oo;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}}class LU 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 $n,this.environmentIntensity=1,this.environmentRotation=new $n,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 xl=new L,UU=new L,OU=new tt;class Ii{constructor(e=new L(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=xl.subVectors(i,n).cross(UU.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(xl),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||OU.getNormalMatrix(e),s=this.coplanarPoint(xl).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 es=new ka,Br=new L;class vd{constructor(e=new Ii,n=new Ii,i=new Ii,s=new Ii,o=new Ii,r=new Ii){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=fi){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===fi)i[5].setComponents(l+a,h+f,_+y,S+w).normalize();else if(n===_a)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(),es.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),es.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(es)}intersectsSprite(e){return es.center.set(0,0,0),es.radius=.7071067811865476,es.applyMatrix4(e.matrixWorld),this.intersectsSphere(es)}intersectsSphere(e){const n=this.planes,i=e.center,s=-e.radius;for(let o=0;o<6;o++)if(n[o].distanceToPoint(i)<s)return!1;return!0}intersectsBox(e){const n=this.planes;for(let i=0;i<6;i++){const s=n[i];if(Br.x=s.normal.x>0?e.max.x:e.min.x,Br.y=s.normal.y>0?e.max.y:e.min.y,Br.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(Br)<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 mr extends ws{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new lt(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 va=new L,ba=new L,ih=new Tt,Do=new Ba,Vr=new ka,Sl=new L,sh=new L;class di extends Nt{constructor(e=new tn,n=new mr){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;s<o;s++)va.fromBufferAttribute(n,s-1),ba.fromBufferAttribute(n,s),i[s]=i[s-1],i[s]+=va.distanceTo(ba);e.setAttribute("lineDistance",new Et(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,n){const i=this.geometry,s=this.matrixWorld,o=e.params.Line.threshold,r=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Vr.copy(i.boundingSphere),Vr.applyMatrix4(s),Vr.radius+=o,e.ray.intersectsSphere(Vr)===!1)return;ih.copy(s).invert(),Do.copy(e.ray).applyMatrix4(ih);const a=o/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,d=this.isLineSegments?2:1,u=i.index,h=i.attributes.position;if(u!==null){const m=Math.max(0,r.start),b=Math.min(u.count,r.start+r.count);for(let y=m,_=b-1;y<_;y+=d){const p=u.getX(y),T=u.getX(y+1),w=$r(this,e,Do,l,p,T,y);w&&n.push(w)}if(this.isLineLoop){const y=u.getX(b-1),_=u.getX(m),p=$r(this,e,Do,l,y,_,b-1);p&&n.push(p)}}else{const m=Math.max(0,r.start),b=Math.min(h.count,r.start+r.count);for(let y=m,_=b-1;y<_;y+=d){const p=$r(this,e,Do,l,y,y+1,y);p&&n.push(p)}if(this.isLineLoop){const y=$r(this,e,Do,l,b-1,m,b-1);y&&n.push(y)}}}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const s=n[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,r=s.length;o<r;o++){const a=s[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=o}}}}}function $r(t,e,n,i,s,o,r){const a=t.geometry.attributes.position;if(va.fromBufferAttribute(a,s),ba.fromBufferAttribute(a,o),n.distanceSqToSegment(va,ba,Sl,sh)>i)return;Sl.applyMatrix4(t.matrixWorld);const d=e.ray.origin.distanceTo(Sl);if(!(d<e.near||d>e.far))return{distance:d,point:sh.clone().applyMatrix4(t.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:t}}const oh=new L,rh=new L;class bd extends di{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;s<o;s+=2)oh.fromBufferAttribute(n,s),rh.fromBufferAttribute(n,s+1),i[s]=s===0?0:i[s-1],i[s+1]=i[s]+oh.distanceTo(rh);e.setAttribute("lineDistance",new Et(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Np extends fn{constructor(e,n,i=bs,s,o,r,a=Vn,l=Vn,d,u=lr){if(u!==lr&&u!==cr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super(null,s,o,r,a,l,u,i,d),this.isDepthTexture=!0,this.image={width:e,height:n},this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new _d(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}class Wt extends tn{constructor(e=1,n=1,i=1,s=32,o=1,r=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:n,height:i,radialSegments:s,heightSegments:o,openEnded:r,thetaStart:a,thetaLength:l};const d=this;s=Math.floor(s),o=Math.floor(o);const u=[],f=[],h=[],m=[];let b=0;const y=[],_=i/2;let p=0;T(),r===!1&&(e>0&&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 L,I=new L;let P=0;const D=(n-e)/i;for(let R=0;R<=o;R++){const E=[],g=R/o,F=g*(n-e)+e;for(let O=0;O<=s;O++){const $=O/s,j=$*l+a,re=Math.sin(j),q=Math.cos(j);I.x=F*re,I.y=-g*i+_,I.z=F*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($,1-g),E.push(b++)}y.push(E)}for(let R=0;R<s;R++)for(let E=0;E<o;E++){const g=y[E][R],F=y[E+1][R],O=y[E+1][R+1],$=y[E][R+1];(e>0||E!==0)&&(u.push(g,F,$),P+=3),(n>0||E!==o-1)&&(u.push(F,O,$),P+=3)}d.addGroup(p,P,0),p+=P}function w(S){const I=b,P=new Ke,D=new L;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 F=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<s;O++){const $=I+O,j=F+O;S===!0?u.push(j,j+1,$):u.push(j+1,j,$),R+=3}d.addGroup(p,R,S===!0?1:2),p+=R}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Wt(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class yd extends Wt{constructor(e=1,n=1,i=32,s=1,o=!1,r=0,a=Math.PI*2){super(0,e,n,i,s,o,r,a),this.type="ConeGeometry",this.parameters={radius:e,height:n,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:r,thetaLength:a}}static fromJSON(e){return new yd(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class xd extends tn{constructor(e=[],n=[],i=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:n,radius:i,detail:s};const o=[],r=[];a(s),d(i),u(),this.setAttribute("position",new Et(o,3)),this.setAttribute("normal",new Et(o.slice(),3)),this.setAttribute("uv",new Et(r,2)),s===0?this.computeVertexNormals():this.normalizeNormals();function a(T){const w=new L,S=new L,I=new L;for(let P=0;P<n.length;P+=3)m(n[P+0],w),m(n[P+1],S),m(n[P+2],I),l(w,S,I,T)}function l(T,w,S,I){const P=I+1,D=[];for(let R=0;R<=P;R++){D[R]=[];const E=T.clone().lerp(S,R/P),g=w.clone().lerp(S,R/P),F=P-R;for(let O=0;O<=F;O++)O===0&&R===P?D[R][O]=E:D[R][O]=E.clone().lerp(g,O/F)}for(let R=0;R<P;R++)for(let E=0;E<2*(P-R)-1;E++){const g=Math.floor(E/2);E%2===0?(h(D[R][g+1]),h(D[R+1][g]),h(D[R][g])):(h(D[R][g+1]),h(D[R+1][g+1]),h(D[R+1][g]))}}function d(T){const w=new L;for(let S=0;S<o.length;S+=3)w.x=o[S+0],w.y=o[S+1],w.z=o[S+2],w.normalize().multiplyScalar(T),o[S+0]=w.x,o[S+1]=w.y,o[S+2]=w.z}function u(){const T=new L;for(let w=0;w<o.length;w+=3){T.x=o[w+0],T.y=o[w+1],T.z=o[w+2];const S=_(T)/2/Math.PI+.5,I=p(T)/Math.PI+.5;r.push(S,1-I)}b(),f()}function f(){for(let T=0;T<r.length;T+=6){const w=r[T+0],S=r[T+2],I=r[T+4],P=Math.max(w,S,I),D=Math.min(w,S,I);P>.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 L,w=new L,S=new L,I=new L,P=new Ke,D=new Ke,R=new Ke;for(let E=0,g=0;E<o.length;E+=9,g+=6){T.set(o[E+0],o[E+1],o[E+2]),w.set(o[E+3],o[E+4],o[E+5]),S.set(o[E+6],o[E+7],o[E+8]),P.set(r[g+0],r[g+1]),D.set(r[g+2],r[g+3]),R.set(r[g+4],r[g+5]),I.copy(T).add(w).add(S).divideScalar(3);const F=_(I);y(P,g+0,T,F),y(D,g+2,w,F),y(R,g+4,S,F)}}function y(T,w,S,I){I<0&&T.x===1&&(r[w]=T.x-1),S.x===0&&S.z===0&&(r[w]=I/2/Math.PI+.5)}function _(T){return Math.atan2(T.z,-T.x)}function p(T){return Math.atan2(-T.y,Math.sqrt(T.x*T.x+T.z*T.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new xd(e.vertices,e.indices,e.radius,e.details)}}class js extends xd{constructor(e=1,n=0){const i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],s=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(i,s,e,n),this.type="OctahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new js(e.radius,e.detail)}}class xo extends tn{constructor(e=1,n=1,i=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:n,widthSegments:i,heightSegments:s};const o=e/2,r=n/2,a=Math.floor(i),l=Math.floor(s),d=a+1,u=l+1,f=e/a,h=n/l,m=[],b=[],y=[],_=[];for(let p=0;p<u;p++){const T=p*h-r;for(let w=0;w<d;w++){const S=w*f-o;b.push(S,-T,0),y.push(0,0,1),_.push(w/a),_.push(1-p/l)}}for(let p=0;p<l;p++)for(let T=0;T<a;T++){const w=T+d*p,S=T+d*(p+1),I=T+1+d*(p+1),P=T+1+d*p;m.push(w,S,P),m.push(S,I,P)}this.setIndex(m),this.setAttribute("position",new Et(b,3)),this.setAttribute("normal",new Et(y,3)),this.setAttribute("uv",new Et(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new xo(e.width,e.height,e.widthSegments,e.heightSegments)}}class Sd extends tn{constructor(e=1,n=32,i=16,s=0,o=Math.PI*2,r=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:n,heightSegments:i,phiStart:s,phiLength:o,thetaStart:r,thetaLength:a},n=Math.max(3,Math.floor(n)),i=Math.max(2,Math.floor(i));const l=Math.min(r+a,Math.PI);let d=0;const u=[],f=new L,h=new L,m=[],b=[],y=[],_=[];for(let p=0;p<=i;p++){const T=[],w=p/i;let S=0;p===0&&r===0?S=.5/n:p===i&&l===Math.PI&&(S=-.5/n);for(let I=0;I<=n;I++){const P=I/n;f.x=-e*Math.cos(s+P*o)*Math.sin(r+w*a),f.y=e*Math.cos(r+w*a),f.z=e*Math.sin(s+P*o)*Math.sin(r+w*a),b.push(f.x,f.y,f.z),h.copy(f).normalize(),y.push(h.x,h.y,h.z),_.push(P+S,1-w),T.push(d++)}u.push(T)}for(let p=0;p<i;p++)for(let T=0;T<n;T++){const w=u[p][T+1],S=u[p][T],I=u[p+1][T],P=u[p+1][T+1];(p!==0||r>0)&&m.push(w,S,P),(p!==i-1||l<Math.PI)&&m.push(S,I,P)}this.setIndex(m),this.setAttribute("position",new Et(b,3)),this.setAttribute("normal",new Et(y,3)),this.setAttribute("uv",new Et(_,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Sd(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class us extends tn{constructor(e=1,n=.4,i=12,s=48,o=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:n,radialSegments:i,tubularSegments:s,arc:o},i=Math.floor(i),s=Math.floor(s);const r=[],a=[],l=[],d=[],u=new L,f=new L,h=new L;for(let m=0;m<=i;m++)for(let b=0;b<=s;b++){const y=b/s*o,_=m/i*Math.PI*2;f.x=(e+n*Math.cos(_))*Math.cos(y),f.y=(e+n*Math.cos(_))*Math.sin(y),f.z=n*Math.sin(_),a.push(f.x,f.y,f.z),u.x=e*Math.cos(y),u.y=e*Math.sin(y),h.subVectors(f,u).normalize(),l.push(h.x,h.y,h.z),d.push(b/s),d.push(m/i)}for(let m=1;m<=i;m++)for(let b=1;b<=s;b++){const y=(s+1)*m+b-1,_=(s+1)*(m-1)+b-1,p=(s+1)*(m-1)+b,T=(s+1)*m+b;r.push(y,_,T),r.push(_,p,T)}this.setIndex(r),this.setAttribute("position",new Et(a,3)),this.setAttribute("normal",new Et(l,3)),this.setAttribute("uv",new Et(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new us(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class NU extends ws{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new lt(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class zU extends ws{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new lt(16777215),this.specular=new lt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new lt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Cp,this.normalScale=new Ke(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new $n,this.combine=ld,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,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.flatShading=e.flatShading,this.fog=e.fog,this}}class kU extends ws{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=FL,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class BU extends ws{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class zp extends Nt{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new lt(e),this.intensity=n}dispose(){}copy(e,n){return super.copy(e,n),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const n=super.toJSON(e);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,this.groundColor!==void 0&&(n.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(n.object.distance=this.distance),this.angle!==void 0&&(n.object.angle=this.angle),this.decay!==void 0&&(n.object.decay=this.decay),this.penumbra!==void 0&&(n.object.penumbra=this.penumbra),this.shadow!==void 0&&(n.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(n.object.target=this.target.uuid),n}}const Ml=new Tt,ah=new L,lh=new L;class VU{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ke(512,512),this.mapType=ti,this.map=null,this.mapPass=null,this.matrix=new Tt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new vd,this._frameExtents=new Ke(1,1),this._viewportCount=1,this._viewports=[new It(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,i=this.matrix;ah.setFromMatrixPosition(e.matrixWorld),n.position.copy(ah),lh.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(lh),n.updateMatrixWorld(),Ml.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ml),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(Ml)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class $U extends VU{constructor(){super(new gn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const n=this.camera,i=uo*2*e.angle*this.focus,s=this.mapSize.width/this.mapSize.height,o=e.distance||n.far;(i!==n.fov||s!==n.aspect||o!==n.far)&&(n.fov=i,n.aspect=s,n.far=o,n.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class HU extends zp{constructor(e,n,i=0,s=Math.PI/3,o=0,r=2){super(e,n),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Nt.DEFAULT_UP),this.updateMatrix(),this.target=new Nt,this.distance=i,this.angle=s,this.penumbra=o,this.decay=r,this.map=null,this.shadow=new $U}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,n){return super.copy(e,n),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class GU extends Up{constructor(e=-1,n=1,i=1,s=-1,o=.1,r=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=i,this.bottom=s,this.near=o,this.far=r,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,i,s,o,r){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.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let o=i-e,r=i+e,a=s+n,l=s-n;if(this.view!==null&&this.view.enabled){const d=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;o+=d*this.view.offsetX,r=o+d*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(o,r,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}class WU extends zp{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}class XU extends gn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}const ch=new Tt;class jU{constructor(e,n,i=0,s=1/0){this.ray=new Ba(e,n),this.near=i,this.far=s,this.camera=null,this.layers=new gd,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,n){this.ray.set(e,n)}setFromCamera(e,n){n.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(n.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(n).sub(this.ray.origin).normalize(),this.camera=n):n.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(n.near+n.far)/(n.near-n.far)).unproject(n),this.ray.direction.set(0,0,-1).transformDirection(n.matrixWorld),this.camera=n):console.error("THREE.Raycaster: Unsupported camera type: "+n.type)}setFromXRController(e){return ch.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(ch),this}intersectObject(e,n=!0,i=[]){return Nc(e,this,i,n),i.sort(dh),i}intersectObjects(e,n=!0,i=[]){for(let s=0,o=e.length;s<o;s++)Nc(e[s],this,i,n);return i.sort(dh),i}}function dh(t,e){return t.distance-e.distance}function Nc(t,e,n,i){let s=!0;if(t.layers.test(e.layers)&&t.raycast(e,n)===!1&&(s=!1),s===!0&&i===!0){const o=t.children;for(let r=0,a=o.length;r<a;r++)Nc(o[r],e,n,!0)}}class uh{constructor(e=1,n=0,i=0){this.radius=e,this.phi=n,this.theta=i}set(e,n,i){return this.radius=e,this.phi=n,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=rt(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,i){return this.radius=Math.sqrt(e*e+n*n+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(rt(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class YU extends bd{constructor(e=10,n=10,i=4473924,s=8947848){i=new lt(i),s=new lt(s);const o=n/2,r=e/n,a=e/2,l=[],d=[];for(let h=0,m=0,b=-a;h<=n;h++,b+=r){l.push(-a,0,b,a,0,b),l.push(b,0,-a,b,0,a);const y=h===o?i:s;y.toArray(d,m),m+=3,y.toArray(d,m),m+=3,y.toArray(d,m),m+=3,y.toArray(d,m),m+=3}const u=new tn;u.setAttribute("position",new Et(l,3)),u.setAttribute("color",new Et(d,3));const f=new mr({vertexColors:!0,toneMapped:!1});super(u,f),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class qU extends bd{constructor(e=1){const n=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],s=new tn;s.setAttribute("position",new Et(n,3)),s.setAttribute("color",new Et(i,3));const o=new mr({vertexColors:!0,toneMapped:!1});super(s,o),this.type="AxesHelper"}setColors(e,n,i){const s=new lt,o=this.geometry.attributes.color.array;return s.set(e),s.toArray(o,0),s.toArray(o,3),s.set(n),s.toArray(o,6),s.toArray(o,9),s.set(i),s.toArray(o,12),s.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class kp extends Es{constructor(e,n=null){super(),this.object=e,this.domElement=n,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function hh(t,e,n,i){const s=ZU(i);switch(n){case Sp:return t*e;case Ep:return t*e/s.components*s.byteLength;case hd:return t*e/s.components*s.byteLength;case wp:return t*e*2/s.components*s.byteLength;case fd:return t*e*2/s.components*s.byteLength;case Mp:return t*e*3/s.components*s.byteLength;case kn:return t*e*4/s.components*s.byteLength;case pd:return t*e*4/s.components*s.byteLength;case ea:case ta:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case na:case ia:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case hc:case pc:return Math.max(t,16)*Math.max(e,8)/4;case uc:case fc:return Math.max(t,8)*Math.max(e,8)/2;case mc:case _c:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case gc:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case vc:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case bc:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case yc:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case xc:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case Sc:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case Mc:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case Ec:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case wc:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case Tc:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case Cc:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case Ac:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case Pc:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case Rc:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case Dc:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case sa:case Ic:case Fc:return Math.ceil(t/4)*Math.ceil(e/4)*16;case Tp:case Lc:return Math.ceil(t/4)*Math.ceil(e/4)*8;case Uc:case Oc:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function ZU(t){switch(t){case ti:case bp:return{byteLength:1,components:1};case rr:case yp:case fr:return{byteLength:2,components:1};case dd:case ud:return{byteLength:2,components:4};case bs:case cd:case hi:return{byteLength:4,components:1};case xp:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:ad}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=ad);/**
  35. * @license
  36. * Copyright 2010-2025 Three.js Authors
  37. * SPDX-License-Identifier: MIT
  38. */function Bp(){let t=null,e=!1,n=null,i=null;function s(o,r){n(o,r),i=t.requestAnimationFrame(s)}return{start:function(){e!==!0&&n!==null&&(i=t.requestAnimationFrame(s),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(o){n=o},setContext:function(o){t=o}}}function KU(t){const e=new WeakMap;function n(a,l){const d=a.array,u=a.usage,f=d.byteLength,h=t.createBuffer();t.bindBuffer(l,h),t.bufferData(l,d,u),a.onUploadCallback();let m;if(d instanceof Float32Array)m=t.FLOAT;else if(d instanceof Uint16Array)a.isFloat16BufferAttribute?m=t.HALF_FLOAT:m=t.UNSIGNED_SHORT;else if(d instanceof Int16Array)m=t.SHORT;else if(d instanceof Uint32Array)m=t.UNSIGNED_INT;else if(d instanceof Int32Array)m=t.INT;else if(d instanceof Int8Array)m=t.BYTE;else if(d instanceof Uint8Array)m=t.UNSIGNED_BYTE;else if(d instanceof Uint8ClampedArray)m=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+d);return{buffer:h,type:m,bytesPerElement:d.BYTES_PER_ELEMENT,version:a.version,size:f}}function i(a,l,d){const u=l.array,f=l.updateRanges;if(t.bindBuffer(d,a),f.length===0)t.bufferSubData(d,0,u);else{f.sort((m,b)=>m.start-b.start);let h=0;for(let m=1;m<f.length;m++){const b=f[h],y=f[m];y.start<=b.start+b.count+1?b.count=Math.max(b.count,y.start+y.count-b.start):(++h,f[h]=y)}f.length=h+1;for(let m=0,b=f.length;m<b;m++){const y=f[m];t.bufferSubData(d,y.start*u.BYTES_PER_ELEMENT,u,y.start,y.count)}l.clearUpdateRanges()}l.onUploadCallback()}function s(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function o(a){a.isInterleavedBufferAttribute&&(a=a.data);const l=e.get(a);l&&(t.deleteBuffer(l.buffer),e.delete(a))}function r(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){const u=e.get(a);(!u||u.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}const d=e.get(a);if(d===void 0)e.set(a,n(a,l));else if(d.version<a.version){if(d.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(d.buffer,a,l),d.version=a.version}}return{get:s,remove:o,update:r}}var JU=`#ifdef USE_ALPHAHASH
  39. if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
  40. #endif`,QU=`#ifdef USE_ALPHAHASH
  41. const float ALPHA_HASH_SCALE = 0.05;
  42. float hash2D( vec2 value ) {
  43. return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
  44. }
  45. float hash3D( vec3 value ) {
  46. return hash2D( vec2( hash2D( value.xy ), value.z ) );
  47. }
  48. float getAlphaHashThreshold( vec3 position ) {
  49. float maxDeriv = max(
  50. length( dFdx( position.xyz ) ),
  51. length( dFdy( position.xyz ) )
  52. );
  53. float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
  54. vec2 pixScales = vec2(
  55. exp2( floor( log2( pixScale ) ) ),
  56. exp2( ceil( log2( pixScale ) ) )
  57. );
  58. vec2 alpha = vec2(
  59. hash3D( floor( pixScales.x * position.xyz ) ),
  60. hash3D( floor( pixScales.y * position.xyz ) )
  61. );
  62. float lerpFactor = fract( log2( pixScale ) );
  63. float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
  64. float a = min( lerpFactor, 1.0 - lerpFactor );
  65. vec3 cases = vec3(
  66. x * x / ( 2.0 * a * ( 1.0 - a ) ),
  67. ( x - 0.5 * a ) / ( 1.0 - a ),
  68. 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
  69. );
  70. float threshold = ( x < ( 1.0 - a ) )
  71. ? ( ( x < a ) ? cases.x : cases.y )
  72. : cases.z;
  73. return clamp( threshold , 1.0e-6, 1.0 );
  74. }
  75. #endif`,eO=`#ifdef USE_ALPHAMAP
  76. diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
  77. #endif`,tO=`#ifdef USE_ALPHAMAP
  78. uniform sampler2D alphaMap;
  79. #endif`,nO=`#ifdef USE_ALPHATEST
  80. #ifdef ALPHA_TO_COVERAGE
  81. diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
  82. if ( diffuseColor.a == 0.0 ) discard;
  83. #else
  84. if ( diffuseColor.a < alphaTest ) discard;
  85. #endif
  86. #endif`,iO=`#ifdef USE_ALPHATEST
  87. uniform float alphaTest;
  88. #endif`,sO=`#ifdef USE_AOMAP
  89. float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
  90. reflectedLight.indirectDiffuse *= ambientOcclusion;
  91. #if defined( USE_CLEARCOAT )
  92. clearcoatSpecularIndirect *= ambientOcclusion;
  93. #endif
  94. #if defined( USE_SHEEN )
  95. sheenSpecularIndirect *= ambientOcclusion;
  96. #endif
  97. #if defined( USE_ENVMAP ) && defined( STANDARD )
  98. float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
  99. reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
  100. #endif
  101. #endif`,oO=`#ifdef USE_AOMAP
  102. uniform sampler2D aoMap;
  103. uniform float aoMapIntensity;
  104. #endif`,rO=`#ifdef USE_BATCHING
  105. #if ! defined( GL_ANGLE_multi_draw )
  106. #define gl_DrawID _gl_DrawID
  107. uniform int _gl_DrawID;
  108. #endif
  109. uniform highp sampler2D batchingTexture;
  110. uniform highp usampler2D batchingIdTexture;
  111. mat4 getBatchingMatrix( const in float i ) {
  112. int size = textureSize( batchingTexture, 0 ).x;
  113. int j = int( i ) * 4;
  114. int x = j % size;
  115. int y = j / size;
  116. vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
  117. vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
  118. vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
  119. vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
  120. return mat4( v1, v2, v3, v4 );
  121. }
  122. float getIndirectIndex( const in int i ) {
  123. int size = textureSize( batchingIdTexture, 0 ).x;
  124. int x = i % size;
  125. int y = i / size;
  126. return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
  127. }
  128. #endif
  129. #ifdef USE_BATCHING_COLOR
  130. uniform sampler2D batchingColorTexture;
  131. vec3 getBatchingColor( const in float i ) {
  132. int size = textureSize( batchingColorTexture, 0 ).x;
  133. int j = int( i );
  134. int x = j % size;
  135. int y = j / size;
  136. return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
  137. }
  138. #endif`,aO=`#ifdef USE_BATCHING
  139. mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
  140. #endif`,lO=`vec3 transformed = vec3( position );
  141. #ifdef USE_ALPHAHASH
  142. vPosition = vec3( position );
  143. #endif`,cO=`vec3 objectNormal = vec3( normal );
  144. #ifdef USE_TANGENT
  145. vec3 objectTangent = vec3( tangent.xyz );
  146. #endif`,dO=`float G_BlinnPhong_Implicit( ) {
  147. return 0.25;
  148. }
  149. float D_BlinnPhong( const in float shininess, const in float dotNH ) {
  150. return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
  151. }
  152. vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
  153. vec3 halfDir = normalize( lightDir + viewDir );
  154. float dotNH = saturate( dot( normal, halfDir ) );
  155. float dotVH = saturate( dot( viewDir, halfDir ) );
  156. vec3 F = F_Schlick( specularColor, 1.0, dotVH );
  157. float G = G_BlinnPhong_Implicit( );
  158. float D = D_BlinnPhong( shininess, dotNH );
  159. return F * ( G * D );
  160. } // validated`,uO=`#ifdef USE_IRIDESCENCE
  161. const mat3 XYZ_TO_REC709 = mat3(
  162. 3.2404542, -0.9692660, 0.0556434,
  163. -1.5371385, 1.8760108, -0.2040259,
  164. -0.4985314, 0.0415560, 1.0572252
  165. );
  166. vec3 Fresnel0ToIor( vec3 fresnel0 ) {
  167. vec3 sqrtF0 = sqrt( fresnel0 );
  168. return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
  169. }
  170. vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
  171. return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
  172. }
  173. float IorToFresnel0( float transmittedIor, float incidentIor ) {
  174. return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
  175. }
  176. vec3 evalSensitivity( float OPD, vec3 shift ) {
  177. float phase = 2.0 * PI * OPD * 1.0e-9;
  178. vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
  179. vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
  180. vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
  181. vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
  182. xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
  183. xyz /= 1.0685e-7;
  184. vec3 rgb = XYZ_TO_REC709 * xyz;
  185. return rgb;
  186. }
  187. vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
  188. vec3 I;
  189. float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
  190. float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
  191. float cosTheta2Sq = 1.0 - sinTheta2Sq;
  192. if ( cosTheta2Sq < 0.0 ) {
  193. return vec3( 1.0 );
  194. }
  195. float cosTheta2 = sqrt( cosTheta2Sq );
  196. float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
  197. float R12 = F_Schlick( R0, 1.0, cosTheta1 );
  198. float T121 = 1.0 - R12;
  199. float phi12 = 0.0;
  200. if ( iridescenceIOR < outsideIOR ) phi12 = PI;
  201. float phi21 = PI - phi12;
  202. vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
  203. vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
  204. vec3 phi23 = vec3( 0.0 );
  205. if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
  206. if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
  207. if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
  208. float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
  209. vec3 phi = vec3( phi21 ) + phi23;
  210. vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
  211. vec3 r123 = sqrt( R123 );
  212. vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
  213. vec3 C0 = R12 + Rs;
  214. I = C0;
  215. vec3 Cm = Rs - T121;
  216. for ( int m = 1; m <= 2; ++ m ) {
  217. Cm *= r123;
  218. vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
  219. I += Cm * Sm;
  220. }
  221. return max( I, vec3( 0.0 ) );
  222. }
  223. #endif`,hO=`#ifdef USE_BUMPMAP
  224. uniform sampler2D bumpMap;
  225. uniform float bumpScale;
  226. vec2 dHdxy_fwd() {
  227. vec2 dSTdx = dFdx( vBumpMapUv );
  228. vec2 dSTdy = dFdy( vBumpMapUv );
  229. float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
  230. float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
  231. float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
  232. return vec2( dBx, dBy );
  233. }
  234. vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
  235. vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
  236. vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
  237. vec3 vN = surf_norm;
  238. vec3 R1 = cross( vSigmaY, vN );
  239. vec3 R2 = cross( vN, vSigmaX );
  240. float fDet = dot( vSigmaX, R1 ) * faceDirection;
  241. vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
  242. return normalize( abs( fDet ) * surf_norm - vGrad );
  243. }
  244. #endif`,fO=`#if NUM_CLIPPING_PLANES > 0
  245. vec4 plane;
  246. #ifdef ALPHA_TO_COVERAGE
  247. float distanceToPlane, distanceGradient;
  248. float clipOpacity = 1.0;
  249. #pragma unroll_loop_start
  250. for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
  251. plane = clippingPlanes[ i ];
  252. distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
  253. distanceGradient = fwidth( distanceToPlane ) / 2.0;
  254. clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
  255. if ( clipOpacity == 0.0 ) discard;
  256. }
  257. #pragma unroll_loop_end
  258. #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
  259. float unionClipOpacity = 1.0;
  260. #pragma unroll_loop_start
  261. for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
  262. plane = clippingPlanes[ i ];
  263. distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
  264. distanceGradient = fwidth( distanceToPlane ) / 2.0;
  265. unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
  266. }
  267. #pragma unroll_loop_end
  268. clipOpacity *= 1.0 - unionClipOpacity;
  269. #endif
  270. diffuseColor.a *= clipOpacity;
  271. if ( diffuseColor.a == 0.0 ) discard;
  272. #else
  273. #pragma unroll_loop_start
  274. for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
  275. plane = clippingPlanes[ i ];
  276. if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
  277. }
  278. #pragma unroll_loop_end
  279. #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
  280. bool clipped = true;
  281. #pragma unroll_loop_start
  282. for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
  283. plane = clippingPlanes[ i ];
  284. clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
  285. }
  286. #pragma unroll_loop_end
  287. if ( clipped ) discard;
  288. #endif
  289. #endif
  290. #endif`,pO=`#if NUM_CLIPPING_PLANES > 0
  291. varying vec3 vClipPosition;
  292. uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
  293. #endif`,mO=`#if NUM_CLIPPING_PLANES > 0
  294. varying vec3 vClipPosition;
  295. #endif`,_O=`#if NUM_CLIPPING_PLANES > 0
  296. vClipPosition = - mvPosition.xyz;
  297. #endif`,gO=`#if defined( USE_COLOR_ALPHA )
  298. diffuseColor *= vColor;
  299. #elif defined( USE_COLOR )
  300. diffuseColor.rgb *= vColor;
  301. #endif`,vO=`#if defined( USE_COLOR_ALPHA )
  302. varying vec4 vColor;
  303. #elif defined( USE_COLOR )
  304. varying vec3 vColor;
  305. #endif`,bO=`#if defined( USE_COLOR_ALPHA )
  306. varying vec4 vColor;
  307. #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
  308. varying vec3 vColor;
  309. #endif`,yO=`#if defined( USE_COLOR_ALPHA )
  310. vColor = vec4( 1.0 );
  311. #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
  312. vColor = vec3( 1.0 );
  313. #endif
  314. #ifdef USE_COLOR
  315. vColor *= color;
  316. #endif
  317. #ifdef USE_INSTANCING_COLOR
  318. vColor.xyz *= instanceColor.xyz;
  319. #endif
  320. #ifdef USE_BATCHING_COLOR
  321. vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
  322. vColor.xyz *= batchingColor.xyz;
  323. #endif`,xO=`#define PI 3.141592653589793
  324. #define PI2 6.283185307179586
  325. #define PI_HALF 1.5707963267948966
  326. #define RECIPROCAL_PI 0.3183098861837907
  327. #define RECIPROCAL_PI2 0.15915494309189535
  328. #define EPSILON 1e-6
  329. #ifndef saturate
  330. #define saturate( a ) clamp( a, 0.0, 1.0 )
  331. #endif
  332. #define whiteComplement( a ) ( 1.0 - saturate( a ) )
  333. float pow2( const in float x ) { return x*x; }
  334. vec3 pow2( const in vec3 x ) { return x*x; }
  335. float pow3( const in float x ) { return x*x*x; }
  336. float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
  337. float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
  338. float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
  339. highp float rand( const in vec2 uv ) {
  340. const highp float a = 12.9898, b = 78.233, c = 43758.5453;
  341. highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
  342. return fract( sin( sn ) * c );
  343. }
  344. #ifdef HIGH_PRECISION
  345. float precisionSafeLength( vec3 v ) { return length( v ); }
  346. #else
  347. float precisionSafeLength( vec3 v ) {
  348. float maxComponent = max3( abs( v ) );
  349. return length( v / maxComponent ) * maxComponent;
  350. }
  351. #endif
  352. struct IncidentLight {
  353. vec3 color;
  354. vec3 direction;
  355. bool visible;
  356. };
  357. struct ReflectedLight {
  358. vec3 directDiffuse;
  359. vec3 directSpecular;
  360. vec3 indirectDiffuse;
  361. vec3 indirectSpecular;
  362. };
  363. #ifdef USE_ALPHAHASH
  364. varying vec3 vPosition;
  365. #endif
  366. vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
  367. return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
  368. }
  369. vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
  370. return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
  371. }
  372. mat3 transposeMat3( const in mat3 m ) {
  373. mat3 tmp;
  374. tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
  375. tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
  376. tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
  377. return tmp;
  378. }
  379. bool isPerspectiveMatrix( mat4 m ) {
  380. return m[ 2 ][ 3 ] == - 1.0;
  381. }
  382. vec2 equirectUv( in vec3 dir ) {
  383. float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
  384. float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
  385. return vec2( u, v );
  386. }
  387. vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
  388. return RECIPROCAL_PI * diffuseColor;
  389. }
  390. vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
  391. float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
  392. return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
  393. }
  394. float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
  395. float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
  396. return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
  397. } // validated`,SO=`#ifdef ENVMAP_TYPE_CUBE_UV
  398. #define cubeUV_minMipLevel 4.0
  399. #define cubeUV_minTileSize 16.0
  400. float getFace( vec3 direction ) {
  401. vec3 absDirection = abs( direction );
  402. float face = - 1.0;
  403. if ( absDirection.x > absDirection.z ) {
  404. if ( absDirection.x > absDirection.y )
  405. face = direction.x > 0.0 ? 0.0 : 3.0;
  406. else
  407. face = direction.y > 0.0 ? 1.0 : 4.0;
  408. } else {
  409. if ( absDirection.z > absDirection.y )
  410. face = direction.z > 0.0 ? 2.0 : 5.0;
  411. else
  412. face = direction.y > 0.0 ? 1.0 : 4.0;
  413. }
  414. return face;
  415. }
  416. vec2 getUV( vec3 direction, float face ) {
  417. vec2 uv;
  418. if ( face == 0.0 ) {
  419. uv = vec2( direction.z, direction.y ) / abs( direction.x );
  420. } else if ( face == 1.0 ) {
  421. uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
  422. } else if ( face == 2.0 ) {
  423. uv = vec2( - direction.x, direction.y ) / abs( direction.z );
  424. } else if ( face == 3.0 ) {
  425. uv = vec2( - direction.z, direction.y ) / abs( direction.x );
  426. } else if ( face == 4.0 ) {
  427. uv = vec2( - direction.x, direction.z ) / abs( direction.y );
  428. } else {
  429. uv = vec2( direction.x, direction.y ) / abs( direction.z );
  430. }
  431. return 0.5 * ( uv + 1.0 );
  432. }
  433. vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
  434. float face = getFace( direction );
  435. float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
  436. mipInt = max( mipInt, cubeUV_minMipLevel );
  437. float faceSize = exp2( mipInt );
  438. highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
  439. if ( face > 2.0 ) {
  440. uv.y += faceSize;
  441. face -= 3.0;
  442. }
  443. uv.x += face * faceSize;
  444. uv.x += filterInt * 3.0 * cubeUV_minTileSize;
  445. uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
  446. uv.x *= CUBEUV_TEXEL_WIDTH;
  447. uv.y *= CUBEUV_TEXEL_HEIGHT;
  448. #ifdef texture2DGradEXT
  449. return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
  450. #else
  451. return texture2D( envMap, uv ).rgb;
  452. #endif
  453. }
  454. #define cubeUV_r0 1.0
  455. #define cubeUV_m0 - 2.0
  456. #define cubeUV_r1 0.8
  457. #define cubeUV_m1 - 1.0
  458. #define cubeUV_r4 0.4
  459. #define cubeUV_m4 2.0
  460. #define cubeUV_r5 0.305
  461. #define cubeUV_m5 3.0
  462. #define cubeUV_r6 0.21
  463. #define cubeUV_m6 4.0
  464. float roughnessToMip( float roughness ) {
  465. float mip = 0.0;
  466. if ( roughness >= cubeUV_r1 ) {
  467. mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
  468. } else if ( roughness >= cubeUV_r4 ) {
  469. mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
  470. } else if ( roughness >= cubeUV_r5 ) {
  471. mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
  472. } else if ( roughness >= cubeUV_r6 ) {
  473. mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
  474. } else {
  475. mip = - 2.0 * log2( 1.16 * roughness ); }
  476. return mip;
  477. }
  478. vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
  479. float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
  480. float mipF = fract( mip );
  481. float mipInt = floor( mip );
  482. vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
  483. if ( mipF == 0.0 ) {
  484. return vec4( color0, 1.0 );
  485. } else {
  486. vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
  487. return vec4( mix( color0, color1, mipF ), 1.0 );
  488. }
  489. }
  490. #endif`,MO=`vec3 transformedNormal = objectNormal;
  491. #ifdef USE_TANGENT
  492. vec3 transformedTangent = objectTangent;
  493. #endif
  494. #ifdef USE_BATCHING
  495. mat3 bm = mat3( batchingMatrix );
  496. transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
  497. transformedNormal = bm * transformedNormal;
  498. #ifdef USE_TANGENT
  499. transformedTangent = bm * transformedTangent;
  500. #endif
  501. #endif
  502. #ifdef USE_INSTANCING
  503. mat3 im = mat3( instanceMatrix );
  504. transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
  505. transformedNormal = im * transformedNormal;
  506. #ifdef USE_TANGENT
  507. transformedTangent = im * transformedTangent;
  508. #endif
  509. #endif
  510. transformedNormal = normalMatrix * transformedNormal;
  511. #ifdef FLIP_SIDED
  512. transformedNormal = - transformedNormal;
  513. #endif
  514. #ifdef USE_TANGENT
  515. transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
  516. #ifdef FLIP_SIDED
  517. transformedTangent = - transformedTangent;
  518. #endif
  519. #endif`,EO=`#ifdef USE_DISPLACEMENTMAP
  520. uniform sampler2D displacementMap;
  521. uniform float displacementScale;
  522. uniform float displacementBias;
  523. #endif`,wO=`#ifdef USE_DISPLACEMENTMAP
  524. transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
  525. #endif`,TO=`#ifdef USE_EMISSIVEMAP
  526. vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
  527. #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
  528. emissiveColor = sRGBTransferEOTF( emissiveColor );
  529. #endif
  530. totalEmissiveRadiance *= emissiveColor.rgb;
  531. #endif`,CO=`#ifdef USE_EMISSIVEMAP
  532. uniform sampler2D emissiveMap;
  533. #endif`,AO="gl_FragColor = linearToOutputTexel( gl_FragColor );",PO=`vec4 LinearTransferOETF( in vec4 value ) {
  534. return value;
  535. }
  536. vec4 sRGBTransferEOTF( in vec4 value ) {
  537. 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 );
  538. }
  539. vec4 sRGBTransferOETF( in vec4 value ) {
  540. 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 );
  541. }`,RO=`#ifdef USE_ENVMAP
  542. #ifdef ENV_WORLDPOS
  543. vec3 cameraToFrag;
  544. if ( isOrthographic ) {
  545. cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
  546. } else {
  547. cameraToFrag = normalize( vWorldPosition - cameraPosition );
  548. }
  549. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  550. #ifdef ENVMAP_MODE_REFLECTION
  551. vec3 reflectVec = reflect( cameraToFrag, worldNormal );
  552. #else
  553. vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
  554. #endif
  555. #else
  556. vec3 reflectVec = vReflect;
  557. #endif
  558. #ifdef ENVMAP_TYPE_CUBE
  559. vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
  560. #else
  561. vec4 envColor = vec4( 0.0 );
  562. #endif
  563. #ifdef ENVMAP_BLENDING_MULTIPLY
  564. outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
  565. #elif defined( ENVMAP_BLENDING_MIX )
  566. outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
  567. #elif defined( ENVMAP_BLENDING_ADD )
  568. outgoingLight += envColor.xyz * specularStrength * reflectivity;
  569. #endif
  570. #endif`,DO=`#ifdef USE_ENVMAP
  571. uniform float envMapIntensity;
  572. uniform float flipEnvMap;
  573. uniform mat3 envMapRotation;
  574. #ifdef ENVMAP_TYPE_CUBE
  575. uniform samplerCube envMap;
  576. #else
  577. uniform sampler2D envMap;
  578. #endif
  579. #endif`,IO=`#ifdef USE_ENVMAP
  580. uniform float reflectivity;
  581. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
  582. #define ENV_WORLDPOS
  583. #endif
  584. #ifdef ENV_WORLDPOS
  585. varying vec3 vWorldPosition;
  586. uniform float refractionRatio;
  587. #else
  588. varying vec3 vReflect;
  589. #endif
  590. #endif`,FO=`#ifdef USE_ENVMAP
  591. #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
  592. #define ENV_WORLDPOS
  593. #endif
  594. #ifdef ENV_WORLDPOS
  595. varying vec3 vWorldPosition;
  596. #else
  597. varying vec3 vReflect;
  598. uniform float refractionRatio;
  599. #endif
  600. #endif`,LO=`#ifdef USE_ENVMAP
  601. #ifdef ENV_WORLDPOS
  602. vWorldPosition = worldPosition.xyz;
  603. #else
  604. vec3 cameraToVertex;
  605. if ( isOrthographic ) {
  606. cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
  607. } else {
  608. cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
  609. }
  610. vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
  611. #ifdef ENVMAP_MODE_REFLECTION
  612. vReflect = reflect( cameraToVertex, worldNormal );
  613. #else
  614. vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
  615. #endif
  616. #endif
  617. #endif`,UO=`#ifdef USE_FOG
  618. vFogDepth = - mvPosition.z;
  619. #endif`,OO=`#ifdef USE_FOG
  620. varying float vFogDepth;
  621. #endif`,NO=`#ifdef USE_FOG
  622. #ifdef FOG_EXP2
  623. float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
  624. #else
  625. float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
  626. #endif
  627. gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
  628. #endif`,zO=`#ifdef USE_FOG
  629. uniform vec3 fogColor;
  630. varying float vFogDepth;
  631. #ifdef FOG_EXP2
  632. uniform float fogDensity;
  633. #else
  634. uniform float fogNear;
  635. uniform float fogFar;
  636. #endif
  637. #endif`,kO=`#ifdef USE_GRADIENTMAP
  638. uniform sampler2D gradientMap;
  639. #endif
  640. vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
  641. float dotNL = dot( normal, lightDirection );
  642. vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
  643. #ifdef USE_GRADIENTMAP
  644. return vec3( texture2D( gradientMap, coord ).r );
  645. #else
  646. vec2 fw = fwidth( coord ) * 0.5;
  647. return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
  648. #endif
  649. }`,BO=`#ifdef USE_LIGHTMAP
  650. uniform sampler2D lightMap;
  651. uniform float lightMapIntensity;
  652. #endif`,VO=`LambertMaterial material;
  653. material.diffuseColor = diffuseColor.rgb;
  654. material.specularStrength = specularStrength;`,$O=`varying vec3 vViewPosition;
  655. struct LambertMaterial {
  656. vec3 diffuseColor;
  657. float specularStrength;
  658. };
  659. 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 ) {
  660. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  661. vec3 irradiance = dotNL * directLight.color;
  662. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  663. }
  664. 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 ) {
  665. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  666. }
  667. #define RE_Direct RE_Direct_Lambert
  668. #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,HO=`uniform bool receiveShadow;
  669. uniform vec3 ambientLightColor;
  670. #if defined( USE_LIGHT_PROBES )
  671. uniform vec3 lightProbe[ 9 ];
  672. #endif
  673. vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
  674. float x = normal.x, y = normal.y, z = normal.z;
  675. vec3 result = shCoefficients[ 0 ] * 0.886227;
  676. result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
  677. result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
  678. result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
  679. result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
  680. result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
  681. result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
  682. result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
  683. result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
  684. return result;
  685. }
  686. vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
  687. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  688. vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
  689. return irradiance;
  690. }
  691. vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
  692. vec3 irradiance = ambientLightColor;
  693. return irradiance;
  694. }
  695. float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
  696. float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
  697. if ( cutoffDistance > 0.0 ) {
  698. distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
  699. }
  700. return distanceFalloff;
  701. }
  702. float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
  703. return smoothstep( coneCosine, penumbraCosine, angleCosine );
  704. }
  705. #if NUM_DIR_LIGHTS > 0
  706. struct DirectionalLight {
  707. vec3 direction;
  708. vec3 color;
  709. };
  710. uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
  711. void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
  712. light.color = directionalLight.color;
  713. light.direction = directionalLight.direction;
  714. light.visible = true;
  715. }
  716. #endif
  717. #if NUM_POINT_LIGHTS > 0
  718. struct PointLight {
  719. vec3 position;
  720. vec3 color;
  721. float distance;
  722. float decay;
  723. };
  724. uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
  725. void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
  726. vec3 lVector = pointLight.position - geometryPosition;
  727. light.direction = normalize( lVector );
  728. float lightDistance = length( lVector );
  729. light.color = pointLight.color;
  730. light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
  731. light.visible = ( light.color != vec3( 0.0 ) );
  732. }
  733. #endif
  734. #if NUM_SPOT_LIGHTS > 0
  735. struct SpotLight {
  736. vec3 position;
  737. vec3 direction;
  738. vec3 color;
  739. float distance;
  740. float decay;
  741. float coneCos;
  742. float penumbraCos;
  743. };
  744. uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
  745. void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
  746. vec3 lVector = spotLight.position - geometryPosition;
  747. light.direction = normalize( lVector );
  748. float angleCos = dot( light.direction, spotLight.direction );
  749. float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
  750. if ( spotAttenuation > 0.0 ) {
  751. float lightDistance = length( lVector );
  752. light.color = spotLight.color * spotAttenuation;
  753. light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
  754. light.visible = ( light.color != vec3( 0.0 ) );
  755. } else {
  756. light.color = vec3( 0.0 );
  757. light.visible = false;
  758. }
  759. }
  760. #endif
  761. #if NUM_RECT_AREA_LIGHTS > 0
  762. struct RectAreaLight {
  763. vec3 color;
  764. vec3 position;
  765. vec3 halfWidth;
  766. vec3 halfHeight;
  767. };
  768. uniform sampler2D ltc_1; uniform sampler2D ltc_2;
  769. uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
  770. #endif
  771. #if NUM_HEMI_LIGHTS > 0
  772. struct HemisphereLight {
  773. vec3 direction;
  774. vec3 skyColor;
  775. vec3 groundColor;
  776. };
  777. uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
  778. vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
  779. float dotNL = dot( normal, hemiLight.direction );
  780. float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
  781. vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
  782. return irradiance;
  783. }
  784. #endif`,GO=`#ifdef USE_ENVMAP
  785. vec3 getIBLIrradiance( const in vec3 normal ) {
  786. #ifdef ENVMAP_TYPE_CUBE_UV
  787. vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
  788. vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
  789. return PI * envMapColor.rgb * envMapIntensity;
  790. #else
  791. return vec3( 0.0 );
  792. #endif
  793. }
  794. vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
  795. #ifdef ENVMAP_TYPE_CUBE_UV
  796. vec3 reflectVec = reflect( - viewDir, normal );
  797. reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
  798. reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
  799. vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
  800. return envMapColor.rgb * envMapIntensity;
  801. #else
  802. return vec3( 0.0 );
  803. #endif
  804. }
  805. #ifdef USE_ANISOTROPY
  806. vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
  807. #ifdef ENVMAP_TYPE_CUBE_UV
  808. vec3 bentNormal = cross( bitangent, viewDir );
  809. bentNormal = normalize( cross( bentNormal, bitangent ) );
  810. bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
  811. return getIBLRadiance( viewDir, bentNormal, roughness );
  812. #else
  813. return vec3( 0.0 );
  814. #endif
  815. }
  816. #endif
  817. #endif`,WO=`ToonMaterial material;
  818. material.diffuseColor = diffuseColor.rgb;`,XO=`varying vec3 vViewPosition;
  819. struct ToonMaterial {
  820. vec3 diffuseColor;
  821. };
  822. 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 ) {
  823. vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
  824. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  825. }
  826. 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 ) {
  827. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  828. }
  829. #define RE_Direct RE_Direct_Toon
  830. #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,jO=`BlinnPhongMaterial material;
  831. material.diffuseColor = diffuseColor.rgb;
  832. material.specularColor = specular;
  833. material.specularShininess = shininess;
  834. material.specularStrength = specularStrength;`,YO=`varying vec3 vViewPosition;
  835. struct BlinnPhongMaterial {
  836. vec3 diffuseColor;
  837. vec3 specularColor;
  838. float specularShininess;
  839. float specularStrength;
  840. };
  841. 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 ) {
  842. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  843. vec3 irradiance = dotNL * directLight.color;
  844. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  845. reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
  846. }
  847. 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 ) {
  848. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  849. }
  850. #define RE_Direct RE_Direct_BlinnPhong
  851. #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,qO=`PhysicalMaterial material;
  852. material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
  853. vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
  854. float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
  855. material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
  856. material.roughness = min( material.roughness, 1.0 );
  857. #ifdef IOR
  858. material.ior = ior;
  859. #ifdef USE_SPECULAR
  860. float specularIntensityFactor = specularIntensity;
  861. vec3 specularColorFactor = specularColor;
  862. #ifdef USE_SPECULAR_COLORMAP
  863. specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
  864. #endif
  865. #ifdef USE_SPECULAR_INTENSITYMAP
  866. specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
  867. #endif
  868. material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
  869. #else
  870. float specularIntensityFactor = 1.0;
  871. vec3 specularColorFactor = vec3( 1.0 );
  872. material.specularF90 = 1.0;
  873. #endif
  874. material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
  875. #else
  876. material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
  877. material.specularF90 = 1.0;
  878. #endif
  879. #ifdef USE_CLEARCOAT
  880. material.clearcoat = clearcoat;
  881. material.clearcoatRoughness = clearcoatRoughness;
  882. material.clearcoatF0 = vec3( 0.04 );
  883. material.clearcoatF90 = 1.0;
  884. #ifdef USE_CLEARCOATMAP
  885. material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
  886. #endif
  887. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  888. material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
  889. #endif
  890. material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
  891. material.clearcoatRoughness += geometryRoughness;
  892. material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
  893. #endif
  894. #ifdef USE_DISPERSION
  895. material.dispersion = dispersion;
  896. #endif
  897. #ifdef USE_IRIDESCENCE
  898. material.iridescence = iridescence;
  899. material.iridescenceIOR = iridescenceIOR;
  900. #ifdef USE_IRIDESCENCEMAP
  901. material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
  902. #endif
  903. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  904. material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
  905. #else
  906. material.iridescenceThickness = iridescenceThicknessMaximum;
  907. #endif
  908. #endif
  909. #ifdef USE_SHEEN
  910. material.sheenColor = sheenColor;
  911. #ifdef USE_SHEEN_COLORMAP
  912. material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
  913. #endif
  914. material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
  915. #ifdef USE_SHEEN_ROUGHNESSMAP
  916. material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
  917. #endif
  918. #endif
  919. #ifdef USE_ANISOTROPY
  920. #ifdef USE_ANISOTROPYMAP
  921. mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
  922. vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
  923. vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
  924. #else
  925. vec2 anisotropyV = anisotropyVector;
  926. #endif
  927. material.anisotropy = length( anisotropyV );
  928. if( material.anisotropy == 0.0 ) {
  929. anisotropyV = vec2( 1.0, 0.0 );
  930. } else {
  931. anisotropyV /= material.anisotropy;
  932. material.anisotropy = saturate( material.anisotropy );
  933. }
  934. material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
  935. material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
  936. material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
  937. #endif`,ZO=`struct PhysicalMaterial {
  938. vec3 diffuseColor;
  939. float roughness;
  940. vec3 specularColor;
  941. float specularF90;
  942. float dispersion;
  943. #ifdef USE_CLEARCOAT
  944. float clearcoat;
  945. float clearcoatRoughness;
  946. vec3 clearcoatF0;
  947. float clearcoatF90;
  948. #endif
  949. #ifdef USE_IRIDESCENCE
  950. float iridescence;
  951. float iridescenceIOR;
  952. float iridescenceThickness;
  953. vec3 iridescenceFresnel;
  954. vec3 iridescenceF0;
  955. #endif
  956. #ifdef USE_SHEEN
  957. vec3 sheenColor;
  958. float sheenRoughness;
  959. #endif
  960. #ifdef IOR
  961. float ior;
  962. #endif
  963. #ifdef USE_TRANSMISSION
  964. float transmission;
  965. float transmissionAlpha;
  966. float thickness;
  967. float attenuationDistance;
  968. vec3 attenuationColor;
  969. #endif
  970. #ifdef USE_ANISOTROPY
  971. float anisotropy;
  972. float alphaT;
  973. vec3 anisotropyT;
  974. vec3 anisotropyB;
  975. #endif
  976. };
  977. vec3 clearcoatSpecularDirect = vec3( 0.0 );
  978. vec3 clearcoatSpecularIndirect = vec3( 0.0 );
  979. vec3 sheenSpecularDirect = vec3( 0.0 );
  980. vec3 sheenSpecularIndirect = vec3(0.0 );
  981. vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
  982. float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
  983. float x2 = x * x;
  984. float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
  985. return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
  986. }
  987. float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
  988. float a2 = pow2( alpha );
  989. float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
  990. float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
  991. return 0.5 / max( gv + gl, EPSILON );
  992. }
  993. float D_GGX( const in float alpha, const in float dotNH ) {
  994. float a2 = pow2( alpha );
  995. float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
  996. return RECIPROCAL_PI * a2 / pow2( denom );
  997. }
  998. #ifdef USE_ANISOTROPY
  999. 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 ) {
  1000. float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
  1001. float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
  1002. float v = 0.5 / ( gv + gl );
  1003. return saturate(v);
  1004. }
  1005. float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
  1006. float a2 = alphaT * alphaB;
  1007. highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
  1008. highp float v2 = dot( v, v );
  1009. float w2 = a2 / v2;
  1010. return RECIPROCAL_PI * a2 * pow2 ( w2 );
  1011. }
  1012. #endif
  1013. #ifdef USE_CLEARCOAT
  1014. vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
  1015. vec3 f0 = material.clearcoatF0;
  1016. float f90 = material.clearcoatF90;
  1017. float roughness = material.clearcoatRoughness;
  1018. float alpha = pow2( roughness );
  1019. vec3 halfDir = normalize( lightDir + viewDir );
  1020. float dotNL = saturate( dot( normal, lightDir ) );
  1021. float dotNV = saturate( dot( normal, viewDir ) );
  1022. float dotNH = saturate( dot( normal, halfDir ) );
  1023. float dotVH = saturate( dot( viewDir, halfDir ) );
  1024. vec3 F = F_Schlick( f0, f90, dotVH );
  1025. float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
  1026. float D = D_GGX( alpha, dotNH );
  1027. return F * ( V * D );
  1028. }
  1029. #endif
  1030. vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
  1031. vec3 f0 = material.specularColor;
  1032. float f90 = material.specularF90;
  1033. float roughness = material.roughness;
  1034. float alpha = pow2( roughness );
  1035. vec3 halfDir = normalize( lightDir + viewDir );
  1036. float dotNL = saturate( dot( normal, lightDir ) );
  1037. float dotNV = saturate( dot( normal, viewDir ) );
  1038. float dotNH = saturate( dot( normal, halfDir ) );
  1039. float dotVH = saturate( dot( viewDir, halfDir ) );
  1040. vec3 F = F_Schlick( f0, f90, dotVH );
  1041. #ifdef USE_IRIDESCENCE
  1042. F = mix( F, material.iridescenceFresnel, material.iridescence );
  1043. #endif
  1044. #ifdef USE_ANISOTROPY
  1045. float dotTL = dot( material.anisotropyT, lightDir );
  1046. float dotTV = dot( material.anisotropyT, viewDir );
  1047. float dotTH = dot( material.anisotropyT, halfDir );
  1048. float dotBL = dot( material.anisotropyB, lightDir );
  1049. float dotBV = dot( material.anisotropyB, viewDir );
  1050. float dotBH = dot( material.anisotropyB, halfDir );
  1051. float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
  1052. float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
  1053. #else
  1054. float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
  1055. float D = D_GGX( alpha, dotNH );
  1056. #endif
  1057. return F * ( V * D );
  1058. }
  1059. vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
  1060. const float LUT_SIZE = 64.0;
  1061. const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
  1062. const float LUT_BIAS = 0.5 / LUT_SIZE;
  1063. float dotNV = saturate( dot( N, V ) );
  1064. vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
  1065. uv = uv * LUT_SCALE + LUT_BIAS;
  1066. return uv;
  1067. }
  1068. float LTC_ClippedSphereFormFactor( const in vec3 f ) {
  1069. float l = length( f );
  1070. return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
  1071. }
  1072. vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
  1073. float x = dot( v1, v2 );
  1074. float y = abs( x );
  1075. float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
  1076. float b = 3.4175940 + ( 4.1616724 + y ) * y;
  1077. float v = a / b;
  1078. float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
  1079. return cross( v1, v2 ) * theta_sintheta;
  1080. }
  1081. vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
  1082. vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
  1083. vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
  1084. vec3 lightNormal = cross( v1, v2 );
  1085. if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
  1086. vec3 T1, T2;
  1087. T1 = normalize( V - N * dot( V, N ) );
  1088. T2 = - cross( N, T1 );
  1089. mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
  1090. vec3 coords[ 4 ];
  1091. coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
  1092. coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
  1093. coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
  1094. coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
  1095. coords[ 0 ] = normalize( coords[ 0 ] );
  1096. coords[ 1 ] = normalize( coords[ 1 ] );
  1097. coords[ 2 ] = normalize( coords[ 2 ] );
  1098. coords[ 3 ] = normalize( coords[ 3 ] );
  1099. vec3 vectorFormFactor = vec3( 0.0 );
  1100. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
  1101. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
  1102. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
  1103. vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
  1104. float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
  1105. return vec3( result );
  1106. }
  1107. #if defined( USE_SHEEN )
  1108. float D_Charlie( float roughness, float dotNH ) {
  1109. float alpha = pow2( roughness );
  1110. float invAlpha = 1.0 / alpha;
  1111. float cos2h = dotNH * dotNH;
  1112. float sin2h = max( 1.0 - cos2h, 0.0078125 );
  1113. return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
  1114. }
  1115. float V_Neubelt( float dotNV, float dotNL ) {
  1116. return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
  1117. }
  1118. vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
  1119. vec3 halfDir = normalize( lightDir + viewDir );
  1120. float dotNL = saturate( dot( normal, lightDir ) );
  1121. float dotNV = saturate( dot( normal, viewDir ) );
  1122. float dotNH = saturate( dot( normal, halfDir ) );
  1123. float D = D_Charlie( sheenRoughness, dotNH );
  1124. float V = V_Neubelt( dotNV, dotNL );
  1125. return sheenColor * ( D * V );
  1126. }
  1127. #endif
  1128. float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
  1129. float dotNV = saturate( dot( normal, viewDir ) );
  1130. float r2 = roughness * roughness;
  1131. float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
  1132. float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
  1133. float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
  1134. return saturate( DG * RECIPROCAL_PI );
  1135. }
  1136. vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
  1137. float dotNV = saturate( dot( normal, viewDir ) );
  1138. const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
  1139. const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
  1140. vec4 r = roughness * c0 + c1;
  1141. float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
  1142. vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
  1143. return fab;
  1144. }
  1145. vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
  1146. vec2 fab = DFGApprox( normal, viewDir, roughness );
  1147. return specularColor * fab.x + specularF90 * fab.y;
  1148. }
  1149. #ifdef USE_IRIDESCENCE
  1150. 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 ) {
  1151. #else
  1152. 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 ) {
  1153. #endif
  1154. vec2 fab = DFGApprox( normal, viewDir, roughness );
  1155. #ifdef USE_IRIDESCENCE
  1156. vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
  1157. #else
  1158. vec3 Fr = specularColor;
  1159. #endif
  1160. vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
  1161. float Ess = fab.x + fab.y;
  1162. float Ems = 1.0 - Ess;
  1163. vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
  1164. singleScatter += FssEss;
  1165. multiScatter += Fms * Ems;
  1166. }
  1167. #if NUM_RECT_AREA_LIGHTS > 0
  1168. 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 ) {
  1169. vec3 normal = geometryNormal;
  1170. vec3 viewDir = geometryViewDir;
  1171. vec3 position = geometryPosition;
  1172. vec3 lightPos = rectAreaLight.position;
  1173. vec3 halfWidth = rectAreaLight.halfWidth;
  1174. vec3 halfHeight = rectAreaLight.halfHeight;
  1175. vec3 lightColor = rectAreaLight.color;
  1176. float roughness = material.roughness;
  1177. vec3 rectCoords[ 4 ];
  1178. rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
  1179. rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
  1180. rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
  1181. vec2 uv = LTC_Uv( normal, viewDir, roughness );
  1182. vec4 t1 = texture2D( ltc_1, uv );
  1183. vec4 t2 = texture2D( ltc_2, uv );
  1184. mat3 mInv = mat3(
  1185. vec3( t1.x, 0, t1.y ),
  1186. vec3( 0, 1, 0 ),
  1187. vec3( t1.z, 0, t1.w )
  1188. );
  1189. vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
  1190. reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
  1191. reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
  1192. }
  1193. #endif
  1194. 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 ) {
  1195. float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
  1196. vec3 irradiance = dotNL * directLight.color;
  1197. #ifdef USE_CLEARCOAT
  1198. float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
  1199. vec3 ccIrradiance = dotNLcc * directLight.color;
  1200. clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
  1201. #endif
  1202. #ifdef USE_SHEEN
  1203. sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
  1204. #endif
  1205. reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
  1206. reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  1207. }
  1208. 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 ) {
  1209. reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
  1210. }
  1211. 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) {
  1212. #ifdef USE_CLEARCOAT
  1213. clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
  1214. #endif
  1215. #ifdef USE_SHEEN
  1216. sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
  1217. #endif
  1218. vec3 singleScattering = vec3( 0.0 );
  1219. vec3 multiScattering = vec3( 0.0 );
  1220. vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
  1221. #ifdef USE_IRIDESCENCE
  1222. computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
  1223. #else
  1224. computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
  1225. #endif
  1226. vec3 totalScattering = singleScattering + multiScattering;
  1227. vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
  1228. reflectedLight.indirectSpecular += radiance * singleScattering;
  1229. reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
  1230. reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
  1231. }
  1232. #define RE_Direct RE_Direct_Physical
  1233. #define RE_Direct_RectArea RE_Direct_RectArea_Physical
  1234. #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
  1235. #define RE_IndirectSpecular RE_IndirectSpecular_Physical
  1236. float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
  1237. return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
  1238. }`,KO=`
  1239. vec3 geometryPosition = - vViewPosition;
  1240. vec3 geometryNormal = normal;
  1241. vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
  1242. vec3 geometryClearcoatNormal = vec3( 0.0 );
  1243. #ifdef USE_CLEARCOAT
  1244. geometryClearcoatNormal = clearcoatNormal;
  1245. #endif
  1246. #ifdef USE_IRIDESCENCE
  1247. float dotNVi = saturate( dot( normal, geometryViewDir ) );
  1248. if ( material.iridescenceThickness == 0.0 ) {
  1249. material.iridescence = 0.0;
  1250. } else {
  1251. material.iridescence = saturate( material.iridescence );
  1252. }
  1253. if ( material.iridescence > 0.0 ) {
  1254. material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
  1255. material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
  1256. }
  1257. #endif
  1258. IncidentLight directLight;
  1259. #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
  1260. PointLight pointLight;
  1261. #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
  1262. PointLightShadow pointLightShadow;
  1263. #endif
  1264. #pragma unroll_loop_start
  1265. for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
  1266. pointLight = pointLights[ i ];
  1267. getPointLightInfo( pointLight, geometryPosition, directLight );
  1268. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
  1269. pointLightShadow = pointLightShadows[ i ];
  1270. directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
  1271. #endif
  1272. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  1273. }
  1274. #pragma unroll_loop_end
  1275. #endif
  1276. #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
  1277. SpotLight spotLight;
  1278. vec4 spotColor;
  1279. vec3 spotLightCoord;
  1280. bool inSpotLightMap;
  1281. #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
  1282. SpotLightShadow spotLightShadow;
  1283. #endif
  1284. #pragma unroll_loop_start
  1285. for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
  1286. spotLight = spotLights[ i ];
  1287. getSpotLightInfo( spotLight, geometryPosition, directLight );
  1288. #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
  1289. #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
  1290. #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  1291. #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
  1292. #else
  1293. #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
  1294. #endif
  1295. #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
  1296. spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
  1297. inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
  1298. spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
  1299. directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
  1300. #endif
  1301. #undef SPOT_LIGHT_MAP_INDEX
  1302. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  1303. spotLightShadow = spotLightShadows[ i ];
  1304. directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
  1305. #endif
  1306. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  1307. }
  1308. #pragma unroll_loop_end
  1309. #endif
  1310. #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
  1311. DirectionalLight directionalLight;
  1312. #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
  1313. DirectionalLightShadow directionalLightShadow;
  1314. #endif
  1315. #pragma unroll_loop_start
  1316. for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
  1317. directionalLight = directionalLights[ i ];
  1318. getDirectionalLightInfo( directionalLight, directLight );
  1319. #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
  1320. directionalLightShadow = directionalLightShadows[ i ];
  1321. directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  1322. #endif
  1323. RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  1324. }
  1325. #pragma unroll_loop_end
  1326. #endif
  1327. #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
  1328. RectAreaLight rectAreaLight;
  1329. #pragma unroll_loop_start
  1330. for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
  1331. rectAreaLight = rectAreaLights[ i ];
  1332. RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  1333. }
  1334. #pragma unroll_loop_end
  1335. #endif
  1336. #if defined( RE_IndirectDiffuse )
  1337. vec3 iblIrradiance = vec3( 0.0 );
  1338. vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
  1339. #if defined( USE_LIGHT_PROBES )
  1340. irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
  1341. #endif
  1342. #if ( NUM_HEMI_LIGHTS > 0 )
  1343. #pragma unroll_loop_start
  1344. for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
  1345. irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
  1346. }
  1347. #pragma unroll_loop_end
  1348. #endif
  1349. #endif
  1350. #if defined( RE_IndirectSpecular )
  1351. vec3 radiance = vec3( 0.0 );
  1352. vec3 clearcoatRadiance = vec3( 0.0 );
  1353. #endif`,JO=`#if defined( RE_IndirectDiffuse )
  1354. #ifdef USE_LIGHTMAP
  1355. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  1356. vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
  1357. irradiance += lightMapIrradiance;
  1358. #endif
  1359. #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
  1360. iblIrradiance += getIBLIrradiance( geometryNormal );
  1361. #endif
  1362. #endif
  1363. #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
  1364. #ifdef USE_ANISOTROPY
  1365. radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
  1366. #else
  1367. radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
  1368. #endif
  1369. #ifdef USE_CLEARCOAT
  1370. clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
  1371. #endif
  1372. #endif`,QO=`#if defined( RE_IndirectDiffuse )
  1373. RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  1374. #endif
  1375. #if defined( RE_IndirectSpecular )
  1376. RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
  1377. #endif`,eN=`#if defined( USE_LOGDEPTHBUF )
  1378. gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
  1379. #endif`,tN=`#if defined( USE_LOGDEPTHBUF )
  1380. uniform float logDepthBufFC;
  1381. varying float vFragDepth;
  1382. varying float vIsPerspective;
  1383. #endif`,nN=`#ifdef USE_LOGDEPTHBUF
  1384. varying float vFragDepth;
  1385. varying float vIsPerspective;
  1386. #endif`,iN=`#ifdef USE_LOGDEPTHBUF
  1387. vFragDepth = 1.0 + gl_Position.w;
  1388. vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
  1389. #endif`,sN=`#ifdef USE_MAP
  1390. vec4 sampledDiffuseColor = texture2D( map, vMapUv );
  1391. #ifdef DECODE_VIDEO_TEXTURE
  1392. sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
  1393. #endif
  1394. diffuseColor *= sampledDiffuseColor;
  1395. #endif`,oN=`#ifdef USE_MAP
  1396. uniform sampler2D map;
  1397. #endif`,rN=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
  1398. #if defined( USE_POINTS_UV )
  1399. vec2 uv = vUv;
  1400. #else
  1401. vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
  1402. #endif
  1403. #endif
  1404. #ifdef USE_MAP
  1405. diffuseColor *= texture2D( map, uv );
  1406. #endif
  1407. #ifdef USE_ALPHAMAP
  1408. diffuseColor.a *= texture2D( alphaMap, uv ).g;
  1409. #endif`,aN=`#if defined( USE_POINTS_UV )
  1410. varying vec2 vUv;
  1411. #else
  1412. #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
  1413. uniform mat3 uvTransform;
  1414. #endif
  1415. #endif
  1416. #ifdef USE_MAP
  1417. uniform sampler2D map;
  1418. #endif
  1419. #ifdef USE_ALPHAMAP
  1420. uniform sampler2D alphaMap;
  1421. #endif`,lN=`float metalnessFactor = metalness;
  1422. #ifdef USE_METALNESSMAP
  1423. vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
  1424. metalnessFactor *= texelMetalness.b;
  1425. #endif`,cN=`#ifdef USE_METALNESSMAP
  1426. uniform sampler2D metalnessMap;
  1427. #endif`,dN=`#ifdef USE_INSTANCING_MORPH
  1428. float morphTargetInfluences[ MORPHTARGETS_COUNT ];
  1429. float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
  1430. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  1431. morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
  1432. }
  1433. #endif`,uN=`#if defined( USE_MORPHCOLORS )
  1434. vColor *= morphTargetBaseInfluence;
  1435. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  1436. #if defined( USE_COLOR_ALPHA )
  1437. if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
  1438. #elif defined( USE_COLOR )
  1439. if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
  1440. #endif
  1441. }
  1442. #endif`,hN=`#ifdef USE_MORPHNORMALS
  1443. objectNormal *= morphTargetBaseInfluence;
  1444. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  1445. if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
  1446. }
  1447. #endif`,fN=`#ifdef USE_MORPHTARGETS
  1448. #ifndef USE_INSTANCING_MORPH
  1449. uniform float morphTargetBaseInfluence;
  1450. uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
  1451. #endif
  1452. uniform sampler2DArray morphTargetsTexture;
  1453. uniform ivec2 morphTargetsTextureSize;
  1454. vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
  1455. int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
  1456. int y = texelIndex / morphTargetsTextureSize.x;
  1457. int x = texelIndex - y * morphTargetsTextureSize.x;
  1458. ivec3 morphUV = ivec3( x, y, morphTargetIndex );
  1459. return texelFetch( morphTargetsTexture, morphUV, 0 );
  1460. }
  1461. #endif`,pN=`#ifdef USE_MORPHTARGETS
  1462. transformed *= morphTargetBaseInfluence;
  1463. for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
  1464. if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
  1465. }
  1466. #endif`,mN=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
  1467. #ifdef FLAT_SHADED
  1468. vec3 fdx = dFdx( vViewPosition );
  1469. vec3 fdy = dFdy( vViewPosition );
  1470. vec3 normal = normalize( cross( fdx, fdy ) );
  1471. #else
  1472. vec3 normal = normalize( vNormal );
  1473. #ifdef DOUBLE_SIDED
  1474. normal *= faceDirection;
  1475. #endif
  1476. #endif
  1477. #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
  1478. #ifdef USE_TANGENT
  1479. mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
  1480. #else
  1481. mat3 tbn = getTangentFrame( - vViewPosition, normal,
  1482. #if defined( USE_NORMALMAP )
  1483. vNormalMapUv
  1484. #elif defined( USE_CLEARCOAT_NORMALMAP )
  1485. vClearcoatNormalMapUv
  1486. #else
  1487. vUv
  1488. #endif
  1489. );
  1490. #endif
  1491. #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
  1492. tbn[0] *= faceDirection;
  1493. tbn[1] *= faceDirection;
  1494. #endif
  1495. #endif
  1496. #ifdef USE_CLEARCOAT_NORMALMAP
  1497. #ifdef USE_TANGENT
  1498. mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
  1499. #else
  1500. mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
  1501. #endif
  1502. #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
  1503. tbn2[0] *= faceDirection;
  1504. tbn2[1] *= faceDirection;
  1505. #endif
  1506. #endif
  1507. vec3 nonPerturbedNormal = normal;`,_N=`#ifdef USE_NORMALMAP_OBJECTSPACE
  1508. normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
  1509. #ifdef FLIP_SIDED
  1510. normal = - normal;
  1511. #endif
  1512. #ifdef DOUBLE_SIDED
  1513. normal = normal * faceDirection;
  1514. #endif
  1515. normal = normalize( normalMatrix * normal );
  1516. #elif defined( USE_NORMALMAP_TANGENTSPACE )
  1517. vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
  1518. mapN.xy *= normalScale;
  1519. normal = normalize( tbn * mapN );
  1520. #elif defined( USE_BUMPMAP )
  1521. normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
  1522. #endif`,gN=`#ifndef FLAT_SHADED
  1523. varying vec3 vNormal;
  1524. #ifdef USE_TANGENT
  1525. varying vec3 vTangent;
  1526. varying vec3 vBitangent;
  1527. #endif
  1528. #endif`,vN=`#ifndef FLAT_SHADED
  1529. varying vec3 vNormal;
  1530. #ifdef USE_TANGENT
  1531. varying vec3 vTangent;
  1532. varying vec3 vBitangent;
  1533. #endif
  1534. #endif`,bN=`#ifndef FLAT_SHADED
  1535. vNormal = normalize( transformedNormal );
  1536. #ifdef USE_TANGENT
  1537. vTangent = normalize( transformedTangent );
  1538. vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
  1539. #endif
  1540. #endif`,yN=`#ifdef USE_NORMALMAP
  1541. uniform sampler2D normalMap;
  1542. uniform vec2 normalScale;
  1543. #endif
  1544. #ifdef USE_NORMALMAP_OBJECTSPACE
  1545. uniform mat3 normalMatrix;
  1546. #endif
  1547. #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
  1548. mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
  1549. vec3 q0 = dFdx( eye_pos.xyz );
  1550. vec3 q1 = dFdy( eye_pos.xyz );
  1551. vec2 st0 = dFdx( uv.st );
  1552. vec2 st1 = dFdy( uv.st );
  1553. vec3 N = surf_norm;
  1554. vec3 q1perp = cross( q1, N );
  1555. vec3 q0perp = cross( N, q0 );
  1556. vec3 T = q1perp * st0.x + q0perp * st1.x;
  1557. vec3 B = q1perp * st0.y + q0perp * st1.y;
  1558. float det = max( dot( T, T ), dot( B, B ) );
  1559. float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
  1560. return mat3( T * scale, B * scale, N );
  1561. }
  1562. #endif`,xN=`#ifdef USE_CLEARCOAT
  1563. vec3 clearcoatNormal = nonPerturbedNormal;
  1564. #endif`,SN=`#ifdef USE_CLEARCOAT_NORMALMAP
  1565. vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
  1566. clearcoatMapN.xy *= clearcoatNormalScale;
  1567. clearcoatNormal = normalize( tbn2 * clearcoatMapN );
  1568. #endif`,MN=`#ifdef USE_CLEARCOATMAP
  1569. uniform sampler2D clearcoatMap;
  1570. #endif
  1571. #ifdef USE_CLEARCOAT_NORMALMAP
  1572. uniform sampler2D clearcoatNormalMap;
  1573. uniform vec2 clearcoatNormalScale;
  1574. #endif
  1575. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  1576. uniform sampler2D clearcoatRoughnessMap;
  1577. #endif`,EN=`#ifdef USE_IRIDESCENCEMAP
  1578. uniform sampler2D iridescenceMap;
  1579. #endif
  1580. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  1581. uniform sampler2D iridescenceThicknessMap;
  1582. #endif`,wN=`#ifdef OPAQUE
  1583. diffuseColor.a = 1.0;
  1584. #endif
  1585. #ifdef USE_TRANSMISSION
  1586. diffuseColor.a *= material.transmissionAlpha;
  1587. #endif
  1588. gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,TN=`vec3 packNormalToRGB( const in vec3 normal ) {
  1589. return normalize( normal ) * 0.5 + 0.5;
  1590. }
  1591. vec3 unpackRGBToNormal( const in vec3 rgb ) {
  1592. return 2.0 * rgb.xyz - 1.0;
  1593. }
  1594. const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
  1595. const float Inv255 = 1. / 255.;
  1596. const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
  1597. const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
  1598. const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
  1599. const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
  1600. vec4 packDepthToRGBA( const in float v ) {
  1601. if( v <= 0.0 )
  1602. return vec4( 0., 0., 0., 0. );
  1603. if( v >= 1.0 )
  1604. return vec4( 1., 1., 1., 1. );
  1605. float vuf;
  1606. float af = modf( v * PackFactors.a, vuf );
  1607. float bf = modf( vuf * ShiftRight8, vuf );
  1608. float gf = modf( vuf * ShiftRight8, vuf );
  1609. return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
  1610. }
  1611. vec3 packDepthToRGB( const in float v ) {
  1612. if( v <= 0.0 )
  1613. return vec3( 0., 0., 0. );
  1614. if( v >= 1.0 )
  1615. return vec3( 1., 1., 1. );
  1616. float vuf;
  1617. float bf = modf( v * PackFactors.b, vuf );
  1618. float gf = modf( vuf * ShiftRight8, vuf );
  1619. return vec3( vuf * Inv255, gf * PackUpscale, bf );
  1620. }
  1621. vec2 packDepthToRG( const in float v ) {
  1622. if( v <= 0.0 )
  1623. return vec2( 0., 0. );
  1624. if( v >= 1.0 )
  1625. return vec2( 1., 1. );
  1626. float vuf;
  1627. float gf = modf( v * 256., vuf );
  1628. return vec2( vuf * Inv255, gf );
  1629. }
  1630. float unpackRGBAToDepth( const in vec4 v ) {
  1631. return dot( v, UnpackFactors4 );
  1632. }
  1633. float unpackRGBToDepth( const in vec3 v ) {
  1634. return dot( v, UnpackFactors3 );
  1635. }
  1636. float unpackRGToDepth( const in vec2 v ) {
  1637. return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
  1638. }
  1639. vec4 pack2HalfToRGBA( const in vec2 v ) {
  1640. vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
  1641. return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
  1642. }
  1643. vec2 unpackRGBATo2Half( const in vec4 v ) {
  1644. return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
  1645. }
  1646. float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
  1647. return ( viewZ + near ) / ( near - far );
  1648. }
  1649. float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
  1650. return depth * ( near - far ) - near;
  1651. }
  1652. float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
  1653. return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
  1654. }
  1655. float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
  1656. return ( near * far ) / ( ( far - near ) * depth - far );
  1657. }`,CN=`#ifdef PREMULTIPLIED_ALPHA
  1658. gl_FragColor.rgb *= gl_FragColor.a;
  1659. #endif`,AN=`vec4 mvPosition = vec4( transformed, 1.0 );
  1660. #ifdef USE_BATCHING
  1661. mvPosition = batchingMatrix * mvPosition;
  1662. #endif
  1663. #ifdef USE_INSTANCING
  1664. mvPosition = instanceMatrix * mvPosition;
  1665. #endif
  1666. mvPosition = modelViewMatrix * mvPosition;
  1667. gl_Position = projectionMatrix * mvPosition;`,PN=`#ifdef DITHERING
  1668. gl_FragColor.rgb = dithering( gl_FragColor.rgb );
  1669. #endif`,RN=`#ifdef DITHERING
  1670. vec3 dithering( vec3 color ) {
  1671. float grid_position = rand( gl_FragCoord.xy );
  1672. vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
  1673. dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
  1674. return color + dither_shift_RGB;
  1675. }
  1676. #endif`,DN=`float roughnessFactor = roughness;
  1677. #ifdef USE_ROUGHNESSMAP
  1678. vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
  1679. roughnessFactor *= texelRoughness.g;
  1680. #endif`,IN=`#ifdef USE_ROUGHNESSMAP
  1681. uniform sampler2D roughnessMap;
  1682. #endif`,FN=`#if NUM_SPOT_LIGHT_COORDS > 0
  1683. varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
  1684. #endif
  1685. #if NUM_SPOT_LIGHT_MAPS > 0
  1686. uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
  1687. #endif
  1688. #ifdef USE_SHADOWMAP
  1689. #if NUM_DIR_LIGHT_SHADOWS > 0
  1690. uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
  1691. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
  1692. struct DirectionalLightShadow {
  1693. float shadowIntensity;
  1694. float shadowBias;
  1695. float shadowNormalBias;
  1696. float shadowRadius;
  1697. vec2 shadowMapSize;
  1698. };
  1699. uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
  1700. #endif
  1701. #if NUM_SPOT_LIGHT_SHADOWS > 0
  1702. uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
  1703. struct SpotLightShadow {
  1704. float shadowIntensity;
  1705. float shadowBias;
  1706. float shadowNormalBias;
  1707. float shadowRadius;
  1708. vec2 shadowMapSize;
  1709. };
  1710. uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
  1711. #endif
  1712. #if NUM_POINT_LIGHT_SHADOWS > 0
  1713. uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
  1714. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
  1715. struct PointLightShadow {
  1716. float shadowIntensity;
  1717. float shadowBias;
  1718. float shadowNormalBias;
  1719. float shadowRadius;
  1720. vec2 shadowMapSize;
  1721. float shadowCameraNear;
  1722. float shadowCameraFar;
  1723. };
  1724. uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
  1725. #endif
  1726. float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
  1727. return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
  1728. }
  1729. vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
  1730. return unpackRGBATo2Half( texture2D( shadow, uv ) );
  1731. }
  1732. float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
  1733. float occlusion = 1.0;
  1734. vec2 distribution = texture2DDistribution( shadow, uv );
  1735. float hard_shadow = step( compare , distribution.x );
  1736. if (hard_shadow != 1.0 ) {
  1737. float distance = compare - distribution.x ;
  1738. float variance = max( 0.00000, distribution.y * distribution.y );
  1739. 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 );
  1740. }
  1741. return occlusion;
  1742. }
  1743. float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
  1744. float shadow = 1.0;
  1745. shadowCoord.xyz /= shadowCoord.w;
  1746. shadowCoord.z += shadowBias;
  1747. bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
  1748. bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
  1749. if ( frustumTest ) {
  1750. #if defined( SHADOWMAP_TYPE_PCF )
  1751. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  1752. float dx0 = - texelSize.x * shadowRadius;
  1753. float dy0 = - texelSize.y * shadowRadius;
  1754. float dx1 = + texelSize.x * shadowRadius;
  1755. float dy1 = + texelSize.y * shadowRadius;
  1756. float dx2 = dx0 / 2.0;
  1757. float dy2 = dy0 / 2.0;
  1758. float dx3 = dx1 / 2.0;
  1759. float dy3 = dy1 / 2.0;
  1760. shadow = (
  1761. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
  1762. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
  1763. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
  1764. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
  1765. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
  1766. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
  1767. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
  1768. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
  1769. texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
  1770. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
  1771. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
  1772. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
  1773. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
  1774. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
  1775. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
  1776. texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
  1777. texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
  1778. ) * ( 1.0 / 17.0 );
  1779. #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
  1780. vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
  1781. float dx = texelSize.x;
  1782. float dy = texelSize.y;
  1783. vec2 uv = shadowCoord.xy;
  1784. vec2 f = fract( uv * shadowMapSize + 0.5 );
  1785. uv -= f * texelSize;
  1786. shadow = (
  1787. texture2DCompare( shadowMap, uv, shadowCoord.z ) +
  1788. texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
  1789. texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
  1790. texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
  1791. mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
  1792. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
  1793. f.x ) +
  1794. mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
  1795. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
  1796. f.x ) +
  1797. mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
  1798. texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
  1799. f.y ) +
  1800. mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
  1801. texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
  1802. f.y ) +
  1803. mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
  1804. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
  1805. f.x ),
  1806. mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
  1807. texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
  1808. f.x ),
  1809. f.y )
  1810. ) * ( 1.0 / 9.0 );
  1811. #elif defined( SHADOWMAP_TYPE_VSM )
  1812. shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
  1813. #else
  1814. shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
  1815. #endif
  1816. }
  1817. return mix( 1.0, shadow, shadowIntensity );
  1818. }
  1819. vec2 cubeToUV( vec3 v, float texelSizeY ) {
  1820. vec3 absV = abs( v );
  1821. float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
  1822. absV *= scaleToCube;
  1823. v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
  1824. vec2 planar = v.xy;
  1825. float almostATexel = 1.5 * texelSizeY;
  1826. float almostOne = 1.0 - almostATexel;
  1827. if ( absV.z >= almostOne ) {
  1828. if ( v.z > 0.0 )
  1829. planar.x = 4.0 - v.x;
  1830. } else if ( absV.x >= almostOne ) {
  1831. float signX = sign( v.x );
  1832. planar.x = v.z * signX + 2.0 * signX;
  1833. } else if ( absV.y >= almostOne ) {
  1834. float signY = sign( v.y );
  1835. planar.x = v.x + 2.0 * signY + 2.0;
  1836. planar.y = v.z * signY - 2.0;
  1837. }
  1838. return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
  1839. }
  1840. float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
  1841. float shadow = 1.0;
  1842. vec3 lightToPosition = shadowCoord.xyz;
  1843. float lightToPositionLength = length( lightToPosition );
  1844. if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
  1845. float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
  1846. vec3 bd3D = normalize( lightToPosition );
  1847. vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
  1848. #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
  1849. vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
  1850. shadow = (
  1851. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
  1852. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
  1853. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
  1854. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
  1855. texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
  1856. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
  1857. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
  1858. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
  1859. texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
  1860. ) * ( 1.0 / 9.0 );
  1861. #else
  1862. shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
  1863. #endif
  1864. }
  1865. return mix( 1.0, shadow, shadowIntensity );
  1866. }
  1867. #endif`,LN=`#if NUM_SPOT_LIGHT_COORDS > 0
  1868. uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
  1869. varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
  1870. #endif
  1871. #ifdef USE_SHADOWMAP
  1872. #if NUM_DIR_LIGHT_SHADOWS > 0
  1873. uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
  1874. varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
  1875. struct DirectionalLightShadow {
  1876. float shadowIntensity;
  1877. float shadowBias;
  1878. float shadowNormalBias;
  1879. float shadowRadius;
  1880. vec2 shadowMapSize;
  1881. };
  1882. uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
  1883. #endif
  1884. #if NUM_SPOT_LIGHT_SHADOWS > 0
  1885. struct SpotLightShadow {
  1886. float shadowIntensity;
  1887. float shadowBias;
  1888. float shadowNormalBias;
  1889. float shadowRadius;
  1890. vec2 shadowMapSize;
  1891. };
  1892. uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
  1893. #endif
  1894. #if NUM_POINT_LIGHT_SHADOWS > 0
  1895. uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
  1896. varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
  1897. struct PointLightShadow {
  1898. float shadowIntensity;
  1899. float shadowBias;
  1900. float shadowNormalBias;
  1901. float shadowRadius;
  1902. vec2 shadowMapSize;
  1903. float shadowCameraNear;
  1904. float shadowCameraFar;
  1905. };
  1906. uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
  1907. #endif
  1908. #endif`,UN=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
  1909. vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
  1910. vec4 shadowWorldPosition;
  1911. #endif
  1912. #if defined( USE_SHADOWMAP )
  1913. #if NUM_DIR_LIGHT_SHADOWS > 0
  1914. #pragma unroll_loop_start
  1915. for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
  1916. shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
  1917. vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
  1918. }
  1919. #pragma unroll_loop_end
  1920. #endif
  1921. #if NUM_POINT_LIGHT_SHADOWS > 0
  1922. #pragma unroll_loop_start
  1923. for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
  1924. shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
  1925. vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
  1926. }
  1927. #pragma unroll_loop_end
  1928. #endif
  1929. #endif
  1930. #if NUM_SPOT_LIGHT_COORDS > 0
  1931. #pragma unroll_loop_start
  1932. for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
  1933. shadowWorldPosition = worldPosition;
  1934. #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
  1935. shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
  1936. #endif
  1937. vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
  1938. }
  1939. #pragma unroll_loop_end
  1940. #endif`,ON=`float getShadowMask() {
  1941. float shadow = 1.0;
  1942. #ifdef USE_SHADOWMAP
  1943. #if NUM_DIR_LIGHT_SHADOWS > 0
  1944. DirectionalLightShadow directionalLight;
  1945. #pragma unroll_loop_start
  1946. for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
  1947. directionalLight = directionalLightShadows[ i ];
  1948. shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
  1949. }
  1950. #pragma unroll_loop_end
  1951. #endif
  1952. #if NUM_SPOT_LIGHT_SHADOWS > 0
  1953. SpotLightShadow spotLight;
  1954. #pragma unroll_loop_start
  1955. for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
  1956. spotLight = spotLightShadows[ i ];
  1957. shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
  1958. }
  1959. #pragma unroll_loop_end
  1960. #endif
  1961. #if NUM_POINT_LIGHT_SHADOWS > 0
  1962. PointLightShadow pointLight;
  1963. #pragma unroll_loop_start
  1964. for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
  1965. pointLight = pointLightShadows[ i ];
  1966. shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
  1967. }
  1968. #pragma unroll_loop_end
  1969. #endif
  1970. #endif
  1971. return shadow;
  1972. }`,NN=`#ifdef USE_SKINNING
  1973. mat4 boneMatX = getBoneMatrix( skinIndex.x );
  1974. mat4 boneMatY = getBoneMatrix( skinIndex.y );
  1975. mat4 boneMatZ = getBoneMatrix( skinIndex.z );
  1976. mat4 boneMatW = getBoneMatrix( skinIndex.w );
  1977. #endif`,zN=`#ifdef USE_SKINNING
  1978. uniform mat4 bindMatrix;
  1979. uniform mat4 bindMatrixInverse;
  1980. uniform highp sampler2D boneTexture;
  1981. mat4 getBoneMatrix( const in float i ) {
  1982. int size = textureSize( boneTexture, 0 ).x;
  1983. int j = int( i ) * 4;
  1984. int x = j % size;
  1985. int y = j / size;
  1986. vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
  1987. vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
  1988. vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
  1989. vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
  1990. return mat4( v1, v2, v3, v4 );
  1991. }
  1992. #endif`,kN=`#ifdef USE_SKINNING
  1993. vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
  1994. vec4 skinned = vec4( 0.0 );
  1995. skinned += boneMatX * skinVertex * skinWeight.x;
  1996. skinned += boneMatY * skinVertex * skinWeight.y;
  1997. skinned += boneMatZ * skinVertex * skinWeight.z;
  1998. skinned += boneMatW * skinVertex * skinWeight.w;
  1999. transformed = ( bindMatrixInverse * skinned ).xyz;
  2000. #endif`,BN=`#ifdef USE_SKINNING
  2001. mat4 skinMatrix = mat4( 0.0 );
  2002. skinMatrix += skinWeight.x * boneMatX;
  2003. skinMatrix += skinWeight.y * boneMatY;
  2004. skinMatrix += skinWeight.z * boneMatZ;
  2005. skinMatrix += skinWeight.w * boneMatW;
  2006. skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
  2007. objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
  2008. #ifdef USE_TANGENT
  2009. objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
  2010. #endif
  2011. #endif`,VN=`float specularStrength;
  2012. #ifdef USE_SPECULARMAP
  2013. vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
  2014. specularStrength = texelSpecular.r;
  2015. #else
  2016. specularStrength = 1.0;
  2017. #endif`,$N=`#ifdef USE_SPECULARMAP
  2018. uniform sampler2D specularMap;
  2019. #endif`,HN=`#if defined( TONE_MAPPING )
  2020. gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
  2021. #endif`,GN=`#ifndef saturate
  2022. #define saturate( a ) clamp( a, 0.0, 1.0 )
  2023. #endif
  2024. uniform float toneMappingExposure;
  2025. vec3 LinearToneMapping( vec3 color ) {
  2026. return saturate( toneMappingExposure * color );
  2027. }
  2028. vec3 ReinhardToneMapping( vec3 color ) {
  2029. color *= toneMappingExposure;
  2030. return saturate( color / ( vec3( 1.0 ) + color ) );
  2031. }
  2032. vec3 CineonToneMapping( vec3 color ) {
  2033. color *= toneMappingExposure;
  2034. color = max( vec3( 0.0 ), color - 0.004 );
  2035. return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
  2036. }
  2037. vec3 RRTAndODTFit( vec3 v ) {
  2038. vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
  2039. vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
  2040. return a / b;
  2041. }
  2042. vec3 ACESFilmicToneMapping( vec3 color ) {
  2043. const mat3 ACESInputMat = mat3(
  2044. vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
  2045. vec3( 0.04823, 0.01566, 0.83777 )
  2046. );
  2047. const mat3 ACESOutputMat = mat3(
  2048. vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
  2049. vec3( -0.07367, -0.00605, 1.07602 )
  2050. );
  2051. color *= toneMappingExposure / 0.6;
  2052. color = ACESInputMat * color;
  2053. color = RRTAndODTFit( color );
  2054. color = ACESOutputMat * color;
  2055. return saturate( color );
  2056. }
  2057. const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
  2058. vec3( 1.6605, - 0.1246, - 0.0182 ),
  2059. vec3( - 0.5876, 1.1329, - 0.1006 ),
  2060. vec3( - 0.0728, - 0.0083, 1.1187 )
  2061. );
  2062. const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
  2063. vec3( 0.6274, 0.0691, 0.0164 ),
  2064. vec3( 0.3293, 0.9195, 0.0880 ),
  2065. vec3( 0.0433, 0.0113, 0.8956 )
  2066. );
  2067. vec3 agxDefaultContrastApprox( vec3 x ) {
  2068. vec3 x2 = x * x;
  2069. vec3 x4 = x2 * x2;
  2070. return + 15.5 * x4 * x2
  2071. - 40.14 * x4 * x
  2072. + 31.96 * x4
  2073. - 6.868 * x2 * x
  2074. + 0.4298 * x2
  2075. + 0.1191 * x
  2076. - 0.00232;
  2077. }
  2078. vec3 AgXToneMapping( vec3 color ) {
  2079. const mat3 AgXInsetMatrix = mat3(
  2080. vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
  2081. vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
  2082. vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
  2083. );
  2084. const mat3 AgXOutsetMatrix = mat3(
  2085. vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
  2086. vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
  2087. vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
  2088. );
  2089. const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
  2090. color *= toneMappingExposure;
  2091. color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
  2092. color = AgXInsetMatrix * color;
  2093. color = max( color, 1e-10 ); color = log2( color );
  2094. color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
  2095. color = clamp( color, 0.0, 1.0 );
  2096. color = agxDefaultContrastApprox( color );
  2097. color = AgXOutsetMatrix * color;
  2098. color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
  2099. color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
  2100. color = clamp( color, 0.0, 1.0 );
  2101. return color;
  2102. }
  2103. vec3 NeutralToneMapping( vec3 color ) {
  2104. const float StartCompression = 0.8 - 0.04;
  2105. const float Desaturation = 0.15;
  2106. color *= toneMappingExposure;
  2107. float x = min( color.r, min( color.g, color.b ) );
  2108. float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
  2109. color -= offset;
  2110. float peak = max( color.r, max( color.g, color.b ) );
  2111. if ( peak < StartCompression ) return color;
  2112. float d = 1. - StartCompression;
  2113. float newPeak = 1. - d * d / ( peak + d - StartCompression );
  2114. color *= newPeak / peak;
  2115. float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
  2116. return mix( color, vec3( newPeak ), g );
  2117. }
  2118. vec3 CustomToneMapping( vec3 color ) { return color; }`,WN=`#ifdef USE_TRANSMISSION
  2119. material.transmission = transmission;
  2120. material.transmissionAlpha = 1.0;
  2121. material.thickness = thickness;
  2122. material.attenuationDistance = attenuationDistance;
  2123. material.attenuationColor = attenuationColor;
  2124. #ifdef USE_TRANSMISSIONMAP
  2125. material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
  2126. #endif
  2127. #ifdef USE_THICKNESSMAP
  2128. material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
  2129. #endif
  2130. vec3 pos = vWorldPosition;
  2131. vec3 v = normalize( cameraPosition - pos );
  2132. vec3 n = inverseTransformDirection( normal, viewMatrix );
  2133. vec4 transmitted = getIBLVolumeRefraction(
  2134. n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
  2135. pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
  2136. material.attenuationColor, material.attenuationDistance );
  2137. material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
  2138. totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
  2139. #endif`,XN=`#ifdef USE_TRANSMISSION
  2140. uniform float transmission;
  2141. uniform float thickness;
  2142. uniform float attenuationDistance;
  2143. uniform vec3 attenuationColor;
  2144. #ifdef USE_TRANSMISSIONMAP
  2145. uniform sampler2D transmissionMap;
  2146. #endif
  2147. #ifdef USE_THICKNESSMAP
  2148. uniform sampler2D thicknessMap;
  2149. #endif
  2150. uniform vec2 transmissionSamplerSize;
  2151. uniform sampler2D transmissionSamplerMap;
  2152. uniform mat4 modelMatrix;
  2153. uniform mat4 projectionMatrix;
  2154. varying vec3 vWorldPosition;
  2155. float w0( float a ) {
  2156. return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
  2157. }
  2158. float w1( float a ) {
  2159. return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
  2160. }
  2161. float w2( float a ){
  2162. return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
  2163. }
  2164. float w3( float a ) {
  2165. return ( 1.0 / 6.0 ) * ( a * a * a );
  2166. }
  2167. float g0( float a ) {
  2168. return w0( a ) + w1( a );
  2169. }
  2170. float g1( float a ) {
  2171. return w2( a ) + w3( a );
  2172. }
  2173. float h0( float a ) {
  2174. return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
  2175. }
  2176. float h1( float a ) {
  2177. return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
  2178. }
  2179. vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
  2180. uv = uv * texelSize.zw + 0.5;
  2181. vec2 iuv = floor( uv );
  2182. vec2 fuv = fract( uv );
  2183. float g0x = g0( fuv.x );
  2184. float g1x = g1( fuv.x );
  2185. float h0x = h0( fuv.x );
  2186. float h1x = h1( fuv.x );
  2187. float h0y = h0( fuv.y );
  2188. float h1y = h1( fuv.y );
  2189. vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
  2190. vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
  2191. vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
  2192. vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
  2193. return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
  2194. g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
  2195. }
  2196. vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
  2197. vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
  2198. vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
  2199. vec2 fLodSizeInv = 1.0 / fLodSize;
  2200. vec2 cLodSizeInv = 1.0 / cLodSize;
  2201. vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
  2202. vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
  2203. return mix( fSample, cSample, fract( lod ) );
  2204. }
  2205. vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
  2206. vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
  2207. vec3 modelScale;
  2208. modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
  2209. modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
  2210. modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
  2211. return normalize( refractionVector ) * thickness * modelScale;
  2212. }
  2213. float applyIorToRoughness( const in float roughness, const in float ior ) {
  2214. return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
  2215. }
  2216. vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
  2217. float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
  2218. return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
  2219. }
  2220. vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
  2221. if ( isinf( attenuationDistance ) ) {
  2222. return vec3( 1.0 );
  2223. } else {
  2224. vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
  2225. vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
  2226. }
  2227. }
  2228. vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
  2229. const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
  2230. const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
  2231. const in vec3 attenuationColor, const in float attenuationDistance ) {
  2232. vec4 transmittedLight;
  2233. vec3 transmittance;
  2234. #ifdef USE_DISPERSION
  2235. float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
  2236. vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
  2237. for ( int i = 0; i < 3; i ++ ) {
  2238. vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
  2239. vec3 refractedRayExit = position + transmissionRay;
  2240. vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
  2241. vec2 refractionCoords = ndcPos.xy / ndcPos.w;
  2242. refractionCoords += 1.0;
  2243. refractionCoords /= 2.0;
  2244. vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
  2245. transmittedLight[ i ] = transmissionSample[ i ];
  2246. transmittedLight.a += transmissionSample.a;
  2247. transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
  2248. }
  2249. transmittedLight.a /= 3.0;
  2250. #else
  2251. vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
  2252. vec3 refractedRayExit = position + transmissionRay;
  2253. vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
  2254. vec2 refractionCoords = ndcPos.xy / ndcPos.w;
  2255. refractionCoords += 1.0;
  2256. refractionCoords /= 2.0;
  2257. transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
  2258. transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
  2259. #endif
  2260. vec3 attenuatedColor = transmittance * transmittedLight.rgb;
  2261. vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
  2262. float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
  2263. return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
  2264. }
  2265. #endif`,jN=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
  2266. varying vec2 vUv;
  2267. #endif
  2268. #ifdef USE_MAP
  2269. varying vec2 vMapUv;
  2270. #endif
  2271. #ifdef USE_ALPHAMAP
  2272. varying vec2 vAlphaMapUv;
  2273. #endif
  2274. #ifdef USE_LIGHTMAP
  2275. varying vec2 vLightMapUv;
  2276. #endif
  2277. #ifdef USE_AOMAP
  2278. varying vec2 vAoMapUv;
  2279. #endif
  2280. #ifdef USE_BUMPMAP
  2281. varying vec2 vBumpMapUv;
  2282. #endif
  2283. #ifdef USE_NORMALMAP
  2284. varying vec2 vNormalMapUv;
  2285. #endif
  2286. #ifdef USE_EMISSIVEMAP
  2287. varying vec2 vEmissiveMapUv;
  2288. #endif
  2289. #ifdef USE_METALNESSMAP
  2290. varying vec2 vMetalnessMapUv;
  2291. #endif
  2292. #ifdef USE_ROUGHNESSMAP
  2293. varying vec2 vRoughnessMapUv;
  2294. #endif
  2295. #ifdef USE_ANISOTROPYMAP
  2296. varying vec2 vAnisotropyMapUv;
  2297. #endif
  2298. #ifdef USE_CLEARCOATMAP
  2299. varying vec2 vClearcoatMapUv;
  2300. #endif
  2301. #ifdef USE_CLEARCOAT_NORMALMAP
  2302. varying vec2 vClearcoatNormalMapUv;
  2303. #endif
  2304. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  2305. varying vec2 vClearcoatRoughnessMapUv;
  2306. #endif
  2307. #ifdef USE_IRIDESCENCEMAP
  2308. varying vec2 vIridescenceMapUv;
  2309. #endif
  2310. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  2311. varying vec2 vIridescenceThicknessMapUv;
  2312. #endif
  2313. #ifdef USE_SHEEN_COLORMAP
  2314. varying vec2 vSheenColorMapUv;
  2315. #endif
  2316. #ifdef USE_SHEEN_ROUGHNESSMAP
  2317. varying vec2 vSheenRoughnessMapUv;
  2318. #endif
  2319. #ifdef USE_SPECULARMAP
  2320. varying vec2 vSpecularMapUv;
  2321. #endif
  2322. #ifdef USE_SPECULAR_COLORMAP
  2323. varying vec2 vSpecularColorMapUv;
  2324. #endif
  2325. #ifdef USE_SPECULAR_INTENSITYMAP
  2326. varying vec2 vSpecularIntensityMapUv;
  2327. #endif
  2328. #ifdef USE_TRANSMISSIONMAP
  2329. uniform mat3 transmissionMapTransform;
  2330. varying vec2 vTransmissionMapUv;
  2331. #endif
  2332. #ifdef USE_THICKNESSMAP
  2333. uniform mat3 thicknessMapTransform;
  2334. varying vec2 vThicknessMapUv;
  2335. #endif`,YN=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
  2336. varying vec2 vUv;
  2337. #endif
  2338. #ifdef USE_MAP
  2339. uniform mat3 mapTransform;
  2340. varying vec2 vMapUv;
  2341. #endif
  2342. #ifdef USE_ALPHAMAP
  2343. uniform mat3 alphaMapTransform;
  2344. varying vec2 vAlphaMapUv;
  2345. #endif
  2346. #ifdef USE_LIGHTMAP
  2347. uniform mat3 lightMapTransform;
  2348. varying vec2 vLightMapUv;
  2349. #endif
  2350. #ifdef USE_AOMAP
  2351. uniform mat3 aoMapTransform;
  2352. varying vec2 vAoMapUv;
  2353. #endif
  2354. #ifdef USE_BUMPMAP
  2355. uniform mat3 bumpMapTransform;
  2356. varying vec2 vBumpMapUv;
  2357. #endif
  2358. #ifdef USE_NORMALMAP
  2359. uniform mat3 normalMapTransform;
  2360. varying vec2 vNormalMapUv;
  2361. #endif
  2362. #ifdef USE_DISPLACEMENTMAP
  2363. uniform mat3 displacementMapTransform;
  2364. varying vec2 vDisplacementMapUv;
  2365. #endif
  2366. #ifdef USE_EMISSIVEMAP
  2367. uniform mat3 emissiveMapTransform;
  2368. varying vec2 vEmissiveMapUv;
  2369. #endif
  2370. #ifdef USE_METALNESSMAP
  2371. uniform mat3 metalnessMapTransform;
  2372. varying vec2 vMetalnessMapUv;
  2373. #endif
  2374. #ifdef USE_ROUGHNESSMAP
  2375. uniform mat3 roughnessMapTransform;
  2376. varying vec2 vRoughnessMapUv;
  2377. #endif
  2378. #ifdef USE_ANISOTROPYMAP
  2379. uniform mat3 anisotropyMapTransform;
  2380. varying vec2 vAnisotropyMapUv;
  2381. #endif
  2382. #ifdef USE_CLEARCOATMAP
  2383. uniform mat3 clearcoatMapTransform;
  2384. varying vec2 vClearcoatMapUv;
  2385. #endif
  2386. #ifdef USE_CLEARCOAT_NORMALMAP
  2387. uniform mat3 clearcoatNormalMapTransform;
  2388. varying vec2 vClearcoatNormalMapUv;
  2389. #endif
  2390. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  2391. uniform mat3 clearcoatRoughnessMapTransform;
  2392. varying vec2 vClearcoatRoughnessMapUv;
  2393. #endif
  2394. #ifdef USE_SHEEN_COLORMAP
  2395. uniform mat3 sheenColorMapTransform;
  2396. varying vec2 vSheenColorMapUv;
  2397. #endif
  2398. #ifdef USE_SHEEN_ROUGHNESSMAP
  2399. uniform mat3 sheenRoughnessMapTransform;
  2400. varying vec2 vSheenRoughnessMapUv;
  2401. #endif
  2402. #ifdef USE_IRIDESCENCEMAP
  2403. uniform mat3 iridescenceMapTransform;
  2404. varying vec2 vIridescenceMapUv;
  2405. #endif
  2406. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  2407. uniform mat3 iridescenceThicknessMapTransform;
  2408. varying vec2 vIridescenceThicknessMapUv;
  2409. #endif
  2410. #ifdef USE_SPECULARMAP
  2411. uniform mat3 specularMapTransform;
  2412. varying vec2 vSpecularMapUv;
  2413. #endif
  2414. #ifdef USE_SPECULAR_COLORMAP
  2415. uniform mat3 specularColorMapTransform;
  2416. varying vec2 vSpecularColorMapUv;
  2417. #endif
  2418. #ifdef USE_SPECULAR_INTENSITYMAP
  2419. uniform mat3 specularIntensityMapTransform;
  2420. varying vec2 vSpecularIntensityMapUv;
  2421. #endif
  2422. #ifdef USE_TRANSMISSIONMAP
  2423. uniform mat3 transmissionMapTransform;
  2424. varying vec2 vTransmissionMapUv;
  2425. #endif
  2426. #ifdef USE_THICKNESSMAP
  2427. uniform mat3 thicknessMapTransform;
  2428. varying vec2 vThicknessMapUv;
  2429. #endif`,qN=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
  2430. vUv = vec3( uv, 1 ).xy;
  2431. #endif
  2432. #ifdef USE_MAP
  2433. vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
  2434. #endif
  2435. #ifdef USE_ALPHAMAP
  2436. vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
  2437. #endif
  2438. #ifdef USE_LIGHTMAP
  2439. vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
  2440. #endif
  2441. #ifdef USE_AOMAP
  2442. vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
  2443. #endif
  2444. #ifdef USE_BUMPMAP
  2445. vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
  2446. #endif
  2447. #ifdef USE_NORMALMAP
  2448. vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
  2449. #endif
  2450. #ifdef USE_DISPLACEMENTMAP
  2451. vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
  2452. #endif
  2453. #ifdef USE_EMISSIVEMAP
  2454. vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
  2455. #endif
  2456. #ifdef USE_METALNESSMAP
  2457. vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
  2458. #endif
  2459. #ifdef USE_ROUGHNESSMAP
  2460. vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
  2461. #endif
  2462. #ifdef USE_ANISOTROPYMAP
  2463. vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
  2464. #endif
  2465. #ifdef USE_CLEARCOATMAP
  2466. vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
  2467. #endif
  2468. #ifdef USE_CLEARCOAT_NORMALMAP
  2469. vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
  2470. #endif
  2471. #ifdef USE_CLEARCOAT_ROUGHNESSMAP
  2472. vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
  2473. #endif
  2474. #ifdef USE_IRIDESCENCEMAP
  2475. vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
  2476. #endif
  2477. #ifdef USE_IRIDESCENCE_THICKNESSMAP
  2478. vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
  2479. #endif
  2480. #ifdef USE_SHEEN_COLORMAP
  2481. vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
  2482. #endif
  2483. #ifdef USE_SHEEN_ROUGHNESSMAP
  2484. vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
  2485. #endif
  2486. #ifdef USE_SPECULARMAP
  2487. vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
  2488. #endif
  2489. #ifdef USE_SPECULAR_COLORMAP
  2490. vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
  2491. #endif
  2492. #ifdef USE_SPECULAR_INTENSITYMAP
  2493. vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
  2494. #endif
  2495. #ifdef USE_TRANSMISSIONMAP
  2496. vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
  2497. #endif
  2498. #ifdef USE_THICKNESSMAP
  2499. vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
  2500. #endif`,ZN=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
  2501. vec4 worldPosition = vec4( transformed, 1.0 );
  2502. #ifdef USE_BATCHING
  2503. worldPosition = batchingMatrix * worldPosition;
  2504. #endif
  2505. #ifdef USE_INSTANCING
  2506. worldPosition = instanceMatrix * worldPosition;
  2507. #endif
  2508. worldPosition = modelMatrix * worldPosition;
  2509. #endif`;const KN=`varying vec2 vUv;
  2510. uniform mat3 uvTransform;
  2511. void main() {
  2512. vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
  2513. gl_Position = vec4( position.xy, 1.0, 1.0 );
  2514. }`,JN=`uniform sampler2D t2D;
  2515. uniform float backgroundIntensity;
  2516. varying vec2 vUv;
  2517. void main() {
  2518. vec4 texColor = texture2D( t2D, vUv );
  2519. #ifdef DECODE_VIDEO_TEXTURE
  2520. 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 );
  2521. #endif
  2522. texColor.rgb *= backgroundIntensity;
  2523. gl_FragColor = texColor;
  2524. #include <tonemapping_fragment>
  2525. #include <colorspace_fragment>
  2526. }`,QN=`varying vec3 vWorldDirection;
  2527. #include <common>
  2528. void main() {
  2529. vWorldDirection = transformDirection( position, modelMatrix );
  2530. #include <begin_vertex>
  2531. #include <project_vertex>
  2532. gl_Position.z = gl_Position.w;
  2533. }`,ez=`#ifdef ENVMAP_TYPE_CUBE
  2534. uniform samplerCube envMap;
  2535. #elif defined( ENVMAP_TYPE_CUBE_UV )
  2536. uniform sampler2D envMap;
  2537. #endif
  2538. uniform float flipEnvMap;
  2539. uniform float backgroundBlurriness;
  2540. uniform float backgroundIntensity;
  2541. uniform mat3 backgroundRotation;
  2542. varying vec3 vWorldDirection;
  2543. #include <cube_uv_reflection_fragment>
  2544. void main() {
  2545. #ifdef ENVMAP_TYPE_CUBE
  2546. vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
  2547. #elif defined( ENVMAP_TYPE_CUBE_UV )
  2548. vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
  2549. #else
  2550. vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
  2551. #endif
  2552. texColor.rgb *= backgroundIntensity;
  2553. gl_FragColor = texColor;
  2554. #include <tonemapping_fragment>
  2555. #include <colorspace_fragment>
  2556. }`,tz=`varying vec3 vWorldDirection;
  2557. #include <common>
  2558. void main() {
  2559. vWorldDirection = transformDirection( position, modelMatrix );
  2560. #include <begin_vertex>
  2561. #include <project_vertex>
  2562. gl_Position.z = gl_Position.w;
  2563. }`,nz=`uniform samplerCube tCube;
  2564. uniform float tFlip;
  2565. uniform float opacity;
  2566. varying vec3 vWorldDirection;
  2567. void main() {
  2568. vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
  2569. gl_FragColor = texColor;
  2570. gl_FragColor.a *= opacity;
  2571. #include <tonemapping_fragment>
  2572. #include <colorspace_fragment>
  2573. }`,iz=`#include <common>
  2574. #include <batching_pars_vertex>
  2575. #include <uv_pars_vertex>
  2576. #include <displacementmap_pars_vertex>
  2577. #include <morphtarget_pars_vertex>
  2578. #include <skinning_pars_vertex>
  2579. #include <logdepthbuf_pars_vertex>
  2580. #include <clipping_planes_pars_vertex>
  2581. varying vec2 vHighPrecisionZW;
  2582. void main() {
  2583. #include <uv_vertex>
  2584. #include <batching_vertex>
  2585. #include <skinbase_vertex>
  2586. #include <morphinstance_vertex>
  2587. #ifdef USE_DISPLACEMENTMAP
  2588. #include <beginnormal_vertex>
  2589. #include <morphnormal_vertex>
  2590. #include <skinnormal_vertex>
  2591. #endif
  2592. #include <begin_vertex>
  2593. #include <morphtarget_vertex>
  2594. #include <skinning_vertex>
  2595. #include <displacementmap_vertex>
  2596. #include <project_vertex>
  2597. #include <logdepthbuf_vertex>
  2598. #include <clipping_planes_vertex>
  2599. vHighPrecisionZW = gl_Position.zw;
  2600. }`,sz=`#if DEPTH_PACKING == 3200
  2601. uniform float opacity;
  2602. #endif
  2603. #include <common>
  2604. #include <packing>
  2605. #include <uv_pars_fragment>
  2606. #include <map_pars_fragment>
  2607. #include <alphamap_pars_fragment>
  2608. #include <alphatest_pars_fragment>
  2609. #include <alphahash_pars_fragment>
  2610. #include <logdepthbuf_pars_fragment>
  2611. #include <clipping_planes_pars_fragment>
  2612. varying vec2 vHighPrecisionZW;
  2613. void main() {
  2614. vec4 diffuseColor = vec4( 1.0 );
  2615. #include <clipping_planes_fragment>
  2616. #if DEPTH_PACKING == 3200
  2617. diffuseColor.a = opacity;
  2618. #endif
  2619. #include <map_fragment>
  2620. #include <alphamap_fragment>
  2621. #include <alphatest_fragment>
  2622. #include <alphahash_fragment>
  2623. #include <logdepthbuf_fragment>
  2624. float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
  2625. #if DEPTH_PACKING == 3200
  2626. gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
  2627. #elif DEPTH_PACKING == 3201
  2628. gl_FragColor = packDepthToRGBA( fragCoordZ );
  2629. #elif DEPTH_PACKING == 3202
  2630. gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
  2631. #elif DEPTH_PACKING == 3203
  2632. gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
  2633. #endif
  2634. }`,oz=`#define DISTANCE
  2635. varying vec3 vWorldPosition;
  2636. #include <common>
  2637. #include <batching_pars_vertex>
  2638. #include <uv_pars_vertex>
  2639. #include <displacementmap_pars_vertex>
  2640. #include <morphtarget_pars_vertex>
  2641. #include <skinning_pars_vertex>
  2642. #include <clipping_planes_pars_vertex>
  2643. void main() {
  2644. #include <uv_vertex>
  2645. #include <batching_vertex>
  2646. #include <skinbase_vertex>
  2647. #include <morphinstance_vertex>
  2648. #ifdef USE_DISPLACEMENTMAP
  2649. #include <beginnormal_vertex>
  2650. #include <morphnormal_vertex>
  2651. #include <skinnormal_vertex>
  2652. #endif
  2653. #include <begin_vertex>
  2654. #include <morphtarget_vertex>
  2655. #include <skinning_vertex>
  2656. #include <displacementmap_vertex>
  2657. #include <project_vertex>
  2658. #include <worldpos_vertex>
  2659. #include <clipping_planes_vertex>
  2660. vWorldPosition = worldPosition.xyz;
  2661. }`,rz=`#define DISTANCE
  2662. uniform vec3 referencePosition;
  2663. uniform float nearDistance;
  2664. uniform float farDistance;
  2665. varying vec3 vWorldPosition;
  2666. #include <common>
  2667. #include <packing>
  2668. #include <uv_pars_fragment>
  2669. #include <map_pars_fragment>
  2670. #include <alphamap_pars_fragment>
  2671. #include <alphatest_pars_fragment>
  2672. #include <alphahash_pars_fragment>
  2673. #include <clipping_planes_pars_fragment>
  2674. void main () {
  2675. vec4 diffuseColor = vec4( 1.0 );
  2676. #include <clipping_planes_fragment>
  2677. #include <map_fragment>
  2678. #include <alphamap_fragment>
  2679. #include <alphatest_fragment>
  2680. #include <alphahash_fragment>
  2681. float dist = length( vWorldPosition - referencePosition );
  2682. dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
  2683. dist = saturate( dist );
  2684. gl_FragColor = packDepthToRGBA( dist );
  2685. }`,az=`varying vec3 vWorldDirection;
  2686. #include <common>
  2687. void main() {
  2688. vWorldDirection = transformDirection( position, modelMatrix );
  2689. #include <begin_vertex>
  2690. #include <project_vertex>
  2691. }`,lz=`uniform sampler2D tEquirect;
  2692. varying vec3 vWorldDirection;
  2693. #include <common>
  2694. void main() {
  2695. vec3 direction = normalize( vWorldDirection );
  2696. vec2 sampleUV = equirectUv( direction );
  2697. gl_FragColor = texture2D( tEquirect, sampleUV );
  2698. #include <tonemapping_fragment>
  2699. #include <colorspace_fragment>
  2700. }`,cz=`uniform float scale;
  2701. attribute float lineDistance;
  2702. varying float vLineDistance;
  2703. #include <common>
  2704. #include <uv_pars_vertex>
  2705. #include <color_pars_vertex>
  2706. #include <fog_pars_vertex>
  2707. #include <morphtarget_pars_vertex>
  2708. #include <logdepthbuf_pars_vertex>
  2709. #include <clipping_planes_pars_vertex>
  2710. void main() {
  2711. vLineDistance = scale * lineDistance;
  2712. #include <uv_vertex>
  2713. #include <color_vertex>
  2714. #include <morphinstance_vertex>
  2715. #include <morphcolor_vertex>
  2716. #include <begin_vertex>
  2717. #include <morphtarget_vertex>
  2718. #include <project_vertex>
  2719. #include <logdepthbuf_vertex>
  2720. #include <clipping_planes_vertex>
  2721. #include <fog_vertex>
  2722. }`,dz=`uniform vec3 diffuse;
  2723. uniform float opacity;
  2724. uniform float dashSize;
  2725. uniform float totalSize;
  2726. varying float vLineDistance;
  2727. #include <common>
  2728. #include <color_pars_fragment>
  2729. #include <uv_pars_fragment>
  2730. #include <map_pars_fragment>
  2731. #include <fog_pars_fragment>
  2732. #include <logdepthbuf_pars_fragment>
  2733. #include <clipping_planes_pars_fragment>
  2734. void main() {
  2735. vec4 diffuseColor = vec4( diffuse, opacity );
  2736. #include <clipping_planes_fragment>
  2737. if ( mod( vLineDistance, totalSize ) > dashSize ) {
  2738. discard;
  2739. }
  2740. vec3 outgoingLight = vec3( 0.0 );
  2741. #include <logdepthbuf_fragment>
  2742. #include <map_fragment>
  2743. #include <color_fragment>
  2744. outgoingLight = diffuseColor.rgb;
  2745. #include <opaque_fragment>
  2746. #include <tonemapping_fragment>
  2747. #include <colorspace_fragment>
  2748. #include <fog_fragment>
  2749. #include <premultiplied_alpha_fragment>
  2750. }`,uz=`#include <common>
  2751. #include <batching_pars_vertex>
  2752. #include <uv_pars_vertex>
  2753. #include <envmap_pars_vertex>
  2754. #include <color_pars_vertex>
  2755. #include <fog_pars_vertex>
  2756. #include <morphtarget_pars_vertex>
  2757. #include <skinning_pars_vertex>
  2758. #include <logdepthbuf_pars_vertex>
  2759. #include <clipping_planes_pars_vertex>
  2760. void main() {
  2761. #include <uv_vertex>
  2762. #include <color_vertex>
  2763. #include <morphinstance_vertex>
  2764. #include <morphcolor_vertex>
  2765. #include <batching_vertex>
  2766. #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
  2767. #include <beginnormal_vertex>
  2768. #include <morphnormal_vertex>
  2769. #include <skinbase_vertex>
  2770. #include <skinnormal_vertex>
  2771. #include <defaultnormal_vertex>
  2772. #endif
  2773. #include <begin_vertex>
  2774. #include <morphtarget_vertex>
  2775. #include <skinning_vertex>
  2776. #include <project_vertex>
  2777. #include <logdepthbuf_vertex>
  2778. #include <clipping_planes_vertex>
  2779. #include <worldpos_vertex>
  2780. #include <envmap_vertex>
  2781. #include <fog_vertex>
  2782. }`,hz=`uniform vec3 diffuse;
  2783. uniform float opacity;
  2784. #ifndef FLAT_SHADED
  2785. varying vec3 vNormal;
  2786. #endif
  2787. #include <common>
  2788. #include <dithering_pars_fragment>
  2789. #include <color_pars_fragment>
  2790. #include <uv_pars_fragment>
  2791. #include <map_pars_fragment>
  2792. #include <alphamap_pars_fragment>
  2793. #include <alphatest_pars_fragment>
  2794. #include <alphahash_pars_fragment>
  2795. #include <aomap_pars_fragment>
  2796. #include <lightmap_pars_fragment>
  2797. #include <envmap_common_pars_fragment>
  2798. #include <envmap_pars_fragment>
  2799. #include <fog_pars_fragment>
  2800. #include <specularmap_pars_fragment>
  2801. #include <logdepthbuf_pars_fragment>
  2802. #include <clipping_planes_pars_fragment>
  2803. void main() {
  2804. vec4 diffuseColor = vec4( diffuse, opacity );
  2805. #include <clipping_planes_fragment>
  2806. #include <logdepthbuf_fragment>
  2807. #include <map_fragment>
  2808. #include <color_fragment>
  2809. #include <alphamap_fragment>
  2810. #include <alphatest_fragment>
  2811. #include <alphahash_fragment>
  2812. #include <specularmap_fragment>
  2813. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  2814. #ifdef USE_LIGHTMAP
  2815. vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
  2816. reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
  2817. #else
  2818. reflectedLight.indirectDiffuse += vec3( 1.0 );
  2819. #endif
  2820. #include <aomap_fragment>
  2821. reflectedLight.indirectDiffuse *= diffuseColor.rgb;
  2822. vec3 outgoingLight = reflectedLight.indirectDiffuse;
  2823. #include <envmap_fragment>
  2824. #include <opaque_fragment>
  2825. #include <tonemapping_fragment>
  2826. #include <colorspace_fragment>
  2827. #include <fog_fragment>
  2828. #include <premultiplied_alpha_fragment>
  2829. #include <dithering_fragment>
  2830. }`,fz=`#define LAMBERT
  2831. varying vec3 vViewPosition;
  2832. #include <common>
  2833. #include <batching_pars_vertex>
  2834. #include <uv_pars_vertex>
  2835. #include <displacementmap_pars_vertex>
  2836. #include <envmap_pars_vertex>
  2837. #include <color_pars_vertex>
  2838. #include <fog_pars_vertex>
  2839. #include <normal_pars_vertex>
  2840. #include <morphtarget_pars_vertex>
  2841. #include <skinning_pars_vertex>
  2842. #include <shadowmap_pars_vertex>
  2843. #include <logdepthbuf_pars_vertex>
  2844. #include <clipping_planes_pars_vertex>
  2845. void main() {
  2846. #include <uv_vertex>
  2847. #include <color_vertex>
  2848. #include <morphinstance_vertex>
  2849. #include <morphcolor_vertex>
  2850. #include <batching_vertex>
  2851. #include <beginnormal_vertex>
  2852. #include <morphnormal_vertex>
  2853. #include <skinbase_vertex>
  2854. #include <skinnormal_vertex>
  2855. #include <defaultnormal_vertex>
  2856. #include <normal_vertex>
  2857. #include <begin_vertex>
  2858. #include <morphtarget_vertex>
  2859. #include <skinning_vertex>
  2860. #include <displacementmap_vertex>
  2861. #include <project_vertex>
  2862. #include <logdepthbuf_vertex>
  2863. #include <clipping_planes_vertex>
  2864. vViewPosition = - mvPosition.xyz;
  2865. #include <worldpos_vertex>
  2866. #include <envmap_vertex>
  2867. #include <shadowmap_vertex>
  2868. #include <fog_vertex>
  2869. }`,pz=`#define LAMBERT
  2870. uniform vec3 diffuse;
  2871. uniform vec3 emissive;
  2872. uniform float opacity;
  2873. #include <common>
  2874. #include <packing>
  2875. #include <dithering_pars_fragment>
  2876. #include <color_pars_fragment>
  2877. #include <uv_pars_fragment>
  2878. #include <map_pars_fragment>
  2879. #include <alphamap_pars_fragment>
  2880. #include <alphatest_pars_fragment>
  2881. #include <alphahash_pars_fragment>
  2882. #include <aomap_pars_fragment>
  2883. #include <lightmap_pars_fragment>
  2884. #include <emissivemap_pars_fragment>
  2885. #include <envmap_common_pars_fragment>
  2886. #include <envmap_pars_fragment>
  2887. #include <fog_pars_fragment>
  2888. #include <bsdfs>
  2889. #include <lights_pars_begin>
  2890. #include <normal_pars_fragment>
  2891. #include <lights_lambert_pars_fragment>
  2892. #include <shadowmap_pars_fragment>
  2893. #include <bumpmap_pars_fragment>
  2894. #include <normalmap_pars_fragment>
  2895. #include <specularmap_pars_fragment>
  2896. #include <logdepthbuf_pars_fragment>
  2897. #include <clipping_planes_pars_fragment>
  2898. void main() {
  2899. vec4 diffuseColor = vec4( diffuse, opacity );
  2900. #include <clipping_planes_fragment>
  2901. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  2902. vec3 totalEmissiveRadiance = emissive;
  2903. #include <logdepthbuf_fragment>
  2904. #include <map_fragment>
  2905. #include <color_fragment>
  2906. #include <alphamap_fragment>
  2907. #include <alphatest_fragment>
  2908. #include <alphahash_fragment>
  2909. #include <specularmap_fragment>
  2910. #include <normal_fragment_begin>
  2911. #include <normal_fragment_maps>
  2912. #include <emissivemap_fragment>
  2913. #include <lights_lambert_fragment>
  2914. #include <lights_fragment_begin>
  2915. #include <lights_fragment_maps>
  2916. #include <lights_fragment_end>
  2917. #include <aomap_fragment>
  2918. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
  2919. #include <envmap_fragment>
  2920. #include <opaque_fragment>
  2921. #include <tonemapping_fragment>
  2922. #include <colorspace_fragment>
  2923. #include <fog_fragment>
  2924. #include <premultiplied_alpha_fragment>
  2925. #include <dithering_fragment>
  2926. }`,mz=`#define MATCAP
  2927. varying vec3 vViewPosition;
  2928. #include <common>
  2929. #include <batching_pars_vertex>
  2930. #include <uv_pars_vertex>
  2931. #include <color_pars_vertex>
  2932. #include <displacementmap_pars_vertex>
  2933. #include <fog_pars_vertex>
  2934. #include <normal_pars_vertex>
  2935. #include <morphtarget_pars_vertex>
  2936. #include <skinning_pars_vertex>
  2937. #include <logdepthbuf_pars_vertex>
  2938. #include <clipping_planes_pars_vertex>
  2939. void main() {
  2940. #include <uv_vertex>
  2941. #include <color_vertex>
  2942. #include <morphinstance_vertex>
  2943. #include <morphcolor_vertex>
  2944. #include <batching_vertex>
  2945. #include <beginnormal_vertex>
  2946. #include <morphnormal_vertex>
  2947. #include <skinbase_vertex>
  2948. #include <skinnormal_vertex>
  2949. #include <defaultnormal_vertex>
  2950. #include <normal_vertex>
  2951. #include <begin_vertex>
  2952. #include <morphtarget_vertex>
  2953. #include <skinning_vertex>
  2954. #include <displacementmap_vertex>
  2955. #include <project_vertex>
  2956. #include <logdepthbuf_vertex>
  2957. #include <clipping_planes_vertex>
  2958. #include <fog_vertex>
  2959. vViewPosition = - mvPosition.xyz;
  2960. }`,_z=`#define MATCAP
  2961. uniform vec3 diffuse;
  2962. uniform float opacity;
  2963. uniform sampler2D matcap;
  2964. varying vec3 vViewPosition;
  2965. #include <common>
  2966. #include <dithering_pars_fragment>
  2967. #include <color_pars_fragment>
  2968. #include <uv_pars_fragment>
  2969. #include <map_pars_fragment>
  2970. #include <alphamap_pars_fragment>
  2971. #include <alphatest_pars_fragment>
  2972. #include <alphahash_pars_fragment>
  2973. #include <fog_pars_fragment>
  2974. #include <normal_pars_fragment>
  2975. #include <bumpmap_pars_fragment>
  2976. #include <normalmap_pars_fragment>
  2977. #include <logdepthbuf_pars_fragment>
  2978. #include <clipping_planes_pars_fragment>
  2979. void main() {
  2980. vec4 diffuseColor = vec4( diffuse, opacity );
  2981. #include <clipping_planes_fragment>
  2982. #include <logdepthbuf_fragment>
  2983. #include <map_fragment>
  2984. #include <color_fragment>
  2985. #include <alphamap_fragment>
  2986. #include <alphatest_fragment>
  2987. #include <alphahash_fragment>
  2988. #include <normal_fragment_begin>
  2989. #include <normal_fragment_maps>
  2990. vec3 viewDir = normalize( vViewPosition );
  2991. vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
  2992. vec3 y = cross( viewDir, x );
  2993. vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
  2994. #ifdef USE_MATCAP
  2995. vec4 matcapColor = texture2D( matcap, uv );
  2996. #else
  2997. vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
  2998. #endif
  2999. vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
  3000. #include <opaque_fragment>
  3001. #include <tonemapping_fragment>
  3002. #include <colorspace_fragment>
  3003. #include <fog_fragment>
  3004. #include <premultiplied_alpha_fragment>
  3005. #include <dithering_fragment>
  3006. }`,gz=`#define NORMAL
  3007. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  3008. varying vec3 vViewPosition;
  3009. #endif
  3010. #include <common>
  3011. #include <batching_pars_vertex>
  3012. #include <uv_pars_vertex>
  3013. #include <displacementmap_pars_vertex>
  3014. #include <normal_pars_vertex>
  3015. #include <morphtarget_pars_vertex>
  3016. #include <skinning_pars_vertex>
  3017. #include <logdepthbuf_pars_vertex>
  3018. #include <clipping_planes_pars_vertex>
  3019. void main() {
  3020. #include <uv_vertex>
  3021. #include <batching_vertex>
  3022. #include <beginnormal_vertex>
  3023. #include <morphinstance_vertex>
  3024. #include <morphnormal_vertex>
  3025. #include <skinbase_vertex>
  3026. #include <skinnormal_vertex>
  3027. #include <defaultnormal_vertex>
  3028. #include <normal_vertex>
  3029. #include <begin_vertex>
  3030. #include <morphtarget_vertex>
  3031. #include <skinning_vertex>
  3032. #include <displacementmap_vertex>
  3033. #include <project_vertex>
  3034. #include <logdepthbuf_vertex>
  3035. #include <clipping_planes_vertex>
  3036. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  3037. vViewPosition = - mvPosition.xyz;
  3038. #endif
  3039. }`,vz=`#define NORMAL
  3040. uniform float opacity;
  3041. #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
  3042. varying vec3 vViewPosition;
  3043. #endif
  3044. #include <packing>
  3045. #include <uv_pars_fragment>
  3046. #include <normal_pars_fragment>
  3047. #include <bumpmap_pars_fragment>
  3048. #include <normalmap_pars_fragment>
  3049. #include <logdepthbuf_pars_fragment>
  3050. #include <clipping_planes_pars_fragment>
  3051. void main() {
  3052. vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
  3053. #include <clipping_planes_fragment>
  3054. #include <logdepthbuf_fragment>
  3055. #include <normal_fragment_begin>
  3056. #include <normal_fragment_maps>
  3057. gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
  3058. #ifdef OPAQUE
  3059. gl_FragColor.a = 1.0;
  3060. #endif
  3061. }`,bz=`#define PHONG
  3062. varying vec3 vViewPosition;
  3063. #include <common>
  3064. #include <batching_pars_vertex>
  3065. #include <uv_pars_vertex>
  3066. #include <displacementmap_pars_vertex>
  3067. #include <envmap_pars_vertex>
  3068. #include <color_pars_vertex>
  3069. #include <fog_pars_vertex>
  3070. #include <normal_pars_vertex>
  3071. #include <morphtarget_pars_vertex>
  3072. #include <skinning_pars_vertex>
  3073. #include <shadowmap_pars_vertex>
  3074. #include <logdepthbuf_pars_vertex>
  3075. #include <clipping_planes_pars_vertex>
  3076. void main() {
  3077. #include <uv_vertex>
  3078. #include <color_vertex>
  3079. #include <morphcolor_vertex>
  3080. #include <batching_vertex>
  3081. #include <beginnormal_vertex>
  3082. #include <morphinstance_vertex>
  3083. #include <morphnormal_vertex>
  3084. #include <skinbase_vertex>
  3085. #include <skinnormal_vertex>
  3086. #include <defaultnormal_vertex>
  3087. #include <normal_vertex>
  3088. #include <begin_vertex>
  3089. #include <morphtarget_vertex>
  3090. #include <skinning_vertex>
  3091. #include <displacementmap_vertex>
  3092. #include <project_vertex>
  3093. #include <logdepthbuf_vertex>
  3094. #include <clipping_planes_vertex>
  3095. vViewPosition = - mvPosition.xyz;
  3096. #include <worldpos_vertex>
  3097. #include <envmap_vertex>
  3098. #include <shadowmap_vertex>
  3099. #include <fog_vertex>
  3100. }`,yz=`#define PHONG
  3101. uniform vec3 diffuse;
  3102. uniform vec3 emissive;
  3103. uniform vec3 specular;
  3104. uniform float shininess;
  3105. uniform float opacity;
  3106. #include <common>
  3107. #include <packing>
  3108. #include <dithering_pars_fragment>
  3109. #include <color_pars_fragment>
  3110. #include <uv_pars_fragment>
  3111. #include <map_pars_fragment>
  3112. #include <alphamap_pars_fragment>
  3113. #include <alphatest_pars_fragment>
  3114. #include <alphahash_pars_fragment>
  3115. #include <aomap_pars_fragment>
  3116. #include <lightmap_pars_fragment>
  3117. #include <emissivemap_pars_fragment>
  3118. #include <envmap_common_pars_fragment>
  3119. #include <envmap_pars_fragment>
  3120. #include <fog_pars_fragment>
  3121. #include <bsdfs>
  3122. #include <lights_pars_begin>
  3123. #include <normal_pars_fragment>
  3124. #include <lights_phong_pars_fragment>
  3125. #include <shadowmap_pars_fragment>
  3126. #include <bumpmap_pars_fragment>
  3127. #include <normalmap_pars_fragment>
  3128. #include <specularmap_pars_fragment>
  3129. #include <logdepthbuf_pars_fragment>
  3130. #include <clipping_planes_pars_fragment>
  3131. void main() {
  3132. vec4 diffuseColor = vec4( diffuse, opacity );
  3133. #include <clipping_planes_fragment>
  3134. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  3135. vec3 totalEmissiveRadiance = emissive;
  3136. #include <logdepthbuf_fragment>
  3137. #include <map_fragment>
  3138. #include <color_fragment>
  3139. #include <alphamap_fragment>
  3140. #include <alphatest_fragment>
  3141. #include <alphahash_fragment>
  3142. #include <specularmap_fragment>
  3143. #include <normal_fragment_begin>
  3144. #include <normal_fragment_maps>
  3145. #include <emissivemap_fragment>
  3146. #include <lights_phong_fragment>
  3147. #include <lights_fragment_begin>
  3148. #include <lights_fragment_maps>
  3149. #include <lights_fragment_end>
  3150. #include <aomap_fragment>
  3151. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
  3152. #include <envmap_fragment>
  3153. #include <opaque_fragment>
  3154. #include <tonemapping_fragment>
  3155. #include <colorspace_fragment>
  3156. #include <fog_fragment>
  3157. #include <premultiplied_alpha_fragment>
  3158. #include <dithering_fragment>
  3159. }`,xz=`#define STANDARD
  3160. varying vec3 vViewPosition;
  3161. #ifdef USE_TRANSMISSION
  3162. varying vec3 vWorldPosition;
  3163. #endif
  3164. #include <common>
  3165. #include <batching_pars_vertex>
  3166. #include <uv_pars_vertex>
  3167. #include <displacementmap_pars_vertex>
  3168. #include <color_pars_vertex>
  3169. #include <fog_pars_vertex>
  3170. #include <normal_pars_vertex>
  3171. #include <morphtarget_pars_vertex>
  3172. #include <skinning_pars_vertex>
  3173. #include <shadowmap_pars_vertex>
  3174. #include <logdepthbuf_pars_vertex>
  3175. #include <clipping_planes_pars_vertex>
  3176. void main() {
  3177. #include <uv_vertex>
  3178. #include <color_vertex>
  3179. #include <morphinstance_vertex>
  3180. #include <morphcolor_vertex>
  3181. #include <batching_vertex>
  3182. #include <beginnormal_vertex>
  3183. #include <morphnormal_vertex>
  3184. #include <skinbase_vertex>
  3185. #include <skinnormal_vertex>
  3186. #include <defaultnormal_vertex>
  3187. #include <normal_vertex>
  3188. #include <begin_vertex>
  3189. #include <morphtarget_vertex>
  3190. #include <skinning_vertex>
  3191. #include <displacementmap_vertex>
  3192. #include <project_vertex>
  3193. #include <logdepthbuf_vertex>
  3194. #include <clipping_planes_vertex>
  3195. vViewPosition = - mvPosition.xyz;
  3196. #include <worldpos_vertex>
  3197. #include <shadowmap_vertex>
  3198. #include <fog_vertex>
  3199. #ifdef USE_TRANSMISSION
  3200. vWorldPosition = worldPosition.xyz;
  3201. #endif
  3202. }`,Sz=`#define STANDARD
  3203. #ifdef PHYSICAL
  3204. #define IOR
  3205. #define USE_SPECULAR
  3206. #endif
  3207. uniform vec3 diffuse;
  3208. uniform vec3 emissive;
  3209. uniform float roughness;
  3210. uniform float metalness;
  3211. uniform float opacity;
  3212. #ifdef IOR
  3213. uniform float ior;
  3214. #endif
  3215. #ifdef USE_SPECULAR
  3216. uniform float specularIntensity;
  3217. uniform vec3 specularColor;
  3218. #ifdef USE_SPECULAR_COLORMAP
  3219. uniform sampler2D specularColorMap;
  3220. #endif
  3221. #ifdef USE_SPECULAR_INTENSITYMAP
  3222. uniform sampler2D specularIntensityMap;
  3223. #endif
  3224. #endif
  3225. #ifdef USE_CLEARCOAT
  3226. uniform float clearcoat;
  3227. uniform float clearcoatRoughness;
  3228. #endif
  3229. #ifdef USE_DISPERSION
  3230. uniform float dispersion;
  3231. #endif
  3232. #ifdef USE_IRIDESCENCE
  3233. uniform float iridescence;
  3234. uniform float iridescenceIOR;
  3235. uniform float iridescenceThicknessMinimum;
  3236. uniform float iridescenceThicknessMaximum;
  3237. #endif
  3238. #ifdef USE_SHEEN
  3239. uniform vec3 sheenColor;
  3240. uniform float sheenRoughness;
  3241. #ifdef USE_SHEEN_COLORMAP
  3242. uniform sampler2D sheenColorMap;
  3243. #endif
  3244. #ifdef USE_SHEEN_ROUGHNESSMAP
  3245. uniform sampler2D sheenRoughnessMap;
  3246. #endif
  3247. #endif
  3248. #ifdef USE_ANISOTROPY
  3249. uniform vec2 anisotropyVector;
  3250. #ifdef USE_ANISOTROPYMAP
  3251. uniform sampler2D anisotropyMap;
  3252. #endif
  3253. #endif
  3254. varying vec3 vViewPosition;
  3255. #include <common>
  3256. #include <packing>
  3257. #include <dithering_pars_fragment>
  3258. #include <color_pars_fragment>
  3259. #include <uv_pars_fragment>
  3260. #include <map_pars_fragment>
  3261. #include <alphamap_pars_fragment>
  3262. #include <alphatest_pars_fragment>
  3263. #include <alphahash_pars_fragment>
  3264. #include <aomap_pars_fragment>
  3265. #include <lightmap_pars_fragment>
  3266. #include <emissivemap_pars_fragment>
  3267. #include <iridescence_fragment>
  3268. #include <cube_uv_reflection_fragment>
  3269. #include <envmap_common_pars_fragment>
  3270. #include <envmap_physical_pars_fragment>
  3271. #include <fog_pars_fragment>
  3272. #include <lights_pars_begin>
  3273. #include <normal_pars_fragment>
  3274. #include <lights_physical_pars_fragment>
  3275. #include <transmission_pars_fragment>
  3276. #include <shadowmap_pars_fragment>
  3277. #include <bumpmap_pars_fragment>
  3278. #include <normalmap_pars_fragment>
  3279. #include <clearcoat_pars_fragment>
  3280. #include <iridescence_pars_fragment>
  3281. #include <roughnessmap_pars_fragment>
  3282. #include <metalnessmap_pars_fragment>
  3283. #include <logdepthbuf_pars_fragment>
  3284. #include <clipping_planes_pars_fragment>
  3285. void main() {
  3286. vec4 diffuseColor = vec4( diffuse, opacity );
  3287. #include <clipping_planes_fragment>
  3288. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  3289. vec3 totalEmissiveRadiance = emissive;
  3290. #include <logdepthbuf_fragment>
  3291. #include <map_fragment>
  3292. #include <color_fragment>
  3293. #include <alphamap_fragment>
  3294. #include <alphatest_fragment>
  3295. #include <alphahash_fragment>
  3296. #include <roughnessmap_fragment>
  3297. #include <metalnessmap_fragment>
  3298. #include <normal_fragment_begin>
  3299. #include <normal_fragment_maps>
  3300. #include <clearcoat_normal_fragment_begin>
  3301. #include <clearcoat_normal_fragment_maps>
  3302. #include <emissivemap_fragment>
  3303. #include <lights_physical_fragment>
  3304. #include <lights_fragment_begin>
  3305. #include <lights_fragment_maps>
  3306. #include <lights_fragment_end>
  3307. #include <aomap_fragment>
  3308. vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
  3309. vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
  3310. #include <transmission_fragment>
  3311. vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
  3312. #ifdef USE_SHEEN
  3313. float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
  3314. outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
  3315. #endif
  3316. #ifdef USE_CLEARCOAT
  3317. float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
  3318. vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
  3319. outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
  3320. #endif
  3321. #include <opaque_fragment>
  3322. #include <tonemapping_fragment>
  3323. #include <colorspace_fragment>
  3324. #include <fog_fragment>
  3325. #include <premultiplied_alpha_fragment>
  3326. #include <dithering_fragment>
  3327. }`,Mz=`#define TOON
  3328. varying vec3 vViewPosition;
  3329. #include <common>
  3330. #include <batching_pars_vertex>
  3331. #include <uv_pars_vertex>
  3332. #include <displacementmap_pars_vertex>
  3333. #include <color_pars_vertex>
  3334. #include <fog_pars_vertex>
  3335. #include <normal_pars_vertex>
  3336. #include <morphtarget_pars_vertex>
  3337. #include <skinning_pars_vertex>
  3338. #include <shadowmap_pars_vertex>
  3339. #include <logdepthbuf_pars_vertex>
  3340. #include <clipping_planes_pars_vertex>
  3341. void main() {
  3342. #include <uv_vertex>
  3343. #include <color_vertex>
  3344. #include <morphinstance_vertex>
  3345. #include <morphcolor_vertex>
  3346. #include <batching_vertex>
  3347. #include <beginnormal_vertex>
  3348. #include <morphnormal_vertex>
  3349. #include <skinbase_vertex>
  3350. #include <skinnormal_vertex>
  3351. #include <defaultnormal_vertex>
  3352. #include <normal_vertex>
  3353. #include <begin_vertex>
  3354. #include <morphtarget_vertex>
  3355. #include <skinning_vertex>
  3356. #include <displacementmap_vertex>
  3357. #include <project_vertex>
  3358. #include <logdepthbuf_vertex>
  3359. #include <clipping_planes_vertex>
  3360. vViewPosition = - mvPosition.xyz;
  3361. #include <worldpos_vertex>
  3362. #include <shadowmap_vertex>
  3363. #include <fog_vertex>
  3364. }`,Ez=`#define TOON
  3365. uniform vec3 diffuse;
  3366. uniform vec3 emissive;
  3367. uniform float opacity;
  3368. #include <common>
  3369. #include <packing>
  3370. #include <dithering_pars_fragment>
  3371. #include <color_pars_fragment>
  3372. #include <uv_pars_fragment>
  3373. #include <map_pars_fragment>
  3374. #include <alphamap_pars_fragment>
  3375. #include <alphatest_pars_fragment>
  3376. #include <alphahash_pars_fragment>
  3377. #include <aomap_pars_fragment>
  3378. #include <lightmap_pars_fragment>
  3379. #include <emissivemap_pars_fragment>
  3380. #include <gradientmap_pars_fragment>
  3381. #include <fog_pars_fragment>
  3382. #include <bsdfs>
  3383. #include <lights_pars_begin>
  3384. #include <normal_pars_fragment>
  3385. #include <lights_toon_pars_fragment>
  3386. #include <shadowmap_pars_fragment>
  3387. #include <bumpmap_pars_fragment>
  3388. #include <normalmap_pars_fragment>
  3389. #include <logdepthbuf_pars_fragment>
  3390. #include <clipping_planes_pars_fragment>
  3391. void main() {
  3392. vec4 diffuseColor = vec4( diffuse, opacity );
  3393. #include <clipping_planes_fragment>
  3394. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  3395. vec3 totalEmissiveRadiance = emissive;
  3396. #include <logdepthbuf_fragment>
  3397. #include <map_fragment>
  3398. #include <color_fragment>
  3399. #include <alphamap_fragment>
  3400. #include <alphatest_fragment>
  3401. #include <alphahash_fragment>
  3402. #include <normal_fragment_begin>
  3403. #include <normal_fragment_maps>
  3404. #include <emissivemap_fragment>
  3405. #include <lights_toon_fragment>
  3406. #include <lights_fragment_begin>
  3407. #include <lights_fragment_maps>
  3408. #include <lights_fragment_end>
  3409. #include <aomap_fragment>
  3410. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
  3411. #include <opaque_fragment>
  3412. #include <tonemapping_fragment>
  3413. #include <colorspace_fragment>
  3414. #include <fog_fragment>
  3415. #include <premultiplied_alpha_fragment>
  3416. #include <dithering_fragment>
  3417. }`,wz=`uniform float size;
  3418. uniform float scale;
  3419. #include <common>
  3420. #include <color_pars_vertex>
  3421. #include <fog_pars_vertex>
  3422. #include <morphtarget_pars_vertex>
  3423. #include <logdepthbuf_pars_vertex>
  3424. #include <clipping_planes_pars_vertex>
  3425. #ifdef USE_POINTS_UV
  3426. varying vec2 vUv;
  3427. uniform mat3 uvTransform;
  3428. #endif
  3429. void main() {
  3430. #ifdef USE_POINTS_UV
  3431. vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
  3432. #endif
  3433. #include <color_vertex>
  3434. #include <morphinstance_vertex>
  3435. #include <morphcolor_vertex>
  3436. #include <begin_vertex>
  3437. #include <morphtarget_vertex>
  3438. #include <project_vertex>
  3439. gl_PointSize = size;
  3440. #ifdef USE_SIZEATTENUATION
  3441. bool isPerspective = isPerspectiveMatrix( projectionMatrix );
  3442. if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
  3443. #endif
  3444. #include <logdepthbuf_vertex>
  3445. #include <clipping_planes_vertex>
  3446. #include <worldpos_vertex>
  3447. #include <fog_vertex>
  3448. }`,Tz=`uniform vec3 diffuse;
  3449. uniform float opacity;
  3450. #include <common>
  3451. #include <color_pars_fragment>
  3452. #include <map_particle_pars_fragment>
  3453. #include <alphatest_pars_fragment>
  3454. #include <alphahash_pars_fragment>
  3455. #include <fog_pars_fragment>
  3456. #include <logdepthbuf_pars_fragment>
  3457. #include <clipping_planes_pars_fragment>
  3458. void main() {
  3459. vec4 diffuseColor = vec4( diffuse, opacity );
  3460. #include <clipping_planes_fragment>
  3461. vec3 outgoingLight = vec3( 0.0 );
  3462. #include <logdepthbuf_fragment>
  3463. #include <map_particle_fragment>
  3464. #include <color_fragment>
  3465. #include <alphatest_fragment>
  3466. #include <alphahash_fragment>
  3467. outgoingLight = diffuseColor.rgb;
  3468. #include <opaque_fragment>
  3469. #include <tonemapping_fragment>
  3470. #include <colorspace_fragment>
  3471. #include <fog_fragment>
  3472. #include <premultiplied_alpha_fragment>
  3473. }`,Cz=`#include <common>
  3474. #include <batching_pars_vertex>
  3475. #include <fog_pars_vertex>
  3476. #include <morphtarget_pars_vertex>
  3477. #include <skinning_pars_vertex>
  3478. #include <logdepthbuf_pars_vertex>
  3479. #include <shadowmap_pars_vertex>
  3480. void main() {
  3481. #include <batching_vertex>
  3482. #include <beginnormal_vertex>
  3483. #include <morphinstance_vertex>
  3484. #include <morphnormal_vertex>
  3485. #include <skinbase_vertex>
  3486. #include <skinnormal_vertex>
  3487. #include <defaultnormal_vertex>
  3488. #include <begin_vertex>
  3489. #include <morphtarget_vertex>
  3490. #include <skinning_vertex>
  3491. #include <project_vertex>
  3492. #include <logdepthbuf_vertex>
  3493. #include <worldpos_vertex>
  3494. #include <shadowmap_vertex>
  3495. #include <fog_vertex>
  3496. }`,Az=`uniform vec3 color;
  3497. uniform float opacity;
  3498. #include <common>
  3499. #include <packing>
  3500. #include <fog_pars_fragment>
  3501. #include <bsdfs>
  3502. #include <lights_pars_begin>
  3503. #include <logdepthbuf_pars_fragment>
  3504. #include <shadowmap_pars_fragment>
  3505. #include <shadowmask_pars_fragment>
  3506. void main() {
  3507. #include <logdepthbuf_fragment>
  3508. gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
  3509. #include <tonemapping_fragment>
  3510. #include <colorspace_fragment>
  3511. #include <fog_fragment>
  3512. }`,Pz=`uniform float rotation;
  3513. uniform vec2 center;
  3514. #include <common>
  3515. #include <uv_pars_vertex>
  3516. #include <fog_pars_vertex>
  3517. #include <logdepthbuf_pars_vertex>
  3518. #include <clipping_planes_pars_vertex>
  3519. void main() {
  3520. #include <uv_vertex>
  3521. vec4 mvPosition = modelViewMatrix[ 3 ];
  3522. vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
  3523. #ifndef USE_SIZEATTENUATION
  3524. bool isPerspective = isPerspectiveMatrix( projectionMatrix );
  3525. if ( isPerspective ) scale *= - mvPosition.z;
  3526. #endif
  3527. vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
  3528. vec2 rotatedPosition;
  3529. rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
  3530. rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
  3531. mvPosition.xy += rotatedPosition;
  3532. gl_Position = projectionMatrix * mvPosition;
  3533. #include <logdepthbuf_vertex>
  3534. #include <clipping_planes_vertex>
  3535. #include <fog_vertex>
  3536. }`,Rz=`uniform vec3 diffuse;
  3537. uniform float opacity;
  3538. #include <common>
  3539. #include <uv_pars_fragment>
  3540. #include <map_pars_fragment>
  3541. #include <alphamap_pars_fragment>
  3542. #include <alphatest_pars_fragment>
  3543. #include <alphahash_pars_fragment>
  3544. #include <fog_pars_fragment>
  3545. #include <logdepthbuf_pars_fragment>
  3546. #include <clipping_planes_pars_fragment>
  3547. void main() {
  3548. vec4 diffuseColor = vec4( diffuse, opacity );
  3549. #include <clipping_planes_fragment>
  3550. vec3 outgoingLight = vec3( 0.0 );
  3551. #include <logdepthbuf_fragment>
  3552. #include <map_fragment>
  3553. #include <alphamap_fragment>
  3554. #include <alphatest_fragment>
  3555. #include <alphahash_fragment>
  3556. outgoingLight = diffuseColor.rgb;
  3557. #include <opaque_fragment>
  3558. #include <tonemapping_fragment>
  3559. #include <colorspace_fragment>
  3560. #include <fog_fragment>
  3561. }`,it={alphahash_fragment:JU,alphahash_pars_fragment:QU,alphamap_fragment:eO,alphamap_pars_fragment:tO,alphatest_fragment:nO,alphatest_pars_fragment:iO,aomap_fragment:sO,aomap_pars_fragment:oO,batching_pars_vertex:rO,batching_vertex:aO,begin_vertex:lO,beginnormal_vertex:cO,bsdfs:dO,iridescence_fragment:uO,bumpmap_pars_fragment:hO,clipping_planes_fragment:fO,clipping_planes_pars_fragment:pO,clipping_planes_pars_vertex:mO,clipping_planes_vertex:_O,color_fragment:gO,color_pars_fragment:vO,color_pars_vertex:bO,color_vertex:yO,common:xO,cube_uv_reflection_fragment:SO,defaultnormal_vertex:MO,displacementmap_pars_vertex:EO,displacementmap_vertex:wO,emissivemap_fragment:TO,emissivemap_pars_fragment:CO,colorspace_fragment:AO,colorspace_pars_fragment:PO,envmap_fragment:RO,envmap_common_pars_fragment:DO,envmap_pars_fragment:IO,envmap_pars_vertex:FO,envmap_physical_pars_fragment:GO,envmap_vertex:LO,fog_vertex:UO,fog_pars_vertex:OO,fog_fragment:NO,fog_pars_fragment:zO,gradientmap_pars_fragment:kO,lightmap_pars_fragment:BO,lights_lambert_fragment:VO,lights_lambert_pars_fragment:$O,lights_pars_begin:HO,lights_toon_fragment:WO,lights_toon_pars_fragment:XO,lights_phong_fragment:jO,lights_phong_pars_fragment:YO,lights_physical_fragment:qO,lights_physical_pars_fragment:ZO,lights_fragment_begin:KO,lights_fragment_maps:JO,lights_fragment_end:QO,logdepthbuf_fragment:eN,logdepthbuf_pars_fragment:tN,logdepthbuf_pars_vertex:nN,logdepthbuf_vertex:iN,map_fragment:sN,map_pars_fragment:oN,map_particle_fragment:rN,map_particle_pars_fragment:aN,metalnessmap_fragment:lN,metalnessmap_pars_fragment:cN,morphinstance_vertex:dN,morphcolor_vertex:uN,morphnormal_vertex:hN,morphtarget_pars_vertex:fN,morphtarget_vertex:pN,normal_fragment_begin:mN,normal_fragment_maps:_N,normal_pars_fragment:gN,normal_pars_vertex:vN,normal_vertex:bN,normalmap_pars_fragment:yN,clearcoat_normal_fragment_begin:xN,clearcoat_normal_fragment_maps:SN,clearcoat_pars_fragment:MN,iridescence_pars_fragment:EN,opaque_fragment:wN,packing:TN,premultiplied_alpha_fragment:CN,project_vertex:AN,dithering_fragment:PN,dithering_pars_fragment:RN,roughnessmap_fragment:DN,roughnessmap_pars_fragment:IN,shadowmap_pars_fragment:FN,shadowmap_pars_vertex:LN,shadowmap_vertex:UN,shadowmask_pars_fragment:ON,skinbase_vertex:NN,skinning_pars_vertex:zN,skinning_vertex:kN,skinnormal_vertex:BN,specularmap_fragment:VN,specularmap_pars_fragment:$N,tonemapping_fragment:HN,tonemapping_pars_fragment:GN,transmission_fragment:WN,transmission_pars_fragment:XN,uv_pars_fragment:jN,uv_pars_vertex:YN,uv_vertex:qN,worldpos_vertex:ZN,background_vert:KN,background_frag:JN,backgroundCube_vert:QN,backgroundCube_frag:ez,cube_vert:tz,cube_frag:nz,depth_vert:iz,depth_frag:sz,distanceRGBA_vert:oz,distanceRGBA_frag:rz,equirect_vert:az,equirect_frag:lz,linedashed_vert:cz,linedashed_frag:dz,meshbasic_vert:uz,meshbasic_frag:hz,meshlambert_vert:fz,meshlambert_frag:pz,meshmatcap_vert:mz,meshmatcap_frag:_z,meshnormal_vert:gz,meshnormal_frag:vz,meshphong_vert:bz,meshphong_frag:yz,meshphysical_vert:xz,meshphysical_frag:Sz,meshtoon_vert:Mz,meshtoon_frag:Ez,points_vert:wz,points_frag:Tz,shadow_vert:Cz,shadow_frag:Az,sprite_vert:Pz,sprite_frag:Rz},xe={common:{diffuse:{value:new lt(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 lt(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 lt(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 lt(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}}},Yn={basic:{uniforms:an([xe.common,xe.specularmap,xe.envmap,xe.aomap,xe.lightmap,xe.fog]),vertexShader:it.meshbasic_vert,fragmentShader:it.meshbasic_frag},lambert:{uniforms:an([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 lt(0)}}]),vertexShader:it.meshlambert_vert,fragmentShader:it.meshlambert_frag},phong:{uniforms:an([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 lt(0)},specular:{value:new lt(1118481)},shininess:{value:30}}]),vertexShader:it.meshphong_vert,fragmentShader:it.meshphong_frag},standard:{uniforms:an([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 lt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:it.meshphysical_vert,fragmentShader:it.meshphysical_frag},toon:{uniforms:an([xe.common,xe.aomap,xe.lightmap,xe.emissivemap,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.gradientmap,xe.fog,xe.lights,{emissive:{value:new lt(0)}}]),vertexShader:it.meshtoon_vert,fragmentShader:it.meshtoon_frag},matcap:{uniforms:an([xe.common,xe.bumpmap,xe.normalmap,xe.displacementmap,xe.fog,{matcap:{value:null}}]),vertexShader:it.meshmatcap_vert,fragmentShader:it.meshmatcap_frag},points:{uniforms:an([xe.points,xe.fog]),vertexShader:it.points_vert,fragmentShader:it.points_frag},dashed:{uniforms:an([xe.common,xe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:it.linedashed_vert,fragmentShader:it.linedashed_frag},depth:{uniforms:an([xe.common,xe.displacementmap]),vertexShader:it.depth_vert,fragmentShader:it.depth_frag},normal:{uniforms:an([xe.common,xe.bumpmap,xe.normalmap,xe.displacementmap,{opacity:{value:1}}]),vertexShader:it.meshnormal_vert,fragmentShader:it.meshnormal_frag},sprite:{uniforms:an([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:an([xe.common,xe.displacementmap,{referencePosition:{value:new L},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:it.distanceRGBA_vert,fragmentShader:it.distanceRGBA_frag},shadow:{uniforms:an([xe.lights,xe.fog,{color:{value:new lt(0)},opacity:{value:1}}]),vertexShader:it.shadow_vert,fragmentShader:it.shadow_frag}};Yn.physical={uniforms:an([Yn.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 lt(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 lt(0)},specularColor:{value:new lt(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 Hr={r:0,b:0,g:0},ts=new $n,Dz=new Tt;function Iz(t,e,n,i,s,o,r){const a=new lt(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===za)?(u===void 0&&(u=new Pe(new Ot(1,1,1),new Hi({name:"BackgroundCubeMaterial",uniforms:ho(Yn.backgroundCube.uniforms),vertexShader:Yn.backgroundCube.vertexShader,fragmentShader:Yn.backgroundCube.fragmentShader,side:hn,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)),ts.copy(S.backgroundRotation),ts.x*=-1,ts.y*=-1,ts.z*=-1,I.isCubeTexture&&I.isRenderTargetTexture===!1&&(ts.y*=-1,ts.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(Dz.makeRotationFromEuler(ts)),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 Pe(new xo(2,2),new Hi({name:"BackgroundMaterial",uniforms:ho(Yn.background.uniforms),vertexShader:Yn.background.vertexShader,fragmentShader:Yn.background.fragmentShader,side:$i,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(Hr,Lp(t)),i.buffers.color.setClear(Hr.r,Hr.g,Hr.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 Fz(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},s=h(null);let o=s,r=!1;function a(g,F,O,$,j){let re=!1;const q=f($,O,F);o!==q&&(o=q,d(o.object)),re=m(g,$,O,j),re&&b(g,$,O,j),j!==null&&e.update(j,t.ELEMENT_ARRAY_BUFFER),(re||r)&&(r=!1,S(g,F,O,$),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,F,O){const $=O.wireframe===!0;let j=i[g.id];j===void 0&&(j={},i[g.id]=j);let re=j[F.id];re===void 0&&(re={},j[F.id]=re);let q=re[$];return q===void 0&&(q=h(l()),re[$]=q),q}function h(g){const F=[],O=[],$=[];for(let j=0;j<n;j++)F[j]=0,O[j]=0,$[j]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:F,enabledAttributes:O,attributeDivisors:$,object:g,attributes:{},index:null}}function m(g,F,O,$){const j=o.attributes,re=F.attributes;let q=0;const ae=O.getAttributes();for(const G in ae)if(ae[G].location>=0){const ye=j[G];let De=re[G];if(De===void 0&&(G==="instanceMatrix"&&g.instanceMatrix&&(De=g.instanceMatrix),G==="instanceColor"&&g.instanceColor&&(De=g.instanceColor)),ye===void 0||ye.attribute!==De||De&&ye.data!==De.data)return!0;q++}return o.attributesNum!==q||o.index!==$}function b(g,F,O,$){const j={},re=F.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 De={};De.attribute=ye,ye&&ye.data&&(De.data=ye.data),j[G]=De,q++}o.attributes=j,o.attributesNum=q,o.index=$}function y(){const g=o.newAttributes;for(let F=0,O=g.length;F<O;F++)g[F]=0}function _(g){p(g,0)}function p(g,F){const O=o.newAttributes,$=o.enabledAttributes,j=o.attributeDivisors;O[g]=1,$[g]===0&&(t.enableVertexAttribArray(g),$[g]=1),j[g]!==F&&(t.vertexAttribDivisor(g,F),j[g]=F)}function T(){const g=o.newAttributes,F=o.enabledAttributes;for(let O=0,$=F.length;O<$;O++)F[O]!==g[O]&&(t.disableVertexAttribArray(O),F[O]=0)}function w(g,F,O,$,j,re,q){q===!0?t.vertexAttribIPointer(g,F,O,j,re):t.vertexAttribPointer(g,F,O,$,j,re)}function S(g,F,O,$){y();const j=$.attributes,re=O.getAttributes(),q=F.defaultAttributeValues;for(const ae in re){const G=re[ae];if(G.location>=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,De=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===cd;if(fe.isInterleavedBufferAttribute){const Y=fe.data,ue=Y.stride,Oe=fe.offset;if(Y.isInstancedInterleavedBuffer){for(let Se=0;Se<G.locationSize;Se++)p(G.location+Se,Y.meshPerAttribute);g.isInstancedMesh!==!0&&$._maxInstanceCount===void 0&&($._maxInstanceCount=Y.meshPerAttribute*Y.count)}else for(let Se=0;Se<G.locationSize;Se++)_(G.location+Se);t.bindBuffer(t.ARRAY_BUFFER,Je);for(let Se=0;Se<G.locationSize;Se++)w(G.location+Se,De/G.locationSize,ce,ye,ue*N,(Oe+De/G.locationSize*Se)*N,le)}else{if(fe.isInstancedBufferAttribute){for(let Y=0;Y<G.locationSize;Y++)p(G.location+Y,fe.meshPerAttribute);g.isInstancedMesh!==!0&&$._maxInstanceCount===void 0&&($._maxInstanceCount=fe.meshPerAttribute*fe.count)}else for(let Y=0;Y<G.locationSize;Y++)_(G.location+Y);t.bindBuffer(t.ARRAY_BUFFER,Je);for(let Y=0;Y<G.locationSize;Y++)w(G.location+Y,De/G.locationSize,ce,ye,De*N,De/G.locationSize*Y*N,le)}}else if(q!==void 0){const ye=q[ae];if(ye!==void 0)switch(ye.length){case 2:t.vertexAttrib2fv(G.location,ye);break;case 3:t.vertexAttrib3fv(G.location,ye);break;case 4:t.vertexAttrib4fv(G.location,ye);break;default:t.vertexAttrib1fv(G.location,ye)}}}}T()}function I(){R();for(const g in i){const F=i[g];for(const O in F){const $=F[O];for(const j in $)u($[j].object),delete $[j];delete F[O]}delete i[g]}}function P(g){if(i[g.id]===void 0)return;const F=i[g.id];for(const O in F){const $=F[O];for(const j in $)u($[j].object),delete $[j];delete F[O]}delete i[g.id]}function D(g){for(const F in i){const O=i[F];if(O[g.id]===void 0)continue;const $=O[g.id];for(const j in $)u($[j].object),delete $[j];delete O[g.id]}}function R(){E(),r=!0,o!==s&&(o=s,d(o.object))}function E(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:a,reset:R,resetDefaultState:E,dispose:I,releaseStatesOfGeometry:P,releaseStatesOfProgram:D,initAttributes:y,enableAttribute:_,disableUnusedAttributes:T}}function Lz(t,e,n){let i;function s(d){i=d}function o(d,u){t.drawArrays(i,d,u),n.update(u,i,1)}function r(d,u,f){f!==0&&(t.drawArraysInstanced(i,d,u,f),n.update(u,i,f))}function a(d,u,f){if(f===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,d,0,u,0,f);let m=0;for(let b=0;b<f;b++)m+=u[b];n.update(m,i,1)}function l(d,u,f,h){if(f===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let b=0;b<d.length;b++)r(d[b],u[b],h[b]);else{m.multiDrawArraysInstancedWEBGL(i,d,0,u,0,h,0,f);let b=0;for(let y=0;y<f;y++)b+=u[y]*h[y];n.update(b,i,1)}}this.setMode=s,this.render=o,this.renderInstances=r,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function Uz(t,e,n,i){let s;function o(){if(s!==void 0)return s;if(e.has("EXT_texture_filter_anisotropic")===!0){const D=e.get("EXT_texture_filter_anisotropic");s=t.getParameter(D.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s}function r(D){return!(D!==kn&&i.convert(D)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(D){const R=D===fr&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(D!==ti&&i.convert(D)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&D!==hi&&!R)}function l(D){if(D==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&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 Oz(t){const e=this;let n=null,i=0,s=!1,o=!1;const r=new Ii,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||_.length<p)&&(_=new Float32Array(p));for(let w=0,S=m;w!==y;++w,S+=4)r.copy(f[w]).applyMatrix4(T,a),r.normal.toArray(_,S),_[S+3]=r.constant}l.value=_,l.needsUpdate=!0}return e.numPlanes=y,e.numIntersection=0,_}}function Nz(t){let e=new WeakMap;function n(r,a){return a===ac?r.mapping=ao:a===lc&&(r.mapping=lo),r}function i(r){if(r&&r.isTexture){const a=r.mapping;if(a===ac||a===lc)if(e.has(r)){const l=e.get(r).texture;return n(l,r.mapping)}else{const l=r.image;if(l&&l.height>0){const d=new IU(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 Ys=4,fh=[.125,.215,.35,.446,.526,.582],hs=20,El=new GU,ph=new lt;let wl=null,Tl=0,Cl=0,Al=!1;const rs=(1+Math.sqrt(5))/2,Vs=1/rs,mh=[new L(-rs,Vs,0),new L(rs,Vs,0),new L(-Vs,0,rs),new L(Vs,0,rs),new L(0,rs,-Vs),new L(0,rs,Vs),new L(-1,1,-1),new L(1,1,-1),new L(-1,1,1),new L(1,1,1)],zz=new L;class _h{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=zz}=o;wl=this._renderer.getRenderTarget(),Tl=this._renderer.getActiveCubeFace(),Cl=this._renderer.getActiveMipmapLevel(),Al=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=bh(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=vh(),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;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(wl,Tl,Cl),this._renderer.xr.enabled=Al,e.scissorTest=!1,Gr(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===ao||e.mapping===lo?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),wl=this._renderer.getRenderTarget(),Tl=this._renderer.getActiveCubeFace(),Cl=this._renderer.getActiveMipmapLevel(),Al=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=n||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,i={magFilter:Zn,minFilter:Zn,generateMipmaps:!1,type:fr,format:kn,colorSpace:co,depthBuffer:!1},s=gh(e,n,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=gh(e,n,i);const{_lodMax:o}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=kz(o)),this._blurMaterial=Bz(o,e,n)}return s}_compileMaterial(e){const n=new Pe(this._lodPlanes[0],e);this._renderer.compile(n,El)}_sceneToCubeUV(e,n,i,s,o){const l=new gn(90,1,n,i),d=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],f=this._renderer,h=f.autoClear,m=f.toneMapping;f.getClearColor(ph),f.toneMapping=ki,f.autoClear=!1;const b=new Va({name:"PMREM.Background",side:hn,depthWrite:!1,depthTest:!1}),y=new Pe(new Ot,b);let _=!1;const p=e.background;p?p.isColor&&(b.color.copy(p),e.background=null,_=!0):(b.color.copy(ph),_=!0);for(let T=0;T<6;T++){const w=T%3;w===0?(l.up.set(0,d[T],0),l.position.set(o.x,o.y,o.z),l.lookAt(o.x+u[T],o.y,o.z)):w===1?(l.up.set(0,0,d[T]),l.position.set(o.x,o.y,o.z),l.lookAt(o.x,o.y+u[T],o.z)):(l.up.set(0,d[T],0),l.position.set(o.x,o.y,o.z),l.lookAt(o.x,o.y,o.z+u[T]));const S=this._cubeSize;Gr(s,w*S,T>2?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===ao||e.mapping===lo;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=bh()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=vh());const o=s?this._cubemapMaterial:this._equirectMaterial,r=new Pe(this._lodPlanes[0],o),a=o.uniforms;a.envMap.value=e;const l=this._cubeSize;Gr(n,0,0,3*l,2*l),i.setRenderTarget(n),i.render(r,El)}_applyPMREM(e){const n=this._renderer,i=n.autoClear;n.autoClear=!1;const s=this._lodPlanes.length;for(let o=1;o<s;o++){const r=Math.sqrt(this._sigmas[o]*this._sigmas[o]-this._sigmas[o-1]*this._sigmas[o-1]),a=mh[(s-o-1)%mh.length];this._blur(e,o-1,o,r,a)}n.autoClear=i}_blur(e,n,i,s,o){const r=this._pingPongRenderTarget;this._halfBlur(e,r,n,i,s,"latitudinal",o),this._halfBlur(r,e,i,i,s,"longitudinal",o)}_halfBlur(e,n,i,s,o,r,a){const l=this._renderer,d=this._blurMaterial;r!=="latitudinal"&&r!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,f=new Pe(this._lodPlanes[s],d),h=d.uniforms,m=this._sizeLods[i]-1,b=isFinite(o)?Math.PI/(2*m):2*Math.PI/(2*hs-1),y=o/b,_=isFinite(o)?1+Math.floor(u*y):hs;_>hs&&console.warn(`sigmaRadians, ${o}, is too large and will clip, as it requested ${_} samples when the maximum is set to ${hs}`);const p=[];let T=0;for(let D=0;D<hs;++D){const R=D/y,E=Math.exp(-R*R/2);p.push(E),D===0?T+=E:D<_&&(T+=2*E)}for(let D=0;D<p.length;D++)p[D]=p[D]/T;h.envMap.value=e.texture,h.samples.value=_,h.weights.value=p,h.latitudinal.value=r==="latitudinal",a&&(h.poleAxis.value=a);const{_lodMax:w}=this;h.dTheta.value=b,h.mipInt.value=w-i;const S=this._sizeLods[s],I=3*S*(s>w-Ys?s-w+Ys:0),P=4*(this._cubeSize-S);Gr(n,I,P,3*S,2*S),l.setRenderTarget(n),l.render(f,El)}}function kz(t){const e=[],n=[],i=[];let s=t;const o=t-Ys+1+fh.length;for(let r=0;r<o;r++){const a=Math.pow(2,s);n.push(a);let l=1/a;r>t-Ys?l=fh[r-t+Ys-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;P<m;P++){const D=P%3*2/3-1,R=P>2?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 Qn(T,y)),I.setAttribute("uv",new Qn(w,_)),I.setAttribute("faceIndex",new Qn(S,p)),e.push(I),s>Ys&&s--}return{lodPlanes:e,sizeLods:n,sigmas:i}}function gh(t,e,n){const i=new ys(t,e,n);return i.texture.mapping=za,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Gr(t,e,n,i,s){t.viewport.set(e,n,i,s),t.scissor.set(e,n,i,s)}function Bz(t,e,n){const i=new Float32Array(hs),s=new L(0,1,0);return new Hi({name:"SphericalGaussianBlur",defines:{n:hs,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:Md(),fragmentShader:`
  3562. precision mediump float;
  3563. precision mediump int;
  3564. varying vec3 vOutputDirection;
  3565. uniform sampler2D envMap;
  3566. uniform int samples;
  3567. uniform float weights[ n ];
  3568. uniform bool latitudinal;
  3569. uniform float dTheta;
  3570. uniform float mipInt;
  3571. uniform vec3 poleAxis;
  3572. #define ENVMAP_TYPE_CUBE_UV
  3573. #include <cube_uv_reflection_fragment>
  3574. vec3 getSample( float theta, vec3 axis ) {
  3575. float cosTheta = cos( theta );
  3576. // Rodrigues' axis-angle rotation
  3577. vec3 sampleDirection = vOutputDirection * cosTheta
  3578. + cross( axis, vOutputDirection ) * sin( theta )
  3579. + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
  3580. return bilinearCubeUV( envMap, sampleDirection, mipInt );
  3581. }
  3582. void main() {
  3583. vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
  3584. if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
  3585. axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
  3586. }
  3587. axis = normalize( axis );
  3588. gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
  3589. gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
  3590. for ( int i = 1; i < n; i++ ) {
  3591. if ( i >= samples ) {
  3592. break;
  3593. }
  3594. float theta = dTheta * float( i );
  3595. gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
  3596. gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
  3597. }
  3598. }
  3599. `,blending:zi,depthTest:!1,depthWrite:!1})}function vh(){return new Hi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Md(),fragmentShader:`
  3600. precision mediump float;
  3601. precision mediump int;
  3602. varying vec3 vOutputDirection;
  3603. uniform sampler2D envMap;
  3604. #include <common>
  3605. void main() {
  3606. vec3 outputDirection = normalize( vOutputDirection );
  3607. vec2 uv = equirectUv( outputDirection );
  3608. gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
  3609. }
  3610. `,blending:zi,depthTest:!1,depthWrite:!1})}function bh(){return new Hi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Md(),fragmentShader:`
  3611. precision mediump float;
  3612. precision mediump int;
  3613. uniform float flipEnvMap;
  3614. varying vec3 vOutputDirection;
  3615. uniform samplerCube envMap;
  3616. void main() {
  3617. gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
  3618. }
  3619. `,blending:zi,depthTest:!1,depthWrite:!1})}function Md(){return`
  3620. precision mediump float;
  3621. precision mediump int;
  3622. attribute float faceIndex;
  3623. varying vec3 vOutputDirection;
  3624. // RH coordinate system; PMREM face-indexing convention
  3625. vec3 getDirection( vec2 uv, float face ) {
  3626. uv = 2.0 * uv - 1.0;
  3627. vec3 direction = vec3( uv, 1.0 );
  3628. if ( face == 0.0 ) {
  3629. direction = direction.zyx; // ( 1, v, u ) pos x
  3630. } else if ( face == 1.0 ) {
  3631. direction = direction.xzy;
  3632. direction.xz *= -1.0; // ( -u, 1, -v ) pos y
  3633. } else if ( face == 2.0 ) {
  3634. direction.x *= -1.0; // ( -u, v, 1 ) pos z
  3635. } else if ( face == 3.0 ) {
  3636. direction = direction.zyx;
  3637. direction.xz *= -1.0; // ( -1, v, -u ) neg x
  3638. } else if ( face == 4.0 ) {
  3639. direction = direction.xzy;
  3640. direction.xy *= -1.0; // ( -u, -1, v ) neg y
  3641. } else if ( face == 5.0 ) {
  3642. direction.z *= -1.0; // ( u, v, -1 ) neg z
  3643. }
  3644. return direction;
  3645. }
  3646. void main() {
  3647. vOutputDirection = getDirection( uv, faceIndex );
  3648. gl_Position = vec4( position, 1.0 );
  3649. }
  3650. `}function Vz(t){let e=new WeakMap,n=null;function i(a){if(a&&a.isTexture){const l=a.mapping,d=l===ac||l===lc,u=l===ao||l===lo;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 _h(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 _h(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;u<d;u++)a[u]!==void 0&&l++;return l===d}function o(a){const l=a.target;l.removeEventListener("dispose",o);const d=e.get(l);d!==void 0&&(e.delete(l),d.dispose())}function r(){e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:r}}function $z(t){const e={};function n(i){if(e[i]!==void 0)return e[i];let s;switch(i){case"WEBGL_depth_texture":s=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":s=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":s=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":s=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:s=t.getExtension(i)}return e[i]=s,s}return{has:function(i){return n(i)!==null},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(i){const s=n(i);return s===null&&oa("THREE.WebGLRenderer: "+i+" extension not supported."),s}}}function Hz(t,e,n,i){const s={},o=new WeakMap;function r(f){const h=f.target;h.index!==null&&e.remove(h.index);for(const b in h.attributes)e.remove(h.attributes[b]);h.removeEventListener("dispose",r),delete s[h.id];const m=o.get(h);m&&(e.remove(m),o.delete(h)),i.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,n.memory.geometries--}function a(f,h){return s[h.id]===!0||(h.addEventListener("dispose",r),s[h.id]=!0,n.memory.geometries++),h}function l(f){const h=f.attributes;for(const m in h)e.update(h[m],t.ARRAY_BUFFER)}function d(f){const h=[],m=f.index,b=f.attributes.position;let y=0;if(m!==null){const T=m.array;y=m.version;for(let w=0,S=T.length;w<S;w+=3){const I=T[w+0],P=T[w+1],D=T[w+2];h.push(I,P,P,D,D,I)}}else if(b!==void 0){const T=b.array;y=b.version;for(let w=0,S=T.length/3-1;w<S;w+=3){const I=w+0,P=w+1,D=w+2;h.push(I,P,P,D,D,I)}}else return;const _=new(Pp(h)?Fp:Ip)(h,1);_.version=y;const p=o.get(f);p&&e.remove(p),o.set(f,_)}function u(f){const h=o.get(f);if(h){const m=f.index;m!==null&&h.version<m.version&&d(f)}else d(f);return o.get(f)}return{get:a,update:l,getWireframeAttribute:u}}function Gz(t,e,n){let i;function s(h){i=h}let o,r;function a(h){o=h.type,r=h.bytesPerElement}function l(h,m){t.drawElements(i,m,o,h*r),n.update(m,i,1)}function d(h,m,b){b!==0&&(t.drawElementsInstanced(i,m,o,h*r,b),n.update(m,i,b))}function u(h,m,b){if(b===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,m,0,o,h,0,b);let _=0;for(let p=0;p<b;p++)_+=m[p];n.update(_,i,1)}function f(h,m,b,y){if(b===0)return;const _=e.get("WEBGL_multi_draw");if(_===null)for(let p=0;p<h.length;p++)d(h[p]/r,m[p],y[p]);else{_.multiDrawElementsInstancedWEBGL(i,m,0,o,h,0,y,0,b);let p=0;for(let T=0;T<b;T++)p+=m[T]*y[T];n.update(p,i,1)}}this.setMode=s,this.setIndex=a,this.render=l,this.renderInstances=d,this.renderMultiDraw=u,this.renderMultiDrawInstances=f}function Wz(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(o,r,a){switch(n.calls++,r){case t.TRIANGLES:n.triangles+=a*(o/3);break;case t.LINES:n.lines+=a*(o/2);break;case t.LINE_STRIP:n.lines+=a*(o-1);break;case t.LINE_LOOP:n.lines+=a*o;break;case t.POINTS:n.points+=a*o;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",r);break}}function s(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:s,update:i}}function Xz(t,e,n){const i=new WeakMap,s=new It;function o(r,a,l){const d=r.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,f=u!==void 0?u.length:0;let h=i.get(a);if(h===void 0||h.count!==f){let E=function(){D.dispose(),i.delete(a),a.removeEventListener("dispose",E)};h!==void 0&&h.texture.dispose();const m=a.morphAttributes.position!==void 0,b=a.morphAttributes.normal!==void 0,y=a.morphAttributes.color!==void 0,_=a.morphAttributes.position||[],p=a.morphAttributes.normal||[],T=a.morphAttributes.color||[];let w=0;m===!0&&(w=1),b===!0&&(w=2),y===!0&&(w=3);let S=a.attributes.position.count*w,I=1;S>e.maxTextureSize&&(I=Math.ceil(S/e.maxTextureSize),S=e.maxTextureSize);const P=new Float32Array(S*I*4*f),D=new Rp(P,S,I,f);D.type=hi,D.needsUpdate=!0;const R=w*4;for(let g=0;g<f;g++){const F=_[g],O=p[g],$=T[g],j=S*I*4*g;for(let re=0;re<F.count;re++){const q=re*R;m===!0&&(s.fromBufferAttribute(F,re),P[j+q+0]=s.x,P[j+q+1]=s.y,P[j+q+2]=s.z,P[j+q+3]=0),b===!0&&(s.fromBufferAttribute(O,re),P[j+q+4]=s.x,P[j+q+5]=s.y,P[j+q+6]=s.z,P[j+q+7]=0),y===!0&&(s.fromBufferAttribute($,re),P[j+q+8]=s.x,P[j+q+9]=s.y,P[j+q+10]=s.z,P[j+q+11]=$.itemSize===4?s.w:1)}}h={count:f,texture:D,size:new Ke(S,I)},i.set(a,h),a.addEventListener("dispose",E)}if(r.isInstancedMesh===!0&&r.morphTexture!==null)l.getUniforms().setValue(t,"morphTexture",r.morphTexture,n);else{let m=0;for(let y=0;y<d.length;y++)m+=d[y];const b=a.morphTargetsRelative?1:1-m;l.getUniforms().setValue(t,"morphTargetBaseInfluence",b),l.getUniforms().setValue(t,"morphTargetInfluences",d)}l.getUniforms().setValue(t,"morphTargetsTexture",h.texture,n),l.getUniforms().setValue(t,"morphTargetsTextureSize",h.size)}return{update:o}}function jz(t,e,n,i){let s=new WeakMap;function o(l){const d=i.render.frame,u=l.geometry,f=e.get(l,u);if(s.get(f)!==d&&(e.update(f),s.set(f,d)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),s.get(l)!==d&&(n.update(l.instanceMatrix,t.ARRAY_BUFFER),l.instanceColor!==null&&n.update(l.instanceColor,t.ARRAY_BUFFER),s.set(l,d))),l.isSkinnedMesh){const h=l.skeleton;s.get(h)!==d&&(h.update(),s.set(h,d))}return f}function r(){s=new WeakMap}function a(l){const d=l.target;d.removeEventListener("dispose",a),n.remove(d.instanceMatrix),d.instanceColor!==null&&n.remove(d.instanceColor)}return{update:o,dispose:r}}const Vp=new fn,yh=new Np(1,1),$p=new Rp,Hp=new mU,Gp=new Op,xh=[],Sh=[],Mh=new Float32Array(16),Eh=new Float32Array(9),wh=new Float32Array(4);function So(t,e,n){const i=t[0];if(i<=0||i>0)return t;const s=e*n;let o=xh[s];if(o===void 0&&(o=new Float32Array(s),xh[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<i;n++)if(t[n]!==e[n])return!1;return!0}function Vt(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function $a(t,e){let n=Sh[e];n===void 0&&(n=new Int32Array(e),Sh[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function Yz(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function qz(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Bt(n,e))return;t.uniform2fv(this.addr,e),Vt(n,e)}}function Zz(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(e.r!==void 0)(n[0]!==e.r||n[1]!==e.g||n[2]!==e.b)&&(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(Bt(n,e))return;t.uniform3fv(this.addr,e),Vt(n,e)}}function Kz(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Bt(n,e))return;t.uniform4fv(this.addr,e),Vt(n,e)}}function Jz(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(Bt(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Vt(n,e)}else{if(Bt(n,i))return;wh.set(i),t.uniformMatrix2fv(this.addr,!1,wh),Vt(n,i)}}function Qz(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(Bt(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Vt(n,e)}else{if(Bt(n,i))return;Eh.set(i),t.uniformMatrix3fv(this.addr,!1,Eh),Vt(n,i)}}function ek(t,e){const n=this.cache,i=e.elements;if(i===void 0){if(Bt(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Vt(n,e)}else{if(Bt(n,i))return;Mh.set(i),t.uniformMatrix4fv(this.addr,!1,Mh),Vt(n,i)}}function tk(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function nk(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Bt(n,e))return;t.uniform2iv(this.addr,e),Vt(n,e)}}function ik(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(Bt(n,e))return;t.uniform3iv(this.addr,e),Vt(n,e)}}function sk(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Bt(n,e))return;t.uniform4iv(this.addr,e),Vt(n,e)}}function ok(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function rk(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Bt(n,e))return;t.uniform2uiv(this.addr,e),Vt(n,e)}}function ak(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(Bt(n,e))return;t.uniform3uiv(this.addr,e),Vt(n,e)}}function lk(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Bt(n,e))return;t.uniform4uiv(this.addr,e),Vt(n,e)}}function ck(t,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(t.uniform1i(this.addr,s),i[0]=s);let o;this.type===t.SAMPLER_2D_SHADOW?(yh.compareFunction=Ap,o=yh):o=Vp,n.setTexture2D(e||o,s)}function dk(t,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(t.uniform1i(this.addr,s),i[0]=s),n.setTexture3D(e||Hp,s)}function uk(t,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(t.uniform1i(this.addr,s),i[0]=s),n.setTextureCube(e||Gp,s)}function hk(t,e,n){const i=this.cache,s=n.allocateTextureUnit();i[0]!==s&&(t.uniform1i(this.addr,s),i[0]=s),n.setTexture2DArray(e||$p,s)}function fk(t){switch(t){case 5126:return Yz;case 35664:return qz;case 35665:return Zz;case 35666:return Kz;case 35674:return Jz;case 35675:return Qz;case 35676:return ek;case 5124:case 35670:return tk;case 35667:case 35671:return nk;case 35668:case 35672:return ik;case 35669:case 35673:return sk;case 5125:return ok;case 36294:return rk;case 36295:return ak;case 36296:return lk;case 35678:case 36198:case 36298:case 36306:case 35682:return ck;case 35679:case 36299:case 36307:return dk;case 35680:case 36300:case 36308:case 36293:return uk;case 36289:case 36303:case 36311:case 36292:return hk}}function pk(t,e){t.uniform1fv(this.addr,e)}function mk(t,e){const n=So(e,this.size,2);t.uniform2fv(this.addr,n)}function _k(t,e){const n=So(e,this.size,3);t.uniform3fv(this.addr,n)}function gk(t,e){const n=So(e,this.size,4);t.uniform4fv(this.addr,n)}function vk(t,e){const n=So(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function bk(t,e){const n=So(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function yk(t,e){const n=So(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function xk(t,e){t.uniform1iv(this.addr,e)}function Sk(t,e){t.uniform2iv(this.addr,e)}function Mk(t,e){t.uniform3iv(this.addr,e)}function Ek(t,e){t.uniform4iv(this.addr,e)}function wk(t,e){t.uniform1uiv(this.addr,e)}function Tk(t,e){t.uniform2uiv(this.addr,e)}function Ck(t,e){t.uniform3uiv(this.addr,e)}function Ak(t,e){t.uniform4uiv(this.addr,e)}function Pk(t,e,n){const i=this.cache,s=e.length,o=$a(n,s);Bt(i,o)||(t.uniform1iv(this.addr,o),Vt(i,o));for(let r=0;r!==s;++r)n.setTexture2D(e[r]||Vp,o[r])}function Rk(t,e,n){const i=this.cache,s=e.length,o=$a(n,s);Bt(i,o)||(t.uniform1iv(this.addr,o),Vt(i,o));for(let r=0;r!==s;++r)n.setTexture3D(e[r]||Hp,o[r])}function Dk(t,e,n){const i=this.cache,s=e.length,o=$a(n,s);Bt(i,o)||(t.uniform1iv(this.addr,o),Vt(i,o));for(let r=0;r!==s;++r)n.setTextureCube(e[r]||Gp,o[r])}function Ik(t,e,n){const i=this.cache,s=e.length,o=$a(n,s);Bt(i,o)||(t.uniform1iv(this.addr,o),Vt(i,o));for(let r=0;r!==s;++r)n.setTexture2DArray(e[r]||$p,o[r])}function Fk(t){switch(t){case 5126:return pk;case 35664:return mk;case 35665:return _k;case 35666:return gk;case 35674:return vk;case 35675:return bk;case 35676:return yk;case 5124:case 35670:return xk;case 35667:case 35671:return Sk;case 35668:case 35672:return Mk;case 35669:case 35673:return Ek;case 5125:return wk;case 36294:return Tk;case 36295:return Ck;case 36296:return Ak;case 35678:case 36198:case 36298:case 36306:case 35682:return Pk;case 35679:case 36299:case 36307:return Rk;case 35680:case 36300:case 36308:case 36293:return Dk;case 36289:case 36303:case 36311:case 36292:return Ik}}class Lk{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.setValue=fk(n.type)}}class Uk{constructor(e,n,i){this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=Fk(n.type)}}class Ok{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,i){const s=this.seq;for(let o=0,r=s.length;o!==r;++o){const a=s[o];a.setValue(e,n[a.id],i)}}}const Pl=/(\w+)(\])?(\[|\.)?/g;function Th(t,e){t.seq.push(e),t.map[e.id]=e}function Nk(t,e,n){const i=t.name,s=i.length;for(Pl.lastIndex=0;;){const o=Pl.exec(i),r=Pl.lastIndex;let a=o[1];const l=o[2]==="]",d=o[3];if(l&&(a=a|0),d===void 0||d==="["&&r+2===s){Th(n,d===void 0?new Lk(a,t,e):new Uk(a,t,e));break}else{let f=n.map[a];f===void 0&&(f=new Ok(a),Th(n,f)),n=f}}}class ra{constructor(e,n){this.seq=[],this.map={};const i=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let s=0;s<i;++s){const o=e.getActiveUniform(n,s),r=e.getUniformLocation(n,o.name);Nk(o,r,this)}}setValue(e,n,i,s){const o=this.map[n];o!==void 0&&o.setValue(e,i,s)}setOptional(e,n,i){const s=n[i];s!==void 0&&this.setValue(e,i,s)}static upload(e,n,i,s){for(let o=0,r=n.length;o!==r;++o){const a=n[o],l=i[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,s)}}static seqWithValue(e,n){const i=[];for(let s=0,o=e.length;s!==o;++s){const r=e[s];r.id in n&&i.push(r)}return i}}function Ch(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}const zk=37297;let kk=0;function Bk(t,e){const n=t.split(`
  3651. `),i=[],s=Math.max(e-6,0),o=Math.min(e+6,n.length);for(let r=s;r<o;r++){const a=r+1;i.push(`${a===e?">":" "} ${a}: ${n[r]}`)}return i.join(`
  3652. `)}const Ah=new tt;function Vk(t){ft._getMatrix(Ah,ft.workingColorSpace,t);const e=`mat3( ${Ah.elements.map(n=>n.toFixed(4))} )`;switch(ft.getTransfer(t)){case ma:return[e,"LinearTransferOETF"];case bt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}function Ph(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()+`
  3653. `+s+`
  3654. `+Bk(t.getShaderSource(e),r)}else return s}function $k(t,e){const n=Vk(e);return[`vec4 ${t}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
  3655. `)}function Hk(t,e){let n;switch(e){case wL:n="Linear";break;case TL:n="Reinhard";break;case CL:n="Cineon";break;case AL:n="ACESFilmic";break;case RL:n="AgX";break;case DL:n="Neutral";break;case PL:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const Wr=new L;function Gk(){ft.getLuminanceCoefficients(Wr);const t=Wr.x.toFixed(4),e=Wr.y.toFixed(4),n=Wr.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${t}, ${e}, ${n} );`," return dot( weights, rgb );","}"].join(`
  3656. `)}function Wk(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(No).join(`
  3657. `)}function Xk(t){const e=[];for(const n in t){const i=t[n];i!==!1&&e.push("#define "+n+" "+i)}return e.join(`
  3658. `)}function jk(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let s=0;s<i;s++){const o=t.getActiveAttrib(e,s),r=o.name;let a=1;o.type===t.FLOAT_MAT2&&(a=2),o.type===t.FLOAT_MAT3&&(a=3),o.type===t.FLOAT_MAT4&&(a=4),n[r]={type:o.type,location:t.getAttribLocation(e,r),locationSize:a}}return n}function No(t){return t!==""}function Rh(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Dh(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Yk=/^[ \t]*#include +<([\w\d./]+)>/gm;function zc(t){return t.replace(Yk,Zk)}const qk=new Map;function Zk(t,e){let n=it[e];if(n===void 0){const i=qk.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 zc(n)}const Kk=/#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 Ih(t){return t.replace(Kk,Jk)}function Jk(t,e,n,i){let s="";for(let o=parseInt(e);o<parseInt(n);o++)s+=i.replace(/\[\s*i\s*\]/g,"[ "+o+" ]").replace(/UNROLLED_LOOP_INDEX/g,o);return s}function Fh(t){let e=`precision ${t.precision} float;
  3659. precision ${t.precision} int;
  3660. precision ${t.precision} sampler2D;
  3661. precision ${t.precision} samplerCube;
  3662. precision ${t.precision} sampler3D;
  3663. precision ${t.precision} sampler2DArray;
  3664. precision ${t.precision} sampler2DShadow;
  3665. precision ${t.precision} samplerCubeShadow;
  3666. precision ${t.precision} sampler2DArrayShadow;
  3667. precision ${t.precision} isampler2D;
  3668. precision ${t.precision} isampler3D;
  3669. precision ${t.precision} isamplerCube;
  3670. precision ${t.precision} isampler2DArray;
  3671. precision ${t.precision} usampler2D;
  3672. precision ${t.precision} usampler3D;
  3673. precision ${t.precision} usamplerCube;
  3674. precision ${t.precision} usampler2DArray;
  3675. `;return t.precision==="highp"?e+=`
  3676. #define HIGH_PRECISION`:t.precision==="mediump"?e+=`
  3677. #define MEDIUM_PRECISION`:t.precision==="lowp"&&(e+=`
  3678. #define LOW_PRECISION`),e}function Qk(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===gp?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===sL?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===ci&&(e="SHADOWMAP_TYPE_VSM"),e}function e4(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case ao:case lo:e="ENVMAP_TYPE_CUBE";break;case za:e="ENVMAP_TYPE_CUBE_UV";break}return e}function t4(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case lo:e="ENVMAP_MODE_REFRACTION";break}return e}function n4(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case ld:e="ENVMAP_BLENDING_MULTIPLY";break;case ML:e="ENVMAP_BLENDING_MIX";break;case EL:e="ENVMAP_BLENDING_ADD";break}return e}function i4(t){const e=t.envMapCubeUVHeight;if(e===null)return null;const n=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),7*16)),texelHeight:i,maxMip:n}}function s4(t,e,n,i){const s=t.getContext(),o=n.defines;let r=n.vertexShader,a=n.fragmentShader;const l=Qk(n),d=e4(n),u=t4(n),f=n4(n),h=i4(n),m=Wk(n),b=Xk(o),y=s.createProgram();let _,p,T=n.glslVersion?"#version "+n.glslVersion+`
  3679. `:"";n.isRawShaderMaterial?(_=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(No).join(`
  3680. `),_.length>0&&(_+=`
  3681. `),p=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(No).join(`
  3682. `),p.length>0&&(p+=`
  3683. `)):(_=[Fh(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",`
  3684. `].filter(No).join(`
  3685. `),p=[Fh(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!==ki?"#define TONE_MAPPING":"",n.toneMapping!==ki?it.tonemapping_pars_fragment:"",n.toneMapping!==ki?Hk("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",it.colorspace_pars_fragment,$k("linearToOutputTexel",n.outputColorSpace),Gk(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
  3686. `].filter(No).join(`
  3687. `)),r=zc(r),r=Rh(r,n),r=Dh(r,n),a=zc(a),a=Rh(a,n),a=Dh(a,n),r=Ih(r),a=Ih(a),n.isRawShaderMaterial!==!0&&(T=`#version 300 es
  3688. `,_=[m,"#define attribute in","#define varying out","#define texture2D texture"].join(`
  3689. `)+`
  3690. `+_,p=["#define varying in",n.glslVersion===zu?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===zu?"":"#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(`
  3691. `)+`
  3692. `+p);const w=T+_+r,S=T+p+a,I=Ch(s,s.VERTEX_SHADER,w),P=Ch(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(F){if(t.debug.checkShaderErrors){const O=s.getProgramInfoLog(y).trim(),$=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=Ph(s,I,"vertex"),G=Ph(s,P,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(y,s.VALIDATE_STATUS)+`
  3693. Material Name: `+F.name+`
  3694. Material Type: `+F.type+`
  3695. Program Info Log: `+O+`
  3696. `+ae+`
  3697. `+G)}else O!==""?console.warn("THREE.WebGLProgram: Program Info Log:",O):($===""||j==="")&&(q=!1);q&&(F.diagnostics={runnable:re,programLog:O,vertexShader:{log:$,prefix:_},fragmentShader:{log:j,prefix:p}})}s.deleteShader(I),s.deleteShader(P),R=new ra(s,y),E=jk(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,zk)),g},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(y),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=kk++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=I,this.fragmentShader=P,this}let o4=0;class r4{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 a4(e),n.set(e,i)),i}}class a4{constructor(e){this.id=o4++,this.code=e,this.usedTimes=0}}function l4(t,e,n,i,s,o,r){const a=new gd,l=new r4,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,F,O,$){const j=O.fog,re=$.geometry,q=E.isMeshStandardMaterial?O.environment:null,ae=(E.isMeshStandardMaterial?n:e).get(E.envMap||q),G=!!ae&&ae.mapping===za?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,De=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=Yn[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=$.isInstancedMesh===!0,Se=$.isBatchedMesh===!0,Ne=!!E.map,Le=!!E.matcap,A=!!ae,x=!!E.aoMap,Z=!!E.lightMap,ie=!!E.bumpMap,te=!!E.normalMap,ne=!!E.displacementMap,_e=!!E.emissiveMap,Q=!!E.metalnessMap,M=!!E.roughnessMap,v=E.anisotropy>0,U=E.clearcoat>0,B=E.dispersion>0,X=E.iridescence>0,H=E.sheen>0,ge=E.transmission>0,pe=v&&!!E.anisotropyMap,be=U&&!!E.clearcoatMap,Me=U&&!!E.clearcoatNormalMap,he=U&&!!E.clearcoatRoughnessMap,Ae=X&&!!E.iridescenceMap,Xe=X&&!!E.iridescenceThicknessMap,He=H&&!!E.sheenColorMap,Ie=H&&!!E.sheenRoughnessMap,Ye=!!E.specularMap,Ge=!!E.specularColorMap,gt=!!E.specularIntensityMap,z=ge&&!!E.transmissionMap,Te=ge&&!!E.thicknessMap,oe=!!E.gradientMap,de=!!E.alphaMap,Re=E.alphaTest>0,Ce=!!E.alphaHash,Qe=!!E.extensions;let Rt=ki;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&&$._colorsTexture!==null,instancing:Oe,instancingColor:Oe&&$.instanceColor!==null,instancingMorph:Oe&&$.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:Y===null?t.outputColorSpace:Y.isXRRenderTarget===!0?Y.texture.colorSpace:co,alphaToCoverage:!!E.alphaToCoverage,map:Ne,matcap:Le,envMap:A,envMapMode:A&&ae.mapping,envMapCubeUVHeight:G,aoMap:x,lightMap:Z,bumpMap:ie,normalMap:te,displacementMap:h&&ne,emissiveMap:_e,normalMapObjectSpace:te&&E.normalMapType===UL,normalMapTangentSpace:te&&E.normalMapType===Cp,metalnessMap:Q,roughnessMap:M,anisotropy:v,anisotropyMap:pe,clearcoat:U,clearcoatMap:be,clearcoatNormalMap:Me,clearcoatRoughnessMap:he,dispersion:B,iridescence:X,iridescenceMap:Ae,iridescenceThicknessMap:Xe,sheen:H,sheenColorMap:He,sheenRoughnessMap:Ie,specularMap:Ye,specularColorMap:Ge,specularIntensityMap:gt,transmission:ge,transmissionMap:z,thicknessMap:Te,gradientMap:oe,opaque:E.transparent===!1&&E.blending===Qs&&E.alphaToCoverage===!1,alphaMap:de,alphaTest:Re,alphaHash:Ce,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:_e&&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:Ae&&y(E.iridescenceMap.channel),iridescenceThicknessMapUv:Xe&&y(E.iridescenceThicknessMap.channel),sheenColorMapUv:He&&y(E.sheenColorMap.channel),sheenRoughnessMapUv:Ie&&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:Te&&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:$.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:$.isSkinnedMesh===!0,morphTargets:re.morphAttributes.position!==void 0,morphNormals:re.morphAttributes.normal!==void 0,morphColors:re.morphAttributes.color!==void 0,morphTargetsCount:De,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&&F.length>0,shadowMapType:t.shadowMap.type,toneMapping:Rt,decodeVideoTexture:Ne&&E.map.isVideoTexture===!0&&ft.getTransfer(E.map.colorSpace)===bt,decodeVideoTextureEmissive:_e&&E.emissiveMap.isVideoTexture===!0&&ft.getTransfer(E.emissiveMap.colorSpace)===bt,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===On,flipSided:E.side===hn,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 F in E.defines)g.push(F),g.push(E.defines[F]);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 F;if(g){const O=Yn[g];F=AU.clone(O.uniforms)}else F=E.uniforms;return F}function I(E,g){let F;for(let O=0,$=u.length;O<$;O++){const j=u[O];if(j.cacheKey===g){F=j,++F.usedTimes;break}}return F===void 0&&(F=new s4(t,g,E,o),u.push(F)),F}function P(E){if(--E.usedTimes===0){const g=u.indexOf(E);u[g]=u[u.length-1],u.pop(),E.destroy()}}function D(E){l.remove(E)}function R(){l.dispose()}return{getParameters:_,getProgramCacheKey:p,getUniforms:S,acquireProgram:I,releaseProgram:P,releaseShaderCache:D,programs:u,dispose:R}}function c4(){let t=new WeakMap;function e(r){return t.has(r)}function n(r){let a=t.get(r);return a===void 0&&(a={},t.set(r,a)),a}function i(r){t.delete(r)}function s(r,a,l){t.get(r)[a]=l}function o(){t=new WeakMap}return{has:e,get:n,remove:i,update:s,dispose:o}}function d4(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Lh(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Uh(){const t=[];let e=0;const n=[],i=[],s=[];function o(){e=0,n.length=0,i.length=0,s.length=0}function r(f,h,m,b,y,_){let p=t[e];return p===void 0?(p={id:f.id,object:f,geometry:h,material:m,groupOrder:b,renderOrder:f.renderOrder,z:y,group:_},t[e]=p):(p.id=f.id,p.object=f,p.geometry=h,p.material=m,p.groupOrder=b,p.renderOrder=f.renderOrder,p.z=y,p.group=_),e++,p}function a(f,h,m,b,y,_){const p=r(f,h,m,b,y,_);m.transmission>0?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||d4),i.length>1&&i.sort(h||Lh),s.length>1&&s.sort(h||Lh)}function u(){for(let f=e,h=t.length;f<h;f++){const m=t[f];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:n,transmissive:i,transparent:s,init:o,push:a,unshift:l,finish:u,sort:d}}function u4(){let t=new WeakMap;function e(i,s){const o=t.get(i);let r;return o===void 0?(r=new Uh,t.set(i,[r])):s>=o.length?(r=new Uh,o.push(r)):r=o[s],r}function n(){t=new WeakMap}return{get:e,dispose:n}}function h4(){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 L,color:new lt};break;case"SpotLight":n={position:new L,direction:new L,color:new lt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new L,color:new lt,distance:0,decay:0};break;case"HemisphereLight":n={direction:new L,skyColor:new lt,groundColor:new lt};break;case"RectAreaLight":n={color:new lt,position:new L,halfWidth:new L,halfHeight:new L};break}return t[e.id]=n,n}}}function f4(){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 p4=0;function m4(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function _4(t){const e=new h4,n=f4(),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 L);const s=new L,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(m4);for(let E=0,g=d.length;E<g;E++){const F=d[E],O=F.color,$=F.intensity,j=F.distance,re=F.shadow&&F.shadow.map?F.shadow.map.texture:null;if(F.isAmbientLight)u+=O.r*$,f+=O.g*$,h+=O.b*$;else if(F.isLightProbe){for(let q=0;q<9;q++)i.probe[q].addScaledVector(F.sh.coefficients[q],$);D++}else if(F.isDirectionalLight){const q=e.get(F);if(q.color.copy(F.color).multiplyScalar(F.intensity),F.castShadow){const ae=F.shadow,G=n.get(F);G.shadowIntensity=ae.intensity,G.shadowBias=ae.bias,G.shadowNormalBias=ae.normalBias,G.shadowRadius=ae.radius,G.shadowMapSize=ae.mapSize,i.directionalShadow[m]=G,i.directionalShadowMap[m]=re,i.directionalShadowMatrix[m]=F.shadow.matrix,T++}i.directional[m]=q,m++}else if(F.isSpotLight){const q=e.get(F);q.position.setFromMatrixPosition(F.matrixWorld),q.color.copy(O).multiplyScalar($),q.distance=j,q.coneCos=Math.cos(F.angle),q.penumbraCos=Math.cos(F.angle*(1-F.penumbra)),q.decay=F.decay,i.spot[y]=q;const ae=F.shadow;if(F.map&&(i.spotLightMap[I]=F.map,I++,ae.updateMatrices(F),F.castShadow&&P++),i.spotLightMatrix[y]=ae.matrix,F.castShadow){const G=n.get(F);G.shadowIntensity=ae.intensity,G.shadowBias=ae.bias,G.shadowNormalBias=ae.normalBias,G.shadowRadius=ae.radius,G.shadowMapSize=ae.mapSize,i.spotShadow[y]=G,i.spotShadowMap[y]=re,S++}y++}else if(F.isRectAreaLight){const q=e.get(F);q.color.copy(O).multiplyScalar($),q.halfWidth.set(F.width*.5,0,0),q.halfHeight.set(0,F.height*.5,0),i.rectArea[_]=q,_++}else if(F.isPointLight){const q=e.get(F);if(q.color.copy(F.color).multiplyScalar(F.intensity),q.distance=F.distance,q.decay=F.decay,F.castShadow){const ae=F.shadow,G=n.get(F);G.shadowIntensity=ae.intensity,G.shadowBias=ae.bias,G.shadowNormalBias=ae.normalBias,G.shadowRadius=ae.radius,G.shadowMapSize=ae.mapSize,G.shadowCameraNear=ae.camera.near,G.shadowCameraFar=ae.camera.far,i.pointShadow[b]=G,i.pointShadowMap[b]=re,i.pointShadowMatrix[b]=F.shadow.matrix,w++}i.point[b]=q,b++}else if(F.isHemisphereLight){const q=e.get(F);q.skyColor.copy(F.color).multiplyScalar($),q.groundColor.copy(F.groundColor).multiplyScalar($),i.hemi[p]=q,p++}}_>0&&(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=p4++)}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<T;p++){const w=d[p];if(w.isDirectionalLight){const S=i.directional[f];S.direction.setFromMatrixPosition(w.matrixWorld),s.setFromMatrixPosition(w.target.matrixWorld),S.direction.sub(s),S.direction.transformDirection(_),f++}else if(w.isSpotLight){const S=i.spot[m];S.position.setFromMatrixPosition(w.matrixWorld),S.position.applyMatrix4(_),S.direction.setFromMatrixPosition(w.matrixWorld),s.setFromMatrixPosition(w.target.matrixWorld),S.direction.sub(s),S.direction.transformDirection(_),m++}else if(w.isRectAreaLight){const S=i.rectArea[b];S.position.setFromMatrixPosition(w.matrixWorld),S.position.applyMatrix4(_),r.identity(),o.copy(w.matrixWorld),o.premultiply(_),r.extractRotation(o),S.halfWidth.set(w.width*.5,0,0),S.halfHeight.set(0,w.height*.5,0),S.halfWidth.applyMatrix4(r),S.halfHeight.applyMatrix4(r),b++}else if(w.isPointLight){const S=i.point[h];S.position.setFromMatrixPosition(w.matrixWorld),S.position.applyMatrix4(_),h++}else if(w.isHemisphereLight){const S=i.hemi[y];S.direction.setFromMatrixPosition(w.matrixWorld),S.direction.transformDirection(_),y++}}}return{setup:a,setupView:l,state:i}}function Oh(t){const e=new _4(t),n=[],i=[];function s(u){d.camera=u,n.length=0,i.length=0}function o(u){n.push(u)}function r(u){i.push(u)}function a(){e.setup(n)}function l(u){e.setupView(n,u)}const d={lightsArray:n,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:s,state:d,setupLights:a,setupLightsView:l,pushLight:o,pushShadow:r}}function g4(t){let e=new WeakMap;function n(s,o=0){const r=e.get(s);let a;return r===void 0?(a=new Oh(t),e.set(s,[a])):o>=r.length?(a=new Oh(t),r.push(a)):a=r[o],a}function i(){e=new WeakMap}return{get:n,dispose:i}}const v4=`void main() {
  3698. gl_Position = vec4( position, 1.0 );
  3699. }`,b4=`uniform sampler2D shadow_pass;
  3700. uniform vec2 resolution;
  3701. uniform float radius;
  3702. #include <packing>
  3703. void main() {
  3704. const float samples = float( VSM_SAMPLES );
  3705. float mean = 0.0;
  3706. float squared_mean = 0.0;
  3707. float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
  3708. float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
  3709. for ( float i = 0.0; i < samples; i ++ ) {
  3710. float uvOffset = uvStart + i * uvStride;
  3711. #ifdef HORIZONTAL_PASS
  3712. vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
  3713. mean += distribution.x;
  3714. squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
  3715. #else
  3716. float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
  3717. mean += depth;
  3718. squared_mean += depth * depth;
  3719. #endif
  3720. }
  3721. mean = mean / samples;
  3722. squared_mean = squared_mean / samples;
  3723. float std_dev = sqrt( squared_mean - mean * mean );
  3724. gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
  3725. }`;function y4(t,e,n){let i=new vd;const s=new Ke,o=new Ke,r=new It,a=new kU({depthPacking:LL}),l=new BU,d={},u=n.maxTextureSize,f={[$i]:hn,[hn]:$i,[On]:On},h=new Hi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ke},radius:{value:4}},vertexShader:v4,fragmentShader:b4}),m=h.clone();m.defines.HORIZONTAL_PASS=1;const b=new tn;b.setAttribute("position",new Qn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new Pe(b,h),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=gp;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(),F=t.getActiveMipmapLevel(),O=t.state;O.setBlending(zi),O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);const $=p!==ci&&this.type===ci,j=p===ci&&this.type!==ci;for(let re=0,q=P.length;re<q;re++){const ae=P[re],G=ae.shadow;if(G===void 0){console.warn("THREE.WebGLShadowMap:",ae,"has no shadow.");continue}if(G.autoUpdate===!1&&G.needsUpdate===!1)continue;s.copy(G.mapSize);const fe=G.getFrameExtents();if(s.multiply(fe),o.copy(G.mapSize),(s.x>u||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||$===!0||j===!0){const De=this.type!==ci?{minFilter:Vn,magFilter:Vn}:{};G.map!==null&&G.map.dispose(),G.map=new ys(s.x,s.y,De),G.map.texture.name=ae.name+".shadowMap",G.camera.updateProjectionMatrix()}t.setRenderTarget(G.map),t.clear();const ye=G.getViewportCount();for(let De=0;De<ye;De++){const Be=G.getViewport(De);r.set(o.x*Be.x,o.y*Be.y,o.x*Be.z,o.y*Be.w),O.viewport(r),G.updateMatrices(ae,De),i=G.getFrustum(),S(D,R,G.camera,ae,this.type)}G.isPointLightShadow!==!0&&this.type===ci&&T(G,R),G.needsUpdate=!1}p=this.type,_.needsUpdate=!1,t.setRenderTarget(E,g,F)};function T(P,D){const R=e.update(y);h.defines.VSM_SAMPLES!==P.blurSamples&&(h.defines.VSM_SAMPLES=P.blurSamples,m.defines.VSM_SAMPLES=P.blurSamples,h.needsUpdate=!0,m.needsUpdate=!0),P.mapPass===null&&(P.mapPass=new ys(s.x,s.y)),h.uniforms.shadow_pass.value=P.map.texture,h.uniforms.resolution.value=P.mapSize,h.uniforms.radius.value=P.radius,t.setRenderTarget(P.mapPass),t.clear(),t.renderBufferDirect(D,null,R,h,y,null),m.uniforms.shadow_pass.value=P.mapPass.texture,m.uniforms.resolution.value=P.mapSize,m.uniforms.radius.value=P.radius,t.setRenderTarget(P.map),t.clear(),t.renderBufferDirect(D,null,R,m,y,null)}function w(P,D,R,E){let g=null;const F=R.isPointLight===!0?P.customDistanceMaterial:P.customDepthMaterial;if(F!==void 0)g=F;else if(g=R.isPointLight===!0?l:a,t.localClippingEnabled&&D.clipShadows===!0&&Array.isArray(D.clippingPlanes)&&D.clippingPlanes.length!==0||D.displacementMap&&D.displacementScale!==0||D.alphaMap&&D.alphaTest>0||D.map&&D.alphaTest>0||D.alphaToCoverage===!0){const O=g.uuid,$=D.uuid;let j=d[O];j===void 0&&(j={},d[O]=j);let re=j[$];re===void 0&&(re=g.clone(),j[$]=re,D.addEventListener("dispose",I)),g=re}if(g.visible=D.visible,g.wireframe=D.wireframe,E===ci?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===ci)&&(!P.frustumCulled||i.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,P.matrixWorld);const $=e.update(P),j=P.material;if(Array.isArray(j)){const re=$.groups;for(let q=0,ae=re.length;q<ae;q++){const G=re[q],fe=j[G.materialIndex];if(fe&&fe.visible){const ye=w(P,fe,E,g);P.onBeforeShadow(t,P,D,R,$,ye,G),t.renderBufferDirect(R,null,$,ye,P,G),P.onAfterShadow(t,P,D,R,$,ye,G)}}}else if(j.visible){const re=w(P,j,E,g);P.onBeforeShadow(t,P,D,R,$,re,null),t.renderBufferDirect(R,null,$,re,P,null),P.onAfterShadow(t,P,D,R,$,re,null)}}const O=P.children;for(let $=0,j=O.length;$<j;$++)S(O[$],D,R,E,g)}function I(P){P.target.removeEventListener("dispose",I);for(const R in d){const E=d[R],g=P.target.uuid;g in E&&(E[g].dispose(),delete E[g])}}}const x4={[ec]:tc,[nc]:oc,[ic]:rc,[ro]:sc,[tc]:ec,[oc]:nc,[rc]:ic,[sc]:ro};function S4(t,e){function n(){let z=!1;const Te=new It;let oe=null;const de=new It(0,0,0,0);return{setMask:function(Re){oe!==Re&&!z&&(t.colorMask(Re,Re,Re,Re),oe=Re)},setLocked:function(Re){z=Re},setClear:function(Re,Ce,Qe,Rt,Yt){Yt===!0&&(Re*=Rt,Ce*=Rt,Qe*=Rt),Te.set(Re,Ce,Qe,Rt),de.equals(Te)===!1&&(t.clearColor(Re,Ce,Qe,Rt),de.copy(Te))},reset:function(){z=!1,oe=null,de.set(-1,0,0,0)}}}function i(){let z=!1,Te=!1,oe=null,de=null,Re=null;return{setReversed:function(Ce){if(Te!==Ce){const Qe=e.get("EXT_clip_control");Ce?Qe.clipControlEXT(Qe.LOWER_LEFT_EXT,Qe.ZERO_TO_ONE_EXT):Qe.clipControlEXT(Qe.LOWER_LEFT_EXT,Qe.NEGATIVE_ONE_TO_ONE_EXT),Te=Ce;const Rt=Re;Re=null,this.setClear(Rt)}},getReversed:function(){return Te},setTest:function(Ce){Ce?Y(t.DEPTH_TEST):ue(t.DEPTH_TEST)},setMask:function(Ce){oe!==Ce&&!z&&(t.depthMask(Ce),oe=Ce)},setFunc:function(Ce){if(Te&&(Ce=x4[Ce]),de!==Ce){switch(Ce){case ec:t.depthFunc(t.NEVER);break;case tc:t.depthFunc(t.ALWAYS);break;case nc:t.depthFunc(t.LESS);break;case ro:t.depthFunc(t.LEQUAL);break;case ic:t.depthFunc(t.EQUAL);break;case sc:t.depthFunc(t.GEQUAL);break;case oc:t.depthFunc(t.GREATER);break;case rc:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}de=Ce}},setLocked:function(Ce){z=Ce},setClear:function(Ce){Re!==Ce&&(Te&&(Ce=1-Ce),t.clearDepth(Ce),Re=Ce)},reset:function(){z=!1,oe=null,de=null,Re=null,Te=!1}}}function s(){let z=!1,Te=null,oe=null,de=null,Re=null,Ce=null,Qe=null,Rt=null,Yt=null;return{setTest:function(vt){z||(vt?Y(t.STENCIL_TEST):ue(t.STENCIL_TEST))},setMask:function(vt){Te!==vt&&!z&&(t.stencilMask(vt),Te=vt)},setFunc:function(vt,An,ni){(oe!==vt||de!==An||Re!==ni)&&(t.stencilFunc(vt,An,ni),oe=vt,de=An,Re=ni)},setOp:function(vt,An,ni){(Ce!==vt||Qe!==An||Rt!==ni)&&(t.stencilOp(vt,An,ni),Ce=vt,Qe=An,Rt=ni)},setLocked:function(vt){z=vt},setClear:function(vt){Yt!==vt&&(t.clearStencil(vt),Yt=vt)},reset:function(){z=!1,Te=null,oe=null,de=null,Re=null,Ce=null,Qe=null,Rt=null,Yt=null}}}const o=new n,r=new i,a=new s,l=new WeakMap,d=new WeakMap;let u={},f={},h=new WeakMap,m=[],b=null,y=!1,_=null,p=null,T=null,w=null,S=null,I=null,P=null,D=new lt(0,0,0),R=0,E=!1,g=null,F=null,O=null,$=null,j=null;const re=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let q=!1,ae=0;const G=t.getParameter(t.VERSION);G.indexOf("WebGL")!==-1?(ae=parseFloat(/^WebGL (\d)/.exec(G)[1]),q=ae>=1):G.indexOf("OpenGL ES")!==-1&&(ae=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),q=ae>=2);let fe=null,ye={};const De=t.getParameter(t.SCISSOR_BOX),Be=t.getParameter(t.VIEWPORT),Je=new It().fromArray(De),ce=new It().fromArray(Be);function N(z,Te,oe,de){const Re=new Uint8Array(4),Ce=t.createTexture();t.bindTexture(z,Ce),t.texParameteri(z,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(z,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Qe=0;Qe<oe;Qe++)z===t.TEXTURE_3D||z===t.TEXTURE_2D_ARRAY?t.texImage3D(Te,0,t.RGBA,1,1,de,0,t.RGBA,t.UNSIGNED_BYTE,Re):t.texImage2D(Te+Qe,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,Re);return Ce}const le={};le[t.TEXTURE_2D]=N(t.TEXTURE_2D,t.TEXTURE_2D,1),le[t.TEXTURE_CUBE_MAP]=N(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),le[t.TEXTURE_2D_ARRAY]=N(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),le[t.TEXTURE_3D]=N(t.TEXTURE_3D,t.TEXTURE_3D,1,1),o.setClear(0,0,0,1),r.setClear(1),a.setClear(0),Y(t.DEPTH_TEST),r.setFunc(ro),ie(!1),te(Iu),Y(t.CULL_FACE),x(zi);function Y(z){u[z]!==!0&&(t.enable(z),u[z]=!0)}function ue(z){u[z]!==!1&&(t.disable(z),u[z]=!1)}function Oe(z,Te){return f[z]!==Te?(t.bindFramebuffer(z,Te),f[z]=Te,z===t.DRAW_FRAMEBUFFER&&(f[t.FRAMEBUFFER]=Te),z===t.FRAMEBUFFER&&(f[t.DRAW_FRAMEBUFFER]=Te),!0):!1}function Se(z,Te){let oe=m,de=!1;if(z){oe=h.get(Te),oe===void 0&&(oe=[],h.set(Te,oe));const Re=z.textures;if(oe.length!==Re.length||oe[0]!==t.COLOR_ATTACHMENT0){for(let Ce=0,Qe=Re.length;Ce<Qe;Ce++)oe[Ce]=t.COLOR_ATTACHMENT0+Ce;oe.length=Re.length,de=!0}}else oe[0]!==t.BACK&&(oe[0]=t.BACK,de=!0);de&&t.drawBuffers(oe)}function Ne(z){return b!==z?(t.useProgram(z),b=z,!0):!1}const Le={[ds]:t.FUNC_ADD,[rL]:t.FUNC_SUBTRACT,[aL]:t.FUNC_REVERSE_SUBTRACT};Le[lL]=t.MIN,Le[cL]=t.MAX;const A={[dL]:t.ZERO,[uL]:t.ONE,[hL]:t.SRC_COLOR,[Jl]:t.SRC_ALPHA,[vL]:t.SRC_ALPHA_SATURATE,[_L]:t.DST_COLOR,[pL]:t.DST_ALPHA,[fL]:t.ONE_MINUS_SRC_COLOR,[Ql]:t.ONE_MINUS_SRC_ALPHA,[gL]:t.ONE_MINUS_DST_COLOR,[mL]:t.ONE_MINUS_DST_ALPHA,[bL]:t.CONSTANT_COLOR,[yL]:t.ONE_MINUS_CONSTANT_COLOR,[xL]:t.CONSTANT_ALPHA,[SL]:t.ONE_MINUS_CONSTANT_ALPHA};function x(z,Te,oe,de,Re,Ce,Qe,Rt,Yt,vt){if(z===zi){y===!0&&(ue(t.BLEND),y=!1);return}if(y===!1&&(Y(t.BLEND),y=!0),z!==oL){if(z!==_||vt!==E){if((p!==ds||S!==ds)&&(t.blendEquation(t.FUNC_ADD),p=ds,S=ds),vt)switch(z){case Qs:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case Fu:t.blendFunc(t.ONE,t.ONE);break;case Lu:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case Uu:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",z);break}else switch(z){case Qs:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case Fu:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case Lu:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case Uu:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",z);break}T=null,w=null,I=null,P=null,D.set(0,0,0),R=0,_=z,E=vt}return}Re=Re||Te,Ce=Ce||oe,Qe=Qe||de,(Te!==p||Re!==S)&&(t.blendEquationSeparate(Le[Te],Le[Re]),p=Te,S=Re),(oe!==T||de!==w||Ce!==I||Qe!==P)&&(t.blendFuncSeparate(A[oe],A[de],A[Ce],A[Qe]),T=oe,w=de,I=Ce,P=Qe),(Rt.equals(D)===!1||Yt!==R)&&(t.blendColor(Rt.r,Rt.g,Rt.b,Yt),D.copy(Rt),R=Yt),_=z,E=!1}function Z(z,Te){z.side===On?ue(t.CULL_FACE):Y(t.CULL_FACE);let oe=z.side===hn;Te&&(oe=!oe),ie(oe),z.blending===Qs&&z.transparent===!1?x(zi):x(z.blending,z.blendEquation,z.blendSrc,z.blendDst,z.blendEquationAlpha,z.blendSrcAlpha,z.blendDstAlpha,z.blendColor,z.blendAlpha,z.premultipliedAlpha),r.setFunc(z.depthFunc),r.setTest(z.depthTest),r.setMask(z.depthWrite),o.setMask(z.colorWrite);const de=z.stencilWrite;a.setTest(de),de&&(a.setMask(z.stencilWriteMask),a.setFunc(z.stencilFunc,z.stencilRef,z.stencilFuncMask),a.setOp(z.stencilFail,z.stencilZFail,z.stencilZPass)),_e(z.polygonOffset,z.polygonOffsetFactor,z.polygonOffsetUnits),z.alphaToCoverage===!0?Y(t.SAMPLE_ALPHA_TO_COVERAGE):ue(t.SAMPLE_ALPHA_TO_COVERAGE)}function ie(z){g!==z&&(z?t.frontFace(t.CW):t.frontFace(t.CCW),g=z)}function te(z){z!==nL?(Y(t.CULL_FACE),z!==F&&(z===Iu?t.cullFace(t.BACK):z===iL?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):ue(t.CULL_FACE),F=z}function ne(z){z!==O&&(q&&t.lineWidth(z),O=z)}function _e(z,Te,oe){z?(Y(t.POLYGON_OFFSET_FILL),($!==Te||j!==oe)&&(t.polygonOffset(Te,oe),$=Te,j=oe)):ue(t.POLYGON_OFFSET_FILL)}function Q(z){z?Y(t.SCISSOR_TEST):ue(t.SCISSOR_TEST)}function M(z){z===void 0&&(z=t.TEXTURE0+re-1),fe!==z&&(t.activeTexture(z),fe=z)}function v(z,Te,oe){oe===void 0&&(fe===null?oe=t.TEXTURE0+re-1:oe=fe);let de=ye[oe];de===void 0&&(de={type:void 0,texture:void 0},ye[oe]=de),(de.type!==z||de.texture!==Te)&&(fe!==oe&&(t.activeTexture(oe),fe=oe),t.bindTexture(z,Te||le[z]),de.type=z,de.texture=Te)}function U(){const z=ye[fe];z!==void 0&&z.type!==void 0&&(t.bindTexture(z.type,null),z.type=void 0,z.texture=void 0)}function B(){try{t.compressedTexImage2D(...arguments)}catch(z){console.error("THREE.WebGLState:",z)}}function X(){try{t.compressedTexImage3D(...arguments)}catch(z){console.error("THREE.WebGLState:",z)}}function H(){try{t.texSubImage2D(...arguments)}catch(z){console.error("THREE.WebGLState:",z)}}function ge(){try{t.texSubImage3D(...arguments)}catch(z){console.error("THREE.WebGLState:",z)}}function pe(){try{t.compressedTexSubImage2D(...arguments)}catch(z){console.error("THREE.WebGLState:",z)}}function be(){try{t.compressedTexSubImage3D(...arguments)}catch(z){console.error("THREE.WebGLState:",z)}}function Me(){try{t.texStorage2D(...arguments)}catch(z){console.error("THREE.WebGLState:",z)}}function he(){try{t.texStorage3D(...arguments)}catch(z){console.error("THREE.WebGLState:",z)}}function Ae(){try{t.texImage2D(...arguments)}catch(z){console.error("THREE.WebGLState:",z)}}function Xe(){try{t.texImage3D(...arguments)}catch(z){console.error("THREE.WebGLState:",z)}}function He(z){Je.equals(z)===!1&&(t.scissor(z.x,z.y,z.z,z.w),Je.copy(z))}function Ie(z){ce.equals(z)===!1&&(t.viewport(z.x,z.y,z.z,z.w),ce.copy(z))}function Ye(z,Te){let oe=d.get(Te);oe===void 0&&(oe=new WeakMap,d.set(Te,oe));let de=oe.get(z);de===void 0&&(de=t.getUniformBlockIndex(Te,z.name),oe.set(z,de))}function Ge(z,Te){const de=d.get(Te).get(z);l.get(Te)!==de&&(t.uniformBlockBinding(Te,de,z.__bindingPointIndex),l.set(Te,de))}function gt(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),r.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),u={},fe=null,ye={},f={},h=new WeakMap,m=[],b=null,y=!1,_=null,p=null,T=null,w=null,S=null,I=null,P=null,D=new lt(0,0,0),R=0,E=!1,g=null,F=null,O=null,$=null,j=null,Je.set(0,0,t.canvas.width,t.canvas.height),ce.set(0,0,t.canvas.width,t.canvas.height),o.reset(),r.reset(),a.reset()}return{buffers:{color:o,depth:r,stencil:a},enable:Y,disable:ue,bindFramebuffer:Oe,drawBuffers:Se,useProgram:Ne,setBlending:x,setMaterial:Z,setFlipSided:ie,setCullFace:te,setLineWidth:ne,setPolygonOffset:_e,setScissorTest:Q,activeTexture:M,bindTexture:v,unbindTexture:U,compressedTexImage2D:B,compressedTexImage3D:X,texImage2D:Ae,texImage3D:Xe,updateUBOMapping:Ye,uniformBlockBinding:Ge,texStorage2D:Me,texStorage3D:he,texSubImage2D:H,texSubImage3D:ge,compressedTexSubImage2D:pe,compressedTexSubImage3D:be,scissor:He,viewport:Ie,reset:gt}}function M4(t,e,n,i,s,o,r){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator=="undefined"?!1:/OculusBrowser/g.test(navigator.userAgent),d=new Ke,u=new WeakMap;let f;const h=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(M,v){return m?new OffscreenCanvas(M,v):ga("canvas")}function y(M,v,U){let B=1;const X=Q(M);if((X.width>U||X.height>U)&&(B=U/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 H=Math.floor(B*X.width),ge=Math.floor(B*X.height);f===void 0&&(f=b(H,ge));const pe=v?b(H,ge):f;return pe.width=H,pe.height=ge,pe.getContext("2d").drawImage(M,0,0,H,ge),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+X.width+"x"+X.height+") to ("+H+"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,U,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 H=v;if(v===t.RED&&(U===t.FLOAT&&(H=t.R32F),U===t.HALF_FLOAT&&(H=t.R16F),U===t.UNSIGNED_BYTE&&(H=t.R8)),v===t.RED_INTEGER&&(U===t.UNSIGNED_BYTE&&(H=t.R8UI),U===t.UNSIGNED_SHORT&&(H=t.R16UI),U===t.UNSIGNED_INT&&(H=t.R32UI),U===t.BYTE&&(H=t.R8I),U===t.SHORT&&(H=t.R16I),U===t.INT&&(H=t.R32I)),v===t.RG&&(U===t.FLOAT&&(H=t.RG32F),U===t.HALF_FLOAT&&(H=t.RG16F),U===t.UNSIGNED_BYTE&&(H=t.RG8)),v===t.RG_INTEGER&&(U===t.UNSIGNED_BYTE&&(H=t.RG8UI),U===t.UNSIGNED_SHORT&&(H=t.RG16UI),U===t.UNSIGNED_INT&&(H=t.RG32UI),U===t.BYTE&&(H=t.RG8I),U===t.SHORT&&(H=t.RG16I),U===t.INT&&(H=t.RG32I)),v===t.RGB_INTEGER&&(U===t.UNSIGNED_BYTE&&(H=t.RGB8UI),U===t.UNSIGNED_SHORT&&(H=t.RGB16UI),U===t.UNSIGNED_INT&&(H=t.RGB32UI),U===t.BYTE&&(H=t.RGB8I),U===t.SHORT&&(H=t.RGB16I),U===t.INT&&(H=t.RGB32I)),v===t.RGBA_INTEGER&&(U===t.UNSIGNED_BYTE&&(H=t.RGBA8UI),U===t.UNSIGNED_SHORT&&(H=t.RGBA16UI),U===t.UNSIGNED_INT&&(H=t.RGBA32UI),U===t.BYTE&&(H=t.RGBA8I),U===t.SHORT&&(H=t.RGBA16I),U===t.INT&&(H=t.RGBA32I)),v===t.RGB&&U===t.UNSIGNED_INT_5_9_9_9_REV&&(H=t.RGB9_E5),v===t.RGBA){const ge=X?ma:ft.getTransfer(B);U===t.FLOAT&&(H=t.RGBA32F),U===t.HALF_FLOAT&&(H=t.RGBA16F),U===t.UNSIGNED_BYTE&&(H=ge===bt?t.SRGB8_ALPHA8:t.RGBA8),U===t.UNSIGNED_SHORT_4_4_4_4&&(H=t.RGBA4),U===t.UNSIGNED_SHORT_5_5_5_1&&(H=t.RGB5_A1)}return(H===t.R16F||H===t.R32F||H===t.RG16F||H===t.RG32F||H===t.RGBA16F||H===t.RGBA32F)&&e.get("EXT_color_buffer_float"),H}function S(M,v){let U;return M?v===null||v===bs||v===ar?U=t.DEPTH24_STENCIL8:v===hi?U=t.DEPTH32F_STENCIL8:v===rr&&(U=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):v===null||v===bs||v===ar?U=t.DEPTH_COMPONENT24:v===hi?U=t.DEPTH_COMPONENT32F:v===rr&&(U=t.DEPTH_COMPONENT16),U}function I(M,v){return _(M)===!0||M.isFramebufferTexture&&M.minFilter!==Vn&&M.minFilter!==Zn?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 U=M.source,B=h.get(U);if(B){const X=B[v.__cacheKey];X.usedTimes--,X.usedTimes===0&&E(M),Object.keys(B).length===0&&h.delete(U)}i.remove(M)}function E(M){const v=i.get(M);t.deleteTexture(v.__webglTexture);const U=M.source,B=h.get(U);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<v.__webglFramebuffer[B].length;X++)t.deleteFramebuffer(v.__webglFramebuffer[B][X]);else t.deleteFramebuffer(v.__webglFramebuffer[B]);v.__webglDepthbuffer&&t.deleteRenderbuffer(v.__webglDepthbuffer[B])}else{if(Array.isArray(v.__webglFramebuffer))for(let B=0;B<v.__webglFramebuffer.length;B++)t.deleteFramebuffer(v.__webglFramebuffer[B]);else t.deleteFramebuffer(v.__webglFramebuffer);if(v.__webglDepthbuffer&&t.deleteRenderbuffer(v.__webglDepthbuffer),v.__webglMultisampledFramebuffer&&t.deleteFramebuffer(v.__webglMultisampledFramebuffer),v.__webglColorRenderbuffer)for(let B=0;B<v.__webglColorRenderbuffer.length;B++)v.__webglColorRenderbuffer[B]&&t.deleteRenderbuffer(v.__webglColorRenderbuffer[B]);v.__webglDepthRenderbuffer&&t.deleteRenderbuffer(v.__webglDepthRenderbuffer)}const U=M.textures;for(let B=0,X=U.length;B<X;B++){const H=i.get(U[B]);H.__webglTexture&&(t.deleteTexture(H.__webglTexture),r.memory.textures--),i.remove(U[B])}i.remove(M)}let F=0;function O(){F=0}function $(){const M=F;return M>=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+M+" texture units while this GPU supports only "+s.maxTextures),F+=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 U=i.get(M);if(M.isVideoTexture&&ne(M),M.isRenderTargetTexture===!1&&M.version>0&&U.__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(U,M,v);return}}n.bindTexture(t.TEXTURE_2D,U.__webglTexture,t.TEXTURE0+v)}function q(M,v){const U=i.get(M);if(M.version>0&&U.__version!==M.version){ce(U,M,v);return}n.bindTexture(t.TEXTURE_2D_ARRAY,U.__webglTexture,t.TEXTURE0+v)}function ae(M,v){const U=i.get(M);if(M.version>0&&U.__version!==M.version){ce(U,M,v);return}n.bindTexture(t.TEXTURE_3D,U.__webglTexture,t.TEXTURE0+v)}function G(M,v){const U=i.get(M);if(M.version>0&&U.__version!==M.version){N(U,M,v);return}n.bindTexture(t.TEXTURE_CUBE_MAP,U.__webglTexture,t.TEXTURE0+v)}const fe={[cc]:t.REPEAT,[ps]:t.CLAMP_TO_EDGE,[dc]:t.MIRRORED_REPEAT},ye={[Vn]:t.NEAREST,[IL]:t.NEAREST_MIPMAP_NEAREST,[Mr]:t.NEAREST_MIPMAP_LINEAR,[Zn]:t.LINEAR,[el]:t.LINEAR_MIPMAP_NEAREST,[ms]:t.LINEAR_MIPMAP_LINEAR},De={[OL]:t.NEVER,[$L]:t.ALWAYS,[NL]:t.LESS,[Ap]:t.LEQUAL,[zL]:t.EQUAL,[VL]:t.GEQUAL,[kL]:t.GREATER,[BL]:t.NOTEQUAL};function Be(M,v){if(v.type===hi&&e.has("OES_texture_float_linear")===!1&&(v.magFilter===Zn||v.magFilter===el||v.magFilter===Mr||v.magFilter===ms||v.minFilter===Zn||v.minFilter===el||v.minFilter===Mr||v.minFilter===ms)&&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,De[v.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(v.magFilter===Vn||v.minFilter!==Mr&&v.minFilter!==ms||v.type===hi&&e.has("OES_texture_float_linear")===!1)return;if(v.anisotropy>1||i.get(v).__currentAnisotropy){const U=e.get("EXT_texture_filter_anisotropic");t.texParameterf(M,U.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(v.anisotropy,s.getMaxAnisotropy())),i.get(v).__currentAnisotropy=v.anisotropy}}}function Je(M,v){let U=!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 H=j(v);if(H!==M.__cacheKey){X[H]===void 0&&(X[H]={texture:t.createTexture(),usedTimes:0},r.memory.textures++,U=!0),X[H].usedTimes++;const ge=X[M.__cacheKey];ge!==void 0&&(X[M.__cacheKey].usedTimes--,ge.usedTimes===0&&E(v)),M.__cacheKey=H,M.__webglTexture=X[H].texture}return U}function ce(M,v,U){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),H=v.source;n.bindTexture(B,M.__webglTexture,t.TEXTURE0+U);const ge=i.get(H);if(H.version!==ge.__version||X===!0){n.activeTexture(t.TEXTURE0+U);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=_e(v,he);const Ae=o.convert(v.format,v.colorSpace),Xe=o.convert(v.type);let He=w(v.internalFormat,Ae,Xe,v.colorSpace,v.isVideoTexture);Be(B,v);let Ie;const Ye=v.mipmaps,Ge=v.isVideoTexture!==!0,gt=ge.__version===void 0||X===!0,z=H.dataReady,Te=I(v,he);if(v.isDepthTexture)He=S(v.format===cr,v.type),gt&&(Ge?n.texStorage2D(t.TEXTURE_2D,1,He,he.width,he.height):n.texImage2D(t.TEXTURE_2D,0,He,he.width,he.height,0,Ae,Xe,null));else if(v.isDataTexture)if(Ye.length>0){Ge&&gt&&n.texStorage2D(t.TEXTURE_2D,Te,He,Ye[0].width,Ye[0].height);for(let oe=0,de=Ye.length;oe<de;oe++)Ie=Ye[oe],Ge?z&&n.texSubImage2D(t.TEXTURE_2D,oe,0,0,Ie.width,Ie.height,Ae,Xe,Ie.data):n.texImage2D(t.TEXTURE_2D,oe,He,Ie.width,Ie.height,0,Ae,Xe,Ie.data);v.generateMipmaps=!1}else Ge?(gt&&n.texStorage2D(t.TEXTURE_2D,Te,He,he.width,he.height),z&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,he.width,he.height,Ae,Xe,he.data)):n.texImage2D(t.TEXTURE_2D,0,He,he.width,he.height,0,Ae,Xe,he.data);else if(v.isCompressedTexture)if(v.isCompressedArrayTexture){Ge&&gt&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Te,He,Ye[0].width,Ye[0].height,he.depth);for(let oe=0,de=Ye.length;oe<de;oe++)if(Ie=Ye[oe],v.format!==kn)if(Ae!==null)if(Ge){if(z)if(v.layerUpdates.size>0){const Re=hh(Ie.width,Ie.height,v.format,v.type);for(const Ce of v.layerUpdates){const Qe=Ie.data.subarray(Ce*Re/Ie.data.BYTES_PER_ELEMENT,(Ce+1)*Re/Ie.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,oe,0,0,Ce,Ie.width,Ie.height,1,Ae,Qe)}v.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,oe,0,0,0,Ie.width,Ie.height,he.depth,Ae,Ie.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,oe,He,Ie.width,Ie.height,he.depth,0,Ie.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,Ie.width,Ie.height,he.depth,Ae,Xe,Ie.data):n.texImage3D(t.TEXTURE_2D_ARRAY,oe,He,Ie.width,Ie.height,he.depth,0,Ae,Xe,Ie.data)}else{Ge&&gt&&n.texStorage2D(t.TEXTURE_2D,Te,He,Ye[0].width,Ye[0].height);for(let oe=0,de=Ye.length;oe<de;oe++)Ie=Ye[oe],v.format!==kn?Ae!==null?Ge?z&&n.compressedTexSubImage2D(t.TEXTURE_2D,oe,0,0,Ie.width,Ie.height,Ae,Ie.data):n.compressedTexImage2D(t.TEXTURE_2D,oe,He,Ie.width,Ie.height,0,Ie.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ge?z&&n.texSubImage2D(t.TEXTURE_2D,oe,0,0,Ie.width,Ie.height,Ae,Xe,Ie.data):n.texImage2D(t.TEXTURE_2D,oe,He,Ie.width,Ie.height,0,Ae,Xe,Ie.data)}else if(v.isDataArrayTexture)if(Ge){if(gt&&n.texStorage3D(t.TEXTURE_2D_ARRAY,Te,He,he.width,he.height,he.depth),z)if(v.layerUpdates.size>0){const oe=hh(he.width,he.height,v.format,v.type);for(const de of v.layerUpdates){const Re=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,Ae,Xe,Re)}v.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,he.width,he.height,he.depth,Ae,Xe,he.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,He,he.width,he.height,he.depth,0,Ae,Xe,he.data);else if(v.isData3DTexture)Ge?(gt&&n.texStorage3D(t.TEXTURE_3D,Te,He,he.width,he.height,he.depth),z&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,he.width,he.height,he.depth,Ae,Xe,he.data)):n.texImage3D(t.TEXTURE_3D,0,He,he.width,he.height,he.depth,0,Ae,Xe,he.data);else if(v.isFramebufferTexture){if(gt)if(Ge)n.texStorage2D(t.TEXTURE_2D,Te,He,he.width,he.height);else{let oe=he.width,de=he.height;for(let Re=0;Re<Te;Re++)n.texImage2D(t.TEXTURE_2D,Re,He,oe,de,0,Ae,Xe,null),oe>>=1,de>>=1}}else if(Ye.length>0){if(Ge&&gt){const oe=Q(Ye[0]);n.texStorage2D(t.TEXTURE_2D,Te,He,oe.width,oe.height)}for(let oe=0,de=Ye.length;oe<de;oe++)Ie=Ye[oe],Ge?z&&n.texSubImage2D(t.TEXTURE_2D,oe,0,0,Ae,Xe,Ie):n.texImage2D(t.TEXTURE_2D,oe,He,Ae,Xe,Ie);v.generateMipmaps=!1}else if(Ge){if(gt){const oe=Q(he);n.texStorage2D(t.TEXTURE_2D,Te,He,oe.width,oe.height)}z&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,Ae,Xe,he)}else n.texImage2D(t.TEXTURE_2D,0,He,Ae,Xe,he);_(v)&&p(B),ge.__version=H.version,v.onUpdate&&v.onUpdate(v)}M.__version=v.version}function N(M,v,U){if(v.image.length!==6)return;const B=Je(M,v),X=v.source;n.bindTexture(t.TEXTURE_CUBE_MAP,M.__webglTexture,t.TEXTURE0+U);const H=i.get(X);if(X.version!==H.__version||B===!0){n.activeTexture(t.TEXTURE0+U);const ge=ft.getPrimaries(ft.workingColorSpace),pe=v.colorSpace===Li?null:ft.getPrimaries(v.colorSpace),be=v.colorSpace===Li||ge===pe?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,be);const Me=v.isCompressedTexture||v.image[0].isCompressedTexture,he=v.image[0]&&v.image[0].isDataTexture,Ae=[];for(let de=0;de<6;de++)!Me&&!he?Ae[de]=y(v.image[de],!0,s.maxCubemapSize):Ae[de]=he?v.image[de].image:v.image[de],Ae[de]=_e(v,Ae[de]);const Xe=Ae[0],He=o.convert(v.format,v.colorSpace),Ie=o.convert(v.type),Ye=w(v.internalFormat,He,Ie,v.colorSpace),Ge=v.isVideoTexture!==!0,gt=H.__version===void 0||B===!0,z=X.dataReady;let Te=I(v,Xe);Be(t.TEXTURE_CUBE_MAP,v);let oe;if(Me){Ge&&gt&&n.texStorage2D(t.TEXTURE_CUBE_MAP,Te,Ye,Xe.width,Xe.height);for(let de=0;de<6;de++){oe=Ae[de].mipmaps;for(let Re=0;Re<oe.length;Re++){const Ce=oe[Re];v.format!==kn?He!==null?Ge?z&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,Re,0,0,Ce.width,Ce.height,He,Ce.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,Re,Ye,Ce.width,Ce.height,0,Ce.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ge?z&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,Re,0,0,Ce.width,Ce.height,He,Ie,Ce.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,Re,Ye,Ce.width,Ce.height,0,He,Ie,Ce.data)}}}else{if(oe=v.mipmaps,Ge&&gt){oe.length>0&&Te++;const de=Q(Ae[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,Te,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,Ae[de].width,Ae[de].height,He,Ie,Ae[de].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,Ye,Ae[de].width,Ae[de].height,0,He,Ie,Ae[de].data);for(let Re=0;Re<oe.length;Re++){const Qe=oe[Re].image[de].image;Ge?z&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,Re+1,0,0,Qe.width,Qe.height,He,Ie,Qe.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,Re+1,Ye,Qe.width,Qe.height,0,He,Ie,Qe.data)}}else{Ge?z&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,0,0,He,Ie,Ae[de]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,Ye,He,Ie,Ae[de]);for(let Re=0;Re<oe.length;Re++){const Ce=oe[Re];Ge?z&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,Re+1,0,0,He,Ie,Ce.image[de]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+de,Re+1,Ye,He,Ie,Ce.image[de])}}}_(v)&&p(t.TEXTURE_CUBE_MAP),H.__version=X.version,v.onUpdate&&v.onUpdate(v)}M.__version=v.version}function le(M,v,U,B,X,H){const ge=o.convert(U.format,U.colorSpace),pe=o.convert(U.type),be=w(U.internalFormat,ge,pe,U.colorSpace),Me=i.get(v),he=i.get(U);if(he.__renderTarget=v,!Me.__hasExternalTextures){const Ae=Math.max(1,v.width>>H),Xe=Math.max(1,v.height>>H);X===t.TEXTURE_3D||X===t.TEXTURE_2D_ARRAY?n.texImage3D(X,H,be,Ae,Xe,v.depth,0,ge,pe,null):n.texImage2D(X,H,be,Ae,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,H),n.bindFramebuffer(t.FRAMEBUFFER,null)}function Y(M,v,U){if(t.bindRenderbuffer(t.RENDERBUFFER,M),v.depthBuffer){const B=v.depthTexture,X=B&&B.isDepthTexture?B.type:null,H=S(v.stencilBuffer,X),ge=v.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,pe=ie(v);te(v)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,pe,H,v.width,v.height):U?t.renderbufferStorageMultisample(t.RENDERBUFFER,pe,H,v.width,v.height):t.renderbufferStorage(t.RENDERBUFFER,H,v.width,v.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,ge,t.RENDERBUFFER,M)}else{const B=v.textures;for(let X=0;X<B.length;X++){const H=B[X],ge=o.convert(H.format,H.colorSpace),pe=o.convert(H.type),be=w(H.internalFormat,ge,pe,H.colorSpace),Me=ie(v);U&&te(v)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,Me,be,v.width,v.height):te(v)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Me,be,v.width,v.height):t.renderbufferStorage(t.RENDERBUFFER,be,v.width,v.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function ue(M,v){if(v&&v.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,M),!(v.depthTexture&&v.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const B=i.get(v.depthTexture);B.__renderTarget=v,(!B.__webglTexture||v.depthTexture.image.width!==v.width||v.depthTexture.image.height!==v.height)&&(v.depthTexture.image.width=v.width,v.depthTexture.image.height=v.height,v.depthTexture.needsUpdate=!0),re(v.depthTexture,0);const X=B.__webglTexture,H=ie(v);if(v.depthTexture.format===lr)te(v)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,X,0,H):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,X,0);else if(v.depthTexture.format===cr)te(v)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,X,0,H):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,X,0);else throw new Error("Unknown depthTexture format")}function Oe(M){const v=i.get(M),U=M.isWebGLCubeRenderTarget===!0;if(v.__boundDepthTexture!==M.depthTexture){const B=M.depthTexture;if(v.__depthDisposeCallback&&v.__depthDisposeCallback(),B){const 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(U)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(U){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,H=v.__webglDepthbuffer[B];t.bindRenderbuffer(t.RENDERBUFFER,H),t.framebufferRenderbuffer(t.FRAMEBUFFER,X,t.RENDERBUFFER,H)}}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,H=v.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,H),t.framebufferRenderbuffer(t.FRAMEBUFFER,X,t.RENDERBUFFER,H)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function Se(M,v,U){const B=i.get(M);v!==void 0&&le(B.__webglFramebuffer,M,M.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),U!==void 0&&Oe(M)}function Ne(M){const v=M.texture,U=i.get(M),B=i.get(v);M.addEventListener("dispose",D);const X=M.textures,H=M.isWebGLCubeRenderTarget===!0,ge=X.length>1;if(ge||(B.__webglTexture===void 0&&(B.__webglTexture=t.createTexture()),B.__version=v.version,r.memory.textures++),H){U.__webglFramebuffer=[];for(let pe=0;pe<6;pe++)if(v.mipmaps&&v.mipmaps.length>0){U.__webglFramebuffer[pe]=[];for(let be=0;be<v.mipmaps.length;be++)U.__webglFramebuffer[pe][be]=t.createFramebuffer()}else U.__webglFramebuffer[pe]=t.createFramebuffer()}else{if(v.mipmaps&&v.mipmaps.length>0){U.__webglFramebuffer=[];for(let pe=0;pe<v.mipmaps.length;pe++)U.__webglFramebuffer[pe]=t.createFramebuffer()}else U.__webglFramebuffer=t.createFramebuffer();if(ge)for(let pe=0,be=X.length;pe<be;pe++){const Me=i.get(X[pe]);Me.__webglTexture===void 0&&(Me.__webglTexture=t.createTexture(),r.memory.textures++)}if(M.samples>0&&te(M)===!1){U.__webglMultisampledFramebuffer=t.createFramebuffer(),U.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,U.__webglMultisampledFramebuffer);for(let pe=0;pe<X.length;pe++){const be=X[pe];U.__webglColorRenderbuffer[pe]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,U.__webglColorRenderbuffer[pe]);const Me=o.convert(be.format,be.colorSpace),he=o.convert(be.type),Ae=w(be.internalFormat,Me,he,be.colorSpace,M.isXRRenderTarget===!0),Xe=ie(M);t.renderbufferStorageMultisample(t.RENDERBUFFER,Xe,Ae,M.width,M.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+pe,t.RENDERBUFFER,U.__webglColorRenderbuffer[pe])}t.bindRenderbuffer(t.RENDERBUFFER,null),M.depthBuffer&&(U.__webglDepthRenderbuffer=t.createRenderbuffer(),Y(U.__webglDepthRenderbuffer,M,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(H){n.bindTexture(t.TEXTURE_CUBE_MAP,B.__webglTexture),Be(t.TEXTURE_CUBE_MAP,v);for(let pe=0;pe<6;pe++)if(v.mipmaps&&v.mipmaps.length>0)for(let be=0;be<v.mipmaps.length;be++)le(U.__webglFramebuffer[pe][be],M,v,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+pe,be);else le(U.__webglFramebuffer[pe],M,v,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0);_(v)&&p(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(ge){for(let pe=0,be=X.length;pe<be;pe++){const Me=X[pe],he=i.get(Me);n.bindTexture(t.TEXTURE_2D,he.__webglTexture),Be(t.TEXTURE_2D,Me),le(U.__webglFramebuffer,M,Me,t.COLOR_ATTACHMENT0+pe,t.TEXTURE_2D,0),_(Me)&&p(t.TEXTURE_2D)}n.unbindTexture()}else{let pe=t.TEXTURE_2D;if((M.isWebGL3DRenderTarget||M.isWebGLArrayRenderTarget)&&(pe=M.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(pe,B.__webglTexture),Be(pe,v),v.mipmaps&&v.mipmaps.length>0)for(let be=0;be<v.mipmaps.length;be++)le(U.__webglFramebuffer[be],M,v,t.COLOR_ATTACHMENT0,pe,be);else le(U.__webglFramebuffer,M,v,t.COLOR_ATTACHMENT0,pe,0);_(v)&&p(pe),n.unbindTexture()}M.depthBuffer&&Oe(M)}function Le(M){const v=M.textures;for(let U=0,B=v.length;U<B;U++){const X=v[U];if(_(X)){const H=T(M),ge=i.get(X).__webglTexture;n.bindTexture(H,ge),p(H),n.unbindTexture()}}}const A=[],x=[];function Z(M){if(M.samples>0){if(te(M)===!1){const v=M.textures,U=M.width,B=M.height;let X=t.COLOR_BUFFER_BIT;const H=M.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ge=i.get(M),pe=v.length>1;if(pe)for(let Me=0;Me<v.length;Me++)n.bindFramebuffer(t.FRAMEBUFFER,ge.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Me,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,ge.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+Me,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,ge.__webglMultisampledFramebuffer);const be=M.texture.mipmaps;be&&be.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,ge.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,ge.__webglFramebuffer);for(let Me=0;Me<v.length;Me++){if(M.resolveDepthBuffer&&(M.depthBuffer&&(X|=t.DEPTH_BUFFER_BIT),M.stencilBuffer&&M.resolveStencilBuffer&&(X|=t.STENCIL_BUFFER_BIT)),pe){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,ge.__webglColorRenderbuffer[Me]);const he=i.get(v[Me]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,he,0)}t.blitFramebuffer(0,0,U,B,0,0,U,B,X,t.NEAREST),l===!0&&(A.length=0,x.length=0,A.push(t.COLOR_ATTACHMENT0+Me),M.depthBuffer&&M.resolveDepthBuffer===!1&&(A.push(H),x.push(H),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,x)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,A))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),pe)for(let Me=0;Me<v.length;Me++){n.bindFramebuffer(t.FRAMEBUFFER,ge.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Me,t.RENDERBUFFER,ge.__webglColorRenderbuffer[Me]);const he=i.get(v[Me]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,ge.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+Me,t.TEXTURE_2D,he,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,ge.__webglMultisampledFramebuffer)}else if(M.depthBuffer&&M.resolveDepthBuffer===!1&&l){const v=M.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[v])}}}function ie(M){return Math.min(s.maxSamples,M.samples)}function te(M){const v=i.get(M);return M.samples>0&&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 _e(M,v){const U=M.colorSpace,B=M.format,X=M.type;return M.isCompressedTexture===!0||M.isVideoTexture===!0||U!==co&&U!==Li&&(ft.getTransfer(U)===bt?(B!==kn||X!==ti)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",U)),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=$,this.resetTextureUnits=O,this.setTexture2D=re,this.setTexture2DArray=q,this.setTexture3D=ae,this.setTextureCube=G,this.rebindTextures=Se,this.setupRenderTarget=Ne,this.updateRenderTargetMipmap=Le,this.updateMultisampleRenderTarget=Z,this.setupDepthRenderbuffer=Oe,this.setupFrameBufferTexture=le,this.useMultisampledRTT=te}function E4(t,e){function n(i,s=Li){let o;const r=ft.getTransfer(s);if(i===ti)return t.UNSIGNED_BYTE;if(i===dd)return t.UNSIGNED_SHORT_4_4_4_4;if(i===ud)return t.UNSIGNED_SHORT_5_5_5_1;if(i===xp)return t.UNSIGNED_INT_5_9_9_9_REV;if(i===bp)return t.BYTE;if(i===yp)return t.SHORT;if(i===rr)return t.UNSIGNED_SHORT;if(i===cd)return t.INT;if(i===bs)return t.UNSIGNED_INT;if(i===hi)return t.FLOAT;if(i===fr)return t.HALF_FLOAT;if(i===Sp)return t.ALPHA;if(i===Mp)return t.RGB;if(i===kn)return t.RGBA;if(i===lr)return t.DEPTH_COMPONENT;if(i===cr)return t.DEPTH_STENCIL;if(i===Ep)return t.RED;if(i===hd)return t.RED_INTEGER;if(i===wp)return t.RG;if(i===fd)return t.RG_INTEGER;if(i===pd)return t.RGBA_INTEGER;if(i===ea||i===ta||i===na||i===ia)if(r===bt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(i===ea)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===ta)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===na)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===ia)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(i===ea)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===ta)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===na)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===ia)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===uc||i===hc||i===fc||i===pc)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(i===uc)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===hc)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===fc)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===pc)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===mc||i===_c||i===gc)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(i===mc||i===_c)return r===bt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(i===gc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===vc||i===bc||i===yc||i===xc||i===Sc||i===Mc||i===Ec||i===wc||i===Tc||i===Cc||i===Ac||i===Pc||i===Rc||i===Dc)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(i===vc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===bc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===yc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===xc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Sc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Mc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Ec)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===wc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Tc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Cc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Ac)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Pc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Rc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Dc)return r===bt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===sa||i===Ic||i===Fc)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(i===sa)return r===bt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Ic)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Fc)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Tp||i===Lc||i===Uc||i===Oc)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(i===sa)return o.COMPRESSED_RED_RGTC1_EXT;if(i===Lc)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Uc)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Oc)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===ar?t.UNSIGNED_INT_24_8:t[i]!==void 0?t[i]:null}return{convert:n}}const w4=`
  3726. void main() {
  3727. gl_Position = vec4( position, 1.0 );
  3728. }`,T4=`
  3729. uniform sampler2DArray depthColor;
  3730. uniform float depthWidth;
  3731. uniform float depthHeight;
  3732. void main() {
  3733. vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
  3734. if ( coord.x >= 1.0 ) {
  3735. gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
  3736. } else {
  3737. gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
  3738. }
  3739. }`;class C4{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n,i){if(this.texture===null){const s=new fn,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:w4,fragmentShader:T4,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new Pe(new xo(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class A4 extends Es{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 C4,_=n.getContextAttributes();let p=null,T=null;const w=[],S=[],I=new Ke;let P=null;const D=new gn;D.viewport=new It;const R=new gn;R.viewport=new It;const E=[D,R],g=new XU;let F=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 yl,w[ce]=N),N.getTargetRaySpace()},this.getControllerGrip=function(ce){let N=w[ce];return N===void 0&&(N=new yl,w[ce]=N),N.getGripSpace()},this.getHand=function(ce){let N=w[ce];return N===void 0&&(N=new yl,w[ce]=N),N.getHandSpace()};function $(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",$),s.removeEventListener("selectstart",$),s.removeEventListener("selectend",$),s.removeEventListener("squeeze",$),s.removeEventListener("squeezestart",$),s.removeEventListener("squeezeend",$),s.removeEventListener("end",j),s.removeEventListener("inputsourceschange",re);for(let ce=0;ce<w.length;ce++){const N=S[ce];N!==null&&(S[ce]=null,w[ce].disconnect(N))}F=null,O=null,y.reset(),e.setRenderTarget(p),m=null,h=null,f=null,s=null,T=null,Je.stop(),i.isPresenting=!1,e.setPixelRatio(P),e.setSize(I.width,I.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ce){o=ce,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ce){a=ce,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||r},this.setReferenceSpace=function(ce){d=ce},this.getBaseLayer=function(){return h!==null?h:m},this.getBinding=function(){return f},this.getFrame=function(){return b},this.getSession=function(){return s},this.setSession=async function(ce){if(s=ce,s!==null){if(p=e.getRenderTarget(),s.addEventListener("select",$),s.addEventListener("selectstart",$),s.addEventListener("selectend",$),s.addEventListener("squeeze",$),s.addEventListener("squeezestart",$),s.addEventListener("squeezeend",$),s.addEventListener("end",j),s.addEventListener("inputsourceschange",re),_.xrCompatible!==!0&&await n.makeXRCompatible(),P=e.getPixelRatio(),e.getSize(I),typeof XRWebGLBinding!="undefined"&&"createProjectionLayer"in XRWebGLBinding.prototype){let le=null,Y=null,ue=null;_.depth&&(ue=_.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,le=_.stencil?cr:lr,Y=_.stencil?ar:bs);const Oe={colorFormat:n.RGBA8,depthFormat:ue,scaleFactor:o};f=new XRWebGLBinding(s,n),h=f.createProjectionLayer(Oe),s.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),T=new ys(h.textureWidth,h.textureHeight,{format:kn,type:ti,depthTexture:new Np(h.textureWidth,h.textureHeight,Y,void 0,void 0,void 0,void 0,void 0,void 0,le),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1})}else{const le={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:o};m=new XRWebGLLayer(s,n,le),s.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),T=new ys(m.framebufferWidth,m.framebufferHeight,{format:kn,type:ti,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:m.ignoreDepthValues===!1,resolveStencilBuffer:m.ignoreDepthValues===!1})}T.isXRRenderTarget=!0,this.setFoveation(l),d=null,r=await s.requestReferenceSpace(a),Je.setContext(s),Je.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode},this.getDepthTexture=function(){return y.getDepthTexture()};function re(ce){for(let N=0;N<ce.removed.length;N++){const le=ce.removed[N],Y=S.indexOf(le);Y>=0&&(S[Y]=null,w[Y].disconnect(le))}for(let N=0;N<ce.added.length;N++){const le=ce.added[N];let Y=S.indexOf(le);if(Y===-1){for(let Oe=0;Oe<w.length;Oe++)if(Oe>=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 L,ae=new L;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),Le=(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),_e=ne*-x;if(N.matrixWorld.decompose(ce.position,ce.quaternion,ce.scale),ce.translateX(_e),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-_e,U=te+(Y-_e),B=Le*Ne/M*Q,X=A*Ne/M*Q;ce.projectionMatrix.makePerspective(v,U,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,(F!==g.near||O!==g.far)&&(s.updateRenderState({depthNear:g.near,depthFar:g.far}),F=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;Oe<ue.length;Oe++)fe(ue[Oe],Y);ue.length===2?G(g,D,R):g.projectionMatrix.copy(D.projectionMatrix),ye(ce,g,Y)};function ye(ce,N,le){le===null?ce.matrix.copy(N.matrixWorld):(ce.matrix.copy(le.matrixWorld),ce.matrix.invert(),ce.matrix.multiply(N.matrixWorld)),ce.matrix.decompose(ce.position,ce.quaternion,ce.scale),ce.updateMatrixWorld(!0),ce.projectionMatrix.copy(N.projectionMatrix),ce.projectionMatrixInverse.copy(N.projectionMatrixInverse),ce.isPerspectiveCamera&&(ce.fov=uo*2*Math.atan(1/ce.projectionMatrix.elements[5]),ce.zoom=1)}this.getCamera=function(){return g},this.getFoveation=function(){if(!(h===null&&m===null))return l},this.setFoveation=function(ce){l=ce,h!==null&&(h.fixedFoveation=ce),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=ce)},this.hasDepthSensing=function(){return y.texture!==null},this.getDepthSensingMesh=function(){return y.getMesh(g)};let De=null;function Be(ce,N){if(u=N.getViewerPose(d||r),b=N,u!==null){const le=u.views;m!==null&&(e.setRenderTargetFramebuffer(T,m.framebuffer),e.setRenderTarget(T));let Y=!1;le.length!==g.cameras.length&&(g.cameras.length=0,Y=!0);for(let Se=0;Se<le.length;Se++){const Ne=le[Se];let Le=null;if(m!==null)Le=m.getViewport(Ne);else{const x=f.getViewSubImage(h,Ne);Le=x.viewport,Se===0&&(e.setRenderTargetTextures(T,x.colorTexture,x.depthStencilTexture),e.setRenderTarget(T))}let A=E[Se];A===void 0&&(A=new gn,A.layers.enable(Se),A.viewport=new It,E[Se]=A),A.matrix.fromArray(Ne.transform.matrix),A.matrix.decompose(A.position,A.quaternion,A.scale),A.projectionMatrix.fromArray(Ne.projectionMatrix),A.projectionMatrixInverse.copy(A.projectionMatrix).invert(),A.viewport.set(Le.x,Le.y,Le.width,Le.height),Se===0&&(g.matrix.copy(A.matrix),g.matrix.decompose(g.position,g.quaternion,g.scale)),Y===!0&&g.cameras.push(A)}const ue=s.enabledFeatures;if(ue&&ue.includes("depth-sensing")&&s.depthUsage=="gpu-optimized"&&f){const Se=f.getDepthInformation(le[0]);Se&&Se.isValid&&Se.texture&&y.init(e,Se,s.renderState)}}for(let le=0;le<w.length;le++){const Y=S[le],ue=w[le];Y!==null&&ue!==void 0&&ue.update(Y,N,d||r)}De&&De(ce,N),N.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:N}),b=null}const Je=new Bp;Je.setAnimationLoop(Be),this.setAnimationLoop=function(ce){De=ce},this.dispose=function(){}}}const ns=new $n,P4=new Tt;function R4(t,e){function n(_,p){_.matrixAutoUpdate===!0&&_.updateMatrix(),p.value.copy(_.matrix)}function i(_,p){p.color.getRGB(_.fogColor.value,Lp(t)),p.isFog?(_.fogNear.value=p.near,_.fogFar.value=p.far):p.isFogExp2&&(_.fogDensity.value=p.density)}function s(_,p,T,w,S){p.isMeshBasicMaterial||p.isMeshLambertMaterial?o(_,p):p.isMeshToonMaterial?(o(_,p),f(_,p)):p.isMeshPhongMaterial?(o(_,p),u(_,p)):p.isMeshStandardMaterial?(o(_,p),h(_,p),p.isMeshPhysicalMaterial&&m(_,p,S)):p.isMeshMatcapMaterial?(o(_,p),b(_,p)):p.isMeshDepthMaterial?o(_,p):p.isMeshDistanceMaterial?(o(_,p),y(_,p)):p.isMeshNormalMaterial?o(_,p):p.isLineBasicMaterial?(r(_,p),p.isLineDashedMaterial&&a(_,p)):p.isPointsMaterial?l(_,p,T,w):p.isSpriteMaterial?d(_,p):p.isShadowMaterial?(_.color.value.copy(p.color),_.opacity.value=p.opacity):p.isShaderMaterial&&(p.uniformsNeedUpdate=!1)}function o(_,p){_.opacity.value=p.opacity,p.color&&_.diffuse.value.copy(p.color),p.emissive&&_.emissive.value.copy(p.emissive).multiplyScalar(p.emissiveIntensity),p.map&&(_.map.value=p.map,n(p.map,_.mapTransform)),p.alphaMap&&(_.alphaMap.value=p.alphaMap,n(p.alphaMap,_.alphaMapTransform)),p.bumpMap&&(_.bumpMap.value=p.bumpMap,n(p.bumpMap,_.bumpMapTransform),_.bumpScale.value=p.bumpScale,p.side===hn&&(_.bumpScale.value*=-1)),p.normalMap&&(_.normalMap.value=p.normalMap,n(p.normalMap,_.normalMapTransform),_.normalScale.value.copy(p.normalScale),p.side===hn&&_.normalScale.value.negate()),p.displacementMap&&(_.displacementMap.value=p.displacementMap,n(p.displacementMap,_.displacementMapTransform),_.displacementScale.value=p.displacementScale,_.displacementBias.value=p.displacementBias),p.emissiveMap&&(_.emissiveMap.value=p.emissiveMap,n(p.emissiveMap,_.emissiveMapTransform)),p.specularMap&&(_.specularMap.value=p.specularMap,n(p.specularMap,_.specularMapTransform)),p.alphaTest>0&&(_.alphaTest.value=p.alphaTest);const T=e.get(p),w=T.envMap,S=T.envMapRotation;w&&(_.envMap.value=w,ns.copy(S),ns.x*=-1,ns.y*=-1,ns.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(ns.y*=-1,ns.z*=-1),_.envMapRotation.value.setFromMatrix4(P4.makeRotationFromEuler(ns)),_.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===hn&&_.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 D4(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;T<a;T++)if(r.indexOf(T)===-1)return r.push(T),T;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(T){const w=s[T.id],S=T.uniforms,I=T.__cache;t.bindBuffer(t.UNIFORM_BUFFER,w);for(let P=0,D=S.length;P<D;P++){const R=Array.isArray(S[P])?S[P]:[S[P]];for(let E=0,g=R.length;E<g;E++){const F=R[E];if(m(F,P,E,I)===!0){const O=F.__offset,$=Array.isArray(F.value)?F.value:[F.value];let j=0;for(let re=0;re<$.length;re++){const q=$[re],ae=y(q);typeof q=="number"||typeof q=="boolean"?(F.__data[0]=q,t.bufferSubData(t.UNIFORM_BUFFER,O+j,F.__data)):q.isMatrix3?(F.__data[0]=q.elements[0],F.__data[1]=q.elements[1],F.__data[2]=q.elements[2],F.__data[3]=0,F.__data[4]=q.elements[3],F.__data[5]=q.elements[4],F.__data[6]=q.elements[5],F.__data[7]=0,F.__data[8]=q.elements[6],F.__data[9]=q.elements[7],F.__data[10]=q.elements[8],F.__data[11]=0):(q.toArray(F.__data,j),j+=ae.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,O,F.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function m(T,w,S,I){const P=T.value,D=w+"_"+S;if(I[D]===void 0)return typeof P=="number"||typeof P=="boolean"?I[D]=P:I[D]=P.clone(),!0;{const R=I[D];if(typeof P=="number"||typeof P=="boolean"){if(R!==P)return I[D]=P,!0}else if(R.equals(P)===!1)return R.copy(P),!0}return!1}function b(T){const w=T.uniforms;let S=0;const I=16;for(let D=0,R=w.length;D<R;D++){const E=Array.isArray(w[D])?w[D]:[w[D]];for(let g=0,F=E.length;g<F;g++){const O=E[g],$=Array.isArray(O.value)?O.value:[O.value];for(let j=0,re=$.length;j<re;j++){const q=$[j],ae=y(q),G=S%I,fe=G%ae.boundary,ye=G+fe;S+=fe,ye!==0&&I-ye<ae.storage&&(S+=I-ye),O.__data=new Float32Array(ae.storage/Float32Array.BYTES_PER_ELEMENT),O.__offset=S,S+=ae.storage}}}const P=S%I;return P>0&&(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 I4{constructor(e={}){const{canvas:n=rU(),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=ki,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const S=this;let I=!1;this._outputColorSpace=wn;let P=0,D=0,R=null,E=-1,g=null;const F=new It,O=new It;let $=null;const j=new lt(0);let re=0,q=n.width,ae=n.height,G=1,fe=null,ye=null;const De=new It(0,0,q,ae),Be=new It(0,0,q,ae);let Je=!1;const ce=new vd;let N=!1,le=!1;const Y=new Tt,ue=new Tt,Oe=new L,Se=new It,Ne={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Le=!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${ad}`),n.addEventListener("webglcontextlost",de,!1),n.addEventListener("webglcontextrestored",Re,!1),n.addEventListener("webglcontextcreationerror",Ce,!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,_e,Q,M,v,U,B,X,H,ge,pe,be,Me,he,Ae,Xe,He,Ie,Ye,Ge,gt,z;function Te(){ie=new $z(x),ie.init(),Ge=new E4(x,ie),te=new Uz(x,ie,e,Ge),ne=new S4(x,ie),te.reverseDepthBuffer&&h&&ne.buffers.depth.setReversed(!0),_e=new Wz(x),Q=new c4,M=new M4(x,ie,ne,Q,te,Ge,_e),v=new Nz(S),U=new Vz(S),B=new KU(x),gt=new Fz(x,B),X=new Hz(x,B,_e,gt),H=new jz(x,X,B,_e),He=new Xz(x,te,M),he=new Oz(Q),ge=new l4(S,v,U,ie,te,gt,he),pe=new R4(S,Q),be=new u4,Me=new g4(ie),Xe=new Iz(S,v,U,ne,H,m,l),Ae=new y4(S,H,te),z=new D4(x,_e,te,ne),Ie=new Lz(x,ie,_e),Ye=new Gz(x,ie,_e),_e.programs=ge.programs,S.capabilities=te,S.extensions=ie,S.properties=Q,S.renderLists=be,S.shadowMap=Ae,S.state=ne,S.info=_e}Te();const oe=new A4(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(F)},this.getViewport=function(C){return C.copy(De)},this.setViewport=function(C,k,K,J){C.isVector4?De.set(C.x,C.y,C.z,C.w):De.set(C,k,K,J),ne.viewport(F.copy(De).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===pd||ve===fd||ve===hd}if(V){const ve=R.texture.type,Ee=ve===ti||ve===bs||ve===rr||ve===ar||ve===dd||ve===ud,Fe=Xe.getClearColor(),Ue=Xe.getClearAlpha(),Ze=Fe.r,qe=Fe.g,Ve=Fe.b;Ee?(b[0]=Ze,b[1]=qe,b[2]=Ve,b[3]=Ue,x.clearBufferuiv(x.COLOR,0,b)):(y[0]=Ze,y[1]=qe,y[2]=Ve,y[3]=Ue,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",Re,!1),n.removeEventListener("webglcontextcreationerror",Ce,!1),Xe.dispose(),be.dispose(),Me.dispose(),Q.dispose(),v.dispose(),U.dispose(),H.dispose(),gt.dispose(),z.dispose(),ge.dispose(),oe.dispose(),oe.removeEventListener("sessionstart",Td),oe.removeEventListener("sessionend",Cd),Wi.stop()};function de(C){C.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),I=!0}function Re(){console.log("THREE.WebGLRenderer: Context Restored."),I=!1;const C=_e.autoReset,k=Ae.enabled,K=Ae.autoUpdate,J=Ae.needsUpdate,V=Ae.type;Te(),_e.autoReset=C,Ae.enabled=k,Ae.autoUpdate=K,Ae.needsUpdate=J,Ae.type=V}function Ce(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,Fe=Xp(C,k,K,J,V);ne.setMaterial(J,Ee);let Ue=K.index,Ze=1;if(J.wireframe===!0){if(Ue=X.getWireframeAttribute(K),Ue===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)),Ue!==null?(ut=Math.max(ut,0),mt=Math.min(mt,Ue.count)):Ve!=null&&(ut=Math.max(ut,0),mt=Math.min(mt,Ve.count));const Lt=mt-ut;if(Lt<0||Lt===1/0)return;gt.setup(V,J,Fe,K,Ue);let Dt,ht=Ie;if(Ue!==null&&(Dt=B.get(Ue),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)oa("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,Pn=Ue?B.get(Ue).bytesPerElement:1,Ts=Q.get(J).currentProgram.getUniforms();for(let pn=0;pn<_t;pn++)Ts.setValue(x,"_gl_DrawID",pn),ht.render(We[pn]/Pn,Gt[pn])}else if(V.isInstancedMesh)ht.renderInstances(ut,Lt,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,Lt,Gt)}else ht.render(ut,Lt)};function vt(C,k,K){C.transparent===!0&&C.side===On&&C.forceSinglePass===!1?(C.side=hn,C.needsUpdate=!0,gr(C,k,K),C.side=$i,C.needsUpdate=!0,gr(C,k,K),C.side=On):gr(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<ve.length;Ee++){const Fe=ve[Ee];vt(Fe,K,V),J.add(Fe)}else vt(ve,K,V),J.add(ve)}),p=w.pop(),J},this.compileAsync=function(C,k,K=null){const J=this.compile(C,k,K);return new Promise(V=>{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 An=null;function ni(C){An&&An(C)}function Td(){Wi.stop()}function Cd(){Wi.start()}const Wi=new Bp;Wi.setAnimationLoop(ni),typeof self!="undefined"&&Wi.setContext(self),this.setAnimationLoop=function(C){An=C,oe.setAnimationLoop(C),C===null?Wi.stop():Wi.start()},oe.addEventListener("sessionstart",Td),oe.addEventListener("sessionend",Cd),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&&Ha(ve,k,-1/0,S.sortObjects)}Ha(C,k,0,S.sortObjects),_.finish(),S.sortObjects===!0&&_.sort(fe,ye),Le=oe.enabled===!1||oe.isPresenting===!1||oe.hasDepthSensing()===!1,Le&&Xe.addToRenderList(_,C),this.info.render.frame++,N===!0&&he.beginShadows();const K=p.state.shadowsArray;Ae.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,Fe=ve.length;Ee<Fe;Ee++){const Ue=ve[Ee];Pd(J,V,C,Ue)}Le&&Xe.render(C);for(let Ee=0,Fe=ve.length;Ee<Fe;Ee++){const Ue=ve[Ee];Ad(_,C,Ue,Ue.viewport)}}else V.length>0&&Pd(J,V,C,k),Le&&Xe.render(C),Ad(_,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 Ha(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=H.update(C),Fe=C.material;Fe.visible&&_.push(C,Ee,Fe,K,Se.z,null)}}else if((C.isMesh||C.isLine||C.isPoints)&&(!C.frustumCulled||ce.intersectsObject(C))){const Ee=H.update(C),Fe=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(Fe)){const Ue=Ee.groups;for(let Ze=0,qe=Ue.length;Ze<qe;Ze++){const Ve=Ue[Ze],ut=Fe[Ve.materialIndex];ut&&ut.visible&&_.push(C,Ee,ut,K,Se.z,Ve)}}else Fe.visible&&_.push(C,Ee,Fe,K,Se.z,null)}}const ve=C.children;for(let Ee=0,Fe=ve.length;Ee<Fe;Ee++)Ha(ve[Ee],k,K,J)}function Ad(C,k,K,J){const V=C.opaque,ve=C.transmissive,Ee=C.transparent;p.setupLightsView(K),N===!0&&he.setGlobalState(S.clippingPlanes,K),J&&ne.viewport(F.copy(J)),V.length>0&&_r(V,k,K),ve.length>0&&_r(ve,k,K),Ee.length>0&&_r(Ee,k,K),ne.buffers.depth.setTest(!0),ne.buffers.depth.setMask(!0),ne.buffers.color.setMask(!0),ne.setPolygonOffset(!1)}function Pd(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 ys(1,1,{generateMipmaps:!0,type:ie.has("EXT_color_buffer_half_float")||ie.has("EXT_color_buffer_float")?fr:ti,minFilter:ms,samples:4,stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ft.workingColorSpace}));const ve=p.state.transmissionRenderTarget[J.id],Ee=J.viewport||F;ve.setSize(Ee.z*S.transmissionResolutionScale,Ee.w*S.transmissionResolutionScale);const Fe=S.getRenderTarget();S.setRenderTarget(ve),S.getClearColor(j),re=S.getClearAlpha(),re<1&&S.setClearColor(16777215,.5),S.clear(),Le&&Xe.render(K);const Ue=S.toneMapping;S.toneMapping=ki;const Ze=J.viewport;if(J.viewport!==void 0&&(J.viewport=void 0),p.setupLightsView(J),N===!0&&he.setGlobalState(S.clippingPlanes,J),_r(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;Ve<ut;Ve++){const mt=k[Ve],Lt=mt.object,Dt=mt.geometry,ht=mt.material,We=mt.group;if(ht.side===On&&Lt.layers.test(J.layers)){const Gt=ht.side;ht.side=hn,ht.needsUpdate=!0,Rd(Lt,K,J,Dt,ht,We),ht.side=Gt,ht.needsUpdate=!0,qe=!0}}qe===!0&&(M.updateMultisampleRenderTarget(ve),M.updateRenderTargetMipmap(ve))}S.setRenderTarget(Fe),S.setClearColor(j,re),Ze!==void 0&&(J.viewport=Ze),S.toneMapping=Ue}function _r(C,k,K){const J=k.isScene===!0?k.overrideMaterial:null;for(let V=0,ve=C.length;V<ve;V++){const Ee=C[V],Fe=Ee.object,Ue=Ee.geometry,Ze=Ee.group;let qe=Ee.material;qe.allowOverride===!0&&J!==null&&(qe=J),Fe.layers.test(K.layers)&&Rd(Fe,k,K,Ue,qe,Ze)}}function Rd(C,k,K,J,V,ve){C.onBeforeRender(S,k,K,J,V,ve),C.modelViewMatrix.multiplyMatrices(K.matrixWorldInverse,C.matrixWorld),C.normalMatrix.getNormalMatrix(C.modelViewMatrix),V.onBeforeRender(S,k,K,J,C,ve),V.transparent===!0&&V.side===On&&V.forceSinglePass===!1?(V.side=hn,V.needsUpdate=!0,S.renderBufferDirect(K,k,J,V,C,ve),V.side=$i,V.needsUpdate=!0,S.renderBufferDirect(K,k,J,V,C,ve),V.side=On):S.renderBufferDirect(K,k,J,V,C,ve),C.onAfterRender(S,k,K,J,V,ve)}function gr(C,k,K){k.isScene!==!0&&(k=Ne);const J=Q.get(C),V=p.state.lights,ve=p.state.shadowsArray,Ee=V.state.version,Fe=ge.getParameters(C,V.state,ve,k,K),Ue=ge.getProgramCacheKey(Fe);let Ze=J.programs;J.environment=C.isMeshStandardMaterial?k.environment:null,J.fog=k.fog,J.envMap=(C.isMeshStandardMaterial?U:v).get(C.envMap||J.environment),J.envMapRotation=J.environment!==null&&C.envMap===null?k.environmentRotation:C.envMapRotation,Ze===void 0&&(C.addEventListener("dispose",Qe),Ze=new Map,J.programs=Ze);let qe=Ze.get(Ue);if(qe!==void 0){if(J.currentProgram===qe&&J.lightsStateVersion===Ee)return Id(C,Fe),qe}else Fe.uniforms=ge.getUniforms(C),C.onBeforeCompile(Fe,S),qe=ge.acquireProgram(Fe,Ue),Ze.set(Ue,qe),J.uniforms=Fe.uniforms;const Ve=J.uniforms;return(!C.isShaderMaterial&&!C.isRawShaderMaterial||C.clipping===!0)&&(Ve.clippingPlanes=he.uniform),Id(C,Fe),J.needsLights=Yp(C),J.lightsStateVersion=Ee,J.needsLights&&(Ve.ambientLightColor.value=V.state.ambient,Ve.lightProbe.value=V.state.probe,Ve.directionalLights.value=V.state.directional,Ve.directionalLightShadows.value=V.state.directionalShadow,Ve.spotLights.value=V.state.spot,Ve.spotLightShadows.value=V.state.spotShadow,Ve.rectAreaLights.value=V.state.rectArea,Ve.ltc_1.value=V.state.rectAreaLTC1,Ve.ltc_2.value=V.state.rectAreaLTC2,Ve.pointLights.value=V.state.point,Ve.pointLightShadows.value=V.state.pointShadow,Ve.hemisphereLights.value=V.state.hemi,Ve.directionalShadowMap.value=V.state.directionalShadowMap,Ve.directionalShadowMatrix.value=V.state.directionalShadowMatrix,Ve.spotShadowMap.value=V.state.spotShadowMap,Ve.spotLightMatrix.value=V.state.spotLightMatrix,Ve.spotLightMap.value=V.state.spotLightMap,Ve.pointShadowMap.value=V.state.pointShadowMap,Ve.pointShadowMatrix.value=V.state.pointShadowMatrix),J.currentProgram=qe,J.uniformsList=null,qe}function Dd(C){if(C.uniformsList===null){const k=C.currentProgram.getUniforms();C.uniformsList=ra.seqWithValue(k.seq,C.uniforms)}return C.uniformsList}function Id(C,k){const K=Q.get(C);K.outputColorSpace=k.outputColorSpace,K.batching=k.batching,K.batchingColor=k.batchingColor,K.instancing=k.instancing,K.instancingColor=k.instancingColor,K.instancingMorph=k.instancingMorph,K.skinning=k.skinning,K.morphTargets=k.morphTargets,K.morphNormals=k.morphNormals,K.morphColors=k.morphColors,K.morphTargetsCount=k.morphTargetsCount,K.numClippingPlanes=k.numClippingPlanes,K.numIntersection=k.numClipIntersection,K.vertexAlphas=k.vertexAlphas,K.vertexTangents=k.vertexTangents,K.toneMapping=k.toneMapping}function Xp(C,k,K,J,V){k.isScene!==!0&&(k=Ne),M.resetTextureUnits();const ve=k.fog,Ee=J.isMeshStandardMaterial?k.environment:null,Fe=R===null?S.outputColorSpace:R.isXRRenderTarget===!0?R.texture.colorSpace:co,Ue=(J.isMeshStandardMaterial?U:v).get(J.envMap||Ee),Ze=J.vertexColors===!0&&!!K.attributes.color&&K.attributes.color.itemSize===4,qe=!!K.attributes.tangent&&(!!J.normalMap||J.anisotropy>0),Ve=!!K.morphAttributes.position,ut=!!K.morphAttributes.normal,mt=!!K.morphAttributes.color;let Lt=ki;J.toneMapped&&(R===null||R.isXRRenderTarget===!0)&&(Lt=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 sn=C===g&&J.id===E;he.setState(J,C,sn)}let _t=!1;J.version===We.__version?(We.needsLights&&We.lightsStateVersion!==Gt.state.version||We.outputColorSpace!==Fe||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!==Ue||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!==Lt||We.morphTargetsCount!==ht)&&(_t=!0):(_t=!0,We.__version=J.version);let Pn=We.currentProgram;_t===!0&&(Pn=gr(J,k,V));let Ts=!1,pn=!1,Mo=!1;const At=Pn.getUniforms(),yn=We.uniforms;if(ne.useProgram(Pn.program)&&(Ts=!0,pn=!0,Mo=!0),J.id!==E&&(E=J.id,pn=!0),Ts||g!==C){ne.buffers.depth.getReversed()?(Y.copy(C.projectionMatrix),lU(Y),cU(Y),At.setValue(x,"projectionMatrix",Y)):At.setValue(x,"projectionMatrix",C.projectionMatrix),At.setValue(x,"viewMatrix",C.matrixWorldInverse);const cn=At.map.cameraPosition;cn!==void 0&&cn.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,pn=!0,Mo=!0)}if(V.isSkinnedMesh){At.setOptional(x,V,"bindMatrix"),At.setOptional(x,V,"bindMatrixInverse");const sn=V.skeleton;sn&&(sn.boneTexture===null&&sn.computeBoneTexture(),At.setValue(x,"boneTexture",sn.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 xn=K.morphAttributes;if((xn.position!==void 0||xn.normal!==void 0||xn.color!==void 0)&&He.update(V,K,Pn),(pn||We.receiveShadow!==V.receiveShadow)&&(We.receiveShadow=V.receiveShadow,At.setValue(x,"receiveShadow",V.receiveShadow)),J.isMeshGouraudMaterial&&J.envMap!==null&&(yn.envMap.value=Ue,yn.flipEnvMap.value=Ue.isCubeTexture&&Ue.isRenderTargetTexture===!1?-1:1),J.isMeshStandardMaterial&&J.envMap===null&&k.environment!==null&&(yn.envMapIntensity.value=k.environmentIntensity),pn&&(At.setValue(x,"toneMappingExposure",S.toneMappingExposure),We.needsLights&&jp(yn,Mo),ve&&J.fog===!0&&pe.refreshFogUniforms(yn,ve),pe.refreshMaterialUniforms(yn,J,G,ae,p.state.transmissionRenderTarget[C.id]),ra.upload(x,Dd(We),yn,M)),J.isShaderMaterial&&J.uniformsNeedUpdate===!0&&(ra.upload(x,Dd(We),yn,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 sn=J.uniformsGroups;for(let cn=0,Ga=sn.length;cn<Ga;cn++){const Xi=sn[cn];z.update(Xi,Pn),z.bind(Xi,Pn)}}return Pn}function jp(C,k){C.ambientLightColor.needsUpdate=k,C.lightProbe.needsUpdate=k,C.directionalLights.needsUpdate=k,C.directionalLightShadows.needsUpdate=k,C.pointLights.needsUpdate=k,C.pointLightShadows.needsUpdate=k,C.spotLights.needsUpdate=k,C.spotLightShadows.needsUpdate=k,C.rectAreaLights.needsUpdate=k,C.hemisphereLights.needsUpdate=k}function Yp(C){return C.isMeshLambertMaterial||C.isMeshToonMaterial||C.isMeshPhongMaterial||C.isMeshStandardMaterial||C.isShadowMaterial||C.isShaderMaterial&&C.lights===!0}this.getActiveCubeFace=function(){return P},this.getActiveMipmapLevel=function(){return D},this.getRenderTarget=function(){return R},this.setRenderTargetTextures=function(C,k,K){const J=Q.get(C);J.__autoAllocateDepthBuffer=C.resolveDepthBuffer===!1,J.__autoAllocateDepthBuffer===!1&&(J.__useRenderToTexture=!1),Q.get(C.texture).__webglTexture=k,Q.get(C.depthTexture).__webglTexture=J.__autoAllocateDepthBuffer?void 0:K,J.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(C,k){const K=Q.get(C);K.__webglFramebuffer=k,K.__useDefaultFramebuffer=k===void 0};const qp=x.createFramebuffer();this.setRenderTarget=function(C,k=0,K=0){R=C,P=k,D=K;let J=!0,V=null,ve=!1,Ee=!1;if(C){const Ue=Q.get(C);if(Ue.__useDefaultFramebuffer!==void 0)ne.bindFramebuffer(x.FRAMEBUFFER,null),J=!1;else if(Ue.__webglFramebuffer===void 0)M.setupRenderTarget(C);else if(Ue.__hasExternalTextures)M.rebindTextures(C,Q.get(C.texture).__webglTexture,Q.get(C.depthTexture).__webglTexture);else if(C.depthBuffer){const Ve=C.depthTexture;if(Ue.__boundDepthTexture!==Ve){if(Ve!==null&&Q.has(Ve)&&(C.width!==Ve.image.width||C.height!==Ve.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");M.setupDepthRenderbuffer(C)}}const Ze=C.texture;(Ze.isData3DTexture||Ze.isDataArrayTexture||Ze.isCompressedArrayTexture)&&(Ee=!0);const qe=Q.get(C).__webglFramebuffer;C.isWebGLCubeRenderTarget?(Array.isArray(qe[k])?V=qe[k][K]:V=qe[k],ve=!0):C.samples>0&&M.useMultisampledRTT(C)===!1?V=Q.get(C).__webglMultisampledFramebuffer:Array.isArray(qe)?V=qe[K]:V=qe,F.copy(C.viewport),O.copy(C.scissor),$=C.scissorTest}else F.copy(De).multiplyScalar(G).floor(),O.copy(Be).multiplyScalar(G).floor(),$=Je;if(K!==0&&(V=qp),ne.bindFramebuffer(x.FRAMEBUFFER,V)&&J&&ne.drawBuffers(C,V),ne.viewport(F),ne.scissor(O),ne.setScissorTest($),ve){const Ue=Q.get(C.texture);x.framebufferTexture2D(x.FRAMEBUFFER,x.COLOR_ATTACHMENT0,x.TEXTURE_CUBE_MAP_POSITIVE_X+k,Ue.__webglTexture,K)}else if(Ee){const Ue=Q.get(C.texture),Ze=k;x.framebufferTextureLayer(x.FRAMEBUFFER,x.COLOR_ATTACHMENT0,Ue.__webglTexture,K,Ze)}else if(C!==null&&K!==0){const Ue=Q.get(C.texture);x.framebufferTexture2D(x.FRAMEBUFFER,x.COLOR_ATTACHMENT0,x.TEXTURE_2D,Ue.__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 Fe=Q.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&Ee!==void 0&&(Fe=Fe[Ee]),Fe){ne.bindFramebuffer(x.FRAMEBUFFER,Fe);try{const Ue=C.texture,Ze=Ue.format,qe=Ue.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 Ue=R!==null?Q.get(R).__webglFramebuffer:null;ne.bindFramebuffer(x.FRAMEBUFFER,Ue)}}},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 Fe=Q.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&Ee!==void 0&&(Fe=Fe[Ee]),Fe)if(k>=0&&k<=C.width-J&&K>=0&&K<=C.height-V){ne.bindFramebuffer(x.FRAMEBUFFER,Fe);const Ue=C.texture,Ze=Ue.format,qe=Ue.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 aU(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,Fe=k!==null?k.y:0;M.setTexture2D(C,0),x.copyTexSubImage2D(x.TEXTURE_2D,K,0,0,Ee,Fe,V,ve),ne.unbindTexture()};const Zp=x.createFramebuffer(),Kp=x.createFramebuffer();this.copyTextureToTexture=function(C,k,K=null,J=null,V=0,ve=null){ve===null&&(V!==0?(oa("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),ve=V,V=0):ve=0);let Ee,Fe,Ue,Ze,qe,Ve,ut,mt,Lt;const Dt=C.isCompressedTexture?C.mipmaps[ve]:C.image;if(K!==null)Ee=K.max.x-K.min.x,Fe=K.max.y-K.min.y,Ue=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 xn=Math.pow(2,-V);Ee=Math.floor(Dt.width*xn),Fe=Math.floor(Dt.height*xn),C.isDataArrayTexture?Ue=Dt.depth:C.isData3DTexture?Ue=Math.floor(Dt.depth*xn):Ue=1,Ze=0,qe=0,Ve=0}J!==null?(ut=J.x,mt=J.y,Lt=J.z):(ut=0,mt=0,Lt=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),Pn=x.getParameter(x.UNPACK_IMAGE_HEIGHT),Ts=x.getParameter(x.UNPACK_SKIP_PIXELS),pn=x.getParameter(x.UNPACK_SKIP_ROWS),Mo=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,yn=k.isDataArrayTexture||k.isData3DTexture;if(C.isDepthTexture){const xn=Q.get(C),sn=Q.get(k),cn=Q.get(xn.__renderTarget),Ga=Q.get(sn.__renderTarget);ne.bindFramebuffer(x.READ_FRAMEBUFFER,cn.__webglFramebuffer),ne.bindFramebuffer(x.DRAW_FRAMEBUFFER,Ga.__webglFramebuffer);for(let Xi=0;Xi<Ue;Xi++)At&&(x.framebufferTextureLayer(x.READ_FRAMEBUFFER,x.COLOR_ATTACHMENT0,Q.get(C).__webglTexture,V,Ve+Xi),x.framebufferTextureLayer(x.DRAW_FRAMEBUFFER,x.COLOR_ATTACHMENT0,Q.get(k).__webglTexture,ve,Lt+Xi)),x.blitFramebuffer(Ze,qe,Ee,Fe,ut,mt,Ee,Fe,x.DEPTH_BUFFER_BIT,x.NEAREST);ne.bindFramebuffer(x.READ_FRAMEBUFFER,null),ne.bindFramebuffer(x.DRAW_FRAMEBUFFER,null)}else if(V!==0||C.isRenderTargetTexture||Q.has(C)){const xn=Q.get(C),sn=Q.get(k);ne.bindFramebuffer(x.READ_FRAMEBUFFER,Zp),ne.bindFramebuffer(x.DRAW_FRAMEBUFFER,Kp);for(let cn=0;cn<Ue;cn++)At?x.framebufferTextureLayer(x.READ_FRAMEBUFFER,x.COLOR_ATTACHMENT0,xn.__webglTexture,V,Ve+cn):x.framebufferTexture2D(x.READ_FRAMEBUFFER,x.COLOR_ATTACHMENT0,x.TEXTURE_2D,xn.__webglTexture,V),yn?x.framebufferTextureLayer(x.DRAW_FRAMEBUFFER,x.COLOR_ATTACHMENT0,sn.__webglTexture,ve,Lt+cn):x.framebufferTexture2D(x.DRAW_FRAMEBUFFER,x.COLOR_ATTACHMENT0,x.TEXTURE_2D,sn.__webglTexture,ve),V!==0?x.blitFramebuffer(Ze,qe,Ee,Fe,ut,mt,Ee,Fe,x.COLOR_BUFFER_BIT,x.NEAREST):yn?x.copyTexSubImage3D(Gt,ve,ut,mt,Lt+cn,Ze,qe,Ee,Fe):x.copyTexSubImage2D(Gt,ve,ut,mt,Ze,qe,Ee,Fe);ne.bindFramebuffer(x.READ_FRAMEBUFFER,null),ne.bindFramebuffer(x.DRAW_FRAMEBUFFER,null)}else yn?C.isDataTexture||C.isData3DTexture?x.texSubImage3D(Gt,ve,ut,mt,Lt,Ee,Fe,Ue,ht,We,Dt.data):k.isCompressedArrayTexture?x.compressedTexSubImage3D(Gt,ve,ut,mt,Lt,Ee,Fe,Ue,ht,Dt.data):x.texSubImage3D(Gt,ve,ut,mt,Lt,Ee,Fe,Ue,ht,We,Dt):C.isDataTexture?x.texSubImage2D(x.TEXTURE_2D,ve,ut,mt,Ee,Fe,ht,We,Dt.data):C.isCompressedTexture?x.compressedTexSubImage2D(x.TEXTURE_2D,ve,ut,mt,Dt.width,Dt.height,ht,Dt.data):x.texSubImage2D(x.TEXTURE_2D,ve,ut,mt,Ee,Fe,ht,We,Dt);x.pixelStorei(x.UNPACK_ROW_LENGTH,_t),x.pixelStorei(x.UNPACK_IMAGE_HEIGHT,Pn),x.pixelStorei(x.UNPACK_SKIP_PIXELS,Ts),x.pixelStorei(x.UNPACK_SKIP_ROWS,pn),x.pixelStorei(x.UNPACK_SKIP_IMAGES,Mo),ve===0&&k.generateMipmaps&&x.generateMipmap(Gt),ne.unbindTexture()},this.copyTextureToTexture3D=function(C,k,K=null,J=null,V=0){return oa('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(C,k,K,J,V)},this.initRenderTarget=function(C){Q.get(C).__webglFramebuffer===void 0&&M.setupRenderTarget(C)},this.initTexture=function(C){C.isCubeTexture?M.setTextureCube(C,0):C.isData3DTexture?M.setTexture3D(C,0):C.isDataArrayTexture||C.isCompressedArrayTexture?M.setTexture2DArray(C,0):M.setTexture2D(C,0),ne.unbindTexture()},this.resetState=function(){P=0,D=0,R=null,ne.reset(),gt.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return fi}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=ft._getDrawingBufferColorSpace(e),n.unpackColorSpace=ft._getUnpackColorSpace()}}const Nh={type:"change"},Ed={type:"start"},Wp={type:"end"},Xr=new Ba,zh=new Ii,F4=Math.cos(70*oU.DEG2RAD),kt=new L,dn=2*Math.PI,yt={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},Rl=1e-6;class L4 extends kp{constructor(e,n=null){super(e,n),this.state=yt.NONE,this.target=new L,this.cursor=new L,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Js.ROTATE,MIDDLE:Js.DOLLY,RIGHT:Js.PAN},this.touches={ONE:Xs.ROTATE,TWO:Xs.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new L,this._lastQuaternion=new Xt,this._lastTargetPosition=new L,this._quat=new Xt().setFromUnitVectors(e.up,new L(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new uh,this._sphericalDelta=new uh,this._scale=1,this._panOffset=new L,this._rotateStart=new Ke,this._rotateEnd=new Ke,this._rotateDelta=new Ke,this._panStart=new Ke,this._panEnd=new Ke,this._panDelta=new Ke,this._dollyStart=new Ke,this._dollyEnd=new Ke,this._dollyDelta=new Ke,this._dollyDirection=new L,this._mouse=new Ke,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=O4.bind(this),this._onPointerDown=U4.bind(this),this._onPointerUp=N4.bind(this),this._onContextMenu=G4.bind(this),this._onMouseWheel=B4.bind(this),this._onKeyDown=V4.bind(this),this._onTouchStart=$4.bind(this),this._onTouchMove=H4.bind(this),this._onMouseDown=z4.bind(this),this._onMouseMove=k4.bind(this),this._interceptControlDown=W4.bind(this),this._interceptControlUp=X4.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Nh),this.update(),this.state=yt.NONE}update(e=null){const n=this.object.position;kt.copy(n).sub(this.target),kt.applyQuaternion(this._quat),this._spherical.setFromVector3(kt),this.autoRotate&&this.state===yt.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let i=this.minAzimuthAngle,s=this.maxAzimuthAngle;isFinite(i)&&isFinite(s)&&(i<-Math.PI?i+=dn:i>Math.PI&&(i-=dn),s<-Math.PI?s+=dn:s>Math.PI&&(s-=dn),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 L(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 L(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):(Xr.origin.copy(this.object.position),Xr.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Xr.direction))<F4?this.object.lookAt(this.target):(zh.setFromNormalAndCoplanarPoint(this.object.up,this.target),Xr.intersectPlane(zh,this.target))))}else if(this.object.isOrthographicCamera){const r=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),r!==this.object.zoom&&(this.object.updateProjectionMatrix(),o=!0)}return this._scale=1,this._performCursorZoom=!1,o||this._lastPosition.distanceToSquared(this.object.position)>Rl||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Rl||this._lastTargetPosition.distanceToSquared(this.target)>Rl?(this.dispatchEvent(Nh),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?dn/60*this.autoRotateSpeed*e:dn/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(dn*this._rotateDelta.x/n.clientHeight),this._rotateUp(dn*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(dn*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(-dn*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(dn*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(-dn*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(dn*this._rotateDelta.x/n.clientHeight),this._rotateUp(dn*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<this._pointers.length;n++)if(this._pointers[n]==e.pointerId){this._pointers.splice(n,1);return}}_isTrackingPointer(e){for(let n=0;n<this._pointers.length;n++)if(this._pointers[n]==e.pointerId)return!0;return!1}_trackPointer(e){let n=this._pointerPositions[e.pointerId];n===void 0&&(n=new Ke,this._pointerPositions[e.pointerId]=n),n.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){const n=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[n]}_customWheelEvent(e){const n=e.deltaMode,i={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(n){case 1:i.deltaY*=16;break;case 2:i.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(i.deltaY*=10),i}}function U4(t){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(t)&&(this._addPointer(t),t.pointerType==="touch"?this._onTouchStart(t):this._onMouseDown(t)))}function O4(t){this.enabled!==!1&&(t.pointerType==="touch"?this._onTouchMove(t):this._onMouseMove(t))}function N4(t){switch(this._removePointer(t),this._pointers.length){case 0:this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(Wp),this.state=yt.NONE;break;case 1:const e=this._pointers[0],n=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:n.x,pageY:n.y});break}}function z4(t){let e;switch(t.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Js.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(t),this.state=yt.DOLLY;break;case Js.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=yt.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=yt.ROTATE}break;case Js.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(t),this.state=yt.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(t),this.state=yt.PAN}break;default:this.state=yt.NONE}this.state!==yt.NONE&&this.dispatchEvent(Ed)}function k4(t){switch(this.state){case yt.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(t);break;case yt.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(t);break;case yt.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(t);break}}function B4(t){this.enabled===!1||this.enableZoom===!1||this.state!==yt.NONE||(t.preventDefault(),this.dispatchEvent(Ed),this._handleMouseWheel(this._customWheelEvent(t)),this.dispatchEvent(Wp))}function V4(t){this.enabled!==!1&&this._handleKeyDown(t)}function $4(t){switch(this._trackPointer(t),this._pointers.length){case 1:switch(this.touches.ONE){case Xs.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(t),this.state=yt.TOUCH_ROTATE;break;case Xs.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(t),this.state=yt.TOUCH_PAN;break;default:this.state=yt.NONE}break;case 2:switch(this.touches.TWO){case Xs.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(t),this.state=yt.TOUCH_DOLLY_PAN;break;case Xs.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(t),this.state=yt.TOUCH_DOLLY_ROTATE;break;default:this.state=yt.NONE}break;default:this.state=yt.NONE}this.state!==yt.NONE&&this.dispatchEvent(Ed)}function H4(t){switch(this._trackPointer(t),this.state){case yt.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(t),this.update();break;case yt.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(t),this.update();break;case yt.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(t),this.update();break;case yt.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(t),this.update();break;default:this.state=yt.NONE}}function G4(t){this.enabled!==!1&&t.preventDefault()}function W4(t){t.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function X4(t){t.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}const is=new jU,Kt=new L,Ai=new L,Pt=new Xt,kh={X:new L(1,0,0),Y:new L(0,1,0),Z:new L(0,0,1)},Dl={type:"change"},Bh={type:"mouseDown",mode:null},Vh={type:"mouseUp",mode:null},$h={type:"objectChange"};class j4 extends kp{constructor(e,n=null){super(void 0,n);const i=new Q4(this);this._root=i;const s=new eB;this._gizmo=s,i.add(s);const o=new tB;this._plane=o,i.add(o);const r=this;function a(w,S){let I=S;Object.defineProperty(r,w,{get:function(){return I!==void 0?I:S},set:function(P){I!==P&&(I=P,o[w]=P,s[w]=P,r.dispatchEvent({type:w+"-changed",value:P}),r.dispatchEvent(Dl))}}),r[w]=S,o[w]=S,s[w]=S}a("camera",e),a("object",void 0),a("enabled",!0),a("axis",null),a("mode","translate"),a("translationSnap",null),a("rotationSnap",null),a("scaleSnap",null),a("space","world"),a("size",1),a("dragging",!1),a("showX",!0),a("showY",!0),a("showZ",!0),a("minX",-1/0),a("maxX",1/0),a("minY",-1/0),a("maxY",1/0),a("minZ",-1/0),a("maxZ",1/0);const l=new L,d=new L,u=new Xt,f=new Xt,h=new L,m=new Xt,b=new L,y=new L,_=new L,p=0,T=new L;a("worldPosition",l),a("worldPositionStart",d),a("worldQuaternion",u),a("worldQuaternionStart",f),a("cameraPosition",h),a("cameraQuaternion",m),a("pointStart",b),a("pointEnd",y),a("rotationAxis",_),a("rotationAngle",p),a("eye",T),this._offset=new L,this._startNorm=new L,this._endNorm=new L,this._cameraScale=new L,this._parentPosition=new L,this._parentQuaternion=new Xt,this._parentQuaternionInv=new Xt,this._parentScale=new L,this._worldScaleStart=new L,this._worldQuaternionInv=new Xt,this._worldScale=new L,this._positionStart=new L,this._quaternionStart=new Xt,this._scaleStart=new L,this._getPointer=Y4.bind(this),this._onPointerDown=Z4.bind(this),this._onPointerHover=q4.bind(this),this._onPointerMove=K4.bind(this),this._onPointerUp=J4.bind(this),n!==null&&this.connect(n)}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.style.touchAction="auto"}getHelper(){return this._root}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;e!==null&&is.setFromCamera(e,this.camera);const n=Il(this._gizmo.picker[this.mode],is);n?this.axis=n.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e!=null&&e.button!==0)&&this.axis!==null){e!==null&&is.setFromCamera(e,this.camera);const n=Il(this._plane,is,!0);n&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(n.point).sub(this.worldPositionStart)),this.dragging=!0,Bh.mode=this.mode,this.dispatchEvent(Bh)}}pointerMove(e){const n=this.axis,i=this.mode,s=this.object;let o=this.space;if(i==="scale"?o="local":(n==="E"||n==="XYZE"||n==="XYZ")&&(o="world"),s===void 0||n===null||this.dragging===!1||e!==null&&e.button!==-1)return;e!==null&&is.setFromCamera(e,this.camera);const r=Il(this._plane,is,!0);if(!!r){if(this.pointEnd.copy(r.point).sub(this.worldPositionStart),i==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),o==="local"&&n!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),n.indexOf("X")===-1&&(this._offset.x=0),n.indexOf("Y")===-1&&(this._offset.y=0),n.indexOf("Z")===-1&&(this._offset.z=0),o==="local"&&n!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),s.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(o==="local"&&(s.position.applyQuaternion(Pt.copy(this._quaternionStart).invert()),n.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),n.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),n.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.position.applyQuaternion(this._quaternionStart)),o==="world"&&(s.parent&&s.position.add(Kt.setFromMatrixPosition(s.parent.matrixWorld)),n.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),n.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),n.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.parent&&s.position.sub(Kt.setFromMatrixPosition(s.parent.matrixWorld)))),s.position.x=Math.max(this.minX,Math.min(this.maxX,s.position.x)),s.position.y=Math.max(this.minY,Math.min(this.maxY,s.position.y)),s.position.z=Math.max(this.minZ,Math.min(this.maxZ,s.position.z));else if(i==="scale"){if(n.search("XYZ")!==-1){let a=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(a*=-1),Ai.set(a,a,a)}else Kt.copy(this.pointStart),Ai.copy(this.pointEnd),Kt.applyQuaternion(this._worldQuaternionInv),Ai.applyQuaternion(this._worldQuaternionInv),Ai.divide(Kt),n.search("X")===-1&&(Ai.x=1),n.search("Y")===-1&&(Ai.y=1),n.search("Z")===-1&&(Ai.z=1);s.scale.copy(this._scaleStart).multiply(Ai),this.scaleSnap&&(n.search("X")!==-1&&(s.scale.x=Math.round(s.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),n.search("Y")!==-1&&(s.scale.y=Math.round(s.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),n.search("Z")!==-1&&(s.scale.z=Math.round(s.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(i==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const a=20/this.worldPosition.distanceTo(Kt.setFromMatrixPosition(this.camera.matrixWorld));let l=!1;n==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Kt.copy(this.rotationAxis).cross(this.eye))*a):(n==="X"||n==="Y"||n==="Z")&&(this.rotationAxis.copy(kh[n]),Kt.copy(kh[n]),o==="local"&&Kt.applyQuaternion(this.worldQuaternion),Kt.cross(this.eye),Kt.length()===0?l=!0:this.rotationAngle=this._offset.dot(Kt.normalize())*a),(n==="E"||l)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),o==="local"&&n!=="E"&&n!=="XYZE"?(s.quaternion.copy(this._quaternionStart),s.quaternion.multiply(Pt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),s.quaternion.copy(Pt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),s.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(Dl),this.dispatchEvent($h)}}pointerUp(e){e!==null&&e.button!==0||(this.dragging&&this.axis!==null&&(Vh.mode=this.mode,this.dispatchEvent(Vh)),this.dragging=!1,this.axis=null)}dispose(){this.disconnect(),this._root.dispose()}attach(e){return this.object=e,this._root.visible=!0,this}detach(){return this.object=void 0,this.axis=null,this._root.visible=!1,this}reset(){!this.enabled||this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(Dl),this.dispatchEvent($h),this.pointStart.copy(this.pointEnd))}getRaycaster(){return is}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function Y4(t){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:t.button};{const e=this.domElement.getBoundingClientRect();return{x:(t.clientX-e.left)/e.width*2-1,y:-(t.clientY-e.top)/e.height*2+1,button:t.button}}}function q4(t){if(!!this.enabled)switch(t.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(t));break}}function Z4(t){!this.enabled||(document.pointerLockElement||this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(t)),this.pointerDown(this._getPointer(t)))}function K4(t){!this.enabled||this.pointerMove(this._getPointer(t))}function J4(t){!this.enabled||(this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(t)))}function Il(t,e,n){const i=e.intersectObject(t,!0);for(let s=0;s<i.length;s++)if(i[s].object.visible||n)return i[s];return!1}const jr=new $n,xt=new L(0,1,0),Hh=new L(0,0,0),Gh=new Tt,Yr=new Xt,aa=new Xt,Wn=new L,Wh=new Tt,zo=new L(1,0,0),as=new L(0,1,0),ko=new L(0,0,1),qr=new L,Io=new L,Fo=new L;class Q4 extends Nt{constructor(e){super(),this.isTransformControlsRoot=!0,this.controls=e,this.visible=!1}updateMatrixWorld(e){const n=this.controls;n.object!==void 0&&(n.object.updateMatrixWorld(),n.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):n.object.parent.matrixWorld.decompose(n._parentPosition,n._parentQuaternion,n._parentScale),n.object.matrixWorld.decompose(n.worldPosition,n.worldQuaternion,n._worldScale),n._parentQuaternionInv.copy(n._parentQuaternion).invert(),n._worldQuaternionInv.copy(n.worldQuaternion).invert()),n.camera.updateMatrixWorld(),n.camera.matrixWorld.decompose(n.cameraPosition,n.cameraQuaternion,n._cameraScale),n.camera.isOrthographicCamera?n.camera.getWorldDirection(n.eye).negate():n.eye.copy(n.cameraPosition).sub(n.worldPosition).normalize(),super.updateMatrixWorld(e)}dispose(){this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}}class eB extends Nt{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new Va({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),n=new mr({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=e.clone();i.opacity=.15;const s=n.clone();s.opacity=.5;const o=e.clone();o.color.setHex(16711680);const r=e.clone();r.color.setHex(65280);const a=e.clone();a.color.setHex(255);const l=e.clone();l.color.setHex(16711680),l.opacity=.5;const d=e.clone();d.color.setHex(65280),d.opacity=.5;const u=e.clone();u.color.setHex(255),u.opacity=.5;const f=e.clone();f.opacity=.25;const h=e.clone();h.color.setHex(16776960),h.opacity=.25,e.clone().color.setHex(16776960);const b=e.clone();b.color.setHex(7895160);const y=new Wt(0,.04,.1,12);y.translate(0,.05,0);const _=new Ot(.08,.08,.08);_.translate(0,.04,0);const p=new tn;p.setAttribute("position",new Et([0,0,0,1,0,0],3));const T=new Wt(.0075,.0075,.5,3);T.translate(0,.25,0);function w(re,q){const ae=new us(re,.0075,3,64,q*Math.PI*2);return ae.rotateY(Math.PI/2),ae.rotateX(Math.PI/2),ae}function S(){const re=new tn;return re.setAttribute("position",new Et([0,0,0,1,1,1],3)),re}const I={X:[[new Pe(y,o),[.5,0,0],[0,0,-Math.PI/2]],[new Pe(y,o),[-.5,0,0],[0,0,Math.PI/2]],[new Pe(T,o),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new Pe(y,r),[0,.5,0]],[new Pe(y,r),[0,-.5,0],[Math.PI,0,0]],[new Pe(T,r)]],Z:[[new Pe(y,a),[0,0,.5],[Math.PI/2,0,0]],[new Pe(y,a),[0,0,-.5],[-Math.PI/2,0,0]],[new Pe(T,a),null,[Math.PI/2,0,0]]],XYZ:[[new Pe(new js(.1,0),f.clone()),[0,0,0]]],XY:[[new Pe(new Ot(.15,.15,.01),u.clone()),[.15,.15,0]]],YZ:[[new Pe(new Ot(.15,.15,.01),l.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new Pe(new Ot(.15,.15,.01),d.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},P={X:[[new Pe(new Wt(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new Pe(new Wt(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new Pe(new Wt(.2,0,.6,4),i),[0,.3,0]],[new Pe(new Wt(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new Pe(new Wt(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new Pe(new Wt(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new Pe(new js(.2,0),i)]],XY:[[new Pe(new Ot(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new Pe(new Ot(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new Pe(new Ot(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]]},D={START:[[new Pe(new js(.01,2),s),null,null,null,"helper"]],END:[[new Pe(new js(.01,2),s),null,null,null,"helper"]],DELTA:[[new di(S(),s),null,null,null,"helper"]],X:[[new di(p,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new di(p,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new di(p,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},R={XYZE:[[new Pe(w(.5,1),b),null,[0,Math.PI/2,0]]],X:[[new Pe(w(.5,.5),o)]],Y:[[new Pe(w(.5,.5),r),null,[0,0,-Math.PI/2]]],Z:[[new Pe(w(.5,.5),a),null,[0,Math.PI/2,0]]],E:[[new Pe(w(.75,1),h),null,[0,Math.PI/2,0]]]},E={AXIS:[[new di(p,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},g={XYZE:[[new Pe(new Sd(.25,10,8),i)]],X:[[new Pe(new us(.5,.1,4,24),i),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new Pe(new us(.5,.1,4,24),i),[0,0,0],[Math.PI/2,0,0]]],Z:[[new Pe(new us(.5,.1,4,24),i),[0,0,0],[0,0,-Math.PI/2]]],E:[[new Pe(new us(.75,.1,2,24),i)]]},F={X:[[new Pe(_,o),[.5,0,0],[0,0,-Math.PI/2]],[new Pe(T,o),[0,0,0],[0,0,-Math.PI/2]],[new Pe(_,o),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new Pe(_,r),[0,.5,0]],[new Pe(T,r)],[new Pe(_,r),[0,-.5,0],[0,0,Math.PI]]],Z:[[new Pe(_,a),[0,0,.5],[Math.PI/2,0,0]],[new Pe(T,a),[0,0,0],[Math.PI/2,0,0]],[new Pe(_,a),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new Pe(new Ot(.15,.15,.01),u),[.15,.15,0]]],YZ:[[new Pe(new Ot(.15,.15,.01),l),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new Pe(new Ot(.15,.15,.01),d),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new Pe(new Ot(.1,.1,.1),f.clone())]]},O={X:[[new Pe(new Wt(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new Pe(new Wt(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new Pe(new Wt(.2,0,.6,4),i),[0,.3,0]],[new Pe(new Wt(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new Pe(new Wt(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new Pe(new Wt(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new Pe(new Ot(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new Pe(new Ot(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new Pe(new Ot(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new Pe(new Ot(.2,.2,.2),i),[0,0,0]]]},$={X:[[new di(p,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new di(p,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new di(p,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function j(re){const q=new Nt;for(const ae in re)for(let G=re[ae].length;G--;){const fe=re[ae][G][0].clone(),ye=re[ae][G][1],De=re[ae][G][2],Be=re[ae][G][3],Je=re[ae][G][4];fe.name=ae,fe.tag=Je,ye&&fe.position.set(ye[0],ye[1],ye[2]),De&&fe.rotation.set(De[0],De[1],De[2]),Be&&fe.scale.set(Be[0],Be[1],Be[2]),fe.updateMatrix();const ce=fe.geometry.clone();ce.applyMatrix4(fe.matrix),fe.geometry=ce,fe.renderOrder=1/0,fe.position.set(0,0,0),fe.rotation.set(0,0,0),fe.scale.set(1,1,1),q.add(fe)}return q}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=j(I)),this.add(this.gizmo.rotate=j(R)),this.add(this.gizmo.scale=j(F)),this.add(this.picker.translate=j(P)),this.add(this.picker.rotate=j(g)),this.add(this.picker.scale=j(O)),this.add(this.helper.translate=j(D)),this.add(this.helper.rotate=j(E)),this.add(this.helper.scale=j($)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){const i=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:aa;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let s=[];s=s.concat(this.picker[this.mode].children),s=s.concat(this.gizmo[this.mode].children),s=s.concat(this.helper[this.mode].children);for(let o=0;o<s.length;o++){const r=s[o];r.visible=!0,r.rotation.set(0,0,0),r.position.copy(this.worldPosition);let a;if(this.camera.isOrthographicCamera?a=(this.camera.top-this.camera.bottom)/this.camera.zoom:a=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),r.scale.set(1,1,1).multiplyScalar(a*this.size/4),r.tag==="helper"){r.visible=!1,r.name==="AXIS"?(r.visible=!!this.axis,this.axis==="X"&&(Pt.setFromEuler(jr.set(0,0,0)),r.quaternion.copy(i).multiply(Pt),Math.abs(xt.copy(zo).applyQuaternion(i).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="Y"&&(Pt.setFromEuler(jr.set(0,0,Math.PI/2)),r.quaternion.copy(i).multiply(Pt),Math.abs(xt.copy(as).applyQuaternion(i).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="Z"&&(Pt.setFromEuler(jr.set(0,Math.PI/2,0)),r.quaternion.copy(i).multiply(Pt),Math.abs(xt.copy(ko).applyQuaternion(i).dot(this.eye))>.9&&(r.visible=!1)),this.axis==="XYZE"&&(Pt.setFromEuler(jr.set(0,Math.PI/2,0)),xt.copy(this.rotationAxis),r.quaternion.setFromRotationMatrix(Gh.lookAt(Hh,xt,as)),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(zo).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(as).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(ko).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(ko).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(zo).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(as).applyQuaternion(i).dot(this.eye))<.2&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1)):this.mode==="rotate"&&(Yr.copy(i),xt.copy(this.eye).applyQuaternion(Pt.copy(i).invert()),r.name.search("E")!==-1&&r.quaternion.setFromRotationMatrix(Gh.lookAt(this.eye,Hh,as)),r.name==="X"&&(Pt.setFromAxisAngle(zo,Math.atan2(-xt.y,xt.z)),Pt.multiplyQuaternions(Yr,Pt),r.quaternion.copy(Pt)),r.name==="Y"&&(Pt.setFromAxisAngle(as,Math.atan2(xt.x,xt.z)),Pt.multiplyQuaternions(Yr,Pt),r.quaternion.copy(Pt)),r.name==="Z"&&(Pt.setFromAxisAngle(ko,Math.atan2(xt.y,xt.x)),Pt.multiplyQuaternions(Yr,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 tB extends Pe{constructor(){super(new xo(1e5,1e5,2,2),new Va({visible:!1,wireframe:!0,side:On,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"),qr.copy(zo).applyQuaternion(n==="local"?this.worldQuaternion:aa),Io.copy(as).applyQuaternion(n==="local"?this.worldQuaternion:aa),Fo.copy(ko).applyQuaternion(n==="local"?this.worldQuaternion:aa),xt.copy(Io),this.mode){case"translate":case"scale":switch(this.axis){case"X":xt.copy(this.eye).cross(qr),Wn.copy(qr).cross(xt);break;case"Y":xt.copy(this.eye).cross(Io),Wn.copy(Io).cross(xt);break;case"Z":xt.copy(this.eye).cross(Fo),Wn.copy(Fo).cross(xt);break;case"XY":Wn.copy(Fo);break;case"YZ":Wn.copy(qr);break;case"XZ":xt.copy(Fo),Wn.copy(Io);break;case"XYZ":case"E":Wn.set(0,0,0);break}break;case"rotate":default:Wn.set(0,0,0)}Wn.length()===0?this.quaternion.copy(this.cameraQuaternion):(Wh.lookAt(Kt.set(0,0,0),Wn,xt),this.quaternion.setFromRotationMatrix(Wh)),super.updateMatrixWorld(e)}}let ss,Fn,li,En;const nB={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(){li.render(Fn,ss)},setSize(){li.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.x<this.x_min?this.x_min:t.x,t.y=t.y>this.y_max?this.y_max:t.y,t.y=t.y<this.y_min?this.y_min:t.y,t.z=t.z>this.z_max?this.z_max:t.z,t.z=t.z<this.z_min?this.z_min:t.z,t.a=1.8*t.a;let e={x:2e3*t.x/(this.x_max-this.x_min),y:2e3*t.y/(this.y_max-this.y_min),z:2e3*t.z/(this.z_max-this.z_min),a:t.a*(Math.PI/180)};En.position.z=1e3+e.x,En.position.x=1e3+e.y,En.position.y=100+e.z,En.rotation.set(Math.PI,e.a,0),this.render()}},mounted(){let t,e=this.$refs.container3d;Fn=new LU,Fn.background=new lt(15790320),ss=new gn(70,this.width/this.height,1,1e4),ss.rotation.set(-Math.PI/2,0,-Math.PI/2),ss.position.set(-300,1800,0),Fn.add(ss),Fn.add(new WU(15790320,3));const n=new HU(16777215,4.5);n.position.set(0,1500,200),n.angle=Math.PI*.2,n.decay=0,n.castShadow=!0,n.shadow.camera.near=200,n.shadow.camera.far=2e3,n.shadow.bias=-222e-6,n.shadow.mapSize.width=1024,n.shadow.mapSize.height=1024,Fn.add(n);const i=new xo(50,50),s=new NU({color:0,opacity:.2}),o=new Pe(i,s);o.position.y=-200,o.receiveShadow=!0,Fn.add(o);const r=new YU(2e3,20);r.position.y=0,r.material.opacity=.25,r.material.transparent=!0,Fn.add(r);const a=new qU(200);a.position.x=1e3,a.position.z=1e3,a.rotateY(Math.PI),Fn.add(a),li=new I4({antialias:!0}),li.setPixelRatio(window.devicePixelRatio),li.setSize(this.width,this.height),li.shadowMap.enabled=!0,e.appendChild(li.domElement);const l=new L4(ss,li.domElement);l.damping=.2,l.addEventListener("change",this.render),t=new j4(ss,li.domElement),t.addEventListener("change",this.render),t.addEventListener("dragging-changed",function(h){l.enabled=!h.value}),Fn.add(t.getHelper()),t.addEventListener("objectChange",function(){updateSplineOutline()});const d=new yd(50,200,4,1),u=new mr({color:16777215,transparent:!0,opacity:.5}),f=new zU({color:1401481,emissive:468276,side:On,flatShading:!0});En=new Oo,En.add(new bd(d,u)),En.add(new Pe(d,f)),Fn.add(En),En.rotateX(Math.PI),En.position.y=100,En.position.x=1e3,En.position.z=1e3,this.setPos(),this.render()},watch:{height(){this.setSize()},width(){this.setPos()},x(){this.setPos()},y(){this.setPos()},z(){this.setPos()},a(){this.setPos()}}},iB={class:"card mt-1"},sB=c("div",{class:"card-header"},"Vializer",-1),oB={class:"card-body"},rB={ref:"container3d",id:"container3d",class:"border p-0 m-0"};function aB(t,e,n,i,s,o){return W(),ee("div",iB,[sB,c("div",oB,[c("div",rB,null,512)])])}var lB=ct(nB,[["render",aB]]);const cB={props:["title","number","width","height"],data:function(){return{winStateClass:"",drag:!1,dragObject:this.dragObject,shiftX:this.shiftX,shiftY:this.shiftY,downX:this.downX,downY:this.downY}},computed:{windowRightOffset(){return 10+(this.number-1)*310}},methods:{toggleMinimize:function(){this.winStateClass==""?this.winStateClass="minimized":this.winStateClass=""},close(){this.$emit("close")},moveOnTop(){let t=document.getElementsByClassName("win"),e=0;for(let n of t)e=Math.max(e,n.style.zIndex),n.style.zIndex--;this.dragObject.style.zIndex=e},mousedownTitle(t){this.moveOnTop();let e=this.dragObject.getBoundingClientRect();this.shiftX=e.left,this.shiftY=e.top,t.type=="mousedown"?(this.downX=t.pageX,this.downY=t.pageY):t.type=="touchstart"&&(this.downX=t.touches[0].pageX,this.downY=t.touches[0].pageY),this.drag=!0},mouseupTitle(){this.drag=!1},dblclickTitle(){this.winStateClass=="minimized"&&(this.winStateClass="")},onMouseMove(t){if(this.drag==!0){let e=0,n=0;t.type=="mousemove"?(e=t.pageX,n=t.pageY):t.type=="touchmove"&&(e=t.touches[0].pageX,n=t.touches[0].pageY),this.dragObject.style.left=this.shiftX+(e-this.downX)+"px",this.dragObject.style.top=this.shiftY+(n-this.downY)+"px"}},setSize:function(){typeof this.width!="undefined"&&(this.dragObject.style.width=this.width+"px"),typeof this.height!="undefined"&&(this.dragObject.style.height=this.height+"px")}},mounted:function(){this.dragObject=this.$refs["win"+this.number],document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("touchmove",this.onMouseMove),this.setSize()},beforeUnmount:function(){document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("touchmove",this.onMouseMove)},watch:{width(){this.setSize()},height(){this.setSize()}}},dB=c("div",{class:"icon"},null,-1),uB={class:"title"},hB={class:"content"};function fB(t,e,n,i,s,o){return W(),ee("div",{class:je("win "+t.winStateClass),style:fo("z-index: 100; right: "+o.windowRightOffset+"px;"),ref:"win"+n.number,onClick:e[5]||(e[5]=r=>o.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())},[dB,c("div",uB,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",hB,[to(t.$slots,"default")])],6)}var pB=ct(cB,[["render",fB]]),mB={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)}}},_B={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 sendCommandsPool(t){console.log("sendCommandsPool Start");for(let e of t)await this.sendCommand(e);await this.sendCommands(["?"],!0),console.log("sendCommandsPool Stop")},async sendCommand(t){if(this.portIsOpened){t=="$H"&&(this.machineState.status="Homing");let e=Uint8Array.from(Array.from(t+`
  3740. `).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]))}}},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 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)})},pnpGoToZero_GCODE(){let t=[],e=parseFloat(this.settings.heads[0].safePosZ);return t.push(`G0 Z${e}`),t.push("G0 X0 Y0"),t.push("G0 Z0"),t},async pnpGoToZero(){let t=this.pnpGoToZero_GCODE();await this.sendCommands(t,!0)},pnpGoToParking_GCODE(){let t=[];return 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`),t},async pnpGoToParking(){let t=this.pnpGoToParking_GCODE();await this.sendCommands(t,!0)},pnpPumpOn_GCODE(){let t=[];return t.push(this.settings.pump.On),t.push("$G"),t},async pnpPumpOn(){let t=this.pnpPumpOn_GCODE();await this.sendCommands(t,!0)},pnpPumpOff_GCODE(){let t=[];return t.push(this.settings.pump.Off),t.push("$G"),t},async pnpPumpOff(){let t=this.pnpPumpOff_GCODE();await this.sendCommands(t,!0)},pnpValveOn_GCODE(t){let e=[];return e.push(`G04 P${t.pauseBeforeOn}`),e.push(t.valveOn),e.push(`G04 P${t.pauseAfterOn}`),e.push("$G"),e},async pnpValveOn(t){let e=this.pnpValveOn_GCODE(t);await this.sendCommands(e,!0)},pnpValveOff_GCODE(t){let e=[];return e.push(`G04 P${t.pauseBeforeOff}`),e.push(t.valveOff),e.push(`G04 P${t.pauseAfterOff}`),e.push("$G"),e},async pnpValveOff(t){let e=this.pnpValveOff_GCODE(t);await this.sendCommands(e,!0)},pnpLightOn_GCODE(t){let e=[];return e.push(this.settings.cams[t].lightOn),e.push("$G"),e},async pnpLightOn(t){let e=this.pnpLightOn_GCODE(t);await this.sendCommands(e,!0)},pnpLightOff_GCODE(t){let e=[];return e.push(this.settings.cams[t].lightOff),e.push("$G"),e},async pnpLightOff(t){let e=this.pnpLightOff_GCODE(t);await this.sendCommands(e,!0)},pnpSafetyUp_GCODE(t){let n=`G0 Z${parseFloat(this.settings.heads[0].safePosZ)}`;return isNaN(t)||(n=n+` A${t}`),[n]},async pnpSafetyUp(t){let e=this.pnpSafetyUp_GCODE(t);await this.sendCommands(e,!0)},pnpSafetyGoToXYZ_GCODE(t,e,n){let i=[];return i.push(...this.pnpSafetyUp_GCODE()),i.push(...this.pnpGoToXYZAF_GCODE(t,e,NaN,NaN,5500)),isNaN(n)||i.push(...this.pnpGoToXYZAF_GCODE(NaN,NaN,n,NaN,5500)),i},async pnpSafetyGoToXYZ(t,e,n){let i=this.pnpSafetyGoToXYZ_GCODE(t,e,n);await this.sendCommands(i,!0)},pnpGoToXYZA_GCODE(t,e,n,i){let s="G0";return isNaN(t)||(s=s+` X${t}`),isNaN(e)||(s=s+` Y${e}`),isNaN(n)||(s=s+` Z${n}`),isNaN(i)||(s=s+` A${i}`),[s]},async pnpGoToXYZA(t,e,n,i){let s=this.pnpGoToXYZA_GCODE(t,e,n,i);await this.sendCommands(s,!0)},pnpGoToXYZAF_GCODE(t,e,n,i,s=500){let o="G1";return isNaN(t)||(o=o+` X${t}`),isNaN(e)||(o=o+` Y${e}`),isNaN(n)||(o=o+` Z${n}`),isNaN(i)||(o=o+` A${i}`),isNaN(s)||(o=o+` F${s}`),[o]},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 t.type==2&&(e=t.pos.x,n=t.pos.y),{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)+1<parseInt(t.capacity))if(this.valvesState[e]==!1)i=parseFloat(t.pos.x)+parseFloat(t.step.x)*parseFloat(t.current),s=parseFloat(t.pos.y)+parseFloat(t.step.y)*parseFloat(t.current),o=parseFloat(t.pos.z)+parseFloat(t.step.z)*parseFloat(t.current),await this.pnpSafetyUp(0),await this.pnpSafetyGoToXYZ(i,s,o),await this.pnpValveOn(r),await this.pnpSafetyUp(),t.current=parseInt(t.current)+1;else return await st("Valve is On!","Warning","warning"),!1;else return await st("Feeder is empty","Warning","warning"),!1;if(t.type==1){await this.pnpSafetyUp(0);let a=[];for(let l of t.pathPoints)a.push(...this.pnpGoToXYZAF_GCODE(l.x,l.y,NaN,NaN,5500)),a.push(...this.pnpGoToXYZAF_GCODE(NaN,NaN,l.z,NaN,5500)),l.pick==!0&&a.push(...this.pnpValveOn_GCODE(r));console.log(a),await this.sendCommandsPool(a),await this.pnpSafetyUp()}if(t.type==2){let a=0;await this.pnpSafetyUp(0),await this.pnpLightOn(a),await this.pnpGoToFeederCam(t),await new Promise(f=>setTimeout(f,this.settings.cv[a].pauseBefore*1e3));let l=await this.getCVData(a),d,u=1e4;if(typeof l.objects!="undefined"&&typeof l.objects.rect!="undefined"){let f=parseFloat(t.pos.wx),h=parseFloat(t.pos.wy);for(let m of l.objects.rect){let b=Math.round(m.dx*1e3/this.settings.cams[a].ppmm)/1e3,y=Math.round(m.dy*1e3/this.settings.cams[a].ppmm)/1e3,_=Math.sqrt(b*b+y*y);Math.abs(b)<f&&Math.abs(y)<h&&_<u&&(d=Object.assign({},m),d.dxmm=b,d.dymm=y,u=_)}}if(d){let f=parseFloat(t.pos.x)-d.dxmm,h=parseFloat(t.pos.y)+d.dymm,m=parseFloat(t.pos.z)+parseFloat(t.elementHeight),b=-d.angle/360;await this.pnpSafetyGoToXYZ(f,h,m),await this.pnpValveOn(r),await this.pnpSafetyUp(),await this.pnpGoToXYZA(NaN,NaN,NaN,b)}else await st('Can not see element in feeder "'+t.name+'"!',"Warning","warning")}return!0}finally{this.pnpProcessing.runFlag=n}},async pnpAdjFeederPositionCV(t){let e=0;await this.pnpLightOn(e),await this.pnpGoToFeederCam(t),await new Promise(o=>setTimeout(o,this.settings.cv[e].pauseBefore*1e3));let n=await this.getCVData(e),i,s=1e4;if(typeof n.objects!="undefined"&&typeof n.objects.rect!="undefined")for(let o of n.objects.rect){let r=Math.round(o.dx*1e3/this.settings.cams[e].ppmm)/1e3,a=Math.round(o.dy*1e3/this.settings.cams[e].ppmm)/1e3,l=Math.sqrt(r*r+a*a);l<2&&l<s&&(i=Object.assign({},o),i.dxmm=r,i.dymm=a,s=l)}if(i){if(t.type==0&&(t.pos.x=(parseFloat(t.pos.x)-i.dxmm).toFixed(3),t.pos.y=(parseFloat(t.pos.y)+i.dymm).toFixed(3)),t.type==1){let o=0;for(let r of t.pathPoints)r.x=(parseFloat(r.x)-i.dxmm).toFixed(3),r.pick==!0&&(o=r.y);for(let r of t.pathPoints)r.y==o&&(r.y=(parseFloat(r.y)+i.dymm).toFixed(3))}await this.pnpGoToFeederCam(t)}else await st('Can not see element in feeder "'+t.name+'"!',"Warning","warning");await this.pnpLightOff(e)},async pnpAdjFeedersPositionCV(t){for(let e of t)e.active==!0&&await this.pnpAdjFeederPositionCV(e)},async pnpAdjPCBPositionCV(t){let e=0,n=[];for(let i of t.elements)i.caption.toLowerCase().includes("fiducial")&&n.push(i);if(n.length>0){let i=0,s=0,o=0;for(let r of n){await this.pnpLightOn(e),await this.pnpGoToElementCam(r),await new Promise(u=>setTimeout(u,2*this.settings.cv[e].pauseBefore*1e3));let a=await this.getCVData(e);await this.pnpLightOff(e);let l,d=1e4;if(typeof a.objects!="undefined"&&typeof a.objects.circle!="undefined")for(let u of a.objects.circle){let f=Math.round(u.dx*1e3/this.settings.cams[e].ppmm)/1e3,h=Math.round(u.dy*1e3/this.settings.cams[e].ppmm)/1e3,m=Math.sqrt(f*f+h*h);m<2&&m<d&&(l=Object.assign({},u),l.dxmm=f,l.dymm=h,d=m)}l?(i+=l.dxmm,s+=l.dymm,o+=1):await st("Can not see Fiducials on the PCB!","Warning","warning")}o>0&&(t.pcb.pos.x=(i/o).toFixed(3),t.pcb.pos.y=(s/o).toFixed(3))}else await st("Fiducials is not found! One or more elements must contain 'FIDUCIAL' in field 'Caption'!","Warning","warning")},async pnpAdjPosition(){let t=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let e=1,n,i,s,o,r;n=parseFloat(this.settings.cams[e].pos.x),i=parseFloat(this.settings.cams[e].pos.y),s=parseFloat(this.settings.cams[e].pos.z),o=this.machinePos.a,await this.pnpGoToBottomCam();for(let u=0;u<3;u++)if(await new Promise(f=>setTimeout(f,this.settings.cv[e].pauseBefore*1e3)),r=await this.getCVData(e),typeof r.objects.object!="undefined"){let f=Math.round(r.objects.object.dx*1e3/this.settings.cams[e].ppmm)/1e3,h=Math.round(r.objects.object.dy*1e3/this.settings.cams[e].ppmm)/1e3;n=n-f,i=i-h;let m=r.objects.object.angle_degrees;m<-45&&(m=90+m),m>45&&(m=-90+m),m=m/360,o=o-m,Math.abs(f)<5&&Math.abs(h)<5&&Math.abs(m)<.25&&await this.pnpGoToXYZA(n,i,NaN,o)}await this.pnpLightOff(e);let a=parseFloat(this.machinePos.x)-parseFloat(this.settings.cams[e].pos.x),l=parseFloat(this.machinePos.y)-parseFloat(this.settings.cams[e].pos.y);return{x:a,y:l}}finally{this.pnpProcessing.runFlag=t}},async pnpDropIntoBasket(){let t=this.pnpProcessing.runFlag;try{this.pnpProcessing.runFlag=!0;let e=this.settings.basket.pos.x,n=this.settings.basket.pos.y,i=this.settings.basket.pos.z;await this.pnpSafetyGoToXYZ(e,n,i);for(let s of this.settings.heads)await this.pnpValveOff(s);await this.pnpSafetyUp(0)}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.pnpAdjPosition();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 st("Autocalibration is failed! Nozzle not found!","Error","error");return}}await this.pnpLightOff(n),await this.pnpSafetyUp(0),await st("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},pnpGetEmptyNozzlePlace(){let t=null;if(this.settings.heads[0].nozzle==-1)return!0;for(let e of this.settings.nozzlesHolder.places)if(e.nozzleId==-1){t=e;break}return t==null?(st("Not found the empty place!","Error","error"),null):t},async pnpPullOffNozzle(t){let e=this.pnpGetEmptyNozzlePlace();if(e===!0)return!0;if(e==null)return!1;let n=[];for(let s=e.points.length-1;s>=0;s--){let o=e.points[s];s==e.points.length-1?n.push(...this.pnpSafetyGoToXYZ_GCODE(o.x,o.y,o.z)):n.push(...this.pnpGoToXYZAF_GCODE(o.x,o.y,o.z,NaN,t.feed))}let i=parseFloat(this.settings.heads[0].safePosZ);return n.push(...this.pnpGoToXYZAF_GCODE(NaN,NaN,i,NaN,5500)),await this.sendCommandsPool(n),e.nozzleId=this.settings.heads[0].nozzle,this.settings.heads[0].nozzle=-1,!0},async pnpPutOnNozzle(t){if(t.nozzleId==-1){st("Specified Nozzle place is empty!","Error","error");return}if(t.points.length==0){st("Not specified the path to take!","Error","error");return}if(await this.pnpPullOffNozzle(t)==!1)return;console.log(t);let e=[];for(let n=0;n<t.points.length;n++){let i=t.points[n];console.log(i),n==0?e.push(...this.pnpSafetyGoToXYZ_GCODE(i.x,i.y,i.z)):e.push(...this.pnpGoToXYZAF_GCODE(i.x,i.y,i.z,NaN,t.feed))}await this.sendCommandsPool(e),this.settings.heads[0].nozzle=t.nozzleId,t.nozzleId=-1,await this.pnpSafetyUp(0)},async pnpJobStart(t=null){let e=[];t!==null?e=this.project.elements.slice(this.project.elements.indexOf(t),this.project.elements.length):e=this.project.elements;for(let s of e)if(s.active==!0&&s.nozzleId!=this.settings.heads[0].nozzle&&this.getNozzlePlace(s.nozzleId)==null){let r=this.getNozzle(s.nozzleId);st(`Can't start Job because the nozzles holder doesn't have the required nozzle '${r.name}'`,"Warning","warning");return}let n=this.getNozzle(this.settings.heads[0].nozzle),i=this.getNozzlePlace(-1);await Un(`Head is use the Nozzle '${n.name}'. Empty place in the Nozzles Holder is '${i.name}'. Is it correct? Shall we begin?`,"Please check").then(async s=>{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 st("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 st("The Job has been canceled!","Canceled","warning"),this.pnpProcessingReset()):(this.pnpProcessing.message="Completed",this.pnpProcessing.element=null,await st('The project "'+this.project.name+'" has been completed',"Completed","success"),this.pnpProcessing.message="")}finally{this.pnpProcessing.runFlag=e}}}};const gB={mixins:[mB,_B,Ms],components:{Loading:tL,DialogWrapper:Ty,Window:pB,Vializer3D:lB,ControllerState:xv,ControllerMovingNew:dy,ControllerConsole:xy,ControllerGCode:ux,ControllerSettings:wx,CamerasSettings:dM,CVSettings:cE,HeadsSettings:nw,PumpSettings:gw,NozzlesSettings:RT,NozzlesHolderSettings:YC,BasketSettings:bA,ParkingSettings:GA,FeedersSettings:_p,PCBTableSettings:h3,Projects:qF},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+`
  3741. `},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),st(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,st("Calibration complete successfully. Don't forget to apply settings.","Calibration","success")):st(n.msg,"Error","error")},n=>{console.log(n),st(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),st(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"?st("Settings applied successfully","Settings","success"):n.error?st(n.error,"Error","error"):st("Unexpected Error!","Error","error")},n=>{console.log(n),st(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),st(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),st(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),st(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),st(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"?st('File "'+e+'" saved successfully',"Settings","success"):s.error?st(s.error,"Error","error"):st("Unexpected Error!","Error","error")},s=>{console.log(s),st(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}}},vB={class:"float-end tool-buttons"},bB={class:"row border bg-light machine-pos"},yB={class:"col-3 p-1"},xB={class:"col-3 p-1"},SB={class:"col-3 p-1"},MB={class:"col-3 p-1"},EB=["src"],wB=["width","height"],TB={class:"form-check form-switch"},CB=["checked"],AB=c("label",{class:"form-check-label",for:"topLight"},"Light",-1),PB=["src"],RB={class:"form-check form-switch"},DB=["checked"],IB=c("label",{class:"form-check-label",for:"bottomLight"},"Light",-1),FB=["src"],LB={class:"row m-0"},UB={class:"col form-check form-switch"},OB=["checked"],NB=c("label",{class:"form-check-label",for:"topLight"},"Light",-1),zB={class:"col form-check form-switch"},kB=c("label",{class:"form-check-label",for:"machineView"},"Machine vision",-1),BB=["src"],VB={class:"row m-0"},$B={class:"col form-check form-switch"},HB=["checked"],GB=c("label",{class:"form-check-label",for:"bottomLight"},"Light",-1),WB={class:"col form-check form-switch"},XB=c("label",{class:"form-check-label",for:"machineView"},"Machine vision",-1),jB={class:"nav nav-tabs"},YB={class:"nav-item"},qB={class:"nav-item"},ZB={class:"nav-item"},KB={class:"row mt-2"},JB={class:"col-md-auto left-column"},QB={class:"col-md central-column"},e5={class:"row"},t5={class:"col"},n5={class:"row"},i5={class:"col"},s5={class:"col-auto"},o5={class:"row mt-2"},r5={class:"col"},a5={class:"row flex-nowrap"},l5={class:"col-auto"},c5={class:"d-flex flex-column"},d5={class:"nav nav-pills flex-column"},u5={class:"nav-item"},h5={class:"nav-item"},f5={class:"nav-item"},p5={class:"nav-item"},m5={class:"nav-item"},_5={class:"nav-item"},g5={class:"nav-item"},v5={class:"nav-item"},b5={class:"nav-item"},y5={class:"nav-item"},x5={class:"nav-item"},S5={class:"col settings"},M5={class:"row mt-2"},E5={class:"col"},w5=c("hr",null,null,-1);function T5(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",vB,[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",bB,[c("div",yB," X: "+ze(o.machinePos.x),1),c("div",xB," Y: "+ze(o.machinePos.y),1),c("div",SB," Z: "+ze(o.machinePos.z),1),c("div",MB," 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,EB)):ot("",!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:fo("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,wB)):ot("",!0),c("div",TB,[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,CB),AB])]),_:1},8,["title","width","height"]),[[ln,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,PB)):ot("",!0),c("div",RB,[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,DB),IB])]),_:1},8,["title","width","height"]),[[ln,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,FB),c("div",LB,[c("div",UB,[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,OB),NB]),c("div",zB,[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),[[Kn,s.CVLikeMachineView]]),kB])])]),_:1},8,["width","height"]),[[ln,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,BB),c("div",VB,[c("div",$B,[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,HB),GB]),c("div",WB,[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),[[Kn,s.CVLikeMachineView]]),XB])])]),_:1},8,["width","height"]),[[ln,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),[[ln,s.showWindow[4]]]),c("ul",jB,[c("li",YB,[c("a",{class:je("nav-link"+(s.tab==0?" active":"")),onClick:e[27]||(e[27]=g=>s.tab=0)},"Manual control",2)]),c("li",qB,[c("a",{class:je("nav-link"+(s.tab==1?" active":"")),onClick:e[28]||(e[28]=g=>s.tab=1)},"Settings",2)]),c("li",ZB,[c("a",{class:je("nav-link"+(s.tab==2?" active":"")),onClick:e[29]||(e[29]=g=>s.tab=2)},"Projects",2)])]),se(c("div",KB,[c("div",JB,[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",QB,[c("div",e5,[c("div",t5,[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",n5,[c("div",i5,[ke(h,{consoleLog:s.consoleLog,disabled:!o.controlsEnabledUnderAlarm,onSendCommand:e[37]||(e[37]=g=>t.sendCommandUI([g]))},null,8,["consoleLog","disabled"])])])]),c("div",s5,[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),[[ln,s.tab==0]]),se(c("div",o5,[c("div",r5,[c("div",a5,[c("div",l5,[c("div",c5,[c("ul",d5,[c("li",u5,[c("a",{class:je("nav-link"+(s.tabSettings==0?" active":"")),onClick:e[38]||(e[38]=g=>s.tabSettings=0)},"Controller",2)]),c("li",h5,[c("a",{class:je("nav-link"+(s.tabSettings==1?" active":"")),onClick:e[39]||(e[39]=g=>s.tabSettings=1)},"Cameras",2)]),c("li",f5,[c("a",{class:je("nav-link"+(s.tabSettings==2?" active":"")),onClick:e[40]||(e[40]=g=>s.tabSettings=2)},"Computer Vision",2)]),c("li",p5,[c("a",{class:je("nav-link"+(s.tabSettings==3?" active":"")),onClick:e[41]||(e[41]=g=>s.tabSettings=3)},"Nozzles",2)]),c("li",m5,[c("a",{class:je("nav-link"+(s.tabSettings==4?" active":"")),onClick:e[42]||(e[42]=g=>s.tabSettings=4)},"Nozzles Holder",2)]),c("li",_5,[c("a",{class:je("nav-link"+(s.tabSettings==5?" active":"")),onClick:e[43]||(e[43]=g=>s.tabSettings=5)},"Heads",2)]),c("li",g5,[c("a",{class:je("nav-link"+(s.tabSettings==6?" active":"")),onClick:e[44]||(e[44]=g=>s.tabSettings=6)},"Pump",2)]),c("li",v5,[c("a",{class:je("nav-link"+(s.tabSettings==7?" active":"")),onClick:e[45]||(e[45]=g=>s.tabSettings=7)},"Parking",2)]),c("li",b5,[c("a",{class:je("nav-link"+(s.tabSettings==8?" active":"")),onClick:e[46]||(e[46]=g=>s.tabSettings=8)},"Basket",2)]),c("li",y5,[c("a",{class:je("nav-link"+(s.tabSettings==9?" active":"")),onClick:e[47]||(e[47]=g=>s.tabSettings=9)},"Feeders",2)]),c("li",x5,[c("a",{class:je("nav-link"+(s.tabSettings==10?" active":"")),onClick:e[48]||(e[48]=g=>s.tabSettings=10)},"PCB Table",2)])])])]),c("div",S5,[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"])):ot("",!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"])):ot("",!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"])):ot("",!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"])):ot("",!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"])):ot("",!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"])):ot("",!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"])):ot("",!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"])):ot("",!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"])):ot("",!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,onAdjFeederPositionCV:e[66]||(e[66]=g=>t.pnpAdjFeederPositionCV(g)),onGoToFeeder:e[67]||(e[67]=g=>t.pnpGoToFeeder(g)),onGoToFeederCam:e[68]||(e[68]=g=>t.pnpGoToFeederCam(g)),onPickFromFeeder:e[69]||(e[69]=g=>t.pnpPickFromFeeder(g)),onAdjPosition:e[70]||(e[70]=g=>t.pnpAdjPosition(g)),onDropIntoBasket:e[71]||(e[71]=g=>t.pnpDropIntoBasket(g)),onSaveFeeders:e[72]||(e[72]=g=>o.saveJSON("","feeders",this.feeders))},null,8,["settings","cases","machineState","machinePos","feeders","disabled","loading"])):ot("",!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[73]||(e[73]=g=>o.applaySettings())},null,8,["pcbtable","machineState","machinePos","loading"])):ot("",!0)])])])],512),[[ln,s.tab==1]]),se(c("div",M5,[c("div",E5,[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[74]||(e[74]=g=>o.setSMDCase(g)),onAdjFeederPositionCV:e[75]||(e[75]=g=>t.pnpAdjFeederPositionCV(g)),onAdjFeedersPositionCV:e[76]||(e[76]=g=>t.pnpAdjFeedersPositionCV(g)),onAdjPCBPositionCV:e[77]||(e[77]=g=>t.pnpAdjPCBPositionCV(g)),onGoToFeeder:e[78]||(e[78]=g=>t.pnpGoToFeeder(g)),onGoToFeederCam:e[79]||(e[79]=g=>t.pnpGoToFeederCam(g)),onPickFromFeeder:e[80]||(e[80]=g=>t.pnpPickFromFeeder(g)),onAdjPosition:e[81]||(e[81]=g=>t.pnpAdjPosition(g)),onDropIntoBasket:e[82]||(e[82]=g=>t.pnpDropIntoBasket(g)),onGoToElement:e[83]||(e[83]=g=>t.pnpGoToElement(g)),onGoToElementCam:e[84]||(e[84]=g=>t.pnpGoToElementCam(g)),onPlaceElement:e[85]||(e[85]=g=>t.pnpPlaceElement(g)),onSetFeeders:e[86]||(e[86]=g=>o.setFeedersFromProject()),onNewProject:e[87]||(e[87]=g=>o.newProject()),onLoadProject:e[88]||(e[88]=g=>o.loadProject()),onSaveProject:e[89]||(e[89]=g=>o.saveProject()),onRenameProject:e[90]||(e[90]=g=>o.renameProject(g)),onDeleteProject:e[91]||(e[91]=g=>o.deleteProject(g)),onRun:e[92]||(e[92]=g=>t.pnpJobStart()),onRunFrom:e[93]||(e[93]=g=>t.pnpJobStart(g)),onPause:e[94]||(e[94]=g=>o.pnpProcessingPause()),onStop:e[95]||(e[95]=g=>o.pnpProcessingStop())},null,8,["project","projects_list","disabled","loading","settings","cases","default_feeders","machineState","machinePos","pnpProcessing"])])],512),[[ln,s.tab==2]]),w5])}var C5=ct(gB,[["render",T5]]);const A5=w0({history:Vg(),routes:[{path:"/",name:"home",component:C5},{path:"/about",name:"about",component:()=>G0(()=>import("./AboutView.95c4c286.js"),[])}]}),wd=yg(V0);wd.use(A5);wd.use(Sy);wd.mount("#app");export{ct as _,c as a,ee as c,W as o};