-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbundle.js
7 lines (7 loc) · 874 KB
/
bundle.js
1
2
3
4
5
6
7
var app=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function r(t){t.forEach(e)}function i(t){return"function"==typeof t}function o(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}let a,s;function l(t,e){return a||(a=document.createElement("a")),a.href=e,t===a.href}function c(t){return null==t?"":t}function u(t,e){t.appendChild(e)}function h(t,e,n){t.insertBefore(e,n||null)}function d(t){t.parentNode.removeChild(t)}function p(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function f(t){return document.createElement(t)}function m(t){return document.createTextNode(t)}function g(){return m(" ")}function v(){return m("")}function y(t,e,n,r){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)}function x(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function b(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function w(t,e){t.value=null==e?"":e}function _(t,e,n,r){null===n?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}class M{constructor(){this.e=this.n=null}c(t){this.h(t)}m(t,e,n=null){this.e||(this.e=f(e.nodeName),this.t=e,this.c(t)),this.i(n)}h(t){this.e.innerHTML=t,this.n=Array.from(this.e.childNodes)}i(t){for(let e=0;e<this.n.length;e+=1)h(this.t,this.n[e],t)}p(t){this.d(),this.h(t),this.i(this.a)}d(){this.n.forEach(d)}}function S(t){s=t}function T(t){(function(){if(!s)throw new Error("Function called outside component initialization");return s})().$$.on_mount.push(t)}const E=[],C=[],L=[],A=[],R=Promise.resolve();let P=!1;function N(t){L.push(t)}function D(t){A.push(t)}const k=new Set;let I=0;function O(){const t=s;do{for(;I<E.length;){const t=E[I];I++,S(t),z(t.$$)}for(S(null),E.length=0,I=0;C.length;)C.pop()();for(let t=0;t<L.length;t+=1){const e=L[t];k.has(e)||(k.add(e),e())}L.length=0}while(E.length);for(;A.length;)A.pop()();P=!1,k.clear(),S(t)}function z(t){if(null!==t.fragment){t.update(),r(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(N)}}const F=new Set;let B;function U(){B={r:0,c:[],p:B}}function H(){B.r||r(B.c),B=B.p}function W(t,e){t&&t.i&&(F.delete(t),t.i(e))}function G(t,e,n,r){if(t&&t.o){if(F.has(t))return;F.add(t),B.c.push((()=>{F.delete(t),r&&(n&&t.d(1),r())})),t.o(e)}}function V(t,e,n){const r=t.$$.props[e];void 0!==r&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function j(t){t&&t.c()}function $(t,n,o,a){const{fragment:s,on_mount:l,on_destroy:c,after_update:u}=t.$$;s&&s.m(n,o),a||N((()=>{const n=l.map(e).filter(i);c?c.push(...n):r(n),t.$$.on_mount=[]})),u.forEach(N)}function q(t,e){const n=t.$$;null!==n.fragment&&(r(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function X(t,e){-1===t.$$.dirty[0]&&(E.push(t),P||(P=!0,R.then(O)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function Y(e,i,o,a,l,c,u,h=[-1]){const p=s;S(e);const f=e.$$={fragment:null,ctx:null,props:c,update:t,not_equal:l,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(i.context||(p?p.$$.context:[])),callbacks:n(),dirty:h,skip_bound:!1,root:i.target||p.$$.root};u&&u(f.root);let m=!1;if(f.ctx=o?o(e,i.props||{},((t,n,...r)=>{const i=r.length?r[0]:n;return f.ctx&&l(f.ctx[t],f.ctx[t]=i)&&(!f.skip_bound&&f.bound[t]&&f.bound[t](i),m&&X(e,t)),n})):[],f.update(),m=!0,r(f.before_update),f.fragment=!!a&&a(f.ctx),i.target){if(i.hydrate){const t=function(t){return Array.from(t.childNodes)}(i.target);f.fragment&&f.fragment.l(t),t.forEach(d)}else f.fragment&&f.fragment.c();i.intro&&W(e.$$.fragment),$(e,i.target,i.anchor,i.customElement),O()}S(p)}class Z{$destroy(){q(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}var J={eng:"Monitoring & Countering Narratives Online",fra:"Contrer les Discours en Ligne",por:"Contando Narrativas Online",ara:"مكافحة الروايات على الإنترنت"},K={eng:"Towards a complete blueprint",fra:"Vers un mode d'emploi",por:"Para um manual",ara:"نحو دليل"},Q={eng:"For any inquiries contact us at <a href='mailto:[email protected]' target='_blank'>[email protected]</a>",fra:"Pour nous rejoindre, contactez nous au <a href='mailto:[email protected]' target='_blank'>[email protected]</a>",por:"Para mais informações contacte-nos em <a href='mailto:[email protected]' target='_blank'>[email protected]</a>",ara:"<a href='mailto:[email protected]' target='_blank'>[email protected]</a> للاستفسارات اتصل بنا على"},tt={eng:"Executive Summary",fra:"Résumé",por:"Sumário executivo",ara:"ملخص تنفيذي"},et={eng:"Introduction",fra:"Introduction",por:"Introduçao",ara:"مقدمة"},nt={eng:"Methodology",fra:"Méthodologie",por:"Metodologia",ara:"المنهجية"},rt={eng:"Key Findings",fra:"Principales conclusions",por:"Principais conclusões",ara:"النتائج الرئيسية"},it={eng:"Lessons Learned",fra:"Leçons apprises",por:"Lições aprendidas",ara:"الدروس المستفادة"},ot={eng:"Conclusion",fra:"Conclusion",por:"Conclusao",ara:"استنتاج"},at={eng:"Results",fra:"Résultats",por:"Resultados",ara:"نتائج"},st={eng:"Limitations",fra:"Limites",por:"Limitações",ara:"محددات"},lt={eng:"",fra:"",por:"",ara:""},ct={eng:"Error",fra:"Erreur",por:"Error",ara:"Error"},ut={title:J,subtitle:K,footer:Q,title_executive_summary:tt,title_introduction:et,title_methodology:nt,title_key_findings:rt,title_lessons_learned:it,title_conclusion:ot,title_results:at,title_limitations:st,template:lt,error:ct},ht=Object.freeze({__proto__:null,title:J,subtitle:K,footer:Q,title_executive_summary:tt,title_introduction:et,title_methodology:nt,title_key_findings:rt,title_lessons_learned:it,title_conclusion:ot,title_results:at,title_limitations:st,template:lt,error:ct,default:ut}),dt=[{key:"eng",name:"English",mobile:"en"}],pt="/projects/seshat/",ft="http://en5kq3sxdcnf5cvirydxs5hwpbivosfzu3kxtxvttrsbibaznpk4ljqd.onion",mt=[[{key:"contains_disinfo",value:"yes"}]];function gt(t,e){return function(t){return null!=t&&"string"==typeof t&&""!==t&&dt.map((t=>t.key)).includes(t)}(t)?void 0===ht[e]?(console.error(`'${e}' does not exist in strings`),"error"):void 0===ht[e][t]?(console.error(`'${e}' in the '${t}' language does not exist in strings`),"error"):ht[e][t]:(console.error(`the '${t}' language is not supported`),"error")}function vt(){try{return!!/Android|webOS|iPhone|iPad|iPod|pocket|psp|kindle|avantgo|blazer|midori|Tablet|Palm|maemo|plucker|phone|BlackBerry|symbian|IEMobile|mobile|ZuneWP7|Windows Phone|Opera Mini/i.test(navigator.userAgent)}catch(t){return console.log("Error in isMobile"),!1}}function yt(t,e,n){const r=t.slice();return r[3]=e[n],r}function xt(t,e,n){const r=t.slice();return r[3]=e[n],r}function bt(t){let e,n,r,i,o,a,s,c,v,w,M,S,T=gt(t[0],"title")+"",E=dt,C=[];for(let e=0;e<E.length;e+=1)C[e]=_t(yt(t,E,e));return{c(){e=f("div"),n=f("div"),r=f("img"),o=g(),a=f("div"),s=f("p"),c=m(T),v=g(),w=f("div");for(let t=0;t<C.length;t+=1)C[t].c();x(r,"id","logo"),x(r,"alt","logo"),l(r.src,i=pt+"assets/logo.png")||x(r,"src","/projects/seshat/assets/logo.png"),x(r,"class","svelte-1irj8uj"),_(n,"left","16px"),_(n,"cursor","pointer"),x(n,"class","svelte-1irj8uj"),x(s,"class","svelte-1irj8uj"),_(a,"left","0px"),_(a,"right","0px"),_(a,"text-align","center"),x(a,"class","svelte-1irj8uj"),_(w,"right","16px"),x(w,"class","svelte-1irj8uj"),x(e,"class","center-container svelte-1irj8uj")},m(i,l){h(i,e,l),u(e,n),u(n,r),u(e,o),u(e,a),u(a,s),u(s,c),u(e,v),u(e,w);for(let t=0;t<C.length;t+=1)C[t].m(w,null);M||(S=y(n,"click",t[2]),M=!0)},p(t,e){if(1&e&&T!==(T=gt(t[0],"title")+"")&&b(c,T),0&e){let n;for(E=dt,n=0;n<E.length;n+=1){const r=yt(t,E,n);C[n]?C[n].p(r,e):(C[n]=_t(r),C[n].c(),C[n].m(w,null))}for(;n<C.length;n+=1)C[n].d(1);C.length=E.length}},d(t){t&&d(e),p(C,t),M=!1,S()}}}function wt(t){let e,n,r,i,o,a,s,c,m=dt,v=[];for(let e=0;e<m.length;e+=1)v[e]=Mt(xt(t,m,e));return{c(){e=f("div"),n=f("div"),r=f("img"),o=g(),a=f("div");for(let t=0;t<v.length;t+=1)v[t].c();x(r,"id","logo"),x(r,"alt","logo"),l(r.src,i=pt+"assets/logo.png")||x(r,"src","/projects/seshat/assets/logo.png"),x(r,"class","svelte-1irj8uj"),_(n,"left","16px"),_(n,"cursor","pointer"),x(n,"class","svelte-1irj8uj"),_(a,"right","16px"),x(a,"class","svelte-1irj8uj"),x(e,"class","center-container svelte-1irj8uj")},m(i,l){h(i,e,l),u(e,n),u(n,r),u(e,o),u(e,a);for(let t=0;t<v.length;t+=1)v[t].m(a,null);s||(c=y(n,"click",t[1]),s=!0)},p(t,e){if(0&e){let n;for(m=dt,n=0;n<m.length;n+=1){const r=xt(t,m,n);v[n]?v[n].p(r,e):(v[n]=Mt(r),v[n].c(),v[n].m(a,null))}for(;n<v.length;n+=1)v[n].d(1);v.length=m.length}},d(t){t&&d(e),p(v,t),s=!1,c()}}}function _t(e){let n,r,i,o=e[3].name+"";return{c(){n=f("a"),r=m(o),x(n,"href",i=Tt(e[3].key)),x(n,"class","svelte-1irj8uj")},m(t,e){h(t,n,e),u(n,r)},p:t,d(t){t&&d(n)}}}function Mt(e){let n,r,i,o=e[3].mobile+"";return{c(){n=f("a"),r=m(o),x(n,"href",i=Tt(e[3].key)),x(n,"class","svelte-1irj8uj")},m(t,e){h(t,n,e),u(n,r)},p:t,d(t){t&&d(n)}}}function St(e){let n;let r=(vt()?wt:bt)(e);return{c(){n=f("div"),r.c(),x(n,"class","header svelte-1irj8uj")},m(t,e){h(t,n,e),r.m(n,null)},p(t,[e]){r.p(t,e)},i:t,o:t,d(t){t&&d(n),r.d()}}}function Tt(t){const e=window.location.href;return e.includes("lang=")?`${e.split("?")[0]}?lang=${t}`:`${e}?lang=${t}`}function Et(t,e,n){let{lang:r}=e;return t.$$set=t=>{"lang"in t&&n(0,r=t.lang)},[r,()=>window.open("https://www.charitableanalytics.org/","_blank"),()=>window.open("https://www.charitableanalytics.org/","_blank")]}class Ct extends Z{constructor(t){super(),Y(this,t,Et,St,o,{lang:0})}}function Lt(e){let n,r,i,o,a,s,l,c,p=gt(e[0],"footer")+"";return{c(){n=f("div"),r=f("hr"),i=g(),o=f("p"),a=g(),s=f("p"),l=f("a"),c=m("PGP Public Key"),x(r,"class","svelte-15nefoa"),x(o,"class","italic svelte-15nefoa"),_(o,"margin-top","8px"),_(o,"margin-bottom","8px"),x(l,"href",pt+"assets/files/pgp.pub.txt"),x(l,"target","_blank"),_(s,"margin-bottom","8px"),x(s,"class","svelte-15nefoa"),x(n,"class","footer-up svelte-15nefoa")},m(t,e){h(t,n,e),u(n,r),u(n,i),u(n,o),o.innerHTML=p,u(n,a),u(n,s),u(s,l),u(l,c)},p(t,[e]){1&e&&p!==(p=gt(t[0],"footer")+"")&&(o.innerHTML=p)},i:t,o:t,d(t){t&&d(n)}}}function At(t,e,n){let{lang:r}=e;return t.$$set=t=>{"lang"in t&&n(0,r=t.lang)},[r]}class Rt extends Z{constructor(t){super(),Y(this,t,At,Lt,o,{lang:0})}}
/**
* @license
* Copyright 2010-2021 Three.js Authors
* SPDX-License-Identifier: MIT
*/const Pt=100,Nt=301,Dt=302,kt=306,It=1e3,Ot=1001,zt=1002,Ft=1003,Bt=1006,Ut=1008,Ht=1009,Wt=1012,Gt=1014,Vt=1015,jt=1016,$t=1020,qt=1022,Xt=1023,Yt=1026,Zt=1027,Jt=2300,Kt=2301,Qt=2302,te=2400,ee=2401,ne=2402,re=2500,ie=3e3,oe=3001,ae=3007,se=3002,le=7680,ce=35044,ue=35048,he="300 es";class de{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,r=n.length;e<r;e++)n[e].call(this,t);t.target=null}}}let pe=1234567;const fe=Math.PI/180,me=180/Math.PI,ge=[];for(let t=0;t<256;t++)ge[t]=(t<16?"0":"")+t.toString(16);const ve="undefined"!=typeof crypto&&"randomUUID"in crypto;function ye(){if(ve)return crypto.randomUUID().toUpperCase();const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(ge[255&t]+ge[t>>8&255]+ge[t>>16&255]+ge[t>>24&255]+"-"+ge[255&e]+ge[e>>8&255]+"-"+ge[e>>16&15|64]+ge[e>>24&255]+"-"+ge[63&n|128]+ge[n>>8&255]+"-"+ge[n>>16&255]+ge[n>>24&255]+ge[255&r]+ge[r>>8&255]+ge[r>>16&255]+ge[r>>24&255]).toUpperCase()}function xe(t,e,n){return Math.max(e,Math.min(n,t))}function be(t,e){return(t%e+e)%e}function we(t,e,n){return(1-n)*t+n*e}function _e(t){return 0==(t&t-1)&&0!==t}function Me(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}var Se=Object.freeze({__proto__:null,DEG2RAD:fe,RAD2DEG:me,generateUUID:ye,clamp:xe,euclideanModulo:be,mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},inverseLerp:function(t,e,n){return t!==e?(n-t)/(e-t):0},lerp:we,damp:function(t,e,n,r){return we(t,e,1-Math.exp(-n*r))},pingpong:function(t,e=1){return e-Math.abs(be(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(pe=t%2147483647),pe=16807*pe%2147483647,(pe-1)/2147483646},degToRad:function(t){return t*fe},radToDeg:function(t){return t*me},isPowerOfTwo:_e,ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:Me,setQuaternionFromProperEuler:function(t,e,n,r,i){const o=Math.cos,a=Math.sin,s=o(n/2),l=a(n/2),c=o((e+r)/2),u=a((e+r)/2),h=o((e-r)/2),d=a((e-r)/2),p=o((r-e)/2),f=a((r-e)/2);switch(i){case"XYX":t.set(s*u,l*h,l*d,s*c);break;case"YZY":t.set(l*d,s*u,l*h,s*c);break;case"ZXZ":t.set(l*h,l*d,s*u,s*c);break;case"XZX":t.set(s*u,l*f,l*p,s*c);break;case"YXY":t.set(l*p,s*u,l*f,s*c);break;case"ZYZ":t.set(l*f,l*p,s*u,s*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}});class Te{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,o=this.y-t.y;return this.x=i*n-o*r+t.x,this.y=i*r+o*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}Te.prototype.isVector2=!0;class Ee{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,r,i,o,a,s,l){const c=this.elements;return c[0]=t,c[1]=r,c[2]=a,c[3]=e,c[4]=i,c[5]=s,c[6]=n,c[7]=o,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,o=n[0],a=n[3],s=n[6],l=n[1],c=n[4],u=n[7],h=n[2],d=n[5],p=n[8],f=r[0],m=r[3],g=r[6],v=r[1],y=r[4],x=r[7],b=r[2],w=r[5],_=r[8];return i[0]=o*f+a*v+s*b,i[3]=o*m+a*y+s*w,i[6]=o*g+a*x+s*_,i[1]=l*f+c*v+u*b,i[4]=l*m+c*y+u*w,i[7]=l*g+c*x+u*_,i[2]=h*f+d*v+p*b,i[5]=h*m+d*y+p*w,i[8]=h*g+d*x+p*_,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],c=t[8];return e*o*c-e*a*l-n*i*c+n*a*s+r*i*l-r*o*s}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],c=t[8],u=c*o-a*l,h=a*s-c*i,d=l*i-o*s,p=e*u+n*h+r*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=u*f,t[1]=(r*l-c*n)*f,t[2]=(a*n-r*o)*f,t[3]=h*f,t[4]=(c*e-r*s)*f,t[5]=(r*i-a*e)*f,t[6]=d*f,t[7]=(n*s-l*e)*f,t[8]=(o*e-n*i)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,r,i,o,a){const s=Math.cos(i),l=Math.sin(i);return this.set(n*s,n*l,-n*(s*o+l*a)+o+t,-r*l,r*s,-r*(-l*o+s*a)+a+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),r=this.elements,i=r[0],o=r[3],a=r[6],s=r[1],l=r[4],c=r[7];return r[0]=e*i+n*s,r[3]=e*o+n*l,r[6]=e*a+n*c,r[1]=-n*i+e*s,r[4]=-n*o+e*l,r[7]=-n*a+e*c,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<9;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}function Ce(t){if(0===t.length)return-1/0;let e=t[0];for(let n=1,r=t.length;n<r;++n)t[n]>e&&(e=t[n]);return e}function Le(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Ae(t,e=0){let n=3735928559^e,r=1103547991^e;for(let e,i=0;i<t.length;i++)e=t.charCodeAt(i),n=Math.imul(n^e,2654435761),r=Math.imul(r^e,1597334677);return n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),4294967296*(2097151&r)+(n>>>0)}let Re;Ee.prototype.isMatrix3=!0;class Pe{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===Re&&(Re=Le("canvas")),Re.width=t.width,Re.height=t.height;const n=Re.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Re}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}}let Ne=0;class De extends de{constructor(t=De.DEFAULT_IMAGE,e=De.DEFAULT_MAPPING,n=1001,r=1001,i=1006,o=1008,a=1023,s=1009,l=1,c=3e3){super(),Object.defineProperty(this,"id",{value:Ne++}),this.uuid=ye(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=o,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=s,this.offset=new Te(0,0),this.repeat=new Te(1,1),this.center=new Te(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ee,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1}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(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this.userData=JSON.parse(JSON.stringify(t.userData)),this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,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,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const r=this.image;if(void 0===r.uuid&&(r.uuid=ye()),!e&&void 0===t.images[r.uuid]){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(ke(r[t].image)):e.push(ke(r[t]))}else e=ke(r);t.images[r.uuid]={uuid:r.uuid,url:e}}n.image=r.uuid}return"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case It:t.x=t.x-Math.floor(t.x);break;case Ot:t.x=t.x<0?0:1;break;case zt:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case It:t.y=t.y-Math.floor(t.y);break;case Ot:t.y=t.y<0?0:1;break;case zt:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&this.version++}}function ke(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Pe.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}De.DEFAULT_IMAGE=void 0,De.DEFAULT_MAPPING=300,De.prototype.isTexture=!0;class Ie{constructor(t=0,e=0,n=0,r=1){this.x=t,this.y=e,this.z=n,this.w=r}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*e+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*e+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*e+o[7]*n+o[11]*r+o[15]*i,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,r,i;const o=.01,a=.1,s=t.elements,l=s[0],c=s[4],u=s[8],h=s[1],d=s[5],p=s[9],f=s[2],m=s[6],g=s[10];if(Math.abs(c-h)<o&&Math.abs(u-f)<o&&Math.abs(p-m)<o){if(Math.abs(c+h)<a&&Math.abs(u+f)<a&&Math.abs(p+m)<a&&Math.abs(l+d+g-3)<a)return this.set(1,0,0,0),this;e=Math.PI;const t=(l+1)/2,s=(d+1)/2,v=(g+1)/2,y=(c+h)/4,x=(u+f)/4,b=(p+m)/4;return t>s&&t>v?t<o?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(t),r=y/n,i=x/n):s>v?s<o?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),n=y/r,i=b/r):v<o?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(v),n=x/i,r=b/i),this.set(n,r,i,e),this}let v=Math.sqrt((m-p)*(m-p)+(u-f)*(u-f)+(h-c)*(h-c));return Math.abs(v)<.001&&(v=1),this.x=(m-p)/v,this.y=(u-f)/v,this.z=(h-c)/v,this.w=Math.acos((l+d+g-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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}}Ie.prototype.isVector4=!0;class Oe extends de{constructor(t,e,n={}){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new Ie(0,0,t,e),this.scissorTest=!1,this.viewport=new Ie(0,0,t,e),this.texture=new De(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.image={width:t,height:e,depth:1},this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.internalFormat=void 0!==n.internalFormat?n.internalFormat:null,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:Bt,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}setTexture(t){t.image={width:this.width,height:this.height,depth:this.depth},this.texture=t}setSize(t,e,n=1){this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.image={...this.texture.image},this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}Oe.prototype.isWebGLRenderTarget=!0;(class extends Oe{constructor(t,e,n){super(t,e);const r=this.texture;this.texture=[];for(let t=0;t<n;t++)this.texture[t]=r.clone()}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let r=0,i=this.texture.length;r<i;r++)this.texture[r].image.width=t,this.texture[r].image.height=e,this.texture[r].image.depth=n;this.dispose()}return this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e),this}copy(t){this.dispose(),this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this.texture.length=0;for(let e=0,n=t.texture.length;e<n;e++)this.texture[e]=t.texture[e].clone();return this}}).prototype.isWebGLMultipleRenderTargets=!0;class ze extends Oe{constructor(t,e,n){super(t,e,n),this.samples=4}copy(t){return super.copy.call(this,t),this.samples=t.samples,this}}ze.prototype.isWebGLMultisampleRenderTarget=!0;class Fe{constructor(t=0,e=0,n=0,r=1){this._x=t,this._y=e,this._z=n,this._w=r}static slerp(t,e,n,r){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(t,e,r)}static slerpFlat(t,e,n,r,i,o,a){let s=n[r+0],l=n[r+1],c=n[r+2],u=n[r+3];const h=i[o+0],d=i[o+1],p=i[o+2],f=i[o+3];if(0===a)return t[e+0]=s,t[e+1]=l,t[e+2]=c,void(t[e+3]=u);if(1===a)return t[e+0]=h,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(u!==f||s!==h||l!==d||c!==p){let t=1-a;const e=s*h+l*d+c*p+u*f,n=e>=0?1:-1,r=1-e*e;if(r>Number.EPSILON){const i=Math.sqrt(r),o=Math.atan2(i,e*n);t=Math.sin(t*o)/i,a=Math.sin(a*o)/i}const i=a*n;if(s=s*t+h*i,l=l*t+d*i,c=c*t+p*i,u=u*t+f*i,t===1-a){const t=1/Math.sqrt(s*s+l*l+c*c+u*u);s*=t,l*=t,c*=t,u*=t}}t[e]=s,t[e+1]=l,t[e+2]=c,t[e+3]=u}static multiplyQuaternionsFlat(t,e,n,r,i,o){const a=n[r],s=n[r+1],l=n[r+2],c=n[r+3],u=i[o],h=i[o+1],d=i[o+2],p=i[o+3];return t[e]=a*p+c*u+s*d-l*h,t[e+1]=s*p+c*h+l*u-a*d,t[e+2]=l*p+c*d+a*h-s*u,t[e+3]=c*p-a*u-s*h-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,r=t._y,i=t._z,o=t._order,a=Math.cos,s=Math.sin,l=a(n/2),c=a(r/2),u=a(i/2),h=s(n/2),d=s(r/2),p=s(i/2);switch(o){case"XYZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"YXZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"ZXY":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"ZYX":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"YZX":this._x=h*c*u+l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u-h*d*p;break;case"XZY":this._x=h*c*u-l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],r=e[4],i=e[8],o=e[1],a=e[5],s=e[9],l=e[2],c=e[6],u=e[10],h=n+a+u;if(h>0){const t=.5/Math.sqrt(h+1);this._w=.25/t,this._x=(c-s)*t,this._y=(i-l)*t,this._z=(o-r)*t}else if(n>a&&n>u){const t=2*Math.sqrt(1+n-a-u);this._w=(c-s)/t,this._x=.25*t,this._y=(r+o)/t,this._z=(i+l)/t}else if(a>u){const t=2*Math.sqrt(1+a-n-u);this._w=(i-l)/t,this._x=(r+o)/t,this._y=.25*t,this._z=(s+c)/t}else{const t=2*Math.sqrt(1+u-n-a);this._w=(o-r)/t,this._x=(i+l)/t,this._y=(s+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(xe(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const r=Math.min(1,e/n);return this.slerp(t,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,r=t._y,i=t._z,o=t._w,a=e._x,s=e._y,l=e._z,c=e._w;return this._x=n*c+o*a+r*l-i*s,this._y=r*c+o*s+i*a-n*l,this._z=i*c+o*l+n*s-r*a,this._w=o*c-n*a-r*s-i*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,r=this._y,i=this._z,o=this._w;let a=o*t._w+n*t._x+r*t._y+i*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;const s=1-a*a;if(s<=Number.EPSILON){const t=1-e;return this._w=t*o+e*this._w,this._x=t*n+e*this._x,this._y=t*r+e*this._y,this._z=t*i+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(s),c=Math.atan2(l,a),u=Math.sin((1-e)*c)/l,h=Math.sin(e*c)/l;return this._w=o*u+this._w*h,this._x=n*u+this._x*h,this._y=r*u+this._y*h,this._z=i*u+this._z*h,this._onChangeCallback(),this}slerpQuaternions(t,e,n){this.copy(t).slerp(e,n)}random(){const t=Math.random(),e=Math.sqrt(1-t),n=Math.sqrt(t),r=2*Math.PI*Math.random(),i=2*Math.PI*Math.random();return this.set(e*Math.cos(r),n*Math.sin(i),n*Math.cos(i),e*Math.sin(r))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}Fe.prototype.isQuaternion=!0;class Be{constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(He.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(He.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=t.elements,o=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*o,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*o,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*o,this}applyQuaternion(t){const e=this.x,n=this.y,r=this.z,i=t.x,o=t.y,a=t.z,s=t.w,l=s*e+o*r-a*n,c=s*n+a*e-i*r,u=s*r+i*n-o*e,h=-i*e-o*n-a*r;return this.x=l*s+h*-i+c*-a-u*-o,this.y=c*s+h*-o+u*-i-l*-a,this.z=u*s+h*-a+l*-o-c*-i,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,r=t.y,i=t.z,o=e.x,a=e.y,s=e.z;return this.x=r*s-i*a,this.y=i*o-n*s,this.z=n*a-r*o,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Ue.copy(this).projectOnVector(t),this.sub(Ue)}reflect(t){return this.sub(Ue.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(xe(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,n=Math.sqrt(1-t**2);return this.x=n*Math.cos(e),this.y=n*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}Be.prototype.isVector3=!0;const Ue=new Be,He=new Fe;class We{constructor(t=new Be(1/0,1/0,1/0),e=new Be(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0;for(let s=0,l=t.length;s<l;s+=3){const l=t[s],c=t[s+1],u=t[s+2];l<e&&(e=l),c<n&&(n=c),u<r&&(r=u),l>i&&(i=l),c>o&&(o=c),u>a&&(a=u)}return this.min.set(e,n,r),this.max.set(i,o,a),this}setFromBufferAttribute(t){let e=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0;for(let s=0,l=t.count;s<l;s++){const l=t.getX(s),c=t.getY(s),u=t.getZ(s);l<e&&(e=l),c<n&&(n=c),u<r&&(r=u),l>i&&(i=l),c>o&&(o=c),u>a&&(a=u)}return this.min.set(e,n,r),this.max.set(i,o,a),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=Ve.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.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(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t){t.updateWorldMatrix(!1,!1);const e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),je.copy(e.boundingBox),je.applyMatrix4(t.matrixWorld),this.union(je));const n=t.children;for(let t=0,e=n.length;t<e;t++)this.expandByObject(n[t]);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Ve),Ve.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Ke),Qe.subVectors(this.max,Ke),$e.subVectors(t.a,Ke),qe.subVectors(t.b,Ke),Xe.subVectors(t.c,Ke),Ye.subVectors(qe,$e),Ze.subVectors(Xe,qe),Je.subVectors($e,Xe);let e=[0,-Ye.z,Ye.y,0,-Ze.z,Ze.y,0,-Je.z,Je.y,Ye.z,0,-Ye.x,Ze.z,0,-Ze.x,Je.z,0,-Je.x,-Ye.y,Ye.x,0,-Ze.y,Ze.x,0,-Je.y,Je.x,0];return!!nn(e,$e,qe,Xe,Qe)&&(e=[1,0,0,0,1,0,0,0,1],!!nn(e,$e,qe,Xe,Qe)&&(tn.crossVectors(Ye,Ze),e=[tn.x,tn.y,tn.z],nn(e,$e,qe,Xe,Qe)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Ve.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(Ve).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Ge[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Ge[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Ge[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Ge[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Ge[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Ge[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Ge[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Ge[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Ge)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}We.prototype.isBox3=!0;const Ge=[new Be,new Be,new Be,new Be,new Be,new Be,new Be,new Be],Ve=new Be,je=new We,$e=new Be,qe=new Be,Xe=new Be,Ye=new Be,Ze=new Be,Je=new Be,Ke=new Be,Qe=new Be,tn=new Be,en=new Be;function nn(t,e,n,r,i){for(let o=0,a=t.length-3;o<=a;o+=3){en.fromArray(t,o);const a=i.x*Math.abs(en.x)+i.y*Math.abs(en.y)+i.z*Math.abs(en.z),s=e.dot(en),l=n.dot(en),c=r.dot(en);if(Math.max(-Math.max(s,l,c),Math.min(s,l,c))>a)return!1}return!0}const rn=new We,on=new Be,an=new Be,sn=new Be;class ln{constructor(t=new Be,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):rn.setFromPoints(t).getCenter(n);let r=0;for(let e=0,i=t.length;e<i;e++)r=Math.max(r,n.distanceToSquared(t[e]));return this.radius=Math.sqrt(r),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){sn.subVectors(t,this.center);const e=sn.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.add(sn.multiplyScalar(n/t)),this.radius+=n}return this}union(t){return an.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(on.copy(t.center).add(an)),this.expandByPoint(on.copy(t.center).sub(an)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const cn=new Be,un=new Be,hn=new Be,dn=new Be,pn=new Be,fn=new Be,mn=new Be;class gn{constructor(t=new Be,e=new Be(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,cn)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=cn.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(cn.copy(this.direction).multiplyScalar(e).add(this.origin),cn.distanceToSquared(t))}distanceSqToSegment(t,e,n,r){un.copy(t).add(e).multiplyScalar(.5),hn.copy(e).sub(t).normalize(),dn.copy(this.origin).sub(un);const i=.5*t.distanceTo(e),o=-this.direction.dot(hn),a=dn.dot(this.direction),s=-dn.dot(hn),l=dn.lengthSq(),c=Math.abs(1-o*o);let u,h,d,p;if(c>0)if(u=o*s-a,h=o*a-s,p=i*c,u>=0)if(h>=-p)if(h<=p){const t=1/c;u*=t,h*=t,d=u*(u+o*h+2*a)+h*(o*u+h+2*s)+l}else h=i,u=Math.max(0,-(o*h+a)),d=-u*u+h*(h+2*s)+l;else h=-i,u=Math.max(0,-(o*h+a)),d=-u*u+h*(h+2*s)+l;else h<=-p?(u=Math.max(0,-(-o*i+a)),h=u>0?-i:Math.min(Math.max(-i,-s),i),d=-u*u+h*(h+2*s)+l):h<=p?(u=0,h=Math.min(Math.max(-i,-s),i),d=h*(h+2*s)+l):(u=Math.max(0,-(o*i+a)),h=u>0?i:Math.min(Math.max(-i,-s),i),d=-u*u+h*(h+2*s)+l);else h=o>0?-i:i,u=Math.max(0,-(o*h+a)),d=-u*u+h*(h+2*s)+l;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),r&&r.copy(hn).multiplyScalar(h).add(un),d}intersectSphere(t,e){cn.subVectors(t.center,this.origin);const n=cn.dot(this.direction),r=cn.dot(cn)-n*n,i=t.radius*t.radius;if(r>i)return null;const o=Math.sqrt(i-r),a=n-o,s=n+o;return a<0&&s<0?null:a<0?this.at(s,e):this.at(a,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,r,i,o,a,s;const l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return l>=0?(n=(t.min.x-h.x)*l,r=(t.max.x-h.x)*l):(n=(t.max.x-h.x)*l,r=(t.min.x-h.x)*l),c>=0?(i=(t.min.y-h.y)*c,o=(t.max.y-h.y)*c):(i=(t.max.y-h.y)*c,o=(t.min.y-h.y)*c),n>o||i>r?null:((i>n||n!=n)&&(n=i),(o<r||r!=r)&&(r=o),u>=0?(a=(t.min.z-h.z)*u,s=(t.max.z-h.z)*u):(a=(t.max.z-h.z)*u,s=(t.min.z-h.z)*u),n>s||a>r?null:((a>n||n!=n)&&(n=a),(s<r||r!=r)&&(r=s),r<0?null:this.at(n>=0?n:r,e)))}intersectsBox(t){return null!==this.intersectBox(t,cn)}intersectTriangle(t,e,n,r,i){pn.subVectors(e,t),fn.subVectors(n,t),mn.crossVectors(pn,fn);let o,a=this.direction.dot(mn);if(a>0){if(r)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}dn.subVectors(this.origin,t);const s=o*this.direction.dot(fn.crossVectors(dn,fn));if(s<0)return null;const l=o*this.direction.dot(pn.cross(dn));if(l<0)return null;if(s+l>a)return null;const c=-o*dn.dot(mn);return c<0?null:this.at(c/a,i)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class vn{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,r,i,o,a,s,l,c,u,h,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=r,g[1]=i,g[5]=o,g[9]=a,g[13]=s,g[2]=l,g[6]=c,g[10]=u,g[14]=h,g[3]=d,g[7]=p,g[11]=f,g[15]=m,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 vn).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,r=1/yn.setFromMatrixColumn(t,0).length(),i=1/yn.setFromMatrixColumn(t,1).length(),o=1/yn.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*i,e[5]=n[5]*i,e[6]=n[6]*i,e[7]=0,e[8]=n[8]*o,e[9]=n[9]*o,e[10]=n[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,n=t.x,r=t.y,i=t.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(r),l=Math.sin(r),c=Math.cos(i),u=Math.sin(i);if("XYZ"===t.order){const t=o*c,n=o*u,r=a*c,i=a*u;e[0]=s*c,e[4]=-s*u,e[8]=l,e[1]=n+r*l,e[5]=t-i*l,e[9]=-a*s,e[2]=i-t*l,e[6]=r+n*l,e[10]=o*s}else if("YXZ"===t.order){const t=s*c,n=s*u,r=l*c,i=l*u;e[0]=t+i*a,e[4]=r*a-n,e[8]=o*l,e[1]=o*u,e[5]=o*c,e[9]=-a,e[2]=n*a-r,e[6]=i+t*a,e[10]=o*s}else if("ZXY"===t.order){const t=s*c,n=s*u,r=l*c,i=l*u;e[0]=t-i*a,e[4]=-o*u,e[8]=r+n*a,e[1]=n+r*a,e[5]=o*c,e[9]=i-t*a,e[2]=-o*l,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){const t=o*c,n=o*u,r=a*c,i=a*u;e[0]=s*c,e[4]=r*l-n,e[8]=t*l+i,e[1]=s*u,e[5]=i*l+t,e[9]=n*l-r,e[2]=-l,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){const t=o*s,n=o*l,r=a*s,i=a*l;e[0]=s*c,e[4]=i-t*u,e[8]=r*u+n,e[1]=u,e[5]=o*c,e[9]=-a*c,e[2]=-l*c,e[6]=n*u+r,e[10]=t-i*u}else if("XZY"===t.order){const t=o*s,n=o*l,r=a*s,i=a*l;e[0]=s*c,e[4]=-u,e[8]=l*c,e[1]=t*u+i,e[5]=o*c,e[9]=n*u-r,e[2]=r*u-n,e[6]=a*c,e[10]=i*u+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(bn,t,wn)}lookAt(t,e,n){const r=this.elements;return Sn.subVectors(t,e),0===Sn.lengthSq()&&(Sn.z=1),Sn.normalize(),_n.crossVectors(n,Sn),0===_n.lengthSq()&&(1===Math.abs(n.z)?Sn.x+=1e-4:Sn.z+=1e-4,Sn.normalize(),_n.crossVectors(n,Sn)),_n.normalize(),Mn.crossVectors(Sn,_n),r[0]=_n.x,r[4]=Mn.x,r[8]=Sn.x,r[1]=_n.y,r[5]=Mn.y,r[9]=Sn.y,r[2]=_n.z,r[6]=Mn.z,r[10]=Sn.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,o=n[0],a=n[4],s=n[8],l=n[12],c=n[1],u=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],x=n[11],b=n[15],w=r[0],_=r[4],M=r[8],S=r[12],T=r[1],E=r[5],C=r[9],L=r[13],A=r[2],R=r[6],P=r[10],N=r[14],D=r[3],k=r[7],I=r[11],O=r[15];return i[0]=o*w+a*T+s*A+l*D,i[4]=o*_+a*E+s*R+l*k,i[8]=o*M+a*C+s*P+l*I,i[12]=o*S+a*L+s*N+l*O,i[1]=c*w+u*T+h*A+d*D,i[5]=c*_+u*E+h*R+d*k,i[9]=c*M+u*C+h*P+d*I,i[13]=c*S+u*L+h*N+d*O,i[2]=p*w+f*T+m*A+g*D,i[6]=p*_+f*E+m*R+g*k,i[10]=p*M+f*C+m*P+g*I,i[14]=p*S+f*L+m*N+g*O,i[3]=v*w+y*T+x*A+b*D,i[7]=v*_+y*E+x*R+b*k,i[11]=v*M+y*C+x*P+b*I,i[15]=v*S+y*L+x*N+b*O,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],o=t[1],a=t[5],s=t[9],l=t[13],c=t[2],u=t[6],h=t[10],d=t[14];return t[3]*(+i*s*u-r*l*u-i*a*h+n*l*h+r*a*d-n*s*d)+t[7]*(+e*s*d-e*l*h+i*o*h-r*o*d+r*l*c-i*s*c)+t[11]*(+e*l*u-e*a*d-i*o*u+n*o*d+i*a*c-n*l*c)+t[15]*(-r*a*c-e*s*u+e*a*h+r*o*u-n*o*h+n*s*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],c=t[8],u=t[9],h=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],v=u*m*l-f*h*l+f*s*d-a*m*d-u*s*g+a*h*g,y=p*h*l-c*m*l-p*s*d+o*m*d+c*s*g-o*h*g,x=c*f*l-p*u*l+p*a*d-o*f*d-c*a*g+o*u*g,b=p*u*s-c*f*s-p*a*h+o*f*h+c*a*m-o*u*m,w=e*v+n*y+r*x+i*b;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const _=1/w;return t[0]=v*_,t[1]=(f*h*i-u*m*i-f*r*d+n*m*d+u*r*g-n*h*g)*_,t[2]=(a*m*i-f*s*i+f*r*l-n*m*l-a*r*g+n*s*g)*_,t[3]=(u*s*i-a*h*i-u*r*l+n*h*l+a*r*d-n*s*d)*_,t[4]=y*_,t[5]=(c*m*i-p*h*i+p*r*d-e*m*d-c*r*g+e*h*g)*_,t[6]=(p*s*i-o*m*i-p*r*l+e*m*l+o*r*g-e*s*g)*_,t[7]=(o*h*i-c*s*i+c*r*l-e*h*l-o*r*d+e*s*d)*_,t[8]=x*_,t[9]=(p*u*i-c*f*i-p*n*d+e*f*d+c*n*g-e*u*g)*_,t[10]=(o*f*i-p*a*i+p*n*l-e*f*l-o*n*g+e*a*g)*_,t[11]=(c*a*i-o*u*i-c*n*l+e*u*l+o*n*d-e*a*d)*_,t[12]=b*_,t[13]=(c*f*r-p*u*r+p*n*h-e*f*h-c*n*m+e*u*m)*_,t[14]=(p*a*r-o*f*r-p*n*s+e*f*s+o*n*m-e*a*m)*_,t[15]=(o*u*r-c*a*r+c*n*s-e*u*s-o*n*h+e*a*h)*_,this}scale(t){const e=this.elements,n=t.x,r=t.y,i=t.z;return e[0]*=n,e[4]*=r,e[8]*=i,e[1]*=n,e[5]*=r,e[9]*=i,e[2]*=n,e[6]*=r,e[10]*=i,e[3]*=n,e[7]*=r,e[11]*=i,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),r=Math.sin(e),i=1-n,o=t.x,a=t.y,s=t.z,l=i*o,c=i*a;return this.set(l*o+n,l*a-r*s,l*s+r*a,0,l*a+r*s,c*a+n,c*s-r*o,0,l*s-r*a,c*s+r*o,i*s*s+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,r,i,o){return this.set(1,n,i,0,t,1,o,0,e,r,1,0,0,0,0,1),this}compose(t,e,n){const r=this.elements,i=e._x,o=e._y,a=e._z,s=e._w,l=i+i,c=o+o,u=a+a,h=i*l,d=i*c,p=i*u,f=o*c,m=o*u,g=a*u,v=s*l,y=s*c,x=s*u,b=n.x,w=n.y,_=n.z;return r[0]=(1-(f+g))*b,r[1]=(d+x)*b,r[2]=(p-y)*b,r[3]=0,r[4]=(d-x)*w,r[5]=(1-(h+g))*w,r[6]=(m+v)*w,r[7]=0,r[8]=(p+y)*_,r[9]=(m-v)*_,r[10]=(1-(h+f))*_,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,n){const r=this.elements;let i=yn.set(r[0],r[1],r[2]).length();const o=yn.set(r[4],r[5],r[6]).length(),a=yn.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),t.x=r[12],t.y=r[13],t.z=r[14],xn.copy(this);const s=1/i,l=1/o,c=1/a;return xn.elements[0]*=s,xn.elements[1]*=s,xn.elements[2]*=s,xn.elements[4]*=l,xn.elements[5]*=l,xn.elements[6]*=l,xn.elements[8]*=c,xn.elements[9]*=c,xn.elements[10]*=c,e.setFromRotationMatrix(xn),n.x=i,n.y=o,n.z=a,this}makePerspective(t,e,n,r,i,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const a=this.elements,s=2*i/(e-t),l=2*i/(n-r),c=(e+t)/(e-t),u=(n+r)/(n-r),h=-(o+i)/(o-i),d=-2*o*i/(o-i);return a[0]=s,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=l,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(t,e,n,r,i,o){const a=this.elements,s=1/(e-t),l=1/(n-r),c=1/(o-i),u=(e+t)*s,h=(n+r)*l,d=(o+i)*c;return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<16;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}vn.prototype.isMatrix4=!0;const yn=new Be,xn=new vn,bn=new Be(0,0,0),wn=new Be(1,1,1),_n=new Be,Mn=new Be,Sn=new Be,Tn=new vn,En=new Fe;class Cn{constructor(t=0,e=0,n=0,r=Cn.DefaultOrder){this._x=t,this._y=e,this._z=n,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,r=this._order){return this._x=t,this._y=e,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const r=t.elements,i=r[0],o=r[4],a=r[8],s=r[1],l=r[5],c=r[9],u=r[2],h=r[6],d=r[10];switch(e){case"XYZ":this._y=Math.asin(xe(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-o,i)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-xe(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(s,l)):(this._y=Math.atan2(-u,i),this._z=0);break;case"ZXY":this._x=Math.asin(xe(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(s,i));break;case"ZYX":this._y=Math.asin(-xe(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(xe(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-xe(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(a,i)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Tn.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Tn,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return En.setFromEuler(this),this.setFromQuaternion(En,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new Be(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}Cn.prototype.isEuler=!0,Cn.DefaultOrder="XYZ",Cn.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Ln{constructor(){this.mask=1}set(t){this.mask=1<<t|0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}}let An=0;const Rn=new Be,Pn=new Fe,Nn=new vn,Dn=new Be,kn=new Be,In=new Be,On=new Fe,zn=new Be(1,0,0),Fn=new Be(0,1,0),Bn=new Be(0,0,1),Un={type:"added"},Hn={type:"removed"};class Wn extends de{constructor(){super(),Object.defineProperty(this,"id",{value:An++}),this.uuid=ye(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Wn.DefaultUp.clone();const t=new Be,e=new Cn,n=new Fe,r=new Be(1,1,1);e._onChange((function(){n.setFromEuler(e,!1)})),n._onChange((function(){e.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new vn},normalMatrix:{value:new Ee}}),this.matrix=new vn,this.matrixWorld=new vn,this.matrixAutoUpdate=Wn.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Ln,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Pn.setFromAxisAngle(t,e),this.quaternion.multiply(Pn),this}rotateOnWorldAxis(t,e){return Pn.setFromAxisAngle(t,e),this.quaternion.premultiply(Pn),this}rotateX(t){return this.rotateOnAxis(zn,t)}rotateY(t){return this.rotateOnAxis(Fn,t)}rotateZ(t){return this.rotateOnAxis(Bn,t)}translateOnAxis(t,e){return Rn.copy(t).applyQuaternion(this.quaternion),this.position.add(Rn.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(zn,t)}translateY(t){return this.translateOnAxis(Fn,t)}translateZ(t){return this.translateOnAxis(Bn,t)}localToWorld(t){return t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return t.applyMatrix4(Nn.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?Dn.copy(t):Dn.set(t,e,n);const r=this.parent;this.updateWorldMatrix(!0,!1),kn.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Nn.lookAt(kn,Dn,this.up):Nn.lookAt(Dn,kn,this.up),this.quaternion.setFromRotationMatrix(Nn),r&&(Nn.extractRotation(r.matrixWorld),Pn.setFromRotationMatrix(Nn),this.quaternion.premultiply(Pn.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(Un)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Hn)),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(Hn)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),Nn.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Nn.multiply(t.parent.matrixWorld)),t.applyMatrix4(Nn),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,r=this.children.length;n<r;n++){const r=this.children[n].getObjectByProperty(t,e);if(void 0!==r)return r}}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(kn,t,In),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(kn,On,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){const n=this.parent;if(!0===t&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,n=t.length;e<n;e++)t[e].updateWorldMatrix(!1,!0)}}toJSON(t){const e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const r={};function i(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&(r.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,r=n.length;e<r;e++){const r=n[e];i(t.shapes,r)}else i(t.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(i(t.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let n=0,r=this.material.length;n<r;n++)e.push(i(t.materials,this.material[n]));r.material=e}else r.material=i(t.materials,this.material);if(this.children.length>0){r.children=[];for(let e=0;e<this.children.length;e++)r.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){r.animations=[];for(let e=0;e<this.animations.length;e++){const n=this.animations[e];r.animations.push(i(t.animations,n))}}if(e){const e=o(t.geometries),r=o(t.materials),i=o(t.textures),a=o(t.images),s=o(t.shapes),l=o(t.skeletons),c=o(t.animations);e.length>0&&(n.geometries=e),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),a.length>0&&(n.images=a),s.length>0&&(n.shapes=s),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c)}return n.object=r,n;function o(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const n=t.children[e];this.add(n.clone())}return this}}Wn.DefaultUp=new Be(0,1,0),Wn.DefaultMatrixAutoUpdate=!0,Wn.prototype.isObject3D=!0;const Gn=new Be,Vn=new Be,jn=new Be,$n=new Be,qn=new Be,Xn=new Be,Yn=new Be,Zn=new Be,Jn=new Be,Kn=new Be;class Qn{constructor(t=new Be,e=new Be,n=new Be){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,r){r.subVectors(n,e),Gn.subVectors(t,e),r.cross(Gn);const i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(t,e,n,r,i){Gn.subVectors(r,e),Vn.subVectors(n,e),jn.subVectors(t,e);const o=Gn.dot(Gn),a=Gn.dot(Vn),s=Gn.dot(jn),l=Vn.dot(Vn),c=Vn.dot(jn),u=o*l-a*a;if(0===u)return i.set(-2,-1,-1);const h=1/u,d=(l*s-a*c)*h,p=(o*c-a*s)*h;return i.set(1-d-p,p,d)}static containsPoint(t,e,n,r){return this.getBarycoord(t,e,n,r,$n),$n.x>=0&&$n.y>=0&&$n.x+$n.y<=1}static getUV(t,e,n,r,i,o,a,s){return this.getBarycoord(t,e,n,r,$n),s.set(0,0),s.addScaledVector(i,$n.x),s.addScaledVector(o,$n.y),s.addScaledVector(a,$n.z),s}static isFrontFacing(t,e,n,r){return Gn.subVectors(n,e),Vn.subVectors(t,e),Gn.cross(Vn).dot(r)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this}setFromAttributeAndIndices(t,e,n,r){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,r),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Gn.subVectors(this.c,this.b),Vn.subVectors(this.a,this.b),.5*Gn.cross(Vn).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Qn.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Qn.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,r,i){return Qn.getUV(t,this.a,this.b,this.c,e,n,r,i)}containsPoint(t){return Qn.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Qn.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,r=this.b,i=this.c;let o,a;qn.subVectors(r,n),Xn.subVectors(i,n),Zn.subVectors(t,n);const s=qn.dot(Zn),l=Xn.dot(Zn);if(s<=0&&l<=0)return e.copy(n);Jn.subVectors(t,r);const c=qn.dot(Jn),u=Xn.dot(Jn);if(c>=0&&u<=c)return e.copy(r);const h=s*u-c*l;if(h<=0&&s>=0&&c<=0)return o=s/(s-c),e.copy(n).addScaledVector(qn,o);Kn.subVectors(t,i);const d=qn.dot(Kn),p=Xn.dot(Kn);if(p>=0&&d<=p)return e.copy(i);const f=d*l-s*p;if(f<=0&&l>=0&&p<=0)return a=l/(l-p),e.copy(n).addScaledVector(Xn,a);const m=c*p-d*u;if(m<=0&&u-c>=0&&d-p>=0)return Yn.subVectors(i,r),a=(u-c)/(u-c+(d-p)),e.copy(r).addScaledVector(Yn,a);const g=1/(m+f+h);return o=f*g,a=h*g,e.copy(n).addScaledVector(qn,o).addScaledVector(Xn,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let tr=0;class er extends de{constructor(){super(),Object.defineProperty(this,"id",{value:tr++}),this.uuid=ye(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.format=Xt,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=Pt,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=le,this.stencilZFail=le,this.stencilZPass=le,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.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.format!==Xt&&(n.format=this.format),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=r(t.textures),i=r(t.images);e.length>0&&(n.textures=e),i.length>0&&(n.images=i)}return n}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.format=t.format,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let r=0;r!==t;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}er.prototype.isMaterial=!0;const nr={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},rr={h:0,s:0,l:0},ir={h:0,s:0,l:0};function or(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function ar(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function sr(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class lr{constructor(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,n){return this.r=t,this.g=e,this.b=n,this}setHSL(t,e,n){if(t=be(t,1),e=xe(e,0,1),n=xe(n,0,1),0===e)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+e):n+e-n*e,i=2*n-r;this.r=or(i,r,t+1/3),this.g=or(i,r,t),this.b=or(i,r,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const r=n[1],i=n[2];switch(r){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i)){const n=parseFloat(t[1])/360,r=parseInt(t[2],10)/100,i=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(n,r,i)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=nr[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=ar(t.r),this.g=ar(t.g),this.b=ar(t.b),this}copyLinearToSRGB(t){return this.r=sr(t.r),this.g=sr(t.g),this.b=sr(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){const e=this.r,n=this.g,r=this.b,i=Math.max(e,n,r),o=Math.min(e,n,r);let a,s;const l=(o+i)/2;if(o===i)a=0,s=0;else{const t=i-o;switch(s=l<=.5?t/(i+o):t/(2-i-o),i){case e:a=(n-r)/t+(n<r?6:0);break;case n:a=(r-e)/t+2;break;case r:a=(e-n)/t+4}a/=6}return t.h=a,t.s=s,t.l=l,t}getStyle(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}offsetHSL(t,e,n){return this.getHSL(rr),rr.h+=t,rr.s+=e,rr.l+=n,this.setHSL(rr.h,rr.s,rr.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(rr),t.getHSL(ir);const n=we(rr.h,ir.h,e),r=we(rr.s,ir.s,e),i=we(rr.l,ir.l,e);return this.setHSL(n,r,i),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}lr.NAMES=nr,lr.prototype.isColor=!0,lr.prototype.r=1,lr.prototype.g=1,lr.prototype.b=1;class cr extends er{constructor(t){super(),this.type="MeshBasicMaterial",this.color=new lr(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.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}cr.prototype.isMeshBasicMaterial=!0;const ur=new Be,hr=new Te;class dr{constructor(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.usage=ce,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[t+r]=e.array[n+r];return this}copyArray(t){return this.array.set(t),this}copyColorsArray(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),i=new lr),e[n++]=i.r,e[n++]=i.g,e[n++]=i.b}return this}copyVector2sArray(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),i=new Te),e[n++]=i.x,e[n++]=i.y}return this}copyVector3sArray(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),i=new Be),e[n++]=i.x,e[n++]=i.y,e[n++]=i.z}return this}copyVector4sArray(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),i=new Ie),e[n++]=i.x,e[n++]=i.y,e[n++]=i.z,e[n++]=i.w}return this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,n=this.count;e<n;e++)hr.fromBufferAttribute(this,e),hr.applyMatrix3(t),this.setXY(e,hr.x,hr.y);else if(3===this.itemSize)for(let e=0,n=this.count;e<n;e++)ur.fromBufferAttribute(this,e),ur.applyMatrix3(t),this.setXYZ(e,ur.x,ur.y,ur.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)ur.x=this.getX(e),ur.y=this.getY(e),ur.z=this.getZ(e),ur.applyMatrix4(t),this.setXYZ(e,ur.x,ur.y,ur.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)ur.x=this.getX(e),ur.y=this.getY(e),ur.z=this.getZ(e),ur.applyNormalMatrix(t),this.setXYZ(e,ur.x,ur.y,ur.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)ur.x=this.getX(e),ur.y=this.getY(e),ur.z=this.getZ(e),ur.transformDirection(t),this.setXYZ(e,ur.x,ur.y,ur.z);return this}set(t,e=0){return this.array.set(t,e),this}getX(t){return this.array[t*this.itemSize]}setX(t,e){return this.array[t*this.itemSize]=e,this}getY(t){return this.array[t*this.itemSize+1]}setY(t,e){return this.array[t*this.itemSize+1]=e,this}getZ(t){return this.array[t*this.itemSize+2]}setZ(t,e){return this.array[t*this.itemSize+2]=e,this}getW(t){return this.array[t*this.itemSize+3]}setW(t,e){return this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this}setXYZW(t,e,n,r,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this.array[t+3]=i,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==ce&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t}}dr.prototype.isBufferAttribute=!0;class pr extends dr{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class fr extends dr{constructor(t,e,n){super(new Uint32Array(t),e,n)}}(class extends dr{constructor(t,e,n){super(new Uint16Array(t),e,n)}}).prototype.isFloat16BufferAttribute=!0;class mr extends dr{constructor(t,e,n){super(new Float32Array(t),e,n)}}let gr=0;const vr=new vn,yr=new Wn,xr=new Be,br=new We,wr=new We,_r=new Be;class Mr extends de{constructor(){super(),Object.defineProperty(this,"id",{value:gr++}),this.uuid=ye(),this.name="",this.type="BufferGeometry",this.index=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(t){return Array.isArray(t)?this.index=new(Ce(t)>65535?fr:pr)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new Ee).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(t),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return vr.makeRotationFromQuaternion(t),this.applyMatrix4(vr),this}rotateX(t){return vr.makeRotationX(t),this.applyMatrix4(vr),this}rotateY(t){return vr.makeRotationY(t),this.applyMatrix4(vr),this}rotateZ(t){return vr.makeRotationZ(t),this.applyMatrix4(vr),this}translate(t,e,n){return vr.makeTranslation(t,e,n),this.applyMatrix4(vr),this}scale(t,e,n){return vr.makeScale(t,e,n),this.applyMatrix4(vr),this}lookAt(t){return yr.lookAt(t),yr.updateMatrix(),this.applyMatrix4(yr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(xr).negate(),this.translate(xr.x,xr.y,xr.z),this}setFromPoints(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];e.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new mr(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new We);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new Be(-1/0,-1/0,-1/0),new Be(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];br.setFromBufferAttribute(n),this.morphTargetsRelative?(_r.addVectors(this.boundingBox.min,br.min),this.boundingBox.expandByPoint(_r),_r.addVectors(this.boundingBox.max,br.max),this.boundingBox.expandByPoint(_r)):(this.boundingBox.expandByPoint(br.min),this.boundingBox.expandByPoint(br.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(){null===this.boundingSphere&&(this.boundingSphere=new ln);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new Be,1/0);if(t){const n=this.boundingSphere.center;if(br.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];wr.setFromBufferAttribute(n),this.morphTargetsRelative?(_r.addVectors(br.min,wr.min),br.expandByPoint(_r),_r.addVectors(br.max,wr.max),br.expandByPoint(_r)):(br.expandByPoint(wr.min),br.expandByPoint(wr.max))}br.getCenter(n);let r=0;for(let e=0,i=t.count;e<i;e++)_r.fromBufferAttribute(t,e),r=Math.max(r,n.distanceToSquared(_r));if(e)for(let i=0,o=e.length;i<o;i++){const o=e[i],a=this.morphTargetsRelative;for(let e=0,i=o.count;e<i;e++)_r.fromBufferAttribute(o,e),a&&(xr.fromBufferAttribute(t,e),_r.add(xr)),r=Math.max(r,n.distanceToSquared(_r))}this.boundingSphere.radius=Math.sqrt(r),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 t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.array,r=e.position.array,i=e.normal.array,o=e.uv.array,a=r.length/3;void 0===e.tangent&&this.setAttribute("tangent",new dr(new Float32Array(4*a),4));const s=e.tangent.array,l=[],c=[];for(let t=0;t<a;t++)l[t]=new Be,c[t]=new Be;const u=new Be,h=new Be,d=new Be,p=new Te,f=new Te,m=new Te,g=new Be,v=new Be;function y(t,e,n){u.fromArray(r,3*t),h.fromArray(r,3*e),d.fromArray(r,3*n),p.fromArray(o,2*t),f.fromArray(o,2*e),m.fromArray(o,2*n),h.sub(u),d.sub(u),f.sub(p),m.sub(p);const i=1/(f.x*m.y-m.x*f.y);isFinite(i)&&(g.copy(h).multiplyScalar(m.y).addScaledVector(d,-f.y).multiplyScalar(i),v.copy(d).multiplyScalar(f.x).addScaledVector(h,-m.x).multiplyScalar(i),l[t].add(g),l[e].add(g),l[n].add(g),c[t].add(v),c[e].add(v),c[n].add(v))}let x=this.groups;0===x.length&&(x=[{start:0,count:n.length}]);for(let t=0,e=x.length;t<e;++t){const e=x[t],r=e.start;for(let t=r,i=r+e.count;t<i;t+=3)y(n[t+0],n[t+1],n[t+2])}const b=new Be,w=new Be,_=new Be,M=new Be;function S(t){_.fromArray(i,3*t),M.copy(_);const e=l[t];b.copy(e),b.sub(_.multiplyScalar(_.dot(e))).normalize(),w.crossVectors(M,e);const n=w.dot(c[t])<0?-1:1;s[4*t]=b.x,s[4*t+1]=b.y,s[4*t+2]=b.z,s[4*t+3]=n}for(let t=0,e=x.length;t<e;++t){const e=x[t],r=e.start;for(let t=r,i=r+e.count;t<i;t+=3)S(n[t+0]),S(n[t+1]),S(n[t+2])}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let n=this.getAttribute("normal");if(void 0===n)n=new dr(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(let t=0,e=n.count;t<e;t++)n.setXYZ(t,0,0,0);const r=new Be,i=new Be,o=new Be,a=new Be,s=new Be,l=new Be,c=new Be,u=new Be;if(t)for(let h=0,d=t.count;h<d;h+=3){const d=t.getX(h+0),p=t.getX(h+1),f=t.getX(h+2);r.fromBufferAttribute(e,d),i.fromBufferAttribute(e,p),o.fromBufferAttribute(e,f),c.subVectors(o,i),u.subVectors(r,i),c.cross(u),a.fromBufferAttribute(n,d),s.fromBufferAttribute(n,p),l.fromBufferAttribute(n,f),a.add(c),s.add(c),l.add(c),n.setXYZ(d,a.x,a.y,a.z),n.setXYZ(p,s.x,s.y,s.z),n.setXYZ(f,l.x,l.y,l.z)}else for(let t=0,a=e.count;t<a;t+=3)r.fromBufferAttribute(e,t+0),i.fromBufferAttribute(e,t+1),o.fromBufferAttribute(e,t+2),c.subVectors(o,i),u.subVectors(r,i),c.cross(u),n.setXYZ(t+0,c.x,c.y,c.z),n.setXYZ(t+1,c.x,c.y,c.z),n.setXYZ(t+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(t,e){if(!t||!t.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const n=this.attributes;for(const r in n){if(void 0===t.attributes[r])continue;const i=n[r].array,o=t.attributes[r],a=o.array,s=o.itemSize*e,l=Math.min(a.length,i.length-s);for(let t=0,e=s;t<l;t++,e++)i[e]=a[t]}return this}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)_r.fromBufferAttribute(t,e),_r.normalize(),t.setXYZ(e,_r.x,_r.y,_r.z)}toNonIndexed(){function t(t,e){const n=t.array,r=t.itemSize,i=t.normalized,o=new n.constructor(e.length*r);let a=0,s=0;for(let i=0,l=e.length;i<l;i++){a=t.isInterleavedBufferAttribute?e[i]*t.data.stride+t.offset:e[i]*r;for(let t=0;t<r;t++)o[s++]=n[a++]}return new dr(o,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Mr,n=this.index.array,r=this.attributes;for(const i in r){const o=t(r[i],n);e.setAttribute(i,o)}const i=this.morphAttributes;for(const r in i){const o=[],a=i[r];for(let e=0,r=a.length;e<r;e++){const r=t(a[e],n);o.push(r)}e.morphAttributes[r]=o}e.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let t=0,n=o.length;t<n;t++){const n=o[t];e.addGroup(n.start,n.count,n.materialIndex)}return e}toJSON(){const t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const e in n){const r=n[e];t.data.attributes[e]=r.toJSON(t.data)}const r={};let i=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],o=[];for(let e=0,r=n.length;e<r;e++){const r=n[e];o.push(r.toJSON(t.data))}o.length>0&&(r[e]=o,i=!0)}i&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(t.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const r=t.attributes;for(const t in r){const n=r[t];this.setAttribute(t,n.clone(e))}const i=t.morphAttributes;for(const t in i){const n=[],r=i[t];for(let t=0,i=r.length;t<i;t++)n.push(r[t].clone(e));this.morphAttributes[t]=n}this.morphTargetsRelative=t.morphTargetsRelative;const o=t.groups;for(let t=0,e=o.length;t<e;t++){const e=o[t];this.addGroup(e.start,e.count,e.materialIndex)}const a=t.boundingBox;null!==a&&(this.boundingBox=a.clone());const s=t.boundingSphere;return null!==s&&(this.boundingSphere=s.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,void 0!==t.parameters&&(this.parameters=Object.assign({},t.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}Mr.prototype.isBufferGeometry=!0;const Sr=new vn,Tr=new gn,Er=new ln,Cr=new Be,Lr=new Be,Ar=new Be,Rr=new Be,Pr=new Be,Nr=new Be,Dr=new Be,kr=new Be,Ir=new Be,Or=new Te,zr=new Te,Fr=new Te,Br=new Be,Ur=new Be;class Hr extends Wn{constructor(t=new Mr,e=new cr){super(),this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(t,e){const n=this.geometry,r=this.material,i=this.matrixWorld;if(void 0===r)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),Er.copy(n.boundingSphere),Er.applyMatrix4(i),!1===t.ray.intersectsSphere(Er))return;if(Sr.copy(i).invert(),Tr.copy(t.ray).applyMatrix4(Sr),null!==n.boundingBox&&!1===Tr.intersectsBox(n.boundingBox))return;let o;if(n.isBufferGeometry){const i=n.index,a=n.attributes.position,s=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,u=n.attributes.uv2,h=n.groups,d=n.drawRange;if(null!==i)if(Array.isArray(r))for(let n=0,p=h.length;n<p;n++){const p=h[n],f=r[p.materialIndex];for(let n=Math.max(p.start,d.start),r=Math.min(i.count,Math.min(p.start+p.count,d.start+d.count));n<r;n+=3){const r=i.getX(n),h=i.getX(n+1),d=i.getX(n+2);o=Wr(this,f,t,Tr,a,s,l,c,u,r,h,d),o&&(o.faceIndex=Math.floor(n/3),o.face.materialIndex=p.materialIndex,e.push(o))}}else{for(let n=Math.max(0,d.start),h=Math.min(i.count,d.start+d.count);n<h;n+=3){const h=i.getX(n),d=i.getX(n+1),p=i.getX(n+2);o=Wr(this,r,t,Tr,a,s,l,c,u,h,d,p),o&&(o.faceIndex=Math.floor(n/3),e.push(o))}}else if(void 0!==a)if(Array.isArray(r))for(let n=0,i=h.length;n<i;n++){const i=h[n],p=r[i.materialIndex];for(let n=Math.max(i.start,d.start),r=Math.min(a.count,Math.min(i.start+i.count,d.start+d.count));n<r;n+=3){o=Wr(this,p,t,Tr,a,s,l,c,u,n,n+1,n+2),o&&(o.faceIndex=Math.floor(n/3),o.face.materialIndex=i.materialIndex,e.push(o))}}else{for(let n=Math.max(0,d.start),i=Math.min(a.count,d.start+d.count);n<i;n+=3){o=Wr(this,r,t,Tr,a,s,l,c,u,n,n+1,n+2),o&&(o.faceIndex=Math.floor(n/3),e.push(o))}}}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}function Wr(t,e,n,r,i,o,a,s,l,c,u,h){Cr.fromBufferAttribute(i,c),Lr.fromBufferAttribute(i,u),Ar.fromBufferAttribute(i,h);const d=t.morphTargetInfluences;if(o&&d){Dr.set(0,0,0),kr.set(0,0,0),Ir.set(0,0,0);for(let t=0,e=o.length;t<e;t++){const e=d[t],n=o[t];0!==e&&(Rr.fromBufferAttribute(n,c),Pr.fromBufferAttribute(n,u),Nr.fromBufferAttribute(n,h),a?(Dr.addScaledVector(Rr,e),kr.addScaledVector(Pr,e),Ir.addScaledVector(Nr,e)):(Dr.addScaledVector(Rr.sub(Cr),e),kr.addScaledVector(Pr.sub(Lr),e),Ir.addScaledVector(Nr.sub(Ar),e)))}Cr.add(Dr),Lr.add(kr),Ar.add(Ir)}t.isSkinnedMesh&&(t.boneTransform(c,Cr),t.boneTransform(u,Lr),t.boneTransform(h,Ar));const p=function(t,e,n,r,i,o,a,s){let l;if(l=1===e.side?r.intersectTriangle(a,o,i,!0,s):r.intersectTriangle(i,o,a,2!==e.side,s),null===l)return null;Ur.copy(s),Ur.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(Ur);return c<n.near||c>n.far?null:{distance:c,point:Ur.clone(),object:t}}(t,e,n,r,Cr,Lr,Ar,Br);if(p){s&&(Or.fromBufferAttribute(s,c),zr.fromBufferAttribute(s,u),Fr.fromBufferAttribute(s,h),p.uv=Qn.getUV(Br,Cr,Lr,Ar,Or,zr,Fr,new Te)),l&&(Or.fromBufferAttribute(l,c),zr.fromBufferAttribute(l,u),Fr.fromBufferAttribute(l,h),p.uv2=Qn.getUV(Br,Cr,Lr,Ar,Or,zr,Fr,new Te));const t={a:c,b:u,c:h,normal:new Be,materialIndex:0};Qn.getNormal(Cr,Lr,Ar,t.normal),p.face=t}return p}Hr.prototype.isMesh=!0;class Gr extends Mr{constructor(t=1,e=1,n=1,r=1,i=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:o};const a=this;r=Math.floor(r),i=Math.floor(i),o=Math.floor(o);const s=[],l=[],c=[],u=[];let h=0,d=0;function p(t,e,n,r,i,o,p,f,m,g,v){const y=o/m,x=p/g,b=o/2,w=p/2,_=f/2,M=m+1,S=g+1;let T=0,E=0;const C=new Be;for(let o=0;o<S;o++){const a=o*x-w;for(let s=0;s<M;s++){const h=s*y-b;C[t]=h*r,C[e]=a*i,C[n]=_,l.push(C.x,C.y,C.z),C[t]=0,C[e]=0,C[n]=f>0?1:-1,c.push(C.x,C.y,C.z),u.push(s/m),u.push(1-o/g),T+=1}}for(let t=0;t<g;t++)for(let e=0;e<m;e++){const n=h+e+M*t,r=h+e+M*(t+1),i=h+(e+1)+M*(t+1),o=h+(e+1)+M*t;s.push(n,r,o),s.push(r,i,o),E+=6}a.addGroup(d,E,v),d+=E,h+=T}p("z","y","x",-1,-1,n,e,t,o,i,0),p("z","y","x",1,-1,n,e,-t,o,i,1),p("x","z","y",1,1,t,n,e,r,o,2),p("x","z","y",1,-1,t,n,-e,r,o,3),p("x","y","z",1,-1,t,e,n,r,i,4),p("x","y","z",-1,-1,t,e,-n,r,i,5),this.setIndex(s),this.setAttribute("position",new mr(l,3)),this.setAttribute("normal",new mr(c,3)),this.setAttribute("uv",new mr(u,2))}static fromJSON(t){return new Gr(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Vr(t){const e={};for(const n in t){e[n]={};for(const r in t[n]){const i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}}return e}function jr(t){const e={};for(let n=0;n<t.length;n++){const r=Vr(t[n]);for(const t in r)e[t]=r[t]}return e}const $r={clone:Vr,merge:jr};class qr extends er{constructor(t){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Vr(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const n in this.uniforms){const r=this.uniforms[n].value;r&&r.isTexture?e.uniforms[n]={type:"t",value:r.toJSON(t).uuid}:r&&r.isColor?e.uniforms[n]={type:"c",value:r.getHex()}:r&&r.isVector2?e.uniforms[n]={type:"v2",value:r.toArray()}:r&&r.isVector3?e.uniforms[n]={type:"v3",value:r.toArray()}:r&&r.isVector4?e.uniforms[n]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?e.uniforms[n]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?e.uniforms[n]={type:"m4",value:r.toArray()}:e.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const t in this.extensions)!0===this.extensions[t]&&(n[t]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}qr.prototype.isShaderMaterial=!0;class Xr extends Wn{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new vn,this.projectionMatrix=new vn,this.projectionMatrixInverse=new vn}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}Xr.prototype.isCamera=!0;class Yr extends Xr{constructor(t=50,e=1,n=.1,r=2e3){super(),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*me*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*fe*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*me*Math.atan(Math.tan(.5*fe*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,n,r,i,o){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*fe*this.fov)/this.zoom,n=2*e,r=this.aspect*n,i=-.5*r;const o=this.view;if(null!==this.view&&this.view.enabled){const t=o.fullWidth,a=o.fullHeight;i+=o.offsetX*r/t,e-=o.offsetY*n/a,r*=o.width/t,n*=o.height/a}const a=this.filmOffset;0!==a&&(i+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}Yr.prototype.isPerspectiveCamera=!0;const Zr=90;class Jr extends Wn{constructor(t,e,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const r=new Yr(Zr,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Be(1,0,0)),this.add(r);const i=new Yr(Zr,1,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new Be(-1,0,0)),this.add(i);const o=new Yr(Zr,1,t,e);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new Be(0,1,0)),this.add(o);const a=new Yr(Zr,1,t,e);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new Be(0,-1,0)),this.add(a);const s=new Yr(Zr,1,t,e);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new Be(0,0,1)),this.add(s);const l=new Yr(Zr,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new Be(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[r,i,o,a,s,l]=this.children,c=t.xr.enabled,u=t.getRenderTarget();t.xr.enabled=!1;const h=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,r),t.setRenderTarget(n,1),t.render(e,i),t.setRenderTarget(n,2),t.render(e,o),t.setRenderTarget(n,3),t.render(e,a),t.setRenderTarget(n,4),t.render(e,s),n.texture.generateMipmaps=h,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(u),t.xr.enabled=c}}class Kr extends De{constructor(t,e,n,r,i,o,a,s,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:Nt,n,r,i,o,a,s,l,c),this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}Kr.prototype.isCubeTexture=!0;class Qr extends Oe{constructor(t,e,n){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=n),super(t,t,e),e=e||{},this.texture=new Kr(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:Bt,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=Xt,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},r=new Gr(5,5,5),i=new qr({name:"CubemapFromEquirect",uniforms:Vr(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=e;const o=new Hr(r,i),a=e.minFilter;e.minFilter===Ut&&(e.minFilter=Bt);return new Jr(1,10,this).update(t,o),e.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(t,e,n,r){const i=t.getRenderTarget();for(let i=0;i<6;i++)t.setRenderTarget(this,i),t.clear(e,n,r);t.setRenderTarget(i)}}Qr.prototype.isWebGLCubeRenderTarget=!0;const ti=new Be,ei=new Be,ni=new Ee;class ri{constructor(t=new Be(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,r){return this.normal.set(t,e,n),this.constant=r,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const r=ti.subVectors(n,e).cross(ei.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){const n=t.delta(ti),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const i=-(t.start.dot(this.normal)+this.constant)/r;return i<0||i>1?null:e.copy(n).multiplyScalar(i).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||ni.getNormalMatrix(t),r=this.coplanarPoint(ti).applyMatrix4(t),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}ri.prototype.isPlane=!0;const ii=new ln,oi=new Be;class ai{constructor(t=new ri,e=new ri,n=new ri,r=new ri,i=new ri,o=new ri){this.planes=[t,e,n,r,i,o]}set(t,e,n,r,i,o){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(r),a[4].copy(i),a[5].copy(o),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,r=n[0],i=n[1],o=n[2],a=n[3],s=n[4],l=n[5],c=n[6],u=n[7],h=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return e[0].setComponents(a-r,u-s,f-h,y-m).normalize(),e[1].setComponents(a+r,u+s,f+h,y+m).normalize(),e[2].setComponents(a+i,u+l,f+d,y+g).normalize(),e[3].setComponents(a-i,u-l,f-d,y-g).normalize(),e[4].setComponents(a-o,u-c,f-p,y-v).normalize(),e[5].setComponents(a+o,u+c,f+p,y+v).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),ii.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(ii)}intersectsSprite(t){return ii.center.set(0,0,0),ii.radius=.7071067811865476,ii.applyMatrix4(t.matrixWorld),this.intersectsSphere(ii)}intersectsSphere(t){const e=this.planes,n=t.center,r=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(n)<r)return!1}return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const r=e[n];if(oi.x=r.normal.x>0?t.max.x:t.min.x,oi.y=r.normal.y>0?t.max.y:t.min.y,oi.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(oi)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function si(){let t=null,e=!1,n=null,r=null;function i(e,o){n(e,o),r=t.requestAnimationFrame(i)}return{start:function(){!0!==e&&null!==n&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function li(t,e){const n=e.isWebGL2,r=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),r.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=r.get(e);n&&(t.deleteBuffer(n.buffer),r.delete(e))},update:function(e,i){if(e.isGLBufferAttribute){const t=r.get(e);return void((!t||t.version<e.version)&&r.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const o=r.get(e);void 0===o?r.set(e,function(e,r){const i=e.array,o=e.usage,a=t.createBuffer();t.bindBuffer(r,a),t.bufferData(r,i,o),e.onUploadCallback();let s=5126;return i instanceof Float32Array?s=5126:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?e.isFloat16BufferAttribute?n?s=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):s=5123:i instanceof Int16Array?s=5122:i instanceof Uint32Array?s=5125:i instanceof Int32Array?s=5124:i instanceof Int8Array?s=5120:(i instanceof Uint8Array||i instanceof Uint8ClampedArray)&&(s=5121),{buffer:a,type:s,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version}}(e,i)):o.version<e.version&&(!function(e,r,i){const o=r.array,a=r.updateRange;t.bindBuffer(i,e),-1===a.count?t.bufferSubData(i,0,o):(n?t.bufferSubData(i,a.offset*o.BYTES_PER_ELEMENT,o,a.offset,a.count):t.bufferSubData(i,a.offset*o.BYTES_PER_ELEMENT,o.subarray(a.offset,a.offset+a.count)),a.count=-1)}(o.buffer,e,i),o.version=e.version)}}}class ci extends Mr{constructor(t=1,e=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r};const i=t/2,o=e/2,a=Math.floor(n),s=Math.floor(r),l=a+1,c=s+1,u=t/a,h=e/s,d=[],p=[],f=[],m=[];for(let t=0;t<c;t++){const e=t*h-o;for(let n=0;n<l;n++){const r=n*u-i;p.push(r,-e,0),f.push(0,0,1),m.push(n/a),m.push(1-t/s)}}for(let t=0;t<s;t++)for(let e=0;e<a;e++){const n=e+l*t,r=e+l*(t+1),i=e+1+l*(t+1),o=e+1+l*t;d.push(n,r,o),d.push(r,i,o)}this.setIndex(d),this.setAttribute("position",new mr(p,3)),this.setAttribute("normal",new mr(f,3)),this.setAttribute("uv",new mr(m,2))}static fromJSON(t){return new ci(t.width,t.height,t.widthSegments,t.heightSegments)}}const ui={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn 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 );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn 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 );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec;\n\t\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\t\treflectVec = reflect( - viewDir, normal );\n\t\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\t#else\n\t\t\t\treflectVec = refract( - viewDir, normal, refractionRatio );\n\t\t\t#endif\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tlightMapIrradiance *= PI;\n\t#endif\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= specularColorMapTexelToLinear( texture2D( specularColorMap, vUv ) ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= sheenColorMapTexelToLinear( texture2D( sheenColorMap, vUv ) ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid 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 ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] > 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1, 2 ) * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform vec2 morphTargetsTextureSize;\n\t\tvec3 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset, const in int stride ) {\n\t\t\tfloat texelIndex = float( vertexIndex * stride + offset );\n\t\t\tfloat y = floor( texelIndex / morphTargetsTextureSize.x );\n\t\t\tfloat x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tvec3 morphUV = vec3( ( x + 0.5 ) / morphTargetsTextureSize.x, y / morphTargetsTextureSize.y, morphTargetIndex );\n\t\t\treturn texture( morphTargetsTexture, morphUV ).xyz;\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\t#ifndef USE_MORPHNORMALS\n\t\t\t\tif ( morphTargetInfluences[ i ] > 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 1 ) * morphTargetInfluences[ i ];\n\t\t\t#else\n\t\t\t\tif ( morphTargetInfluences[ i ] > 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 2 ) * morphTargetInfluences[ i ];\n\t\t\t#endif\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( float roughness, float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( vec2 fragCoord, float roughness, float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 diffuseColor, vec3 specularColor, float specularF90,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\n\t\tvec3 attenuationColor, float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - clearcoat * Fcc ) + clearcoatSpecular * clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}"},hi={common:{diffuse:{value:new lr(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Ee},uv2Transform:{value:new Ee},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Te(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new lr(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{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 lr(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Ee}},sprite:{diffuse:{value:new lr(16777215)},opacity:{value:1},center:{value:new Te(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Ee}}},di={basic:{uniforms:jr([hi.common,hi.specularmap,hi.envmap,hi.aomap,hi.lightmap,hi.fog]),vertexShader:ui.meshbasic_vert,fragmentShader:ui.meshbasic_frag},lambert:{uniforms:jr([hi.common,hi.specularmap,hi.envmap,hi.aomap,hi.lightmap,hi.emissivemap,hi.fog,hi.lights,{emissive:{value:new lr(0)}}]),vertexShader:ui.meshlambert_vert,fragmentShader:ui.meshlambert_frag},phong:{uniforms:jr([hi.common,hi.specularmap,hi.envmap,hi.aomap,hi.lightmap,hi.emissivemap,hi.bumpmap,hi.normalmap,hi.displacementmap,hi.fog,hi.lights,{emissive:{value:new lr(0)},specular:{value:new lr(1118481)},shininess:{value:30}}]),vertexShader:ui.meshphong_vert,fragmentShader:ui.meshphong_frag},standard:{uniforms:jr([hi.common,hi.envmap,hi.aomap,hi.lightmap,hi.emissivemap,hi.bumpmap,hi.normalmap,hi.displacementmap,hi.roughnessmap,hi.metalnessmap,hi.fog,hi.lights,{emissive:{value:new lr(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ui.meshphysical_vert,fragmentShader:ui.meshphysical_frag},toon:{uniforms:jr([hi.common,hi.aomap,hi.lightmap,hi.emissivemap,hi.bumpmap,hi.normalmap,hi.displacementmap,hi.gradientmap,hi.fog,hi.lights,{emissive:{value:new lr(0)}}]),vertexShader:ui.meshtoon_vert,fragmentShader:ui.meshtoon_frag},matcap:{uniforms:jr([hi.common,hi.bumpmap,hi.normalmap,hi.displacementmap,hi.fog,{matcap:{value:null}}]),vertexShader:ui.meshmatcap_vert,fragmentShader:ui.meshmatcap_frag},points:{uniforms:jr([hi.points,hi.fog]),vertexShader:ui.points_vert,fragmentShader:ui.points_frag},dashed:{uniforms:jr([hi.common,hi.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ui.linedashed_vert,fragmentShader:ui.linedashed_frag},depth:{uniforms:jr([hi.common,hi.displacementmap]),vertexShader:ui.depth_vert,fragmentShader:ui.depth_frag},normal:{uniforms:jr([hi.common,hi.bumpmap,hi.normalmap,hi.displacementmap,{opacity:{value:1}}]),vertexShader:ui.meshnormal_vert,fragmentShader:ui.meshnormal_frag},sprite:{uniforms:jr([hi.sprite,hi.fog]),vertexShader:ui.sprite_vert,fragmentShader:ui.sprite_frag},background:{uniforms:{uvTransform:{value:new Ee},t2D:{value:null}},vertexShader:ui.background_vert,fragmentShader:ui.background_frag},cube:{uniforms:jr([hi.envmap,{opacity:{value:1}}]),vertexShader:ui.cube_vert,fragmentShader:ui.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ui.equirect_vert,fragmentShader:ui.equirect_frag},distanceRGBA:{uniforms:jr([hi.common,hi.displacementmap,{referencePosition:{value:new Be},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ui.distanceRGBA_vert,fragmentShader:ui.distanceRGBA_frag},shadow:{uniforms:jr([hi.lights,hi.fog,{color:{value:new lr(0)},opacity:{value:1}}]),vertexShader:ui.shadow_vert,fragmentShader:ui.shadow_frag}};function pi(t,e,n,r,i){const o=new lr(0);let a,s,l=0,c=null,u=0,h=null;function d(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,i)}return{getClearColor:function(){return o},setClearColor:function(t,e=1){o.set(t),l=e,d(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(t){l=t,d(o,l)},render:function(n,i){let p=!1,f=!0===i.isScene?i.background:null;f&&f.isTexture&&(f=e.get(f));const m=t.xr,g=m.getSession&&m.getSession();g&&"additive"===g.environmentBlendMode&&(f=null),null===f?d(o,l):f&&f.isColor&&(d(f,1),p=!0),(t.autoClear||p)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),f&&(f.isCubeTexture||f.mapping===kt)?(void 0===s&&(s=new Hr(new Gr(1,1,1),new qr({name:"BackgroundCubeMaterial",uniforms:Vr(di.cube.uniforms),vertexShader:di.cube.vertexShader,fragmentShader:di.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(s)),s.material.uniforms.envMap.value=f,s.material.uniforms.flipEnvMap.value=f.isCubeTexture&&!1===f.isRenderTargetTexture?-1:1,c===f&&u===f.version&&h===t.toneMapping||(s.material.needsUpdate=!0,c=f,u=f.version,h=t.toneMapping),n.unshift(s,s.geometry,s.material,0,0,null)):f&&f.isTexture&&(void 0===a&&(a=new Hr(new ci(2,2),new qr({name:"BackgroundMaterial",uniforms:Vr(di.background.uniforms),vertexShader:di.background.vertexShader,fragmentShader:di.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(a)),a.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),a.material.uniforms.uvTransform.value.copy(f.matrix),c===f&&u===f.version&&h===t.toneMapping||(a.material.needsUpdate=!0,c=f,u=f.version,h=t.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null))}}}function fi(t,e,n,r){const i=t.getParameter(34921),o=r.isWebGL2?null:e.get("OES_vertex_array_object"),a=r.isWebGL2||null!==o,s={},l=d(null);let c=l;function u(e){return r.isWebGL2?t.bindVertexArray(e):o.bindVertexArrayOES(e)}function h(e){return r.isWebGL2?t.deleteVertexArray(e):o.deleteVertexArrayOES(e)}function d(t){const e=[],n=[],r=[];for(let t=0;t<i;t++)e[t]=0,n[t]=0,r[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:r,object:t,attributes:{},index:null}}function p(){const t=c.newAttributes;for(let e=0,n=t.length;e<n;e++)t[e]=0}function f(t){m(t,0)}function m(n,i){const o=c.newAttributes,a=c.enabledAttributes,s=c.attributeDivisors;if(o[n]=1,0===a[n]&&(t.enableVertexAttribArray(n),a[n]=1),s[n]!==i){(r.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),s[n]=i}}function g(){const e=c.newAttributes,n=c.enabledAttributes;for(let r=0,i=n.length;r<i;r++)n[r]!==e[r]&&(t.disableVertexAttribArray(r),n[r]=0)}function v(e,n,i,o,a,s){!0!==r.isWebGL2||5124!==i&&5125!==i?t.vertexAttribPointer(e,n,i,o,a,s):t.vertexAttribIPointer(e,n,i,a,s)}function y(){x(),c!==l&&(c=l,u(c.object))}function x(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(i,l,h,y,x){let b=!1;if(a){const e=function(e,n,i){const a=!0===i.wireframe;let l=s[e.id];void 0===l&&(l={},s[e.id]=l);let c=l[n.id];void 0===c&&(c={},l[n.id]=c);let u=c[a];void 0===u&&(u=d(r.isWebGL2?t.createVertexArray():o.createVertexArrayOES()),c[a]=u);return u}(y,h,l);c!==e&&(c=e,u(c.object)),b=function(t,e){const n=c.attributes,r=t.attributes;let i=0;for(const t in r){const e=n[t],o=r[t];if(void 0===e)return!0;if(e.attribute!==o)return!0;if(e.data!==o.data)return!0;i++}return c.attributesNum!==i||c.index!==e}(y,x),b&&function(t,e){const n={},r=t.attributes;let i=0;for(const t in r){const e=r[t],o={};o.attribute=e,e.data&&(o.data=e.data),n[t]=o,i++}c.attributes=n,c.attributesNum=i,c.index=e}(y,x)}else{const t=!0===l.wireframe;c.geometry===y.id&&c.program===h.id&&c.wireframe===t||(c.geometry=y.id,c.program=h.id,c.wireframe=t,b=!0)}!0===i.isInstancedMesh&&(b=!0),null!==x&&n.update(x,34963),b&&(!function(i,o,a,s){if(!1===r.isWebGL2&&(i.isInstancedMesh||s.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;p();const l=s.attributes,c=a.getAttributes(),u=o.defaultAttributeValues;for(const e in c){const r=c[e];if(r.location>=0){let o=l[e];if(void 0===o&&("instanceMatrix"===e&&i.instanceMatrix&&(o=i.instanceMatrix),"instanceColor"===e&&i.instanceColor&&(o=i.instanceColor)),void 0!==o){const e=o.normalized,a=o.itemSize,l=n.get(o);if(void 0===l)continue;const c=l.buffer,u=l.type,h=l.bytesPerElement;if(o.isInterleavedBufferAttribute){const n=o.data,l=n.stride,d=o.offset;if(n&&n.isInstancedInterleavedBuffer){for(let t=0;t<r.locationSize;t++)m(r.location+t,n.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=n.meshPerAttribute*n.count)}else for(let t=0;t<r.locationSize;t++)f(r.location+t);t.bindBuffer(34962,c);for(let t=0;t<r.locationSize;t++)v(r.location+t,a/r.locationSize,u,e,l*h,(d+a/r.locationSize*t)*h)}else{if(o.isInstancedBufferAttribute){for(let t=0;t<r.locationSize;t++)m(r.location+t,o.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let t=0;t<r.locationSize;t++)f(r.location+t);t.bindBuffer(34962,c);for(let t=0;t<r.locationSize;t++)v(r.location+t,a/r.locationSize,u,e,a*h,a/r.locationSize*t*h)}}else if(void 0!==u){const n=u[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(r.location,n);break;case 3:t.vertexAttrib3fv(r.location,n);break;case 4:t.vertexAttrib4fv(r.location,n);break;default:t.vertexAttrib1fv(r.location,n)}}}}g()}(i,l,h,y),null!==x&&t.bindBuffer(34963,n.get(x).buffer))},reset:y,resetDefaultState:x,dispose:function(){y();for(const t in s){const e=s[t];for(const t in e){const n=e[t];for(const t in n)h(n[t].object),delete n[t];delete e[t]}delete s[t]}},releaseStatesOfGeometry:function(t){if(void 0===s[t.id])return;const e=s[t.id];for(const t in e){const n=e[t];for(const t in n)h(n[t].object),delete n[t];delete e[t]}delete s[t.id]},releaseStatesOfProgram:function(t){for(const e in s){const n=s[e];if(void 0===n[t.id])continue;const r=n[t.id];for(const t in r)h(r[t].object),delete r[t];delete n[t.id]}},initAttributes:p,enableAttribute:f,disableUnusedAttributes:g}}function mi(t,e,n,r){const i=r.isWebGL2;let o;this.setMode=function(t){o=t},this.render=function(e,r){t.drawArrays(o,e,r),n.update(r,o,1)},this.renderInstances=function(r,a,s){if(0===s)return;let l,c;if(i)l=t,c="drawArraysInstanced";else if(l=e.get("ANGLE_instanced_arrays"),c="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](o,r,a,s),n.update(a,o,s)}}function gi(t,e,n){let r;function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let a=void 0!==n.precision?n.precision:"highp";const s=i(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);const l=o||e.has("WEBGL_draw_buffers"),c=!0===n.logarithmicDepthBuffer,u=t.getParameter(34930),h=t.getParameter(35660),d=t.getParameter(3379),p=t.getParameter(34076),f=t.getParameter(34921),m=t.getParameter(36347),g=t.getParameter(36348),v=t.getParameter(36349),y=h>0,x=o||e.has("OES_texture_float");return{isWebGL2:o,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:a,logarithmicDepthBuffer:c,maxTextures:u,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:y&&x,maxSamples:o?t.getParameter(36183):0}}function vi(t){const e=this;let n=null,r=0,i=!1,o=!1;const a=new ri,s=new Ee,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function u(t,n,r,i){const o=null!==t?t.length:0;let c=null;if(0!==o){if(c=l.value,!0!==i||null===c){const e=r+4*o,i=n.matrixWorldInverse;s.getNormalMatrix(i),(null===c||c.length<e)&&(c=new Float32Array(e));for(let e=0,n=r;e!==o;++e,n+=4)a.copy(t[e]).applyMatrix4(i,s),a.normal.toArray(c,n),c[n+3]=a.constant}l.value=c,l.needsUpdate=!0}return e.numPlanes=o,e.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,o){const a=0!==t.length||e||0!==r||i;return i=e,n=u(t,o,0),r=t.length,a},this.beginShadows=function(){o=!0,u(null)},this.endShadows=function(){o=!1,c()},this.setState=function(e,a,s){const h=e.clippingPlanes,d=e.clipIntersection,p=e.clipShadows,f=t.get(e);if(!i||null===h||0===h.length||o&&!p)o?u(null):c();else{const t=o?0:r,e=4*t;let i=f.clippingState||null;l.value=i,i=u(h,a,e,s);for(let t=0;t!==e;++t)i[t]=n[t];f.clippingState=i,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function yi(t){let e=new WeakMap;function n(t,e){return 303===e?t.mapping=Nt:304===e&&(t.mapping=Dt),t}function r(t){const n=t.target;n.removeEventListener("dispose",r);const i=e.get(n);void 0!==i&&(e.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture&&!1===i.isRenderTargetTexture){const o=i.mapping;if(303===o||304===o){if(e.has(i)){return n(e.get(i).texture,i.mapping)}{const o=i.image;if(o&&o.height>0){const a=t.getRenderTarget(),s=new Qr(o.height/2);return s.fromEquirectangularTexture(t,i),e.set(i,s),t.setRenderTarget(a),i.addEventListener("dispose",r),n(s.texture,i.mapping)}return null}}}return i},dispose:function(){e=new WeakMap}}}di.physical={uniforms:jr([di.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Te(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new lr(0)},sheenColorMap:{value:null},sheenRoughness:{value:0},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Te},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new lr(0)},specularIntensity:{value:0},specularIntensityMap:{value:null},specularColor:{value:new lr(1,1,1)},specularColorMap:{value:null}}]),vertexShader:ui.meshphysical_vert,fragmentShader:ui.meshphysical_frag};class xi extends Xr{constructor(t=-1,e=1,n=1,r=-1,i=.1,o=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=r,this.near=i,this.far=o,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,r,i,o){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let i=n-t,o=n+t,a=r+e,s=r-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=t*this.view.offsetX,o=i+t*this.view.width,a-=e*this.view.offsetY,s=a-e*this.view.height}this.projectionMatrix.makeOrthographic(i,o,a,s,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}xi.prototype.isOrthographicCamera=!0;class bi extends qr{constructor(t){super(t),this.type="RawShaderMaterial"}}bi.prototype.isRawShaderMaterial=!0;const wi=Math.pow(2,8),_i=[.125,.215,.35,.446,.526,.582],Mi=5+_i.length,Si=20,Ti={[ie]:0,[oe]:1,[se]:2,3004:3,3005:4,3006:5,[ae]:6},Ei=new xi,{_lodPlanes:Ci,_sizeLods:Li,_sigmas:Ai}=zi(),Ri=new lr;let Pi=null;const Ni=(1+Math.sqrt(5))/2,Di=1/Ni,ki=[new Be(1,1,1),new Be(-1,1,1),new Be(1,1,-1),new Be(-1,1,-1),new Be(0,Ni,Di),new Be(0,Ni,-Di),new Be(Di,0,Ni),new Be(-Di,0,Ni),new Be(Ni,Di,0),new Be(-Ni,Di,0)];class Ii{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=function(t){const e=new Float32Array(t),n=new Be(0,1,0);return new bi({name:"SphericalGaussianBlur",defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:Ti[3e3]},outputEncoding:{value:Ti[3e3]}},vertexShader:Wi(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t${Gi()}\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1})}(Si),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,r=100){Pi=this._renderer.getRenderTarget();const i=this._allocateTargets();return this._sceneToCubeUV(t,n,r,i),e>0&&this._blur(i,0,0,e),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Hi(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Ui(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t<Ci.length;t++)Ci[t].dispose()}_cleanup(t){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(Pi),t.scissorTest=!1,Bi(t,0,0,t.width,t.height)}_fromTexture(t){Pi=this._renderer.getRenderTarget();const e=this._allocateTargets(t);return this._textureToCubeUV(t,e),this._applyPMREM(e),this._cleanup(e),e}_allocateTargets(t){const e={magFilter:Ft,minFilter:Ft,generateMipmaps:!1,type:Ht,format:1023,encoding:Oi(t)?t.encoding:se,depthBuffer:!1},n=Fi(e);return n.depthBuffer=!t,this._pingPongRenderTarget=Fi(e),n}_compileMaterial(t){const e=new Hr(Ci[0],t);this._renderer.compile(e,Ei)}_sceneToCubeUV(t,e,n,r){const i=new Yr(90,1,e,n),o=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],s=this._renderer,l=s.autoClear,c=s.outputEncoding,u=s.toneMapping;s.getClearColor(Ri),s.toneMapping=0,s.outputEncoding=ie,s.autoClear=!1;const h=new cr({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),d=new Hr(new Gr,h);let p=!1;const f=t.background;f?f.isColor&&(h.color.copy(f),t.background=null,p=!0):(h.color.copy(Ri),p=!0);for(let e=0;e<6;e++){const n=e%3;0==n?(i.up.set(0,o[e],0),i.lookAt(a[e],0,0)):1==n?(i.up.set(0,0,o[e]),i.lookAt(0,a[e],0)):(i.up.set(0,o[e],0),i.lookAt(0,0,a[e])),Bi(r,n*wi,e>2?wi:0,wi,wi),s.setRenderTarget(r),p&&s.render(d,i),s.render(t,i)}d.geometry.dispose(),d.material.dispose(),s.toneMapping=u,s.outputEncoding=c,s.autoClear=l,t.background=f}_setEncoding(t,e){!0===this._renderer.capabilities.isWebGL2&&e.format===Xt&&e.type===Ht&&e.encoding===oe?t.value=Ti[3e3]:t.value=Ti[e.encoding]}_textureToCubeUV(t,e){const n=this._renderer,r=t.mapping===Nt||t.mapping===Dt;r?null==this._cubemapShader&&(this._cubemapShader=Hi()):null==this._equirectShader&&(this._equirectShader=Ui());const i=r?this._cubemapShader:this._equirectShader,o=new Hr(Ci[0],i),a=i.uniforms;a.envMap.value=t,r||a.texelSize.value.set(1/t.image.width,1/t.image.height),this._setEncoding(a.inputEncoding,t),this._setEncoding(a.outputEncoding,e.texture),Bi(e,0,0,3*wi,2*wi),n.setRenderTarget(e),n.render(o,Ei)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let e=1;e<Mi;e++){const n=Math.sqrt(Ai[e]*Ai[e]-Ai[e-1]*Ai[e-1]),r=ki[(e-1)%ki.length];this._blur(t,e-1,e,n,r)}e.autoClear=n}_blur(t,e,n,r,i){const o=this._pingPongRenderTarget;this._halfBlur(t,o,e,n,r,"latitudinal",i),this._halfBlur(o,t,n,n,r,"longitudinal",i)}_halfBlur(t,e,n,r,i,o,a){const s=this._renderer,l=this._blurMaterial;"latitudinal"!==o&&"longitudinal"!==o&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new Hr(Ci[r],l),u=l.uniforms,h=Li[n]-1,d=isFinite(i)?Math.PI/(2*h):2*Math.PI/39,p=i/d,f=isFinite(i)?1+Math.floor(3*p):Si;f>Si&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const m=[];let g=0;for(let t=0;t<Si;++t){const e=t/p,n=Math.exp(-e*e/2);m.push(n),0==t?g+=n:t<f&&(g+=2*n)}for(let t=0;t<m.length;t++)m[t]=m[t]/g;u.envMap.value=t.texture,u.samples.value=f,u.weights.value=m,u.latitudinal.value="latitudinal"===o,a&&(u.poleAxis.value=a),u.dTheta.value=d,u.mipInt.value=8-n,this._setEncoding(u.inputEncoding,t.texture),this._setEncoding(u.outputEncoding,t.texture);const v=Li[r];Bi(e,3*Math.max(0,wi-2*v),(0===r?0:2*wi)+2*v*(r>4?r-8+4:0),3*v,2*v),s.setRenderTarget(e),s.render(c,Ei)}}function Oi(t){return void 0!==t&&t.type===Ht&&(t.encoding===ie||t.encoding===oe||t.encoding===ae)}function zi(){const t=[],e=[],n=[];let r=8;for(let i=0;i<Mi;i++){const o=Math.pow(2,r);e.push(o);let a=1/o;i>4?a=_i[i-8+4-1]:0==i&&(a=0),n.push(a);const s=1/(o-1),l=-s/2,c=1+s/2,u=[l,l,c,l,c,c,l,l,c,c,l,c],h=6,d=6,p=3,f=2,m=1,g=new Float32Array(p*d*h),v=new Float32Array(f*d*h),y=new Float32Array(m*d*h);for(let t=0;t<h;t++){const e=t%3*2/3-1,n=t>2?0:-1,r=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];g.set(r,p*d*t),v.set(u,f*d*t);const i=[t,t,t,t,t,t];y.set(i,m*d*t)}const x=new Mr;x.setAttribute("position",new dr(g,p)),x.setAttribute("uv",new dr(v,f)),x.setAttribute("faceIndex",new dr(y,m)),t.push(x),r>4&&r--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function Fi(t){const e=new Oe(3*wi,3*wi,t);return e.texture.mapping=kt,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Bi(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function Ui(){const t=new Te(1,1);return new bi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:Ti[3e3]},outputEncoding:{value:Ti[3e3]}},vertexShader:Wi(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t${Gi()}\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1})}function Hi(){return new bi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:Ti[3e3]},outputEncoding:{value:Ti[3e3]}},vertexShader:Wi(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t${Gi()}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1})}function Wi(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Gi(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"}function Vi(t){let e=new WeakMap,n=null;function r(t){const n=t.target;n.removeEventListener("dispose",r);const i=e.get(n);void 0!==i&&(e.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture&&!1===i.isRenderTargetTexture){const o=i.mapping,a=303===o||304===o,s=o===Nt||o===Dt;if(a||s){if(e.has(i))return e.get(i).texture;{const o=i.image;if(a&&o&&o.height>0||s&&o&&function(t){let e=0;const n=6;for(let r=0;r<n;r++)void 0!==t[r]&&e++;return e===n}(o)){const o=t.getRenderTarget();null===n&&(n=new Ii(t));const s=a?n.fromEquirectangular(i):n.fromCubemap(i);return e.set(i,s),t.setRenderTarget(o),i.addEventListener("dispose",r),s.texture}return null}}}return i},dispose:function(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function ji(t){const e={};function n(n){if(void 0!==e[n])return e[n];let r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=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":r=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":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(n)}return e[n]=r,r}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float")},get:function(t){const e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function $i(t,e,n,r){const i={},o=new WeakMap;function a(t){const s=t.target;null!==s.index&&e.remove(s.index);for(const t in s.attributes)e.remove(s.attributes[t]);s.removeEventListener("dispose",a),delete i[s.id];const l=o.get(s);l&&(e.remove(l),o.delete(s)),r.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(t){const n=[],r=t.index,i=t.attributes.position;let a=0;if(null!==r){const t=r.array;a=r.version;for(let e=0,r=t.length;e<r;e+=3){const r=t[e+0],i=t[e+1],o=t[e+2];n.push(r,i,i,o,o,r)}}else{const t=i.array;a=i.version;for(let e=0,r=t.length/3-1;e<r;e+=3){const t=e+0,r=e+1,i=e+2;n.push(t,r,r,i,i,t)}}const s=new(Ce(n)>65535?fr:pr)(n,1);s.version=a;const l=o.get(t);l&&e.remove(l),o.set(t,s)}return{get:function(t,e){return!0===i[e.id]||(e.addEventListener("dispose",a),i[e.id]=!0,n.memory.geometries++),e},update:function(t){const n=t.attributes;for(const t in n)e.update(n[t],34962);const r=t.morphAttributes;for(const t in r){const n=r[t];for(let t=0,r=n.length;t<r;t++)e.update(n[t],34962)}},getWireframeAttribute:function(t){const e=o.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&s(t)}else s(t);return o.get(t)}}}function qi(t,e,n,r){const i=r.isWebGL2;let o,a,s;this.setMode=function(t){o=t},this.setIndex=function(t){a=t.type,s=t.bytesPerElement},this.render=function(e,r){t.drawElements(o,r,a,e*s),n.update(r,o,1)},this.renderInstances=function(r,l,c){if(0===c)return;let u,h;if(i)u=t,h="drawElementsInstanced";else if(u=e.get("ANGLE_instanced_arrays"),h="drawElementsInstancedANGLE",null===u)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[h](o,l,a,r*s,c),n.update(l,o,c)}}function Xi(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,n,r){switch(e.calls++,n){case 4:e.triangles+=r*(t/3);break;case 1:e.lines+=r*(t/2);break;case 3:e.lines+=r*(t-1);break;case 2:e.lines+=r*t;break;case 0:e.points+=r*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}class Yi extends De{constructor(t=null,e=1,n=1,r=1){super(null),this.image={data:t,width:e,height:n,depth:r},this.magFilter=Ft,this.minFilter=Ft,this.wrapR=Ot,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}function Zi(t,e){return t[0]-e[0]}function Ji(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Ki(t,e){let n=1;const r=e.isInterleavedBufferAttribute?e.data.array:e.array;r instanceof Int8Array?n=127:r instanceof Int16Array?n=32767:r instanceof Int32Array?n=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",r),t.divideScalar(n)}function Qi(t,e,n){const r={},i=new Float32Array(8),o=new WeakMap,a=new Be,s=[];for(let t=0;t<8;t++)s[t]=[t,0];return{update:function(l,c,u,h){const d=l.morphTargetInfluences;if(!0===e.isWebGL2){const r=c.morphAttributes.position.length;let i=o.get(c);if(void 0===i||i.count!==r){void 0!==i&&i.texture.dispose();const t=void 0!==c.morphAttributes.normal,n=c.morphAttributes.position,s=c.morphAttributes.normal||[],l=!0===t?2:1;let u=c.attributes.position.count*l,h=1;u>e.maxTextureSize&&(h=Math.ceil(u/e.maxTextureSize),u=e.maxTextureSize);const d=new Float32Array(u*h*4*r),p=new Yi(d,u,h,r);p.format=Xt,p.type=Vt;const f=4*l;for(let e=0;e<r;e++){const r=n[e],i=s[e],o=u*h*4*e;for(let e=0;e<r.count;e++){a.fromBufferAttribute(r,e),!0===r.normalized&&Ki(a,r);const n=e*f;d[o+n+0]=a.x,d[o+n+1]=a.y,d[o+n+2]=a.z,d[o+n+3]=0,!0===t&&(a.fromBufferAttribute(i,e),!0===i.normalized&&Ki(a,i),d[o+n+4]=a.x,d[o+n+5]=a.y,d[o+n+6]=a.z,d[o+n+7]=0)}}i={count:r,texture:p,size:new Te(u,h)},o.set(c,i)}let s=0;for(let t=0;t<d.length;t++)s+=d[t];const l=c.morphTargetsRelative?1:1-s;h.getUniforms().setValue(t,"morphTargetBaseInfluence",l),h.getUniforms().setValue(t,"morphTargetInfluences",d),h.getUniforms().setValue(t,"morphTargetsTexture",i.texture,n),h.getUniforms().setValue(t,"morphTargetsTextureSize",i.size)}else{const e=void 0===d?0:d.length;let n=r[c.id];if(void 0===n||n.length!==e){n=[];for(let t=0;t<e;t++)n[t]=[t,0];r[c.id]=n}for(let t=0;t<e;t++){const e=n[t];e[0]=t,e[1]=d[t]}n.sort(Ji);for(let t=0;t<8;t++)t<e&&n[t][1]?(s[t][0]=n[t][0],s[t][1]=n[t][1]):(s[t][0]=Number.MAX_SAFE_INTEGER,s[t][1]=0);s.sort(Zi);const o=c.morphAttributes.position,a=c.morphAttributes.normal;let l=0;for(let t=0;t<8;t++){const e=s[t],n=e[0],r=e[1];n!==Number.MAX_SAFE_INTEGER&&r?(o&&c.getAttribute("morphTarget"+t)!==o[n]&&c.setAttribute("morphTarget"+t,o[n]),a&&c.getAttribute("morphNormal"+t)!==a[n]&&c.setAttribute("morphNormal"+t,a[n]),i[t]=r,l+=r):(o&&!0===c.hasAttribute("morphTarget"+t)&&c.deleteAttribute("morphTarget"+t),a&&!0===c.hasAttribute("morphNormal"+t)&&c.deleteAttribute("morphNormal"+t),i[t]=0)}const u=c.morphTargetsRelative?1:1-l;h.getUniforms().setValue(t,"morphTargetBaseInfluence",u),h.getUniforms().setValue(t,"morphTargetInfluences",i)}}}}function to(t,e,n,r){let i=new WeakMap;function o(t){const e=t.target;e.removeEventListener("dispose",o),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(t){const a=r.render.frame,s=t.geometry,l=e.get(t,s);return i.get(l)!==a&&(e.update(l),i.set(l,a)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",o)&&t.addEventListener("dispose",o),n.update(t.instanceMatrix,34962),null!==t.instanceColor&&n.update(t.instanceColor,34962)),l},dispose:function(){i=new WeakMap}}}Yi.prototype.isDataTexture2DArray=!0;class eo extends De{constructor(t=null,e=1,n=1,r=1){super(null),this.image={data:t,width:e,height:n,depth:r},this.magFilter=Ft,this.minFilter=Ft,this.wrapR=Ot,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}eo.prototype.isDataTexture3D=!0;const no=new De,ro=new Yi,io=new eo,oo=new Kr,ao=[],so=[],lo=new Float32Array(16),co=new Float32Array(9),uo=new Float32Array(4);function ho(t,e,n){const r=t[0];if(r<=0||r>0)return t;const i=e*n;let o=ao[i];if(void 0===o&&(o=new Float32Array(i),ao[i]=o),0!==e){r.toArray(o,0);for(let r=1,i=0;r!==e;++r)i+=n,t[r].toArray(o,i)}return o}function po(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}function fo(t,e){for(let n=0,r=e.length;n<r;n++)t[n]=e[n]}function mo(t,e){let n=so[e];void 0===n&&(n=new Int32Array(e),so[e]=n);for(let r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function go(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function vo(t,e){const n=this.cache;if(void 0!==e.x)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(po(n,e))return;t.uniform2fv(this.addr,e),fo(n,e)}}function yo(t,e){const n=this.cache;if(void 0!==e.x)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(void 0!==e.r)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(po(n,e))return;t.uniform3fv(this.addr,e),fo(n,e)}}function xo(t,e){const n=this.cache;if(void 0!==e.x)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(po(n,e))return;t.uniform4fv(this.addr,e),fo(n,e)}}function bo(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(po(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),fo(n,e)}else{if(po(n,r))return;uo.set(r),t.uniformMatrix2fv(this.addr,!1,uo),fo(n,r)}}function wo(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(po(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),fo(n,e)}else{if(po(n,r))return;co.set(r),t.uniformMatrix3fv(this.addr,!1,co),fo(n,r)}}function _o(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(po(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),fo(n,e)}else{if(po(n,r))return;lo.set(r),t.uniformMatrix4fv(this.addr,!1,lo),fo(n,r)}}function Mo(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function So(t,e){const n=this.cache;po(n,e)||(t.uniform2iv(this.addr,e),fo(n,e))}function To(t,e){const n=this.cache;po(n,e)||(t.uniform3iv(this.addr,e),fo(n,e))}function Eo(t,e){const n=this.cache;po(n,e)||(t.uniform4iv(this.addr,e),fo(n,e))}function Co(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Lo(t,e){const n=this.cache;po(n,e)||(t.uniform2uiv(this.addr,e),fo(n,e))}function Ao(t,e){const n=this.cache;po(n,e)||(t.uniform3uiv(this.addr,e),fo(n,e))}function Ro(t,e){const n=this.cache;po(n,e)||(t.uniform4uiv(this.addr,e),fo(n,e))}function Po(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(e||no,i)}function No(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||io,i)}function Do(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(e||oo,i)}function ko(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||ro,i)}function Io(t,e){t.uniform1fv(this.addr,e)}function Oo(t,e){const n=ho(e,this.size,2);t.uniform2fv(this.addr,n)}function zo(t,e){const n=ho(e,this.size,3);t.uniform3fv(this.addr,n)}function Fo(t,e){const n=ho(e,this.size,4);t.uniform4fv(this.addr,n)}function Bo(t,e){const n=ho(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Uo(t,e){const n=ho(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function Ho(t,e){const n=ho(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Wo(t,e){t.uniform1iv(this.addr,e)}function Go(t,e){t.uniform2iv(this.addr,e)}function Vo(t,e){t.uniform3iv(this.addr,e)}function jo(t,e){t.uniform4iv(this.addr,e)}function $o(t,e){t.uniform1uiv(this.addr,e)}function qo(t,e){t.uniform2uiv(this.addr,e)}function Xo(t,e){t.uniform3uiv(this.addr,e)}function Yo(t,e){t.uniform4uiv(this.addr,e)}function Zo(t,e,n){const r=e.length,i=mo(n,r);t.uniform1iv(this.addr,i);for(let t=0;t!==r;++t)n.safeSetTexture2D(e[t]||no,i[t])}function Jo(t,e,n){const r=e.length,i=mo(n,r);t.uniform1iv(this.addr,i);for(let t=0;t!==r;++t)n.safeSetTextureCube(e[t]||oo,i[t])}function Ko(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=function(t){switch(t){case 5126:return go;case 35664:return vo;case 35665:return yo;case 35666:return xo;case 35674:return bo;case 35675:return wo;case 35676:return _o;case 5124:case 35670:return Mo;case 35667:case 35671:return So;case 35668:case 35672:return To;case 35669:case 35673:return Eo;case 5125:return Co;case 36294:return Lo;case 36295:return Ao;case 36296:return Ro;case 35678:case 36198:case 36298:case 36306:case 35682:return Po;case 35679:case 36299:case 36307:return No;case 35680:case 36300:case 36308:case 36293:return Do;case 36289:case 36303:case 36311:case 36292:return ko}}(e.type)}function Qo(t,e,n){this.id=t,this.addr=n,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Io;case 35664:return Oo;case 35665:return zo;case 35666:return Fo;case 35674:return Bo;case 35675:return Uo;case 35676:return Ho;case 5124:case 35670:return Wo;case 35667:case 35671:return Go;case 35668:case 35672:return Vo;case 35669:case 35673:return jo;case 5125:return $o;case 36294:return qo;case 36295:return Xo;case 36296:return Yo;case 35678:case 36198:case 36298:case 36306:case 35682:return Zo;case 35680:case 36300:case 36308:case 36293:return Jo}}(e.type)}function ta(t){this.id=t,this.seq=[],this.map={}}Qo.prototype.updateCache=function(t){const e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),fo(e,t)},ta.prototype.setValue=function(t,e,n){const r=this.seq;for(let i=0,o=r.length;i!==o;++i){const o=r[i];o.setValue(t,e[o.id],n)}};const ea=/(\w+)(\])?(\[|\.)?/g;function na(t,e){t.seq.push(e),t.map[e.id]=e}function ra(t,e,n){const r=t.name,i=r.length;for(ea.lastIndex=0;;){const o=ea.exec(r),a=ea.lastIndex;let s=o[1];const l="]"===o[2],c=o[3];if(l&&(s|=0),void 0===c||"["===c&&a+2===i){na(n,void 0===c?new Ko(s,t,e):new Qo(s,t,e));break}{let t=n.map[s];void 0===t&&(t=new ta(s),na(n,t)),n=t}}}function ia(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,35718);for(let r=0;r<n;++r){const n=t.getActiveUniform(e,r);ra(n,t.getUniformLocation(e,n.name),this)}}function oa(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}ia.prototype.setValue=function(t,e,n,r){const i=this.map[e];void 0!==i&&i.setValue(t,n,r)},ia.prototype.setOptional=function(t,e,n){const r=e[n];void 0!==r&&this.setValue(t,n,r)},ia.upload=function(t,e,n,r){for(let i=0,o=e.length;i!==o;++i){const o=e[i],a=n[o.id];!1!==a.needsUpdate&&o.setValue(t,a.value,r)}},ia.seqWithValue=function(t,e){const n=[];for(let r=0,i=t.length;r!==i;++r){const i=t[r];i.id in e&&n.push(i)}return n};let aa=0;function sa(t){switch(t){case ie:return["Linear","( value )"];case oe:return["sRGB","( value )"];case se:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case ae:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case 3003:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function la(t,e,n){const r=t.getShaderParameter(e,35713),i=t.getShaderInfoLog(e).trim();return r&&""===i?"":n.toUpperCase()+"\n\n"+i+"\n\n"+function(t){const e=t.split("\n");for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")}(t.getShaderSource(e))}function ca(t,e){const n=sa(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function ua(t,e){const n=sa(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function ha(t,e){let n;switch(e){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function da(t){return""!==t}function pa(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).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/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function fa(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const ma=/^[ \t]*#include +<([\w\d./]+)>/gm;function ga(t){return t.replace(ma,va)}function va(t,e){const n=ui[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return ga(n)}const ya=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,xa=/#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 ba(t){return t.replace(xa,_a).replace(ya,wa)}function wa(t,e,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),_a(t,e,n,r)}function _a(t,e,n,r){let i="";for(let t=parseInt(e);t<parseInt(n);t++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return i}function Ma(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function Sa(t,e,n,r){const i=t.getContext(),o=n.defines;let a=n.vertexShader,s=n.fragmentShader;const l=function(t){let e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(n),c=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case Nt:case Dt:e="ENVMAP_TYPE_CUBE";break;case kt:case 307:e="ENVMAP_TYPE_CUBE_UV"}return e}(n),u=function(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case Dt:case 307:e="ENVMAP_MODE_REFRACTION"}return e}(n),h=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(n),d=t.gammaFactor>0?t.gammaFactor:1,p=n.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(da).join("\n")}(n),f=function(t){const e=[];for(const n in t){const r=t[n];!1!==r&&e.push("#define "+n+" "+r)}return e.join("\n")}(o),m=i.createProgram();let g,v,y=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=[f].filter(da).join("\n"),g.length>0&&(g+="\n"),v=[p,f].filter(da).join("\n"),v.length>0&&(v+="\n")):(g=[Ma(n),"#define SHADER_NAME "+n.shaderName,f,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+d,"#define MAX_BONES "+n.maxBones,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.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphTargets&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargets&&n.isWebGL2?"#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.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(da).join("\n"),v=[p,Ma(n),"#define SHADER_NAME "+n.shaderName,f,"#define GAMMA_FACTOR "+d,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+u:"",n.envMap?"#define "+h:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",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.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?ui.tonemapping_pars_fragment:"",0!==n.toneMapping?ha("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.format===qt?"#define OPAQUE":"",ui.encodings_pars_fragment,n.map?ca("mapTexelToLinear",n.mapEncoding):"",n.matcap?ca("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?ca("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?ca("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.specularColorMap?ca("specularColorMapTexelToLinear",n.specularColorMapEncoding):"",n.sheenColorMap?ca("sheenColorMapTexelToLinear",n.sheenColorMapEncoding):"",n.lightMap?ca("lightMapTexelToLinear",n.lightMapEncoding):"",ua("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(da).join("\n")),a=ga(a),a=pa(a,n),a=fa(a,n),s=ga(s),s=pa(s,n),s=fa(s,n),a=ba(a),s=ba(s),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",g=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,v=["#define varying in",n.glslVersion===he?"":"out highp vec4 pc_fragColor;",n.glslVersion===he?"":"#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("\n")+"\n"+v);const x=y+v+s,b=oa(i,35633,y+g+a),w=oa(i,35632,x);if(i.attachShader(m,b),i.attachShader(m,w),void 0!==n.index0AttributeName?i.bindAttribLocation(m,0,n.index0AttributeName):!0===n.morphTargets&&i.bindAttribLocation(m,0,"position"),i.linkProgram(m),t.debug.checkShaderErrors){const t=i.getProgramInfoLog(m).trim(),e=i.getShaderInfoLog(b).trim(),n=i.getShaderInfoLog(w).trim();let r=!0,o=!0;if(!1===i.getProgramParameter(m,35714)){r=!1;const e=la(i,b,"vertex"),n=la(i,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(m,35715)+"\n\nProgram Info Log: "+t+"\n"+e+"\n"+n)}else""!==t?console.warn("THREE.WebGLProgram: Program Info Log:",t):""!==e&&""!==n||(o=!1);o&&(this.diagnostics={runnable:r,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:n,prefix:v}})}let _,M;return i.deleteShader(b),i.deleteShader(w),this.getUniforms=function(){return void 0===_&&(_=new ia(i,m)),_},this.getAttributes=function(){return void 0===M&&(M=function(t,e){const n={},r=t.getProgramParameter(e,35721);for(let i=0;i<r;i++){const r=t.getActiveAttrib(e,i),o=r.name;let a=1;35674===r.type&&(a=2),35675===r.type&&(a=3),35676===r.type&&(a=4),n[o]={type:r.type,location:t.getAttribLocation(e,o),locationSize:a}}return n}(i,m)),M},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(m),this.program=void 0},this.name=n.shaderName,this.id=aa++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=b,this.fragmentShader=w,this}function Ta(t,e,n,r,i,o,a){const s=[],l=i.isWebGL2,c=i.logarithmicDepthBuffer,u=i.floatVertexTextures,h=i.maxVertexUniforms,d=i.vertexTextures;let p=i.precision;const f={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"},m=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoat","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap",,"roughnessMap","metalnessMap","gradientMap","alphaMap","alphaTest","combine","vertexColors","vertexAlphas","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","morphTargetsCount","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","format","specularIntensityMap","specularColorMap","specularColorMapEncoding","transmission","transmissionMap","thicknessMap","sheen","sheenColorMap","sheenColorMapEncoding","sheenRoughnessMap"];function g(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=ie,l&&t&&t.isTexture&&t.format===Xt&&t.type===Ht&&t.encoding===oe&&(e=ie),e}return{getParameters:function(o,s,m,v,y){const x=v.fog,b=o.isMeshStandardMaterial?v.environment:null,w=(o.isMeshStandardMaterial?n:e).get(o.envMap||b),_=f[o.type],M=y.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(u)return 1024;{const t=h,n=Math.floor((t-20)/4),r=Math.min(n,e.length);return r<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+r+"."),0):r}}(y):0;let S,T;if(null!==o.precision&&(p=i.getMaxPrecision(o.precision),p!==o.precision&&console.warn("THREE.WebGLProgram.getParameters:",o.precision,"not supported, using",p,"instead.")),_){const t=di[_];S=t.vertexShader,T=t.fragmentShader}else S=o.vertexShader,T=o.fragmentShader;const E=t.getRenderTarget(),C=o.alphaTest>0,L=o.clearcoat>0;return{isWebGL2:l,shaderID:_,shaderName:o.type,vertexShader:S,fragmentShader:T,defines:o.defines,isRawShaderMaterial:!0===o.isRawShaderMaterial,glslVersion:o.glslVersion,precision:p,instancing:!0===y.isInstancedMesh,instancingColor:!0===y.isInstancedMesh&&null!==y.instanceColor,supportsVertexTextures:d,outputEncoding:null!==E?g(E.texture):t.outputEncoding,map:!!o.map,mapEncoding:g(o.map),matcap:!!o.matcap,matcapEncoding:g(o.matcap),envMap:!!w,envMapMode:w&&w.mapping,envMapEncoding:g(w),envMapCubeUV:!!w&&(w.mapping===kt||307===w.mapping),lightMap:!!o.lightMap,lightMapEncoding:g(o.lightMap),aoMap:!!o.aoMap,emissiveMap:!!o.emissiveMap,emissiveMapEncoding:g(o.emissiveMap),bumpMap:!!o.bumpMap,normalMap:!!o.normalMap,objectSpaceNormalMap:1===o.normalMapType,tangentSpaceNormalMap:0===o.normalMapType,clearcoat:L,clearcoatMap:L&&!!o.clearcoatMap,clearcoatRoughnessMap:L&&!!o.clearcoatRoughnessMap,clearcoatNormalMap:L&&!!o.clearcoatNormalMap,displacementMap:!!o.displacementMap,roughnessMap:!!o.roughnessMap,metalnessMap:!!o.metalnessMap,specularMap:!!o.specularMap,specularIntensityMap:!!o.specularIntensityMap,specularColorMap:!!o.specularColorMap,specularColorMapEncoding:g(o.specularColorMap),alphaMap:!!o.alphaMap,alphaTest:C,gradientMap:!!o.gradientMap,sheen:o.sheen>0,sheenColorMap:!!o.sheenColorMap,sheenColorMapEncoding:g(o.sheenColorMap),sheenRoughnessMap:!!o.sheenRoughnessMap,transmission:o.transmission>0,transmissionMap:!!o.transmissionMap,thicknessMap:!!o.thicknessMap,combine:o.combine,vertexTangents:!!o.normalMap&&!!y.geometry&&!!y.geometry.attributes.tangent,vertexColors:o.vertexColors,vertexAlphas:!0===o.vertexColors&&!!y.geometry&&!!y.geometry.attributes.color&&4===y.geometry.attributes.color.itemSize,vertexUvs:!!o.map||!!o.bumpMap||!!o.normalMap||!!o.specularMap||!!o.alphaMap||!!o.emissiveMap||!!o.roughnessMap||!!o.metalnessMap||!!o.clearcoatMap||!!o.clearcoatRoughnessMap||!!o.clearcoatNormalMap||!!o.displacementMap||!!o.transmissionMap||!!o.thicknessMap||!!o.specularIntensityMap||!!o.specularColorMap||!!o.sheenColorMap||o.sheenRoughnessMap,uvsVertexOnly:!(o.map||o.bumpMap||o.normalMap||o.specularMap||o.alphaMap||o.emissiveMap||o.roughnessMap||o.metalnessMap||o.clearcoatNormalMap||o.transmission>0||o.transmissionMap||o.thicknessMap||o.specularIntensityMap||o.specularColorMap||!!o.sheen>0||o.sheenColorMap||o.sheenRoughnessMap||!o.displacementMap),fog:!!x,useFog:o.fog,fogExp2:x&&x.isFogExp2,flatShading:!!o.flatShading,sizeAttenuation:o.sizeAttenuation,logarithmicDepthBuffer:c,skinning:!0===y.isSkinnedMesh&&M>0,maxBones:M,useVertexTexture:u,morphTargets:!!y.geometry&&!!y.geometry.morphAttributes.position,morphNormals:!!y.geometry&&!!y.geometry.morphAttributes.normal,morphTargetsCount:y.geometry&&y.geometry.morphAttributes.position?y.geometry.morphAttributes.position.length:0,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,format:o.format,dithering:o.dithering,shadowMapEnabled:t.shadowMap.enabled&&m.length>0,shadowMapType:t.shadowMap.type,toneMapping:o.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:o.premultipliedAlpha,doubleSided:2===o.side,flipSided:1===o.side,depthPacking:void 0!==o.depthPacking&&o.depthPacking,index0AttributeName:o.index0AttributeName,extensionDerivatives:o.extensions&&o.extensions.derivatives,extensionFragDepth:o.extensions&&o.extensions.fragDepth,extensionDrawBuffers:o.extensions&&o.extensions.drawBuffers,extensionShaderTextureLOD:o.extensions&&o.extensions.shaderTextureLOD,rendererExtensionFragDepth:l||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:l||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:l||r.has("EXT_shader_texture_lod"),customProgramCacheKey:o.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(Ae(e.fragmentShader)),n.push(Ae(e.vertexShader))),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t<m.length;t++)n.push(e[m[t]]);n.push(t.outputEncoding),n.push(t.gammaFactor)}return n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=f[t.type];let n;if(e){const t=di[e];n=$r.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let r;for(let t=0,e=s.length;t<e;t++){const e=s[t];if(e.cacheKey===n){r=e,++r.usedTimes;break}}return void 0===r&&(r=new Sa(t,n,e,o),s.push(r)),r},releaseProgram:function(t){if(0==--t.usedTimes){const e=s.indexOf(t);s[e]=s[s.length-1],s.pop(),t.destroy()}},programs:s}}function Ea(){let t=new WeakMap;return{get:function(e){let n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,r){t.get(e)[n]=r},dispose:function(){t=new WeakMap}}}function Ca(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id: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 La(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 Aa(t){const e=[];let n=0;const r=[],i=[],o=[],a={id:-1};function s(r,i,o,s,l,c){let u=e[n];const h=t.get(o);return void 0===u?(u={id:r.id,object:r,geometry:i,material:o,program:h.program||a,groupOrder:s,renderOrder:r.renderOrder,z:l,group:c},e[n]=u):(u.id=r.id,u.object=r,u.geometry=i,u.material=o,u.program=h.program||a,u.groupOrder=s,u.renderOrder=r.renderOrder,u.z=l,u.group=c),n++,u}return{opaque:r,transmissive:i,transparent:o,init:function(){n=0,r.length=0,i.length=0,o.length=0},push:function(t,e,n,a,l,c){const u=s(t,e,n,a,l,c);n.transmission>0?i.push(u):!0===n.transparent?o.push(u):r.push(u)},unshift:function(t,e,n,a,l,c){const u=s(t,e,n,a,l,c);n.transmission>0?i.unshift(u):!0===n.transparent?o.unshift(u):r.unshift(u)},finish:function(){for(let t=n,r=e.length;t<r;t++){const n=e[t];if(null===n.id)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.program=null,n.group=null}},sort:function(t,e){r.length>1&&r.sort(t||Ca),i.length>1&&i.sort(e||La),o.length>1&&o.sort(e||La)}}}function Ra(t){let e=new WeakMap;return{get:function(n,r){let i;return!1===e.has(n)?(i=new Aa(t),e.set(n,[i])):r>=e.get(n).length?(i=new Aa(t),e.get(n).push(i)):i=e.get(n)[r],i},dispose:function(){e=new WeakMap}}}function Pa(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Be,color:new lr};break;case"SpotLight":n={position:new Be,direction:new Be,color:new lr,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Be,color:new lr,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Be,skyColor:new lr,groundColor:new lr};break;case"RectAreaLight":n={color:new lr,position:new Be,halfWidth:new Be,halfHeight:new Be}}return t[e.id]=n,n}}}let Na=0;function Da(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function ka(t,e){const n=new Pa,r=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Te};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Te,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)i.probe.push(new Be);const o=new Be,a=new vn,s=new vn;return{setup:function(o,a){let s=0,l=0,c=0;for(let t=0;t<9;t++)i.probe[t].set(0,0,0);let u=0,h=0,d=0,p=0,f=0,m=0,g=0,v=0;o.sort(Da);const y=!0!==a?Math.PI:1;for(let t=0,e=o.length;t<e;t++){const e=o[t],a=e.color,x=e.intensity,b=e.distance,w=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)s+=a.r*x*y,l+=a.g*x*y,c+=a.b*x*y;else if(e.isLightProbe)for(let t=0;t<9;t++)i.probe[t].addScaledVector(e.sh.coefficients[t],x);else if(e.isDirectionalLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*y),e.castShadow){const t=e.shadow,n=r.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,i.directionalShadow[u]=n,i.directionalShadowMap[u]=w,i.directionalShadowMatrix[u]=e.shadow.matrix,m++}i.directional[u]=t,u++}else if(e.isSpotLight){const t=n.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(a).multiplyScalar(x*y),t.distance=b,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,e.castShadow){const t=e.shadow,n=r.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,i.spotShadow[d]=n,i.spotShadowMap[d]=w,i.spotShadowMatrix[d]=e.shadow.matrix,v++}i.spot[d]=t,d++}else if(e.isRectAreaLight){const t=n.get(e);t.color.copy(a).multiplyScalar(x),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),i.rectArea[p]=t,p++}else if(e.isPointLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*y),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,n=r.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,n.shadowCameraNear=t.camera.near,n.shadowCameraFar=t.camera.far,i.pointShadow[h]=n,i.pointShadowMap[h]=w,i.pointShadowMatrix[h]=e.shadow.matrix,g++}i.point[h]=t,h++}else if(e.isHemisphereLight){const t=n.get(e);t.skyColor.copy(e.color).multiplyScalar(x*y),t.groundColor.copy(e.groundColor).multiplyScalar(x*y),i.hemi[f]=t,f++}}p>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=hi.LTC_FLOAT_1,i.rectAreaLTC2=hi.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(i.rectAreaLTC1=hi.LTC_HALF_1,i.rectAreaLTC2=hi.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=s,i.ambient[1]=l,i.ambient[2]=c;const x=i.hash;x.directionalLength===u&&x.pointLength===h&&x.spotLength===d&&x.rectAreaLength===p&&x.hemiLength===f&&x.numDirectionalShadows===m&&x.numPointShadows===g&&x.numSpotShadows===v||(i.directional.length=u,i.spot.length=d,i.rectArea.length=p,i.point.length=h,i.hemi.length=f,i.directionalShadow.length=m,i.directionalShadowMap.length=m,i.pointShadow.length=g,i.pointShadowMap.length=g,i.spotShadow.length=v,i.spotShadowMap.length=v,i.directionalShadowMatrix.length=m,i.pointShadowMatrix.length=g,i.spotShadowMatrix.length=v,x.directionalLength=u,x.pointLength=h,x.spotLength=d,x.rectAreaLength=p,x.hemiLength=f,x.numDirectionalShadows=m,x.numPointShadows=g,x.numSpotShadows=v,i.version=Na++)},setupView:function(t,e){let n=0,r=0,l=0,c=0,u=0;const h=e.matrixWorldInverse;for(let e=0,d=t.length;e<d;e++){const d=t[e];if(d.isDirectionalLight){const t=i.directional[n];t.direction.setFromMatrixPosition(d.matrixWorld),o.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(h),n++}else if(d.isSpotLight){const t=i.spot[l];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(h),t.direction.setFromMatrixPosition(d.matrixWorld),o.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(h),l++}else if(d.isRectAreaLight){const t=i.rectArea[c];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(h),s.identity(),a.copy(d.matrixWorld),a.premultiply(h),s.extractRotation(a),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(s),t.halfHeight.applyMatrix4(s),c++}else if(d.isPointLight){const t=i.point[r];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(h),r++}else if(d.isHemisphereLight){const t=i.hemi[u];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(h),t.direction.normalize(),u++}}},state:i}}function Ia(t,e){const n=new ka(t,e),r=[],i=[];return{init:function(){r.length=0,i.length=0},state:{lightsArray:r,shadowsArray:i,lights:n},setupLights:function(t){n.setup(r,t)},setupLightsView:function(t){n.setupView(r,t)},pushLight:function(t){r.push(t)},pushShadow:function(t){i.push(t)}}}function Oa(t,e){let n=new WeakMap;return{get:function(r,i=0){let o;return!1===n.has(r)?(o=new Ia(t,e),n.set(r,[o])):i>=n.get(r).length?(o=new Ia(t,e),n.get(r).push(o)):o=n.get(r)[i],o},dispose:function(){n=new WeakMap}}}class za extends er{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}za.prototype.isMeshDepthMaterial=!0;class Fa extends er{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new Be,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}Fa.prototype.isMeshDistanceMaterial=!0;function Ba(t,e,n){let r=new ai;const i=new Te,o=new Te,a=new Ie,s=new za({depthPacking:3201}),l=new Fa,c={},u=n.maxTextureSize,h={0:1,1:0,2:2},d=new qr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Te},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const f=new Mr;f.setAttribute("position",new dr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new Hr(f,d),g=this;function v(n,r){const i=e.update(m);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(r,null,i,d,m,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(r,null,i,p,m,null)}function y(e,n,r,i,o,a,u){let d=null;const p=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(d=void 0!==p?p:!0===i.isPointLight?l:s,t.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length||r.displacementMap&&0!==r.displacementScale||r.alphaMap&&r.alphaTest>0){const t=d.uuid,e=r.uuid;let n=c[t];void 0===n&&(n={},c[t]=n);let i=n[e];void 0===i&&(i=d.clone(),n[e]=i),d=i}return d.visible=r.visible,d.wireframe=r.wireframe,d.side=3===u?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:h[r.side],d.alphaMap=r.alphaMap,d.alphaTest=r.alphaTest,d.clipShadows=r.clipShadows,d.clippingPlanes=r.clippingPlanes,d.clipIntersection=r.clipIntersection,d.displacementMap=r.displacementMap,d.displacementScale=r.displacementScale,d.displacementBias=r.displacementBias,d.wireframeLinewidth=r.wireframeLinewidth,d.linewidth=r.linewidth,!0===i.isPointLight&&!0===d.isMeshDistanceMaterial&&(d.referencePosition.setFromMatrixPosition(i.matrixWorld),d.nearDistance=o,d.farDistance=a),d}function x(n,i,o,a,s){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===s)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,n.matrixWorld);const r=e.update(n),i=n.material;if(Array.isArray(i)){const e=r.groups;for(let l=0,c=e.length;l<c;l++){const c=e[l],u=i[c.materialIndex];if(u&&u.visible){const e=y(n,0,u,a,o.near,o.far,s);t.renderBufferDirect(o,null,r,e,n,c)}}}else if(i.visible){const e=y(n,0,i,a,o.near,o.far,s);t.renderBufferDirect(o,null,r,e,n,null)}}const l=n.children;for(let t=0,e=l.length;t<e;t++)x(l[t],i,o,a,s)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,n,s){if(!1===g.enabled)return;if(!1===g.autoUpdate&&!1===g.needsUpdate)return;if(0===e.length)return;const l=t.getRenderTarget(),c=t.getActiveCubeFace(),h=t.getActiveMipmapLevel(),d=t.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(let l=0,c=e.length;l<c;l++){const c=e[l],h=c.shadow;if(void 0===h){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===h.autoUpdate&&!1===h.needsUpdate)continue;i.copy(h.mapSize);const p=h.getFrameExtents();if(i.multiply(p),o.copy(h.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(o.x=Math.floor(u/p.x),i.x=o.x*p.x,h.mapSize.x=o.x),i.y>u&&(o.y=Math.floor(u/p.y),i.y=o.y*p.y,h.mapSize.y=o.y)),null===h.map&&!h.isPointLightShadow&&3===this.type){const t={minFilter:Bt,magFilter:Bt,format:Xt};h.map=new Oe(i.x,i.y,t),h.map.texture.name=c.name+".shadowMap",h.mapPass=new Oe(i.x,i.y,t),h.camera.updateProjectionMatrix()}if(null===h.map){const t={minFilter:Ft,magFilter:Ft,format:Xt};h.map=new Oe(i.x,i.y,t),h.map.texture.name=c.name+".shadowMap",h.camera.updateProjectionMatrix()}t.setRenderTarget(h.map),t.clear();const f=h.getViewportCount();for(let t=0;t<f;t++){const e=h.getViewport(t);a.set(o.x*e.x,o.y*e.y,o.x*e.z,o.y*e.w),d.viewport(a),h.updateMatrices(c,t),r=h.getFrustum(),x(n,s,h.camera,c,this.type)}h.isPointLightShadow||3!==this.type||v(h,s),h.needsUpdate=!1}g.needsUpdate=!1,t.setRenderTarget(l,c,h)}}function Ua(t,e,n){const r=n.isWebGL2;const i=new function(){let e=!1;const n=new Ie;let r=null;const i=new Ie(0,0,0,0);return{setMask:function(n){r===n||e||(t.colorMask(n,n,n,n),r=n)},setLocked:function(t){e=t},setClear:function(e,r,o,a,s){!0===s&&(e*=a,r*=a,o*=a),n.set(e,r,o,a),!1===i.equals(n)&&(t.clearColor(e,r,o,a),i.copy(n))},reset:function(){e=!1,r=null,i.set(-1,0,0,0)}}},o=new function(){let e=!1,n=null,r=null,i=null;return{setTest:function(t){t?z(2929):F(2929)},setMask:function(r){n===r||e||(t.depthMask(r),n=r)},setFunc:function(e){if(r!==e){if(e)switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:default:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517)}else t.depthFunc(515);r=e}},setLocked:function(t){e=t},setClear:function(e){i!==e&&(t.clearDepth(e),i=e)},reset:function(){e=!1,n=null,r=null,i=null}}},a=new function(){let e=!1,n=null,r=null,i=null,o=null,a=null,s=null,l=null,c=null;return{setTest:function(t){e||(t?z(2960):F(2960))},setMask:function(r){n===r||e||(t.stencilMask(r),n=r)},setFunc:function(e,n,a){r===e&&i===n&&o===a||(t.stencilFunc(e,n,a),r=e,i=n,o=a)},setOp:function(e,n,r){a===e&&s===n&&l===r||(t.stencilOp(e,n,r),a=e,s=n,l=r)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,n=null,r=null,i=null,o=null,a=null,s=null,l=null,c=null}}};let s={},l=null,c={},u=null,h=!1,d=null,p=null,f=null,m=null,g=null,v=null,y=null,x=!1,b=null,w=null,_=null,M=null,S=null;const T=t.getParameter(35661);let E=!1,C=0;const L=t.getParameter(7938);-1!==L.indexOf("WebGL")?(C=parseFloat(/^WebGL (\d)/.exec(L)[1]),E=C>=1):-1!==L.indexOf("OpenGL ES")&&(C=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),E=C>=2);let A=null,R={};const P=t.getParameter(3088),N=t.getParameter(2978),D=(new Ie).fromArray(P),k=(new Ie).fromArray(N);function I(e,n,r){const i=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;e<r;e++)t.texImage2D(n+e,0,6408,1,1,0,6408,5121,i);return o}const O={};function z(e){!0!==s[e]&&(t.enable(e),s[e]=!0)}function F(e){!1!==s[e]&&(t.disable(e),s[e]=!1)}O[3553]=I(3553,3553,1),O[34067]=I(34067,34069,6),i.setClear(0,0,0,1),o.setClear(1),a.setClear(0),z(2929),o.setFunc(3),W(!1),G(1),z(2884),H(0);const B={[Pt]:32774,101:32778,102:32779};if(r)B[103]=32775,B[104]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(B[103]=t.MIN_EXT,B[104]=t.MAX_EXT)}const U={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function H(e,n,r,i,o,a,s,l){if(0!==e){if(!1===h&&(z(3042),h=!0),5===e)o=o||n,a=a||r,s=s||i,n===p&&o===g||(t.blendEquationSeparate(B[n],B[o]),p=n,g=o),r===f&&i===m&&a===v&&s===y||(t.blendFuncSeparate(U[r],U[i],U[a],U[s]),f=r,m=i,v=a,y=s),d=e,x=null;else if(e!==d||l!==x){if(p===Pt&&g===Pt||(t.blendEquation(32774),p=Pt,g=Pt),l)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,0,769,771);break;case 4:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFunc(0,769);break;case 4:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}f=null,m=null,v=null,y=null,d=e,x=l}}else!0===h&&(F(3042),h=!1)}function W(e){b!==e&&(e?t.frontFace(2304):t.frontFace(2305),b=e)}function G(e){0!==e?(z(2884),e!==w&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):F(2884),w=e}function V(e,n,r){e?(z(32823),M===n&&S===r||(t.polygonOffset(n,r),M=n,S=r)):F(32823)}function j(e){void 0===e&&(e=33984+T-1),A!==e&&(t.activeTexture(e),A=e)}return{buffers:{color:i,depth:o,stencil:a},enable:z,disable:F,bindFramebuffer:function(e,n){return null===n&&null!==l&&(n=l),c[e]!==n&&(t.bindFramebuffer(e,n),c[e]=n,r&&(36009===e&&(c[36160]=n),36160===e&&(c[36009]=n)),!0)},bindXRFramebuffer:function(e){e!==l&&(t.bindFramebuffer(36160,e),l=e)},useProgram:function(e){return u!==e&&(t.useProgram(e),u=e,!0)},setBlending:H,setMaterial:function(t,e){2===t.side?F(2884):z(2884);let n=1===t.side;e&&(n=!n),W(n),1===t.blending&&!1===t.transparent?H(0):H(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),o.setFunc(t.depthFunc),o.setTest(t.depthTest),o.setMask(t.depthWrite),i.setMask(t.colorWrite);const r=t.stencilWrite;a.setTest(r),r&&(a.setMask(t.stencilWriteMask),a.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),a.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),V(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?z(32926):F(32926)},setFlipSided:W,setCullFace:G,setLineWidth:function(e){e!==_&&(E&&t.lineWidth(e),_=e)},setPolygonOffset:V,setScissorTest:function(t){t?z(3089):F(3089)},activeTexture:j,bindTexture:function(e,n){null===A&&j();let r=R[A];void 0===r&&(r={type:void 0,texture:void 0},R[A]=r),r.type===e&&r.texture===n||(t.bindTexture(e,n||O[e]),r.type=e,r.texture=n)},unbindTexture:function(){const e=R[A];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===D.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),D.copy(e))},viewport:function(e){!1===k.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),k.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.disable(32926),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.bindFramebuffer(36160,null),!0===r&&(t.bindFramebuffer(36009,null),t.bindFramebuffer(36008,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),s={},A=null,R={},l=null,c={},u=null,h=!1,d=null,p=null,f=null,m=null,g=null,v=null,y=null,x=!1,b=null,w=null,_=null,M=null,S=null,D.set(0,0,t.canvas.width,t.canvas.height),k.set(0,0,t.canvas.width,t.canvas.height),i.reset(),o.reset(),a.reset()}}}function Ha(t,e,n,r,i,o,a){const s=i.isWebGL2,l=i.maxTextures,c=i.maxCubemapSize,u=i.maxTextureSize,h=i.maxSamples,d=new WeakMap;let p,f=!1;try{f="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function m(t,e){return f?new OffscreenCanvas(t,e):Le("canvas")}function g(t,e,n,r){let i=1;if((t.width>r||t.height>r)&&(i=r/Math.max(t.width,t.height)),i<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const r=e?Me:Math.floor,o=r(i*t.width),a=r(i*t.height);void 0===p&&(p=m(o,a));const s=n?m(o,a):p;s.width=o,s.height=a;return s.getContext("2d").drawImage(t,0,0,o,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+a+")."),s}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function v(t){return _e(t.width)&&_e(t.height)}function y(t,e){return t.generateMipmaps&&e&&t.minFilter!==Ft&&t.minFilter!==Bt}function x(e,n,i,o,a=1){t.generateMipmap(e);r.get(n).__maxMipLevel=Math.log2(Math.max(i,o,a))}function b(n,r,i,o){if(!1===s)return r;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let a=r;return 6403===r&&(5126===i&&(a=33326),5131===i&&(a=33325),5121===i&&(a=33321)),6407===r&&(5126===i&&(a=34837),5131===i&&(a=34843),5121===i&&(a=32849)),6408===r&&(5126===i&&(a=34836),5131===i&&(a=34842),5121===i&&(a=o===oe?35907:32856)),33325!==a&&33326!==a&&34842!==a&&34836!==a||e.get("EXT_color_buffer_float"),a}function w(t){return t===Ft||1004===t||1005===t?9728:9729}function _(e){const n=e.target;n.removeEventListener("dispose",_),function(e){const n=r.get(e);if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture),r.remove(e)}(n),n.isVideoTexture&&d.delete(n),a.memory.textures--}function M(e){const n=e.target;n.removeEventListener("dispose",M),function(e){const n=e.texture,i=r.get(e),o=r.get(n);if(!e)return;void 0!==o.__webglTexture&&(t.deleteTexture(o.__webglTexture),a.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(i.__webglFramebuffer[e]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[e]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&t.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer);if(e.isWebGLMultipleRenderTargets)for(let e=0,i=n.length;e<i;e++){const i=r.get(n[e]);i.__webglTexture&&(t.deleteTexture(i.__webglTexture),a.memory.textures--),r.remove(n[e])}r.remove(n),r.remove(e)}(n)}let S=0;function T(t,e){const i=r.get(t);if(t.isVideoTexture&&function(t){const e=a.render.frame;d.get(t)!==e&&(d.set(t,e),t.update())}(t),t.version>0&&i.__version!==t.version){const n=t.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void P(i,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,i.__webglTexture)}function E(e,i){const a=r.get(e);e.version>0&&a.__version!==e.version?function(e,r,i){if(6!==r.image.length)return;R(e,r),n.activeTexture(33984+i),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const a=r&&(r.isCompressedTexture||r.image[0].isCompressedTexture),l=r.image[0]&&r.image[0].isDataTexture,u=[];for(let t=0;t<6;t++)u[t]=a||l?l?r.image[t].image:r.image[t]:g(r.image[t],!1,!0,c);const h=u[0],d=v(h)||s,p=o.convert(r.format),f=o.convert(r.type),m=b(r.internalFormat,p,f,r.encoding);let w;if(A(34067,r,d),a){for(let t=0;t<6;t++){w=u[t].mipmaps;for(let e=0;e<w.length;e++){const i=w[e];r.format!==Xt&&r.format!==qt?null!==p?n.compressedTexImage2D(34069+t,e,m,i.width,i.height,0,i.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+t,e,m,i.width,i.height,0,p,f,i.data)}}e.__maxMipLevel=w.length-1}else{w=r.mipmaps;for(let t=0;t<6;t++)if(l){n.texImage2D(34069+t,0,m,u[t].width,u[t].height,0,p,f,u[t].data);for(let e=0;e<w.length;e++){const r=w[e].image[t].image;n.texImage2D(34069+t,e+1,m,r.width,r.height,0,p,f,r.data)}}else{n.texImage2D(34069+t,0,m,p,f,u[t]);for(let e=0;e<w.length;e++){const r=w[e];n.texImage2D(34069+t,e+1,m,p,f,r.image[t])}}e.__maxMipLevel=w.length}y(r,d)&&x(34067,r,h.width,h.height);e.__version=r.version,r.onUpdate&&r.onUpdate(r)}(a,e,i):(n.activeTexture(33984+i),n.bindTexture(34067,a.__webglTexture))}const C={[It]:10497,[Ot]:33071,[zt]:33648},L={[Ft]:9728,1004:9984,1005:9986,[Bt]:9729,1007:9985,[Ut]:9987};function A(n,o,a){if(a?(t.texParameteri(n,10242,C[o.wrapS]),t.texParameteri(n,10243,C[o.wrapT]),32879!==n&&35866!==n||t.texParameteri(n,32882,C[o.wrapR]),t.texParameteri(n,10240,L[o.magFilter]),t.texParameteri(n,10241,L[o.minFilter])):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),o.wrapS===Ot&&o.wrapT===Ot||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,10240,w(o.magFilter)),t.texParameteri(n,10241,w(o.minFilter)),o.minFilter!==Ft&&o.minFilter!==Bt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){const a=e.get("EXT_texture_filter_anisotropic");if(o.type===Vt&&!1===e.has("OES_texture_float_linear"))return;if(!1===s&&o.type===jt&&!1===e.has("OES_texture_half_float_linear"))return;(o.anisotropy>1||r.get(o).__currentAnisotropy)&&(t.texParameterf(n,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,i.getMaxAnisotropy())),r.get(o).__currentAnisotropy=o.anisotropy)}}function R(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",_),e.__webglTexture=t.createTexture(),a.memory.textures++)}function P(e,r,i){let a=3553;r.isDataTexture2DArray&&(a=35866),r.isDataTexture3D&&(a=32879),R(e,r),n.activeTexture(33984+i),n.bindTexture(a,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const l=function(t){return!s&&(t.wrapS!==Ot||t.wrapT!==Ot||t.minFilter!==Ft&&t.minFilter!==Bt)}(r)&&!1===v(r.image),c=g(r.image,l,!1,u),h=v(c)||s,d=o.convert(r.format);let p,f=o.convert(r.type),m=b(r.internalFormat,d,f,r.encoding);A(a,r,h);const w=r.mipmaps;if(r.isDepthTexture)m=6402,s?m=r.type===Vt?36012:r.type===Gt?33190:r.type===$t?35056:33189:r.type===Vt&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===Yt&&6402===m&&r.type!==Wt&&r.type!==Gt&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=Wt,f=o.convert(r.type)),r.format===Zt&&6402===m&&(m=34041,r.type!==$t&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=$t,f=o.convert(r.type))),n.texImage2D(3553,0,m,c.width,c.height,0,d,f,null);else if(r.isDataTexture)if(w.length>0&&h){for(let t=0,e=w.length;t<e;t++)p=w[t],n.texImage2D(3553,t,m,p.width,p.height,0,d,f,p.data);r.generateMipmaps=!1,e.__maxMipLevel=w.length-1}else n.texImage2D(3553,0,m,c.width,c.height,0,d,f,c.data),e.__maxMipLevel=0;else if(r.isCompressedTexture){for(let t=0,e=w.length;t<e;t++)p=w[t],r.format!==Xt&&r.format!==qt?null!==d?n.compressedTexImage2D(3553,t,m,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,t,m,p.width,p.height,0,d,f,p.data);e.__maxMipLevel=w.length-1}else if(r.isDataTexture2DArray)n.texImage3D(35866,0,m,c.width,c.height,c.depth,0,d,f,c.data),e.__maxMipLevel=0;else if(r.isDataTexture3D)n.texImage3D(32879,0,m,c.width,c.height,c.depth,0,d,f,c.data),e.__maxMipLevel=0;else if(w.length>0&&h){for(let t=0,e=w.length;t<e;t++)p=w[t],n.texImage2D(3553,t,m,d,f,p);r.generateMipmaps=!1,e.__maxMipLevel=w.length-1}else n.texImage2D(3553,0,m,d,f,c),e.__maxMipLevel=0;y(r,h)&&x(a,r,c.width,c.height),e.__version=r.version,r.onUpdate&&r.onUpdate(r)}function N(e,i,a,s,l){const c=o.convert(a.format),u=o.convert(a.type),h=b(a.internalFormat,c,u,a.encoding);32879===l||35866===l?n.texImage3D(l,0,h,i.width,i.height,i.depth,0,c,u,null):n.texImage2D(l,0,h,i.width,i.height,0,c,u,null),n.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,s,l,r.get(a).__webglTexture,0),n.bindFramebuffer(36160,null)}function D(e,n,r){if(t.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer){let i=33189;if(r){const e=n.depthTexture;e&&e.isDepthTexture&&(e.type===Vt?i=36012:e.type===Gt&&(i=33190));const r=I(n);t.renderbufferStorageMultisample(36161,r,i,n.width,n.height)}else t.renderbufferStorage(36161,i,n.width,n.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(n.depthBuffer&&n.stencilBuffer){if(r){const e=I(n);t.renderbufferStorageMultisample(36161,e,35056,n.width,n.height)}else t.renderbufferStorage(36161,34041,n.width,n.height);t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=!0===n.isWebGLMultipleRenderTargets?n.texture[0]:n.texture,i=o.convert(e.format),a=o.convert(e.type),s=b(e.internalFormat,i,a,e.encoding);if(r){const e=I(n);t.renderbufferStorageMultisample(36161,e,s,n.width,n.height)}else t.renderbufferStorage(36161,s,n.width,n.height)}t.bindRenderbuffer(36161,null)}function k(e){const i=r.get(e),o=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(o)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,i){if(i&&i.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(36160,e),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),T(i.depthTexture,0);const o=r.get(i.depthTexture).__webglTexture;if(i.depthTexture.format===Yt)t.framebufferTexture2D(36160,36096,3553,o,0);else{if(i.depthTexture.format!==Zt)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,o,0)}}(i.__webglFramebuffer,e)}else if(o){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)n.bindFramebuffer(36160,i.__webglFramebuffer[r]),i.__webglDepthbuffer[r]=t.createRenderbuffer(),D(i.__webglDepthbuffer[r],e,!1)}else n.bindFramebuffer(36160,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),D(i.__webglDepthbuffer,e,!1);n.bindFramebuffer(36160,null)}function I(t){return s&&t.isWebGLMultisampleRenderTarget?Math.min(h,t.samples):0}let O=!1,z=!1;this.allocateTextureUnit=function(){const t=S;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),S+=1,t},this.resetTextureUnits=function(){S=0},this.setTexture2D=T,this.setTexture2DArray=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?P(i,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?P(i,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=E,this.setupRenderTarget=function(e){const l=e.texture,c=r.get(e),u=r.get(l);e.addEventListener("dispose",M),!0!==e.isWebGLMultipleRenderTargets&&(u.__webglTexture=t.createTexture(),u.__version=l.version,a.memory.textures++);const h=!0===e.isWebGLCubeRenderTarget,d=!0===e.isWebGLMultipleRenderTargets,p=!0===e.isWebGLMultisampleRenderTarget,f=l.isDataTexture3D||l.isDataTexture2DArray,m=v(e)||s;if(!s||l.format!==qt||l.type!==Vt&&l.type!==jt||(l.format=Xt,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),h){c.__webglFramebuffer=[];for(let e=0;e<6;e++)c.__webglFramebuffer[e]=t.createFramebuffer()}else if(c.__webglFramebuffer=t.createFramebuffer(),d)if(i.drawBuffers){const n=e.texture;for(let e=0,i=n.length;e<i;e++){const i=r.get(n[e]);void 0===i.__webglTexture&&(i.__webglTexture=t.createTexture(),a.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(p)if(s){c.__webglMultisampledFramebuffer=t.createFramebuffer(),c.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,c.__webglColorRenderbuffer);const r=o.convert(l.format),i=o.convert(l.type),a=b(l.internalFormat,r,i,l.encoding),s=I(e);t.renderbufferStorageMultisample(36161,s,a,e.width,e.height),n.bindFramebuffer(36160,c.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,c.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(c.__webglDepthRenderbuffer=t.createRenderbuffer(),D(c.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(h){n.bindTexture(34067,u.__webglTexture),A(34067,l,m);for(let t=0;t<6;t++)N(c.__webglFramebuffer[t],e,l,36064,34069+t);y(l,m)&&x(34067,l,e.width,e.height),n.unbindTexture()}else if(d){const t=e.texture;for(let i=0,o=t.length;i<o;i++){const o=t[i],a=r.get(o);n.bindTexture(3553,a.__webglTexture),A(3553,o,m),N(c.__webglFramebuffer,e,o,36064+i,3553),y(o,m)&&x(3553,o,e.width,e.height)}n.unbindTexture()}else{let t=3553;if(f)if(s){t=l.isDataTexture3D?32879:35866}else console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.");n.bindTexture(t,u.__webglTexture),A(t,l,m),N(c.__webglFramebuffer,e,l,36064,t),y(l,m)&&x(t,l,e.width,e.height,e.depth),n.unbindTexture()}e.depthBuffer&&k(e)},this.updateRenderTargetMipmap=function(t){const e=v(t)||s,i=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture];for(let o=0,a=i.length;o<a;o++){const a=i[o];if(y(a,e)){const e=t.isWebGLCubeRenderTarget?34067:3553,i=r.get(a).__webglTexture;n.bindTexture(e,i),x(e,a,t.width,t.height),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(s){const i=e.width,o=e.height;let a=16384;e.depthBuffer&&(a|=256),e.stencilBuffer&&(a|=1024);const s=r.get(e);n.bindFramebuffer(36008,s.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,s.__webglFramebuffer),t.blitFramebuffer(0,0,i,o,0,0,i,o,a,9728),n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,s.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===O&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),O=!0),t=t.texture),T(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===z&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),z=!0),t=t.texture),E(t,e)}}function Wa(t,e,n){const r=n.isWebGL2;return{convert:function(t){let n;if(t===Ht)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1019===t)return 33635;if(1010===t)return 5120;if(1011===t)return 5122;if(t===Wt)return 5123;if(1013===t)return 5124;if(t===Gt)return 5125;if(t===Vt)return 5126;if(t===jt)return r?5131:(n=e.get("OES_texture_half_float"),null!==n?n.HALF_FLOAT_OES:null);if(1021===t)return 6406;if(t===qt)return 6407;if(t===Xt)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(t===Yt)return 6402;if(t===Zt)return 34041;if(1028===t)return 6403;if(1029===t)return 36244;if(1030===t)return 33319;if(1031===t)return 33320;if(1032===t)return 36248;if(1033===t)return 36249;if(33776===t||33777===t||33778===t||33779===t){if(n=e.get("WEBGL_compressed_texture_s3tc"),null===n)return null;if(33776===t)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===t)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===t)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===t)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===t||35841===t||35842===t||35843===t){if(n=e.get("WEBGL_compressed_texture_pvrtc"),null===n)return null;if(35840===t)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===t)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===t)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===t)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===t)return n=e.get("WEBGL_compressed_texture_etc1"),null!==n?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((37492===t||37496===t)&&(n=e.get("WEBGL_compressed_texture_etc"),null!==n)){if(37492===t)return n.COMPRESSED_RGB8_ETC2;if(37496===t)return n.COMPRESSED_RGBA8_ETC2_EAC}return 37808===t||37809===t||37810===t||37811===t||37812===t||37813===t||37814===t||37815===t||37816===t||37817===t||37818===t||37819===t||37820===t||37821===t||37840===t||37841===t||37842===t||37843===t||37844===t||37845===t||37846===t||37847===t||37848===t||37849===t||37850===t||37851===t||37852===t||37853===t?(n=e.get("WEBGL_compressed_texture_astc"),null!==n?t:null):36492===t?(n=e.get("EXT_texture_compression_bptc"),null!==n?t:null):t===$t?r?34042:(n=e.get("WEBGL_depth_texture"),null!==n?n.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}class Ga extends Yr{constructor(t=[]){super(),this.cameras=t}}Ga.prototype.isArrayCamera=!0;class Va extends Wn{constructor(){super(),this.type="Group"}}Va.prototype.isGroup=!0;const ja={type:"move"};class $a{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Va,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Va,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Be,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Be),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Va,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Be,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Be),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,n){let r=null,i=null,o=null;const a=this._targetRay,s=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==a&&(r=e.getPose(t.targetRaySpace,n),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(ja))),l&&t.hand){o=!0;for(const r of t.hand.values()){const t=e.getJointPose(r,n);if(void 0===l.joints[r.jointName]){const t=new Va;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[r.jointName]=t,l.add(t)}const i=l.joints[r.jointName];null!==t&&(i.matrix.fromArray(t.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.jointRadius=t.radius),i.visible=null!==t}const r=l.joints["index-finger-tip"],i=l.joints["thumb-tip"],a=r.position.distanceTo(i.position),s=.02,c=.005;l.inputState.pinching&&a>s+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&a<=s-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==s&&t.gripSpace&&(i=e.getPose(t.gripSpace,n),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1));return null!==a&&(a.visible=null!==r),null!==s&&(s.visible=null!==i),null!==l&&(l.visible=null!==o),this}}class qa extends de{constructor(t,e){super();const n=this,r=t.state;let i=null,o=1,a=null,s="local-floor",l=null,c=null,u=null,h=null,d=null,p=!1,f=null,m=null,g=null,v=null,y=null,x=null;const b=[],w=new Map,_=new Yr;_.layers.enable(1),_.viewport=new Ie;const M=new Yr;M.layers.enable(2),M.viewport=new Ie;const S=[_,M],T=new Ga;T.layers.enable(1),T.layers.enable(2);let E=null,C=null;function L(t){const e=w.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function A(){w.forEach((function(t,e){t.disconnect(e)})),w.clear(),E=null,C=null,r.bindXRFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),u&&e.deleteFramebuffer(u),f&&e.deleteFramebuffer(f),m&&e.deleteRenderbuffer(m),g&&e.deleteRenderbuffer(g),u=null,f=null,m=null,g=null,d=null,h=null,c=null,i=null,I.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function R(t){const e=i.inputSources;for(let t=0;t<b.length;t++)w.set(e[t],b[t]);for(let e=0;e<t.removed.length;e++){const n=t.removed[e],r=w.get(n);r&&(r.dispatchEvent({type:"disconnected",data:n}),w.delete(n))}for(let e=0;e<t.added.length;e++){const n=t.added[e],r=w.get(n);r&&r.dispatchEvent({type:"connected",data:n})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=b[t];return void 0===e&&(e=new $a,b[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=b[t];return void 0===e&&(e=new $a,b[t]=e),e.getGripSpace()},this.getHand=function(t){let e=b[t];return void 0===e&&(e=new $a,b[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){o=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){s=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return a},this.getBaseLayer=function(){return null!==h?h:d},this.getBinding=function(){return c},this.getFrame=function(){return v},this.getSession=function(){return i},this.setSession=async function(t){if(i=t,null!==i){i.addEventListener("select",L),i.addEventListener("selectstart",L),i.addEventListener("selectend",L),i.addEventListener("squeeze",L),i.addEventListener("squeezestart",L),i.addEventListener("squeezeend",L),i.addEventListener("end",A),i.addEventListener("inputsourceschange",R);const t=e.getContextAttributes();if(!0!==t.xrCompatible&&await e.makeXRCompatible(),void 0===i.renderState.layers){const n={antialias:t.antialias,alpha:t.alpha,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:o};d=new XRWebGLLayer(i,e,n),i.updateRenderState({baseLayer:d})}else if(e instanceof WebGLRenderingContext){const n={antialias:!0,alpha:t.alpha,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:o};d=new XRWebGLLayer(i,e,n),i.updateRenderState({layers:[d]})}else{p=t.antialias;let n=null;t.depth&&(x=256,t.stencil&&(x|=1024),y=t.stencil?33306:36096,n=t.stencil?35056:33190);const a={colorFormat:t.alpha?32856:32849,depthFormat:n,scaleFactor:o};c=new XRWebGLBinding(i,e),h=c.createProjectionLayer(a),u=e.createFramebuffer(),i.updateRenderState({layers:[h]}),p&&(f=e.createFramebuffer(),m=e.createRenderbuffer(),e.bindRenderbuffer(36161,m),e.renderbufferStorageMultisample(36161,4,32856,h.textureWidth,h.textureHeight),r.bindFramebuffer(36160,f),e.framebufferRenderbuffer(36160,36064,36161,m),e.bindRenderbuffer(36161,null),null!==n&&(g=e.createRenderbuffer(),e.bindRenderbuffer(36161,g),e.renderbufferStorageMultisample(36161,4,n,h.textureWidth,h.textureHeight),e.framebufferRenderbuffer(36160,y,36161,g),e.bindRenderbuffer(36161,null)),r.bindFramebuffer(36160,null))}a=await i.requestReferenceSpace(s),I.setContext(i),I.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};const P=new Be,N=new Be;function D(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===i)return;T.near=M.near=_.near=t.near,T.far=M.far=_.far=t.far,E===T.near&&C===T.far||(i.updateRenderState({depthNear:T.near,depthFar:T.far}),E=T.near,C=T.far);const e=t.parent,n=T.cameras;D(T,e);for(let t=0;t<n.length;t++)D(n[t],e);T.matrixWorld.decompose(T.position,T.quaternion,T.scale),t.position.copy(T.position),t.quaternion.copy(T.quaternion),t.scale.copy(T.scale),t.matrix.copy(T.matrix),t.matrixWorld.copy(T.matrixWorld);const r=t.children;for(let t=0,e=r.length;t<e;t++)r[t].updateMatrixWorld(!0);2===n.length?function(t,e,n){P.setFromMatrixPosition(e.matrixWorld),N.setFromMatrixPosition(n.matrixWorld);const r=P.distanceTo(N),i=e.projectionMatrix.elements,o=n.projectionMatrix.elements,a=i[14]/(i[10]-1),s=i[14]/(i[10]+1),l=(i[9]+1)/i[5],c=(i[9]-1)/i[5],u=(i[8]-1)/i[0],h=(o[8]+1)/o[0],d=a*u,p=a*h,f=r/(-u+h),m=f*-u;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const g=a+f,v=s+f,y=d-m,x=p+(r-m),b=l*s/v*g,w=c*s/v*g;t.projectionMatrix.makePerspective(y,x,b,w,g,v)}(T,_,M):T.projectionMatrix.copy(_.projectionMatrix)},this.getCamera=function(){return T},this.getFoveation=function(){return null!==h?h.fixedFoveation:null!==d?d.fixedFoveation:void 0},this.setFoveation=function(t){null!==h&&(h.fixedFoveation=t),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=t)};let k=null;const I=new si;I.setAnimationLoop((function(t,n){if(l=n.getViewerPose(a),v=n,null!==l){const t=l.views;null!==d&&r.bindXRFramebuffer(d.framebuffer);let n=!1;t.length!==T.cameras.length&&(T.cameras.length=0,n=!0);for(let i=0;i<t.length;i++){const o=t[i];let a=null;if(null!==d)a=d.getViewport(o);else{const t=c.getViewSubImage(h,o);r.bindXRFramebuffer(u),void 0!==t.depthStencilTexture&&e.framebufferTexture2D(36160,y,3553,t.depthStencilTexture,0),e.framebufferTexture2D(36160,36064,3553,t.colorTexture,0),a=t.viewport}const s=S[i];s.matrix.fromArray(o.transform.matrix),s.projectionMatrix.fromArray(o.projectionMatrix),s.viewport.set(a.x,a.y,a.width,a.height),0===i&&T.matrix.copy(s.matrix),!0===n&&T.cameras.push(s)}p&&(r.bindXRFramebuffer(f),null!==x&&e.clear(x))}const o=i.inputSources;for(let t=0;t<b.length;t++){const e=b[t],r=o[t];e.update(r,n,a)}if(k&&k(t,n),p){const t=h.textureWidth,n=h.textureHeight;r.bindFramebuffer(36008,f),r.bindFramebuffer(36009,u),e.invalidateFramebuffer(36008,[y]),e.invalidateFramebuffer(36009,[y]),e.blitFramebuffer(0,0,t,n,0,0,t,n,16384,9728),e.invalidateFramebuffer(36008,[36064]),r.bindFramebuffer(36008,null),r.bindFramebuffer(36009,null),r.bindFramebuffer(36160,f)}v=null})),this.setAnimationLoop=function(t){k=t},this.dispose=function(){}}}function Xa(t){function e(e,n){e.opacity.value=n.opacity,n.color&&e.diffuse.value.copy(n.color),n.emissive&&e.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(e.map.value=n.map),n.alphaMap&&(e.alphaMap.value=n.alphaMap),n.specularMap&&(e.specularMap.value=n.specularMap),n.alphaTest>0&&(e.alphaTest.value=n.alphaTest);const r=t.get(n).envMap;if(r){e.envMap.value=r,e.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,e.reflectivity.value=n.reflectivity,e.ior.value=n.ior,e.refractionRatio.value=n.refractionRatio;const i=t.get(r).__maxMipLevel;void 0!==i&&(e.maxMipLevel.value=i)}let i,o;n.lightMap&&(e.lightMap.value=n.lightMap,e.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(e.aoMap.value=n.aoMap,e.aoMapIntensity.value=n.aoMapIntensity),n.map?i=n.map:n.specularMap?i=n.specularMap:n.displacementMap?i=n.displacementMap:n.normalMap?i=n.normalMap:n.bumpMap?i=n.bumpMap:n.roughnessMap?i=n.roughnessMap:n.metalnessMap?i=n.metalnessMap:n.alphaMap?i=n.alphaMap:n.emissiveMap?i=n.emissiveMap:n.clearcoatMap?i=n.clearcoatMap:n.clearcoatNormalMap?i=n.clearcoatNormalMap:n.clearcoatRoughnessMap?i=n.clearcoatRoughnessMap:n.specularIntensityMap?i=n.specularIntensityMap:n.specularColorMap?i=n.specularColorMap:n.transmissionMap?i=n.transmissionMap:n.thicknessMap?i=n.thicknessMap:n.sheenColorMap?i=n.sheenColorMap:n.sheenRoughnessMap&&(i=n.sheenRoughnessMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix)),n.aoMap?o=n.aoMap:n.lightMap&&(o=n.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),e.uv2Transform.value.copy(o.matrix))}function n(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(e.emissiveMap.value=n.emissiveMap),n.bumpMap&&(e.bumpMap.value=n.bumpMap,e.bumpScale.value=n.bumpScale,1===n.side&&(e.bumpScale.value*=-1)),n.normalMap&&(e.normalMap.value=n.normalMap,e.normalScale.value.copy(n.normalScale),1===n.side&&e.normalScale.value.negate()),n.displacementMap&&(e.displacementMap.value=n.displacementMap,e.displacementScale.value=n.displacementScale,e.displacementBias.value=n.displacementBias);t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,r,i,o,a){r.isMeshBasicMaterial?e(t,r):r.isMeshLambertMaterial?(e(t,r),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,r)):r.isMeshToonMaterial?(e(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap);e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isMeshPhongMaterial?(e(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isMeshStandardMaterial?(e(t,r),r.isMeshPhysicalMaterial?function(t,e,r){n(t,e),t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap));e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate()));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=r.texture,t.transmissionSamplerSize.value.set(r.width,r.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor));t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap);e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap)}(t,r,a):n(t,r)):r.isMeshMatcapMaterial?(e(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isMeshDepthMaterial?(e(t,r),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isMeshDistanceMaterial?(e(t,r),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias);t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,r)):r.isMeshNormalMaterial?(e(t,r),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,r)):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,n,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*r,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let i;e.map?i=e.map:e.alphaMap&&(i=e.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}(t,r,i,o):r.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let n;e.map?n=e.map:e.alphaMap&&(n=e.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Ya(t={}){const e=void 0!==t.canvas?t.canvas:function(){const t=Le("canvas");return t.style.display="block",t}(),n=void 0!==t.context?t.context:null,r=void 0!==t.alpha&&t.alpha,i=void 0===t.depth||t.depth,o=void 0===t.stencil||t.stencil,a=void 0!==t.antialias&&t.antialias,s=void 0===t.premultipliedAlpha||t.premultipliedAlpha,l=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,c=void 0!==t.powerPreference?t.powerPreference:"default",u=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let h=null,d=null;const p=[],f=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=ie,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;const m=this;let g=!1,v=0,y=0,x=null,b=-1,w=null;const _=new Ie,M=new Ie;let S=null,T=e.width,E=e.height,C=1,L=null,A=null;const R=new Ie(0,0,T,E),P=new Ie(0,0,T,E);let N=!1;const D=[],k=new ai;let I=!1,O=!1,z=null;const F=new vn,B=new Be,U={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function H(){return null===x?C:1}let W,G,V,j,$,q,X,Y,Z,J,K,Q,tt,et,nt,rt,it,ot,at,st,lt,ct,ut,ht=n;function dt(t,n){for(let r=0;r<t.length;r++){const i=t[r],o=e.getContext(i,n);if(null!==o)return o}return null}try{const t={alpha:r,depth:i,stencil:o,antialias:a,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:u};if(e.addEventListener("webglcontextlost",mt,!1),e.addEventListener("webglcontextrestored",gt,!1),null===ht){const e=["webgl2","webgl","experimental-webgl"];if(!0===m.isWebGL1Renderer&&e.shift(),ht=dt(e,t),null===ht)throw dt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===ht.getShaderPrecisionFormat&&(ht.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function pt(){W=new ji(ht),G=new gi(ht,W,t),W.init(G),ct=new Wa(ht,W,G),V=new Ua(ht,W,G),D[0]=1029,j=new Xi(ht),$=new Ea,q=new Ha(ht,W,V,$,G,ct,j),X=new yi(m),Y=new Vi(m),Z=new li(ht,G),ut=new fi(ht,W,Z,G),J=new $i(ht,Z,j,ut),K=new to(ht,J,Z,j),at=new Qi(ht,G,q),rt=new vi($),Q=new Ta(m,X,Y,W,G,ut,rt),tt=new Xa($),et=new Ra($),nt=new Oa(W,G),ot=new pi(m,X,V,K,s),it=new Ba(m,K,G),st=new mi(ht,W,j,G),lt=new qi(ht,W,j,G),j.programs=Q.programs,m.capabilities=G,m.extensions=W,m.properties=$,m.renderLists=et,m.shadowMap=it,m.state=V,m.info=j}pt();const ft=new qa(m,ht);function mt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),g=!0}function gt(){console.log("THREE.WebGLRenderer: Context Restored."),g=!1;const t=j.autoReset,e=it.enabled,n=it.autoUpdate,r=it.needsUpdate,i=it.type;pt(),j.autoReset=t,it.enabled=e,it.autoUpdate=n,it.needsUpdate=r,it.type=i}function vt(t){const e=t.target;e.removeEventListener("dispose",vt),function(t){(function(t){const e=$.get(t).programs;void 0!==e&&e.forEach((function(t){Q.releaseProgram(t)}))})(t),$.remove(t)}(e)}this.xr=ft,this.getContext=function(){return ht},this.getContextAttributes=function(){return ht.getContextAttributes()},this.forceContextLoss=function(){const t=W.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=W.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return C},this.setPixelRatio=function(t){void 0!==t&&(C=t,this.setSize(T,E,!1))},this.getSize=function(t){return t.set(T,E)},this.setSize=function(t,n,r){ft.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(T=t,E=n,e.width=Math.floor(t*C),e.height=Math.floor(n*C),!1!==r&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(t){return t.set(T*C,E*C).floor()},this.setDrawingBufferSize=function(t,n,r){T=t,E=n,C=r,e.width=Math.floor(t*r),e.height=Math.floor(n*r),this.setViewport(0,0,t,n)},this.getCurrentViewport=function(t){return t.copy(_)},this.getViewport=function(t){return t.copy(R)},this.setViewport=function(t,e,n,r){t.isVector4?R.set(t.x,t.y,t.z,t.w):R.set(t,e,n,r),V.viewport(_.copy(R).multiplyScalar(C).floor())},this.getScissor=function(t){return t.copy(P)},this.setScissor=function(t,e,n,r){t.isVector4?P.set(t.x,t.y,t.z,t.w):P.set(t,e,n,r),V.scissor(M.copy(P).multiplyScalar(C).floor())},this.getScissorTest=function(){return N},this.setScissorTest=function(t){V.setScissorTest(N=t)},this.setOpaqueSort=function(t){L=t},this.setTransparentSort=function(t){A=t},this.getClearColor=function(t){return t.copy(ot.getClearColor())},this.setClearColor=function(){ot.setClearColor.apply(ot,arguments)},this.getClearAlpha=function(){return ot.getClearAlpha()},this.setClearAlpha=function(){ot.setClearAlpha.apply(ot,arguments)},this.clear=function(t,e,n){let r=0;(void 0===t||t)&&(r|=16384),(void 0===e||e)&&(r|=256),(void 0===n||n)&&(r|=1024),ht.clear(r)},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(){e.removeEventListener("webglcontextlost",mt,!1),e.removeEventListener("webglcontextrestored",gt,!1),et.dispose(),nt.dispose(),$.dispose(),X.dispose(),Y.dispose(),K.dispose(),ut.dispose(),ft.dispose(),ft.removeEventListener("sessionstart",xt),ft.removeEventListener("sessionend",bt),z&&(z.dispose(),z=null),wt.stop()},this.renderBufferDirect=function(t,e,n,r,i,o){null===e&&(e=U);const a=i.isMesh&&i.matrixWorld.determinant()<0,s=function(t,e,n,r,i){!0!==e.isScene&&(e=U);q.resetTextureUnits();const o=e.fog,a=r.isMeshStandardMaterial?e.environment:null,s=null===x?m.outputEncoding:x.texture.encoding,l=(r.isMeshStandardMaterial?Y:X).get(r.envMap||a),c=!0===r.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,u=!!r.normalMap&&!!n.attributes.tangent,h=!!n.morphAttributes.position,p=!!n.morphAttributes.normal,f=n.morphAttributes.position?n.morphAttributes.position.length:0,g=$.get(r),v=d.state.lights;if(!0===I&&(!0===O||t!==w)){const e=t===w&&r.id===b;rt.setState(r,t,e)}let y=!1;r.version===g.__version?g.needsLights&&g.lightsStateVersion!==v.state.version||g.outputEncoding!==s||i.isInstancedMesh&&!1===g.instancing?y=!0:i.isInstancedMesh||!0!==g.instancing?i.isSkinnedMesh&&!1===g.skinning?y=!0:i.isSkinnedMesh||!0!==g.skinning?g.envMap!==l||r.fog&&g.fog!==o?y=!0:void 0===g.numClippingPlanes||g.numClippingPlanes===rt.numPlanes&&g.numIntersection===rt.numIntersection?(g.vertexAlphas!==c||g.vertexTangents!==u||g.morphTargets!==h||g.morphNormals!==p||!0===G.isWebGL2&&g.morphTargetsCount!==f)&&(y=!0):y=!0:y=!0:y=!0:(y=!0,g.__version=r.version);let _=g.currentProgram;!0===y&&(_=Et(r,e,i));let M=!1,S=!1,T=!1;const L=_.getUniforms(),A=g.uniforms;V.useProgram(_.program)&&(M=!0,S=!0,T=!0);r.id!==b&&(b=r.id,S=!0);if(M||w!==t){if(L.setValue(ht,"projectionMatrix",t.projectionMatrix),G.logarithmicDepthBuffer&&L.setValue(ht,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),w!==t&&(w=t,S=!0,T=!0),r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshStandardMaterial||r.envMap){const e=L.map.cameraPosition;void 0!==e&&e.setValue(ht,B.setFromMatrixPosition(t.matrixWorld))}(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&L.setValue(ht,"isOrthographic",!0===t.isOrthographicCamera),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.isShadowMaterial||i.isSkinnedMesh)&&L.setValue(ht,"viewMatrix",t.matrixWorldInverse)}if(i.isSkinnedMesh){L.setOptional(ht,i,"bindMatrix"),L.setOptional(ht,i,"bindMatrixInverse");const t=i.skeleton;t&&(G.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),L.setValue(ht,"boneTexture",t.boneTexture,q),L.setValue(ht,"boneTextureSize",t.boneTextureSize)):L.setOptional(ht,t,"boneMatrices"))}!n||void 0===n.morphAttributes.position&&void 0===n.morphAttributes.normal||at.update(i,n,r,_);(S||g.receiveShadow!==i.receiveShadow)&&(g.receiveShadow=i.receiveShadow,L.setValue(ht,"receiveShadow",i.receiveShadow));S&&(L.setValue(ht,"toneMappingExposure",m.toneMappingExposure),g.needsLights&&(P=T,(R=A).ambientLightColor.needsUpdate=P,R.lightProbe.needsUpdate=P,R.directionalLights.needsUpdate=P,R.directionalLightShadows.needsUpdate=P,R.pointLights.needsUpdate=P,R.pointLightShadows.needsUpdate=P,R.spotLights.needsUpdate=P,R.spotLightShadows.needsUpdate=P,R.rectAreaLights.needsUpdate=P,R.hemisphereLights.needsUpdate=P),o&&r.fog&&tt.refreshFogUniforms(A,o),tt.refreshMaterialUniforms(A,r,C,E,z),ia.upload(ht,g.uniformsList,A,q));var R,P;r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(ia.upload(ht,g.uniformsList,A,q),r.uniformsNeedUpdate=!1);r.isSpriteMaterial&&L.setValue(ht,"center",i.center);return L.setValue(ht,"modelViewMatrix",i.modelViewMatrix),L.setValue(ht,"normalMatrix",i.normalMatrix),L.setValue(ht,"modelMatrix",i.matrixWorld),_}(t,e,n,r,i);V.setMaterial(r,a);let l=n.index;const c=n.attributes.position;if(null===l){if(void 0===c||0===c.count)return}else if(0===l.count)return;let u,h=1;!0===r.wireframe&&(l=J.getWireframeAttribute(n),h=2),ut.setup(i,r,s,n,l);let p=st;null!==l&&(u=Z.get(l),p=lt,p.setIndex(u));const f=null!==l?l.count:c.count,g=n.drawRange.start*h,v=n.drawRange.count*h,y=null!==o?o.start*h:0,_=null!==o?o.count*h:1/0,M=Math.max(g,y),S=Math.min(f,g+v,y+_)-1,T=Math.max(0,S-M+1);if(0!==T){if(i.isMesh)!0===r.wireframe?(V.setLineWidth(r.wireframeLinewidth*H()),p.setMode(1)):p.setMode(4);else if(i.isLine){let t=r.linewidth;void 0===t&&(t=1),V.setLineWidth(t*H()),i.isLineSegments?p.setMode(1):i.isLineLoop?p.setMode(2):p.setMode(3)}else i.isPoints?p.setMode(0):i.isSprite&&p.setMode(4);if(i.isInstancedMesh)p.renderInstances(M,T,i.count);else if(n.isInstancedBufferGeometry){const t=Math.min(n.instanceCount,n._maxInstanceCount);p.renderInstances(M,T,t)}else p.render(M,T)}},this.compile=function(t,e){d=nt.get(t),d.init(),f.push(d),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(d.pushLight(t),t.castShadow&&d.pushShadow(t))})),d.setupLights(m.physicallyCorrectLights),t.traverse((function(e){const n=e.material;if(n)if(Array.isArray(n))for(let r=0;r<n.length;r++){Et(n[r],t,e)}else Et(n,t,e)})),f.pop(),d=null};let yt=null;function xt(){wt.stop()}function bt(){wt.start()}const wt=new si;function _t(t,e,n,r){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)d.pushLight(t),t.castShadow&&d.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||k.intersectsSprite(t)){r&&B.setFromMatrixPosition(t.matrixWorld).applyMatrix4(F);const e=K.update(t),i=t.material;i.visible&&h.push(t,e,i,n,B.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==j.render.frame&&(t.skeleton.update(),t.skeleton.frame=j.render.frame),!t.frustumCulled||k.intersectsObject(t))){r&&B.setFromMatrixPosition(t.matrixWorld).applyMatrix4(F);const e=K.update(t),i=t.material;if(Array.isArray(i)){const r=e.groups;for(let o=0,a=r.length;o<a;o++){const a=r[o],s=i[a.materialIndex];s&&s.visible&&h.push(t,e,s,n,B.z,a)}}else i.visible&&h.push(t,e,i,n,B.z,null)}const i=t.children;for(let t=0,o=i.length;t<o;t++)_t(i[t],e,n,r)}function Mt(t,e,n,r){const i=t.opaque,o=t.transmissive,s=t.transparent;d.setupLightsView(n),o.length>0&&function(t,e,n){if(null===z){const t=!0===a&&!0===G.isWebGL2;z=new(t?ze:Oe)(1024,1024,{generateMipmaps:!0,type:null!==ct.convert(jt)?jt:Ht,minFilter:Ut,magFilter:Ft,wrapS:Ot,wrapT:Ot})}const r=m.getRenderTarget();m.setRenderTarget(z),m.clear();const i=m.toneMapping;m.toneMapping=0,St(t,e,n),m.toneMapping=i,q.updateMultisampleRenderTarget(z),q.updateRenderTargetMipmap(z),m.setRenderTarget(r)}(i,e,n),r&&V.viewport(_.copy(r)),i.length>0&&St(i,e,n),o.length>0&&St(o,e,n),s.length>0&&St(s,e,n)}function St(t,e,n){const r=!0===e.isScene?e.overrideMaterial:null;for(let i=0,o=t.length;i<o;i++){const o=t[i],a=o.object,s=o.geometry,l=null===r?o.material:r,c=o.group;a.layers.test(n.layers)&&Tt(a,e,n,s,l,c)}}function Tt(t,e,n,r,i,o){t.onBeforeRender(m,e,n,r,i,o),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),i.onBeforeRender(m,e,n,r,t,o),!0===i.transparent&&2===i.side?(i.side=1,i.needsUpdate=!0,m.renderBufferDirect(n,e,r,i,t,o),i.side=0,i.needsUpdate=!0,m.renderBufferDirect(n,e,r,i,t,o),i.side=2):m.renderBufferDirect(n,e,r,i,t,o),t.onAfterRender(m,e,n,r,i,o)}function Et(t,e,n){!0!==e.isScene&&(e=U);const r=$.get(t),i=d.state.lights,o=d.state.shadowsArray,a=i.state.version,s=Q.getParameters(t,i.state,o,e,n),l=Q.getProgramCacheKey(s);let c=r.programs;r.environment=t.isMeshStandardMaterial?e.environment:null,r.fog=e.fog,r.envMap=(t.isMeshStandardMaterial?Y:X).get(t.envMap||r.environment),void 0===c&&(t.addEventListener("dispose",vt),c=new Map,r.programs=c);let u=c.get(l);if(void 0!==u){if(r.currentProgram===u&&r.lightsStateVersion===a)return Ct(t,s),u}else s.uniforms=Q.getUniforms(t),t.onBuild(n,s,m),t.onBeforeCompile(s,m),u=Q.acquireProgram(s,l),c.set(l,u),r.uniforms=s.uniforms;const h=r.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(h.clippingPlanes=rt.uniform),Ct(t,s),r.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),r.lightsStateVersion=a,r.needsLights&&(h.ambientLightColor.value=i.state.ambient,h.lightProbe.value=i.state.probe,h.directionalLights.value=i.state.directional,h.directionalLightShadows.value=i.state.directionalShadow,h.spotLights.value=i.state.spot,h.spotLightShadows.value=i.state.spotShadow,h.rectAreaLights.value=i.state.rectArea,h.ltc_1.value=i.state.rectAreaLTC1,h.ltc_2.value=i.state.rectAreaLTC2,h.pointLights.value=i.state.point,h.pointLightShadows.value=i.state.pointShadow,h.hemisphereLights.value=i.state.hemi,h.directionalShadowMap.value=i.state.directionalShadowMap,h.directionalShadowMatrix.value=i.state.directionalShadowMatrix,h.spotShadowMap.value=i.state.spotShadowMap,h.spotShadowMatrix.value=i.state.spotShadowMatrix,h.pointShadowMap.value=i.state.pointShadowMap,h.pointShadowMatrix.value=i.state.pointShadowMatrix);const p=u.getUniforms(),f=ia.seqWithValue(p.seq,h);return r.currentProgram=u,r.uniformsList=f,u}function Ct(t,e){const n=$.get(t);n.outputEncoding=e.outputEncoding,n.instancing=e.instancing,n.skinning=e.skinning,n.morphTargets=e.morphTargets,n.morphNormals=e.morphNormals,n.morphTargetsCount=e.morphTargetsCount,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas,n.vertexTangents=e.vertexTangents}wt.setAnimationLoop((function(t){yt&&yt(t)})),"undefined"!=typeof window&&wt.setContext(window),this.setAnimationLoop=function(t){yt=t,ft.setAnimationLoop(t),null===t?wt.stop():wt.start()},ft.addEventListener("sessionstart",xt),ft.addEventListener("sessionend",bt),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===g)return;!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===ft.enabled&&!0===ft.isPresenting&&(!0===ft.cameraAutoUpdate&&ft.updateCamera(e),e=ft.getCamera()),!0===t.isScene&&t.onBeforeRender(m,t,e,x),d=nt.get(t,f.length),d.init(),f.push(d),F.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),k.setFromProjectionMatrix(F),O=this.localClippingEnabled,I=rt.init(this.clippingPlanes,O,e),h=et.get(t,p.length),h.init(),p.push(h),_t(t,e,0,m.sortObjects),h.finish(),!0===m.sortObjects&&h.sort(L,A),!0===I&&rt.beginShadows();const n=d.state.shadowsArray;if(it.render(n,t,e),!0===I&&rt.endShadows(),!0===this.info.autoReset&&this.info.reset(),ot.render(h,t),d.setupLights(m.physicallyCorrectLights),e.isArrayCamera){const n=e.cameras;for(let e=0,r=n.length;e<r;e++){const r=n[e];Mt(h,t,r,r.viewport)}}else Mt(h,t,e);null!==x&&(q.updateMultisampleRenderTarget(x),q.updateRenderTargetMipmap(x)),!0===t.isScene&&t.onAfterRender(m,t,e),V.buffers.depth.setTest(!0),V.buffers.depth.setMask(!0),V.buffers.color.setMask(!0),V.setPolygonOffset(!1),ut.resetDefaultState(),b=-1,w=null,f.pop(),d=f.length>0?f[f.length-1]:null,p.pop(),h=p.length>0?p[p.length-1]:null},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return x},this.setRenderTarget=function(t,e=0,n=0){x=t,v=e,y=n,t&&void 0===$.get(t).__webglFramebuffer&&q.setupRenderTarget(t);let r=null,i=!1,o=!1;if(t){const n=t.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(o=!0);const a=$.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=a[e],i=!0):r=t.isWebGLMultisampleRenderTarget?$.get(t).__webglMultisampledFramebuffer:a,_.copy(t.viewport),M.copy(t.scissor),S=t.scissorTest}else _.copy(R).multiplyScalar(C).floor(),M.copy(P).multiplyScalar(C).floor(),S=N;if(V.bindFramebuffer(36160,r)&&G.drawBuffers){let e=!1;if(t)if(t.isWebGLMultipleRenderTargets){const n=t.texture;if(D.length!==n.length||36064!==D[0]){for(let t=0,e=n.length;t<e;t++)D[t]=36064+t;D.length=n.length,e=!0}}else 1===D.length&&36064===D[0]||(D[0]=36064,D.length=1,e=!0);else 1===D.length&&1029===D[0]||(D[0]=1029,D.length=1,e=!0);e&&(G.isWebGL2?ht.drawBuffers(D):W.get("WEBGL_draw_buffers").drawBuffersWEBGL(D))}if(V.viewport(_),V.scissor(M),V.setScissorTest(S),i){const r=$.get(t.texture);ht.framebufferTexture2D(36160,36064,34069+e,r.__webglTexture,n)}else if(o){const r=$.get(t.texture),i=e||0;ht.framebufferTextureLayer(36160,36064,r.__webglTexture,n||0,i)}b=-1},this.readRenderTargetPixels=function(t,e,n,r,i,o,a){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let s=$.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(s=s[a]),s){V.bindFramebuffer(36160,s);try{const a=t.texture,s=a.format,l=a.type;if(s!==Xt&&ct.convert(s)!==ht.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===jt&&(W.has("EXT_color_buffer_half_float")||G.isWebGL2&&W.has("EXT_color_buffer_float"));if(!(l===Ht||ct.convert(l)===ht.getParameter(35738)||l===Vt&&(G.isWebGL2||W.has("OES_texture_float")||W.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===ht.checkFramebufferStatus(36160)?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&ht.readPixels(e,n,r,i,ct.convert(s),ct.convert(l),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const t=null!==x?$.get(x).__webglFramebuffer:null;V.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,n=0){const r=Math.pow(2,-n),i=Math.floor(e.image.width*r),o=Math.floor(e.image.height*r);let a=ct.convert(e.format);G.isWebGL2&&(6407===a&&(a=32849),6408===a&&(a=32856)),q.setTexture2D(e,0),ht.copyTexImage2D(3553,n,a,t.x,t.y,i,o,0),V.unbindTexture()},this.copyTextureToTexture=function(t,e,n,r=0){const i=e.image.width,o=e.image.height,a=ct.convert(n.format),s=ct.convert(n.type);q.setTexture2D(n,0),ht.pixelStorei(37440,n.flipY),ht.pixelStorei(37441,n.premultiplyAlpha),ht.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?ht.texSubImage2D(3553,r,t.x,t.y,i,o,a,s,e.image.data):e.isCompressedTexture?ht.compressedTexSubImage2D(3553,r,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,a,e.mipmaps[0].data):ht.texSubImage2D(3553,r,t.x,t.y,a,s,e.image),0===r&&n.generateMipmaps&&ht.generateMipmap(3553),V.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,r,i=0){if(m.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const o=t.max.x-t.min.x+1,a=t.max.y-t.min.y+1,s=t.max.z-t.min.z+1,l=ct.convert(r.format),c=ct.convert(r.type);let u;if(r.isDataTexture3D)q.setTexture3D(r,0),u=32879;else{if(!r.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");q.setTexture2DArray(r,0),u=35866}ht.pixelStorei(37440,r.flipY),ht.pixelStorei(37441,r.premultiplyAlpha),ht.pixelStorei(3317,r.unpackAlignment);const h=ht.getParameter(3314),d=ht.getParameter(32878),p=ht.getParameter(3316),f=ht.getParameter(3315),g=ht.getParameter(32877),v=n.isCompressedTexture?n.mipmaps[0]:n.image;ht.pixelStorei(3314,v.width),ht.pixelStorei(32878,v.height),ht.pixelStorei(3316,t.min.x),ht.pixelStorei(3315,t.min.y),ht.pixelStorei(32877,t.min.z),n.isDataTexture||n.isDataTexture3D?ht.texSubImage3D(u,i,e.x,e.y,e.z,o,a,s,l,c,v.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ht.compressedTexSubImage3D(u,i,e.x,e.y,e.z,o,a,s,l,v.data)):ht.texSubImage3D(u,i,e.x,e.y,e.z,o,a,s,l,c,v),ht.pixelStorei(3314,h),ht.pixelStorei(32878,d),ht.pixelStorei(3316,p),ht.pixelStorei(3315,f),ht.pixelStorei(32877,g),0===i&&r.generateMipmaps&&ht.generateMipmap(u),V.unbindTexture()},this.initTexture=function(t){q.setTexture2D(t,0),V.unbindTexture()},this.resetState=function(){v=0,y=0,x=null,V.reset(),ut.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Ya.prototype.isWebGLRenderer=!0;(class extends Ya{}).prototype.isWebGL1Renderer=!0;class Za extends Wn{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}Za.prototype.isScene=!0;class Ja{constructor(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=ce,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=ye()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let r=0,i=this.stride;r<i;r++)this.array[t+r]=e.array[n+r];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=ye()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=ye()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}Ja.prototype.isInterleavedBuffer=!0;const Ka=new Be;class Qa{constructor(t,e,n,r=!1){this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)Ka.x=this.getX(e),Ka.y=this.getY(e),Ka.z=this.getZ(e),Ka.applyMatrix4(t),this.setXYZ(e,Ka.x,Ka.y,Ka.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Ka.x=this.getX(e),Ka.y=this.getY(e),Ka.z=this.getZ(e),Ka.applyNormalMatrix(t),this.setXYZ(e,Ka.x,Ka.y,Ka.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Ka.x=this.getX(e),Ka.y=this.getY(e),Ka.z=this.getZ(e),Ka.transformDirection(t),this.setXYZ(e,Ka.x,Ka.y,Ka.z);return this}setX(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){return this.data.array[t*this.data.stride+this.offset]}getY(t){return this.data.array[t*this.data.stride+this.offset+1]}getZ(t){return this.data.array[t*this.data.stride+this.offset+2]}getW(t){return this.data.array[t*this.data.stride+this.offset+3]}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this}setXYZW(t,e,n,r,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this.data.array[t+3]=i,this}clone(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return new dr(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new Qa(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}Qa.prototype.isInterleavedBufferAttribute=!0;class ts extends er{constructor(t){super(),this.type="SpriteMaterial",this.color=new lr(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this}}let es;ts.prototype.isSpriteMaterial=!0;const ns=new Be,rs=new Be,is=new Be,os=new Te,as=new Te,ss=new vn,ls=new Be,cs=new Be,us=new Be,hs=new Te,ds=new Te,ps=new Te;function fs(t,e,n,r,i,o){os.subVectors(t,n).addScalar(.5).multiply(r),void 0!==i?(as.x=o*os.x-i*os.y,as.y=i*os.x+o*os.y):as.copy(os),t.copy(e),t.x+=as.x,t.y+=as.y,t.applyMatrix4(ss)}(class extends Wn{constructor(t){if(super(),this.type="Sprite",void 0===es){es=new Mr;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),e=new Ja(t,5);es.setIndex([0,1,2,0,2,3]),es.setAttribute("position",new Qa(e,3,0,!1)),es.setAttribute("uv",new Qa(e,2,3,!1))}this.geometry=es,this.material=void 0!==t?t:new ts,this.center=new Te(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),rs.setFromMatrixScale(this.matrixWorld),ss.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),is.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&rs.multiplyScalar(-is.z);const n=this.material.rotation;let r,i;0!==n&&(i=Math.cos(n),r=Math.sin(n));const o=this.center;fs(ls.set(-.5,-.5,0),is,o,rs,r,i),fs(cs.set(.5,-.5,0),is,o,rs,r,i),fs(us.set(.5,.5,0),is,o,rs,r,i),hs.set(0,0),ds.set(1,0),ps.set(1,1);let a=t.ray.intersectTriangle(ls,cs,us,!1,ns);if(null===a&&(fs(cs.set(-.5,.5,0),is,o,rs,r,i),ds.set(0,1),a=t.ray.intersectTriangle(ls,us,cs,!1,ns),null===a))return;const s=t.ray.origin.distanceTo(ns);s<t.near||s>t.far||e.push({distance:s,point:ns.clone(),uv:Qn.getUV(ns,ls,cs,us,hs,ds,ps,new Te),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}).prototype.isSprite=!0;const ms=new Be,gs=new Ie,vs=new Ie,ys=new Be,xs=new vn;class bs extends Hr{constructor(t,e){super(t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new vn,this.bindMatrixInverse=new vn}copy(t){return super.copy(t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new Ie,e=this.geometry.attributes.skinWeight;for(let n=0,r=e.count;n<r;n++){t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.w=e.getW(n);const r=1/t.manhattanLength();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(t,e){const n=this.skeleton,r=this.geometry;gs.fromBufferAttribute(r.attributes.skinIndex,t),vs.fromBufferAttribute(r.attributes.skinWeight,t),ms.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const r=vs.getComponent(t);if(0!==r){const i=gs.getComponent(t);xs.multiplyMatrices(n.bones[i].matrixWorld,n.boneInverses[i]),e.addScaledVector(ys.copy(ms).applyMatrix4(xs),r)}}return e.applyMatrix4(this.bindMatrixInverse)}}bs.prototype.isSkinnedMesh=!0;(class extends Wn{constructor(){super(),this.type="Bone"}}).prototype.isBone=!0;(class extends De{constructor(t=null,e=1,n=1,r,i,o,a,s,l=1003,c=1003,u,h){super(null,o,a,s,l,c,r,i,u,h),this.image={data:t,width:e,height:n},this.magFilter=l,this.minFilter=c,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}).prototype.isDataTexture=!0;class ws extends dr{constructor(t,e,n,r=1){"number"==typeof n&&(r=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(t,e,n),this.meshPerAttribute=r}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}ws.prototype.isInstancedBufferAttribute=!0;const _s=new vn,Ms=new vn,Ss=[],Ts=new Hr;(class extends Hr{constructor(t,e,n){super(t,e),this.instanceMatrix=new ws(new Float32Array(16*n),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}copy(t){return super.copy(t),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}raycast(t,e){const n=this.matrixWorld,r=this.count;if(Ts.geometry=this.geometry,Ts.material=this.material,void 0!==Ts.material)for(let i=0;i<r;i++){this.getMatrixAt(i,_s),Ms.multiplyMatrices(n,_s),Ts.matrixWorld=Ms,Ts.raycast(t,Ss);for(let t=0,n=Ss.length;t<n;t++){const n=Ss[t];n.instanceId=i,n.object=this,e.push(n)}Ss.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new ws(new Float32Array(3*this.instanceMatrix.count),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}).prototype.isInstancedMesh=!0;class Es extends er{constructor(t){super(),this.type="LineBasicMaterial",this.color=new lr(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this}}Es.prototype.isLineBasicMaterial=!0;const Cs=new Be,Ls=new Be,As=new vn,Rs=new gn,Ps=new ln;class Ns extends Wn{constructor(t=new Mr,e=new Es){super(),this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[0];for(let t=1,r=e.count;t<r;t++)Cs.fromBufferAttribute(e,t-1),Ls.fromBufferAttribute(e,t),n[t]=n[t-1],n[t]+=Cs.distanceTo(Ls);t.setAttribute("lineDistance",new mr(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(t,e){const n=this.geometry,r=this.matrixWorld,i=t.params.Line.threshold,o=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Ps.copy(n.boundingSphere),Ps.applyMatrix4(r),Ps.radius+=i,!1===t.ray.intersectsSphere(Ps))return;As.copy(r).invert(),Rs.copy(t.ray).applyMatrix4(As);const a=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=a*a,l=new Be,c=new Be,u=new Be,h=new Be,d=this.isLineSegments?2:1;if(n.isBufferGeometry){const r=n.index,i=n.attributes.position;if(null!==r){for(let n=Math.max(0,o.start),a=Math.min(r.count,o.start+o.count)-1;n<a;n+=d){const o=r.getX(n),a=r.getX(n+1);l.fromBufferAttribute(i,o),c.fromBufferAttribute(i,a);if(Rs.distanceSqToSegment(l,c,h,u)>s)continue;h.applyMatrix4(this.matrixWorld);const d=t.ray.origin.distanceTo(h);d<t.near||d>t.far||e.push({distance:d,point:u.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else{for(let n=Math.max(0,o.start),r=Math.min(i.count,o.start+o.count)-1;n<r;n+=d){l.fromBufferAttribute(i,n),c.fromBufferAttribute(i,n+1);if(Rs.distanceSqToSegment(l,c,h,u)>s)continue;h.applyMatrix4(this.matrixWorld);const r=t.ray.origin.distanceTo(h);r<t.near||r>t.far||e.push({distance:r,point:u.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}Ns.prototype.isLine=!0;const Ds=new Be,ks=new Be;class Is extends Ns{constructor(t,e){super(t,e),this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,r=e.count;t<r;t+=2)Ds.fromBufferAttribute(e,t),ks.fromBufferAttribute(e,t+1),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+Ds.distanceTo(ks);t.setAttribute("lineDistance",new mr(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}Is.prototype.isLineSegments=!0;(class extends Ns{constructor(t,e){super(t,e),this.type="LineLoop"}}).prototype.isLineLoop=!0;class Os extends er{constructor(t){super(),this.type="PointsMaterial",this.color=new lr(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this}}Os.prototype.isPointsMaterial=!0;const zs=new vn,Fs=new gn,Bs=new ln,Us=new Be;function Hs(t,e,n,r,i,o,a){const s=Fs.distanceSqToPoint(t);if(s<n){const n=new Be;Fs.closestPointToPoint(t,n),n.applyMatrix4(r);const l=i.ray.origin.distanceTo(n);if(l<i.near||l>i.far)return;o.push({distance:l,distanceToRay:Math.sqrt(s),point:n,index:e,face:null,object:a})}}(class extends Wn{constructor(t=new Mr,e=new Os){super(),this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}raycast(t,e){const n=this.geometry,r=this.matrixWorld,i=t.params.Points.threshold,o=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Bs.copy(n.boundingSphere),Bs.applyMatrix4(r),Bs.radius+=i,!1===t.ray.intersectsSphere(Bs))return;zs.copy(r).invert(),Fs.copy(t.ray).applyMatrix4(zs);const a=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=a*a;if(n.isBufferGeometry){const i=n.index,a=n.attributes.position;if(null!==i){for(let n=Math.max(0,o.start),l=Math.min(i.count,o.start+o.count);n<l;n++){const o=i.getX(n);Us.fromBufferAttribute(a,o),Hs(Us,o,s,r,t,e,this)}}else{for(let n=Math.max(0,o.start),i=Math.min(a.count,o.start+o.count);n<i;n++)Us.fromBufferAttribute(a,n),Hs(Us,n,s,r,t,e,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}).prototype.isPoints=!0;(class extends De{constructor(t,e,n,r,i,o,a,s,l){super(t,e,n,r,i,o,a,s,l),this.format=void 0!==a?a:qt,this.minFilter=void 0!==o?o:Bt,this.magFilter=void 0!==i?i:Bt,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){c.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}).prototype.isVideoTexture=!0;(class extends De{constructor(t,e,n,r,i,o,a,s,l,c,u,h){super(null,o,a,s,l,c,r,i,u,h),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}).prototype.isCompressedTexture=!0;(class extends De{constructor(t,e,n,r,i,o,a,s,l){super(t,e,n,r,i,o,a,s,l),this.needsUpdate=!0}}).prototype.isCanvasTexture=!0;(class extends De{constructor(t,e,n,r,i,o,a,s,l,c){if((c=void 0!==c?c:Yt)!==Yt&&c!==Zt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Yt&&(n=Wt),void 0===n&&c===Zt&&(n=$t),super(null,r,i,o,a,s,c,n,l),this.image={width:t,height:e},this.magFilter=void 0!==a?a:Ft,this.minFilter=void 0!==s?s:Ft,this.flipY=!1,this.generateMipmaps=!1}}).prototype.isDepthTexture=!0,new Be,new Be,new Be,new Qn;class Ws{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,r=this.getPoint(0),i=0;e.push(0);for(let o=1;o<=t;o++)n=this.getPoint(o/t),i+=n.distanceTo(r),e.push(i),r=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let r=0;const i=n.length;let o;o=e||t*n[i-1];let a,s=0,l=i-1;for(;s<=l;)if(r=Math.floor(s+(l-s)/2),a=n[r]-o,a<0)s=r+1;else{if(!(a>0)){l=r;break}l=r-1}if(r=l,n[r]===o)return r/(i-1);const c=n[r];return(r+(o-c)/(n[r+1]-c))/(i-1)}getTangent(t,e){const n=1e-4;let r=t-n,i=t+n;r<0&&(r=0),i>1&&(i=1);const o=this.getPoint(r),a=this.getPoint(i),s=e||(o.isVector2?new Te:new Be);return s.copy(a).sub(o).normalize(),s}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new Be,r=[],i=[],o=[],a=new Be,s=new vn;for(let e=0;e<=t;e++){const n=e/t;r[e]=this.getTangentAt(n,new Be)}i[0]=new Be,o[0]=new Be;let l=Number.MAX_VALUE;const c=Math.abs(r[0].x),u=Math.abs(r[0].y),h=Math.abs(r[0].z);c<=l&&(l=c,n.set(1,0,0)),u<=l&&(l=u,n.set(0,1,0)),h<=l&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],a),o[0].crossVectors(r[0],i[0]);for(let e=1;e<=t;e++){if(i[e]=i[e-1].clone(),o[e]=o[e-1].clone(),a.crossVectors(r[e-1],r[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(xe(r[e-1].dot(r[e]),-1,1));i[e].applyMatrix4(s.makeRotationAxis(a,t))}o[e].crossVectors(r[e],i[e])}if(!0===e){let e=Math.acos(xe(i[0].dot(i[t]),-1,1));e/=t,r[0].dot(a.crossVectors(i[0],i[t]))>0&&(e=-e);for(let n=1;n<=t;n++)i[n].applyMatrix4(s.makeRotationAxis(r[n],e*n)),o[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:o}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Gs extends Ws{constructor(t=0,e=0,n=1,r=1,i=0,o=2*Math.PI,a=!1,s=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s}getPoint(t,e){const n=e||new Te,r=2*Math.PI;let i=this.aEndAngle-this.aStartAngle;const o=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=o?0:r),!0!==this.aClockwise||o||(i===r?i=-r:i-=r);const a=this.aStartAngle+t*i;let s=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),n=s-this.aX,r=l-this.aY;s=n*t-r*e+this.aX,l=n*e+r*t+this.aY}return n.set(s,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}Gs.prototype.isEllipseCurve=!0;class Vs extends Gs{constructor(t,e,n,r,i,o){super(t,e,n,n,r,i,o),this.type="ArcCurve"}}function js(){let t=0,e=0,n=0,r=0;function i(i,o,a,s){t=i,e=a,n=-3*i+3*o-2*a-s,r=2*i-2*o+a+s}return{initCatmullRom:function(t,e,n,r,o){i(e,n,o*(n-t),o*(r-e))},initNonuniformCatmullRom:function(t,e,n,r,o,a,s){let l=(e-t)/o-(n-t)/(o+a)+(n-e)/a,c=(n-e)/a-(r-e)/(a+s)+(r-n)/s;l*=a,c*=a,i(e,n,l,c)},calc:function(i){const o=i*i;return t+e*i+n*o+r*(o*i)}}}Vs.prototype.isArcCurve=!0;const $s=new Be,qs=new js,Xs=new js,Ys=new js;class Zs extends Ws{constructor(t=[],e=!1,n="centripetal",r=.5){super(),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=r}getPoint(t,e=new Be){const n=e,r=this.points,i=r.length,o=(i-(this.closed?0:1))*t;let a,s,l=Math.floor(o),c=o-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/i)+1)*i:0===c&&l===i-1&&(l=i-2,c=1),this.closed||l>0?a=r[(l-1)%i]:($s.subVectors(r[0],r[1]).add(r[0]),a=$s);const u=r[l%i],h=r[(l+1)%i];if(this.closed||l+2<i?s=r[(l+2)%i]:($s.subVectors(r[i-1],r[i-2]).add(r[i-1]),s=$s),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(a.distanceToSquared(u),t),n=Math.pow(u.distanceToSquared(h),t),r=Math.pow(h.distanceToSquared(s),t);n<1e-4&&(n=1),e<1e-4&&(e=n),r<1e-4&&(r=n),qs.initNonuniformCatmullRom(a.x,u.x,h.x,s.x,e,n,r),Xs.initNonuniformCatmullRom(a.y,u.y,h.y,s.y,e,n,r),Ys.initNonuniformCatmullRom(a.z,u.z,h.z,s.z,e,n,r)}else"catmullrom"===this.curveType&&(qs.initCatmullRom(a.x,u.x,h.x,s.x,this.tension),Xs.initCatmullRom(a.y,u.y,h.y,s.y,this.tension),Ys.initCatmullRom(a.z,u.z,h.z,s.z,this.tension));return n.set(qs.calc(c),Xs.calc(c),Ys.calc(c)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new Be).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Js(t,e,n,r,i){const o=.5*(r-e),a=.5*(i-n),s=t*t;return(2*n-2*r+o+a)*(t*s)+(-3*n+3*r-2*o-a)*s+o*t+n}function Ks(t,e,n,r){return function(t,e){const n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,r)}function Qs(t,e,n,r,i){return function(t,e){const n=1-t;return n*n*n*e}(t,e)+function(t,e){const n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*e}(t,r)+function(t,e){return t*t*t*e}(t,i)}Zs.prototype.isCatmullRomCurve3=!0;class tl extends Ws{constructor(t=new Te,e=new Te,n=new Te,r=new Te){super(),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new Te){const n=e,r=this.v0,i=this.v1,o=this.v2,a=this.v3;return n.set(Qs(t,r.x,i.x,o.x,a.x),Qs(t,r.y,i.y,o.y,a.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}tl.prototype.isCubicBezierCurve=!0;class el extends Ws{constructor(t=new Be,e=new Be,n=new Be,r=new Be){super(),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new Be){const n=e,r=this.v0,i=this.v1,o=this.v2,a=this.v3;return n.set(Qs(t,r.x,i.x,o.x,a.x),Qs(t,r.y,i.y,o.y,a.y),Qs(t,r.z,i.z,o.z,a.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}el.prototype.isCubicBezierCurve3=!0;class nl extends Ws{constructor(t=new Te,e=new Te){super(),this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new Te){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){const n=e||new Te;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}nl.prototype.isLineCurve=!0;class rl extends Ws{constructor(t=new Te,e=new Te,n=new Te){super(),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new Te){const n=e,r=this.v0,i=this.v1,o=this.v2;return n.set(Ks(t,r.x,i.x,o.x),Ks(t,r.y,i.y,o.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}rl.prototype.isQuadraticBezierCurve=!0;class il extends Ws{constructor(t=new Be,e=new Be,n=new Be){super(),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new Be){const n=e,r=this.v0,i=this.v1,o=this.v2;return n.set(Ks(t,r.x,i.x,o.x),Ks(t,r.y,i.y,o.y),Ks(t,r.z,i.z,o.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}il.prototype.isQuadraticBezierCurve3=!0;class ol extends Ws{constructor(t=[]){super(),this.type="SplineCurve",this.points=t}getPoint(t,e=new Te){const n=e,r=this.points,i=(r.length-1)*t,o=Math.floor(i),a=i-o,s=r[0===o?o:o-1],l=r[o],c=r[o>r.length-2?r.length-1:o+1],u=r[o>r.length-3?r.length-1:o+2];return n.set(Js(a,s.x,l.x,c.x,u.x),Js(a,s.y,l.y,c.y,u.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new Te).fromArray(n))}return this}}ol.prototype.isSplineCurve=!0;var al=Object.freeze({__proto__:null,ArcCurve:Vs,CatmullRomCurve3:Zs,CubicBezierCurve:tl,CubicBezierCurve3:el,EllipseCurve:Gs,LineCurve:nl,LineCurve3:class extends Ws{constructor(t=new Be,e=new Be){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=t,this.v2=e}getPoint(t,e=new Be){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},QuadraticBezierCurve:rl,QuadraticBezierCurve3:il,SplineCurve:ol});class sl extends Ws{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new nl(e,t))}getPoint(t,e){const n=t*this.getLength(),r=this.getCurveLengths();let i=0;for(;i<r.length;){if(r[i]>=n){const t=r[i]-n,o=this.curves[i],a=o.getLength(),s=0===a?0:1-t/a;return o.getPointAt(s,e)}i++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let r=0,i=this.curves;r<i.length;r++){const o=i[r],a=o&&o.isEllipseCurve?2*t:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?t*o.points.length:t,s=o.getPoints(a);for(let t=0;t<s.length;t++){const r=s[t];n&&n.equals(r)||(e.push(r),n=r)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const n=this.curves[e];t.curves.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push((new al[n.type]).fromJSON(n))}return this}}class ll extends sl{constructor(t){super(),this.type="Path",this.currentPoint=new Te,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new nl(this.currentPoint.clone(),new Te(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,r){const i=new rl(this.currentPoint.clone(),new Te(t,e),new Te(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}bezierCurveTo(t,e,n,r,i,o){const a=new tl(this.currentPoint.clone(),new Te(t,e),new Te(n,r),new Te(i,o));return this.curves.push(a),this.currentPoint.set(i,o),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new ol(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,r,i,o){const a=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(t+a,e+s,n,r,i,o),this}absarc(t,e,n,r,i,o){return this.absellipse(t,e,n,n,r,i,o),this}ellipse(t,e,n,r,i,o,a,s){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+l,e+c,n,r,i,o,a,s),this}absellipse(t,e,n,r,i,o,a,s){const l=new Gs(t,e,n,r,i,o,a,s);if(this.curves.length>0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class cl extends ll{constructor(t){super(t),this.uuid=ye(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,r=this.holes.length;n<r;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const n=this.holes[e];t.holes.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push((new ll).fromJSON(n))}return this}}const ul=function(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let o=hl(t,0,i,n,!0);const a=[];if(!o||o.next===o.prev)return a;let s,l,c,u,h,d,p;if(r&&(o=function(t,e,n,r){const i=[];let o,a,s,l,c;for(o=0,a=e.length;o<a;o++)s=e[o]*r,l=o<a-1?e[o+1]*r:t.length,c=hl(t,s,l,r,!1),c===c.next&&(c.steiner=!0),i.push(_l(c));for(i.sort(yl),o=0;o<i.length;o++)xl(i[o],n),n=dl(n,n.next);return n}(t,e,o,n)),t.length>80*n){s=c=t[0],l=u=t[1];for(let e=n;e<i;e+=n)h=t[e],d=t[e+1],h<s&&(s=h),d<l&&(l=d),h>c&&(c=h),d>u&&(u=d);p=Math.max(c-s,u-l),p=0!==p?1/p:0}return pl(o,a,n,s,l,p),a};function hl(t,e,n,r,i){let o,a;if(i===function(t,e,n,r){let i=0;for(let o=e,a=n-r;o<n;o+=r)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}(t,e,n,r)>0)for(o=e;o<n;o+=r)a=Nl(o,t[o],t[o+1],a);else for(o=n-r;o>=e;o-=r)a=Nl(o,t[o],t[o+1],a);return a&&El(a,a.next)&&(Dl(a),a=a.next),a}function dl(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!El(r,r.next)&&0!==Tl(r.prev,r,r.next))r=r.next;else{if(Dl(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function pl(t,e,n,r,i,o,a){if(!t)return;!a&&o&&function(t,e,n,r){let i=t;do{null===i.z&&(i.z=wl(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,n,r,i,o,a,s,l,c=1;do{for(n=t,t=null,o=null,a=0;n;){for(a++,r=n,s=0,e=0;e<c&&(s++,r=r.nextZ,r);e++);for(l=c;s>0||l>0&&r;)0!==s&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,c*=2}while(a>1)}(i)}(t,r,i,o);let s,l,c=t;for(;t.prev!==t.next;)if(s=t.prev,l=t.next,o?ml(t,r,i,o):fl(t))e.push(s.i/n),e.push(t.i/n),e.push(l.i/n),Dl(t),t=l.next,c=l.next;else if((t=l)===c){a?1===a?pl(t=gl(dl(t),e,n),e,n,r,i,o,2):2===a&&vl(t,e,n,r,i,o):pl(dl(t),e,n,r,i,o,1);break}}function fl(t){const e=t.prev,n=t,r=t.next;if(Tl(e,n,r)>=0)return!1;let i=t.next.next;for(;i!==t.prev;){if(Ml(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&Tl(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function ml(t,e,n,r){const i=t.prev,o=t,a=t.next;if(Tl(i,o,a)>=0)return!1;const s=i.x<o.x?i.x<a.x?i.x:a.x:o.x<a.x?o.x:a.x,l=i.y<o.y?i.y<a.y?i.y:a.y:o.y<a.y?o.y:a.y,c=i.x>o.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,u=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,h=wl(s,l,e,n,r),d=wl(c,u,e,n,r);let p=t.prevZ,f=t.nextZ;for(;p&&p.z>=h&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&Ml(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&Tl(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&Ml(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&Tl(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=h;){if(p!==t.prev&&p!==t.next&&Ml(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&Tl(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&Ml(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&Tl(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function gl(t,e,n){let r=t;do{const i=r.prev,o=r.next.next;!El(i,o)&&Cl(i,r,r.next,o)&&Rl(i,o)&&Rl(o,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(o.i/n),Dl(r),Dl(r.next),r=t=o),r=r.next}while(r!==t);return dl(r)}function vl(t,e,n,r,i,o){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&Sl(a,t)){let s=Pl(a,t);return a=dl(a,a.next),s=dl(s,s.next),pl(a,e,n,r,i,o),void pl(s,e,n,r,i,o)}t=t.next}a=a.next}while(a!==t)}function yl(t,e){return t.x-e.x}function xl(t,e){if(e=function(t,e){let n=e;const r=t.x,i=t.y;let o,a=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>a){if(a=t,t===r){if(i===n.y)return n;if(i===n.next.y)return n.next}o=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!o)return null;if(r===a)return o;const s=o,l=o.x,c=o.y;let u,h=1/0;n=o;do{r>=n.x&&n.x>=l&&r!==n.x&&Ml(i<c?r:a,i,l,c,i<c?a:r,i,n.x,n.y)&&(u=Math.abs(i-n.y)/(r-n.x),Rl(n,t)&&(u<h||u===h&&(n.x>o.x||n.x===o.x&&bl(o,n)))&&(o=n,h=u)),n=n.next}while(n!==s);return o}(t,e),e){const n=Pl(e,t);dl(e,e.next),dl(n,n.next)}}function bl(t,e){return Tl(t.prev,t,e.prev)<0&&Tl(e.next,t,t.next)<0}function wl(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function _l(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function Ml(t,e,n,r,i,o,a,s){return(i-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(r-s)-(n-a)*(e-s)>=0&&(n-a)*(o-s)-(i-a)*(r-s)>=0}function Sl(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Cl(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Rl(t,e)&&Rl(e,t)&&function(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(Tl(t.prev,t,e.prev)||Tl(t,e.prev,e))||El(t,e)&&Tl(t.prev,t,t.next)>0&&Tl(e.prev,e,e.next)>0)}function Tl(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function El(t,e){return t.x===e.x&&t.y===e.y}function Cl(t,e,n,r){const i=Al(Tl(t,e,n)),o=Al(Tl(t,e,r)),a=Al(Tl(n,r,t)),s=Al(Tl(n,r,e));return i!==o&&a!==s||(!(0!==i||!Ll(t,n,e))||(!(0!==o||!Ll(t,r,e))||(!(0!==a||!Ll(n,t,r))||!(0!==s||!Ll(n,e,r)))))}function Ll(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Al(t){return t>0?1:t<0?-1:0}function Rl(t,e){return Tl(t.prev,t,t.next)<0?Tl(t,e,t.next)>=0&&Tl(t,t.prev,e)>=0:Tl(t,e,t.prev)<0||Tl(t,t.next,e)<0}function Pl(t,e){const n=new kl(t.i,t.x,t.y),r=new kl(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function Nl(t,e,n,r){const i=new kl(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Dl(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function kl(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Il{static area(t){const e=t.length;let n=0;for(let r=e-1,i=0;i<e;r=i++)n+=t[r].x*t[i].y-t[i].x*t[r].y;return.5*n}static isClockWise(t){return Il.area(t)<0}static triangulateShape(t,e){const n=[],r=[],i=[];Ol(t),zl(n,t);let o=t.length;e.forEach(Ol);for(let t=0;t<e.length;t++)r.push(o),o+=e[t].length,zl(n,e[t]);const a=ul(n,r);for(let t=0;t<a.length;t+=3)i.push(a.slice(t,t+3));return i}}function Ol(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function zl(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class Fl extends Mr{constructor(t=new cl([new Te(.5,.5),new Te(-.5,.5),new Te(-.5,-.5),new Te(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,r=[],i=[];for(let e=0,n=t.length;e<n;e++){o(t[e])}function o(t){const o=[],a=void 0!==e.curveSegments?e.curveSegments:12,s=void 0!==e.steps?e.steps:1;let l=void 0!==e.depth?e.depth:1,c=void 0===e.bevelEnabled||e.bevelEnabled,u=void 0!==e.bevelThickness?e.bevelThickness:.2,h=void 0!==e.bevelSize?e.bevelSize:u-.1,d=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3;const f=e.extrudePath,m=void 0!==e.UVGenerator?e.UVGenerator:Bl;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=e.amount);let g,v,y,x,b,w=!1;f&&(g=f.getSpacedPoints(s),w=!0,c=!1,v=f.computeFrenetFrames(s,!1),y=new Be,x=new Be,b=new Be),c||(p=0,u=0,h=0,d=0);const _=t.extractPoints(a);let M=_.shape;const S=_.holes;if(!Il.isClockWise(M)){M=M.reverse();for(let t=0,e=S.length;t<e;t++){const e=S[t];Il.isClockWise(e)&&(S[t]=e.reverse())}}const T=Il.triangulateShape(M,S),E=M;for(let t=0,e=S.length;t<e;t++){const e=S[t];M=M.concat(e)}function C(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}const L=M.length,A=T.length;function R(t,e,n){let r,i,o;const a=t.x-e.x,s=t.y-e.y,l=n.x-t.x,c=n.y-t.y,u=a*a+s*s,h=a*c-s*l;if(Math.abs(h)>Number.EPSILON){const h=Math.sqrt(u),d=Math.sqrt(l*l+c*c),p=e.x-s/h,f=e.y+a/h,m=((n.x-c/d-p)*c-(n.y+l/d-f)*l)/(a*c-s*l);r=p+a*m-t.x,i=f+s*m-t.y;const g=r*r+i*i;if(g<=2)return new Te(r,i);o=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?l>Number.EPSILON&&(t=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(s)===Math.sign(c)&&(t=!0),t?(r=-s,i=a,o=Math.sqrt(u)):(r=a,i=s,o=Math.sqrt(u/2))}return new Te(r/o,i/o)}const P=[];for(let t=0,e=E.length,n=e-1,r=t+1;t<e;t++,n++,r++)n===e&&(n=0),r===e&&(r=0),P[t]=R(E[t],E[n],E[r]);const N=[];let D,k=P.concat();for(let t=0,e=S.length;t<e;t++){const e=S[t];D=[];for(let t=0,n=e.length,r=n-1,i=t+1;t<n;t++,r++,i++)r===n&&(r=0),i===n&&(i=0),D[t]=R(e[t],e[r],e[i]);N.push(D),k=k.concat(D)}for(let t=0;t<p;t++){const e=t/p,n=u*Math.cos(e*Math.PI/2),r=h*Math.sin(e*Math.PI/2)+d;for(let t=0,e=E.length;t<e;t++){const e=C(E[t],P[t],r);z(e.x,e.y,-n)}for(let t=0,e=S.length;t<e;t++){const e=S[t];D=N[t];for(let t=0,i=e.length;t<i;t++){const i=C(e[t],D[t],r);z(i.x,i.y,-n)}}}const I=h+d;for(let t=0;t<L;t++){const e=c?C(M[t],k[t],I):M[t];w?(x.copy(v.normals[0]).multiplyScalar(e.x),y.copy(v.binormals[0]).multiplyScalar(e.y),b.copy(g[0]).add(x).add(y),z(b.x,b.y,b.z)):z(e.x,e.y,0)}for(let t=1;t<=s;t++)for(let e=0;e<L;e++){const n=c?C(M[e],k[e],I):M[e];w?(x.copy(v.normals[t]).multiplyScalar(n.x),y.copy(v.binormals[t]).multiplyScalar(n.y),b.copy(g[t]).add(x).add(y),z(b.x,b.y,b.z)):z(n.x,n.y,l/s*t)}for(let t=p-1;t>=0;t--){const e=t/p,n=u*Math.cos(e*Math.PI/2),r=h*Math.sin(e*Math.PI/2)+d;for(let t=0,e=E.length;t<e;t++){const e=C(E[t],P[t],r);z(e.x,e.y,l+n)}for(let t=0,e=S.length;t<e;t++){const e=S[t];D=N[t];for(let t=0,i=e.length;t<i;t++){const i=C(e[t],D[t],r);w?z(i.x,i.y+g[s-1].y,g[s-1].x+n):z(i.x,i.y,l+n)}}}function O(t,e){let n=t.length;for(;--n>=0;){const r=n;let i=n-1;i<0&&(i=t.length-1);for(let t=0,n=s+2*p;t<n;t++){const n=L*t,o=L*(t+1);B(e+r+n,e+i+n,e+i+o,e+r+o)}}}function z(t,e,n){o.push(t),o.push(e),o.push(n)}function F(t,e,i){U(t),U(e),U(i);const o=r.length/3,a=m.generateTopUV(n,r,o-3,o-2,o-1);H(a[0]),H(a[1]),H(a[2])}function B(t,e,i,o){U(t),U(e),U(o),U(e),U(i),U(o);const a=r.length/3,s=m.generateSideWallUV(n,r,a-6,a-3,a-2,a-1);H(s[0]),H(s[1]),H(s[3]),H(s[1]),H(s[2]),H(s[3])}function U(t){r.push(o[3*t+0]),r.push(o[3*t+1]),r.push(o[3*t+2])}function H(t){i.push(t.x),i.push(t.y)}!function(){const t=r.length/3;if(c){let t=0,e=L*t;for(let t=0;t<A;t++){const n=T[t];F(n[2]+e,n[1]+e,n[0]+e)}t=s+2*p,e=L*t;for(let t=0;t<A;t++){const n=T[t];F(n[0]+e,n[1]+e,n[2]+e)}}else{for(let t=0;t<A;t++){const e=T[t];F(e[2],e[1],e[0])}for(let t=0;t<A;t++){const e=T[t];F(e[0]+L*s,e[1]+L*s,e[2]+L*s)}}n.addGroup(t,r.length/3-t,0)}(),function(){const t=r.length/3;let e=0;O(E,e),e+=E.length;for(let t=0,n=S.length;t<n;t++){const n=S[t];O(n,e),e+=n.length}n.addGroup(t,r.length/3-t,1)}()}this.setAttribute("position",new mr(r,3)),this.setAttribute("uv",new mr(i,2)),this.computeVertexNormals()}toJSON(){const t=super.toJSON();return function(t,e,n){if(n.shapes=[],Array.isArray(t))for(let e=0,r=t.length;e<r;e++){const r=t[e];n.shapes.push(r.uuid)}else n.shapes.push(t.uuid);void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const n=[];for(let r=0,i=t.shapes.length;r<i;r++){const i=e[t.shapes[r]];n.push(i)}const r=t.options.extrudePath;return void 0!==r&&(t.options.extrudePath=(new al[r.type]).fromJSON(r)),new Fl(n,t.options)}}const Bl={generateTopUV:function(t,e,n,r,i){const o=e[3*n],a=e[3*n+1],s=e[3*r],l=e[3*r+1],c=e[3*i],u=e[3*i+1];return[new Te(o,a),new Te(s,l),new Te(c,u)]},generateSideWallUV:function(t,e,n,r,i,o){const a=e[3*n],s=e[3*n+1],l=e[3*n+2],c=e[3*r],u=e[3*r+1],h=e[3*r+2],d=e[3*i],p=e[3*i+1],f=e[3*i+2],m=e[3*o],g=e[3*o+1],v=e[3*o+2];return Math.abs(s-u)<Math.abs(a-c)?[new Te(a,1-l),new Te(c,1-h),new Te(d,1-f),new Te(m,1-v)]:[new Te(s,1-l),new Te(u,1-h),new Te(p,1-f),new Te(g,1-v)]}};class Ul extends Mr{constructor(t=new cl([new Te(0,.5),new Te(-.5,-.5),new Te(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const n=[],r=[],i=[],o=[];let a=0,s=0;if(!1===Array.isArray(t))l(t);else for(let e=0;e<t.length;e++)l(t[e]),this.addGroup(a,s,e),a+=s,s=0;function l(t){const a=r.length/3,l=t.extractPoints(e);let c=l.shape;const u=l.holes;!1===Il.isClockWise(c)&&(c=c.reverse());for(let t=0,e=u.length;t<e;t++){const e=u[t];!0===Il.isClockWise(e)&&(u[t]=e.reverse())}const h=Il.triangulateShape(c,u);for(let t=0,e=u.length;t<e;t++){const e=u[t];c=c.concat(e)}for(let t=0,e=c.length;t<e;t++){const e=c[t];r.push(e.x,e.y,0),i.push(0,0,1),o.push(e.x,e.y)}for(let t=0,e=h.length;t<e;t++){const e=h[t],r=e[0]+a,i=e[1]+a,o=e[2]+a;n.push(r,i,o),s+=3}}this.setIndex(n),this.setAttribute("position",new mr(r,3)),this.setAttribute("normal",new mr(i,3)),this.setAttribute("uv",new mr(o,2))}toJSON(){const t=super.toJSON();return function(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,r=t.length;n<r;n++){const r=t[n];e.shapes.push(r.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}static fromJSON(t,e){const n=[];for(let r=0,i=t.shapes.length;r<i;r++){const i=e[t.shapes[r]];n.push(i)}return new Ul(n,t.curveSegments)}}class Hl extends Mr{constructor(t=1,e=32,n=16,r=0,i=2*Math.PI,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:r,phiLength:i,thetaStart:o,thetaLength:a},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));const s=Math.min(o+a,Math.PI);let l=0;const c=[],u=new Be,h=new Be,d=[],p=[],f=[],m=[];for(let d=0;d<=n;d++){const g=[],v=d/n;let y=0;0==d&&0==o?y=.5/e:d==n&&s==Math.PI&&(y=-.5/e);for(let n=0;n<=e;n++){const s=n/e;u.x=-t*Math.cos(r+s*i)*Math.sin(o+v*a),u.y=t*Math.cos(o+v*a),u.z=t*Math.sin(r+s*i)*Math.sin(o+v*a),p.push(u.x,u.y,u.z),h.copy(u).normalize(),f.push(h.x,h.y,h.z),m.push(s+y,1-v),g.push(l++)}c.push(g)}for(let t=0;t<n;t++)for(let r=0;r<e;r++){const e=c[t][r+1],i=c[t][r],a=c[t+1][r],l=c[t+1][r+1];(0!==t||o>0)&&d.push(e,i,l),(t!==n-1||s<Math.PI)&&d.push(i,a,l)}this.setIndex(d),this.setAttribute("position",new mr(p,3)),this.setAttribute("normal",new mr(f,3)),this.setAttribute("uv",new mr(m,2))}static fromJSON(t){return new Hl(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}(class extends er{constructor(t){super(),this.type="ShadowMaterial",this.color=new lr(0),this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}}).prototype.isShadowMaterial=!0;class Wl extends er{constructor(t){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new lr(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new lr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}Wl.prototype.isMeshStandardMaterial=!0;(class extends Wl{constructor(t){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Te(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return xe(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new lr(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=.01,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new lr(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new lr(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(t)}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}).prototype.isMeshPhysicalMaterial=!0;(class extends er{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new lr(16777215),this.specular=new lr(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new lr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}).prototype.isMeshPhongMaterial=!0;(class extends er{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new lr(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new lr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}).prototype.isMeshToonMaterial=!0;(class extends er{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}).prototype.isMeshNormalMaterial=!0;(class extends er{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new lr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new lr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}).prototype.isMeshLambertMaterial=!0;(class extends er{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new lr(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this}}).prototype.isMeshMatcapMaterial=!0;(class extends Es{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}).prototype.isLineDashedMaterial=!0;const Gl={arraySlice:function(t,e,n){return Gl.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){const e=t.length,n=new Array(e);for(let t=0;t!==e;++t)n[t]=t;return n.sort((function(e,n){return t[e]-t[n]})),n},sortedArray:function(t,e,n){const r=t.length,i=new t.constructor(r);for(let o=0,a=0;a!==r;++o){const r=n[o]*e;for(let n=0;n!==e;++n)i[a++]=t[r+n]}return i},flattenJSON:function(t,e,n,r){let i=1,o=t[0];for(;void 0!==o&&void 0===o[r];)o=t[i++];if(void 0===o)return;let a=o[r];if(void 0!==a)if(Array.isArray(a))do{a=o[r],void 0!==a&&(e.push(o.time),n.push.apply(n,a)),o=t[i++]}while(void 0!==o);else if(void 0!==a.toArray)do{a=o[r],void 0!==a&&(e.push(o.time),a.toArray(n,n.length)),o=t[i++]}while(void 0!==o);else do{a=o[r],void 0!==a&&(e.push(o.time),n.push(a)),o=t[i++]}while(void 0!==o)},subclip:function(t,e,n,r,i=30){const o=t.clone();o.name=e;const a=[];for(let t=0;t<o.tracks.length;++t){const e=o.tracks[t],s=e.getValueSize(),l=[],c=[];for(let t=0;t<e.times.length;++t){const o=e.times[t]*i;if(!(o<n||o>=r)){l.push(e.times[t]);for(let n=0;n<s;++n)c.push(e.values[t*s+n])}}0!==l.length&&(e.times=Gl.convertArray(l,e.times.constructor),e.values=Gl.convertArray(c,e.values.constructor),a.push(e))}o.tracks=a;let s=1/0;for(let t=0;t<o.tracks.length;++t)s>o.tracks[t].times[0]&&(s=o.tracks[t].times[0]);for(let t=0;t<o.tracks.length;++t)o.tracks[t].shift(-1*s);return o.resetDuration(),o},makeClipAdditive:function(t,e=0,n=t,r=30){r<=0&&(r=30);const i=n.tracks.length,o=e/r;for(let e=0;e<i;++e){const r=n.tracks[e],i=r.ValueTypeName;if("bool"===i||"string"===i)continue;const a=t.tracks.find((function(t){return t.name===r.name&&t.ValueTypeName===i}));if(void 0===a)continue;let s=0;const l=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(s=l/3);let c=0;const u=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=u/3);const h=r.times.length-1;let d;if(o<=r.times[0]){const t=s,e=l-s;d=Gl.arraySlice(r.values,t,e)}else if(o>=r.times[h]){const t=h*l+s,e=t+l-s;d=Gl.arraySlice(r.values,t,e)}else{const t=r.createInterpolant(),e=s,n=l-s;t.evaluate(o),d=Gl.arraySlice(t.resultBuffer,e,n)}if("quaternion"===i){(new Fe).fromArray(d).normalize().conjugate().toArray(d)}const p=a.times.length;for(let t=0;t<p;++t){const e=t*u+c;if("quaternion"===i)Fe.multiplyQuaternionsFlat(a.values,e,d,0,a.values,e);else{const t=u-2*c;for(let n=0;n<t;++n)a.values[e+n]-=d[n]}}}return t.blendMode=2501,t}};class Vl{constructor(t,e,n,r){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,r=e[n],i=e[n-1];t:{e:{let o;n:{r:if(!(t<r)){for(let o=n+2;;){if(void 0===r){if(t<i)break r;return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,t,i)}if(n===o)break;if(i=r,r=e[++n],t<r)break e}o=e.length;break n}if(t>=i)break t;{const a=e[1];t<a&&(n=2,i=a);for(let o=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,t,r);if(n===o)break;if(r=i,i=e[--n-1],t>=i)break e}o=n,n=0}}for(;n<o;){const r=n+o>>>1;t<e[r]?o=r:n=r+1}if(r=e[n],i=e[n-1],void 0===i)return this._cachedIndex=0,this.beforeStart_(0,t,r);if(void 0===r)return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,i,t)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,t,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=t*r;for(let t=0;t!==r;++t)e[t]=n[i+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}Vl.prototype.beforeStart_=Vl.prototype.copySampleValue_,Vl.prototype.afterEnd_=Vl.prototype.copySampleValue_;class jl extends Vl{constructor(t,e,n,r){super(t,e,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:te,endingEnd:te}}intervalChanged_(t,e,n){const r=this.parameterPositions;let i=t-2,o=t+1,a=r[i],s=r[o];if(void 0===a)switch(this.getSettings_().endingStart){case ee:i=t,a=2*e-n;break;case ne:i=r.length-2,a=e+r[i]-r[i+1];break;default:i=t,a=n}if(void 0===s)switch(this.getSettings_().endingEnd){case ee:o=t,s=2*n-e;break;case ne:o=1,s=n+r[1]-r[0];break;default:o=t-1,s=e}const l=.5*(n-e),c=this.valueSize;this._weightPrev=l/(e-a),this._weightNext=l/(s-n),this._offsetPrev=i*c,this._offsetNext=o*c}interpolate_(t,e,n,r){const i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,l=s-a,c=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-e)/(r-e),f=p*p,m=f*p,g=-h*m+2*h*f-h*p,v=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f;for(let t=0;t!==a;++t)i[t]=g*o[c+t]+v*o[l+t]+y*o[s+t]+x*o[u+t];return i}}class $l extends Vl{constructor(t,e,n,r){super(t,e,n,r)}interpolate_(t,e,n,r){const i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,l=s-a,c=(n-e)/(r-e),u=1-c;for(let t=0;t!==a;++t)i[t]=o[l+t]*u+o[s+t]*c;return i}}class ql extends Vl{constructor(t,e,n,r){super(t,e,n,r)}interpolate_(t){return this.copySampleValue_(t-1)}}class Xl{constructor(t,e,n,r){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Gl.convertArray(e,this.TimeBufferType),this.values=Gl.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:Gl.convertArray(t.times,Array),values:Gl.convertArray(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(n.interpolation=e)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new ql(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new $l(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new jl(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Jt:e=this.InterpolantFactoryMethodDiscrete;break;case Kt:e=this.InterpolantFactoryMethodLinear;break;case Qt:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Jt;case this.InterpolantFactoryMethodLinear:return Kt;case this.InterpolantFactoryMethodSmooth:return Qt}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let n=0,r=e.length;n!==r;++n)e[n]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let n=0,r=e.length;n!==r;++n)e[n]*=t}return this}trim(t,e){const n=this.times,r=n.length;let i=0,o=r-1;for(;i!==r&&n[i]<t;)++i;for(;-1!==o&&n[o]>e;)--o;if(++o,0!==i||o!==r){i>=o&&(o=Math.max(o,1),i=o-1);const t=this.getValueSize();this.times=Gl.arraySlice(n,i,o),this.values=Gl.arraySlice(this.values,i*t,o*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let o=null;for(let e=0;e!==i;e++){const r=n[e];if("number"==typeof r&&isNaN(r)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,r),t=!1;break}if(null!==o&&o>r){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,r,o),t=!1;break}o=r}if(void 0!==r&&Gl.isTypedArray(r))for(let e=0,n=r.length;e!==n;++e){const n=r[e];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,n),t=!1;break}}return t}optimize(){const t=Gl.arraySlice(this.times),e=Gl.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===Qt,i=t.length-1;let o=1;for(let a=1;a<i;++a){let i=!1;const s=t[a];if(s!==t[a+1]&&(1!==a||s!==t[0]))if(r)i=!0;else{const t=a*n,r=t-n,o=t+n;for(let a=0;a!==n;++a){const n=e[t+a];if(n!==e[r+a]||n!==e[o+a]){i=!0;break}}}if(i){if(a!==o){t[o]=t[a];const r=a*n,i=o*n;for(let t=0;t!==n;++t)e[i+t]=e[r+t]}++o}}if(i>0){t[o]=t[i];for(let t=i*n,r=o*n,a=0;a!==n;++a)e[r+a]=e[t+a];++o}return o!==t.length?(this.times=Gl.arraySlice(t,0,o),this.values=Gl.arraySlice(e,0,o*n)):(this.times=t,this.values=e),this}clone(){const t=Gl.arraySlice(this.times,0),e=Gl.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}Xl.prototype.TimeBufferType=Float32Array,Xl.prototype.ValueBufferType=Float32Array,Xl.prototype.DefaultInterpolation=Kt;class Yl extends Xl{}Yl.prototype.ValueTypeName="bool",Yl.prototype.ValueBufferType=Array,Yl.prototype.DefaultInterpolation=Jt,Yl.prototype.InterpolantFactoryMethodLinear=void 0,Yl.prototype.InterpolantFactoryMethodSmooth=void 0;class Zl extends Xl{}Zl.prototype.ValueTypeName="color";class Jl extends Xl{}Jl.prototype.ValueTypeName="number";class Kl extends Vl{constructor(t,e,n,r){super(t,e,n,r)}interpolate_(t,e,n,r){const i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=(n-e)/(r-e);let l=t*a;for(let t=l+a;l!==t;l+=4)Fe.slerpFlat(i,0,o,l-a,o,l,s);return i}}class Ql extends Xl{InterpolantFactoryMethodLinear(t){return new Kl(this.times,this.values,this.getValueSize(),t)}}Ql.prototype.ValueTypeName="quaternion",Ql.prototype.DefaultInterpolation=Kt,Ql.prototype.InterpolantFactoryMethodSmooth=void 0;class tc extends Xl{}tc.prototype.ValueTypeName="string",tc.prototype.ValueBufferType=Array,tc.prototype.DefaultInterpolation=Jt,tc.prototype.InterpolantFactoryMethodLinear=void 0,tc.prototype.InterpolantFactoryMethodSmooth=void 0;class ec extends Xl{}ec.prototype.ValueTypeName="vector";class nc{constructor(t,e=-1,n,r=2500){this.name=t,this.tracks=n,this.duration=e,this.blendMode=r,this.uuid=ye(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,r=1/(t.fps||1);for(let t=0,i=n.length;t!==i;++t)e.push(rc(n[t]).scale(r));const i=new this(t.name,t.duration,e,t.blendMode);return i.uuid=t.uuid,i}static toJSON(t){const e=[],n=t.tracks,r={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,r=n.length;t!==r;++t)e.push(Xl.toJSON(n[t]));return r}static CreateFromMorphTargetSequence(t,e,n,r){const i=e.length,o=[];for(let t=0;t<i;t++){let a=[],s=[];a.push((t+i-1)%i,t,(t+1)%i),s.push(0,1,0);const l=Gl.getKeyframeOrder(a);a=Gl.sortedArray(a,1,l),s=Gl.sortedArray(s,1,l),r||0!==a[0]||(a.push(i),s.push(s[0])),o.push(new Jl(".morphTargetInfluences["+e[t].name+"]",a,s).scale(1/n))}return new this(t,-1,o)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const e=t;n=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<n.length;t++)if(n[t].name===e)return n[t];return null}static CreateClipsFromMorphTargetSequences(t,e,n){const r={},i=/^([\w-]*?)([\d]+)$/;for(let e=0,n=t.length;e<n;e++){const n=t[e],o=n.name.match(i);if(o&&o.length>1){const t=o[1];let e=r[t];e||(r[t]=e=[]),e.push(n)}}const o=[];for(const t in r)o.push(this.CreateFromMorphTargetSequence(t,r[t],e,n));return o}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,r,i){if(0!==n.length){const o=[],a=[];Gl.flattenJSON(n,o,a,r),0!==o.length&&i.push(new t(e,o,a))}},r=[],i=t.name||"default",o=t.fps||30,a=t.blendMode;let s=t.length||-1;const l=t.hierarchy||[];for(let t=0;t<l.length;t++){const i=l[t].keys;if(i&&0!==i.length)if(i[0].morphTargets){const t={};let e;for(e=0;e<i.length;e++)if(i[e].morphTargets)for(let n=0;n<i[e].morphTargets.length;n++)t[i[e].morphTargets[n]]=-1;for(const n in t){const t=[],o=[];for(let r=0;r!==i[e].morphTargets.length;++r){const r=i[e];t.push(r.time),o.push(r.morphTarget===n?1:0)}r.push(new Jl(".morphTargetInfluence["+n+"]",t,o))}s=t.length*(o||1)}else{const o=".bones["+e[t].name+"]";n(ec,o+".position",i,"pos",r),n(Ql,o+".quaternion",i,"rot",r),n(ec,o+".scale",i,"scl",r)}}if(0===r.length)return null;return new this(i,s,r,a)}resetDuration(){let t=0;for(let e=0,n=this.tracks.length;e!==n;++e){const n=this.tracks[e];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function rc(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Jl;case"vector":case"vector2":case"vector3":case"vector4":return ec;case"color":return Zl;case"quaternion":return Ql;case"bool":case"boolean":return Yl;case"string":return tc}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],n=[];Gl.flattenJSON(t.keys,e,n,"value"),t.times=e,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const ic={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};const oc=new class{constructor(t,e,n){const r=this;let i,o=!1,a=0,s=0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){s++,!1===o&&void 0!==r.onStart&&r.onStart(t,a,s),o=!0},this.itemEnd=function(t){a++,void 0!==r.onProgress&&r.onProgress(t,a,s),a===s&&(o=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)},this.resolveURL=function(t){return i?i(t):t},this.setURLModifier=function(t){return i=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=l.length;e<n;e+=2){const n=l[e],r=l[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return r}return null}}};class ac{constructor(t){this.manager=void 0!==t?t:oc,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise((function(r,i){n.load(t,r,e,i)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}const sc={};class lc extends ac{constructor(t){super(t)}load(t,e,n,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const i=ic.get(t);if(void 0!==i)return this.manager.itemStart(t),setTimeout((()=>{e&&e(i),this.manager.itemEnd(t)}),0),i;if(void 0!==sc[t])return void sc[t].push({onLoad:e,onProgress:n,onError:r});sc[t]=[],sc[t].push({onLoad:e,onProgress:n,onError:r});const o=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"});fetch(o).then((e=>{if(200===e.status||0===e.status){0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received.");const n=sc[t],r=e.body.getReader(),i=e.headers.get("Content-Length"),o=i?parseInt(i):0,a=0!==o;let s=0;return new ReadableStream({start(t){!function e(){r.read().then((({done:r,value:i})=>{if(r)t.close();else{s+=i.byteLength;const r=new ProgressEvent("progress",{lengthComputable:a,loaded:s,total:o});for(let t=0,e=n.length;t<e;t++){const e=n[t];e.onProgress&&e.onProgress(r)}t.enqueue(i),e()}}))}()}})}throw Error(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`)})).then((t=>{const e=new Response(t);switch(this.responseType){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((t=>(new DOMParser).parseFromString(t,this.mimeType)));case"json":return e.json();default:return e.text()}})).then((e=>{ic.add(t,e);const n=sc[t];delete sc[t];for(let t=0,r=n.length;t<r;t++){const r=n[t];r.onLoad&&r.onLoad(e)}this.manager.itemEnd(t)})).catch((e=>{const n=sc[t];delete sc[t];for(let t=0,r=n.length;t<r;t++){const r=n[t];r.onError&&r.onError(e)}this.manager.itemError(t),this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class cc extends ac{constructor(t){super(t)}load(t,e,n,r){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const i=this,o=ic.get(t);if(void 0!==o)return i.manager.itemStart(t),setTimeout((function(){e&&e(o),i.manager.itemEnd(t)}),0),o;const a=Le("img");function s(){c(),ic.add(t,this),e&&e(this),i.manager.itemEnd(t)}function l(e){c(),r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)}function c(){a.removeEventListener("load",s,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",s,!1),a.addEventListener("error",l,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),i.manager.itemStart(t),a.src=t,a}}class uc extends ac{constructor(t){super(t)}load(t,e,n,r){const i=new Kr,o=new cc(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function s(n){o.load(t[n],(function(t){i.images[n]=t,a++,6===a&&(i.needsUpdate=!0,e&&e(i))}),void 0,r)}for(let e=0;e<t.length;++e)s(e);return i}}class hc extends ac{constructor(t){super(t)}load(t,e,n,r){const i=new De,o=new cc(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,(function(t){i.image=t,i.needsUpdate=!0,void 0!==e&&e(i)}),n,r),i}}class dc extends Wn{constructor(t,e=1){super(),this.type="Light",this.color=new lr(t),this.intensity=e}dispose(){}copy(t){return super.copy(t),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}dc.prototype.isLight=!0;(class extends dc{constructor(t,e,n){super(t,n),this.type="HemisphereLight",this.position.copy(Wn.DefaultUp),this.updateMatrix(),this.groundColor=new lr(e)}copy(t){return dc.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}).prototype.isHemisphereLight=!0;const pc=new vn,fc=new Be,mc=new Be;class gc{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Te(512,512),this.map=null,this.mapPass=null,this.matrix=new vn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ai,this._frameExtents=new Te(1,1),this._viewportCount=1,this._viewports=[new Ie(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;fc.setFromMatrixPosition(t.matrixWorld),e.position.copy(fc),mc.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(mc),e.updateMatrixWorld(),pc.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(pc),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e.projectionMatrix),n.multiply(e.matrixWorldInverse)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class vc extends gc{constructor(){super(new Yr(50,1,.5,500)),this.focus=1}updateMatrices(t){const e=this.camera,n=2*me*t.angle*this.focus,r=this.mapSize.width/this.mapSize.height,i=t.distance||e.far;n===e.fov&&r===e.aspect&&i===e.far||(e.fov=n,e.aspect=r,e.far=i,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}vc.prototype.isSpotLightShadow=!0;(class extends dc{constructor(t,e,n=0,r=Math.PI/3,i=0,o=1){super(t,e),this.type="SpotLight",this.position.copy(Wn.DefaultUp),this.updateMatrix(),this.target=new Wn,this.distance=n,this.angle=r,this.penumbra=i,this.decay=o,this.shadow=new vc}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}).prototype.isSpotLight=!0;const yc=new vn,xc=new Be,bc=new Be;class wc extends gc{constructor(){super(new Yr(90,1,.5,500)),this._frameExtents=new Te(4,2),this._viewportCount=6,this._viewports=[new Ie(2,1,1,1),new Ie(0,1,1,1),new Ie(3,1,1,1),new Ie(1,1,1,1),new Ie(3,0,1,1),new Ie(1,0,1,1)],this._cubeDirections=[new Be(1,0,0),new Be(-1,0,0),new Be(0,0,1),new Be(0,0,-1),new Be(0,1,0),new Be(0,-1,0)],this._cubeUps=[new Be(0,1,0),new Be(0,1,0),new Be(0,1,0),new Be(0,1,0),new Be(0,0,1),new Be(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,r=this.matrix,i=t.distance||n.far;i!==n.far&&(n.far=i,n.updateProjectionMatrix()),xc.setFromMatrixPosition(t.matrixWorld),n.position.copy(xc),bc.copy(n.position),bc.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(bc),n.updateMatrixWorld(),r.makeTranslation(-xc.x,-xc.y,-xc.z),yc.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(yc)}}wc.prototype.isPointLightShadow=!0;(class extends dc{constructor(t,e,n=0,r=1){super(t,e),this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new wc}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}).prototype.isPointLight=!0;class _c extends gc{constructor(){super(new xi(-5,5,5,-5,.5,500))}}_c.prototype.isDirectionalLightShadow=!0;(class extends dc{constructor(t,e){super(t,e),this.type="DirectionalLight",this.position.copy(Wn.DefaultUp),this.updateMatrix(),this.target=new Wn,this.shadow=new _c}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}).prototype.isDirectionalLight=!0;(class extends dc{constructor(t,e){super(t,e),this.type="AmbientLight"}}).prototype.isAmbientLight=!0;(class extends dc{constructor(t,e,n=10,r=10){super(t,e),this.type="RectAreaLight",this.width=n,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}).prototype.isRectAreaLight=!0;class Mc{constructor(){this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new Be)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,r=t.y,i=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.282095),e.addScaledVector(o[1],.488603*r),e.addScaledVector(o[2],.488603*i),e.addScaledVector(o[3],.488603*n),e.addScaledVector(o[4],n*r*1.092548),e.addScaledVector(o[5],r*i*1.092548),e.addScaledVector(o[6],.315392*(3*i*i-1)),e.addScaledVector(o[7],n*i*1.092548),e.addScaledVector(o[8],.546274*(n*n-r*r)),e}getIrradianceAt(t,e){const n=t.x,r=t.y,i=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.886227),e.addScaledVector(o[1],1.023328*r),e.addScaledVector(o[2],1.023328*i),e.addScaledVector(o[3],1.023328*n),e.addScaledVector(o[4],.858086*n*r),e.addScaledVector(o[5],.858086*r*i),e.addScaledVector(o[6],.743125*i*i-.247708),e.addScaledVector(o[7],.858086*n*i),e.addScaledVector(o[8],.429043*(n*n-r*r)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(t,e+3*r);return this}toArray(t=[],e=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(t,e+3*r);return t}static getBasisAt(t,e){const n=t.x,r=t.y,i=t.z;e[0]=.282095,e[1]=.488603*r,e[2]=.488603*i,e[3]=.488603*n,e[4]=1.092548*n*r,e[5]=1.092548*r*i,e[6]=.315392*(3*i*i-1),e[7]=1.092548*n*i,e[8]=.546274*(n*n-r*r)}}Mc.prototype.isSphericalHarmonics3=!0;class Sc extends dc{constructor(t=new Mc,e=1){super(void 0,e),this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}Sc.prototype.isLightProbe=!0;(class extends Mr{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}clone(){return(new this.constructor).copy(this)}toJSON(){const t=super.toJSON(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}).prototype.isInstancedBufferGeometry=!0;let Tc;(class extends ac{constructor(t){super(t),"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,n,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const i=this,o=ic.get(t);if(void 0!==o)return i.manager.itemStart(t),setTimeout((function(){e&&e(o),i.manager.itemEnd(t)}),0),o;const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,fetch(t,a).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(i.options,{colorSpaceConversion:"none"}))})).then((function(n){ic.add(t,n),e&&e(n),i.manager.itemEnd(t)})).catch((function(e){r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)})),i.manager.itemStart(t)}}).prototype.isImageBitmapLoader=!0;const Ec=function(){return void 0===Tc&&(Tc=new(window.AudioContext||window.webkitAudioContext)),Tc};class Cc extends ac{constructor(t){super(t)}load(t,e,n,r){const i=this,o=new lc(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){try{const t=n.slice(0);Ec().decodeAudioData(t,(function(t){e(t)}))}catch(e){r?r(e):console.error(e),i.manager.itemError(t)}}),n,r)}}(class extends Sc{constructor(t,e,n=1){super(void 0,n);const r=(new lr).set(t),i=(new lr).set(e),o=new Be(r.r,r.g,r.b),a=new Be(i.r,i.g,i.b),s=Math.sqrt(Math.PI),l=s*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(s),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(l)}}).prototype.isHemisphereLightProbe=!0;(class extends Sc{constructor(t,e=1){super(void 0,e);const n=(new lr).set(t);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}).prototype.isAmbientLightProbe=!0;class Lc{constructor(t,e,n){let r,i,o;switch(this.binding=t,this.valueSize=n,e){case"quaternion":r=this._slerp,i=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":r=this._select,i=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:r=this._lerp,i=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const n=this.buffer,r=this.valueSize,i=t*r+r;let o=this.cumulativeWeight;if(0===o){for(let t=0;t!==r;++t)n[i+t]=n[t];o=e}else{o+=e;const t=e/o;this._mixBufferRegion(n,i,0,t,r)}this.cumulativeWeight=o}accumulateAdditive(t){const e=this.buffer,n=this.valueSize,r=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,r,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,n=this.buffer,r=t*e+e,i=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){const t=e*this._origIndex;this._mixBufferRegion(n,r,t,1-i,e)}o>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*e,1,e);for(let t=e,i=e+e;t!==i;++t)if(n[t]!==n[t+e]){a.setValue(n,r);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,r=n*this._origIndex;t.getValue(e,r);for(let t=n,i=r;t!==i;++t)e[t]=e[r+t%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,r,i){if(r>=.5)for(let r=0;r!==i;++r)t[e+r]=t[n+r]}_slerp(t,e,n,r){Fe.slerpFlat(t,e,t,e,t,n,r)}_slerpAdditive(t,e,n,r,i){const o=this._workIndex*i;Fe.multiplyQuaternionsFlat(t,o,t,e,t,n),Fe.slerpFlat(t,e,t,e,t,o,r)}_lerp(t,e,n,r,i){const o=1-r;for(let a=0;a!==i;++a){const i=e+a;t[i]=t[i]*o+t[n+a]*r}}_lerpAdditive(t,e,n,r,i){for(let o=0;o!==i;++o){const i=e+o;t[i]=t[i]+t[n+o]*r}}}const Ac="\\[\\]\\.:\\/",Rc=new RegExp("[\\[\\]\\.:\\/]","g"),Pc="[^\\[\\]\\.:\\/]",Nc="[^"+Ac.replace("\\.","")+"]",Dc=/((?:WC+[\/:])*)/.source.replace("WC",Pc),kc=/(WCOD+)?/.source.replace("WCOD",Nc),Ic=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Pc),Oc=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Pc),zc=new RegExp("^"+Dc+kc+Ic+Oc+"$"),Fc=["material","materials","bones"];class Bc{constructor(t,e,n){this.path=e,this.parsedPath=n||Bc.parseTrackName(e),this.node=Bc.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new Bc.Composite(t,e,n):new Bc(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Rc,"")}static parseTrackName(t){const e=zc.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){const t=n.nodeName.substring(r+1);-1!==Fc.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let r=0;r<t.length;r++){const i=t[r];if(i.name===e||i.uuid===e)return i;const o=n(i.children);if(o)return o}return null},r=n(t.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)t[e++]=n[r]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,n=e.objectName,r=e.propertyName;let i=e.propertyIndex;if(t||(t=Bc.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(n){let r=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===r){r=e;break}break;default:if(void 0===t[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[n]}if(void 0!==r){if(void 0===t[r])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[r]}}const o=t[r];if(void 0===o){const n=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+r+" but it wasn't found.",t)}let a=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?a=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(a=this.Versioning.MatrixWorldNeedsUpdate);let s=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===r){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[i]&&(i=t.morphTargetDictionary[i])}s=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=i}else void 0!==o.fromArray&&void 0!==o.toArray?(s=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(s=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[s],this.setValue=this.SetterByBindingTypeAndVersioning[s][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Bc.Composite=class{constructor(t,e,n){const r=n||Bc.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(t,e)}setValue(t,e){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},Bc.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Bc.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Bc.prototype.GetterByBindingType=[Bc.prototype._getValue_direct,Bc.prototype._getValue_array,Bc.prototype._getValue_arrayElement,Bc.prototype._getValue_toArray],Bc.prototype.SetterByBindingTypeAndVersioning=[[Bc.prototype._setValue_direct,Bc.prototype._setValue_direct_setNeedsUpdate,Bc.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Bc.prototype._setValue_array,Bc.prototype._setValue_array_setNeedsUpdate,Bc.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Bc.prototype._setValue_arrayElement,Bc.prototype._setValue_arrayElement_setNeedsUpdate,Bc.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Bc.prototype._setValue_fromArray,Bc.prototype._setValue_fromArray_setNeedsUpdate,Bc.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Uc{constructor(t,e,n=null,r=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=r;const i=e.tracks,o=i.length,a=new Array(o),s={endingStart:te,endingEnd:te};for(let t=0;t!==o;++t){const e=i[t].createInterpolant(null);a[t]=e,e.settings=s}this._interpolantSettings=s,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const n=this._clip.duration,r=t._clip.duration,i=r/n,o=n/r;t.warp(1,i,e),this.warp(o,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const r=this._mixer,i=r.time,o=this.timeScale;let a=this._timeScaleInterpolant;null===a&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);const s=a.parameterPositions,l=a.sampleValues;return s[0]=i,s[1]=i+n,l[0]=t/o,l[1]=e/o,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,r){if(!this.enabled)return void this._updateWeight(t);const i=this._startTime;if(null!==i){const r=(t-i)*n;if(r<0||0===n)return;this._startTime=null,e=n*r}e*=this._updateTimeScale(t);const o=this._updateTime(e),a=this._updateWeight(t);if(a>0){const t=this._interpolants,e=this._propertyBindings;if(2501===this.blendMode)for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(o),e[n].accumulateAdditive(a);else for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(o),e[n].accumulate(r,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let r=this.time+t,i=this._loopCount;const o=2202===n;if(0===t)return-1===i?r:o&&1==(1&i)?e-r:r;if(2200===n){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(r>=e)r=e;else{if(!(r<0)){this.time=r;break t}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===i&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),r>=e||r<0){const n=Math.floor(r/e);r-=e*n,i+=Math.abs(n);const a=this.repetitions-i;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=t>0?e:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){const e=t<0;this._setEndings(e,!e,o)}else this._setEndings(!1,!1,o);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=r;if(o&&1==(1&i))return e-r}return r}_setEndings(t,e,n){const r=this._interpolantSettings;n?(r.endingStart=ee,r.endingEnd=ee):(r.endingStart=t?this.zeroSlopeAtStart?ee:te:ne,r.endingEnd=e?this.zeroSlopeAtEnd?ee:te:ne)}_scheduleFading(t,e,n){const r=this._mixer,i=r.time;let o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,s=o.sampleValues;return a[0]=i,s[0]=e,a[1]=i+t,s[1]=n,this}}(class extends de{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,o=t._propertyBindings,a=t._interpolants,s=n.uuid,l=this._bindingsByRootAndName;let c=l[s];void 0===c&&(c={},l[s]=c);for(let t=0;t!==i;++t){const i=r[t],l=i.name;let u=c[l];if(void 0!==u)o[t]=u;else{if(u=o[t],void 0!==u){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,s,l));continue}const r=e&&e._propertyBindings[t].binding.parsedPath;u=new Lc(Bc.create(n,l,r),i.ValueTypeName,i.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,s,l),o[t]=u}a[t].resultBuffer=u.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,r=this._actionsByClip[n];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,n){const r=this._actions,i=this._actionsByClip;let o=i[e];if(void 0===o)o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,i[e]=o;else{const e=o.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=r.length,r.push(t),o.actionByRoot[n]=t}_removeInactiveAction(t){const e=this._actions,n=e[e.length-1],r=t._cacheIndex;n._cacheIndex=r,e[r]=n,e.pop(),t._cacheIndex=null;const i=t._clip.uuid,o=this._actionsByClip,a=o[i],s=a.knownActions,l=s[s.length-1],c=t._byClipCacheIndex;l._byClipCacheIndex=c,s[c]=l,s.pop(),t._byClipCacheIndex=null;delete a.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete o[i],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(t){const e=this._actions,n=t._cacheIndex,r=this._nActiveActions++,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i}_takeBackAction(t){const e=this._actions,n=t._cacheIndex,r=--this._nActiveActions,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i}_addInactiveBinding(t,e,n){const r=this._bindingsByRootAndName,i=this._bindings;let o=r[e];void 0===o&&(o={},r[e]=o),o[n]=t,t._cacheIndex=i.length,i.push(t)}_removeInactiveBinding(t){const e=this._bindings,n=t.binding,r=n.rootNode.uuid,i=n.path,o=this._bindingsByRootAndName,a=o[r],s=e[e.length-1],l=t._cacheIndex;s._cacheIndex=l,e[l]=s,e.pop(),delete a[i],0===Object.keys(a).length&&delete o[r]}_lendBinding(t){const e=this._bindings,n=t._cacheIndex,r=this._nActiveBindings++,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i}_takeBackBinding(t){const e=this._bindings,n=t._cacheIndex,r=--this._nActiveBindings,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return void 0===n&&(n=new $l(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){const e=this._controlInterpolants,n=t.__cacheIndex,r=--this._nActiveControlInterpolants,i=e[r];t.__cacheIndex=r,e[r]=t,i.__cacheIndex=n,e[n]=i}clipAction(t,e,n){const r=e||this._root,i=r.uuid;let o="string"==typeof t?nc.findByName(r,t):t;const a=null!==o?o.uuid:t,s=this._actionsByClip[a];let l=null;if(void 0===n&&(n=null!==o?o.blendMode:re),void 0!==s){const t=s.actionByRoot[i];if(void 0!==t&&t.blendMode===n)return t;l=s.knownActions[0],null===o&&(o=l._clip)}if(null===o)return null;const c=new Uc(this,o,e,n);return this._bindAction(c,l),this._addInactiveAction(c,a,i),c}existingAction(t,e){const n=e||this._root,r=n.uuid,i="string"==typeof t?nc.findByName(n,t):t,o=i?i.uuid:t,a=this._actionsByClip[o];return void 0!==a&&a.actionByRoot[r]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,r=this.time+=t,i=Math.sign(t),o=this._accuIndex^=1;for(let a=0;a!==n;++a){e[a]._update(r,t,i,o)}const a=this._bindings,s=this._nActiveBindings;for(let t=0;t!==s;++t)a[t].apply(o);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,n=t.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){const t=i.knownActions;for(let n=0,r=t.length;n!==r;++n){const r=t[n];this._deactivateAction(r);const i=r._cacheIndex,o=e[e.length-1];r._cacheIndex=null,r._byClipCacheIndex=null,o._cacheIndex=i,e[i]=o,e.pop(),this._removeInactiveBindingsForAction(r)}delete r[n]}}uncacheRoot(t){const e=t.uuid,n=this._actionsByClip;for(const t in n){const r=n[t].actionByRoot[e];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}const r=this._bindingsByRootAndName[e];if(void 0!==r)for(const t in r){const e=r[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}).prototype._controlInterpolantsResultBuffer=new Float32Array(1);(class extends Ja{constructor(t,e,n=1){super(t,e),this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}).prototype.isInstancedInterleavedBuffer=!0;const Hc=new Be,Wc=new vn,Gc=new vn;function Vc(t){const e=[];t&&t.isBone&&e.push(t);for(let n=0;n<t.children.length;n++)e.push.apply(e,Vc(t.children[n]));return e}const jc=new Float32Array(1);function $c(e){let n;return{c(){n=f("canvas"),x(n,"id","bg"),x(n,"class","fade-in-long svelte-1r3q75o")},m(t,e){h(t,n,e)},p:t,i:t,o:t,d(t){t&&d(n)}}}new Int32Array(jc.buffer),Ws.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Ws.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},ll.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},class extends Is{constructor(t=10,e=10,n=4473924,r=8947848){n=new lr(n),r=new lr(r);const i=e/2,o=t/e,a=t/2,s=[],l=[];for(let t=0,c=0,u=-a;t<=e;t++,u+=o){s.push(-a,0,u,a,0,u),s.push(u,0,-a,u,0,a);const e=t===i?n:r;e.toArray(l,c),c+=3,e.toArray(l,c),c+=3,e.toArray(l,c),c+=3,e.toArray(l,c),c+=3}const c=new Mr;c.setAttribute("position",new mr(s,3)),c.setAttribute("color",new mr(l,3));super(c,new Es({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},class extends Is{constructor(t){const e=Vc(t),n=new Mr,r=[],i=[],o=new lr(0,0,1),a=new lr(0,1,0);for(let t=0;t<e.length;t++){const n=e[t];n.parent&&n.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(o.r,o.g,o.b),i.push(a.r,a.g,a.b))}n.setAttribute("position",new mr(r,3)),n.setAttribute("color",new mr(i,3));super(n,new Es({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,n=this.geometry,r=n.getAttribute("position");Gc.copy(this.root.matrixWorld).invert();for(let t=0,n=0;t<e.length;t++){const i=e[t];i.parent&&i.parent.isBone&&(Wc.multiplyMatrices(Gc,i.matrixWorld),Hc.setFromMatrixPosition(Wc),r.setXYZ(n,Hc.x,Hc.y,Hc.z),Wc.multiplyMatrices(Gc,i.parent.matrixWorld),Hc.setFromMatrixPosition(Wc),r.setXYZ(n+1,Hc.x,Hc.y,Hc.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}}.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},ac.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),class{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let n=0,r=t.length;n<r;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch(t){return e}}static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}.extractUrlBase(t)},ac.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},We.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},We.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},We.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},We.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},We.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},ln.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},ai.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},Ee.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},Ee.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},Ee.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},Ee.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},Ee.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},Ee.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},vn.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},vn.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},vn.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new Be).setFromMatrixColumn(this,3)},vn.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},vn.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},vn.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},vn.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},vn.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},vn.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},vn.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},vn.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},vn.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},vn.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},vn.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},vn.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},vn.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},vn.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},vn.prototype.makeFrustum=function(t,e,n,r,i,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,r,n,i,o)},vn.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},ri.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},Fe.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Fe.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},gn.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},gn.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},gn.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Qn.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},Qn.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},Qn.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},Qn.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},Qn.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},Qn.barycoordFromPoint=function(t,e,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Qn.getBarycoord(t,e,n,r,i)},Qn.normal=function(t,e,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Qn.getNormal(t,e,n,r)},cl.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},cl.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Fl(this,t)},cl.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Ul(this,t)},Te.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Te.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},Te.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Be.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},Be.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},Be.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},Be.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},Be.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},Be.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},Be.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Be.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},Be.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Ie.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Ie.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Wn.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},Wn.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Wn.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},Wn.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Wn.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Wn.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Hr.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(Hr.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),bs.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Yr.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(dc.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(dr.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===ue},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(ue)}}}),dr.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?ue:ce),this},dr.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},dr.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Mr.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},Mr.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new dr(arguments[1],arguments[2])))},Mr.prototype.addDrawCall=function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},Mr.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},Mr.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},Mr.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},Mr.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Mr.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Ja.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?ue:ce),this},Ja.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Fl.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Fl.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Fl.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},Za.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Object.defineProperties(er.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new lr}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}}),Object.defineProperties(qr.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Ya.prototype.clearTarget=function(t,e,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,r)},Ya.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},Ya.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},Ya.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},Ya.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},Ya.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},Ya.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},Ya.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},Ya.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},Ya.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},Ya.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},Ya.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},Ya.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},Ya.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},Ya.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},Ya.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},Ya.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},Ya.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},Ya.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},Ya.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},Ya.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},Ya.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},Ya.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},Ya.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},Ya.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(Ya.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?oe:ie}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(Ba.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(Oe.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),class extends Wn{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){if(this.detune=t,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new Cc).load(t,(function(t){e.setBuffer(t)})),this},Jr.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},Jr.prototype.clear=function(t,e,n,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,r)},Pe.crossOrigin=void 0,Pe.loadTexture=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const i=new hc;i.setCrossOrigin(this.crossOrigin);const o=i.load(t,n,void 0,r);return e&&(o.mapping=e),o},Pe.loadTextureCube=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const i=new uc;i.setCrossOrigin(this.crossOrigin);const o=i.load(t,n,void 0,r);return e&&(o.mapping=e),o},Pe.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Pe.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"134"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="134");function qc(t,e,n,r,i,o){var a=t-r,s=e-i,l=n-o;return Math.sqrt(a*a+s*s+l*l)}function Xc(t){function e(t,e,n,r){const i=new Hl(r,12,12),o=new cr({color:15658734,opacity:.3,transparent:!0}),a=new Hr(i,o);return a.position.set(t,e,n),a}function n(t,e,n,r,i,o){const a=(new Mr).setFromPoints([new Be(t,e,n),new Be(r,i,o)]),s=new Es({color:15658734,opacity:.3,transparent:!0});return new Ns(a,s)}let r=[];for(let t=0;t<300;t++){const[t,n,i]=Array(3).fill().map((()=>Se.randFloatSpread(70))),o=e(t,n,i,.1+.05*Math.random());r.push(o)}let i=[];for(let t=0;t<r.length;t++){let e=[];for(let n=t+1;n<r.length;n++){const[i,o,a]=r[t].position,[s,l,c]=r[n].position,u=qc(i,o,a,s,l,c);e.push([n,u])}e.sort(((t,e)=>t[1]-e[1]));for(let o=0;o<3;o++){if(o>=e.length)continue;const[a,s]=e[o],[l,c,u]=r[t].position,[h,d,p]=r[a].position;if(Math.random()>.5)continue;const f=n(l,c,u,h,d,p);i.push(f)}}return T((()=>{const t=document.querySelector("#bg"),e=new Za,n=new Yr(50,window.innerWidth/window.innerHeight,.1,1e3),o=new Ya({alpha:!0,canvas:t});function a(){const t=document.querySelector("main").scrollTop;n.position.z=.002*t}o.setPixelRatio(window.devicePixelRatio),o.setSize(window.innerWidth,window.innerHeight),n.position.x=0,n.position.y=0,n.position.z=0,r.forEach((t=>e.add(t))),i.forEach((t=>e.add(t))),o.render(e,n),function t(){requestAnimationFrame(t),n.rotation.z+=5e-4,o.render(e,n)}(),setTimeout((()=>{document.querySelector("main").addEventListener("scroll",a)}),200)})),[]}class Yc extends Z{constructor(t){super(),Y(this,t,Xc,$c,o,{})}}function Zc(e){let n,r,i,o,a;return{c(){n=f("div"),r=f("img"),o=g(),a=f("p"),a.textContent="by Cara Zwibel & Evan Balgord",x(r,"alt","hate speech"),l(r.src,i=pt+"assets/images/hate_speech.jpg")||x(r,"src","/projects/seshat/assets/images/hate_speech.jpg"),x(r,"class","svelte-1ltr8nk"),x(a,"class","svelte-1ltr8nk"),x(n,"id","top-img-container"),_(n,"top",-e[0]+"px"),x(n,"class","svelte-1ltr8nk")},m(t,e){h(t,n,e),u(n,r),u(n,o),u(n,a)},p(t,[e]){1&e&&_(n,"top",-t[0]+"px")},i:t,o:t,d(t){t&&d(n)}}}function Jc(t,e,n){let{lang:r}=e,{scrollTop:i=0}=e;return t.$$set=t=>{"lang"in t&&n(1,r=t.lang),"scrollTop"in t&&n(0,i=t.scrollTop)},[i,r]}class Kc extends Z{constructor(t){super(),Y(this,t,Jc,Zc,o,{lang:1,scrollTop:0})}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function Qc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var tu={exports:{}};tu.exports=function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=8)}([function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r="swal-button";e.CLASS_NAMES={MODAL:"swal-modal",OVERLAY:"swal-overlay",SHOW_MODAL:"swal-overlay--show-modal",MODAL_TITLE:"swal-title",MODAL_TEXT:"swal-text",ICON:"swal-icon",ICON_CUSTOM:"swal-icon--custom",CONTENT:"swal-content",FOOTER:"swal-footer",BUTTON_CONTAINER:"swal-button-container",BUTTON:r,CONFIRM_BUTTON:r+"--confirm",CANCEL_BUTTON:r+"--cancel",DANGER_BUTTON:r+"--danger",BUTTON_LOADING:r+"--loading",BUTTON_LOADER:r+"__loader"},e.default=e.CLASS_NAMES},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.getNode=function(t){var e="."+t;return document.querySelector(e)},e.stringToNode=function(t){var e=document.createElement("div");return e.innerHTML=t.trim(),e.firstChild},e.insertAfter=function(t,e){var n=e.nextSibling;e.parentNode.insertBefore(t,n)},e.removeNode=function(t){t.parentElement.removeChild(t)},e.throwErr=function(t){throw"SweetAlert: "+(t=t.replace(/ +(?= )/g,"")).trim()},e.isPlainObject=function(t){if("[object Object]"!==Object.prototype.toString.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype},e.ordinalSuffixOf=function(t){var e=t%10,n=t%100;return 1===e&&11!==n?t+"st":2===e&&12!==n?t+"nd":3===e&&13!==n?t+"rd":t+"th"}},function(t,e,n){function r(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),r(n(25));var i=n(26);e.overlayMarkup=i.default,r(n(27)),r(n(28)),r(n(29));var o=n(0),a=o.default.MODAL_TITLE,s=o.default.MODAL_TEXT,l=o.default.ICON,c=o.default.FOOTER;e.iconMarkup='\n <div class="'+l+'"></div>',e.titleMarkup='\n <div class="'+a+'"></div>\n',e.textMarkup='\n <div class="'+s+'"></div>',e.footerMarkup='\n <div class="'+c+'"></div>\n'},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(1);e.CONFIRM_KEY="confirm",e.CANCEL_KEY="cancel";var i={visible:!0,text:null,value:null,className:"",closeModal:!0},o=Object.assign({},i,{visible:!1,text:"Cancel",value:null}),a=Object.assign({},i,{text:"OK",value:!0});e.defaultButtonList={cancel:o,confirm:a};var s=function(t){switch(t){case e.CONFIRM_KEY:return a;case e.CANCEL_KEY:return o;default:var n=t.charAt(0).toUpperCase()+t.slice(1);return Object.assign({},i,{text:n,value:t})}},l=function(t,e){var n=s(t);return!0===e?Object.assign({},n,{visible:!0}):"string"==typeof e?Object.assign({},n,{visible:!0,text:e}):r.isPlainObject(e)?Object.assign({visible:!0},n,e):Object.assign({},n,{visible:!1})},c=function(t){for(var e={},n=0,r=Object.keys(t);n<r.length;n++){var i=r[n],a=t[i],s=l(i,a);e[i]=s}return e.cancel||(e.cancel=o),e},u=function(t){var n={};switch(t.length){case 1:n[e.CANCEL_KEY]=Object.assign({},o,{visible:!1});break;case 2:n[e.CANCEL_KEY]=l(e.CANCEL_KEY,t[0]),n[e.CONFIRM_KEY]=l(e.CONFIRM_KEY,t[1]);break;default:r.throwErr("Invalid number of 'buttons' in array ("+t.length+").\n If you want more than 2 buttons, you need to use an object!")}return n};e.getButtonListOpts=function(t){var n=e.defaultButtonList;return"string"==typeof t?n[e.CONFIRM_KEY]=l(e.CONFIRM_KEY,t):Array.isArray(t)?n=u(t):r.isPlainObject(t)?n=c(t):!0===t?n=u([!0,!0]):!1===t?n=u([!1,!1]):void 0===t&&(n=e.defaultButtonList),n}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),i=n(2),o=n(0),a=o.default.MODAL,s=o.default.OVERLAY,l=n(30),c=n(31),u=n(32),h=n(33);e.injectElIntoModal=function(t){var e=r.getNode(a),n=r.stringToNode(t);return e.appendChild(n),n};var d=function(t){t.className=a,t.textContent=""},p=function(t,e){d(t);var n=e.className;n&&t.classList.add(n)};e.initModalContent=function(t){var e=r.getNode(a);p(e,t),l.default(t.icon),c.initTitle(t.title),c.initText(t.text),h.default(t.content),u.default(t.buttons,t.dangerMode)};var f=function(){var t=r.getNode(s),e=r.stringToNode(i.modalMarkup);t.appendChild(e)};e.default=f},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i={isOpen:!1,promise:null,actions:{},timer:null},o=Object.assign({},i);e.resetState=function(){o=Object.assign({},i)},e.setActionValue=function(t){if("string"==typeof t)return a(r.CONFIRM_KEY,t);for(var e in t)a(e,t[e])};var a=function(t,e){o.actions[t]||(o.actions[t]={}),Object.assign(o.actions[t],{value:e})};e.setActionOptionsFor=function(t,e){var n=(void 0===e?{}:e).closeModal,r=void 0===n||n;Object.assign(o.actions[t],{closeModal:r})},e.default=o},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),i=n(3),o=n(0),a=o.default.OVERLAY,s=o.default.SHOW_MODAL,l=o.default.BUTTON,c=o.default.BUTTON_LOADING,u=n(5);e.openModal=function(){r.getNode(a).classList.add(s),u.default.isOpen=!0};var h=function(){r.getNode(a).classList.remove(s),u.default.isOpen=!1};e.onAction=function(t){void 0===t&&(t=i.CANCEL_KEY);var e=u.default.actions[t],n=e.value;if(!1===e.closeModal){var o=l+"--"+t;r.getNode(o).classList.add(c)}else h();u.default.promise.resolve(n)},e.getState=function(){var t=Object.assign({},u.default);return delete t.promise,delete t.timer,t},e.stopLoading=function(){for(var t=document.querySelectorAll("."+l),e=0;e<t.length;e++)t[e].classList.remove(c)}},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){(function(e){t.exports=e.sweetAlert=n(9)}).call(e,n(7))},function(t,e,n){(function(e){t.exports=e.swal=n(10)}).call(e,n(7))},function(t,e,n){"undefined"!=typeof window&&n(11),n(16);var r=n(23).default;t.exports=r},function(t,e,n){var r=n(12);"string"==typeof r&&(r=[[t.i,r,""]]);var i={insertAt:"top",transform:void 0};n(14)(r,i),r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(13)(void 0)).push([t.i,'.swal-icon--error{border-color:#f27474;-webkit-animation:animateErrorIcon .5s;animation:animateErrorIcon .5s}.swal-icon--error__x-mark{position:relative;display:block;-webkit-animation:animateXMark .5s;animation:animateXMark .5s}.swal-icon--error__line{position:absolute;height:5px;width:47px;background-color:#f27474;display:block;top:37px;border-radius:2px}.swal-icon--error__line--left{-webkit-transform:rotate(45deg);transform:rotate(45deg);left:17px}.swal-icon--error__line--right{-webkit-transform:rotate(-45deg);transform:rotate(-45deg);right:16px}@-webkit-keyframes animateErrorIcon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}to{-webkit-transform:rotateX(0deg);transform:rotateX(0deg);opacity:1}}@keyframes animateErrorIcon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}to{-webkit-transform:rotateX(0deg);transform:rotateX(0deg);opacity:1}}@-webkit-keyframes animateXMark{0%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}50%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}80%{-webkit-transform:scale(1.15);transform:scale(1.15);margin-top:-6px}to{-webkit-transform:scale(1);transform:scale(1);margin-top:0;opacity:1}}@keyframes animateXMark{0%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}50%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}80%{-webkit-transform:scale(1.15);transform:scale(1.15);margin-top:-6px}to{-webkit-transform:scale(1);transform:scale(1);margin-top:0;opacity:1}}.swal-icon--warning{border-color:#f8bb86;-webkit-animation:pulseWarning .75s infinite alternate;animation:pulseWarning .75s infinite alternate}.swal-icon--warning__body{width:5px;height:47px;top:10px;border-radius:2px;margin-left:-2px}.swal-icon--warning__body,.swal-icon--warning__dot{position:absolute;left:50%;background-color:#f8bb86}.swal-icon--warning__dot{width:7px;height:7px;border-radius:50%;margin-left:-4px;bottom:-11px}@-webkit-keyframes pulseWarning{0%{border-color:#f8d486}to{border-color:#f8bb86}}@keyframes pulseWarning{0%{border-color:#f8d486}to{border-color:#f8bb86}}.swal-icon--success{border-color:#a5dc86}.swal-icon--success:after,.swal-icon--success:before{content:"";border-radius:50%;position:absolute;width:60px;height:120px;background:#fff;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.swal-icon--success:before{border-radius:120px 0 0 120px;top:-7px;left:-33px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:60px 60px;transform-origin:60px 60px}.swal-icon--success:after{border-radius:0 120px 120px 0;top:-11px;left:30px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:0 60px;transform-origin:0 60px;-webkit-animation:rotatePlaceholder 4.25s ease-in;animation:rotatePlaceholder 4.25s ease-in}.swal-icon--success__ring{width:80px;height:80px;border:4px solid hsla(98,55%,69%,.2);border-radius:50%;box-sizing:content-box;position:absolute;left:-4px;top:-4px;z-index:2}.swal-icon--success__hide-corners{width:5px;height:90px;background-color:#fff;padding:1px;position:absolute;left:28px;top:8px;z-index:1;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.swal-icon--success__line{height:5px;background-color:#a5dc86;display:block;border-radius:2px;position:absolute;z-index:2}.swal-icon--success__line--tip{width:25px;left:14px;top:46px;-webkit-transform:rotate(45deg);transform:rotate(45deg);-webkit-animation:animateSuccessTip .75s;animation:animateSuccessTip .75s}.swal-icon--success__line--long{width:47px;right:8px;top:38px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-animation:animateSuccessLong .75s;animation:animateSuccessLong .75s}@-webkit-keyframes rotatePlaceholder{0%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}to{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}@keyframes rotatePlaceholder{0%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}to{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}@-webkit-keyframes animateSuccessTip{0%{width:0;left:1px;top:19px}54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}to{width:25px;left:14px;top:45px}}@keyframes animateSuccessTip{0%{width:0;left:1px;top:19px}54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}to{width:25px;left:14px;top:45px}}@-webkit-keyframes animateSuccessLong{0%{width:0;right:46px;top:54px}65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}to{width:47px;right:8px;top:38px}}@keyframes animateSuccessLong{0%{width:0;right:46px;top:54px}65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}to{width:47px;right:8px;top:38px}}.swal-icon--info{border-color:#c9dae1}.swal-icon--info:before{width:5px;height:29px;bottom:17px;border-radius:2px;margin-left:-2px}.swal-icon--info:after,.swal-icon--info:before{content:"";position:absolute;left:50%;background-color:#c9dae1}.swal-icon--info:after{width:7px;height:7px;border-radius:50%;margin-left:-3px;top:19px}.swal-icon{width:80px;height:80px;border-width:4px;border-style:solid;border-radius:50%;padding:0;position:relative;box-sizing:content-box;margin:20px auto}.swal-icon:first-child{margin-top:32px}.swal-icon--custom{width:auto;height:auto;max-width:100%;border:none;border-radius:0}.swal-icon img{max-width:100%;max-height:100%}.swal-title{color:rgba(0,0,0,.65);font-weight:600;text-transform:none;position:relative;display:block;padding:13px 16px;font-size:27px;line-height:normal;text-align:center;margin-bottom:0}.swal-title:first-child{margin-top:26px}.swal-title:not(:first-child){padding-bottom:0}.swal-title:not(:last-child){margin-bottom:13px}.swal-text{font-size:16px;position:relative;float:none;line-height:normal;vertical-align:top;text-align:left;display:inline-block;margin:0;padding:0 10px;font-weight:400;color:rgba(0,0,0,.64);max-width:calc(100% - 20px);overflow-wrap:break-word;box-sizing:border-box}.swal-text:first-child{margin-top:45px}.swal-text:last-child{margin-bottom:45px}.swal-footer{text-align:right;padding-top:13px;margin-top:13px;padding:13px 16px;border-radius:inherit;border-top-left-radius:0;border-top-right-radius:0}.swal-button-container{margin:5px;display:inline-block;position:relative}.swal-button{background-color:#7cd1f9;color:#fff;border:none;box-shadow:none;border-radius:5px;font-weight:600;font-size:14px;padding:10px 24px;margin:0;cursor:pointer}.swal-button:not([disabled]):hover{background-color:#78cbf2}.swal-button:active{background-color:#70bce0}.swal-button:focus{outline:none;box-shadow:0 0 0 1px #fff,0 0 0 3px rgba(43,114,165,.29)}.swal-button[disabled]{opacity:.5;cursor:default}.swal-button::-moz-focus-inner{border:0}.swal-button--cancel{color:#555;background-color:#efefef}.swal-button--cancel:not([disabled]):hover{background-color:#e8e8e8}.swal-button--cancel:active{background-color:#d7d7d7}.swal-button--cancel:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px rgba(116,136,150,.29)}.swal-button--danger{background-color:#e64942}.swal-button--danger:not([disabled]):hover{background-color:#df4740}.swal-button--danger:active{background-color:#cf423b}.swal-button--danger:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px rgba(165,43,43,.29)}.swal-content{padding:0 20px;margin-top:20px;font-size:medium}.swal-content:last-child{margin-bottom:20px}.swal-content__input,.swal-content__textarea{-webkit-appearance:none;background-color:#fff;border:none;font-size:14px;display:block;box-sizing:border-box;width:100%;border:1px solid rgba(0,0,0,.14);padding:10px 13px;border-radius:2px;transition:border-color .2s}.swal-content__input:focus,.swal-content__textarea:focus{outline:none;border-color:#6db8ff}.swal-content__textarea{resize:vertical}.swal-button--loading{color:transparent}.swal-button--loading~.swal-button__loader{opacity:1}.swal-button__loader{position:absolute;height:auto;width:43px;z-index:2;left:50%;top:50%;-webkit-transform:translateX(-50%) translateY(-50%);transform:translateX(-50%) translateY(-50%);text-align:center;pointer-events:none;opacity:0}.swal-button__loader div{display:inline-block;float:none;vertical-align:baseline;width:9px;height:9px;padding:0;border:none;margin:2px;opacity:.4;border-radius:7px;background-color:hsla(0,0%,100%,.9);transition:background .2s;-webkit-animation:swal-loading-anim 1s infinite;animation:swal-loading-anim 1s infinite}.swal-button__loader div:nth-child(3n+2){-webkit-animation-delay:.15s;animation-delay:.15s}.swal-button__loader div:nth-child(3n+3){-webkit-animation-delay:.3s;animation-delay:.3s}@-webkit-keyframes swal-loading-anim{0%{opacity:.4}20%{opacity:.4}50%{opacity:1}to{opacity:.4}}@keyframes swal-loading-anim{0%{opacity:.4}20%{opacity:.4}50%{opacity:1}to{opacity:.4}}.swal-overlay{position:fixed;top:0;bottom:0;left:0;right:0;text-align:center;font-size:0;overflow-y:auto;background-color:rgba(0,0,0,.4);z-index:10000;pointer-events:none;opacity:0;transition:opacity .3s}.swal-overlay:before{content:" ";display:inline-block;vertical-align:middle;height:100%}.swal-overlay--show-modal{opacity:1;pointer-events:auto}.swal-overlay--show-modal .swal-modal{opacity:1;pointer-events:auto;box-sizing:border-box;-webkit-animation:showSweetAlert .3s;animation:showSweetAlert .3s;will-change:transform}.swal-modal{width:478px;opacity:0;pointer-events:none;background-color:#fff;text-align:center;border-radius:5px;position:static;margin:20px auto;display:inline-block;vertical-align:middle;-webkit-transform:scale(1);transform:scale(1);-webkit-transform-origin:50% 50%;transform-origin:50% 50%;z-index:10001;transition:opacity .2s,-webkit-transform .3s;transition:transform .3s,opacity .2s;transition:transform .3s,opacity .2s,-webkit-transform .3s}@media (max-width:500px){.swal-modal{width:calc(100% - 20px)}}@-webkit-keyframes showSweetAlert{0%{-webkit-transform:scale(1);transform:scale(1)}1%{-webkit-transform:scale(.5);transform:scale(.5)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}to{-webkit-transform:scale(1);transform:scale(1)}}@keyframes showSweetAlert{0%{-webkit-transform:scale(1);transform:scale(1)}1%{-webkit-transform:scale(.5);transform:scale(.5)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}to{-webkit-transform:scale(1);transform:scale(1)}}',""])},function(t,e){function n(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"function"==typeof btoa){var o=r(i);return[n].concat(i.sources.map((function(t){return"/*# sourceURL="+i.sourceRoot+t+" */"}))).concat([o]).join("\n")}return[n].join("\n")}function r(t){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t))))+" */"}t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var r=n(e,t);return e[2]?"@media "+e[2]+"{"+r+"}":r})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},i=0;i<this.length;i++){var o=this[i][0];"number"==typeof o&&(r[o]=!0)}for(i=0;i<t.length;i++){var a=t[i];"number"==typeof a[0]&&r[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,n){function r(t,e){for(var n=0;n<t.length;n++){var r=t[n],i=f[r.id];if(i){i.refs++;for(var o=0;o<i.parts.length;o++)i.parts[o](r.parts[o]);for(;o<r.parts.length;o++)i.parts.push(u(r.parts[o],e))}else{var a=[];for(o=0;o<r.parts.length;o++)a.push(u(r.parts[o],e));f[r.id]={id:r.id,refs:1,parts:a}}}}function i(t,e){for(var n=[],r={},i=0;i<t.length;i++){var o=t[i],a=e.base?o[0]+e.base:o[0],s={css:o[1],media:o[2],sourceMap:o[3]};r[a]?r[a].parts.push(s):n.push(r[a]={id:a,parts:[s]})}return n}function o(t,e){var n=g(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var r=x[x.length-1];if("top"===t.insertAt)r?r.nextSibling?n.insertBefore(e,r.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),x.push(e);else{if("bottom"!==t.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");n.appendChild(e)}}function a(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=x.indexOf(t);e>=0&&x.splice(e,1)}function s(t){var e=document.createElement("style");return t.attrs.type="text/css",c(e,t.attrs),o(t,e),e}function l(t){var e=document.createElement("link");return t.attrs.type="text/css",t.attrs.rel="stylesheet",c(e,t.attrs),o(t,e),e}function c(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function u(t,e){var n,r,i,o;if(e.transform&&t.css){if(!(o=e.transform(t.css)))return function(){};t.css=o}if(e.singleton){var c=y++;n=v||(v=s(e)),r=h.bind(null,n,c,!1),i=h.bind(null,n,c,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=l(e),r=p.bind(null,n,e),i=function(){a(n),n.href&&URL.revokeObjectURL(n.href)}):(n=s(e),r=d.bind(null,n),i=function(){a(n)});return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else i()}}function h(t,e,n,r){var i=n?"":r.css;if(t.styleSheet)t.styleSheet.cssText=w(e,i);else{var o=document.createTextNode(i),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(o,a[e]):t.appendChild(o)}}function d(t,e){var n=e.css,r=e.media;if(r&&t.setAttribute("media",r),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function p(t,e,n){var r=n.css,i=n.sourceMap,o=void 0===e.convertToAbsoluteUrls&&i;(e.convertToAbsoluteUrls||o)&&(r=b(r)),i&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var a=new Blob([r],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}var f={},m=function(t){var e;return function(){return void 0===e&&(e=t.apply(this,arguments)),e}}((function(){return window&&document&&document.all&&!window.atob})),g=function(t){var e={};return function(n){return void 0===e[n]&&(e[n]=t.call(this,n)),e[n]}}((function(t){return document.querySelector(t)})),v=null,y=0,x=[],b=n(15);t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||(e.singleton=m()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=i(t,e);return r(n,e),function(t){for(var o=[],a=0;a<n.length;a++){var s=n[a];(l=f[s.id]).refs--,o.push(l)}for(t&&r(i(t,e),e),a=0;a<o.length;a++){var l;if(0===(l=o[a]).refs){for(var c=0;c<l.parts.length;c++)l.parts[c]();delete f[l.id]}}}};var w=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}()},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,r=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var i,o=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(o)?t:(i=0===o.indexOf("//")?o:0===o.indexOf("/")?n+o:r+o.replace(/^\.\//,""),"url("+JSON.stringify(i)+")")}))}},function(t,e,n){var r=n(17);"undefined"==typeof window||window.Promise||(window.Promise=r),n(21),String.prototype.includes||(String.prototype.includes=function(t,e){return"number"!=typeof e&&(e=0),!(e+t.length>this.length)&&-1!==this.indexOf(t,e)}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(t,e){if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),r=n.length>>>0;if(0===r)return!1;for(var i=0|e,o=Math.max(i>=0?i:r-Math.abs(i),0);o<r;){if(function(t,e){return t===e||"number"==typeof t&&"number"==typeof e&&isNaN(t)&&isNaN(e)}(n[o],t))return!0;o++}return!1}}),"undefined"!=typeof window&&[Element.prototype,CharacterData.prototype,DocumentType.prototype].forEach((function(t){t.hasOwnProperty("remove")||Object.defineProperty(t,"remove",{configurable:!0,enumerable:!0,writable:!0,value:function(){this.parentNode.removeChild(this)}})}))},function(t,e,n){(function(e){!function(n){function r(){}function i(t,e){return function(){t.apply(e,arguments)}}function o(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],h(t,this)}function a(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,o._immediateFn((function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null!==n){var r;try{r=n(t._value)}catch(t){return void l(e.promise,t)}s(e.promise,r)}else(1===t._state?s:l)(e.promise,t._value)}))):t._deferreds.push(e)}function s(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if(e instanceof o)return t._state=3,t._value=e,void c(t);if("function"==typeof n)return void h(i(n,e),t)}t._state=1,t._value=e,c(t)}catch(e){l(t,e)}}function l(t,e){t._state=2,t._value=e,c(t)}function c(t){2===t._state&&0===t._deferreds.length&&o._immediateFn((function(){t._handled||o._unhandledRejectionFn(t._value)}));for(var e=0,n=t._deferreds.length;e<n;e++)a(t,t._deferreds[e]);t._deferreds=null}function u(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function h(t,e){var n=!1;try{t((function(t){n||(n=!0,s(e,t))}),(function(t){n||(n=!0,l(e,t))}))}catch(t){if(n)return;n=!0,l(e,t)}}var d=setTimeout;o.prototype.catch=function(t){return this.then(null,t)},o.prototype.then=function(t,e){var n=new this.constructor(r);return a(this,new u(t,e,n)),n},o.all=function(t){var e=Array.prototype.slice.call(t);return new o((function(t,n){function r(o,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var s=a.then;if("function"==typeof s)return void s.call(a,(function(t){r(o,t)}),n)}e[o]=a,0==--i&&t(e)}catch(t){n(t)}}if(0===e.length)return t([]);for(var i=e.length,o=0;o<e.length;o++)r(o,e[o])}))},o.resolve=function(t){return t&&"object"==typeof t&&t.constructor===o?t:new o((function(e){e(t)}))},o.reject=function(t){return new o((function(e,n){n(t)}))},o.race=function(t){return new o((function(e,n){for(var r=0,i=t.length;r<i;r++)t[r].then(e,n)}))},o._immediateFn="function"==typeof e&&function(t){e(t)}||function(t){d(t,0)},o._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)},o._setImmediateFn=function(t){o._immediateFn=t},o._setUnhandledRejectionFn=function(t){o._unhandledRejectionFn=t},void 0!==t&&t.exports?t.exports=o:n.Promise||(n.Promise=o)}(this)}).call(e,n(18).setImmediate)},function(t,e,n){function r(t,e){this._id=t,this._clearFn=e}var i=Function.prototype.apply;e.setTimeout=function(){return new r(i.call(setTimeout,window,arguments),clearTimeout)},e.setInterval=function(){return new r(i.call(setInterval,window,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(window,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n(19),e.setImmediate=setImmediate,e.clearImmediate=clearImmediate},function(t,e,n){(function(t,e){!function(t,n){function r(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var r={callback:t,args:e};return c[l]=r,s(l),l++}function i(t){delete c[t]}function o(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(n,r)}}function a(t){if(u)setTimeout(a,0,t);else{var e=c[t];if(e){u=!0;try{o(e)}finally{i(t),u=!1}}}}if(!t.setImmediate){var s,l=1,c={},u=!1,h=t.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(t);d=d&&d.setTimeout?d:t,"[object process]"==={}.toString.call(t.process)?s=function(t){e.nextTick((function(){a(t)}))}:function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?function(){var e="setImmediate$"+Math.random()+"$",n=function(n){n.source===t&&"string"==typeof n.data&&0===n.data.indexOf(e)&&a(+n.data.slice(e.length))};t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n),s=function(n){t.postMessage(e+n,"*")}}():t.MessageChannel?function(){var t=new MessageChannel;t.port1.onmessage=function(t){a(t.data)},s=function(e){t.port2.postMessage(e)}}():h&&"onreadystatechange"in h.createElement("script")?function(){var t=h.documentElement;s=function(e){var n=h.createElement("script");n.onreadystatechange=function(){a(e),n.onreadystatechange=null,t.removeChild(n),n=null},t.appendChild(n)}}():s=function(t){setTimeout(a,0,t)},d.setImmediate=r,d.clearImmediate=i}}("undefined"==typeof self?void 0===t?this:t:self)}).call(e,n(7),n(20))},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(t){if(u===setTimeout)return setTimeout(t,0);if((u===n||!u)&&setTimeout)return u=setTimeout,setTimeout(t,0);try{return u(t,0)}catch(e){try{return u.call(null,t,0)}catch(e){return u.call(this,t,0)}}}function o(t){if(h===clearTimeout)return clearTimeout(t);if((h===r||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(t);try{return h(t)}catch(e){try{return h.call(null,t)}catch(e){return h.call(this,t)}}}function a(){m&&p&&(m=!1,p.length?f=p.concat(f):g=-1,f.length&&s())}function s(){if(!m){var t=i(a);m=!0;for(var e=f.length;e;){for(p=f,f=[];++g<e;)p&&p[g].run();g=-1,e=f.length}p=null,m=!1,o(t)}}function l(t,e){this.fun=t,this.array=e}function c(){}var u,h,d=t.exports={};!function(){try{u="function"==typeof setTimeout?setTimeout:n}catch(t){u=n}try{h="function"==typeof clearTimeout?clearTimeout:r}catch(t){h=r}}();var p,f=[],m=!1,g=-1;d.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];f.push(new l(t,e)),1!==f.length||m||i(s)},l.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.prependListener=c,d.prependOnceListener=c,d.listeners=function(t){return[]},d.binding=function(t){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(t){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(t,e,n){n(22).polyfill()},function(t,e,n){function r(t,e){if(null==t)throw new TypeError("Cannot convert first argument to object");for(var n=Object(t),r=1;r<arguments.length;r++){var i=arguments[r];if(null!=i)for(var o=Object.keys(Object(i)),a=0,s=o.length;a<s;a++){var l=o[a],c=Object.getOwnPropertyDescriptor(i,l);void 0!==c&&c.enumerable&&(n[l]=i[l])}}return n}function i(){Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:r})}t.exports={assign:r,polyfill:i}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(24),i=n(6),o=n(5),a=n(36),s=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if("undefined"!=typeof window){var n=a.getOpts.apply(void 0,t);return new Promise((function(t,e){o.default.promise={resolve:t,reject:e},r.default(n),setTimeout((function(){i.openModal()}))}))}};s.close=i.onAction,s.getState=i.getState,s.setActionValue=o.setActionValue,s.stopLoading=i.stopLoading,s.setDefaults=a.setDefaults,e.default=s},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),i=n(0).default.MODAL,o=n(4),a=n(34),s=n(35),l=n(1);e.init=function(t){r.getNode(i)||(document.body||l.throwErr("You can only use SweetAlert AFTER the DOM has loaded!"),a.default(),o.default()),o.initModalContent(t),s.default(t)},e.default=e.init},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(0).default.MODAL;e.modalMarkup='\n <div class="'+r+'" role="dialog" aria-modal="true"></div>',e.default=e.modalMarkup},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r='<div \n class="'+n(0).default.OVERLAY+'"\n tabIndex="-1">\n </div>';e.default=r},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(0).default.ICON;e.errorIconMarkup=function(){var t=r+"--error",e=t+"__line";return'\n <div class="'+t+'__x-mark">\n <span class="'+e+" "+e+'--left"></span>\n <span class="'+e+" "+e+'--right"></span>\n </div>\n '},e.warningIconMarkup=function(){var t=r+"--warning";return'\n <span class="'+t+'__body">\n <span class="'+t+'__dot"></span>\n </span>\n '},e.successIconMarkup=function(){var t=r+"--success";return'\n <span class="'+t+"__line "+t+'__line--long"></span>\n <span class="'+t+"__line "+t+'__line--tip"></span>\n\n <div class="'+t+'__ring"></div>\n <div class="'+t+'__hide-corners"></div>\n '}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(0).default.CONTENT;e.contentMarkup='\n <div class="'+r+'">\n\n </div>\n'},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),i=r.default.BUTTON_CONTAINER,o=r.default.BUTTON,a=r.default.BUTTON_LOADER;e.buttonMarkup='\n <div class="'+i+'">\n\n <button\n class="'+o+'"\n ></button>\n\n <div class="'+a+'">\n <div></div>\n <div></div>\n <div></div>\n </div>\n\n </div>\n'},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(4),i=n(2),o=n(0),a=o.default.ICON,s=o.default.ICON_CUSTOM,l=["error","warning","success","info"],c={error:i.errorIconMarkup(),warning:i.warningIconMarkup(),success:i.successIconMarkup()},u=function(t,e){var n=a+"--"+t;e.classList.add(n);var r=c[t];r&&(e.innerHTML=r)},h=function(t,e){e.classList.add(s);var n=document.createElement("img");n.src=t,e.appendChild(n)},d=function(t){if(t){var e=r.injectElIntoModal(i.iconMarkup);l.includes(t)?u(t,e):h(t,e)}};e.default=d},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),i=n(4),o=function(t){navigator.userAgent.includes("AppleWebKit")&&(t.style.display="none",t.offsetHeight,t.style.display="")};e.initTitle=function(t){if(t){var e=i.injectElIntoModal(r.titleMarkup);e.textContent=t,o(e)}},e.initText=function(t){if(t){var e=document.createDocumentFragment();t.split("\n").forEach((function(t,n,r){e.appendChild(document.createTextNode(t)),n<r.length-1&&e.appendChild(document.createElement("br"))}));var n=i.injectElIntoModal(r.textMarkup);n.appendChild(e),o(n)}}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),i=n(4),o=n(0),a=o.default.BUTTON,s=o.default.DANGER_BUTTON,l=n(3),c=n(2),u=n(6),h=n(5),d=function(t,e,n){var i=e.text,o=e.value,d=e.className,p=e.closeModal,f=r.stringToNode(c.buttonMarkup),m=f.querySelector("."+a),g=a+"--"+t;m.classList.add(g),d&&(Array.isArray(d)?d:d.split(" ")).filter((function(t){return t.length>0})).forEach((function(t){m.classList.add(t)})),n&&t===l.CONFIRM_KEY&&m.classList.add(s),m.textContent=i;var v={};return v[t]=o,h.setActionValue(v),h.setActionOptionsFor(t,{closeModal:p}),m.addEventListener("click",(function(){return u.onAction(t)})),f},p=function(t,e){var n=i.injectElIntoModal(c.footerMarkup);for(var r in t){var o=t[r],a=d(r,o,e);o.visible&&n.appendChild(a)}0===n.children.length&&n.remove()};e.default=p},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=n(4),o=n(2),a=n(5),s=n(6),l=n(0).default.CONTENT,c=function(t){t.addEventListener("input",(function(t){var e=t.target.value;a.setActionValue(e)})),t.addEventListener("keyup",(function(t){if("Enter"===t.key)return s.onAction(r.CONFIRM_KEY)})),setTimeout((function(){t.focus(),a.setActionValue("")}),0)},u=function(t,e,n){var r=document.createElement(e),i=l+"__"+e;for(var o in r.classList.add(i),n){var a=n[o];r[o]=a}"input"===e&&c(r),t.appendChild(r)},h=function(t){if(t){var e=i.injectElIntoModal(o.contentMarkup),n=t.element,r=t.attributes;"string"==typeof n?u(e,n,r):e.appendChild(n)}};e.default=h},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),i=n(2),o=function(){var t=r.stringToNode(i.overlayMarkup);document.body.appendChild(t)};e.default=o},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(5),i=n(6),o=n(1),a=n(3),s=n(0),l=s.default.MODAL,c=s.default.BUTTON,u=s.default.OVERLAY,h=function(t){t.preventDefault(),g()},d=function(t){t.preventDefault(),v()},p=function(t){if(r.default.isOpen&&"Escape"===t.key)return i.onAction(a.CANCEL_KEY)},f=function(t){if(r.default.isOpen&&"Tab"===t.key)return h(t)},m=function(t){if(r.default.isOpen)return"Tab"===t.key&&t.shiftKey?d(t):void 0},g=function(){var t=o.getNode(c);t&&(t.tabIndex=0,t.focus())},v=function(){var t=o.getNode(l).querySelectorAll("."+c),e=t[t.length-1];e&&e.focus()},y=function(t){t[t.length-1].addEventListener("keydown",f)},x=function(t){t[0].addEventListener("keydown",m)},b=function(){var t=o.getNode(l).querySelectorAll("."+c);t.length&&(y(t),x(t))},w=function(t){if(o.getNode(u)===t.target)return i.onAction(a.CANCEL_KEY)},_=function(t){var e=o.getNode(u);e.removeEventListener("click",w),t&&e.addEventListener("click",w)},M=function(t){r.default.timer&&clearTimeout(r.default.timer),t&&(r.default.timer=window.setTimeout((function(){return i.onAction(a.CANCEL_KEY)}),t))},S=function(t){t.closeOnEsc?document.addEventListener("keyup",p):document.removeEventListener("keyup",p),t.dangerMode?g():v(),b(),_(t.closeOnClickOutside),M(t.timer)};e.default=S},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),i=n(3),o=n(37),a=n(38),s={title:null,text:null,icon:null,buttons:i.defaultButtonList,content:null,className:null,closeOnClickOutside:!0,closeOnEsc:!0,dangerMode:!1,timer:null},l=Object.assign({},s);e.setDefaults=function(t){l=Object.assign({},s,t)};var c=function(t){var e=t&&t.button,n=t&&t.buttons;return void 0!==e&&void 0!==n&&r.throwErr("Cannot set both 'button' and 'buttons' options!"),void 0!==e?{confirm:e}:n},u=function(t){return r.ordinalSuffixOf(t+1)},h=function(t,e){r.throwErr(u(e)+" argument ('"+t+"') is invalid")},d=function(t,e){var n=t+1,i=e[n];r.isPlainObject(i)||void 0===i||r.throwErr("Expected "+u(n)+" argument ('"+i+"') to be a plain object")},p=function(t,e){var n=t+1,i=e[n];void 0!==i&&r.throwErr("Unexpected "+u(n)+" argument ("+i+")")},f=function(t,e,n,i){var o=e instanceof Element;if("string"==typeof e){if(0===n)return{text:e};if(1===n)return{text:e,title:i[0]};if(2===n)return d(n,i),{icon:e};h(e,n)}else{if(o&&0===n)return d(n,i),{content:e};if(r.isPlainObject(e))return p(n,i),e;h(e,n)}};e.getOpts=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n={};t.forEach((function(e,r){var i=f(0,e,r,t);Object.assign(n,i)}));var r=c(n);n.buttons=i.getButtonListOpts(r),delete n.button,n.content=o.getContentOpts(n.content);var u=Object.assign({},s,l,n);return Object.keys(u).forEach((function(t){a.DEPRECATED_OPTS[t]&&a.logDeprecation(t)})),u}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),i={element:"input",attributes:{placeholder:""}};e.getContentOpts=function(t){var e={};return r.isPlainObject(t)?Object.assign(e,t):t instanceof Element?{element:t}:"input"===t?i:null}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.logDeprecation=function(t){var n=e.DEPRECATED_OPTS[t],r=n.onlyRename,i=n.replacement,o=n.subOption,a=n.link,s='SweetAlert warning: "'+t+'" option has been '+(r?"renamed":"deprecated")+".";i&&(s+=" Please use"+(o?' "'+o+'" in ':" ")+'"'+i+'" instead.');var l="https://sweetalert.js.org";s+=a?" More details: "+l+a:" More details: "+l+"/guides/#upgrading-from-1x",console.warn(s)},e.DEPRECATED_OPTS={type:{replacement:"icon",link:"/docs/#icon"},imageUrl:{replacement:"icon",link:"/docs/#icon"},customClass:{replacement:"className",onlyRename:!0,link:"/docs/#classname"},imageSize:{},showCancelButton:{replacement:"buttons",link:"/docs/#buttons"},showConfirmButton:{replacement:"button",link:"/docs/#button"},confirmButtonText:{replacement:"button",link:"/docs/#button"},confirmButtonColor:{},cancelButtonText:{replacement:"buttons",link:"/docs/#buttons"},closeOnConfirm:{replacement:"button",subOption:"closeModal",link:"/docs/#button"},closeOnCancel:{replacement:"buttons",subOption:"closeModal",link:"/docs/#buttons"},showLoaderOnConfirm:{replacement:"buttons"},animation:{},inputType:{replacement:"content",link:"/docs/#content"},inputValue:{replacement:"content",link:"/docs/#content"},inputPlaceholder:{replacement:"content",link:"/docs/#content"},html:{replacement:"content",link:"/docs/#content"},allowEscapeKey:{replacement:"closeOnEsc",onlyRename:!0,link:"/docs/#closeonesc"},allowClickOutside:{replacement:"closeOnClickOutside",onlyRename:!0,link:"/docs/#closeonclickoutside"}}}]);var eu=Qc(tu.exports);function nu(t,e="json"){return new Promise((function(n,r){const i=new XMLHttpRequest;i.onload=function(){let t;i.response&&(t=i.response.message),i.status>=200&&i.status<300?n(i.response):r({status:i.status,statusText:i.statusText,message:t})},i.onerror=function(t){r({status:i.status,statusText:i.statusText})},i.open("GET",t,!0),i.responseType=e,i.timeout=4e4,i.ontimeout=function(t){console.log("ERROR: Internet not working"),r({status:i.status,statusText:i.statusText})},i.send()}))}async function ru(t,e,n="json"){let r;return await new Promise(((i,o)=>{nu(t,n).catch((t=>{const{status:n,statusText:r,message:i}=t,o="string"==typeof i?i:r;return eu({title:`${gt(e,"error")} ${n}`,text:o}),null})).then((t=>{r=t,i()}))})),r}async function iu(t){const e=[];e.push(nu(`${pt}assets/data/${t}/sources.json`)),e.push(nu(`${pt}assets/data/${t}/lexicon.json`)),e.push(nu(`${pt}assets/data/${t}/events.json`));const n=await Promise.all(e);return null!==n&&Array.isArray(n)&&0!==n.length?n:null}async function ou(t){return await ru(`${pt}assets/data/${t}/params.json`,"eng")}function au([t,...e],n=[]){return void 0===t?n:[t,...au(n,e)]}function su(e){let n;return{c(){n=f("section"),n.innerHTML='<p class="title">Introduction</p> \n\n <p>Access to the tools of mass communication is now widespread. Broadcasting a message to an arbitrary audience \n is within everyone's reach. It can be done quickly and anonymously. The modern newsroom is multipolar and \n largely unaccountable. As backdrop, digital literacy and algorithms governing the “who sees what” are still \n in an embryonic stage. As a result, online forums are plagued with opportunistic and perverse ideologies. \n Thus far, regulatory bodies and hegemonic social media platforms have failed to deliver adequate safeguards.</p> \n <br/> \n <p>This report lays out a practical and complete blueprint to counter narratives online. The methodology\n is elementary to be operationalizable in most contexts. It should be regarded as a skeleton to \n build upon.</p> \n <br/> \n <p>Our dissection begins with the tools and processes required to examine online discourse and profile narratives. \n Subsequently, we cover how to use the findings to support the countering programme. Finally, we deconceptualize \n the playbook by providing a detailed account of how we implemented it in Bolsonaro’s Brazil and Ouattara’s \n third term Ivory Coast.</p> \n <br/> \n <p>Our hope is that this exposé brings to light the vulnerabilities of these platforms, strengthens intervention efforts and \n catalyzes policy making.</p>'},m(t,e){h(t,n,e)},p:t,i:t,o:t,d(t){t&&d(n)}}}function lu(t,e,n){let{lang:r}=e;return t.$$set=t=>{"lang"in t&&n(0,r=t.lang)},[r]}class cu extends Z{constructor(t){super(),Y(this,t,lu,su,o,{lang:0})}}function uu(e){let n,r,i,o,a;return{c(){n=f("div"),r=f("img"),o=g(),a=f("p"),x(r,"alt",e[1]),l(r.src,i=e[0])||x(r,"src",i),x(r,"class","svelte-otkk37"),x(a,"class","svelte-otkk37"),x(n,"class","image-container svelte-otkk37")},m(t,i){h(t,n,i),u(n,r),u(n,o),u(n,a),a.innerHTML=e[2]},p(t,[e]){2&e&&x(r,"alt",t[1]),1&e&&!l(r.src,i=t[0])&&x(r,"src",i),4&e&&(a.innerHTML=t[2])},i:t,o:t,d(t){t&&d(n)}}}function hu(t,e,n){let{src:r}=e,{alt:i}=e,{caption:o}=e;return t.$$set=t=>{"src"in t&&n(0,r=t.src),"alt"in t&&n(1,i=t.alt),"caption"in t&&n(2,o=t.caption)},[r,i,o]}class du extends Z{constructor(t){super(),Y(this,t,hu,uu,o,{src:0,alt:1,caption:2})}}function pu(e){let n;return{c(){n=f("div"),n.innerHTML='<div id="lexicon-vertical-center" class="svelte-1qlvteu"><div id="lexiconcanvas"></div></div>',x(n,"id","lexicon-container"),x(n,"class","svelte-1qlvteu")},m(t,e){h(t,n,e)},p:t,i:t,o:t,d(t){t&&d(n)}}}function fu(t,e,n){let{posts:r}=e,i=-1;return T((()=>{const t=document.getElementById("lexiconcanvas");!function e(){i=(i+1)%r.length,t.innerHTML=r[i],t.style.lineHeight="1.2em",t.style.fontSize="0.9em",t.className="fade-in",setTimeout((()=>{t.className="fade-out"}),3e3),setTimeout((()=>{e()}),4e3)}()})),t.$$set=t=>{"posts"in t&&n(0,r=t.posts)},[r]}class mu extends Z{constructor(t){super(),Y(this,t,fu,pu,o,{posts:0})}}function gu(e){let n,r,i,o,a,s,c,p,m,v,y,b,w,_,M,S,T,E,C,L,A,R,P,N,D,k,I,O,z,F,B,U,H,W,G,V;return{c(){n=f("div"),r=f("div"),i=f("img"),a=g(),s=f("h1"),s.textContent="Institutions",c=g(),p=f("p"),p.textContent="Bureaucrats/Technocrats",m=g(),v=f("p"),v.textContent="State Affiliated Financial Actors",y=g(),b=f("p"),b.textContent="Business Leaders (private sector)",w=g(),_=f("div"),M=f("img"),T=g(),E=f("h1"),E.textContent="Politics",C=g(),L=f("p"),L.textContent="Elected Officials",A=g(),R=f("p"),R.textContent="Staff of Elected Officials",P=g(),N=f("p"),N.textContent="Political Operatives",D=g(),k=f("div"),I=f("img"),z=g(),F=f("h1"),F.textContent="Society",B=g(),U=f("p"),U.textContent="Political Families",H=g(),W=f("p"),W.textContent="Traditional and Religious Leaders",G=g(),V=f("p"),V.textContent="Cultural Leaders",x(i,"alt","institutions"),l(i.src,o=pt+"assets/images/institutions.png")||x(i,"src","/projects/seshat/assets/images/institutions.png"),x(i,"class","svelte-6srzoj"),x(s,"class","svelte-6srzoj"),x(p,"class","svelte-6srzoj"),x(v,"class","svelte-6srzoj"),x(b,"class","svelte-6srzoj"),x(r,"class","political-network svelte-6srzoj"),x(M,"alt","politics"),l(M.src,S=pt+"assets/images/politics.png")||x(M,"src","/projects/seshat/assets/images/politics.png"),x(M,"class","svelte-6srzoj"),x(E,"class","svelte-6srzoj"),x(L,"class","svelte-6srzoj"),x(R,"class","svelte-6srzoj"),x(N,"class","svelte-6srzoj"),x(_,"class","political-network svelte-6srzoj"),x(I,"alt","society"),l(I.src,O=pt+"assets/images/society.png")||x(I,"src","/projects/seshat/assets/images/society.png"),x(I,"class","svelte-6srzoj"),x(F,"class","svelte-6srzoj"),x(U,"class","svelte-6srzoj"),x(W,"class","svelte-6srzoj"),x(V,"class","svelte-6srzoj"),x(k,"class","political-network svelte-6srzoj"),x(n,"id","political-network-container"),x(n,"class","container svelte-6srzoj")},m(t,e){h(t,n,e),u(n,r),u(r,i),u(r,a),u(r,s),u(r,c),u(r,p),u(r,m),u(r,v),u(r,y),u(r,b),u(n,w),u(n,_),u(_,M),u(_,T),u(_,E),u(_,C),u(_,L),u(_,A),u(_,R),u(_,P),u(_,N),u(n,D),u(n,k),u(k,I),u(k,z),u(k,F),u(k,B),u(k,U),u(k,H),u(k,W),u(k,G),u(k,V)},p:t,i:t,o:t,d(t){t&&d(n)}}}class vu extends Z{constructor(t){super(),Y(this,t,null,gu,o,{})}}function yu(e){let n,r,i,o,a,s,c,p,m,v,y,b,w,M,S,T,E,C,L,A,R,P,N,D,k,I,O;return{c(){n=f("div"),r=f("div"),i=f("div"),o=f("img"),s=g(),c=f("img"),m=g(),v=f("img"),b=g(),w=f("img"),S=g(),T=f("img"),C=g(),L=f("img"),R=g(),P=f("img"),D=g(),k=f("canvas"),I=g(),O=f("canvas"),x(o,"id","post-facebook"),x(o,"alt","facebook"),l(o.src,a=pt+"assets/images/facebook.png")||x(o,"src","/projects/seshat/assets/images/facebook.png"),x(c,"id","post-twitter"),x(c,"alt","twitter"),l(c.src,p=pt+"assets/images/twitter.png")||x(c,"src","/projects/seshat/assets/images/twitter.png"),x(v,"id","post-telegram"),x(v,"alt","telegram"),l(v.src,y=pt+"assets/images/telegram.png")||x(v,"src","/projects/seshat/assets/images/telegram.png"),x(w,"id","post-youtube"),x(w,"alt","youtube"),l(w.src,M=pt+"assets/images/youtube.png")||x(w,"src","/projects/seshat/assets/images/youtube.png"),x(T,"id","approve"),x(T,"alt","approve"),l(T.src,E=pt+"assets/images/approve.png")||x(T,"src","/projects/seshat/assets/images/approve.png"),x(L,"id","reject"),x(L,"alt","reject"),l(L.src,A=pt+"assets/images/reject.png")||x(L,"src","/projects/seshat/assets/images/reject.png"),x(P,"id","annotator"),x(P,"alt","annotator"),l(P.src,N=pt+"assets/images/annotator.png")||x(P,"src","/projects/seshat/assets/images/annotator.png"),_(i,"display","none"),_(k,"position","fixed"),x(k,"id","contentannotationcanvas"),x(k,"class","svelte-5hp6ox"),x(O,"id","contentannotationcanvas_check"),x(O,"class","svelte-5hp6ox"),x(r,"id","annotation-vertical-center"),x(r,"class","svelte-5hp6ox"),x(n,"id","annotation-container"),x(n,"class","svelte-5hp6ox")},m(t,e){h(t,n,e),u(n,r),u(r,i),u(i,o),u(i,s),u(i,c),u(i,m),u(i,v),u(i,b),u(i,w),u(i,S),u(i,T),u(i,C),u(i,L),u(i,R),u(i,P),u(r,D),u(r,k),u(r,I),u(r,O)},p:t,i:t,o:t,d(t){t&&d(n)}}}const xu=400,bu=440,wu=70;function _u(t){return Math.floor(Math.random()*t)}function Mu(t){return T((()=>{const t=document.getElementById("contentannotationcanvas"),e=t.getContext("2d"),n=document.getElementById("contentannotationcanvas_check"),r=n.getContext("2d");t.width=xu,t.height=bu,n.width=xu,n.height=bu,e.globalAlpha=.9,r.globalAlpha=.9;const i=document.getElementById("post-youtube"),o=document.getElementById("post-facebook"),a=document.getElementById("post-telegram"),s=document.getElementById("post-twitter"),l=document.getElementById("annotator"),c=document.getElementById("approve"),u=document.getElementById("reject"),h=[i,o,a,s];function d(t,e){r.clearRect(0,0,xu,bu),e?r.drawImage(c,267,p,wu,wu):r.drawImage(u,267,p,wu,wu),r.globalCompositeOperation="source-in",r.fillStyle=t,r.fillRect(0,0,xu,bu),r.globalCompositeOperation="source-over"}let p=0,f=0,m=h[_u(h.length)],g=!1;setInterval((()=>{var t,n;Math.abs(140-(p+wu+32))<4?(f+=1,f>100?(f=0,p=-100,g=!1,m=h[_u(h.length)]):f>50&&!g&&(1===_u(2)?d("#e44e4e",!1):d("#009900",!0),g=!0)):(p+=2,t=m,n=p,e.clearRect(0,0,xu,bu),r.clearRect(0,0,xu,bu),e.drawImage(t,165,n,wu,wu),e.drawImage(l,50,140),e.globalCompositeOperation="source-in",e.fillStyle="#fff",e.fillRect(0,0,xu,bu),e.globalCompositeOperation="source-over")}),20)})),[]}class Su extends Z{constructor(t){super(),Y(this,t,Mu,yu,o,{})}}function Tu(t){let e,n,r,i,o,a,s,l,c,p,m,v,y,b,w,_,M,S,T,E,C,L,A,R,P,N,D,k,I,O,z,F,B,U,H,V,X,Y,Z,J,K,Q,tt,et,nt,rt,it,ot,at,st,lt,ct,ut,ht,dt,ft,mt,gt,vt,yt,xt,bt,wt,_t,Mt,St,Tt,Et,Ct,Lt,At,Rt,Pt,Nt,Dt,kt,It,Ot,zt,Ft,Bt,Ut,Ht,Wt,Gt,Vt,jt;return A=new vu({}),k=new mu({props:{posts:t[0]}}),et=new du({props:{caption:"Demonstration of a browser-based scraper",alt:"scraping using browser extension",src:pt+"assets/videos/browser-scraper.gif"}}),bt=new Su({}),{c(){e=f("section"),n=f("p"),n.textContent="Monitoring",r=g(),i=f("p"),i.textContent="We can’t tackle what we don't know or can't measure.",o=g(),a=f("br"),s=g(),l=f("p"),l.textContent="Procurement",c=g(),p=f("p"),p.textContent="Delineate the information ecosystem you intend to influence. Define the narratives you plan to monitor, counter & spread. \n Partner with in-situ organizations composed of individuals from diverse backgrounds, who follow local news events avidly, \n use social media, and ideally have experience with data-driven projects. If this expertise is absent in-situ, you will need \n to conduct interviews with local focus groups.",m=g(),v=f("br"),y=g(),b=f("br"),w=g(),_=f("p"),_.textContent="Building the Tools",M=g(),S=f("p"),S.textContent="Narrative identification is an intensely culturally-grounded and nuanced activity - the facts are that, to find, \n understand, engage with, and counter, we depend on people who have a deep working knowledge of the culture. The \n approach we use here involves combining their knowledge and efforts with computational methods. At a high-level, \n this approach involves highly-interactive work with a dedicated group of in-situ participants.",T=g(),E=f("ul"),C=f("li"),C.textContent="Account Mapping: Participants are instructed to go on social media and identify influential Twitter accounts, \n Youtube channels, Telegram, and Facebook public pages/groups probable of disseminating the target narratives. \n When adding accounts to the list, participants include additional information such as geographical reach, political \n affiliation and level of partisanship. Moreover, they categorize them – general conversation, media, activists, \n state-affiliated. Post hoc, participants lay out known connections between accounts.",L=g(),j(A.$$.fragment),R=f("br"),P=g(),N=f("li"),N.textContent="Lexicon: Participants are asked to list out popular idioms, keywords or expressions that characterize, or are often found,\n in posts containing the target narratives. Multiple non-overlapping lexicons can be used separately to decouple \n geographies and themes.",D=g(),j(k.$$.fragment),I=g(),O=f("li"),O.textContent='Annotation Guide: Participants are tasked with creating a questionnaire composed of yes/no questions that can be used\n to determine if a social media post evokes the target narratives. If we use the "climate change denial" narrative, \n we could ask "Does the post suggest a lack of consensus in the scientific community?".',z=g(),F=f("br"),B=g(),U=f("p"),U.textContent="Following these workshops, we have a list of social media accounts, a lexicon, and a questionnaire adapted \n to the ecosystem.",H=g(),V=f("br"),X=g(),Y=f("br"),Z=g(),J=f("p"),J.textContent="Data Collection & Filtering",K=g(),Q=f("p"),Q.textContent="To collect public social media posts, use the official interface provided by each platform (e.g. CrowdTangle, Twitter API, ...). \n For private posts, browser-based scrapers can be used. However, you will need an account that has infiltrated the desired private \n Facebook groups, WhatsApp group chats, etc. Rudimentary social engineering can be used to receive an invitation to join from admins. \n Self-host the image assets contained in the posts because their URLs are ephemeral.",tt=g(),j(et.$$.fragment),nt=g(),rt=f("p"),rt.textContent="Hundreds of thousands of social media posts should be expected. Most of it is noise. Finding posts of interest is analogous \n to finding a “needle in a haystack”, with hay being added relentlessly. To intercept unrelated posts (e.g. sport, fashion, ...) \n automatic filtering techniques must be implemented. Here are the heuristics used to sift the dataset for posts of interest.",it=g(),ot=f("ul"),ot.innerHTML="<li><b>Temporal</b>: Only retain documents that are posted within predetermined date & time windows</li> \n\n <li><b>Lexical</b>: Only retain documents that contain at least one word from the lexicon</li> \n\n <li><b>Engagement</b>: Posts that receive low engagement should be ignored</li>",at=g(),st=f("br"),lt=g(),ct=f("br"),ut=g(),ht=f("p"),ht.textContent="Annotation",dt=g(),ft=f("p"),ft.textContent="Create annotation tasks pairing the social media posts enriched for target narratives and the questionnaire \n developed previously. Speech is subtle and subjective, tasks are sent to in-situ participants to be \n annotated. Make sure the images are displayed well. Add the hyperlink pointing to the source post as reference. \n A post can be sent to multiple independent annotators to receive more perspectives and ultimately improve the \n quality of the annotations. Annotation will incrementally discover posts containing the target narratives.",mt=g(),gt=f("br"),vt=g(),yt=f("p"),yt.textContent="This activity should be done through a web app that allows progress tracking. Monitor which annotators are \n working, not working, how long it is taking them to submit their questionnaires.",xt=g(),j(bt.$$.fragment),wt=g(),_t=f("br"),Mt=g(),St=f("br"),Tt=g(),Et=f("p"),Et.textContent="Continuous Improvement",Ct=g(),Lt=f("p"),Lt.textContent="Once a sizable collection of social media posts of interest has been identified it can be used to evaluate and improve the tools. \n Here are a few tuning techniques:",At=g(),Rt=f("ul"),Rt.innerHTML='<li><b>Lexicon Pruning</b>: Remove words that were rarely found in posts of interest and often found in \n benign posts – true positives over false positives.</li> \n <li><b>Lexicon Expansion</b>: <a target="_blank" href="https://en.wikipedia.org/wiki/Tf%E2%80%93idf">TF-IDF</a> applied to\n posts of interest against benign posts is used to discover important words. Participants then decide if\n they should be added to the lexicon.</li> \n <li><b>Events</b>: Look at temporal dynamics. When do posts of interest spike? After specific events, \n a few days after events, a specific period of time. Adjust the time/date windows accordingly.</li> \n <li><b>Artificial Intelligence</b>: Train and then use a <a href="https://huggingface.co/" target="_blank">language classification model</a> \n to uncover posts that deserved to be reviewed but did not satisfy the temporal or lexical filters.</li>',Pt=g(),Nt=f("br"),Dt=g(),kt=f("br"),It=g(),Ot=f("p"),Ot.textContent="Analysis",zt=g(),Ft=f("p"),Ft.textContent="The reviewed social media posts are analyzed 4 fronts:",Bt=g(),Ut=f("ul"),Ut.innerHTML="<li><b>Belligerents</b>: Look at who is behind the accounts that published the target narratives. Is there a trend given their profile (e.g. political affiliation, partisanship) ?</li> \n <li><b>Salient narratives</b>: Participants re-review the posts that have been flagged as containing the \n target narratives and are asked to identify sub-narratives and communication strategies.</li> \n <li><b>Engagement</b>: Disaggregated by social media platforms, look at which posts received the highest engagement. Verify if they \n were shared by high profile accounts that aren't in your list.</li> \n <li><b>Coordination</b>: To investigate the extent to which different accounts demonstrate a propensity for each of the narratives.\n Assess whether two accounts published a message about the same sub-narrative within an arbitrary number of days.</li>",Ht=g(),Wt=f("p"),Wt.innerHTML='You can extract the links embedded in the final social media posts. Useful tools to get insights about websites are \n <a target="_blank" href="https://www.similarweb.com/">SimilarWeb</a> and <a target="_blank" href="https://dnslytics.com/">DNSlytics</a>.',Gt=g(),Vt=f("br"),x(n,"class","title"),x(l,"class","subtitle"),x(_,"class","subtitle"),x(J,"class","subtitle"),x(ht,"class","subtitle"),x(Et,"class","subtitle"),x(Ot,"class","subtitle")},m(t,d){h(t,e,d),u(e,n),u(e,r),u(e,i),u(e,o),u(e,a),u(e,s),u(e,l),u(e,c),u(e,p),u(e,m),u(e,v),u(e,y),u(e,b),u(e,w),u(e,_),u(e,M),u(e,S),u(e,T),u(e,E),u(E,C),u(E,L),$(A,E,null),u(E,R),u(E,P),u(E,N),u(E,D),$(k,E,null),u(E,I),u(E,O),u(e,z),u(e,F),u(e,B),u(e,U),u(e,H),u(e,V),u(e,X),u(e,Y),u(e,Z),u(e,J),u(e,K),u(e,Q),u(e,tt),$(et,e,null),u(e,nt),u(e,rt),u(e,it),u(e,ot),u(e,at),u(e,st),u(e,lt),u(e,ct),u(e,ut),u(e,ht),u(e,dt),u(e,ft),u(e,mt),u(e,gt),u(e,vt),u(e,yt),u(e,xt),$(bt,e,null),u(e,wt),u(e,_t),u(e,Mt),u(e,St),u(e,Tt),u(e,Et),u(e,Ct),u(e,Lt),u(e,At),u(e,Rt),u(e,Pt),u(e,Nt),u(e,Dt),u(e,kt),u(e,It),u(e,Ot),u(e,zt),u(e,Ft),u(e,Bt),u(e,Ut),u(e,Ht),u(e,Wt),u(e,Gt),u(e,Vt),jt=!0},p(t,[e]){const n={};1&e&&(n.posts=t[0]),k.$set(n)},i(t){jt||(W(A.$$.fragment,t),W(k.$$.fragment,t),W(et.$$.fragment,t),W(bt.$$.fragment,t),jt=!0)},o(t){G(A.$$.fragment,t),G(k.$$.fragment,t),G(et.$$.fragment,t),G(bt.$$.fragment,t),jt=!1},d(t){t&&d(e),q(A),q(k),q(et),q(bt)}}}function Eu(t,e,n){let{lang:r}=e,{sample_posts:i}=e;return t.$$set=t=>{"lang"in t&&n(1,r=t.lang),"sample_posts"in t&&n(0,i=t.sample_posts)},[i,r]}class Cu extends Z{constructor(t){super(),Y(this,t,Eu,Tu,o,{lang:1,sample_posts:0})}}function Lu(e){let n,r,i,o,a,s,c,p,m,v,y,b,w,_,M,S,T,E,C,L,A,R,P,N,D,k,I,O,z,F,B,U;return{c(){n=f("div"),r=f("div"),i=f("img"),a=g(),s=f("h1"),s.textContent="Credibility",c=g(),p=f("p"),p.textContent="Source, Vehicle, Production",m=g(),v=f("div"),y=f("img"),w=g(),_=f("h1"),_.textContent="Shareability",M=g(),S=f("p"),S.textContent="Network feels compelled to share the content",T=g(),E=f("div"),C=f("img"),A=g(),R=f("h1"),R.textContent="Targeted",P=g(),N=f("p"),N.textContent="Geography, Narrative, Vernacular, Platform",D=g(),k=f("div"),I=f("img"),z=g(),F=f("h1"),F.textContent="Repetition",B=g(),U=f("p"),U.textContent="Re-post to reach all potential users",x(i,"alt","credibility"),l(i.src,o=pt+"assets/images/credibility.png")||x(i,"src","/projects/seshat/assets/images/credibility.png"),x(i,"class","svelte-136do0"),x(s,"class","svelte-136do0"),x(p,"class","svelte-136do0"),x(r,"class","campaign-principles svelte-136do0"),x(y,"alt","shareability"),l(y.src,b=pt+"assets/images/shareability.png")||x(y,"src","/projects/seshat/assets/images/shareability.png"),x(y,"class","svelte-136do0"),x(_,"class","svelte-136do0"),x(S,"class","svelte-136do0"),x(v,"class","campaign-principles svelte-136do0"),x(C,"alt","targeted"),l(C.src,L=pt+"assets/images/targeted.png")||x(C,"src","/projects/seshat/assets/images/targeted.png"),x(C,"class","svelte-136do0"),x(R,"class","svelte-136do0"),x(N,"class","svelte-136do0"),x(E,"class","campaign-principles svelte-136do0"),x(I,"alt","repetition"),l(I.src,O=pt+"assets/images/repetition.png")||x(I,"src","/projects/seshat/assets/images/repetition.png"),x(I,"class","svelte-136do0"),x(F,"class","svelte-136do0"),x(U,"class","svelte-136do0"),x(k,"class","campaign-principles svelte-136do0"),x(n,"id","campaign-principles-container"),x(n,"class","container svelte-136do0")},m(t,e){h(t,n,e),u(n,r),u(r,i),u(r,a),u(r,s),u(r,c),u(r,p),u(n,m),u(n,v),u(v,y),u(v,w),u(v,_),u(v,M),u(v,S),u(n,T),u(n,E),u(E,C),u(E,A),u(E,R),u(E,P),u(E,N),u(n,D),u(n,k),u(k,I),u(k,z),u(k,F),u(k,B),u(k,U)},p:t,i:t,o:t,d(t){t&&d(n)}}}!function(t,e){t.exports=function(){var t=navigator.userAgent,e=navigator.platform,n=/gecko\/\d/i.test(t),r=/MSIE \d/.test(t),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(t),o=/Edge\/(\d+)/.exec(t),a=r||i||o,s=a&&(r?document.documentMode||6:+(o||i)[1]),l=!o&&/WebKit\//.test(t),c=l&&/Qt\/\d+\.\d+/.test(t),u=!o&&/Chrome\//.test(t),h=/Opera\//.test(t),d=/Apple Computer/.test(navigator.vendor),p=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(t),f=/PhantomJS/.test(t),m=d&&(/Mobile\/\w+/.test(t)||navigator.maxTouchPoints>2),g=/Android/.test(t),v=m||g||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(t),y=m||/Mac/.test(e),x=/\bCrOS\b/.test(t),b=/win/i.test(e),w=h&&t.match(/Version\/(\d*\.\d*)/);w&&(w=Number(w[1])),w&&w>=15&&(h=!1,l=!0);var _=y&&(c||h&&(null==w||w<12.11)),M=n||a&&s>=9;function S(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}var T,E=function(t,e){var n=t.className,r=S(e).exec(n);if(r){var i=n.slice(r.index+r[0].length);t.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function C(t){for(var e=t.childNodes.length;e>0;--e)t.removeChild(t.firstChild);return t}function L(t,e){return C(t).appendChild(e)}function A(t,e,n,r){var i=document.createElement(t);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof e)i.appendChild(document.createTextNode(e));else if(e)for(var o=0;o<e.length;++o)i.appendChild(e[o]);return i}function R(t,e,n,r){var i=A(t,e,n,r);return i.setAttribute("role","presentation"),i}function P(t,e){if(3==e.nodeType&&(e=e.parentNode),t.contains)return t.contains(e);do{if(11==e.nodeType&&(e=e.host),e==t)return!0}while(e=e.parentNode)}function N(){var t;try{t=document.activeElement}catch(e){t=document.body||null}for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}function D(t,e){var n=t.className;S(e).test(n)||(t.className+=(n?" ":"")+e)}function k(t,e){for(var n=t.split(" "),r=0;r<n.length;r++)n[r]&&!S(n[r]).test(e)&&(e+=" "+n[r]);return e}T=document.createRange?function(t,e,n,r){var i=document.createRange();return i.setEnd(r||t,n),i.setStart(t,e),i}:function(t,e,n){var r=document.body.createTextRange();try{r.moveToElementText(t.parentNode)}catch(t){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",e),r};var I=function(t){t.select()};function O(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,e)}}function z(t,e,n){for(var r in e||(e={}),t)!t.hasOwnProperty(r)||!1===n&&e.hasOwnProperty(r)||(e[r]=t[r]);return e}function F(t,e,n,r,i){null==e&&-1==(e=t.search(/[^\s\u00a0]/))&&(e=t.length);for(var o=r||0,a=i||0;;){var s=t.indexOf("\t",o);if(s<0||s>=e)return a+(e-o);a+=s-o,a+=n-a%n,o=s+1}}m?I=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:a&&(I=function(t){try{t.select()}catch(t){}});var B=function(){this.id=null,this.f=null,this.time=0,this.handler=O(this.onTimeout,this)};function U(t,e){for(var n=0;n<t.length;++n)if(t[n]==e)return n;return-1}B.prototype.onTimeout=function(t){t.id=0,t.time<=+new Date?t.f():setTimeout(t.handler,t.time-+new Date)},B.prototype.set=function(t,e){this.f=e;var n=+new Date+t;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,t),this.time=n)};var H=50,W={toString:function(){return"CodeMirror.Pass"}},G={scroll:!1},V={origin:"*mouse"},j={origin:"+move"};function $(t,e,n){for(var r=0,i=0;;){var o=t.indexOf("\t",r);-1==o&&(o=t.length);var a=o-r;if(o==t.length||i+a>=e)return r+Math.min(a,e-i);if(i+=o-r,r=o+1,(i+=n-i%n)>=e)return r}}var q=[""];function X(t){for(;q.length<=t;)q.push(Y(q)+" ");return q[t]}function Y(t){return t[t.length-1]}function Z(t,e){for(var n=[],r=0;r<t.length;r++)n[r]=e(t[r],r);return n}function J(t,e,n){for(var r=0,i=n(e);r<t.length&&n(t[r])<=i;)r++;t.splice(r,0,e)}function K(){}function Q(t,e){var n;return Object.create?n=Object.create(t):(K.prototype=t,n=new K),e&&z(e,n),n}var tt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function et(t){return/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||tt.test(t))}function nt(t,e){return e?!!(e.source.indexOf("\\w")>-1&&et(t))||e.test(t):et(t)}function rt(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}var it=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ot(t){return t.charCodeAt(0)>=768&&it.test(t)}function at(t,e,n){for(;(n<0?e>0:e<t.length)&&ot(t.charAt(e));)e+=n;return e}function st(t,e,n){for(var r=e>n?-1:1;;){if(e==n)return e;var i=(e+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==e)return t(o)?e:n;t(o)?n=o:e=o+r}}function lt(t,e,n,r){if(!t)return r(e,n,"ltr",0);for(var i=!1,o=0;o<t.length;++o){var a=t[o];(a.from<n&&a.to>e||e==n&&a.to==e)&&(r(Math.max(a.from,e),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),i=!0)}i||r(e,n,"ltr")}var ct=null;function ut(t,e,n){var r;ct=null;for(var i=0;i<t.length;++i){var o=t[i];if(o.from<e&&o.to>e)return i;o.to==e&&(o.from!=o.to&&"before"==n?r=i:ct=i),o.from==e&&(o.from!=o.to&&"before"!=n?r=i:ct=i)}return null!=r?r:ct}var ht=function(){var t="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",e="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(n){return n<=247?t.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1785?e.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":8204==n?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,a=/[Lb1n]/,s=/[1n]/;function l(t,e,n){this.level=t,this.from=e,this.to=n}return function(t,e){var c="ltr"==e?"L":"R";if(0==t.length||"ltr"==e&&!r.test(t))return!1;for(var u=t.length,h=[],d=0;d<u;++d)h.push(n(t.charCodeAt(d)));for(var p=0,f=c;p<u;++p){var m=h[p];"m"==m?h[p]=f:f=m}for(var g=0,v=c;g<u;++g){var y=h[g];"1"==y&&"r"==v?h[g]="n":o.test(y)&&(v=y,"r"==y&&(h[g]="R"))}for(var x=1,b=h[0];x<u-1;++x){var w=h[x];"+"==w&&"1"==b&&"1"==h[x+1]?h[x]="1":","!=w||b!=h[x+1]||"1"!=b&&"n"!=b||(h[x]=b),b=w}for(var _=0;_<u;++_){var M=h[_];if(","==M)h[_]="N";else if("%"==M){var S=void 0;for(S=_+1;S<u&&"%"==h[S];++S);for(var T=_&&"!"==h[_-1]||S<u&&"1"==h[S]?"1":"N",E=_;E<S;++E)h[E]=T;_=S-1}}for(var C=0,L=c;C<u;++C){var A=h[C];"L"==L&&"1"==A?h[C]="L":o.test(A)&&(L=A)}for(var R=0;R<u;++R)if(i.test(h[R])){var P=void 0;for(P=R+1;P<u&&i.test(h[P]);++P);for(var N="L"==(R?h[R-1]:c),D=N==("L"==(P<u?h[P]:c))?N?"L":"R":c,k=R;k<P;++k)h[k]=D;R=P-1}for(var I,O=[],z=0;z<u;)if(a.test(h[z])){var F=z;for(++z;z<u&&a.test(h[z]);++z);O.push(new l(0,F,z))}else{var B=z,U=O.length,H="rtl"==e?1:0;for(++z;z<u&&"L"!=h[z];++z);for(var W=B;W<z;)if(s.test(h[W])){B<W&&(O.splice(U,0,new l(1,B,W)),U+=H);var G=W;for(++W;W<z&&s.test(h[W]);++W);O.splice(U,0,new l(2,G,W)),U+=H,B=W}else++W;B<z&&O.splice(U,0,new l(1,B,z))}return"ltr"==e&&(1==O[0].level&&(I=t.match(/^\s+/))&&(O[0].from=I[0].length,O.unshift(new l(0,0,I[0].length))),1==Y(O).level&&(I=t.match(/\s+$/))&&(Y(O).to-=I[0].length,O.push(new l(0,u-I[0].length,u)))),"rtl"==e?O.reverse():O}}();function dt(t,e){var n=t.order;return null==n&&(n=t.order=ht(t.text,e)),n}var pt=[],ft=function(t,e,n){if(t.addEventListener)t.addEventListener(e,n,!1);else if(t.attachEvent)t.attachEvent("on"+e,n);else{var r=t._handlers||(t._handlers={});r[e]=(r[e]||pt).concat(n)}};function mt(t,e){return t._handlers&&t._handlers[e]||pt}function gt(t,e,n){if(t.removeEventListener)t.removeEventListener(e,n,!1);else if(t.detachEvent)t.detachEvent("on"+e,n);else{var r=t._handlers,i=r&&r[e];if(i){var o=U(i,n);o>-1&&(r[e]=i.slice(0,o).concat(i.slice(o+1)))}}}function vt(t,e){var n=mt(t,e);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function yt(t,e,n){return"string"==typeof e&&(e={type:e,preventDefault:function(){this.defaultPrevented=!0}}),vt(t,n||e.type,t,e),St(e)||e.codemirrorIgnore}function xt(t){var e=t._handlers&&t._handlers.cursorActivity;if(e)for(var n=t.curOp.cursorActivityHandlers||(t.curOp.cursorActivityHandlers=[]),r=0;r<e.length;++r)-1==U(n,e[r])&&n.push(e[r])}function bt(t,e){return mt(t,e).length>0}function wt(t){t.prototype.on=function(t,e){ft(this,t,e)},t.prototype.off=function(t,e){gt(this,t,e)}}function _t(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function Mt(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function St(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function Tt(t){_t(t),Mt(t)}function Et(t){return t.target||t.srcElement}function Ct(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),y&&t.ctrlKey&&1==e&&(e=3),e}var Lt,At,Rt=function(){if(a&&s<9)return!1;var t=A("div");return"draggable"in t||"dragDrop"in t}();function Pt(t){if(null==Lt){var e=A("span","");L(t,A("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(Lt=e.offsetWidth<=1&&e.offsetHeight>2&&!(a&&s<8))}var n=Lt?A("span",""):A("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Nt(t){if(null!=At)return At;var e=L(t,document.createTextNode("AخA")),n=T(e,0,1).getBoundingClientRect(),r=T(e,1,2).getBoundingClientRect();return C(t),!(!n||n.left==n.right)&&(At=r.right-n.right<3)}var Dt,kt=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,n=[],r=t.length;e<=r;){var i=t.indexOf("\n",e);-1==i&&(i=t.length);var o=t.slice(e,"\r"==t.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),e+=a+1):(n.push(o),e=i+1)}return n}:function(t){return t.split(/\r\n?|\n/)},It=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(t){return!1}}:function(t){var e;try{e=t.ownerDocument.selection.createRange()}catch(t){}return!(!e||e.parentElement()!=t)&&0!=e.compareEndPoints("StartToEnd",e)},Ot="oncopy"in(Dt=A("div"))||(Dt.setAttribute("oncopy","return;"),"function"==typeof Dt.oncopy),zt=null;function Ft(t){if(null!=zt)return zt;var e=L(t,A("span","x")),n=e.getBoundingClientRect(),r=T(e,0,1).getBoundingClientRect();return zt=Math.abs(n.left-r.left)>1}var Bt={},Ut={};function Ht(t,e){arguments.length>2&&(e.dependencies=Array.prototype.slice.call(arguments,2)),Bt[t]=e}function Wt(t,e){Ut[t]=e}function Gt(t){if("string"==typeof t&&Ut.hasOwnProperty(t))t=Ut[t];else if(t&&"string"==typeof t.name&&Ut.hasOwnProperty(t.name)){var e=Ut[t.name];"string"==typeof e&&(e={name:e}),(t=Q(e,t)).name=e.name}else{if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return Gt("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return Gt("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}function Vt(t,e){e=Gt(e);var n=Bt[e.name];if(!n)return Vt(t,"text/plain");var r=n(t,e);if(jt.hasOwnProperty(e.name)){var i=jt[e.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=e.name,e.helperType&&(r.helperType=e.helperType),e.modeProps)for(var a in e.modeProps)r[a]=e.modeProps[a];return r}var jt={};function $t(t,e){z(e,jt.hasOwnProperty(t)?jt[t]:jt[t]={})}function qt(t,e){if(!0===e)return e;if(t.copyState)return t.copyState(e);var n={};for(var r in e){var i=e[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Xt(t,e){for(var n;t.innerMode&&(n=t.innerMode(e))&&n.mode!=t;)e=n.state,t=n.mode;return n||{mode:t,state:e}}function Yt(t,e,n){return!t.startState||t.startState(e,n)}var Zt=function(t,e,n){this.pos=this.start=0,this.string=t,this.tabSize=e||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function Jt(t,e){if((e-=t.first)<0||e>=t.size)throw new Error("There is no line "+(e+t.first)+" in the document.");for(var n=t;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(e<o){n=i;break}e-=o}return n.lines[e]}function Kt(t,e,n){var r=[],i=e.line;return t.iter(e.line,n.line+1,(function(t){var o=t.text;i==n.line&&(o=o.slice(0,n.ch)),i==e.line&&(o=o.slice(e.ch)),r.push(o),++i})),r}function Qt(t,e,n){var r=[];return t.iter(e,n,(function(t){r.push(t.text)})),r}function te(t,e){var n=e-t.height;if(n)for(var r=t;r;r=r.parent)r.height+=n}function ee(t){if(null==t.parent)return null;for(var e=t.parent,n=U(e.lines,t),r=e.parent;r;e=r,r=r.parent)for(var i=0;r.children[i]!=e;++i)n+=r.children[i].chunkSize();return n+e.first}function ne(t,e){var n=t.first;t:do{for(var r=0;r<t.children.length;++r){var i=t.children[r],o=i.height;if(e<o){t=i;continue t}e-=o,n+=i.chunkSize()}return n}while(!t.lines);for(var a=0;a<t.lines.length;++a){var s=t.lines[a].height;if(e<s)break;e-=s}return n+a}function re(t,e){return e>=t.first&&e<t.first+t.size}function ie(t,e){return String(t.lineNumberFormatter(e+t.firstLineNumber))}function oe(t,e,n){if(void 0===n&&(n=null),!(this instanceof oe))return new oe(t,e,n);this.line=t,this.ch=e,this.sticky=n}function ae(t,e){return t.line-e.line||t.ch-e.ch}function se(t,e){return t.sticky==e.sticky&&0==ae(t,e)}function le(t){return oe(t.line,t.ch)}function ce(t,e){return ae(t,e)<0?e:t}function ue(t,e){return ae(t,e)<0?t:e}function he(t,e){return Math.max(t.first,Math.min(e,t.first+t.size-1))}function de(t,e){if(e.line<t.first)return oe(t.first,0);var n=t.first+t.size-1;return e.line>n?oe(n,Jt(t,n).text.length):pe(e,Jt(t,e.line).text.length)}function pe(t,e){var n=t.ch;return null==n||n>e?oe(t.line,e):n<0?oe(t.line,0):t}function fe(t,e){for(var n=[],r=0;r<e.length;r++)n[r]=de(t,e[r]);return n}Zt.prototype.eol=function(){return this.pos>=this.string.length},Zt.prototype.sol=function(){return this.pos==this.lineStart},Zt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Zt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Zt.prototype.eat=function(t){var e=this.string.charAt(this.pos);if("string"==typeof t?e==t:e&&(t.test?t.test(e):t(e)))return++this.pos,e},Zt.prototype.eatWhile=function(t){for(var e=this.pos;this.eat(t););return this.pos>e},Zt.prototype.eatSpace=function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},Zt.prototype.skipToEnd=function(){this.pos=this.string.length},Zt.prototype.skipTo=function(t){var e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0},Zt.prototype.backUp=function(t){this.pos-=t},Zt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=F(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?F(this.string,this.lineStart,this.tabSize):0)},Zt.prototype.indentation=function(){return F(this.string,null,this.tabSize)-(this.lineStart?F(this.string,this.lineStart,this.tabSize):0)},Zt.prototype.match=function(t,e,n){if("string"!=typeof t){var r=this.string.slice(this.pos).match(t);return r&&r.index>0?null:(r&&!1!==e&&(this.pos+=r[0].length),r)}var i=function(t){return n?t.toLowerCase():t};if(i(this.string.substr(this.pos,t.length))==i(t))return!1!==e&&(this.pos+=t.length),!0},Zt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Zt.prototype.hideFirstChars=function(t,e){this.lineStart+=t;try{return e()}finally{this.lineStart-=t}},Zt.prototype.lookAhead=function(t){var e=this.lineOracle;return e&&e.lookAhead(t)},Zt.prototype.baseToken=function(){var t=this.lineOracle;return t&&t.baseToken(this.pos)};var me=function(t,e){this.state=t,this.lookAhead=e},ge=function(t,e,n,r){this.state=e,this.doc=t,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function ve(t,e,n,r){var i=[t.state.modeGen],o={};Ee(t,e.text,t.doc.mode,n,(function(t,e){return i.push(t,e)}),o,r);for(var a=n.state,s=function(r){n.baseTokens=i;var s=t.state.overlays[r],l=1,c=0;n.state=!0,Ee(t,e.text,s.mode,n,(function(t,e){for(var n=l;c<t;){var r=i[l];r>t&&i.splice(l,1,t,i[l+1],r),l+=2,c=Math.min(t,r)}if(e)if(s.opaque)i.splice(n,l-n,t,"overlay "+e),l=n+2;else for(;n<l;n+=2){var o=i[n+1];i[n+1]=(o?o+" ":"")+"overlay "+e}}),o),n.state=a,n.baseTokens=null,n.baseTokenPos=1},l=0;l<t.state.overlays.length;++l)s(l);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function ye(t,e,n){if(!e.styles||e.styles[0]!=t.state.modeGen){var r=xe(t,ee(e)),i=e.text.length>t.options.maxHighlightLength&&qt(t.doc.mode,r.state),o=ve(t,e,r);i&&(r.state=i),e.stateAfter=r.save(!i),e.styles=o.styles,o.classes?e.styleClasses=o.classes:e.styleClasses&&(e.styleClasses=null),n===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return e.styles}function xe(t,e,n){var r=t.doc,i=t.display;if(!r.mode.startState)return new ge(r,!0,e);var o=Ce(t,e,n),a=o>r.first&&Jt(r,o-1).stateAfter,s=a?ge.fromSaved(r,a,o):new ge(r,Yt(r.mode),o);return r.iter(o,e,(function(n){be(t,n.text,s);var r=s.line;n.stateAfter=r==e-1||r%5==0||r>=i.viewFrom&&r<i.viewTo?s.save():null,s.nextLine()})),n&&(r.modeFrontier=s.line),s}function be(t,e,n,r){var i=t.doc.mode,o=new Zt(e,t.options.tabSize,n);for(o.start=o.pos=r||0,""==e&&we(i,n.state);!o.eol();)_e(i,o,n.state),o.start=o.pos}function we(t,e){if(t.blankLine)return t.blankLine(e);if(t.innerMode){var n=Xt(t,e);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function _e(t,e,n,r){for(var i=0;i<10;i++){r&&(r[0]=Xt(t,n).mode);var o=t.token(e,n);if(e.pos>e.start)return o}throw new Error("Mode "+t.name+" failed to advance stream.")}ge.prototype.lookAhead=function(t){var e=this.doc.getLine(this.line+t);return null!=e&&t>this.maxLookAhead&&(this.maxLookAhead=t),e},ge.prototype.baseToken=function(t){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=t;)this.baseTokenPos+=2;var e=this.baseTokens[this.baseTokenPos+1];return{type:e&&e.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-t}},ge.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ge.fromSaved=function(t,e,n){return e instanceof me?new ge(t,qt(t.mode,e.state),n,e.lookAhead):new ge(t,qt(t.mode,e),n)},ge.prototype.save=function(t){var e=!1!==t?qt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new me(e,this.maxLookAhead):e};var Me=function(t,e,n){this.start=t.start,this.end=t.pos,this.string=t.current(),this.type=e||null,this.state=n};function Se(t,e,n,r){var i,o,a=t.doc,s=a.mode,l=Jt(a,(e=de(a,e)).line),c=xe(t,e.line,n),u=new Zt(l.text,t.options.tabSize,c);for(r&&(o=[]);(r||u.pos<e.ch)&&!u.eol();)u.start=u.pos,i=_e(s,u,c.state),r&&o.push(new Me(u,i,qt(a.mode,c.state)));return r?o:new Me(u,i,c.state)}function Te(t,e){if(t)for(;;){var n=t.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;t=t.slice(0,n.index)+t.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";null==e[r]?e[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(e[r])||(e[r]+=" "+n[2])}return t}function Ee(t,e,n,r,i,o,a){var s=n.flattenSpans;null==s&&(s=t.options.flattenSpans);var l,c=0,u=null,h=new Zt(e,t.options.tabSize,r),d=t.options.addModeClass&&[null];for(""==e&&Te(we(n,r.state),o);!h.eol();){if(h.pos>t.options.maxHighlightLength?(s=!1,a&&be(t,e,r,h.pos),h.pos=e.length,l=null):l=Te(_e(n,h,r.state,d),o),d){var p=d[0].name;p&&(l="m-"+(l?p+" "+l:p))}if(!s||u!=l){for(;c<h.start;)i(c=Math.min(h.start,c+5e3),u);u=l}h.start=h.pos}for(;c<h.pos;){var f=Math.min(h.pos,c+5e3);i(f,u),c=f}}function Ce(t,e,n){for(var r,i,o=t.doc,a=n?-1:e-(t.doc.mode.innerMode?1e3:100),s=e;s>a;--s){if(s<=o.first)return o.first;var l=Jt(o,s-1),c=l.stateAfter;if(c&&(!n||s+(c instanceof me?c.lookAhead:0)<=o.modeFrontier))return s;var u=F(l.text,null,t.options.tabSize);(null==i||r>u)&&(i=s-1,r=u)}return i}function Le(t,e){if(t.modeFrontier=Math.min(t.modeFrontier,e),!(t.highlightFrontier<e-10)){for(var n=t.first,r=e-1;r>n;r--){var i=Jt(t,r).stateAfter;if(i&&(!(i instanceof me)||r+i.lookAhead<e)){n=r+1;break}}t.highlightFrontier=Math.min(t.highlightFrontier,n)}}var Ae=!1,Re=!1;function Pe(){Ae=!0}function Ne(){Re=!0}function De(t,e,n){this.marker=t,this.from=e,this.to=n}function ke(t,e){if(t)for(var n=0;n<t.length;++n){var r=t[n];if(r.marker==e)return r}}function Ie(t,e){for(var n,r=0;r<t.length;++r)t[r]!=e&&(n||(n=[])).push(t[r]);return n}function Oe(t,e,n){var r=n&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet));r&&r.has(t.markedSpans)?t.markedSpans.push(e):(t.markedSpans=t.markedSpans?t.markedSpans.concat([e]):[e],r&&r.add(t.markedSpans)),e.marker.attachLine(t)}function ze(t,e,n){var r;if(t)for(var i=0;i<t.length;++i){var o=t[i],a=o.marker;if(null==o.from||(a.inclusiveLeft?o.from<=e:o.from<e)||o.from==e&&"bookmark"==a.type&&(!n||!o.marker.insertLeft)){var s=null==o.to||(a.inclusiveRight?o.to>=e:o.to>e);(r||(r=[])).push(new De(a,o.from,s?null:o.to))}}return r}function Fe(t,e,n){var r;if(t)for(var i=0;i<t.length;++i){var o=t[i],a=o.marker;if(null==o.to||(a.inclusiveRight?o.to>=e:o.to>e)||o.from==e&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=e:o.from<e);(r||(r=[])).push(new De(a,s?null:o.from-e,null==o.to?null:o.to-e))}}return r}function Be(t,e){if(e.full)return null;var n=re(t,e.from.line)&&Jt(t,e.from.line).markedSpans,r=re(t,e.to.line)&&Jt(t,e.to.line).markedSpans;if(!n&&!r)return null;var i=e.from.ch,o=e.to.ch,a=0==ae(e.from,e.to),s=ze(n,i,a),l=Fe(r,o,a),c=1==e.text.length,u=Y(e.text).length+(c?i:0);if(s)for(var h=0;h<s.length;++h){var d=s[h];if(null==d.to){var p=ke(l,d.marker);p?c&&(d.to=null==p.to?null:p.to+u):d.to=i}}if(l)for(var f=0;f<l.length;++f){var m=l[f];null!=m.to&&(m.to+=u),null==m.from?ke(s,m.marker)||(m.from=u,c&&(s||(s=[])).push(m)):(m.from+=u,c&&(s||(s=[])).push(m))}s&&(s=Ue(s)),l&&l!=s&&(l=Ue(l));var g=[s];if(!c){var v,y=e.text.length-2;if(y>0&&s)for(var x=0;x<s.length;++x)null==s[x].to&&(v||(v=[])).push(new De(s[x].marker,null,null));for(var b=0;b<y;++b)g.push(v);g.push(l)}return g}function Ue(t){for(var e=0;e<t.length;++e){var n=t[e];null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&t.splice(e--,1)}return t.length?t:null}function He(t,e,n){var r=null;if(t.iter(e.line,n.line+1,(function(t){if(t.markedSpans)for(var e=0;e<t.markedSpans.length;++e){var n=t.markedSpans[e].marker;!n.readOnly||r&&-1!=U(r,n)||(r||(r=[])).push(n)}})),!r)return null;for(var i=[{from:e,to:n}],o=0;o<r.length;++o)for(var a=r[o],s=a.find(0),l=0;l<i.length;++l){var c=i[l];if(!(ae(c.to,s.from)<0||ae(c.from,s.to)>0)){var u=[l,1],h=ae(c.from,s.from),d=ae(c.to,s.to);(h<0||!a.inclusiveLeft&&!h)&&u.push({from:c.from,to:s.from}),(d>0||!a.inclusiveRight&&!d)&&u.push({from:s.to,to:c.to}),i.splice.apply(i,u),l+=u.length-3}}return i}function We(t){var e=t.markedSpans;if(e){for(var n=0;n<e.length;++n)e[n].marker.detachLine(t);t.markedSpans=null}}function Ge(t,e){if(e){for(var n=0;n<e.length;++n)e[n].marker.attachLine(t);t.markedSpans=e}}function Ve(t){return t.inclusiveLeft?-1:0}function je(t){return t.inclusiveRight?1:0}function $e(t,e){var n=t.lines.length-e.lines.length;if(0!=n)return n;var r=t.find(),i=e.find(),o=ae(r.from,i.from)||Ve(t)-Ve(e);if(o)return-o;var a=ae(r.to,i.to)||je(t)-je(e);return a||e.id-t.id}function qe(t,e){var n,r=Re&&t.markedSpans;if(r)for(var i=void 0,o=0;o<r.length;++o)(i=r[o]).marker.collapsed&&null==(e?i.from:i.to)&&(!n||$e(n,i.marker)<0)&&(n=i.marker);return n}function Xe(t){return qe(t,!0)}function Ye(t){return qe(t,!1)}function Ze(t,e){var n,r=Re&&t.markedSpans;if(r)for(var i=0;i<r.length;++i){var o=r[i];o.marker.collapsed&&(null==o.from||o.from<e)&&(null==o.to||o.to>e)&&(!n||$e(n,o.marker)<0)&&(n=o.marker)}return n}function Je(t,e,n,r,i){var o=Jt(t,e),a=Re&&o.markedSpans;if(a)for(var s=0;s<a.length;++s){var l=a[s];if(l.marker.collapsed){var c=l.marker.find(0),u=ae(c.from,n)||Ve(l.marker)-Ve(i),h=ae(c.to,r)||je(l.marker)-je(i);if(!(u>=0&&h<=0||u<=0&&h>=0)&&(u<=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?ae(c.to,n)>=0:ae(c.to,n)>0)||u>=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?ae(c.from,r)<=0:ae(c.from,r)<0)))return!0}}}function Ke(t){for(var e;e=Xe(t);)t=e.find(-1,!0).line;return t}function Qe(t){for(var e;e=Ye(t);)t=e.find(1,!0).line;return t}function tn(t){for(var e,n;e=Ye(t);)t=e.find(1,!0).line,(n||(n=[])).push(t);return n}function en(t,e){var n=Jt(t,e),r=Ke(n);return n==r?e:ee(r)}function nn(t,e){if(e>t.lastLine())return e;var n,r=Jt(t,e);if(!rn(t,r))return e;for(;n=Ye(r);)r=n.find(1,!0).line;return ee(r)+1}function rn(t,e){var n=Re&&e.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i)if((r=n[i]).marker.collapsed){if(null==r.from)return!0;if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&on(t,e,r))return!0}}function on(t,e,n){if(null==n.to){var r=n.marker.find(1,!0);return on(t,r.line,ke(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==e.text.length)return!0;for(var i=void 0,o=0;o<e.markedSpans.length;++o)if((i=e.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(null==i.to||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&on(t,e,i))return!0}function an(t){for(var e=0,n=(t=Ke(t)).parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==t)break;e+=i.height}for(var o=n.parent;o;o=(n=o).parent)for(var a=0;a<o.children.length;++a){var s=o.children[a];if(s==n)break;e+=s.height}return e}function sn(t){if(0==t.height)return 0;for(var e,n=t.text.length,r=t;e=Xe(r);){var i=e.find(0,!0);r=i.from.line,n+=i.from.ch-i.to.ch}for(r=t;e=Ye(r);){var o=e.find(0,!0);n-=r.text.length-o.from.ch,n+=(r=o.to.line).text.length-o.to.ch}return n}function ln(t){var e=t.display,n=t.doc;e.maxLine=Jt(n,n.first),e.maxLineLength=sn(e.maxLine),e.maxLineChanged=!0,n.iter((function(t){var n=sn(t);n>e.maxLineLength&&(e.maxLineLength=n,e.maxLine=t)}))}var cn=function(t,e,n){this.text=t,Ge(this,e),this.height=n?n(this):1};function un(t,e,n,r){t.text=e,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),null!=t.order&&(t.order=null),We(t),Ge(t,n);var i=r?r(t):1;i!=t.height&&te(t,i)}function hn(t){t.parent=null,We(t)}cn.prototype.lineNo=function(){return ee(this)},wt(cn);var dn={},pn={};function fn(t,e){if(!t||/^\s*$/.test(t))return null;var n=e.addModeClass?pn:dn;return n[t]||(n[t]=t.replace(/\S+/g,"cm-$&"))}function mn(t,e){var n=R("span",null,null,l?"padding-right: .1px":null),r={pre:R("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:t,trailingSpace:!1,splitSpaces:t.getOption("lineWrapping")};e.measure={};for(var i=0;i<=(e.rest?e.rest.length:0);i++){var o=i?e.rest[i-1]:e.line,a=void 0;r.pos=0,r.addToken=vn,Nt(t.display.measure)&&(a=dt(o,t.doc.direction))&&(r.addToken=xn(r.addToken,a)),r.map=[],wn(o,r,ye(t,o,e!=t.display.externalMeasured&&ee(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=k(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=k(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Pt(t.display.measure))),0==i?(e.measure.map=r.map,e.measure.cache={}):((e.measure.maps||(e.measure.maps=[])).push(r.map),(e.measure.caches||(e.measure.caches=[])).push({}))}if(l){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return vt(t,"renderLine",t,e.line,r.pre),r.pre.className&&(r.textClass=k(r.pre.className,r.textClass||"")),r}function gn(t){var e=A("span","•","cm-invalidchar");return e.title="\\u"+t.charCodeAt(0).toString(16),e.setAttribute("aria-label",e.title),e}function vn(t,e,n,r,i,o,l){if(e){var c,u=t.splitSpaces?yn(e,t.trailingSpace):e,h=t.cm.state.specialChars,d=!1;if(h.test(e)){c=document.createDocumentFragment();for(var p=0;;){h.lastIndex=p;var f=h.exec(e),m=f?f.index-p:e.length-p;if(m){var g=document.createTextNode(u.slice(p,p+m));a&&s<9?c.appendChild(A("span",[g])):c.appendChild(g),t.map.push(t.pos,t.pos+m,g),t.col+=m,t.pos+=m}if(!f)break;p+=m+1;var v=void 0;if("\t"==f[0]){var y=t.cm.options.tabSize,x=y-t.col%y;(v=c.appendChild(A("span",X(x),"cm-tab"))).setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),t.col+=x}else"\r"==f[0]||"\n"==f[0]?((v=c.appendChild(A("span","\r"==f[0]?"␍":"","cm-invalidchar"))).setAttribute("cm-text",f[0]),t.col+=1):((v=t.cm.options.specialCharPlaceholder(f[0])).setAttribute("cm-text",f[0]),a&&s<9?c.appendChild(A("span",[v])):c.appendChild(v),t.col+=1);t.map.push(t.pos,t.pos+1,v),t.pos++}}else t.col+=e.length,c=document.createTextNode(u),t.map.push(t.pos,t.pos+e.length,c),a&&s<9&&(d=!0),t.pos+=e.length;if(t.trailingSpace=32==u.charCodeAt(e.length-1),n||r||i||d||o||l){var b=n||"";r&&(b+=r),i&&(b+=i);var w=A("span",[c],b,o);if(l)for(var _ in l)l.hasOwnProperty(_)&&"style"!=_&&"class"!=_&&w.setAttribute(_,l[_]);return t.content.appendChild(w)}t.content.appendChild(c)}}function yn(t,e){if(t.length>1&&!/ /.test(t))return t;for(var n=e,r="",i=0;i<t.length;i++){var o=t.charAt(i);" "!=o||!n||i!=t.length-1&&32!=t.charCodeAt(i+1)||(o=" "),r+=o,n=" "==o}return r}function xn(t,e){return function(n,r,i,o,a,s,l){i=i?i+" cm-force-border":"cm-force-border";for(var c=n.pos,u=c+r.length;;){for(var h=void 0,d=0;d<e.length&&!((h=e[d]).to>c&&h.from<=c);d++);if(h.to>=u)return t(n,r,i,o,a,s,l);t(n,r.slice(0,h.to-c),i,o,null,s,l),o=null,r=r.slice(h.to-c),c=h.to}}}function bn(t,e,n,r){var i=!r&&n.widgetNode;i&&t.map.push(t.pos,t.pos+e,i),!r&&t.cm.display.input.needsContentAttribute&&(i||(i=t.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(t.cm.display.input.setUneditable(i),t.content.appendChild(i)),t.pos+=e,t.trailingSpace=!1}function wn(t,e,n){var r=t.markedSpans,i=t.text,o=0;if(r)for(var a,s,l,c,u,h,d,p=i.length,f=0,m=1,g="",v=0;;){if(v==f){l=c=u=s="",d=null,h=null,v=1/0;for(var y=[],x=void 0,b=0;b<r.length;++b){var w=r[b],_=w.marker;if("bookmark"==_.type&&w.from==f&&_.widgetNode)y.push(_);else if(w.from<=f&&(null==w.to||w.to>f||_.collapsed&&w.to==f&&w.from==f)){if(null!=w.to&&w.to!=f&&v>w.to&&(v=w.to,c=""),_.className&&(l+=" "+_.className),_.css&&(s=(s?s+";":"")+_.css),_.startStyle&&w.from==f&&(u+=" "+_.startStyle),_.endStyle&&w.to==v&&(x||(x=[])).push(_.endStyle,w.to),_.title&&((d||(d={})).title=_.title),_.attributes)for(var M in _.attributes)(d||(d={}))[M]=_.attributes[M];_.collapsed&&(!h||$e(h.marker,_)<0)&&(h=w)}else w.from>f&&v>w.from&&(v=w.from)}if(x)for(var S=0;S<x.length;S+=2)x[S+1]==v&&(c+=" "+x[S]);if(!h||h.from==f)for(var T=0;T<y.length;++T)bn(e,0,y[T]);if(h&&(h.from||0)==f){if(bn(e,(null==h.to?p+1:h.to)-f,h.marker,null==h.from),null==h.to)return;h.to==f&&(h=!1)}}if(f>=p)break;for(var E=Math.min(p,v);;){if(g){var C=f+g.length;if(!h){var L=C>E?g.slice(0,E-f):g;e.addToken(e,L,a?a+l:l,u,f+L.length==v?c:"",s,d)}if(C>=E){g=g.slice(E-f),f=E;break}f=C,u=""}g=i.slice(o,o=n[m++]),a=fn(n[m++],e.cm.options)}}else for(var A=1;A<n.length;A+=2)e.addToken(e,i.slice(o,o=n[A]),fn(n[A+1],e.cm.options))}function _n(t,e,n){this.line=e,this.rest=tn(e),this.size=this.rest?ee(Y(this.rest))-n+1:1,this.node=this.text=null,this.hidden=rn(t,e)}function Mn(t,e,n){for(var r,i=[],o=e;o<n;o=r){var a=new _n(t.doc,Jt(t.doc,o),o);r=o+a.size,i.push(a)}return i}var Sn=null;function Tn(t){Sn?Sn.ops.push(t):t.ownsGroup=Sn={ops:[t],delayedCallbacks:[]}}function En(t){var e=t.delayedCallbacks,n=0;do{for(;n<e.length;n++)e[n].call(null);for(var r=0;r<t.ops.length;r++){var i=t.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<e.length)}function Cn(t,e){var n=t.ownsGroup;if(n)try{En(n)}finally{Sn=null,e(n)}}var Ln=null;function An(t,e){var n=mt(t,e);if(n.length){var r,i=Array.prototype.slice.call(arguments,2);Sn?r=Sn.delayedCallbacks:Ln?r=Ln:(r=Ln=[],setTimeout(Rn,0));for(var o=function(t){r.push((function(){return n[t].apply(null,i)}))},a=0;a<n.length;++a)o(a)}}function Rn(){var t=Ln;Ln=null;for(var e=0;e<t.length;++e)t[e]()}function Pn(t,e,n,r){for(var i=0;i<e.changes.length;i++){var o=e.changes[i];"text"==o?In(t,e):"gutter"==o?zn(t,e,n,r):"class"==o?On(t,e):"widget"==o&&Fn(t,e,r)}e.changes=null}function Nn(t){return t.node==t.text&&(t.node=A("div",null,null,"position: relative"),t.text.parentNode&&t.text.parentNode.replaceChild(t.node,t.text),t.node.appendChild(t.text),a&&s<8&&(t.node.style.zIndex=2)),t.node}function Dn(t,e){var n=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),e.background)n?e.background.className=n:(e.background.parentNode.removeChild(e.background),e.background=null);else if(n){var r=Nn(e);e.background=r.insertBefore(A("div",null,n),r.firstChild),t.display.input.setUneditable(e.background)}}function kn(t,e){var n=t.display.externalMeasured;return n&&n.line==e.line?(t.display.externalMeasured=null,e.measure=n.measure,n.built):mn(t,e)}function In(t,e){var n=e.text.className,r=kn(t,e);e.text==e.node&&(e.node=r.pre),e.text.parentNode.replaceChild(r.pre,e.text),e.text=r.pre,r.bgClass!=e.bgClass||r.textClass!=e.textClass?(e.bgClass=r.bgClass,e.textClass=r.textClass,On(t,e)):n&&(e.text.className=n)}function On(t,e){Dn(t,e),e.line.wrapClass?Nn(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var n=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=n||""}function zn(t,e,n,r){if(e.gutter&&(e.node.removeChild(e.gutter),e.gutter=null),e.gutterBackground&&(e.node.removeChild(e.gutterBackground),e.gutterBackground=null),e.line.gutterClass){var i=Nn(e);e.gutterBackground=A("div",null,"CodeMirror-gutter-background "+e.line.gutterClass,"left: "+(t.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),t.display.input.setUneditable(e.gutterBackground),i.insertBefore(e.gutterBackground,e.text)}var o=e.line.gutterMarkers;if(t.options.lineNumbers||o){var a=Nn(e),s=e.gutter=A("div",null,"CodeMirror-gutter-wrapper","left: "+(t.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(s.setAttribute("aria-hidden","true"),t.display.input.setUneditable(s),a.insertBefore(s,e.text),e.line.gutterClass&&(s.className+=" "+e.line.gutterClass),!t.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(e.lineNumber=s.appendChild(A("div",ie(t.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+t.display.lineNumInnerWidth+"px"))),o)for(var l=0;l<t.display.gutterSpecs.length;++l){var c=t.display.gutterSpecs[l].className,u=o.hasOwnProperty(c)&&o[c];u&&s.appendChild(A("div",[u],"CodeMirror-gutter-elt","left: "+r.gutterLeft[c]+"px; width: "+r.gutterWidth[c]+"px"))}}}function Fn(t,e,n){e.alignable&&(e.alignable=null);for(var r=S("CodeMirror-linewidget"),i=e.node.firstChild,o=void 0;i;i=o)o=i.nextSibling,r.test(i.className)&&e.node.removeChild(i);Un(t,e,n)}function Bn(t,e,n,r){var i=kn(t,e);return e.text=e.node=i.pre,i.bgClass&&(e.bgClass=i.bgClass),i.textClass&&(e.textClass=i.textClass),On(t,e),zn(t,e,n,r),Un(t,e,r),e.node}function Un(t,e,n){if(Hn(t,e.line,e,n,!0),e.rest)for(var r=0;r<e.rest.length;r++)Hn(t,e.rest[r],e,n,!1)}function Hn(t,e,n,r,i){if(e.widgets)for(var o=Nn(n),a=0,s=e.widgets;a<s.length;++a){var l=s[a],c=A("div",[l.node],"CodeMirror-linewidget"+(l.className?" "+l.className:""));l.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),Wn(l,c,n,r),t.display.input.setUneditable(c),i&&l.above?o.insertBefore(c,n.gutter||n.text):o.appendChild(c),An(l,"redraw")}}function Wn(t,e,n,r){if(t.noHScroll){(n.alignable||(n.alignable=[])).push(e);var i=r.wrapperWidth;e.style.left=r.fixedPos+"px",t.coverGutter||(i-=r.gutterTotalWidth,e.style.paddingLeft=r.gutterTotalWidth+"px"),e.style.width=i+"px"}t.coverGutter&&(e.style.zIndex=5,e.style.position="relative",t.noHScroll||(e.style.marginLeft=-r.gutterTotalWidth+"px"))}function Gn(t){if(null!=t.height)return t.height;var e=t.doc.cm;if(!e)return 0;if(!P(document.body,t.node)){var n="position: relative;";t.coverGutter&&(n+="margin-left: -"+e.display.gutters.offsetWidth+"px;"),t.noHScroll&&(n+="width: "+e.display.wrapper.clientWidth+"px;"),L(e.display.measure,A("div",[t.node],null,n))}return t.height=t.node.parentNode.offsetHeight}function Vn(t,e){for(var n=Et(e);n!=t.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==t.sizer&&n!=t.mover)return!0}function jn(t){return t.lineSpace.offsetTop}function $n(t){return t.mover.offsetHeight-t.lineSpace.offsetHeight}function qn(t){if(t.cachedPaddingH)return t.cachedPaddingH;var e=L(t.measure,A("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(e):e.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return isNaN(r.left)||isNaN(r.right)||(t.cachedPaddingH=r),r}function Xn(t){return H-t.display.nativeBarWidth}function Yn(t){return t.display.scroller.clientWidth-Xn(t)-t.display.barWidth}function Zn(t){return t.display.scroller.clientHeight-Xn(t)-t.display.barHeight}function Jn(t,e,n){var r=t.options.lineWrapping,i=r&&Yn(t);if(!e.measure.heights||r&&e.measure.width!=i){var o=e.measure.heights=[];if(r){e.measure.width=i;for(var a=e.text.firstChild.getClientRects(),s=0;s<a.length-1;s++){var l=a[s],c=a[s+1];Math.abs(l.bottom-c.bottom)>2&&o.push((l.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Kn(t,e,n){if(t.line==e)return{map:t.measure.map,cache:t.measure.cache};if(t.rest){for(var r=0;r<t.rest.length;r++)if(t.rest[r]==e)return{map:t.measure.maps[r],cache:t.measure.caches[r]};for(var i=0;i<t.rest.length;i++)if(ee(t.rest[i])>n)return{map:t.measure.maps[i],cache:t.measure.caches[i],before:!0}}}function Qn(t,e){var n=ee(e=Ke(e)),r=t.display.externalMeasured=new _n(t.doc,e,n);r.lineN=n;var i=r.built=mn(t,r);return r.text=i.pre,L(t.display.lineMeasure,i.pre),r}function tr(t,e,n,r){return rr(t,nr(t,e),n,r)}function er(t,e){if(e>=t.display.viewFrom&&e<t.display.viewTo)return t.display.view[Or(t,e)];var n=t.display.externalMeasured;return n&&e>=n.lineN&&e<n.lineN+n.size?n:void 0}function nr(t,e){var n=ee(e),r=er(t,n);r&&!r.text?r=null:r&&r.changes&&(Pn(t,r,n,Pr(t)),t.curOp.forceUpdate=!0),r||(r=Qn(t,e));var i=Kn(r,e,n);return{line:e,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function rr(t,e,n,r,i){e.before&&(n=-1);var o,a=n+(r||"");return e.cache.hasOwnProperty(a)?o=e.cache[a]:(e.rect||(e.rect=e.view.text.getBoundingClientRect()),e.hasHeights||(Jn(t,e.view,e.rect),e.hasHeights=!0),(o=lr(t,e,n,r)).bogus||(e.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var ir,or={left:0,right:0,top:0,bottom:0};function ar(t,e,n){for(var r,i,o,a,s,l,c=0;c<t.length;c+=3)if(s=t[c],l=t[c+1],e<s?(i=0,o=1,a="left"):e<l?o=1+(i=e-s):(c==t.length-3||e==l&&t[c+3]>e)&&(i=(o=l-s)-1,e>=l&&(a="right")),null!=i){if(r=t[c+2],s==l&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;c&&t[c-2]==t[c-3]&&t[c-1].insertLeft;)r=t[2+(c-=3)],a="left";if("right"==n&&i==l-s)for(;c<t.length-3&&t[c+3]==t[c+4]&&!t[c+5].insertLeft;)r=t[(c+=3)+2],a="right";break}return{node:r,start:i,end:o,collapse:a,coverStart:s,coverEnd:l}}function sr(t,e){var n=or;if("left"==e)for(var r=0;r<t.length&&(n=t[r]).left==n.right;r++);else for(var i=t.length-1;i>=0&&(n=t[i]).left==n.right;i--);return n}function lr(t,e,n,r){var i,o=ar(e.map,n,r),l=o.node,c=o.start,u=o.end,h=o.collapse;if(3==l.nodeType){for(var d=0;d<4;d++){for(;c&&ot(e.line.text.charAt(o.coverStart+c));)--c;for(;o.coverStart+u<o.coverEnd&&ot(e.line.text.charAt(o.coverStart+u));)++u;if((i=a&&s<9&&0==c&&u==o.coverEnd-o.coverStart?l.parentNode.getBoundingClientRect():sr(T(l,c,u).getClientRects(),r)).left||i.right||0==c)break;u=c,c-=1,h="right"}a&&s<11&&(i=cr(t.display.measure,i))}else{var p;c>0&&(h=r="right"),i=t.options.lineWrapping&&(p=l.getClientRects()).length>1?p["right"==r?p.length-1:0]:l.getBoundingClientRect()}if(a&&s<9&&!c&&(!i||!i.left&&!i.right)){var f=l.parentNode.getClientRects()[0];i=f?{left:f.left,right:f.left+Rr(t.display),top:f.top,bottom:f.bottom}:or}for(var m=i.top-e.rect.top,g=i.bottom-e.rect.top,v=(m+g)/2,y=e.view.measure.heights,x=0;x<y.length-1&&!(v<y[x]);x++);var b=x?y[x-1]:0,w=y[x],_={left:("right"==h?i.right:i.left)-e.rect.left,right:("left"==h?i.left:i.right)-e.rect.left,top:b,bottom:w};return i.left||i.right||(_.bogus=!0),t.options.singleCursorHeightPerLine||(_.rtop=m,_.rbottom=g),_}function cr(t,e){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Ft(t))return e;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:e.left*n,right:e.right*n,top:e.top*r,bottom:e.bottom*r}}function ur(t){if(t.measure&&(t.measure.cache={},t.measure.heights=null,t.rest))for(var e=0;e<t.rest.length;e++)t.measure.caches[e]={}}function hr(t){t.display.externalMeasure=null,C(t.display.lineMeasure);for(var e=0;e<t.display.view.length;e++)ur(t.display.view[e])}function dr(t){hr(t),t.display.cachedCharWidth=t.display.cachedTextHeight=t.display.cachedPaddingH=null,t.options.lineWrapping||(t.display.maxLineChanged=!0),t.display.lineNumChars=null}function pr(){return u&&g?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function fr(){return u&&g?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function mr(t){var e=0;if(t.widgets)for(var n=0;n<t.widgets.length;++n)t.widgets[n].above&&(e+=Gn(t.widgets[n]));return e}function gr(t,e,n,r,i){if(!i){var o=mr(e);n.top+=o,n.bottom+=o}if("line"==r)return n;r||(r="local");var a=an(e);if("local"==r?a+=jn(t.display):a-=t.display.viewOffset,"page"==r||"window"==r){var s=t.display.lineSpace.getBoundingClientRect();a+=s.top+("window"==r?0:fr());var l=s.left+("window"==r?0:pr());n.left+=l,n.right+=l}return n.top+=a,n.bottom+=a,n}function vr(t,e,n){if("div"==n)return e;var r=e.left,i=e.top;if("page"==n)r-=pr(),i-=fr();else if("local"==n||!n){var o=t.display.sizer.getBoundingClientRect();r+=o.left,i+=o.top}var a=t.display.lineSpace.getBoundingClientRect();return{left:r-a.left,top:i-a.top}}function yr(t,e,n,r,i){return r||(r=Jt(t.doc,e.line)),gr(t,r,tr(t,r,e.ch,i),n)}function xr(t,e,n,r,i,o){function a(e,a){var s=rr(t,i,e,a?"right":"left",o);return a?s.left=s.right:s.right=s.left,gr(t,r,s,n)}r=r||Jt(t.doc,e.line),i||(i=nr(t,r));var s=dt(r,t.doc.direction),l=e.ch,c=e.sticky;if(l>=r.text.length?(l=r.text.length,c="before"):l<=0&&(l=0,c="after"),!s)return a("before"==c?l-1:l,"before"==c);function u(t,e,n){return a(n?t-1:t,1==s[e].level!=n)}var h=ut(s,l,c),d=ct,p=u(l,h,"before"==c);return null!=d&&(p.other=u(l,d,"before"!=c)),p}function br(t,e){var n=0;e=de(t.doc,e),t.options.lineWrapping||(n=Rr(t.display)*e.ch);var r=Jt(t.doc,e.line),i=an(r)+jn(t.display);return{left:n,right:n,top:i,bottom:i+r.height}}function wr(t,e,n,r,i){var o=oe(t,e,n);return o.xRel=i,r&&(o.outside=r),o}function _r(t,e,n){var r=t.doc;if((n+=t.display.viewOffset)<0)return wr(r.first,0,null,-1,-1);var i=ne(r,n),o=r.first+r.size-1;if(i>o)return wr(r.first+r.size-1,Jt(r,o).text.length,null,1,1);e<0&&(e=0);for(var a=Jt(r,i);;){var s=Er(t,a,i,e,n),l=Ze(a,s.ch+(s.xRel>0||s.outside>0?1:0));if(!l)return s;var c=l.find(1);if(c.line==i)return c;a=Jt(r,i=c.line)}}function Mr(t,e,n,r){r-=mr(e);var i=e.text.length,o=st((function(e){return rr(t,n,e-1).bottom<=r}),i,0);return{begin:o,end:i=st((function(e){return rr(t,n,e).top>r}),o,i)}}function Sr(t,e,n,r){return n||(n=nr(t,e)),Mr(t,e,n,gr(t,e,rr(t,n,r),"line").top)}function Tr(t,e,n,r){return!(t.bottom<=n)&&(t.top>n||(r?t.left:t.right)>e)}function Er(t,e,n,r,i){i-=an(e);var o=nr(t,e),a=mr(e),s=0,l=e.text.length,c=!0,u=dt(e,t.doc.direction);if(u){var h=(t.options.lineWrapping?Lr:Cr)(t,e,n,o,u,r,i);s=(c=1!=h.level)?h.from:h.to-1,l=c?h.to:h.from-1}var d,p,f=null,m=null,g=st((function(e){var n=rr(t,o,e);return n.top+=a,n.bottom+=a,!!Tr(n,r,i,!1)&&(n.top<=i&&n.left<=r&&(f=e,m=n),!0)}),s,l),v=!1;if(m){var y=r-m.left<m.right-r,x=y==c;g=f+(x?0:1),p=x?"after":"before",d=y?m.left:m.right}else{c||g!=l&&g!=s||g++,p=0==g?"after":g==e.text.length?"before":rr(t,o,g-(c?1:0)).bottom+a<=i==c?"after":"before";var b=xr(t,oe(n,g,p),"line",e,o);d=b.left,v=i<b.top?-1:i>=b.bottom?1:0}return wr(n,g=at(e.text,g,1),p,v,r-d)}function Cr(t,e,n,r,i,o,a){var s=st((function(s){var l=i[s],c=1!=l.level;return Tr(xr(t,oe(n,c?l.to:l.from,c?"before":"after"),"line",e,r),o,a,!0)}),0,i.length-1),l=i[s];if(s>0){var c=1!=l.level,u=xr(t,oe(n,c?l.from:l.to,c?"after":"before"),"line",e,r);Tr(u,o,a,!0)&&u.top>a&&(l=i[s-1])}return l}function Lr(t,e,n,r,i,o,a){var s=Mr(t,e,r,a),l=s.begin,c=s.end;/\s/.test(e.text.charAt(c-1))&&c--;for(var u=null,h=null,d=0;d<i.length;d++){var p=i[d];if(!(p.from>=c||p.to<=l)){var f=rr(t,r,1!=p.level?Math.min(c,p.to)-1:Math.max(l,p.from)).right,m=f<o?o-f+1e9:f-o;(!u||h>m)&&(u=p,h=m)}}return u||(u=i[i.length-1]),u.from<l&&(u={from:l,to:u.to,level:u.level}),u.to>c&&(u={from:u.from,to:c,level:u.level}),u}function Ar(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==ir){ir=A("pre",null,"CodeMirror-line-like");for(var e=0;e<49;++e)ir.appendChild(document.createTextNode("x")),ir.appendChild(A("br"));ir.appendChild(document.createTextNode("x"))}L(t.measure,ir);var n=ir.offsetHeight/50;return n>3&&(t.cachedTextHeight=n),C(t.measure),n||1}function Rr(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=A("span","xxxxxxxxxx"),n=A("pre",[e],"CodeMirror-line-like");L(t.measure,n);var r=e.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(t.cachedCharWidth=i),i||10}function Pr(t){for(var e=t.display,n={},r={},i=e.gutters.clientLeft,o=e.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var s=t.display.gutterSpecs[a].className;n[s]=o.offsetLeft+o.clientLeft+i,r[s]=o.clientWidth}return{fixedPos:Nr(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:e.wrapper.clientWidth}}function Nr(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function Dr(t){var e=Ar(t.display),n=t.options.lineWrapping,r=n&&Math.max(5,t.display.scroller.clientWidth/Rr(t.display)-3);return function(i){if(rn(t.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return n?o+(Math.ceil(i.text.length/r)||1)*e:o+e}}function kr(t){var e=t.doc,n=Dr(t);e.iter((function(t){var e=n(t);e!=t.height&&te(t,e)}))}function Ir(t,e,n,r){var i=t.display;if(!n&&"true"==Et(e).getAttribute("cm-not-content"))return null;var o,a,s=i.lineSpace.getBoundingClientRect();try{o=e.clientX-s.left,a=e.clientY-s.top}catch(t){return null}var l,c=_r(t,o,a);if(r&&c.xRel>0&&(l=Jt(t.doc,c.line).text).length==c.ch){var u=F(l,l.length,t.options.tabSize)-l.length;c=oe(c.line,Math.max(0,Math.round((o-qn(t.display).left)/Rr(t.display))-u))}return c}function Or(t,e){if(e>=t.display.viewTo)return null;if((e-=t.display.viewFrom)<0)return null;for(var n=t.display.view,r=0;r<n.length;r++)if((e-=n[r].size)<0)return r}function zr(t,e,n,r){null==e&&(e=t.doc.first),null==n&&(n=t.doc.first+t.doc.size),r||(r=0);var i=t.display;if(r&&n<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>e)&&(i.updateLineNumbers=e),t.curOp.viewChanged=!0,e>=i.viewTo)Re&&en(t.doc,e)<i.viewTo&&Br(t);else if(n<=i.viewFrom)Re&&nn(t.doc,n+r)>i.viewFrom?Br(t):(i.viewFrom+=r,i.viewTo+=r);else if(e<=i.viewFrom&&n>=i.viewTo)Br(t);else if(e<=i.viewFrom){var o=Ur(t,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):Br(t)}else if(n>=i.viewTo){var a=Ur(t,e,e,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):Br(t)}else{var s=Ur(t,e,e,-1),l=Ur(t,n,n+r,1);s&&l?(i.view=i.view.slice(0,s.index).concat(Mn(t,s.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=r):Br(t)}var c=i.externalMeasured;c&&(n<c.lineN?c.lineN+=r:e<c.lineN+c.size&&(i.externalMeasured=null))}function Fr(t,e,n){t.curOp.viewChanged=!0;var r=t.display,i=t.display.externalMeasured;if(i&&e>=i.lineN&&e<i.lineN+i.size&&(r.externalMeasured=null),!(e<r.viewFrom||e>=r.viewTo)){var o=r.view[Or(t,e)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==U(a,n)&&a.push(n)}}}function Br(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function Ur(t,e,n,r){var i,o=Or(t,e),a=t.display.view;if(!Re||n==t.doc.first+t.doc.size)return{index:o,lineN:n};for(var s=t.display.viewFrom,l=0;l<o;l++)s+=a[l].size;if(s!=e){if(r>0){if(o==a.length-1)return null;i=s+a[o].size-e,o++}else i=s-e;e+=i,n+=i}for(;en(t.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null;n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function Hr(t,e,n){var r=t.display;0==r.view.length||e>=r.viewTo||n<=r.viewFrom?(r.view=Mn(t,e,n),r.viewFrom=e):(r.viewFrom>e?r.view=Mn(t,e,r.viewFrom).concat(r.view):r.viewFrom<e&&(r.view=r.view.slice(Or(t,e))),r.viewFrom=e,r.viewTo<n?r.view=r.view.concat(Mn(t,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Or(t,n)))),r.viewTo=n}function Wr(t){for(var e=t.display.view,n=0,r=0;r<e.length;r++){var i=e[r];i.hidden||i.node&&!i.changes||++n}return n}function Gr(t){t.display.input.showSelection(t.display.input.prepareSelection())}function Vr(t,e){void 0===e&&(e=!0);var n=t.doc,r={},i=r.cursors=document.createDocumentFragment(),o=r.selection=document.createDocumentFragment(),a=t.options.$customCursor;a&&(e=!0);for(var s=0;s<n.sel.ranges.length;s++)if(e||s!=n.sel.primIndex){var l=n.sel.ranges[s];if(!(l.from().line>=t.display.viewTo||l.to().line<t.display.viewFrom)){var c=l.empty();if(a){var u=a(t,l);u&&jr(t,u,i)}else(c||t.options.showCursorWhenSelecting)&&jr(t,l.head,i);c||qr(t,l,o)}}return r}function jr(t,e,n){var r=xr(t,e,"div",null,null,!t.options.singleCursorHeightPerLine),i=n.appendChild(A("div"," ","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*t.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(t.getWrapperElement().className)){var o=yr(t,e,"div",null,null),a=o.right-o.left;i.style.width=(a>0?a:t.defaultCharWidth())+"px"}if(r.other){var s=n.appendChild(A("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));s.style.display="",s.style.left=r.other.left+"px",s.style.top=r.other.top+"px",s.style.height=.85*(r.other.bottom-r.other.top)+"px"}}function $r(t,e){return t.top-e.top||t.left-e.left}function qr(t,e,n){var r=t.display,i=t.doc,o=document.createDocumentFragment(),a=qn(t.display),s=a.left,l=Math.max(r.sizerWidth,Yn(t)-r.sizer.offsetLeft)-a.right,c="ltr"==i.direction;function u(t,e,n,r){e<0&&(e=0),e=Math.round(e),r=Math.round(r),o.appendChild(A("div",null,"CodeMirror-selected","position: absolute; left: "+t+"px;\n top: "+e+"px; width: "+(null==n?l-t:n)+"px;\n height: "+(r-e)+"px"))}function h(e,n,r){var o,a,h=Jt(i,e),d=h.text.length;function p(n,r){return yr(t,oe(e,n),"div",h,r)}function f(e,n,r){var i=Sr(t,h,null,e),o="ltr"==n==("after"==r)?"left":"right";return p("after"==r?i.begin:i.end-(/\s/.test(h.text.charAt(i.end-1))?2:1),o)[o]}var m=dt(h,i.direction);return lt(m,n||0,null==r?d:r,(function(t,e,i,h){var g="ltr"==i,v=p(t,g?"left":"right"),y=p(e-1,g?"right":"left"),x=null==n&&0==t,b=null==r&&e==d,w=0==h,_=!m||h==m.length-1;if(y.top-v.top<=3){var M=(c?b:x)&&_,S=(c?x:b)&&w?s:(g?v:y).left,T=M?l:(g?y:v).right;u(S,v.top,T-S,v.bottom)}else{var E,C,L,A;g?(E=c&&x&&w?s:v.left,C=c?l:f(t,i,"before"),L=c?s:f(e,i,"after"),A=c&&b&&_?l:y.right):(E=c?f(t,i,"before"):s,C=!c&&x&&w?l:v.right,L=!c&&b&&_?s:y.left,A=c?f(e,i,"after"):l),u(E,v.top,C-E,v.bottom),v.bottom<y.top&&u(s,v.bottom,null,y.top),u(L,y.top,A-L,y.bottom)}(!o||$r(v,o)<0)&&(o=v),$r(y,o)<0&&(o=y),(!a||$r(v,a)<0)&&(a=v),$r(y,a)<0&&(a=y)})),{start:o,end:a}}var d=e.from(),p=e.to();if(d.line==p.line)h(d.line,d.ch,p.ch);else{var f=Jt(i,d.line),m=Jt(i,p.line),g=Ke(f)==Ke(m),v=h(d.line,d.ch,g?f.text.length+1:null).end,y=h(p.line,g?0:null,p.ch).start;g&&(v.top<y.top-2?(u(v.right,v.top,null,v.bottom),u(s,y.top,y.left,y.bottom)):u(v.right,v.top,y.left-v.right,v.bottom)),v.bottom<y.top&&u(s,v.bottom,null,y.top)}n.appendChild(o)}function Xr(t){if(t.state.focused){var e=t.display;clearInterval(e.blinker);var n=!0;e.cursorDiv.style.visibility="",t.options.cursorBlinkRate>0?e.blinker=setInterval((function(){t.hasFocus()||Kr(t),e.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(e.cursorDiv.style.visibility="hidden")}}function Yr(t){t.hasFocus()||(t.display.input.focus(),t.state.focused||Jr(t))}function Zr(t){t.state.delayingBlurEvent=!0,setTimeout((function(){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,t.state.focused&&Kr(t))}),100)}function Jr(t,e){t.state.delayingBlurEvent&&!t.state.draggingText&&(t.state.delayingBlurEvent=!1),"nocursor"!=t.options.readOnly&&(t.state.focused||(vt(t,"focus",t,e),t.state.focused=!0,D(t.display.wrapper,"CodeMirror-focused"),t.curOp||t.display.selForContextMenu==t.doc.sel||(t.display.input.reset(),l&&setTimeout((function(){return t.display.input.reset(!0)}),20)),t.display.input.receivedFocus()),Xr(t))}function Kr(t,e){t.state.delayingBlurEvent||(t.state.focused&&(vt(t,"blur",t,e),t.state.focused=!1,E(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout((function(){t.state.focused||(t.display.shift=!1)}),150))}function Qr(t){for(var e=t.display,n=e.lineDiv.offsetTop,r=Math.max(0,e.scroller.getBoundingClientRect().top),i=e.lineDiv.getBoundingClientRect().top,o=0,l=0;l<e.view.length;l++){var c=e.view[l],u=t.options.lineWrapping,h=void 0,d=0;if(!c.hidden){if(i+=c.line.height,a&&s<8){var p=c.node.offsetTop+c.node.offsetHeight;h=p-n,n=p}else{var f=c.node.getBoundingClientRect();h=f.bottom-f.top,!u&&c.text.firstChild&&(d=c.text.firstChild.getBoundingClientRect().right-f.left-1)}var m=c.line.height-h;if((m>.005||m<-.005)&&(i<r&&(o-=m),te(c.line,h),ti(c.line),c.rest))for(var g=0;g<c.rest.length;g++)ti(c.rest[g]);if(d>t.display.sizerWidth){var v=Math.ceil(d/Rr(t.display));v>t.display.maxLineLength&&(t.display.maxLineLength=v,t.display.maxLine=c.line,t.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(e.scroller.scrollTop+=o)}function ti(t){if(t.widgets)for(var e=0;e<t.widgets.length;++e){var n=t.widgets[e],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function ei(t,e,n){var r=n&&null!=n.top?Math.max(0,n.top):t.scroller.scrollTop;r=Math.floor(r-jn(t));var i=n&&null!=n.bottom?n.bottom:r+t.wrapper.clientHeight,o=ne(e,r),a=ne(e,i);if(n&&n.ensure){var s=n.ensure.from.line,l=n.ensure.to.line;s<o?(o=s,a=ne(e,an(Jt(e,s))+t.wrapper.clientHeight)):Math.min(l,e.lastLine())>=a&&(o=ne(e,an(Jt(e,l))-t.wrapper.clientHeight),a=l)}return{from:o,to:Math.max(a,o+1)}}function ni(t,e){if(!yt(t,"scrollCursorIntoView")){var n=t.display,r=n.sizer.getBoundingClientRect(),i=null;if(e.top+r.top<0?i=!0:e.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!f){var o=A("div","",null,"position: absolute;\n top: "+(e.top-n.viewOffset-jn(t.display))+"px;\n height: "+(e.bottom-e.top+Xn(t)+n.barHeight)+"px;\n left: "+e.left+"px; width: "+Math.max(2,e.right-e.left)+"px;");t.display.lineSpace.appendChild(o),o.scrollIntoView(i),t.display.lineSpace.removeChild(o)}}}function ri(t,e,n,r){var i;null==r&&(r=0),t.options.lineWrapping||e!=n||(n="before"==e.sticky?oe(e.line,e.ch+1,"before"):e,e=e.ch?oe(e.line,"before"==e.sticky?e.ch-1:e.ch,"after"):e);for(var o=0;o<5;o++){var a=!1,s=xr(t,e),l=n&&n!=e?xr(t,n):s,c=oi(t,i={left:Math.min(s.left,l.left),top:Math.min(s.top,l.top)-r,right:Math.max(s.left,l.left),bottom:Math.max(s.bottom,l.bottom)+r}),u=t.doc.scrollTop,h=t.doc.scrollLeft;if(null!=c.scrollTop&&(di(t,c.scrollTop),Math.abs(t.doc.scrollTop-u)>1&&(a=!0)),null!=c.scrollLeft&&(fi(t,c.scrollLeft),Math.abs(t.doc.scrollLeft-h)>1&&(a=!0)),!a)break}return i}function ii(t,e){var n=oi(t,e);null!=n.scrollTop&&di(t,n.scrollTop),null!=n.scrollLeft&&fi(t,n.scrollLeft)}function oi(t,e){var n=t.display,r=Ar(t.display);e.top<0&&(e.top=0);var i=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:n.scroller.scrollTop,o=Zn(t),a={};e.bottom-e.top>o&&(e.bottom=e.top+o);var s=t.doc.height+$n(n),l=e.top<r,c=e.bottom>s-r;if(e.top<i)a.scrollTop=l?0:e.top;else if(e.bottom>i+o){var u=Math.min(e.top,(c?s:e.bottom)-o);u!=i&&(a.scrollTop=u)}var h=t.options.fixedGutter?0:n.gutters.offsetWidth,d=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:n.scroller.scrollLeft-h,p=Yn(t)-n.gutters.offsetWidth,f=e.right-e.left>p;return f&&(e.right=e.left+p),e.left<10?a.scrollLeft=0:e.left<d?a.scrollLeft=Math.max(0,e.left+h-(f?0:10)):e.right>p+d-3&&(a.scrollLeft=e.right+(f?0:10)-p),a}function ai(t,e){null!=e&&(ui(t),t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+e)}function si(t){ui(t);var e=t.getCursor();t.curOp.scrollToPos={from:e,to:e,margin:t.options.cursorScrollMargin}}function li(t,e,n){null==e&&null==n||ui(t),null!=e&&(t.curOp.scrollLeft=e),null!=n&&(t.curOp.scrollTop=n)}function ci(t,e){ui(t),t.curOp.scrollToPos=e}function ui(t){var e=t.curOp.scrollToPos;e&&(t.curOp.scrollToPos=null,hi(t,br(t,e.from),br(t,e.to),e.margin))}function hi(t,e,n,r){var i=oi(t,{left:Math.min(e.left,n.left),top:Math.min(e.top,n.top)-r,right:Math.max(e.right,n.right),bottom:Math.max(e.bottom,n.bottom)+r});li(t,i.scrollLeft,i.scrollTop)}function di(t,e){Math.abs(t.doc.scrollTop-e)<2||(n||Gi(t,{top:e}),pi(t,e,!0),n&&Gi(t),Ii(t,100))}function pi(t,e,n){e=Math.max(0,Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,e)),(t.display.scroller.scrollTop!=e||n)&&(t.doc.scrollTop=e,t.display.scrollbars.setScrollTop(e),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e))}function fi(t,e,n,r){e=Math.max(0,Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth)),(n?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)&&!r||(t.doc.scrollLeft=e,qi(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbars.setScrollLeft(e))}function mi(t){var e=t.display,n=e.gutters.offsetWidth,r=Math.round(t.doc.height+$n(t.display));return{clientHeight:e.scroller.clientHeight,viewHeight:e.wrapper.clientHeight,scrollWidth:e.scroller.scrollWidth,clientWidth:e.scroller.clientWidth,viewWidth:e.wrapper.clientWidth,barLeft:t.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Xn(t)+e.barHeight,nativeBarWidth:e.nativeBarWidth,gutterWidth:n}}var gi=function(t,e,n){this.cm=n;var r=this.vert=A("div",[A("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=A("div",[A("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,t(r),t(i),ft(r,"scroll",(function(){r.clientHeight&&e(r.scrollTop,"vertical")})),ft(i,"scroll",(function(){i.clientWidth&&e(i.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,a&&s<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};gi.prototype.update=function(t){var e=t.scrollWidth>t.clientWidth+1,n=t.scrollHeight>t.clientHeight+1,r=t.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=e?r+"px":"0";var i=t.viewHeight-(e?r:0);this.vert.firstChild.style.height=Math.max(0,t.scrollHeight-t.clientHeight+i)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(e){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=t.barLeft+"px";var o=t.viewWidth-t.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,t.scrollWidth-t.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&t.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:e?r:0}},gi.prototype.setScrollLeft=function(t){this.horiz.scrollLeft!=t&&(this.horiz.scrollLeft=t),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},gi.prototype.setScrollTop=function(t){this.vert.scrollTop!=t&&(this.vert.scrollTop=t),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},gi.prototype.zeroWidthHack=function(){var t=y&&!p?"12px":"18px";this.horiz.style.height=this.vert.style.width=t,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new B,this.disableVert=new B},gi.prototype.enableZeroWidthBar=function(t,e,n){function r(){var i=t.getBoundingClientRect();("vert"==n?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=t?t.style.pointerEvents="none":e.set(1e3,r)}t.style.pointerEvents="auto",e.set(1e3,r)},gi.prototype.clear=function(){var t=this.horiz.parentNode;t.removeChild(this.horiz),t.removeChild(this.vert)};var vi=function(){};function yi(t,e){e||(e=mi(t));var n=t.display.barWidth,r=t.display.barHeight;xi(t,e);for(var i=0;i<4&&n!=t.display.barWidth||r!=t.display.barHeight;i++)n!=t.display.barWidth&&t.options.lineWrapping&&Qr(t),xi(t,mi(t)),n=t.display.barWidth,r=t.display.barHeight}function xi(t,e){var n=t.display,r=n.scrollbars.update(e);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=e.gutterWidth+"px"):n.gutterFiller.style.display=""}vi.prototype.update=function(){return{bottom:0,right:0}},vi.prototype.setScrollLeft=function(){},vi.prototype.setScrollTop=function(){},vi.prototype.clear=function(){};var bi={native:gi,null:vi};function wi(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&E(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new bi[t.options.scrollbarStyle]((function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),ft(e,"mousedown",(function(){t.state.focused&&setTimeout((function(){return t.display.input.focus()}),0)})),e.setAttribute("cm-not-content","true")}),(function(e,n){"horizontal"==n?fi(t,e):di(t,e)}),t),t.display.scrollbars.addClass&&D(t.display.wrapper,t.display.scrollbars.addClass)}var _i=0;function Mi(t){t.curOp={cm:t,viewChanged:!1,startHeight:t.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++_i,markArrays:null},Tn(t.curOp)}function Si(t){var e=t.curOp;e&&Cn(e,(function(t){for(var e=0;e<t.ops.length;e++)t.ops[e].cm.curOp=null;Ti(t)}))}function Ti(t){for(var e=t.ops,n=0;n<e.length;n++)Ei(e[n]);for(var r=0;r<e.length;r++)Ci(e[r]);for(var i=0;i<e.length;i++)Li(e[i]);for(var o=0;o<e.length;o++)Ai(e[o]);for(var a=0;a<e.length;a++)Ri(e[a])}function Ei(t){var e=t.cm,n=e.display;Fi(e),t.updateMaxLine&&ln(e),t.mustUpdate=t.viewChanged||t.forceUpdate||null!=t.scrollTop||t.scrollToPos&&(t.scrollToPos.from.line<n.viewFrom||t.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&e.options.lineWrapping,t.update=t.mustUpdate&&new zi(e,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function Ci(t){t.updatedDisplay=t.mustUpdate&&Hi(t.cm,t.update)}function Li(t){var e=t.cm,n=e.display;t.updatedDisplay&&Qr(e),t.barMeasure=mi(e),n.maxLineChanged&&!e.options.lineWrapping&&(t.adjustWidthTo=tr(e,n.maxLine,n.maxLine.text.length).left+3,e.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+t.adjustWidthTo+Xn(e)+e.display.barWidth),t.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+t.adjustWidthTo-Yn(e))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=n.input.prepareSelection())}function Ai(t){var e=t.cm;null!=t.adjustWidthTo&&(e.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLeft<e.doc.scrollLeft&&fi(e,Math.min(e.display.scroller.scrollLeft,t.maxScrollLeft),!0),e.display.maxLineChanged=!1);var n=t.focus&&t.focus==N();t.preparedSelection&&e.display.input.showSelection(t.preparedSelection,n),(t.updatedDisplay||t.startHeight!=e.doc.height)&&yi(e,t.barMeasure),t.updatedDisplay&&$i(e,t.barMeasure),t.selectionChanged&&Xr(e),e.state.focused&&t.updateInput&&e.display.input.reset(t.typing),n&&Yr(t.cm)}function Ri(t){var e=t.cm,n=e.display,r=e.doc;t.updatedDisplay&&Wi(e,t.update),null==n.wheelStartX||null==t.scrollTop&&null==t.scrollLeft&&!t.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null!=t.scrollTop&&pi(e,t.scrollTop,t.forceScroll),null!=t.scrollLeft&&fi(e,t.scrollLeft,!0,!0),t.scrollToPos&&ni(e,ri(e,de(r,t.scrollToPos.from),de(r,t.scrollToPos.to),t.scrollToPos.margin));var i=t.maybeHiddenMarkers,o=t.maybeUnhiddenMarkers;if(i)for(var a=0;a<i.length;++a)i[a].lines.length||vt(i[a],"hide");if(o)for(var s=0;s<o.length;++s)o[s].lines.length&&vt(o[s],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=e.display.scroller.scrollTop),t.changeObjs&&vt(e,"changes",e,t.changeObjs),t.update&&t.update.finish()}function Pi(t,e){if(t.curOp)return e();Mi(t);try{return e()}finally{Si(t)}}function Ni(t,e){return function(){if(t.curOp)return e.apply(t,arguments);Mi(t);try{return e.apply(t,arguments)}finally{Si(t)}}}function Di(t){return function(){if(this.curOp)return t.apply(this,arguments);Mi(this);try{return t.apply(this,arguments)}finally{Si(this)}}}function ki(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);Mi(e);try{return t.apply(this,arguments)}finally{Si(e)}}}function Ii(t,e){t.doc.highlightFrontier<t.display.viewTo&&t.state.highlight.set(e,O(Oi,t))}function Oi(t){var e=t.doc;if(!(e.highlightFrontier>=t.display.viewTo)){var n=+new Date+t.options.workTime,r=xe(t,e.highlightFrontier),i=[];e.iter(r.line,Math.min(e.first+e.size,t.display.viewTo+500),(function(o){if(r.line>=t.display.viewFrom){var a=o.styles,s=o.text.length>t.options.maxHighlightLength?qt(e.mode,r.state):null,l=ve(t,o,r,!0);s&&(r.state=s),o.styles=l.styles;var c=o.styleClasses,u=l.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var h=!a||a.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),d=0;!h&&d<a.length;++d)h=a[d]!=o.styles[d];h&&i.push(r.line),o.stateAfter=r.save(),r.nextLine()}else o.text.length<=t.options.maxHighlightLength&&be(t,o.text,r),o.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return Ii(t,t.options.workDelay),!0})),e.highlightFrontier=r.line,e.modeFrontier=Math.max(e.modeFrontier,r.line),i.length&&Pi(t,(function(){for(var e=0;e<i.length;e++)Fr(t,i[e],"text")}))}}var zi=function(t,e,n){var r=t.display;this.viewport=e,this.visible=ei(r,t.doc,e),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Yn(t),this.force=n,this.dims=Pr(t),this.events=[]};function Fi(t){var e=t.display;!e.scrollbarsClipped&&e.scroller.offsetWidth&&(e.nativeBarWidth=e.scroller.offsetWidth-e.scroller.clientWidth,e.heightForcer.style.height=Xn(t)+"px",e.sizer.style.marginBottom=-e.nativeBarWidth+"px",e.sizer.style.borderRightWidth=Xn(t)+"px",e.scrollbarsClipped=!0)}function Bi(t){if(t.hasFocus())return null;var e=N();if(!e||!P(t.display.lineDiv,e))return null;var n={activeElt:e};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&P(t.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function Ui(t){if(t&&t.activeElt&&t.activeElt!=N()&&(t.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(t.activeElt.nodeName)&&t.anchorNode&&P(document.body,t.anchorNode)&&P(document.body,t.focusNode))){var e=window.getSelection(),n=document.createRange();n.setEnd(t.anchorNode,t.anchorOffset),n.collapse(!1),e.removeAllRanges(),e.addRange(n),e.extend(t.focusNode,t.focusOffset)}}function Hi(t,e){var n=t.display,r=t.doc;if(e.editorIsHidden)return Br(t),!1;if(!e.force&&e.visible.from>=n.viewFrom&&e.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==Wr(t))return!1;Xi(t)&&(Br(t),e.dims=Pr(t));var i=r.first+r.size,o=Math.max(e.visible.from-t.options.viewportMargin,r.first),a=Math.min(i,e.visible.to+t.options.viewportMargin);n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(r.first,n.viewFrom)),n.viewTo>a&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Re&&(o=en(t.doc,o),a=nn(t.doc,a));var s=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=e.wrapperHeight||n.lastWrapWidth!=e.wrapperWidth;Hr(t,o,a),n.viewOffset=an(Jt(t.doc,n.viewFrom)),t.display.mover.style.top=n.viewOffset+"px";var l=Wr(t);if(!s&&0==l&&!e.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var c=Bi(t);return l>4&&(n.lineDiv.style.display="none"),Vi(t,n.updateLineNumbers,e.dims),l>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,Ui(c),C(n.cursorDiv),C(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,s&&(n.lastWrapHeight=e.wrapperHeight,n.lastWrapWidth=e.wrapperWidth,Ii(t,400)),n.updateLineNumbers=null,!0}function Wi(t,e){for(var n=e.viewport,r=!0;;r=!1){if(r&&t.options.lineWrapping&&e.oldDisplayWidth!=Yn(t))r&&(e.visible=ei(t.display,t.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(t.doc.height+$n(t.display)-Zn(t),n.top)}),e.visible=ei(t.display,t.doc,n),e.visible.from>=t.display.viewFrom&&e.visible.to<=t.display.viewTo)break;if(!Hi(t,e))break;Qr(t);var i=mi(t);Gr(t),yi(t,i),$i(t,i),e.force=!1}e.signal(t,"update",t),t.display.viewFrom==t.display.reportedViewFrom&&t.display.viewTo==t.display.reportedViewTo||(e.signal(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo),t.display.reportedViewFrom=t.display.viewFrom,t.display.reportedViewTo=t.display.viewTo)}function Gi(t,e){var n=new zi(t,e);if(Hi(t,n)){Qr(t),Wi(t,n);var r=mi(t);Gr(t),yi(t,r),$i(t,r),n.finish()}}function Vi(t,e,n){var r=t.display,i=t.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function s(e){var n=e.nextSibling;return l&&y&&t.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),n}for(var c=r.view,u=r.viewFrom,h=0;h<c.length;h++){var d=c[h];if(d.hidden);else if(d.node&&d.node.parentNode==o){for(;a!=d.node;)a=s(a);var p=i&&null!=e&&e<=u&&d.lineNumber;d.changes&&(U(d.changes,"gutter")>-1&&(p=!1),Pn(t,d,u,n)),p&&(C(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(ie(t.options,u)))),a=d.node.nextSibling}else{var f=Bn(t,d,u,n);o.insertBefore(f,a)}u+=d.size}for(;a;)a=s(a)}function ji(t){var e=t.gutters.offsetWidth;t.sizer.style.marginLeft=e+"px",An(t,"gutterChanged",t)}function $i(t,e){t.display.sizer.style.minHeight=e.docHeight+"px",t.display.heightForcer.style.top=e.docHeight+"px",t.display.gutters.style.height=e.docHeight+t.display.barHeight+Xn(t)+"px"}function qi(t){var e=t.display,n=e.view;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var r=Nr(e)-e.scroller.scrollLeft+t.doc.scrollLeft,i=e.gutters.offsetWidth,o=r+"px",a=0;a<n.length;a++)if(!n[a].hidden){t.options.fixedGutter&&(n[a].gutter&&(n[a].gutter.style.left=o),n[a].gutterBackground&&(n[a].gutterBackground.style.left=o));var s=n[a].alignable;if(s)for(var l=0;l<s.length;l++)s[l].style.left=o}t.options.fixedGutter&&(e.gutters.style.left=r+i+"px")}}function Xi(t){if(!t.options.lineNumbers)return!1;var e=t.doc,n=ie(t.options,e.first+e.size-1),r=t.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(A("div",[A("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-a)+1,r.lineNumWidth=r.lineNumInnerWidth+a,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ji(t.display),!0}return!1}function Yi(t,e){for(var n=[],r=!1,i=0;i<t.length;i++){var o=t[i],a=null;if("string"!=typeof o&&(a=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!e)continue;r=!0}n.push({className:o,style:a})}return e&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Zi(t){var e=t.gutters,n=t.gutterSpecs;C(e),t.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],o=i.className,a=i.style,s=e.appendChild(A("div",null,"CodeMirror-gutter "+o));a&&(s.style.cssText=a),"CodeMirror-linenumbers"==o&&(t.lineGutter=s,s.style.width=(t.lineNumWidth||1)+"px")}e.style.display=n.length?"":"none",ji(t)}function Ji(t){Zi(t.display),zr(t),qi(t)}function Ki(t,e,r,i){var o=this;this.input=r,o.scrollbarFiller=A("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=A("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=R("div",null,"CodeMirror-code"),o.selectionDiv=A("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=A("div",null,"CodeMirror-cursors"),o.measure=A("div",null,"CodeMirror-measure"),o.lineMeasure=A("div",null,"CodeMirror-measure"),o.lineSpace=R("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var c=R("div",[o.lineSpace],"CodeMirror-lines");o.mover=A("div",[c],null,"position: relative"),o.sizer=A("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=A("div",null,null,"position: absolute; height: "+H+"px; width: 1px;"),o.gutters=A("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=A("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=A("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),o.wrapper.setAttribute("translate","no"),a&&s<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),l||n&&v||(o.scroller.draggable=!0),t&&(t.appendChild?t.appendChild(o.wrapper):t(o.wrapper)),o.viewFrom=o.viewTo=e.first,o.reportedViewFrom=o.reportedViewTo=e.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=Yi(i.gutters,i.lineNumbers),Zi(o),r.init(o)}zi.prototype.signal=function(t,e){bt(t,e)&&this.events.push(arguments)},zi.prototype.finish=function(){for(var t=0;t<this.events.length;t++)vt.apply(null,this.events[t])};var Qi=0,to=null;function eo(t){var e=t.wheelDeltaX,n=t.wheelDeltaY;return null==e&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(e=t.detail),null==n&&t.detail&&t.axis==t.VERTICAL_AXIS?n=t.detail:null==n&&(n=t.wheelDelta),{x:e,y:n}}function no(t){var e=eo(t);return e.x*=to,e.y*=to,e}function ro(t,e){var r=eo(e),i=r.x,o=r.y,a=to;0===e.deltaMode&&(i=e.deltaX,o=e.deltaY,a=1);var s=t.display,c=s.scroller,u=c.scrollWidth>c.clientWidth,d=c.scrollHeight>c.clientHeight;if(i&&u||o&&d){if(o&&y&&l)t:for(var p=e.target,f=s.view;p!=c;p=p.parentNode)for(var m=0;m<f.length;m++)if(f[m].node==p){t.display.currentWheelTarget=p;break t}if(i&&!n&&!h&&null!=a)return o&&d&&di(t,Math.max(0,c.scrollTop+o*a)),fi(t,Math.max(0,c.scrollLeft+i*a)),(!o||o&&d)&&_t(e),void(s.wheelStartX=null);if(o&&null!=a){var g=o*a,v=t.doc.scrollTop,x=v+s.wrapper.clientHeight;g<0?v=Math.max(0,v+g-50):x=Math.min(t.doc.height,x+g+50),Gi(t,{top:v,bottom:x})}Qi<20&&0!==e.deltaMode&&(null==s.wheelStartX?(s.wheelStartX=c.scrollLeft,s.wheelStartY=c.scrollTop,s.wheelDX=i,s.wheelDY=o,setTimeout((function(){if(null!=s.wheelStartX){var t=c.scrollLeft-s.wheelStartX,e=c.scrollTop-s.wheelStartY,n=e&&s.wheelDY&&e/s.wheelDY||t&&s.wheelDX&&t/s.wheelDX;s.wheelStartX=s.wheelStartY=null,n&&(to=(to*Qi+n)/(Qi+1),++Qi)}}),200)):(s.wheelDX+=i,s.wheelDY+=o))}}a?to=-.53:n?to=15:u?to=-.7:d&&(to=-1/3);var io=function(t,e){this.ranges=t,this.primIndex=e};io.prototype.primary=function(){return this.ranges[this.primIndex]},io.prototype.equals=function(t){if(t==this)return!0;if(t.primIndex!=this.primIndex||t.ranges.length!=this.ranges.length)return!1;for(var e=0;e<this.ranges.length;e++){var n=this.ranges[e],r=t.ranges[e];if(!se(n.anchor,r.anchor)||!se(n.head,r.head))return!1}return!0},io.prototype.deepCopy=function(){for(var t=[],e=0;e<this.ranges.length;e++)t[e]=new oo(le(this.ranges[e].anchor),le(this.ranges[e].head));return new io(t,this.primIndex)},io.prototype.somethingSelected=function(){for(var t=0;t<this.ranges.length;t++)if(!this.ranges[t].empty())return!0;return!1},io.prototype.contains=function(t,e){e||(e=t);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ae(e,r.from())>=0&&ae(t,r.to())<=0)return n}return-1};var oo=function(t,e){this.anchor=t,this.head=e};function ao(t,e,n){var r=t&&t.options.selectionsMayTouch,i=e[n];e.sort((function(t,e){return ae(t.from(),e.from())})),n=U(e,i);for(var o=1;o<e.length;o++){var a=e[o],s=e[o-1],l=ae(s.to(),a.from());if(r&&!a.empty()?l>0:l>=0){var c=ue(s.from(),a.from()),u=ce(s.to(),a.to()),h=s.empty()?a.from()==a.head:s.from()==s.head;o<=n&&--n,e.splice(--o,2,new oo(h?u:c,h?c:u))}}return new io(e,n)}function so(t,e){return new io([new oo(t,e||t)],0)}function lo(t){return t.text?oe(t.from.line+t.text.length-1,Y(t.text).length+(1==t.text.length?t.from.ch:0)):t.to}function co(t,e){if(ae(t,e.from)<0)return t;if(ae(t,e.to)<=0)return lo(e);var n=t.line+e.text.length-(e.to.line-e.from.line)-1,r=t.ch;return t.line==e.to.line&&(r+=lo(e).ch-e.to.ch),oe(n,r)}function uo(t,e){for(var n=[],r=0;r<t.sel.ranges.length;r++){var i=t.sel.ranges[r];n.push(new oo(co(i.anchor,e),co(i.head,e)))}return ao(t.cm,n,t.sel.primIndex)}function ho(t,e,n){return t.line==e.line?oe(n.line,t.ch-e.ch+n.ch):oe(n.line+(t.line-e.line),t.ch)}function po(t,e,n){for(var r=[],i=oe(t.first,0),o=i,a=0;a<e.length;a++){var s=e[a],l=ho(s.from,i,o),c=ho(lo(s),i,o);if(i=s.to,o=c,"around"==n){var u=t.sel.ranges[a],h=ae(u.head,u.anchor)<0;r[a]=new oo(h?c:l,h?l:c)}else r[a]=new oo(l,l)}return new io(r,t.sel.primIndex)}function fo(t){t.doc.mode=Vt(t.options,t.doc.modeOption),mo(t)}function mo(t){t.doc.iter((function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)})),t.doc.modeFrontier=t.doc.highlightFrontier=t.doc.first,Ii(t,100),t.state.modeGen++,t.curOp&&zr(t)}function go(t,e){return 0==e.from.ch&&0==e.to.ch&&""==Y(e.text)&&(!t.cm||t.cm.options.wholeLineUpdateBefore)}function vo(t,e,n,r){function i(t){return n?n[t]:null}function o(t,n,i){un(t,n,i,r),An(t,"change",t,e)}function a(t,e){for(var n=[],o=t;o<e;++o)n.push(new cn(c[o],i(o),r));return n}var s=e.from,l=e.to,c=e.text,u=Jt(t,s.line),h=Jt(t,l.line),d=Y(c),p=i(c.length-1),f=l.line-s.line;if(e.full)t.insert(0,a(0,c.length)),t.remove(c.length,t.size-c.length);else if(go(t,e)){var m=a(0,c.length-1);o(h,h.text,p),f&&t.remove(s.line,f),m.length&&t.insert(s.line,m)}else if(u==h)if(1==c.length)o(u,u.text.slice(0,s.ch)+d+u.text.slice(l.ch),p);else{var g=a(1,c.length-1);g.push(new cn(d+u.text.slice(l.ch),p,r)),o(u,u.text.slice(0,s.ch)+c[0],i(0)),t.insert(s.line+1,g)}else if(1==c.length)o(u,u.text.slice(0,s.ch)+c[0]+h.text.slice(l.ch),i(0)),t.remove(s.line+1,f);else{o(u,u.text.slice(0,s.ch)+c[0],i(0)),o(h,d+h.text.slice(l.ch),p);var v=a(1,c.length-1);f>1&&t.remove(s.line+1,f-1),t.insert(s.line+1,v)}An(t,"change",t,e)}function yo(t,e,n){function r(t,i,o){if(t.linked)for(var a=0;a<t.linked.length;++a){var s=t.linked[a];if(s.doc!=i){var l=o&&s.sharedHist;n&&!l||(e(s.doc,l),r(s.doc,t,l))}}}r(t,null,!0)}function xo(t,e){if(e.cm)throw new Error("This document is already in use.");t.doc=e,e.cm=t,kr(t),fo(t),bo(t),t.options.direction=e.direction,t.options.lineWrapping||ln(t),t.options.mode=e.modeOption,zr(t)}function bo(t){("rtl"==t.doc.direction?D:E)(t.display.lineDiv,"CodeMirror-rtl")}function wo(t){Pi(t,(function(){bo(t),zr(t)}))}function _o(t){this.done=[],this.undone=[],this.undoDepth=t?t.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=t?t.maxGeneration:1}function Mo(t,e){var n={from:le(e.from),to:lo(e),text:Kt(t,e.from,e.to)};return Ro(t,n,e.from.line,e.to.line+1),yo(t,(function(t){return Ro(t,n,e.from.line,e.to.line+1)}),!0),n}function So(t){for(;t.length&&Y(t).ranges;)t.pop()}function To(t,e){return e?(So(t.done),Y(t.done)):t.done.length&&!Y(t.done).ranges?Y(t.done):t.done.length>1&&!t.done[t.done.length-2].ranges?(t.done.pop(),Y(t.done)):void 0}function Eo(t,e,n,r){var i=t.history;i.undone.length=0;var o,a,s=+new Date;if((i.lastOp==r||i.lastOrigin==e.origin&&e.origin&&("+"==e.origin.charAt(0)&&i.lastModTime>s-(t.cm?t.cm.options.historyEventDelay:500)||"*"==e.origin.charAt(0)))&&(o=To(i,i.lastOp==r)))a=Y(o.changes),0==ae(e.from,e.to)&&0==ae(e.from,a.to)?a.to=lo(e):o.changes.push(Mo(t,e));else{var l=Y(i.done);for(l&&l.ranges||Ao(t.sel,i.done),o={changes:[Mo(t,e)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=s,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=e.origin,a||vt(t,"historyAdded")}function Co(t,e,n,r){var i=e.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}function Lo(t,e,n,r){var i=t.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||Co(t,o,Y(i.done),e))?i.done[i.done.length-1]=e:Ao(e,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&So(i.undone)}function Ao(t,e){var n=Y(e);n&&n.ranges&&n.equals(t)||e.push(t)}function Ro(t,e,n,r){var i=e["spans_"+t.id],o=0;t.iter(Math.max(t.first,n),Math.min(t.first+t.size,r),(function(n){n.markedSpans&&((i||(i=e["spans_"+t.id]={}))[o]=n.markedSpans),++o}))}function Po(t){if(!t)return null;for(var e,n=0;n<t.length;++n)t[n].marker.explicitlyCleared?e||(e=t.slice(0,n)):e&&e.push(t[n]);return e?e.length?e:null:t}function No(t,e){var n=e["spans_"+t.id];if(!n)return null;for(var r=[],i=0;i<e.text.length;++i)r.push(Po(n[i]));return r}function Do(t,e){var n=No(t,e),r=Be(t,e);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var o=n[i],a=r[i];if(o&&a)t:for(var s=0;s<a.length;++s){for(var l=a[s],c=0;c<o.length;++c)if(o[c].marker==l.marker)continue t;o.push(l)}else a&&(n[i]=a)}return n}function ko(t,e,n){for(var r=[],i=0;i<t.length;++i){var o=t[i];if(o.ranges)r.push(n?io.prototype.deepCopy.call(o):o);else{var a=o.changes,s=[];r.push({changes:s});for(var l=0;l<a.length;++l){var c=a[l],u=void 0;if(s.push({from:c.from,to:c.to,text:c.text}),e)for(var h in c)(u=h.match(/^spans_(\d+)$/))&&U(e,Number(u[1]))>-1&&(Y(s)[h]=c[h],delete c[h])}}}return r}function Io(t,e,n,r){if(r){var i=t.anchor;if(n){var o=ae(e,i)<0;o!=ae(n,i)<0?(i=e,e=n):o!=ae(e,n)<0&&(e=n)}return new oo(i,e)}return new oo(n||e,e)}function Oo(t,e,n,r,i){null==i&&(i=t.cm&&(t.cm.display.shift||t.extend)),Wo(t,new io([Io(t.sel.primary(),e,n,i)],0),r)}function zo(t,e,n){for(var r=[],i=t.cm&&(t.cm.display.shift||t.extend),o=0;o<t.sel.ranges.length;o++)r[o]=Io(t.sel.ranges[o],e[o],null,i);Wo(t,ao(t.cm,r,t.sel.primIndex),n)}function Fo(t,e,n,r){var i=t.sel.ranges.slice(0);i[e]=n,Wo(t,ao(t.cm,i,t.sel.primIndex),r)}function Bo(t,e,n,r){Wo(t,so(e,n),r)}function Uo(t,e,n){var r={ranges:e.ranges,update:function(e){this.ranges=[];for(var n=0;n<e.length;n++)this.ranges[n]=new oo(de(t,e[n].anchor),de(t,e[n].head))},origin:n&&n.origin};return vt(t,"beforeSelectionChange",t,r),t.cm&&vt(t.cm,"beforeSelectionChange",t.cm,r),r.ranges!=e.ranges?ao(t.cm,r.ranges,r.ranges.length-1):e}function Ho(t,e,n){var r=t.history.done,i=Y(r);i&&i.ranges?(r[r.length-1]=e,Go(t,e,n)):Wo(t,e,n)}function Wo(t,e,n){Go(t,e,n),Lo(t,t.sel,t.cm?t.cm.curOp.id:NaN,n)}function Go(t,e,n){(bt(t,"beforeSelectionChange")||t.cm&&bt(t.cm,"beforeSelectionChange"))&&(e=Uo(t,e,n));var r=n&&n.bias||(ae(e.primary().head,t.sel.primary().head)<0?-1:1);Vo(t,$o(t,e,r,!0)),n&&!1===n.scroll||!t.cm||"nocursor"==t.cm.getOption("readOnly")||si(t.cm)}function Vo(t,e){e.equals(t.sel)||(t.sel=e,t.cm&&(t.cm.curOp.updateInput=1,t.cm.curOp.selectionChanged=!0,xt(t.cm)),An(t,"cursorActivity",t))}function jo(t){Vo(t,$o(t,t.sel,null,!1))}function $o(t,e,n,r){for(var i,o=0;o<e.ranges.length;o++){var a=e.ranges[o],s=e.ranges.length==t.sel.ranges.length&&t.sel.ranges[o],l=Xo(t,a.anchor,s&&s.anchor,n,r),c=Xo(t,a.head,s&&s.head,n,r);(i||l!=a.anchor||c!=a.head)&&(i||(i=e.ranges.slice(0,o)),i[o]=new oo(l,c))}return i?ao(t.cm,i,e.primIndex):e}function qo(t,e,n,r,i){var o=Jt(t,e.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var s=o.markedSpans[a],l=s.marker,c="selectLeft"in l?!l.selectLeft:l.inclusiveLeft,u="selectRight"in l?!l.selectRight:l.inclusiveRight;if((null==s.from||(c?s.from<=e.ch:s.from<e.ch))&&(null==s.to||(u?s.to>=e.ch:s.to>e.ch))){if(i&&(vt(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!l.atomic)continue;if(n){var h=l.find(r<0?1:-1),d=void 0;if((r<0?u:c)&&(h=Yo(t,h,-r,h&&h.line==e.line?o:null)),h&&h.line==e.line&&(d=ae(h,n))&&(r<0?d<0:d>0))return qo(t,h,e,r,i)}var p=l.find(r<0?-1:1);return(r<0?c:u)&&(p=Yo(t,p,r,p.line==e.line?o:null)),p?qo(t,p,e,r,i):null}}return e}function Xo(t,e,n,r,i){var o=r||1,a=qo(t,e,n,o,i)||!i&&qo(t,e,n,o,!0)||qo(t,e,n,-o,i)||!i&&qo(t,e,n,-o,!0);return a||(t.cantEdit=!0,oe(t.first,0))}function Yo(t,e,n,r){return n<0&&0==e.ch?e.line>t.first?de(t,oe(e.line-1)):null:n>0&&e.ch==(r||Jt(t,e.line)).text.length?e.line<t.first+t.size-1?oe(e.line+1,0):null:new oe(e.line,e.ch+n)}function Zo(t){t.setSelection(oe(t.firstLine(),0),oe(t.lastLine()),G)}function Jo(t,e,n){var r={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(e,n,i,o){e&&(r.from=de(t,e)),n&&(r.to=de(t,n)),i&&(r.text=i),void 0!==o&&(r.origin=o)}),vt(t,"beforeChange",t,r),t.cm&&vt(t.cm,"beforeChange",t.cm,r),r.canceled?(t.cm&&(t.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Ko(t,e,n){if(t.cm){if(!t.cm.curOp)return Ni(t.cm,Ko)(t,e,n);if(t.cm.state.suppressEdits)return}if(!(bt(t,"beforeChange")||t.cm&&bt(t.cm,"beforeChange"))||(e=Jo(t,e,!0))){var r=Ae&&!n&&He(t,e.from,e.to);if(r)for(var i=r.length-1;i>=0;--i)Qo(t,{from:r[i].from,to:r[i].to,text:i?[""]:e.text,origin:e.origin});else Qo(t,e)}}function Qo(t,e){if(1!=e.text.length||""!=e.text[0]||0!=ae(e.from,e.to)){var n=uo(t,e);Eo(t,e,n,t.cm?t.cm.curOp.id:NaN),na(t,e,n,Be(t,e));var r=[];yo(t,(function(t,n){n||-1!=U(r,t.history)||(sa(t.history,e),r.push(t.history)),na(t,e,null,Be(t,e))}))}}function ta(t,e,n){var r=t.cm&&t.cm.state.suppressEdits;if(!r||n){for(var i,o=t.history,a=t.sel,s="undo"==e?o.done:o.undone,l="undo"==e?o.undone:o.done,c=0;c<s.length&&(i=s[c],n?!i.ranges||i.equals(t.sel):i.ranges);c++);if(c!=s.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(!(i=s.pop()).ranges){if(r)return void s.push(i);break}if(Ao(i,l),n&&!i.equals(t.sel))return void Wo(t,i,{clearRedo:!1});a=i}var u=[];Ao(a,l),l.push({changes:u,generation:o.generation}),o.generation=i.generation||++o.maxGeneration;for(var h=bt(t,"beforeChange")||t.cm&&bt(t.cm,"beforeChange"),d=function(n){var r=i.changes[n];if(r.origin=e,h&&!Jo(t,r,!1))return s.length=0,{};u.push(Mo(t,r));var o=n?uo(t,r):Y(s);na(t,r,o,Do(t,r)),!n&&t.cm&&t.cm.scrollIntoView({from:r.from,to:lo(r)});var a=[];yo(t,(function(t,e){e||-1!=U(a,t.history)||(sa(t.history,r),a.push(t.history)),na(t,r,null,Do(t,r))}))},p=i.changes.length-1;p>=0;--p){var f=d(p);if(f)return f.v}}}}function ea(t,e){if(0!=e&&(t.first+=e,t.sel=new io(Z(t.sel.ranges,(function(t){return new oo(oe(t.anchor.line+e,t.anchor.ch),oe(t.head.line+e,t.head.ch))})),t.sel.primIndex),t.cm)){zr(t.cm,t.first,t.first-e,e);for(var n=t.cm.display,r=n.viewFrom;r<n.viewTo;r++)Fr(t.cm,r,"gutter")}}function na(t,e,n,r){if(t.cm&&!t.cm.curOp)return Ni(t.cm,na)(t,e,n,r);if(e.to.line<t.first)ea(t,e.text.length-1-(e.to.line-e.from.line));else if(!(e.from.line>t.lastLine())){if(e.from.line<t.first){var i=e.text.length-1-(t.first-e.from.line);ea(t,i),e={from:oe(t.first,0),to:oe(e.to.line+i,e.to.ch),text:[Y(e.text)],origin:e.origin}}var o=t.lastLine();e.to.line>o&&(e={from:e.from,to:oe(o,Jt(t,o).text.length),text:[e.text[0]],origin:e.origin}),e.removed=Kt(t,e.from,e.to),n||(n=uo(t,e)),t.cm?ra(t.cm,e,r):vo(t,e,r),Go(t,n,G),t.cantEdit&&Xo(t,oe(t.firstLine(),0))&&(t.cantEdit=!1)}}function ra(t,e,n){var r=t.doc,i=t.display,o=e.from,a=e.to,s=!1,l=o.line;t.options.lineWrapping||(l=ee(Ke(Jt(r,o.line))),r.iter(l,a.line+1,(function(t){if(t==i.maxLine)return s=!0,!0}))),r.sel.contains(e.from,e.to)>-1&&xt(t),vo(r,e,n,Dr(t)),t.options.lineWrapping||(r.iter(l,o.line+e.text.length,(function(t){var e=sn(t);e>i.maxLineLength&&(i.maxLine=t,i.maxLineLength=e,i.maxLineChanged=!0,s=!1)})),s&&(t.curOp.updateMaxLine=!0)),Le(r,o.line),Ii(t,400);var c=e.text.length-(a.line-o.line)-1;e.full?zr(t):o.line!=a.line||1!=e.text.length||go(t.doc,e)?zr(t,o.line,a.line+1,c):Fr(t,o.line,"text");var u=bt(t,"changes"),h=bt(t,"change");if(h||u){var d={from:o,to:a,text:e.text,removed:e.removed,origin:e.origin};h&&An(t,"change",t,d),u&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(d)}t.display.selForContextMenu=null}function ia(t,e,n,r,i){var o;r||(r=n),ae(r,n)<0&&(n=(o=[r,n])[0],r=o[1]),"string"==typeof e&&(e=t.splitLines(e)),Ko(t,{from:n,to:r,text:e,origin:i})}function oa(t,e,n,r){n<t.line?t.line+=r:e<t.line&&(t.line=e,t.ch=0)}function aa(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i],a=!0;if(o.ranges){o.copied||((o=t[i]=o.deepCopy()).copied=!0);for(var s=0;s<o.ranges.length;s++)oa(o.ranges[s].anchor,e,n,r),oa(o.ranges[s].head,e,n,r)}else{for(var l=0;l<o.changes.length;++l){var c=o.changes[l];if(n<c.from.line)c.from=oe(c.from.line+r,c.from.ch),c.to=oe(c.to.line+r,c.to.ch);else if(e<=c.to.line){a=!1;break}}a||(t.splice(0,i+1),i=0)}}}function sa(t,e){var n=e.from.line,r=e.to.line,i=e.text.length-(r-n)-1;aa(t.done,n,r,i),aa(t.undone,n,r,i)}function la(t,e,n,r){var i=e,o=e;return"number"==typeof e?o=Jt(t,he(t,e)):i=ee(e),null==i?null:(r(o,i)&&t.cm&&Fr(t.cm,i,n),o)}function ca(t){this.lines=t,this.parent=null;for(var e=0,n=0;n<t.length;++n)t[n].parent=this,e+=t[n].height;this.height=e}function ua(t){this.children=t;for(var e=0,n=0,r=0;r<t.length;++r){var i=t[r];e+=i.chunkSize(),n+=i.height,i.parent=this}this.size=e,this.height=n,this.parent=null}oo.prototype.from=function(){return ue(this.anchor,this.head)},oo.prototype.to=function(){return ce(this.anchor,this.head)},oo.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},ca.prototype={chunkSize:function(){return this.lines.length},removeInner:function(t,e){for(var n=t,r=t+e;n<r;++n){var i=this.lines[n];this.height-=i.height,hn(i),An(i,"delete")}this.lines.splice(t,e)},collapse:function(t){t.push.apply(t,this.lines)},insertInner:function(t,e,n){this.height+=n,this.lines=this.lines.slice(0,t).concat(e).concat(this.lines.slice(t));for(var r=0;r<e.length;++r)e[r].parent=this},iterN:function(t,e,n){for(var r=t+e;t<r;++t)if(n(this.lines[t]))return!0}},ua.prototype={chunkSize:function(){return this.size},removeInner:function(t,e){this.size-=e;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(t<i){var o=Math.min(e,i-t),a=r.height;if(r.removeInner(t,o),this.height-=a-r.height,i==o&&(this.children.splice(n--,1),r.parent=null),0==(e-=o))break;t=0}else t-=i}if(this.size-e<25&&(this.children.length>1||!(this.children[0]instanceof ca))){var s=[];this.collapse(s),this.children=[new ca(s)],this.children[0].parent=this}},collapse:function(t){for(var e=0;e<this.children.length;++e)this.children[e].collapse(t)},insertInner:function(t,e,n){this.size+=e.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(t<=o){if(i.insertInner(t,e,n),i.lines&&i.lines.length>50){for(var a=i.lines.length%25+25,s=a;s<i.lines.length;){var l=new ca(i.lines.slice(s,s+=25));i.height-=l.height,this.children.splice(++r,0,l),l.parent=this}i.lines=i.lines.slice(0,a),this.maybeSpill()}break}t-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var t=this;do{var e=new ua(t.children.splice(t.children.length-5,5));if(t.parent){t.size-=e.size,t.height-=e.height;var n=U(t.parent.children,t);t.parent.children.splice(n+1,0,e)}else{var r=new ua(t.children);r.parent=t,t.children=[r,e],t=r}e.parent=t.parent}while(t.children.length>10);t.parent.maybeSpill()}},iterN:function(t,e,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(t<o){var a=Math.min(e,o-t);if(i.iterN(t,a,n))return!0;if(0==(e-=a))break;t=0}else t-=o}}};var ha=function(t,e,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=t,this.node=e};function da(t,e,n){an(e)<(t.curOp&&t.curOp.scrollTop||t.doc.scrollTop)&&ai(t,n)}function pa(t,e,n,r){var i=new ha(t,n,r),o=t.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),la(t,e,"widget",(function(e){var n=e.widgets||(e.widgets=[]);if(null==i.insertAt?n.push(i):n.splice(Math.min(n.length,Math.max(0,i.insertAt)),0,i),i.line=e,o&&!rn(t,e)){var r=an(e)<t.scrollTop;te(e,e.height+Gn(i)),r&&ai(o,i.height),o.curOp.forceUpdate=!0}return!0})),o&&An(o,"lineWidgetAdded",o,i,"number"==typeof e?e:ee(e)),i}ha.prototype.clear=function(){var t=this.doc.cm,e=this.line.widgets,n=this.line,r=ee(n);if(null!=r&&e){for(var i=0;i<e.length;++i)e[i]==this&&e.splice(i--,1);e.length||(n.widgets=null);var o=Gn(this);te(n,Math.max(0,n.height-o)),t&&(Pi(t,(function(){da(t,n,-o),Fr(t,r,"widget")})),An(t,"lineWidgetCleared",t,this,r))}},ha.prototype.changed=function(){var t=this,e=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=Gn(this)-e;i&&(rn(this.doc,r)||te(r,r.height+i),n&&Pi(n,(function(){n.curOp.forceUpdate=!0,da(n,r,i),An(n,"lineWidgetChanged",n,t,ee(r))})))},wt(ha);var fa=0,ma=function(t,e){this.lines=[],this.type=e,this.doc=t,this.id=++fa};function ga(t,e,n,r,i){if(r&&r.shared)return ya(t,e,n,r,i);if(t.cm&&!t.cm.curOp)return Ni(t.cm,ga)(t,e,n,r,i);var o=new ma(t,i),a=ae(e,n);if(r&&z(r,o,!1),a>0||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=R("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Je(t,e.line,e,n,o)||e.line!=n.line&&Je(t,n.line,e,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ne()}o.addToHistory&&Eo(t,{from:e,to:n,origin:"markText"},t.sel,NaN);var s,l=e.line,c=t.cm;if(t.iter(l,n.line+1,(function(r){c&&o.collapsed&&!c.options.lineWrapping&&Ke(r)==c.display.maxLine&&(s=!0),o.collapsed&&l!=e.line&&te(r,0),Oe(r,new De(o,l==e.line?e.ch:null,l==n.line?n.ch:null),t.cm&&t.cm.curOp),++l})),o.collapsed&&t.iter(e.line,n.line+1,(function(e){rn(t,e)&&te(e,0)})),o.clearOnEnter&&ft(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(Pe(),(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++fa,o.atomic=!0),c){if(s&&(c.curOp.updateMaxLine=!0),o.collapsed)zr(c,e.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var u=e.line;u<=n.line;u++)Fr(c,u,"text");o.atomic&&jo(c.doc),An(c,"markerAdded",c,o)}return o}ma.prototype.clear=function(){if(!this.explicitlyCleared){var t=this.doc.cm,e=t&&!t.curOp;if(e&&Mi(t),bt(this,"clear")){var n=this.find();n&&An(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],s=ke(a.markedSpans,this);t&&!this.collapsed?Fr(t,ee(a),"text"):t&&(null!=s.to&&(i=ee(a)),null!=s.from&&(r=ee(a))),a.markedSpans=Ie(a.markedSpans,s),null==s.from&&this.collapsed&&!rn(this.doc,a)&&t&&te(a,Ar(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var l=0;l<this.lines.length;++l){var c=Ke(this.lines[l]),u=sn(c);u>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=u,t.display.maxLineChanged=!0)}null!=r&&t&&this.collapsed&&zr(t,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&jo(t.doc)),t&&An(t,"markerCleared",t,this,r,i),e&&Si(t),this.parent&&this.parent.clear()}},ma.prototype.find=function(t,e){var n,r;null==t&&"bookmark"==this.type&&(t=1);for(var i=0;i<this.lines.length;++i){var o=this.lines[i],a=ke(o.markedSpans,this);if(null!=a.from&&(n=oe(e?o:ee(o),a.from),-1==t))return n;if(null!=a.to&&(r=oe(e?o:ee(o),a.to),1==t))return r}return n&&{from:n,to:r}},ma.prototype.changed=function(){var t=this,e=this.find(-1,!0),n=this,r=this.doc.cm;e&&r&&Pi(r,(function(){var i=e.line,o=ee(e.line),a=er(r,o);if(a&&(ur(a),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!rn(n.doc,i)&&null!=n.height){var s=n.height;n.height=null;var l=Gn(n)-s;l&&te(i,i.height+l)}An(r,"markerChanged",r,t)}))},ma.prototype.attachLine=function(t){if(!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;e.maybeHiddenMarkers&&-1!=U(e.maybeHiddenMarkers,this)||(e.maybeUnhiddenMarkers||(e.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(t)},ma.prototype.detachLine=function(t){if(this.lines.splice(U(this.lines,t),1),!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;(e.maybeHiddenMarkers||(e.maybeHiddenMarkers=[])).push(this)}},wt(ma);var va=function(t,e){this.markers=t,this.primary=e;for(var n=0;n<t.length;++n)t[n].parent=this};function ya(t,e,n,r,i){(r=z(r)).shared=!1;var o=[ga(t,e,n,r,i)],a=o[0],s=r.widgetNode;return yo(t,(function(t){s&&(r.widgetNode=s.cloneNode(!0)),o.push(ga(t,de(t,e),de(t,n),r,i));for(var l=0;l<t.linked.length;++l)if(t.linked[l].isParent)return;a=Y(o)})),new va(o,a)}function xa(t){return t.findMarks(oe(t.first,0),t.clipPos(oe(t.lastLine())),(function(t){return t.parent}))}function ba(t,e){for(var n=0;n<e.length;n++){var r=e[n],i=r.find(),o=t.clipPos(i.from),a=t.clipPos(i.to);if(ae(o,a)){var s=ga(t,o,a,r.primary,r.primary.type);r.markers.push(s),s.parent=r}}}function wa(t){for(var e=function(e){var n=t[e],r=[n.primary.doc];yo(n.primary.doc,(function(t){return r.push(t)}));for(var i=0;i<n.markers.length;i++){var o=n.markers[i];-1==U(r,o.doc)&&(o.parent=null,n.markers.splice(i--,1))}},n=0;n<t.length;n++)e(n)}va.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var t=0;t<this.markers.length;++t)this.markers[t].clear();An(this,"clear")}},va.prototype.find=function(t,e){return this.primary.find(t,e)},wt(va);var _a=0,Ma=function(t,e,n,r,i){if(!(this instanceof Ma))return new Ma(t,e,n,r,i);null==n&&(n=0),ua.call(this,[new ca([new cn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var o=oe(n,0);this.sel=so(o),this.history=new _o(null),this.id=++_a,this.modeOption=e,this.lineSep=r,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof t&&(t=this.splitLines(t)),vo(this,{from:o,to:o,text:t}),Wo(this,so(o),G)};Ma.prototype=Q(ua.prototype,{constructor:Ma,iter:function(t,e,n){n?this.iterN(t-this.first,e-t,n):this.iterN(this.first,this.first+this.size,t)},insert:function(t,e){for(var n=0,r=0;r<e.length;++r)n+=e[r].height;this.insertInner(t-this.first,e,n)},remove:function(t,e){this.removeInner(t-this.first,e)},getValue:function(t){var e=Qt(this,this.first,this.first+this.size);return!1===t?e:e.join(t||this.lineSeparator())},setValue:ki((function(t){var e=oe(this.first,0),n=this.first+this.size-1;Ko(this,{from:e,to:oe(n,Jt(this,n).text.length),text:this.splitLines(t),origin:"setValue",full:!0},!0),this.cm&&li(this.cm,0,0),Wo(this,so(e),G)})),replaceRange:function(t,e,n,r){ia(this,t,e=de(this,e),n=n?de(this,n):e,r)},getRange:function(t,e,n){var r=Kt(this,de(this,t),de(this,e));return!1===n?r:""===n?r.join(""):r.join(n||this.lineSeparator())},getLine:function(t){var e=this.getLineHandle(t);return e&&e.text},getLineHandle:function(t){if(re(this,t))return Jt(this,t)},getLineNumber:function(t){return ee(t)},getLineHandleVisualStart:function(t){return"number"==typeof t&&(t=Jt(this,t)),Ke(t)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(t){return de(this,t)},getCursor:function(t){var e=this.sel.primary();return null==t||"head"==t?e.head:"anchor"==t?e.anchor:"end"==t||"to"==t||!1===t?e.to():e.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:ki((function(t,e,n){Bo(this,de(this,"number"==typeof t?oe(t,e||0):t),null,n)})),setSelection:ki((function(t,e,n){Bo(this,de(this,t),de(this,e||t),n)})),extendSelection:ki((function(t,e,n){Oo(this,de(this,t),e&&de(this,e),n)})),extendSelections:ki((function(t,e){zo(this,fe(this,t),e)})),extendSelectionsBy:ki((function(t,e){zo(this,fe(this,Z(this.sel.ranges,t)),e)})),setSelections:ki((function(t,e,n){if(t.length){for(var r=[],i=0;i<t.length;i++)r[i]=new oo(de(this,t[i].anchor),de(this,t[i].head||t[i].anchor));null==e&&(e=Math.min(t.length-1,this.sel.primIndex)),Wo(this,ao(this.cm,r,e),n)}})),addSelection:ki((function(t,e,n){var r=this.sel.ranges.slice(0);r.push(new oo(de(this,t),de(this,e||t))),Wo(this,ao(this.cm,r,r.length-1),n)})),getSelection:function(t){for(var e,n=this.sel.ranges,r=0;r<n.length;r++){var i=Kt(this,n[r].from(),n[r].to());e=e?e.concat(i):i}return!1===t?e:e.join(t||this.lineSeparator())},getSelections:function(t){for(var e=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=Kt(this,n[r].from(),n[r].to());!1!==t&&(i=i.join(t||this.lineSeparator())),e[r]=i}return e},replaceSelection:function(t,e,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=t;this.replaceSelections(r,e,n||"+input")},replaceSelections:ki((function(t,e,n){for(var r=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];r[o]={from:a.from(),to:a.to(),text:this.splitLines(t[o]),origin:n}}for(var s=e&&"end"!=e&&po(this,r,e),l=r.length-1;l>=0;l--)Ko(this,r[l]);s?Ho(this,s):this.cm&&si(this.cm)})),undo:ki((function(){ta(this,"undo")})),redo:ki((function(){ta(this,"redo")})),undoSelection:ki((function(){ta(this,"undo",!0)})),redoSelection:ki((function(){ta(this,"redo",!0)})),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,e=0,n=0,r=0;r<t.done.length;r++)t.done[r].ranges||++e;for(var i=0;i<t.undone.length;i++)t.undone[i].ranges||++n;return{undo:e,redo:n}},clearHistory:function(){var t=this;this.history=new _o(this.history),yo(this,(function(e){return e.history=t.history}),!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(t){return t&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(t){return this.history.generation==(t||this.cleanGeneration)},getHistory:function(){return{done:ko(this.history.done),undone:ko(this.history.undone)}},setHistory:function(t){var e=this.history=new _o(this.history);e.done=ko(t.done.slice(0),null,!0),e.undone=ko(t.undone.slice(0),null,!0)},setGutterMarker:ki((function(t,e,n){return la(this,t,"gutter",(function(t){var r=t.gutterMarkers||(t.gutterMarkers={});return r[e]=n,!n&&rt(r)&&(t.gutterMarkers=null),!0}))})),clearGutter:ki((function(t){var e=this;this.iter((function(n){n.gutterMarkers&&n.gutterMarkers[t]&&la(e,n,"gutter",(function(){return n.gutterMarkers[t]=null,rt(n.gutterMarkers)&&(n.gutterMarkers=null),!0}))}))})),lineInfo:function(t){var e;if("number"==typeof t){if(!re(this,t))return null;if(e=t,!(t=Jt(this,t)))return null}else if(null==(e=ee(t)))return null;return{line:e,handle:t,text:t.text,gutterMarkers:t.gutterMarkers,textClass:t.textClass,bgClass:t.bgClass,wrapClass:t.wrapClass,widgets:t.widgets}},addLineClass:ki((function(t,e,n){return la(this,t,"gutter"==e?"gutter":"class",(function(t){var r="text"==e?"textClass":"background"==e?"bgClass":"gutter"==e?"gutterClass":"wrapClass";if(t[r]){if(S(n).test(t[r]))return!1;t[r]+=" "+n}else t[r]=n;return!0}))})),removeLineClass:ki((function(t,e,n){return la(this,t,"gutter"==e?"gutter":"class",(function(t){var r="text"==e?"textClass":"background"==e?"bgClass":"gutter"==e?"gutterClass":"wrapClass",i=t[r];if(!i)return!1;if(null==n)t[r]=null;else{var o=i.match(S(n));if(!o)return!1;var a=o.index+o[0].length;t[r]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0}))})),addLineWidget:ki((function(t,e,n){return pa(this,t,e,n)})),removeLineWidget:function(t){t.clear()},markText:function(t,e,n){return ga(this,de(this,t),de(this,e),n,n&&n.type||"range")},setBookmark:function(t,e){var n={replacedWith:e&&(null==e.nodeType?e.widget:e),insertLeft:e&&e.insertLeft,clearWhenEmpty:!1,shared:e&&e.shared,handleMouseEvents:e&&e.handleMouseEvents};return ga(this,t=de(this,t),t,n,"bookmark")},findMarksAt:function(t){var e=[],n=Jt(this,(t=de(this,t)).line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(null==i.from||i.from<=t.ch)&&(null==i.to||i.to>=t.ch)&&e.push(i.marker.parent||i.marker)}return e},findMarks:function(t,e,n){t=de(this,t),e=de(this,e);var r=[],i=t.line;return this.iter(t.line,e.line+1,(function(o){var a=o.markedSpans;if(a)for(var s=0;s<a.length;s++){var l=a[s];null!=l.to&&i==t.line&&t.ch>=l.to||null==l.from&&i!=t.line||null!=l.from&&i==e.line&&l.from>=e.ch||n&&!n(l.marker)||r.push(l.marker.parent||l.marker)}++i})),r},getAllMarks:function(){var t=[];return this.iter((function(e){var n=e.markedSpans;if(n)for(var r=0;r<n.length;++r)null!=n[r].from&&t.push(n[r].marker)})),t},posFromIndex:function(t){var e,n=this.first,r=this.lineSeparator().length;return this.iter((function(i){var o=i.text.length+r;if(o>t)return e=t,!0;t-=o,++n})),de(this,oe(n,e))},indexFromPos:function(t){var e=(t=de(this,t)).ch;if(t.line<this.first||t.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,t.line,(function(t){e+=t.text.length+n})),e},copy:function(t){var e=new Ma(Qt(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return e.scrollTop=this.scrollTop,e.scrollLeft=this.scrollLeft,e.sel=this.sel,e.extend=!1,t&&(e.history.undoDepth=this.history.undoDepth,e.setHistory(this.getHistory())),e},linkedDoc:function(t){t||(t={});var e=this.first,n=this.first+this.size;null!=t.from&&t.from>e&&(e=t.from),null!=t.to&&t.to<n&&(n=t.to);var r=new Ma(Qt(this,e,n),t.mode||this.modeOption,e,this.lineSep,this.direction);return t.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:t.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:t.sharedHist}],ba(r,xa(this)),r},unlinkDoc:function(t){if(t instanceof zs&&(t=t.doc),this.linked)for(var e=0;e<this.linked.length;++e)if(this.linked[e].doc==t){this.linked.splice(e,1),t.unlinkDoc(this),wa(xa(this));break}if(t.history==this.history){var n=[t.id];yo(t,(function(t){return n.push(t.id)}),!0),t.history=new _o(null),t.history.done=ko(this.history.done,n),t.history.undone=ko(this.history.undone,n)}},iterLinkedDocs:function(t){yo(this,t)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(t){return this.lineSep?t.split(this.lineSep):kt(t)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:ki((function(t){"rtl"!=t&&(t="ltr"),t!=this.direction&&(this.direction=t,this.iter((function(t){return t.order=null})),this.cm&&wo(this.cm))}))}),Ma.prototype.eachLine=Ma.prototype.iter;var Sa=0;function Ta(t){var e=this;if(La(e),!yt(e,t)&&!Vn(e.display,t)){_t(t),a&&(Sa=+new Date);var n=Ir(e,t,!0),r=t.dataTransfer.files;if(n&&!e.isReadOnly())if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),s=0,l=function(){++s==i&&Ni(e,(function(){var t={from:n=de(e.doc,n),to:n,text:e.doc.splitLines(o.filter((function(t){return null!=t})).join(e.doc.lineSeparator())),origin:"paste"};Ko(e.doc,t),Ho(e.doc,so(de(e.doc,n),de(e.doc,lo(t))))}))()},c=function(t,n){if(e.options.allowDropFileTypes&&-1==U(e.options.allowDropFileTypes,t.type))l();else{var r=new FileReader;r.onerror=function(){return l()},r.onload=function(){var t=r.result;/[\x00-\x08\x0e-\x1f]{2}/.test(t)||(o[n]=t),l()},r.readAsText(t)}},u=0;u<r.length;u++)c(r[u],u);else{if(e.state.draggingText&&e.doc.sel.contains(n)>-1)return e.state.draggingText(t),void setTimeout((function(){return e.display.input.focus()}),20);try{var h=t.dataTransfer.getData("Text");if(h){var d;if(e.state.draggingText&&!e.state.draggingText.copy&&(d=e.listSelections()),Go(e.doc,so(n,n)),d)for(var p=0;p<d.length;++p)ia(e.doc,"",d[p].anchor,d[p].head,"drag");e.replaceSelection(h,"around","paste"),e.display.input.focus()}}catch(t){}}}}function Ea(t,e){if(a&&(!t.state.draggingText||+new Date-Sa<100))Tt(e);else if(!yt(t,e)&&!Vn(t.display,e)&&(e.dataTransfer.setData("Text",t.getSelection()),e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setDragImage&&!d)){var n=A("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",h&&(n.width=n.height=1,t.display.wrapper.appendChild(n),n._top=n.offsetTop),e.dataTransfer.setDragImage(n,0,0),h&&n.parentNode.removeChild(n)}}function Ca(t,e){var n=Ir(t,e);if(n){var r=document.createDocumentFragment();jr(t,n,r),t.display.dragCursor||(t.display.dragCursor=A("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),L(t.display.dragCursor,r)}}function La(t){t.display.dragCursor&&(t.display.lineSpace.removeChild(t.display.dragCursor),t.display.dragCursor=null)}function Aa(t){if(document.getElementsByClassName){for(var e=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<e.length;r++){var i=e[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation((function(){for(var e=0;e<n.length;e++)t(n[e])}))}}var Ra=!1;function Pa(){Ra||(Na(),Ra=!0)}function Na(){var t;ft(window,"resize",(function(){null==t&&(t=setTimeout((function(){t=null,Aa(Da)}),100))})),ft(window,"blur",(function(){return Aa(Kr)}))}function Da(t){var e=t.display;e.cachedCharWidth=e.cachedTextHeight=e.cachedPaddingH=null,e.scrollbarsClipped=!1,t.setSize()}for(var ka={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Ia=0;Ia<10;Ia++)ka[Ia+48]=ka[Ia+96]=String(Ia);for(var Oa=65;Oa<=90;Oa++)ka[Oa]=String.fromCharCode(Oa);for(var za=1;za<=12;za++)ka[za+111]=ka[za+63235]="F"+za;var Fa={};function Ba(t){var e,n,r,i,o=t.split(/-(?!$)/);t=o[o.length-1];for(var a=0;a<o.length-1;a++){var s=o[a];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))e=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else{if(!/^s(hift)?$/i.test(s))throw new Error("Unrecognized modifier name: "+s);r=!0}}return e&&(t="Alt-"+t),n&&(t="Ctrl-"+t),i&&(t="Cmd-"+t),r&&(t="Shift-"+t),t}function Ua(t){var e={};for(var n in t)if(t.hasOwnProperty(n)){var r=t[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==r){delete t[n];continue}for(var i=Z(n.split(" "),Ba),o=0;o<i.length;o++){var a=void 0,s=void 0;o==i.length-1?(s=i.join(" "),a=r):(s=i.slice(0,o+1).join(" "),a="...");var l=e[s];if(l){if(l!=a)throw new Error("Inconsistent bindings for "+s)}else e[s]=a}delete t[n]}for(var c in e)t[c]=e[c];return t}function Ha(t,e,n,r){var i=(e=ja(e)).call?e.call(t,r):e[t];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&n(i))return"handled";if(e.fallthrough){if("[object Array]"!=Object.prototype.toString.call(e.fallthrough))return Ha(t,e.fallthrough,n,r);for(var o=0;o<e.fallthrough.length;o++){var a=Ha(t,e.fallthrough[o],n,r);if(a)return a}}}function Wa(t){var e="string"==typeof t?t:ka[t.keyCode];return"Ctrl"==e||"Alt"==e||"Shift"==e||"Mod"==e}function Ga(t,e,n){var r=t;return e.altKey&&"Alt"!=r&&(t="Alt-"+t),(_?e.metaKey:e.ctrlKey)&&"Ctrl"!=r&&(t="Ctrl-"+t),(_?e.ctrlKey:e.metaKey)&&"Mod"!=r&&(t="Cmd-"+t),!n&&e.shiftKey&&"Shift"!=r&&(t="Shift-"+t),t}function Va(t,e){if(h&&34==t.keyCode&&t.char)return!1;var n=ka[t.keyCode];return null!=n&&!t.altGraphKey&&(3==t.keyCode&&t.code&&(n=t.code),Ga(n,t,e))}function ja(t){return"string"==typeof t?Fa[t]:t}function $a(t,e){for(var n=t.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=e(n[i]);r.length&&ae(o.from,Y(r).to)<=0;){var a=r.pop();if(ae(a.from,o.from)<0){o.from=a.from;break}}r.push(o)}Pi(t,(function(){for(var e=r.length-1;e>=0;e--)ia(t.doc,"",r[e].from,r[e].to,"+delete");si(t)}))}function qa(t,e,n){var r=at(t.text,e+n,n);return r<0||r>t.text.length?null:r}function Xa(t,e,n){var r=qa(t,e.ch,n);return null==r?null:new oe(e.line,r,n<0?"after":"before")}function Ya(t,e,n,r,i){if(t){"rtl"==e.doc.direction&&(i=-i);var o=dt(n,e.doc.direction);if(o){var a,s=i<0?Y(o):o[0],l=i<0==(1==s.level)?"after":"before";if(s.level>0||"rtl"==e.doc.direction){var c=nr(e,n);a=i<0?n.text.length-1:0;var u=rr(e,c,a).top;a=st((function(t){return rr(e,c,t).top==u}),i<0==(1==s.level)?s.from:s.to-1,a),"before"==l&&(a=qa(n,a,1))}else a=i<0?s.to:s.from;return new oe(r,a,l)}}return new oe(r,i<0?n.text.length:0,i<0?"before":"after")}function Za(t,e,n,r){var i=dt(e,t.doc.direction);if(!i)return Xa(e,n,r);n.ch>=e.text.length?(n.ch=e.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=ut(i,n.ch,n.sticky),a=i[o];if("ltr"==t.doc.direction&&a.level%2==0&&(r>0?a.to>n.ch:a.from<n.ch))return Xa(e,n,r);var s,l=function(t,n){return qa(e,t instanceof oe?t.ch:t,n)},c=function(n){return t.options.lineWrapping?(s=s||nr(t,e),Sr(t,e,s,n)):{begin:0,end:e.text.length}},u=c("before"==n.sticky?l(n,-1):n.ch);if("rtl"==t.doc.direction||1==a.level){var h=1==a.level==r<0,d=l(n,h?1:-1);if(null!=d&&(h?d<=a.to&&d<=u.end:d>=a.from&&d>=u.begin)){var p=h?"before":"after";return new oe(n.line,d,p)}}var f=function(t,e,r){for(var o=function(t,e){return e?new oe(n.line,l(t,1),"before"):new oe(n.line,t,"after")};t>=0&&t<i.length;t+=e){var a=i[t],s=e>0==(1!=a.level),c=s?r.begin:l(r.end,-1);if(a.from<=c&&c<a.to)return o(c,s);if(c=s?a.from:l(a.to,-1),r.begin<=c&&c<r.end)return o(c,s)}},m=f(o+r,r,u);if(m)return m;var g=r>0?u.end:l(u.begin,-1);return null==g||r>0&&g==e.text.length||!(m=f(r>0?0:i.length-1,r,c(g)))?null:m}Fa.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Fa.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Fa.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Fa.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Fa.default=y?Fa.macDefault:Fa.pcDefault;var Ja={selectAll:Zo,singleSelection:function(t){return t.setSelection(t.getCursor("anchor"),t.getCursor("head"),G)},killLine:function(t){return $a(t,(function(e){if(e.empty()){var n=Jt(t.doc,e.head.line).text.length;return e.head.ch==n&&e.head.line<t.lastLine()?{from:e.head,to:oe(e.head.line+1,0)}:{from:e.head,to:oe(e.head.line,n)}}return{from:e.from(),to:e.to()}}))},deleteLine:function(t){return $a(t,(function(e){return{from:oe(e.from().line,0),to:de(t.doc,oe(e.to().line+1,0))}}))},delLineLeft:function(t){return $a(t,(function(t){return{from:oe(t.from().line,0),to:t.from()}}))},delWrappedLineLeft:function(t){return $a(t,(function(e){var n=t.charCoords(e.head,"div").top+5;return{from:t.coordsChar({left:0,top:n},"div"),to:e.from()}}))},delWrappedLineRight:function(t){return $a(t,(function(e){var n=t.charCoords(e.head,"div").top+5,r=t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:n},"div");return{from:e.from(),to:r}}))},undo:function(t){return t.undo()},redo:function(t){return t.redo()},undoSelection:function(t){return t.undoSelection()},redoSelection:function(t){return t.redoSelection()},goDocStart:function(t){return t.extendSelection(oe(t.firstLine(),0))},goDocEnd:function(t){return t.extendSelection(oe(t.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy((function(e){return Ka(t,e.head.line)}),{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy((function(e){return ts(t,e.head)}),{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy((function(e){return Qa(t,e.head.line)}),{origin:"+move",bias:-1})},goLineRight:function(t){return t.extendSelectionsBy((function(e){var n=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:n},"div")}),j)},goLineLeft:function(t){return t.extendSelectionsBy((function(e){var n=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:0,top:n},"div")}),j)},goLineLeftSmart:function(t){return t.extendSelectionsBy((function(e){var n=t.cursorCoords(e.head,"div").top+5,r=t.coordsChar({left:0,top:n},"div");return r.ch<t.getLine(r.line).search(/\S/)?ts(t,e.head):r}),j)},goLineUp:function(t){return t.moveV(-1,"line")},goLineDown:function(t){return t.moveV(1,"line")},goPageUp:function(t){return t.moveV(-1,"page")},goPageDown:function(t){return t.moveV(1,"page")},goCharLeft:function(t){return t.moveH(-1,"char")},goCharRight:function(t){return t.moveH(1,"char")},goColumnLeft:function(t){return t.moveH(-1,"column")},goColumnRight:function(t){return t.moveH(1,"column")},goWordLeft:function(t){return t.moveH(-1,"word")},goGroupRight:function(t){return t.moveH(1,"group")},goGroupLeft:function(t){return t.moveH(-1,"group")},goWordRight:function(t){return t.moveH(1,"word")},delCharBefore:function(t){return t.deleteH(-1,"codepoint")},delCharAfter:function(t){return t.deleteH(1,"char")},delWordBefore:function(t){return t.deleteH(-1,"word")},delWordAfter:function(t){return t.deleteH(1,"word")},delGroupBefore:function(t){return t.deleteH(-1,"group")},delGroupAfter:function(t){return t.deleteH(1,"group")},indentAuto:function(t){return t.indentSelection("smart")},indentMore:function(t){return t.indentSelection("add")},indentLess:function(t){return t.indentSelection("subtract")},insertTab:function(t){return t.replaceSelection("\t")},insertSoftTab:function(t){for(var e=[],n=t.listSelections(),r=t.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),a=F(t.getLine(o.line),o.ch,r);e.push(X(r-a%r))}t.replaceSelections(e)},defaultTab:function(t){t.somethingSelected()?t.indentSelection("add"):t.execCommand("insertTab")},transposeChars:function(t){return Pi(t,(function(){for(var e=t.listSelections(),n=[],r=0;r<e.length;r++)if(e[r].empty()){var i=e[r].head,o=Jt(t.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new oe(i.line,i.ch-1)),i.ch>0)i=new oe(i.line,i.ch+1),t.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),oe(i.line,i.ch-2),i,"+transpose");else if(i.line>t.doc.first){var a=Jt(t.doc,i.line-1).text;a&&(i=new oe(i.line,1),t.replaceRange(o.charAt(0)+t.doc.lineSeparator()+a.charAt(a.length-1),oe(i.line-1,a.length-1),i,"+transpose"))}n.push(new oo(i,i))}t.setSelections(n)}))},newlineAndIndent:function(t){return Pi(t,(function(){for(var e=t.listSelections(),n=e.length-1;n>=0;n--)t.replaceRange(t.doc.lineSeparator(),e[n].anchor,e[n].head,"+input");e=t.listSelections();for(var r=0;r<e.length;r++)t.indentLine(e[r].from().line,null,!0);si(t)}))},openLine:function(t){return t.replaceSelection("\n","start")},toggleOverwrite:function(t){return t.toggleOverwrite()}};function Ka(t,e){var n=Jt(t.doc,e),r=Ke(n);return r!=n&&(e=ee(r)),Ya(!0,t,r,e,1)}function Qa(t,e){var n=Jt(t.doc,e),r=Qe(n);return r!=n&&(e=ee(r)),Ya(!0,t,n,e,-1)}function ts(t,e){var n=Ka(t,e.line),r=Jt(t.doc,n.line),i=dt(r,t.doc.direction);if(!i||0==i[0].level){var o=Math.max(n.ch,r.text.search(/\S/)),a=e.line==n.line&&e.ch<=o&&e.ch;return oe(n.line,a?0:o,n.sticky)}return n}function es(t,e,n){if("string"==typeof e&&!(e=Ja[e]))return!1;t.display.input.ensurePolled();var r=t.display.shift,i=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),n&&(t.display.shift=!1),i=e(t)!=W}finally{t.display.shift=r,t.state.suppressEdits=!1}return i}function ns(t,e,n){for(var r=0;r<t.state.keyMaps.length;r++){var i=Ha(e,t.state.keyMaps[r],n,t);if(i)return i}return t.options.extraKeys&&Ha(e,t.options.extraKeys,n,t)||Ha(e,t.options.keyMap,n,t)}var rs=new B;function is(t,e,n,r){var i=t.state.keySeq;if(i){if(Wa(e))return"handled";if(/\'$/.test(e)?t.state.keySeq=null:rs.set(50,(function(){t.state.keySeq==i&&(t.state.keySeq=null,t.display.input.reset())})),os(t,i+" "+e,n,r))return!0}return os(t,e,n,r)}function os(t,e,n,r){var i=ns(t,e,r);return"multi"==i&&(t.state.keySeq=e),"handled"==i&&An(t,"keyHandled",t,e,n),"handled"!=i&&"multi"!=i||(_t(n),Xr(t)),!!i}function as(t,e){var n=Va(e,!0);return!!n&&(e.shiftKey&&!t.state.keySeq?is(t,"Shift-"+n,e,(function(e){return es(t,e,!0)}))||is(t,n,e,(function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return es(t,e)})):is(t,n,e,(function(e){return es(t,e)})))}function ss(t,e,n){return is(t,"'"+n+"'",e,(function(e){return es(t,e,!0)}))}var ls=null;function cs(t){var e=this;if(!(t.target&&t.target!=e.display.input.getField()||(e.curOp.focus=N(),yt(e,t)))){a&&s<11&&27==t.keyCode&&(t.returnValue=!1);var r=t.keyCode;e.display.shift=16==r||t.shiftKey;var i=as(e,t);h&&(ls=i?r:null,i||88!=r||Ot||!(y?t.metaKey:t.ctrlKey)||e.replaceSelection("",null,"cut")),n&&!y&&!i&&46==r&&t.shiftKey&&!t.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=r||/\bCodeMirror-crosshair\b/.test(e.display.lineDiv.className)||us(e)}}function us(t){var e=t.display.lineDiv;function n(t){18!=t.keyCode&&t.altKey||(E(e,"CodeMirror-crosshair"),gt(document,"keyup",n),gt(document,"mouseover",n))}D(e,"CodeMirror-crosshair"),ft(document,"keyup",n),ft(document,"mouseover",n)}function hs(t){16==t.keyCode&&(this.doc.sel.shift=!1),yt(this,t)}function ds(t){var e=this;if(!(t.target&&t.target!=e.display.input.getField()||Vn(e.display,t)||yt(e,t)||t.ctrlKey&&!t.altKey||y&&t.metaKey)){var n=t.keyCode,r=t.charCode;if(h&&n==ls)return ls=null,void _t(t);if(!h||t.which&&!(t.which<10)||!as(e,t)){var i=String.fromCharCode(null==r?n:r);"\b"!=i&&(ss(e,t,i)||e.display.input.onKeyPress(t))}}}var ps,fs,ms=400,gs=function(t,e,n){this.time=t,this.pos=e,this.button=n};function vs(t,e){var n=+new Date;return fs&&fs.compare(n,t,e)?(ps=fs=null,"triple"):ps&&ps.compare(n,t,e)?(fs=new gs(n,t,e),ps=null,"double"):(ps=new gs(n,t,e),fs=null,"single")}function ys(t){var e=this,n=e.display;if(!(yt(e,t)||n.activeTouch&&n.input.supportsTouch()))if(n.input.ensurePolled(),n.shift=t.shiftKey,Vn(n,t))l||(n.scroller.draggable=!1,setTimeout((function(){return n.scroller.draggable=!0}),100));else if(!Cs(e,t)){var r=Ir(e,t),i=Ct(t),o=r?vs(r,i):"single";window.focus(),1==i&&e.state.selectingText&&e.state.selectingText(t),r&&xs(e,i,r,o,t)||(1==i?r?ws(e,r,o,t):Et(t)==n.scroller&&_t(t):2==i?(r&&Oo(e.doc,r),setTimeout((function(){return n.input.focus()}),20)):3==i&&(M?e.display.input.onContextMenu(t):Zr(e)))}}function xs(t,e,n,r,i){var o="Click";return"double"==r?o="Double"+o:"triple"==r&&(o="Triple"+o),is(t,Ga(o=(1==e?"Left":2==e?"Middle":"Right")+o,i),i,(function(e){if("string"==typeof e&&(e=Ja[e]),!e)return!1;var r=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),r=e(t,n)!=W}finally{t.state.suppressEdits=!1}return r}))}function bs(t,e,n){var r=t.getOption("configureMouse"),i=r?r(t,e,n):{};if(null==i.unit){var o=x?n.shiftKey&&n.metaKey:n.altKey;i.unit=o?"rectangle":"single"==e?"char":"double"==e?"word":"line"}return(null==i.extend||t.doc.extend)&&(i.extend=t.doc.extend||n.shiftKey),null==i.addNew&&(i.addNew=y?n.metaKey:n.ctrlKey),null==i.moveOnDrag&&(i.moveOnDrag=!(y?n.altKey:n.ctrlKey)),i}function ws(t,e,n,r){a?setTimeout(O(Yr,t),0):t.curOp.focus=N();var i,o=bs(t,n,r),s=t.doc.sel;t.options.dragDrop&&Rt&&!t.isReadOnly()&&"single"==n&&(i=s.contains(e))>-1&&(ae((i=s.ranges[i]).from(),e)<0||e.xRel>0)&&(ae(i.to(),e)>0||e.xRel<0)?_s(t,r,e,o):Ss(t,r,e,o)}function _s(t,e,n,r){var i=t.display,o=!1,c=Ni(t,(function(e){l&&(i.scroller.draggable=!1),t.state.draggingText=!1,t.state.delayingBlurEvent&&(t.hasFocus()?t.state.delayingBlurEvent=!1:Zr(t)),gt(i.wrapper.ownerDocument,"mouseup",c),gt(i.wrapper.ownerDocument,"mousemove",u),gt(i.scroller,"dragstart",h),gt(i.scroller,"drop",c),o||(_t(e),r.addNew||Oo(t.doc,n,null,null,r.extend),l&&!d||a&&9==s?setTimeout((function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()}),20):i.input.focus())})),u=function(t){o=o||Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)>=10},h=function(){return o=!0};l&&(i.scroller.draggable=!0),t.state.draggingText=c,c.copy=!r.moveOnDrag,ft(i.wrapper.ownerDocument,"mouseup",c),ft(i.wrapper.ownerDocument,"mousemove",u),ft(i.scroller,"dragstart",h),ft(i.scroller,"drop",c),t.state.delayingBlurEvent=!0,setTimeout((function(){return i.input.focus()}),20),i.scroller.dragDrop&&i.scroller.dragDrop()}function Ms(t,e,n){if("char"==n)return new oo(e,e);if("word"==n)return t.findWordAt(e);if("line"==n)return new oo(oe(e.line,0),de(t.doc,oe(e.line+1,0)));var r=n(t,e);return new oo(r.from,r.to)}function Ss(t,e,n,r){a&&Zr(t);var i=t.display,o=t.doc;_t(e);var s,l,c=o.sel,u=c.ranges;if(r.addNew&&!r.extend?(l=o.sel.contains(n),s=l>-1?u[l]:new oo(n,n)):(s=o.sel.primary(),l=o.sel.primIndex),"rectangle"==r.unit)r.addNew||(s=new oo(n,n)),n=Ir(t,e,!0,!0),l=-1;else{var h=Ms(t,n,r.unit);s=r.extend?Io(s,h.anchor,h.head,r.extend):h}r.addNew?-1==l?(l=u.length,Wo(o,ao(t,u.concat([s]),l),{scroll:!1,origin:"*mouse"})):u.length>1&&u[l].empty()&&"char"==r.unit&&!r.extend?(Wo(o,ao(t,u.slice(0,l).concat(u.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),c=o.sel):Fo(o,l,s,V):(l=0,Wo(o,new io([s],0),V),c=o.sel);var d=n;function p(e){if(0!=ae(d,e))if(d=e,"rectangle"==r.unit){for(var i=[],a=t.options.tabSize,u=F(Jt(o,n.line).text,n.ch,a),h=F(Jt(o,e.line).text,e.ch,a),p=Math.min(u,h),f=Math.max(u,h),m=Math.min(n.line,e.line),g=Math.min(t.lastLine(),Math.max(n.line,e.line));m<=g;m++){var v=Jt(o,m).text,y=$(v,p,a);p==f?i.push(new oo(oe(m,y),oe(m,y))):v.length>y&&i.push(new oo(oe(m,y),oe(m,$(v,f,a))))}i.length||i.push(new oo(n,n)),Wo(o,ao(t,c.ranges.slice(0,l).concat(i),l),{origin:"*mouse",scroll:!1}),t.scrollIntoView(e)}else{var x,b=s,w=Ms(t,e,r.unit),_=b.anchor;ae(w.anchor,_)>0?(x=w.head,_=ue(b.from(),w.anchor)):(x=w.anchor,_=ce(b.to(),w.head));var M=c.ranges.slice(0);M[l]=Ts(t,new oo(de(o,_),x)),Wo(o,ao(t,M,l),V)}}var f=i.wrapper.getBoundingClientRect(),m=0;function g(e){var n=++m,a=Ir(t,e,!0,"rectangle"==r.unit);if(a)if(0!=ae(a,d)){t.curOp.focus=N(),p(a);var s=ei(i,o);(a.line>=s.to||a.line<s.from)&&setTimeout(Ni(t,(function(){m==n&&g(e)})),150)}else{var l=e.clientY<f.top?-20:e.clientY>f.bottom?20:0;l&&setTimeout(Ni(t,(function(){m==n&&(i.scroller.scrollTop+=l,g(e))})),50)}}function v(e){t.state.selectingText=!1,m=1/0,e&&(_t(e),i.input.focus()),gt(i.wrapper.ownerDocument,"mousemove",y),gt(i.wrapper.ownerDocument,"mouseup",x),o.history.lastSelOrigin=null}var y=Ni(t,(function(t){0!==t.buttons&&Ct(t)?g(t):v(t)})),x=Ni(t,v);t.state.selectingText=x,ft(i.wrapper.ownerDocument,"mousemove",y),ft(i.wrapper.ownerDocument,"mouseup",x)}function Ts(t,e){var n=e.anchor,r=e.head,i=Jt(t.doc,n.line);if(0==ae(n,r)&&n.sticky==r.sticky)return e;var o=dt(i);if(!o)return e;var a=ut(o,n.ch,n.sticky),s=o[a];if(s.from!=n.ch&&s.to!=n.ch)return e;var l,c=a+(s.from==n.ch==(1!=s.level)?0:1);if(0==c||c==o.length)return e;if(r.line!=n.line)l=(r.line-n.line)*("ltr"==t.doc.direction?1:-1)>0;else{var u=ut(o,r.ch,r.sticky),h=u-a||(r.ch-n.ch)*(1==s.level?-1:1);l=u==c-1||u==c?h<0:h>0}var d=o[c+(l?-1:0)],p=l==(1==d.level),f=p?d.from:d.to,m=p?"after":"before";return n.ch==f&&n.sticky==m?e:new oo(new oe(n.line,f,m),r)}function Es(t,e,n,r){var i,o;if(e.touches)i=e.touches[0].clientX,o=e.touches[0].clientY;else try{i=e.clientX,o=e.clientY}catch(t){return!1}if(i>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;r&&_t(e);var a=t.display,s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!bt(t,n))return St(e);o-=s.top-a.viewOffset;for(var l=0;l<t.display.gutterSpecs.length;++l){var c=a.gutters.childNodes[l];if(c&&c.getBoundingClientRect().right>=i)return vt(t,n,t,ne(t.doc,o),t.display.gutterSpecs[l].className,e),St(e)}}function Cs(t,e){return Es(t,e,"gutterClick",!0)}function Ls(t,e){Vn(t.display,e)||As(t,e)||yt(t,e,"contextmenu")||M||t.display.input.onContextMenu(e)}function As(t,e){return!!bt(t,"gutterContextMenu")&&Es(t,e,"gutterContextMenu",!1)}function Rs(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),dr(t)}gs.prototype.compare=function(t,e,n){return this.time+ms>t&&0==ae(e,this.pos)&&n==this.button};var Ps={toString:function(){return"CodeMirror.Init"}},Ns={},Ds={};function ks(t){var e=t.optionHandlers;function n(n,r,i,o){t.defaults[n]=r,i&&(e[n]=o?function(t,e,n){n!=Ps&&i(t,e,n)}:i)}t.defineOption=n,t.Init=Ps,n("value","",(function(t,e){return t.setValue(e)}),!0),n("mode",null,(function(t,e){t.doc.modeOption=e,fo(t)}),!0),n("indentUnit",2,fo,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,(function(t){mo(t),dr(t),zr(t)}),!0),n("lineSeparator",null,(function(t,e){if(t.doc.lineSep=e,e){var n=[],r=t.doc.first;t.doc.iter((function(t){for(var i=0;;){var o=t.text.indexOf(e,i);if(-1==o)break;i=o+e.length,n.push(oe(r,o))}r++}));for(var i=n.length-1;i>=0;i--)ia(t.doc,e,n[i],oe(n[i].line,n[i].ch+e.length))}})),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(t,e,n){t.state.specialChars=new RegExp(e.source+(e.test("\t")?"":"|\t"),"g"),n!=Ps&&t.refresh()})),n("specialCharPlaceholder",gn,(function(t){return t.refresh()}),!0),n("electricChars",!0),n("inputStyle",v?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),n("spellcheck",!1,(function(t,e){return t.getInputField().spellcheck=e}),!0),n("autocorrect",!1,(function(t,e){return t.getInputField().autocorrect=e}),!0),n("autocapitalize",!1,(function(t,e){return t.getInputField().autocapitalize=e}),!0),n("rtlMoveVisually",!b),n("wholeLineUpdateBefore",!0),n("theme","default",(function(t){Rs(t),Ji(t)}),!0),n("keyMap","default",(function(t,e,n){var r=ja(e),i=n!=Ps&&ja(n);i&&i.detach&&i.detach(t,r),r.attach&&r.attach(t,i||null)})),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Os,!0),n("gutters",[],(function(t,e){t.display.gutterSpecs=Yi(e,t.options.lineNumbers),Ji(t)}),!0),n("fixedGutter",!0,(function(t,e){t.display.gutters.style.left=e?Nr(t.display)+"px":"0",t.refresh()}),!0),n("coverGutterNextToScrollbar",!1,(function(t){return yi(t)}),!0),n("scrollbarStyle","native",(function(t){wi(t),yi(t),t.display.scrollbars.setScrollTop(t.doc.scrollTop),t.display.scrollbars.setScrollLeft(t.doc.scrollLeft)}),!0),n("lineNumbers",!1,(function(t,e){t.display.gutterSpecs=Yi(t.options.gutters,e),Ji(t)}),!0),n("firstLineNumber",1,Ji,!0),n("lineNumberFormatter",(function(t){return t}),Ji,!0),n("showCursorWhenSelecting",!1,Gr,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(function(t,e){"nocursor"==e&&(Kr(t),t.display.input.blur()),t.display.input.readOnlyChanged(e)})),n("screenReaderLabel",null,(function(t,e){e=""===e?null:e,t.display.input.screenReaderLabelChanged(e)})),n("disableInput",!1,(function(t,e){e||t.display.input.reset()}),!0),n("dragDrop",!0,Is),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,Gr,!0),n("singleCursorHeightPerLine",!0,Gr,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,mo,!0),n("addModeClass",!1,mo,!0),n("pollInterval",100),n("undoDepth",200,(function(t,e){return t.doc.history.undoDepth=e})),n("historyEventDelay",1250),n("viewportMargin",10,(function(t){return t.refresh()}),!0),n("maxHighlightLength",1e4,mo,!0),n("moveInputWithCursor",!0,(function(t,e){e||t.display.input.resetPosition()})),n("tabindex",null,(function(t,e){return t.display.input.getField().tabIndex=e||""})),n("autofocus",null),n("direction","ltr",(function(t,e){return t.doc.setDirection(e)}),!0),n("phrases",null)}function Is(t,e,n){if(!e!=!(n&&n!=Ps)){var r=t.display.dragFunctions,i=e?ft:gt;i(t.display.scroller,"dragstart",r.start),i(t.display.scroller,"dragenter",r.enter),i(t.display.scroller,"dragover",r.over),i(t.display.scroller,"dragleave",r.leave),i(t.display.scroller,"drop",r.drop)}}function Os(t){t.options.lineWrapping?(D(t.display.wrapper,"CodeMirror-wrap"),t.display.sizer.style.minWidth="",t.display.sizerWidth=null):(E(t.display.wrapper,"CodeMirror-wrap"),ln(t)),kr(t),zr(t),dr(t),setTimeout((function(){return yi(t)}),100)}function zs(t,e){var n=this;if(!(this instanceof zs))return new zs(t,e);this.options=e=e?z(e):{},z(Ns,e,!1);var r=e.value;"string"==typeof r?r=new Ma(r,e.mode,null,e.lineSeparator,e.direction):e.mode&&(r.modeOption=e.mode),this.doc=r;var i=new zs.inputStyles[e.inputStyle](this),o=this.display=new Ki(t,r,i,e);for(var c in o.wrapper.CodeMirror=this,Rs(this),e.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),wi(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new B,keySeq:null,specialChars:null},e.autofocus&&!v&&o.input.focus(),a&&s<11&&setTimeout((function(){return n.display.input.reset(!0)}),20),Fs(this),Pa(),Mi(this),this.curOp.forceUpdate=!0,xo(this,r),e.autofocus&&!v||this.hasFocus()?setTimeout((function(){n.hasFocus()&&!n.state.focused&&Jr(n)}),20):Kr(this),Ds)Ds.hasOwnProperty(c)&&Ds[c](this,e[c],Ps);Xi(this),e.finishInit&&e.finishInit(this);for(var u=0;u<Bs.length;++u)Bs[u](this);Si(this),l&&e.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}function Fs(t){var e=t.display;ft(e.scroller,"mousedown",Ni(t,ys)),ft(e.scroller,"dblclick",a&&s<11?Ni(t,(function(e){if(!yt(t,e)){var n=Ir(t,e);if(n&&!Cs(t,e)&&!Vn(t.display,e)){_t(e);var r=t.findWordAt(n);Oo(t.doc,r.anchor,r.head)}}})):function(e){return yt(t,e)||_t(e)}),ft(e.scroller,"contextmenu",(function(e){return Ls(t,e)})),ft(e.input.getField(),"contextmenu",(function(n){e.scroller.contains(n.target)||Ls(t,n)}));var n,r={end:0};function i(){e.activeTouch&&(n=setTimeout((function(){return e.activeTouch=null}),1e3),(r=e.activeTouch).end=+new Date)}function o(t){if(1!=t.touches.length)return!1;var e=t.touches[0];return e.radiusX<=1&&e.radiusY<=1}function l(t,e){if(null==e.left)return!0;var n=e.left-t.left,r=e.top-t.top;return n*n+r*r>400}ft(e.scroller,"touchstart",(function(i){if(!yt(t,i)&&!o(i)&&!Cs(t,i)){e.input.ensurePolled(),clearTimeout(n);var a=+new Date;e.activeTouch={start:a,moved:!1,prev:a-r.end<=300?r:null},1==i.touches.length&&(e.activeTouch.left=i.touches[0].pageX,e.activeTouch.top=i.touches[0].pageY)}})),ft(e.scroller,"touchmove",(function(){e.activeTouch&&(e.activeTouch.moved=!0)})),ft(e.scroller,"touchend",(function(n){var r=e.activeTouch;if(r&&!Vn(e,n)&&null!=r.left&&!r.moved&&new Date-r.start<300){var o,a=t.coordsChar(e.activeTouch,"page");o=!r.prev||l(r,r.prev)?new oo(a,a):!r.prev.prev||l(r,r.prev.prev)?t.findWordAt(a):new oo(oe(a.line,0),de(t.doc,oe(a.line+1,0))),t.setSelection(o.anchor,o.head),t.focus(),_t(n)}i()})),ft(e.scroller,"touchcancel",i),ft(e.scroller,"scroll",(function(){e.scroller.clientHeight&&(di(t,e.scroller.scrollTop),fi(t,e.scroller.scrollLeft,!0),vt(t,"scroll",t))})),ft(e.scroller,"mousewheel",(function(e){return ro(t,e)})),ft(e.scroller,"DOMMouseScroll",(function(e){return ro(t,e)})),ft(e.wrapper,"scroll",(function(){return e.wrapper.scrollTop=e.wrapper.scrollLeft=0})),e.dragFunctions={enter:function(e){yt(t,e)||Tt(e)},over:function(e){yt(t,e)||(Ca(t,e),Tt(e))},start:function(e){return Ea(t,e)},drop:Ni(t,Ta),leave:function(e){yt(t,e)||La(t)}};var c=e.input.getField();ft(c,"keyup",(function(e){return hs.call(t,e)})),ft(c,"keydown",Ni(t,cs)),ft(c,"keypress",Ni(t,ds)),ft(c,"focus",(function(e){return Jr(t,e)})),ft(c,"blur",(function(e){return Kr(t,e)}))}zs.defaults=Ns,zs.optionHandlers=Ds;var Bs=[];function Us(t,e,n,r){var i,o=t.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=xe(t,e).state:n="prev");var a=t.options.tabSize,s=Jt(o,e),l=F(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var c,u=s.text.match(/^\s*/)[0];if(r||/\S/.test(s.text)){if("smart"==n&&((c=o.mode.indent(i,s.text.slice(u.length),s.text))==W||c>150)){if(!r)return;n="prev"}}else c=0,n="not";"prev"==n?c=e>o.first?F(Jt(o,e-1).text,null,a):0:"add"==n?c=l+t.options.indentUnit:"subtract"==n?c=l-t.options.indentUnit:"number"==typeof n&&(c=l+n),c=Math.max(0,c);var h="",d=0;if(t.options.indentWithTabs)for(var p=Math.floor(c/a);p;--p)d+=a,h+="\t";if(d<c&&(h+=X(c-d)),h!=u)return ia(o,h,oe(e,0),oe(e,u.length),"+input"),s.stateAfter=null,!0;for(var f=0;f<o.sel.ranges.length;f++){var m=o.sel.ranges[f];if(m.head.line==e&&m.head.ch<u.length){var g=oe(e,u.length);Fo(o,f,new oo(g,g));break}}}zs.defineInitHook=function(t){return Bs.push(t)};var Hs=null;function Ws(t){Hs=t}function Gs(t,e,n,r,i){var o=t.doc;t.display.shift=!1,r||(r=o.sel);var a=+new Date-200,s="paste"==i||t.state.pasteIncoming>a,l=kt(e),c=null;if(s&&r.ranges.length>1)if(Hs&&Hs.text.join("\n")==e){if(r.ranges.length%Hs.text.length==0){c=[];for(var u=0;u<Hs.text.length;u++)c.push(o.splitLines(Hs.text[u]))}}else l.length==r.ranges.length&&t.options.pasteLinesPerSelection&&(c=Z(l,(function(t){return[t]})));for(var h=t.curOp.updateInput,d=r.ranges.length-1;d>=0;d--){var p=r.ranges[d],f=p.from(),m=p.to();p.empty()&&(n&&n>0?f=oe(f.line,f.ch-n):t.state.overwrite&&!s?m=oe(m.line,Math.min(Jt(o,m.line).text.length,m.ch+Y(l).length)):s&&Hs&&Hs.lineWise&&Hs.text.join("\n")==l.join("\n")&&(f=m=oe(f.line,0)));var g={from:f,to:m,text:c?c[d%c.length]:l,origin:i||(s?"paste":t.state.cutIncoming>a?"cut":"+input")};Ko(t.doc,g),An(t,"inputRead",t,g)}e&&!s&&js(t,e),si(t),t.curOp.updateInput<2&&(t.curOp.updateInput=h),t.curOp.typing=!0,t.state.pasteIncoming=t.state.cutIncoming=-1}function Vs(t,e){var n=t.clipboardData&&t.clipboardData.getData("Text");if(n)return t.preventDefault(),e.isReadOnly()||e.options.disableInput||Pi(e,(function(){return Gs(e,n,0,null,"paste")})),!0}function js(t,e){if(t.options.electricChars&&t.options.smartIndent)for(var n=t.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=t.getModeAt(i.head),a=!1;if(o.electricChars){for(var s=0;s<o.electricChars.length;s++)if(e.indexOf(o.electricChars.charAt(s))>-1){a=Us(t,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Jt(t.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Us(t,i.head.line,"smart"));a&&An(t,"electricInput",t,i.head.line)}}}function $s(t){for(var e=[],n=[],r=0;r<t.doc.sel.ranges.length;r++){var i=t.doc.sel.ranges[r].head.line,o={anchor:oe(i,0),head:oe(i+1,0)};n.push(o),e.push(t.getRange(o.anchor,o.head))}return{text:e,ranges:n}}function qs(t,e,n,r){t.setAttribute("autocorrect",n?"":"off"),t.setAttribute("autocapitalize",r?"":"off"),t.setAttribute("spellcheck",!!e)}function Xs(){var t=A("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),e=A("div",[t],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return l?t.style.width="1000px":t.setAttribute("wrap","off"),m&&(t.style.border="1px solid black"),qs(t),e}function Ys(t){var e=t.optionHandlers,n=t.helpers={};t.prototype={constructor:t,focus:function(){window.focus(),this.display.input.focus()},setOption:function(t,n){var r=this.options,i=r[t];r[t]==n&&"mode"!=t||(r[t]=n,e.hasOwnProperty(t)&&Ni(this,e[t])(this,n,i),vt(this,"optionChange",this,t))},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,e){this.state.keyMaps[e?"push":"unshift"](ja(t))},removeKeyMap:function(t){for(var e=this.state.keyMaps,n=0;n<e.length;++n)if(e[n]==t||e[n].name==t)return e.splice(n,1),!0},addOverlay:Di((function(e,n){var r=e.token?e:t.getMode(this.options,e);if(r.startState)throw new Error("Overlays may not be stateful.");J(this.state.overlays,{mode:r,modeSpec:e,opaque:n&&n.opaque,priority:n&&n.priority||0},(function(t){return t.priority})),this.state.modeGen++,zr(this)})),removeOverlay:Di((function(t){for(var e=this.state.overlays,n=0;n<e.length;++n){var r=e[n].modeSpec;if(r==t||"string"==typeof t&&r.name==t)return e.splice(n,1),this.state.modeGen++,void zr(this)}})),indentLine:Di((function(t,e,n){"string"!=typeof e&&"number"!=typeof e&&(e=null==e?this.options.smartIndent?"smart":"prev":e?"add":"subtract"),re(this.doc,t)&&Us(this,t,e,n)})),indentSelection:Di((function(t){for(var e=this.doc.sel.ranges,n=-1,r=0;r<e.length;r++){var i=e[r];if(i.empty())i.head.line>n&&(Us(this,i.head.line,t,!0),n=i.head.line,r==this.doc.sel.primIndex&&si(this));else{var o=i.from(),a=i.to(),s=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=s;l<n;++l)Us(this,l,t);var c=this.doc.sel.ranges;0==o.ch&&e.length==c.length&&c[r].from().ch>0&&Fo(this.doc,r,new oo(o,c[r].to()),G)}}})),getTokenAt:function(t,e){return Se(this,t,e)},getLineTokens:function(t,e){return Se(this,oe(t),e,!0)},getTokenTypeAt:function(t){t=de(this.doc,t);var e,n=ye(this,Jt(this.doc,t.line)),r=0,i=(n.length-1)/2,o=t.ch;if(0==o)e=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]<o)){e=n[2*a+2];break}r=a+1}}var s=e?e.indexOf("overlay "):-1;return s<0?e:0==s?null:e.slice(0,s-1)},getModeAt:function(e){var n=this.doc.mode;return n.innerMode?t.innerMode(n,this.getTokenAt(e).state).mode:n},getHelper:function(t,e){return this.getHelpers(t,e)[0]},getHelpers:function(t,e){var r=[];if(!n.hasOwnProperty(e))return r;var i=n[e],o=this.getModeAt(t);if("string"==typeof o[e])i[o[e]]&&r.push(i[o[e]]);else if(o[e])for(var a=0;a<o[e].length;a++){var s=i[o[e][a]];s&&r.push(s)}else o.helperType&&i[o.helperType]?r.push(i[o.helperType]):i[o.name]&&r.push(i[o.name]);for(var l=0;l<i._global.length;l++){var c=i._global[l];c.pred(o,this)&&-1==U(r,c.val)&&r.push(c.val)}return r},getStateAfter:function(t,e){var n=this.doc;return xe(this,(t=he(n,null==t?n.first+n.size-1:t))+1,e).state},cursorCoords:function(t,e){var n=this.doc.sel.primary();return xr(this,null==t?n.head:"object"==typeof t?de(this.doc,t):t?n.from():n.to(),e||"page")},charCoords:function(t,e){return yr(this,de(this.doc,t),e||"page")},coordsChar:function(t,e){return _r(this,(t=vr(this,t,e||"page")).left,t.top)},lineAtHeight:function(t,e){return t=vr(this,{top:t,left:0},e||"page").top,ne(this.doc,t+this.display.viewOffset)},heightAtLine:function(t,e,n){var r,i=!1;if("number"==typeof t){var o=this.doc.first+this.doc.size-1;t<this.doc.first?t=this.doc.first:t>o&&(t=o,i=!0),r=Jt(this.doc,t)}else r=t;return gr(this,r,{top:0,left:0},e||"page",n||i).top+(i?this.doc.height-an(r):0)},defaultTextHeight:function(){return Ar(this.display)},defaultCharWidth:function(){return Rr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(t,e,n,r,i){var o=this.display,a=(t=xr(this,de(this.doc,t))).bottom,s=t.left;if(e.style.position="absolute",e.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(e),o.sizer.appendChild(e),"over"==r)a=t.top;else if("above"==r||"near"==r){var l=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||t.bottom+e.offsetHeight>l)&&t.top>e.offsetHeight?a=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=l&&(a=t.bottom),s+e.offsetWidth>c&&(s=c-e.offsetWidth)}e.style.top=a+"px",e.style.left=e.style.right="","right"==i?(s=o.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-e.offsetWidth)/2),e.style.left=s+"px"),n&&ii(this,{left:s,top:a,right:s+e.offsetWidth,bottom:a+e.offsetHeight})},triggerOnKeyDown:Di(cs),triggerOnKeyPress:Di(ds),triggerOnKeyUp:hs,triggerOnMouseDown:Di(ys),execCommand:function(t){if(Ja.hasOwnProperty(t))return Ja[t].call(null,this)},triggerElectric:Di((function(t){js(this,t)})),findPosH:function(t,e,n,r){var i=1;e<0&&(i=-1,e=-e);for(var o=de(this.doc,t),a=0;a<e&&!(o=Zs(this.doc,o,i,n,r)).hitSide;++a);return o},moveH:Di((function(t,e){var n=this;this.extendSelectionsBy((function(r){return n.display.shift||n.doc.extend||r.empty()?Zs(n.doc,r.head,t,e,n.options.rtlMoveVisually):t<0?r.from():r.to()}),j)})),deleteH:Di((function(t,e){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):$a(this,(function(n){var i=Zs(r,n.head,t,e,!1);return t<0?{from:i,to:n.head}:{from:n.head,to:i}}))})),findPosV:function(t,e,n,r){var i=1,o=r;e<0&&(i=-1,e=-e);for(var a=de(this.doc,t),s=0;s<e;++s){var l=xr(this,a,"div");if(null==o?o=l.left:l.left=o,(a=Js(this,l,i,n)).hitSide)break}return a},moveV:Di((function(t,e){var n=this,r=this.doc,i=[],o=!this.display.shift&&!r.extend&&r.sel.somethingSelected();if(r.extendSelectionsBy((function(a){if(o)return t<0?a.from():a.to();var s=xr(n,a.head,"div");null!=a.goalColumn&&(s.left=a.goalColumn),i.push(s.left);var l=Js(n,s,t,e);return"page"==e&&a==r.sel.primary()&&ai(n,yr(n,l,"div").top-s.top),l}),j),i.length)for(var a=0;a<r.sel.ranges.length;a++)r.sel.ranges[a].goalColumn=i[a]})),findWordAt:function(t){var e=Jt(this.doc,t.line).text,n=t.ch,r=t.ch;if(e){var i=this.getHelper(t,"wordChars");"before"!=t.sticky&&r!=e.length||!n?++r:--n;for(var o=e.charAt(n),a=nt(o,i)?function(t){return nt(t,i)}:/\s/.test(o)?function(t){return/\s/.test(t)}:function(t){return!/\s/.test(t)&&!nt(t)};n>0&&a(e.charAt(n-1));)--n;for(;r<e.length&&a(e.charAt(r));)++r}return new oo(oe(t.line,n),oe(t.line,r))},toggleOverwrite:function(t){null!=t&&t==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?D(this.display.cursorDiv,"CodeMirror-overwrite"):E(this.display.cursorDiv,"CodeMirror-overwrite"),vt(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==N()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Di((function(t,e){li(this,t,e)})),getScrollInfo:function(){var t=this.display.scroller;return{left:t.scrollLeft,top:t.scrollTop,height:t.scrollHeight-Xn(this)-this.display.barHeight,width:t.scrollWidth-Xn(this)-this.display.barWidth,clientHeight:Zn(this),clientWidth:Yn(this)}},scrollIntoView:Di((function(t,e){null==t?(t={from:this.doc.sel.primary().head,to:null},null==e&&(e=this.options.cursorScrollMargin)):"number"==typeof t?t={from:oe(t,0),to:null}:null==t.from&&(t={from:t,to:null}),t.to||(t.to=t.from),t.margin=e||0,null!=t.from.line?ci(this,t):hi(this,t.from,t.to,t.margin)})),setSize:Di((function(t,e){var n=this,r=function(t){return"number"==typeof t||/^\d+$/.test(String(t))?t+"px":t};null!=t&&(this.display.wrapper.style.width=r(t)),null!=e&&(this.display.wrapper.style.height=r(e)),this.options.lineWrapping&&hr(this);var i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,(function(t){if(t.widgets)for(var e=0;e<t.widgets.length;e++)if(t.widgets[e].noHScroll){Fr(n,i,"widget");break}++i})),this.curOp.forceUpdate=!0,vt(this,"refresh",this)})),operation:function(t){return Pi(this,t)},startOperation:function(){return Mi(this)},endOperation:function(){return Si(this)},refresh:Di((function(){var t=this.display.cachedTextHeight;zr(this),this.curOp.forceUpdate=!0,dr(this),li(this,this.doc.scrollLeft,this.doc.scrollTop),ji(this.display),(null==t||Math.abs(t-Ar(this.display))>.5||this.options.lineWrapping)&&kr(this),vt(this,"refresh",this)})),swapDoc:Di((function(t){var e=this.doc;return e.cm=null,this.state.selectingText&&this.state.selectingText(),xo(this,t),dr(this),this.display.input.reset(),li(this,t.scrollLeft,t.scrollTop),this.curOp.forceScroll=!0,An(this,"swapDoc",this,e),e})),phrase:function(t){var e=this.options.phrases;return e&&Object.prototype.hasOwnProperty.call(e,t)?e[t]:t},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},wt(t),t.registerHelper=function(e,r,i){n.hasOwnProperty(e)||(n[e]=t[e]={_global:[]}),n[e][r]=i},t.registerGlobalHelper=function(e,r,i,o){t.registerHelper(e,r,o),n[e]._global.push({pred:i,val:o})}}function Zs(t,e,n,r,i){var o=e,a=n,s=Jt(t,e.line),l=i&&"rtl"==t.direction?-n:n;function c(){var n=e.line+l;return!(n<t.first||n>=t.first+t.size)&&(e=new oe(n,e.ch,e.sticky),s=Jt(t,n))}function u(o){var a;if("codepoint"==r){var u=s.text.charCodeAt(e.ch+(n>0?0:-1));if(isNaN(u))a=null;else{var h=n>0?u>=55296&&u<56320:u>=56320&&u<57343;a=new oe(e.line,Math.max(0,Math.min(s.text.length,e.ch+n*(h?2:1))),-n)}}else a=i?Za(t.cm,s,e,n):Xa(s,e,n);if(null==a){if(o||!c())return!1;e=Ya(i,t.cm,s,e.line,l)}else e=a;return!0}if("char"==r||"codepoint"==r)u();else if("column"==r)u(!0);else if("word"==r||"group"==r)for(var h=null,d="group"==r,p=t.cm&&t.cm.getHelper(e,"wordChars"),f=!0;!(n<0)||u(!f);f=!1){var m=s.text.charAt(e.ch)||"\n",g=nt(m,p)?"w":d&&"\n"==m?"n":!d||/\s/.test(m)?null:"p";if(!d||f||g||(g="s"),h&&h!=g){n<0&&(n=1,u(),e.sticky="after");break}if(g&&(h=g),n>0&&!u(!f))break}var v=Xo(t,e,o,a,!0);return se(o,v)&&(v.hitSide=!0),v}function Js(t,e,n,r){var i,o,a=t.doc,s=e.left;if("page"==r){var l=Math.min(t.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),c=Math.max(l-.5*Ar(t.display),3);i=(n>0?e.bottom:e.top)+n*c}else"line"==r&&(i=n>0?e.bottom+3:e.top-3);for(;(o=_r(t,s,i)).outside;){if(n<0?i<=0:i>=a.height){o.hitSide=!0;break}i+=5*n}return o}var Ks=function(t){this.cm=t,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new B,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Qs(t,e){var n=er(t,e.line);if(!n||n.hidden)return null;var r=Jt(t.doc,e.line),i=Kn(n,r,e.line),o=dt(r,t.doc.direction),a="left";o&&(a=ut(o,e.ch)%2?"right":"left");var s=ar(i.map,e.ch,a);return s.offset="right"==s.collapse?s.end:s.start,s}function tl(t){for(var e=t;e;e=e.parentNode)if(/CodeMirror-gutter-wrapper/.test(e.className))return!0;return!1}function el(t,e){return e&&(t.bad=!0),t}function nl(t,e,n,r,i){var o="",a=!1,s=t.doc.lineSeparator(),l=!1;function c(t){return function(e){return e.id==t}}function u(){a&&(o+=s,l&&(o+=s),a=l=!1)}function h(t){t&&(u(),o+=t)}function d(e){if(1==e.nodeType){var n=e.getAttribute("cm-text");if(n)return void h(n);var o,p=e.getAttribute("cm-marker");if(p){var f=t.findMarks(oe(r,0),oe(i+1,0),c(+p));return void(f.length&&(o=f[0].find(0))&&h(Kt(t.doc,o.from,o.to).join(s)))}if("false"==e.getAttribute("contenteditable"))return;var m=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(!/^br$/i.test(e.nodeName)&&0==e.textContent.length)return;m&&u();for(var g=0;g<e.childNodes.length;g++)d(e.childNodes[g]);/^(pre|p)$/i.test(e.nodeName)&&(l=!0),m&&(a=!0)}else 3==e.nodeType&&h(e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;d(e),e!=n;)e=e.nextSibling,l=!1;return o}function rl(t,e,n){var r;if(e==t.display.lineDiv){if(!(r=t.display.lineDiv.childNodes[n]))return el(t.clipPos(oe(t.display.viewTo-1)),!0);e=null,n=0}else for(r=e;;r=r.parentNode){if(!r||r==t.display.lineDiv)return null;if(r.parentNode&&r.parentNode==t.display.lineDiv)break}for(var i=0;i<t.display.view.length;i++){var o=t.display.view[i];if(o.node==r)return il(o,e,n)}}function il(t,e,n){var r=t.text.firstChild,i=!1;if(!e||!P(r,e))return el(oe(ee(t.line),0),!0);if(e==r&&(i=!0,e=r.childNodes[n],n=0,!e)){var o=t.rest?Y(t.rest):t.line;return el(oe(ee(o),o.text.length),i)}var a=3==e.nodeType?e:null,s=e;for(a||1!=e.childNodes.length||3!=e.firstChild.nodeType||(a=e.firstChild,n&&(n=a.nodeValue.length));s.parentNode!=r;)s=s.parentNode;var l=t.measure,c=l.maps;function u(e,n,r){for(var i=-1;i<(c?c.length:0);i++)for(var o=i<0?l.map:c[i],a=0;a<o.length;a+=3){var s=o[a+2];if(s==e||s==n){var u=ee(i<0?t.line:t.rest[i]),h=o[a]+r;return(r<0||s!=e)&&(h=o[a+(r?1:0)]),oe(u,h)}}}var h=u(a,s,n);if(h)return el(h,i);for(var d=s.nextSibling,p=a?a.nodeValue.length-n:0;d;d=d.nextSibling){if(h=u(d,d.firstChild,0))return el(oe(h.line,h.ch-p),i);p+=d.textContent.length}for(var f=s.previousSibling,m=n;f;f=f.previousSibling){if(h=u(f,f.firstChild,-1))return el(oe(h.line,h.ch+m),i);m+=f.textContent.length}}Ks.prototype.init=function(t){var e=this,n=this,r=n.cm,i=n.div=t.lineDiv;function o(t){for(var e=t.target;e;e=e.parentNode){if(e==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(e.className))break}return!1}function a(t){if(o(t)&&!yt(r,t)){if(r.somethingSelected())Ws({lineWise:!1,text:r.getSelections()}),"cut"==t.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var e=$s(r);Ws({lineWise:!0,text:e.text}),"cut"==t.type&&r.operation((function(){r.setSelections(e.ranges,0,G),r.replaceSelection("",null,"cut")}))}if(t.clipboardData){t.clipboardData.clearData();var a=Hs.text.join("\n");if(t.clipboardData.setData("Text",a),t.clipboardData.getData("Text")==a)return void t.preventDefault()}var s=Xs(),l=s.firstChild;r.display.lineSpace.insertBefore(s,r.display.lineSpace.firstChild),l.value=Hs.text.join("\n");var c=N();I(l),setTimeout((function(){r.display.lineSpace.removeChild(s),c.focus(),c==i&&n.showPrimarySelection()}),50)}}i.contentEditable=!0,qs(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize),ft(i,"paste",(function(t){!o(t)||yt(r,t)||Vs(t,r)||s<=11&&setTimeout(Ni(r,(function(){return e.updateFromDOM()})),20)})),ft(i,"compositionstart",(function(t){e.composing={data:t.data,done:!1}})),ft(i,"compositionupdate",(function(t){e.composing||(e.composing={data:t.data,done:!1})})),ft(i,"compositionend",(function(t){e.composing&&(t.data!=e.composing.data&&e.readFromDOMSoon(),e.composing.done=!0)})),ft(i,"touchstart",(function(){return n.forceCompositionEnd()})),ft(i,"input",(function(){e.composing||e.readFromDOMSoon()})),ft(i,"copy",a),ft(i,"cut",a)},Ks.prototype.screenReaderLabelChanged=function(t){t?this.div.setAttribute("aria-label",t):this.div.removeAttribute("aria-label")},Ks.prototype.prepareSelection=function(){var t=Vr(this.cm,!1);return t.focus=N()==this.div,t},Ks.prototype.showSelection=function(t,e){t&&this.cm.display.view.length&&((t.focus||e)&&this.showPrimarySelection(),this.showMultipleSelections(t))},Ks.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Ks.prototype.showPrimarySelection=function(){var t=this.getSelection(),e=this.cm,r=e.doc.sel.primary(),i=r.from(),o=r.to();if(e.display.viewTo==e.display.viewFrom||i.line>=e.display.viewTo||o.line<e.display.viewFrom)t.removeAllRanges();else{var a=rl(e,t.anchorNode,t.anchorOffset),s=rl(e,t.focusNode,t.focusOffset);if(!a||a.bad||!s||s.bad||0!=ae(ue(a,s),i)||0!=ae(ce(a,s),o)){var l=e.display.view,c=i.line>=e.display.viewFrom&&Qs(e,i)||{node:l[0].measure.map[2],offset:0},u=o.line<e.display.viewTo&&Qs(e,o);if(!u){var h=l[l.length-1].measure,d=h.maps?h.maps[h.maps.length-1]:h.map;u={node:d[d.length-1],offset:d[d.length-2]-d[d.length-3]}}if(c&&u){var p,f=t.rangeCount&&t.getRangeAt(0);try{p=T(c.node,c.offset,u.offset,u.node)}catch(t){}p&&(!n&&e.state.focused?(t.collapse(c.node,c.offset),p.collapsed||(t.removeAllRanges(),t.addRange(p))):(t.removeAllRanges(),t.addRange(p)),f&&null==t.anchorNode?t.addRange(f):n&&this.startGracePeriod()),this.rememberSelection()}else t.removeAllRanges()}}},Ks.prototype.startGracePeriod=function(){var t=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout((function(){t.gracePeriod=!1,t.selectionChanged()&&t.cm.operation((function(){return t.cm.curOp.selectionChanged=!0}))}),20)},Ks.prototype.showMultipleSelections=function(t){L(this.cm.display.cursorDiv,t.cursors),L(this.cm.display.selectionDiv,t.selection)},Ks.prototype.rememberSelection=function(){var t=this.getSelection();this.lastAnchorNode=t.anchorNode,this.lastAnchorOffset=t.anchorOffset,this.lastFocusNode=t.focusNode,this.lastFocusOffset=t.focusOffset},Ks.prototype.selectionInEditor=function(){var t=this.getSelection();if(!t.rangeCount)return!1;var e=t.getRangeAt(0).commonAncestorContainer;return P(this.div,e)},Ks.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&N()==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Ks.prototype.blur=function(){this.div.blur()},Ks.prototype.getField=function(){return this.div},Ks.prototype.supportsTouch=function(){return!0},Ks.prototype.receivedFocus=function(){var t=this,e=this;function n(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,n))}this.selectionInEditor()?setTimeout((function(){return t.pollSelection()}),20):Pi(this.cm,(function(){return e.cm.curOp.selectionChanged=!0})),this.polling.set(this.cm.options.pollInterval,n)},Ks.prototype.selectionChanged=function(){var t=this.getSelection();return t.anchorNode!=this.lastAnchorNode||t.anchorOffset!=this.lastAnchorOffset||t.focusNode!=this.lastFocusNode||t.focusOffset!=this.lastFocusOffset},Ks.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var t=this.getSelection(),e=this.cm;if(g&&u&&this.cm.display.gutterSpecs.length&&tl(t.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var n=rl(e,t.anchorNode,t.anchorOffset),r=rl(e,t.focusNode,t.focusOffset);n&&r&&Pi(e,(function(){Wo(e.doc,so(n,r),G),(n.bad||r.bad)&&(e.curOp.selectionChanged=!0)}))}}},Ks.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var t,e,n,r=this.cm,i=r.display,o=r.doc.sel.primary(),a=o.from(),s=o.to();if(0==a.ch&&a.line>r.firstLine()&&(a=oe(a.line-1,Jt(r.doc,a.line-1).length)),s.ch==Jt(r.doc,s.line).text.length&&s.line<r.lastLine()&&(s=oe(s.line+1,0)),a.line<i.viewFrom||s.line>i.viewTo-1)return!1;a.line==i.viewFrom||0==(t=Or(r,a.line))?(e=ee(i.view[0].line),n=i.view[0].node):(e=ee(i.view[t].line),n=i.view[t-1].node.nextSibling);var l,c,u=Or(r,s.line);if(u==i.view.length-1?(l=i.viewTo-1,c=i.lineDiv.lastChild):(l=ee(i.view[u+1].line)-1,c=i.view[u+1].node.previousSibling),!n)return!1;for(var h=r.doc.splitLines(nl(r,n,c,e,l)),d=Kt(r.doc,oe(e,0),oe(l,Jt(r.doc,l).text.length));h.length>1&&d.length>1;)if(Y(h)==Y(d))h.pop(),d.pop(),l--;else{if(h[0]!=d[0])break;h.shift(),d.shift(),e++}for(var p=0,f=0,m=h[0],g=d[0],v=Math.min(m.length,g.length);p<v&&m.charCodeAt(p)==g.charCodeAt(p);)++p;for(var y=Y(h),x=Y(d),b=Math.min(y.length-(1==h.length?p:0),x.length-(1==d.length?p:0));f<b&&y.charCodeAt(y.length-f-1)==x.charCodeAt(x.length-f-1);)++f;if(1==h.length&&1==d.length&&e==a.line)for(;p&&p>a.ch&&y.charCodeAt(y.length-f-1)==x.charCodeAt(x.length-f-1);)p--,f++;h[h.length-1]=y.slice(0,y.length-f).replace(/^\u200b+/,""),h[0]=h[0].slice(p).replace(/\u200b+$/,"");var w=oe(e,p),_=oe(l,d.length?Y(d).length-f:0);return h.length>1||h[0]||ae(w,_)?(ia(r.doc,h,w,_,"+input"),!0):void 0},Ks.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ks.prototype.reset=function(){this.forceCompositionEnd()},Ks.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Ks.prototype.readFromDOMSoon=function(){var t=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(t.readDOMTimeout=null,t.composing){if(!t.composing.done)return;t.composing=null}t.updateFromDOM()}),80))},Ks.prototype.updateFromDOM=function(){var t=this;!this.cm.isReadOnly()&&this.pollContent()||Pi(this.cm,(function(){return zr(t.cm)}))},Ks.prototype.setUneditable=function(t){t.contentEditable="false"},Ks.prototype.onKeyPress=function(t){0==t.charCode||this.composing||(t.preventDefault(),this.cm.isReadOnly()||Ni(this.cm,Gs)(this.cm,String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),0))},Ks.prototype.readOnlyChanged=function(t){this.div.contentEditable=String("nocursor"!=t)},Ks.prototype.onContextMenu=function(){},Ks.prototype.resetPosition=function(){},Ks.prototype.needsContentAttribute=!0;var ol=function(t){this.cm=t,this.prevInput="",this.pollingFast=!1,this.polling=new B,this.hasSelection=!1,this.composing=null};function al(t,e){if((e=e?z(e):{}).value=t.value,!e.tabindex&&t.tabIndex&&(e.tabindex=t.tabIndex),!e.placeholder&&t.placeholder&&(e.placeholder=t.placeholder),null==e.autofocus){var n=N();e.autofocus=n==t||null!=t.getAttribute("autofocus")&&n==document.body}function r(){t.value=s.getValue()}var i;if(t.form&&(ft(t.form,"submit",r),!e.leaveSubmitMethodAlone)){var o=t.form;i=o.submit;try{var a=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=a}}catch(t){}}e.finishInit=function(n){n.save=r,n.getTextArea=function(){return t},n.toTextArea=function(){n.toTextArea=isNaN,r(),t.parentNode.removeChild(n.getWrapperElement()),t.style.display="",t.form&&(gt(t.form,"submit",r),e.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=i))}},t.style.display="none";var s=zs((function(e){return t.parentNode.insertBefore(e,t.nextSibling)}),e);return s}function sl(t){t.off=gt,t.on=ft,t.wheelEventPixels=no,t.Doc=Ma,t.splitLines=kt,t.countColumn=F,t.findColumn=$,t.isWordChar=et,t.Pass=W,t.signal=vt,t.Line=cn,t.changeEnd=lo,t.scrollbarModel=bi,t.Pos=oe,t.cmpPos=ae,t.modes=Bt,t.mimeModes=Ut,t.resolveMode=Gt,t.getMode=Vt,t.modeExtensions=jt,t.extendMode=$t,t.copyState=qt,t.startState=Yt,t.innerMode=Xt,t.commands=Ja,t.keyMap=Fa,t.keyName=Va,t.isModifierKey=Wa,t.lookupKey=Ha,t.normalizeKeyMap=Ua,t.StringStream=Zt,t.SharedTextMarker=va,t.TextMarker=ma,t.LineWidget=ha,t.e_preventDefault=_t,t.e_stopPropagation=Mt,t.e_stop=Tt,t.addClass=D,t.contains=P,t.rmClass=E,t.keyNames=ka}ol.prototype.init=function(t){var e=this,n=this,r=this.cm;this.createField(t);var i=this.textarea;function o(t){if(!yt(r,t)){if(r.somethingSelected())Ws({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var e=$s(r);Ws({lineWise:!0,text:e.text}),"cut"==t.type?r.setSelections(e.ranges,null,G):(n.prevInput="",i.value=e.text.join("\n"),I(i))}"cut"==t.type&&(r.state.cutIncoming=+new Date)}}t.wrapper.insertBefore(this.wrapper,t.wrapper.firstChild),m&&(i.style.width="0px"),ft(i,"input",(function(){a&&s>=9&&e.hasSelection&&(e.hasSelection=null),n.poll()})),ft(i,"paste",(function(t){yt(r,t)||Vs(t,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())})),ft(i,"cut",o),ft(i,"copy",o),ft(t.scroller,"paste",(function(e){if(!Vn(t,e)&&!yt(r,e)){if(!i.dispatchEvent)return r.state.pasteIncoming=+new Date,void n.focus();var o=new Event("paste");o.clipboardData=e.clipboardData,i.dispatchEvent(o)}})),ft(t.lineSpace,"selectstart",(function(e){Vn(t,e)||_t(e)})),ft(i,"compositionstart",(function(){var t=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:t,range:r.markText(t,r.getCursor("to"),{className:"CodeMirror-composing"})}})),ft(i,"compositionend",(function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)}))},ol.prototype.createField=function(t){this.wrapper=Xs(),this.textarea=this.wrapper.firstChild},ol.prototype.screenReaderLabelChanged=function(t){t?this.textarea.setAttribute("aria-label",t):this.textarea.removeAttribute("aria-label")},ol.prototype.prepareSelection=function(){var t=this.cm,e=t.display,n=t.doc,r=Vr(t);if(t.options.moveInputWithCursor){var i=xr(t,n.sel.primary().head,"div"),o=e.wrapper.getBoundingClientRect(),a=e.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(e.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(e.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},ol.prototype.showSelection=function(t){var e=this.cm.display;L(e.cursorDiv,t.cursors),L(e.selectionDiv,t.selection),null!=t.teTop&&(this.wrapper.style.top=t.teTop+"px",this.wrapper.style.left=t.teLeft+"px")},ol.prototype.reset=function(t){if(!this.contextMenuPending&&!this.composing){var e=this.cm;if(e.somethingSelected()){this.prevInput="";var n=e.getSelection();this.textarea.value=n,e.state.focused&&I(this.textarea),a&&s>=9&&(this.hasSelection=n)}else t||(this.prevInput=this.textarea.value="",a&&s>=9&&(this.hasSelection=null))}},ol.prototype.getField=function(){return this.textarea},ol.prototype.supportsTouch=function(){return!1},ol.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||N()!=this.textarea))try{this.textarea.focus()}catch(t){}},ol.prototype.blur=function(){this.textarea.blur()},ol.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},ol.prototype.receivedFocus=function(){this.slowPoll()},ol.prototype.slowPoll=function(){var t=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){t.poll(),t.cm.state.focused&&t.slowPoll()}))},ol.prototype.fastPoll=function(){var t=!1,e=this;function n(){e.poll()||t?(e.pollingFast=!1,e.slowPoll()):(t=!0,e.polling.set(60,n))}e.pollingFast=!0,e.polling.set(20,n)},ol.prototype.poll=function(){var t=this,e=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!e.state.focused||It(n)&&!r&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var i=n.value;if(i==r&&!e.somethingSelected())return!1;if(a&&s>=9&&this.hasSelection===i||y&&/[\uf700-\uf7ff]/.test(i))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||r||(r=""),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var l=0,c=Math.min(r.length,i.length);l<c&&r.charCodeAt(l)==i.charCodeAt(l);)++l;return Pi(e,(function(){Gs(e,i.slice(l),r.length-l,null,t.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?n.value=t.prevInput="":t.prevInput=i,t.composing&&(t.composing.range.clear(),t.composing.range=e.markText(t.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},ol.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},ol.prototype.onKeyPress=function(){a&&s>=9&&(this.hasSelection=null),this.fastPoll()},ol.prototype.onContextMenu=function(t){var e=this,n=e.cm,r=n.display,i=e.textarea;e.contextMenuPending&&e.contextMenuPending();var o=Ir(n,t),c=r.scroller.scrollTop;if(o&&!h){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(o)&&Ni(n,Wo)(n.doc,so(o),G);var u,d=i.style.cssText,p=e.wrapper.style.cssText,f=e.wrapper.offsetParent.getBoundingClientRect();if(e.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(t.clientY-f.top-5)+"px; left: "+(t.clientX-f.left-5)+"px;\n z-index: 1000; background: "+(a?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",l&&(u=window.scrollY),r.input.focus(),l&&window.scrollTo(null,u),r.input.reset(),n.somethingSelected()||(i.value=e.prevInput=" "),e.contextMenuPending=v,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll),a&&s>=9&&g(),M){Tt(t);var m=function(){gt(window,"mouseup",m),setTimeout(v,20)};ft(window,"mouseup",m)}else setTimeout(v,50)}function g(){if(null!=i.selectionStart){var t=n.somethingSelected(),o=""+(t?i.value:"");i.value="⇚",i.value=o,e.prevInput=t?"":"",i.selectionStart=1,i.selectionEnd=o.length,r.selForContextMenu=n.doc.sel}}function v(){if(e.contextMenuPending==v&&(e.contextMenuPending=!1,e.wrapper.style.cssText=p,i.style.cssText=d,a&&s<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=c),null!=i.selectionStart)){(!a||a&&s<9)&&g();var t=0,o=function(){r.selForContextMenu==n.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&""==e.prevInput?Ni(n,Zo)(n):t++<10?r.detectingSelectAll=setTimeout(o,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(o,200)}}},ol.prototype.readOnlyChanged=function(t){t||this.reset(),this.textarea.disabled="nocursor"==t,this.textarea.readOnly=!!t},ol.prototype.setUneditable=function(){},ol.prototype.needsContentAttribute=!1,ks(zs),Ys(zs);var ll="iter insert remove copy getEditor constructor".split(" ");for(var cl in Ma.prototype)Ma.prototype.hasOwnProperty(cl)&&U(ll,cl)<0&&(zs.prototype[cl]=function(t){return function(){return t.apply(this.doc,arguments)}}(Ma.prototype[cl]));return wt(Ma),zs.inputStyles={textarea:ol,contenteditable:Ks},zs.defineMode=function(t){zs.defaults.mode||"null"==t||(zs.defaults.mode=t),Ht.apply(this,arguments)},zs.defineMIME=Wt,zs.defineMode("null",(function(){return{token:function(t){return t.skipToEnd()}}})),zs.defineMIME("text/plain","null"),zs.defineExtension=function(t,e){zs.prototype[t]=e},zs.defineDocExtension=function(t,e){Ma.prototype[t]=e},zs.fromTextArea=al,sl(zs),zs.version="5.65.0",zs}()}({exports:{}});class Au extends Z{constructor(t){super(),Y(this,t,null,Lu,o,{})}}function Ru(e){let n,r,i,o,a,s,c,p,m,v,y,b,w,_,M,S,T,E,C,L,A,R,P,N,D,k,I,O,z,F,B,U,H,W;return{c(){n=f("div"),r=f("div"),i=f("img"),a=g(),s=f("h1"),s.textContent="Step #1",c=g(),p=f("p"),p.textContent="Creation of exemplar multimedia content",m=g(),v=f("div"),y=f("img"),w=g(),_=f("h1"),_.textContent="Step #2",M=g(),S=f("p"),S.textContent="Publish on pages you administer",T=g(),E=f("div"),C=f("img"),A=g(),R=f("h1"),R.textContent="Step #3",P=g(),N=f("p"),N.textContent="Share through influencers, public and private groups",D=g(),k=f("div"),I=g(),O=f("div"),z=f("img"),B=g(),U=f("h1"),U.textContent="Step #4",H=g(),W=f("p"),W.textContent="Boost content",x(i,"alt","step #1"),l(i.src,o=pt+"assets/images/creation.png")||x(i,"src","/projects/seshat/assets/images/creation.png"),x(i,"class","svelte-4m7zi0"),x(s,"class","svelte-4m7zi0"),x(p,"class","svelte-4m7zi0"),x(r,"class","boosting-principles svelte-4m7zi0"),x(y,"alt","step #2"),l(y.src,b=pt+"assets/images/publish.png")||x(y,"src","/projects/seshat/assets/images/publish.png"),x(y,"class","svelte-4m7zi0"),x(_,"class","svelte-4m7zi0"),x(S,"class","svelte-4m7zi0"),x(v,"class","boosting-principles svelte-4m7zi0"),x(C,"alt","step #3"),l(C.src,L=pt+"assets/images/share.png")||x(C,"src","/projects/seshat/assets/images/share.png"),x(C,"class","svelte-4m7zi0"),x(R,"class","svelte-4m7zi0"),x(N,"class","svelte-4m7zi0"),x(E,"class","boosting-principles svelte-4m7zi0"),x(k,"class","vl svelte-4m7zi0"),x(z,"alt","step #4"),l(z.src,F=pt+"assets/images/boost.png")||x(z,"src","/projects/seshat/assets/images/boost.png"),x(z,"class","svelte-4m7zi0"),x(U,"class","svelte-4m7zi0"),x(W,"class","svelte-4m7zi0"),x(O,"class","boosting-principles svelte-4m7zi0"),x(n,"id","boosting-principles-container"),x(n,"class","container svelte-4m7zi0")},m(t,e){h(t,n,e),u(n,r),u(r,i),u(r,a),u(r,s),u(r,c),u(r,p),u(n,m),u(n,v),u(v,y),u(v,w),u(v,_),u(v,M),u(v,S),u(n,T),u(n,E),u(E,C),u(E,A),u(E,R),u(E,P),u(E,N),u(n,D),u(n,k),u(n,I),u(n,O),u(O,z),u(O,B),u(O,U),u(O,H),u(O,W)},p:t,i:t,o:t,d(t){t&&d(n)}}}class Pu extends Z{constructor(t){super(),Y(this,t,null,Ru,o,{})}}function Nu(e){let n,r,i,o,a,s,c,p,m,v,y,b,w,_,M,S,T,E,C,L,A,R,P,N,D,k,I,O,z,F,B,U,H,W;return{c(){n=f("div"),r=f("div"),i=f("img"),a=g(),s=f("h1"),s.textContent="Traditional Media",c=g(),p=f("p"),p.textContent="Newspapers",m=g(),v=f("p"),v.textContent="Magazines",y=g(),b=f("p"),b.textContent="Billboards",w=g(),_=f("p"),_.textContent="Radio",M=g(),S=f("p"),S.textContent="Broadcast TV",T=g(),E=f("p"),E.textContent="Direct paper mail",C=g(),L=f("div"),A=f("img"),P=g(),N=f("h1"),N.textContent="Digital Media",D=g(),k=f("p"),k.textContent="Online advertising",I=g(),O=f("p"),O.textContent="Search engines",z=g(),F=f("p"),F.textContent="Social media",B=g(),U=f("p"),U.textContent="Video streaming services",H=g(),W=f("p"),W.textContent="Websites",x(i,"alt","traditional media"),l(i.src,o=pt+"assets/images/newspaper.png")||x(i,"src","/projects/seshat/assets/images/newspaper.png"),x(i,"class","svelte-14ihxfw"),x(s,"class","svelte-14ihxfw"),x(p,"class","svelte-14ihxfw"),x(v,"class","svelte-14ihxfw"),x(b,"class","svelte-14ihxfw"),x(_,"class","svelte-14ihxfw"),x(S,"class","svelte-14ihxfw"),x(E,"class","svelte-14ihxfw"),x(r,"class","media-landscape svelte-14ihxfw"),x(A,"alt","digital media"),l(A.src,R=pt+"assets/images/devices.png")||x(A,"src","/projects/seshat/assets/images/devices.png"),x(A,"class","svelte-14ihxfw"),x(N,"class","svelte-14ihxfw"),x(k,"class","svelte-14ihxfw"),x(O,"class","svelte-14ihxfw"),x(F,"class","svelte-14ihxfw"),x(U,"class","svelte-14ihxfw"),x(W,"class","svelte-14ihxfw"),x(L,"class","media-landscape svelte-14ihxfw"),x(n,"id","media-landscape-container"),x(n,"class","container svelte-14ihxfw")},m(t,e){h(t,n,e),u(n,r),u(r,i),u(r,a),u(r,s),u(r,c),u(r,p),u(r,m),u(r,v),u(r,y),u(r,b),u(r,w),u(r,_),u(r,M),u(r,S),u(r,T),u(r,E),u(n,C),u(n,L),u(L,A),u(L,P),u(L,N),u(L,D),u(L,k),u(L,I),u(L,O),u(L,z),u(L,F),u(L,B),u(L,U),u(L,H),u(L,W)},p:t,i:t,o:t,d(t){t&&d(n)}}}class Du extends Z{constructor(t){super(),Y(this,t,null,Nu,o,{})}}function ku(e){let n,r,i,o,a,s,c,p,m,v,y,b,w,_,M,S,T,E,C,L,A,R,P,N,D,k,I,O,z,F,B,U,H,W,G,V,j,$,q,X,Y,Z,J,K,Q,tt,et,nt;return{c(){n=f("div"),r=f("div"),i=f("img"),a=g(),s=f("h1"),s.textContent="Views",c=g(),p=f("p"),p.textContent="Captures the IP address and browser information each time a visitor loads the page",m=g(),v=f("div"),y=f("img"),w=g(),_=f("h1"),_.textContent="Scrolling",M=g(),S=f("p"),S.textContent="Captures the scroll distance and speed of each visitor",T=g(),E=f("div"),C=f("img"),A=g(),R=f("h1"),R.textContent="Outbound clicks",P=g(),N=f("p"),N.textContent="Captures an outbound click event each time a visitor clicks a link that leads them away from the page",D=g(),k=f("div"),I=f("img"),z=g(),F=f("h1"),F.textContent="Video engagement",B=g(),U=f("p"),U.textContent="Captures video play, progress, and complete events as visitors view embedded videos",H=g(),W=f("div"),G=f("img"),j=g(),$=f("h1"),$.textContent="File Downloads",q=g(),X=f("p"),X.textContent="Captures a file download event each time a file link is clicked",Y=g(),Z=f("div"),J=f("img"),Q=g(),tt=f("h1"),tt.textContent="Site search",et=g(),nt=f("p"),nt.textContent="Captures the query parameter each time a visitor performs a search on your site",x(i,"alt","page views"),l(i.src,o=pt+"assets/images/views.png")||x(i,"src","/projects/seshat/assets/images/views.png"),x(i,"class","svelte-1t6cfb6"),x(s,"class","svelte-1t6cfb6"),x(p,"class","svelte-1t6cfb6"),x(r,"class","measuring-engagement svelte-1t6cfb6"),x(y,"alt","scrolling"),l(y.src,b=pt+"assets/images/scrolling.png")||x(y,"src","/projects/seshat/assets/images/scrolling.png"),x(y,"class","svelte-1t6cfb6"),x(_,"class","svelte-1t6cfb6"),x(S,"class","svelte-1t6cfb6"),x(v,"class","measuring-engagement svelte-1t6cfb6"),x(C,"alt","outbound clicks"),l(C.src,L=pt+"assets/images/click.png")||x(C,"src","/projects/seshat/assets/images/click.png"),x(C,"class","svelte-1t6cfb6"),x(R,"class","svelte-1t6cfb6"),x(N,"class","svelte-1t6cfb6"),x(E,"class","measuring-engagement svelte-1t6cfb6"),x(I,"alt","video engagement"),l(I.src,O=pt+"assets/images/video.png")||x(I,"src","/projects/seshat/assets/images/video.png"),x(I,"class","svelte-1t6cfb6"),x(F,"class","svelte-1t6cfb6"),x(U,"class","svelte-1t6cfb6"),x(k,"class","measuring-engagement svelte-1t6cfb6"),x(G,"alt","downloads"),l(G.src,V=pt+"assets/images/downloads.png")||x(G,"src","/projects/seshat/assets/images/downloads.png"),x(G,"class","svelte-1t6cfb6"),x($,"class","svelte-1t6cfb6"),x(X,"class","svelte-1t6cfb6"),x(W,"class","measuring-engagement svelte-1t6cfb6"),x(J,"alt","site search"),l(J.src,K=pt+"assets/images/search.png")||x(J,"src","/projects/seshat/assets/images/search.png"),x(J,"class","svelte-1t6cfb6"),x(tt,"class","svelte-1t6cfb6"),x(nt,"class","svelte-1t6cfb6"),x(Z,"class","measuring-engagement svelte-1t6cfb6"),x(n,"id","measuring-engagement-container"),x(n,"class","container svelte-1t6cfb6")},m(t,e){h(t,n,e),u(n,r),u(r,i),u(r,a),u(r,s),u(r,c),u(r,p),u(n,m),u(n,v),u(v,y),u(v,w),u(v,_),u(v,M),u(v,S),u(n,T),u(n,E),u(E,C),u(E,A),u(E,R),u(E,P),u(E,N),u(n,D),u(n,k),u(k,I),u(k,z),u(k,F),u(k,B),u(k,U),u(n,H),u(n,W),u(W,G),u(W,j),u(W,$),u(W,q),u(W,X),u(n,Y),u(n,Z),u(Z,J),u(Z,Q),u(Z,tt),u(Z,et),u(Z,nt)},p:t,i:t,o:t,d(t){t&&d(n)}}}class Iu extends Z{constructor(t){super(),Y(this,t,null,ku,o,{})}}function Ou(e){let n,r,i,o,a,s,l,c,p,m,v,y,b,w,M,S,T,E,C,L,A,R,P,N,D,k,I,O,z,F,B,U,H,V,X,Y,Z,J,K,Q,tt,et,nt,rt,it,ot,at,st,lt,ct,ut,ht,dt,ft,mt,gt,vt,yt,xt,bt,wt,_t,Mt,St,Tt,Et,Ct,Lt,At,Rt,Pt,Nt,Dt,kt,It,Ot,zt,Ft,Bt,Ut,Ht;return y=new du({props:{caption:"<a href='https://www.compra-seguidores.com/' target='_blank'>Company selling bot followers</a>",alt:"buying followers",src:pt+"assets/images/buying-followers.png"}}),N=new Du({}),Y=new Au({}),ot=new du({props:{caption:"Example of a thumbnail",alt:"thumbnail example",src:pt+"assets/images/link-preview.png"}}),ht=new Pu({}),_t=new Iu({}),Lt=new du({props:{caption:"Facebook's Interaction Dashboard",alt:"interactions facebook",src:pt+"assets/images/interactions.png"}}),{c(){n=f("section"),r=f("p"),r.textContent="Countering",i=g(),o=f("p"),o.innerHTML='Countering narratives can feel like a sisyphean task. Narratives do not have a face, they live in the zeitgeist and \n trying to censor often leads to the <a href="https://en.wikipedia.org/wiki/Streisand_effect" target="_blank">Streisand effect</a>. \n Only a holistic approach, requiring the benevolent involvement and collaboration of all stakeholders (i.e. government, media, \n civil society, activists, population), can lead to a healthy information space.',a=g(),s=f("br"),l=g(),c=f("p"),c.textContent="Interventions",p=g(),m=f("ol"),m.innerHTML="<p>[ Preventive Care ]</p> \n <li>Baseline resilience to target narratives is strengthened through promotion of better digital practices (critical thinking, sources verification, ...)</li> \n <br/> \n\n <p>[ Easing of symptoms ]</p> \n <li>Addressing the narratives through your own media campaigns. Broadcast content that contains clear calls to actions – viewers should feel \n compelled to customize, embody and spread the message.</li> \n <li>Engaging with credible influencers to share the content</li> \n <li>Social media platforms use a combination of artificial intelligence, human reviews, reports from users and trusted partners to detect and remove \n fake/inauthentic accounts and hateful narratives. Initiating the process and getting the "trusted" partner status is a worthwhile pursuit, as \n your findings will be acted on faster.</li>",v=g(),j(y.$$.fragment),b=g(),w=f("ol"),w.innerHTML="<p>[ Curative care ]</p> \n <li>Punctually and transparently communicate any suspect narratives to all stakeholders</li> \n <li>Incentive alignment so that every stakeholder equally feels the cost of a toxic information ecosystem \n and the benefit of productive information ecosystem</li> \n <br/> \n\n <p>[ Palliative care ]</p> \n <li>Resources should be deployed to mend affected communities</li> \n <li>Thought leaders should be held accountable, paired with surgical and temporary banning of accounts</li>",M=g(),S=f("br"),T=g(),E=f("br"),C=g(),L=f("p"),L.textContent="Mass communication",A=g(),R=f("p"),R.textContent="As described above, central to fighting narratives is the production of counter media campaigns. \n Getting a message in front of the masses can be done through many channels.",P=g(),j(N.$$.fragment),D=g(),k=f("p"),k.textContent="Choosing the adequate channel, or combination of channels, depends on a variety of factors – cost, demographic, \n reach, targetability, credibility, measurability, complexity, and impact.",I=g(),O=f("br"),z=g(),F=f("br"),B=g(),U=f("p"),U.textContent="Best Practice Principles",H=g(),V=f("p"),V.textContent="Four media-agnostic principles should guide the content creation and publishing process of an exemplar campaign.",X=g(),j(Y.$$.fragment),Z=g(),J=f("br"),K=g(),Q=f("br"),tt=g(),et=f("p"),et.textContent="Packaging",nt=g(),rt=f("p"),rt.textContent="People click on the packaging not the content. A title, description, and image is your bait. Make it enticing.",it=g(),j(ot.$$.fragment),at=g(),st=f("p"),st.textContent="Boosting",lt=g(),ct=f("p"),ct.textContent="Many platforms provide “amplification-as-a-service” to increase the reach of your content. However, \n it should be used judiciously. The basic rules are outlined below. Step #4 should only occur if high \n reach is already achieved organically. If it is, set the boosting parameters to target the audience that \n resonated with the content.",ut=g(),j(ht.$$.fragment),dt=g(),ft=f("br"),mt=g(),gt=f("br"),vt=g(),yt=f("p"),yt.textContent="Measuring Engagement",xt=g(),bt=f("p"),bt.textContent="Measuring listenership, viewership or readership is media specific. On digital media, the interactions of\n a user with a piece of content can be recorded through a range of descriptive signals.",wt=g(),j(_t.$$.fragment),Mt=g(),St=f("br"),Tt=g(),Et=f("p"),Et.textContent="Social media platforms, where you will distribute your content, provide an additional level of insight \n into the sentiment of visitors.",Ct=g(),j(Lt.$$.fragment),At=g(),Rt=f("br"),Pt=g(),Nt=f("p"),Nt.textContent="Furthermore, the flow of visitors should be compartmentalized by dispersing URLs with different query parameters. \n This strategy allows for counterfactual conjecturing.",Dt=g(),kt=f("br"),It=g(),Ot=f("div"),Ot.innerHTML='<p style="margin-bottom: 4px">https://website.com?source_id=<b class="underline">from-whatsapp</b></p> \n <p style="margin-bottom: 4px">https://website.com?source_id=<b class="underline">from-facebook</b></p> \n <p style="margin-bottom: 4px">https://website.com?source_id=<b class="underline">from-twitter</b></p>',zt=g(),Ft=f("br"),Bt=g(),Ut=f("br"),x(r,"class","title"),x(c,"class","subtitle"),x(w,"start","5"),x(L,"class","subtitle"),x(U,"class","subtitle"),x(et,"class","subtitle"),x(st,"class","subtitle"),x(yt,"class","subtitle"),_(Ot,"text-align","center")},m(t,e){h(t,n,e),u(n,r),u(n,i),u(n,o),u(n,a),u(n,s),u(n,l),u(n,c),u(n,p),u(n,m),u(n,v),$(y,n,null),u(n,b),u(n,w),u(n,M),u(n,S),u(n,T),u(n,E),u(n,C),u(n,L),u(n,A),u(n,R),u(n,P),$(N,n,null),u(n,D),u(n,k),u(n,I),u(n,O),u(n,z),u(n,F),u(n,B),u(n,U),u(n,H),u(n,V),u(n,X),$(Y,n,null),u(n,Z),u(n,J),u(n,K),u(n,Q),u(n,tt),u(n,et),u(n,nt),u(n,rt),u(n,it),$(ot,n,null),u(n,at),u(n,st),u(n,lt),u(n,ct),u(n,ut),$(ht,n,null),u(n,dt),u(n,ft),u(n,mt),u(n,gt),u(n,vt),u(n,yt),u(n,xt),u(n,bt),u(n,wt),$(_t,n,null),u(n,Mt),u(n,St),u(n,Tt),u(n,Et),u(n,Ct),$(Lt,n,null),u(n,At),u(n,Rt),u(n,Pt),u(n,Nt),u(n,Dt),u(n,kt),u(n,It),u(n,Ot),u(n,zt),u(n,Ft),u(n,Bt),u(n,Ut),Ht=!0},p:t,i(t){Ht||(W(y.$$.fragment,t),W(N.$$.fragment,t),W(Y.$$.fragment,t),W(ot.$$.fragment,t),W(ht.$$.fragment,t),W(_t.$$.fragment,t),W(Lt.$$.fragment,t),Ht=!0)},o(t){G(y.$$.fragment,t),G(N.$$.fragment,t),G(Y.$$.fragment,t),G(ot.$$.fragment,t),G(ht.$$.fragment,t),G(_t.$$.fragment,t),G(Lt.$$.fragment,t),Ht=!1},d(t){t&&d(n),q(y),q(N),q(Y),q(ot),q(ht),q(_t),q(Lt)}}}function zu(t,e,n){let{lang:r}=e;return t.$$set=t=>{"lang"in t&&n(0,r=t.lang)},[r]}class Fu extends Z{constructor(t){super(),Y(this,t,zu,Ou,o,{lang:0})}}function Bu(t){return function(t){return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}(t).toLowerCase().trim()}function Uu(e){let n,i,o,a,s,c,p,m;return{c(){n=f("div"),i=f("input"),o=g(),a=f("button"),s=f("img"),x(i,"type","text"),x(i,"placeholder",e[2]),x(i,"class","svelte-ul0dok"),x(s,"alt","Search"),l(s.src,c=pt+"assets/images/search.svg")||x(s,"src","/projects/seshat/assets/images/search.svg"),x(s,"class","svelte-ul0dok"),a.disabled=e[0],x(a,"title","Search"),x(a,"class","svelte-ul0dok"),x(n,"id","search-bar"),_(n,"margin","auto"),x(n,"class","svelte-ul0dok")},m(t,r){h(t,n,r),u(n,i),w(i,e[1]),u(n,o),u(n,a),u(a,s),p||(m=[y(i,"input",e[7]),y(a,"click",e[3])],p=!0)},p(t,[e]){4&e&&x(i,"placeholder",t[2]),2&e&&i.value!==t[1]&&w(i,t[1]),1&e&&(a.disabled=t[0])},i:t,o:t,d(t){t&&d(n),p=!1,r(m)}}}function Hu(t,e,n){let r,i,{disable:o=!1}=e,{onchange:a}=e,{onsubmit:s}=e,{placeholders:l}=e;let c="Search",u=-1,h=0;function d(){if(!Array.isArray(l)||0===l.length)return;h=0,u=(u+1)%l.length;const t=l[u],e=Math.floor(2e3/(1*t.length)),r=()=>{h>t.length||(n(2,c=t.substring(0,h++)),setTimeout((()=>{r()}),e))};r()}return setInterval((()=>{d()}),3500),d(),t.$$set=t=>{"disable"in t&&n(0,o=t.disable),"onchange"in t&&n(4,a=t.onchange),"onsubmit"in t&&n(5,s=t.onsubmit),"placeholders"in t&&n(6,l=t.placeholders)},t.$$.update=()=>{2&t.$$.dirty&&null!=r&&(i=Bu(r.trim().replaceAll(" "," ")),o||a(i))},[o,r,c,function(){o||s(i)},a,s,l,function(){r=this.value,n(1,r)}]}class Wu extends Z{constructor(t){super(),Y(this,t,Hu,Uu,o,{disable:0,onchange:4,onsubmit:5,placeholders:6})}}function Gu(t,e,n){const r=t.slice();return r[12]=e[n],r[14]=n,r}function Vu(t,e,n){const r=t.slice();return r[15]=e[n],r[17]=n,r}function ju(t,e,n){const r=t.slice();return r[18]=e[n],r}function $u(t){let e,n,r,i=t[1],o=[];for(let e=0;e<i.length;e+=1)o[e]=qu(ju(t,i,e));return{c(){e=f("div"),n=f("table"),r=f("tr");for(let t=0;t<o.length;t+=1)o[t].c();x(r,"class","svelte-hd1pqw"),x(n,"class","svelte-hd1pqw"),x(e,"class","table-headers svelte-hd1pqw"),x(e,"id",t[4])},m(t,i){h(t,e,i),u(e,n),u(n,r);for(let t=0;t<o.length;t+=1)o[t].m(r,null)},p(t,e){if(2&e){let n;for(i=t[1],n=0;n<i.length;n+=1){const a=ju(t,i,n);o[n]?o[n].p(a,e):(o[n]=qu(a),o[n].c(),o[n].m(r,null))}for(;n<o.length;n+=1)o[n].d(1);o.length=i.length}},d(t){t&&d(e),p(o,t)}}}function qu(t){let e,n,r=t[18]+"";return{c(){e=f("th"),n=m(r),x(e,"class","header svelte-hd1pqw")},m(t,r){h(t,e,r),u(e,n)},p(t,e){2&e&&r!==(r=t[18]+"")&&b(n,r)},d(t){t&&d(e)}}}function Xu(t){let e,n,r,i,o,a,s,m,v,b=t[2],w=[];for(let e=0;e<b.length;e+=1)w[e]=Ku(Gu(t,b,e));return{c(){e=f("div"),n=f("table");for(let t=0;t<w.length;t+=1)w[t].c();i=g(),o=f("div"),a=f("img"),x(n,"class",r=c(t[0]?"disabled":"enabled")+" svelte-hd1pqw"),x(e,"class","table-values svelte-hd1pqw"),x(e,"id",t[3]),x(a,"alt","download"),l(a.src,s=pt+"assets/images/download.png")||x(a,"src","/projects/seshat/assets/images/download.png"),x(a,"width","30"),x(a,"height","30"),x(a,"class","svelte-hd1pqw"),x(o,"class","download svelte-hd1pqw")},m(r,s){h(r,e,s),u(e,n);for(let t=0;t<w.length;t+=1)w[t].m(n,null);h(r,i,s),h(r,o,s),u(o,a),m||(v=y(a,"click",t[9]),m=!0)},p(t,e){if(4&e){let r;for(b=t[2],r=0;r<b.length;r+=1){const i=Gu(t,b,r);w[r]?w[r].p(i,e):(w[r]=Ku(i),w[r].c(),w[r].m(n,null))}for(;r<w.length;r+=1)w[r].d(1);w.length=b.length}1&e&&r!==(r=c(t[0]?"disabled":"enabled")+" svelte-hd1pqw")&&x(n,"class",r)},d(t){t&&d(e),p(w,t),t&&d(i),t&&d(o),m=!1,v()}}}function Yu(t){let e,n=t[15]+"";return{c(){e=m(n)},m(t,n){h(t,e,n)},p(t,r){4&r&&n!==(n=t[15]+"")&&b(e,n)},d(t){t&&d(e)}}}function Zu(t){let e,n,r,i=t[15]+"";return{c(){e=f("a"),n=m(i),x(e,"href",r=t[15]),x(e,"target","_blank"),x(e,"class","svelte-hd1pqw")},m(t,r){h(t,e,r),u(e,n)},p(t,o){4&o&&i!==(i=t[15]+"")&&b(n,i),4&o&&r!==(r=t[15])&&x(e,"href",r)},d(t){t&&d(e)}}}function Ju(t){let e,n;function r(t,e){return 4&e&&(n=null),null==n&&(n=!!(t[15].length>4&&"http"===t[15].substring(0,4))),n?Zu:Yu}let i=r(t,-1),o=i(t);return{c(){e=f("th"),o.c(),x(e,"class","value svelte-hd1pqw"),x(e,"data-row_id",t[14]),x(e,"data-col_id",t[17])},m(t,n){h(t,e,n),o.m(e,null)},p(t,n){i===(i=r(t,n))&&o?o.p(t,n):(o.d(1),o=i(t),o&&(o.c(),o.m(e,null)))},d(t){t&&d(e),o.d()}}}function Ku(t){let e,n,r=t[12],i=[];for(let e=0;e<r.length;e+=1)i[e]=Ju(Vu(t,r,e));return{c(){e=f("tr");for(let t=0;t<i.length;t+=1)i[t].c();n=g(),x(e,"class","svelte-hd1pqw")},m(t,r){h(t,e,r);for(let t=0;t<i.length;t+=1)i[t].m(e,null);u(e,n)},p(t,o){if(4&o){let a;for(r=t[12],a=0;a<r.length;a+=1){const s=Vu(t,r,a);i[a]?i[a].p(s,o):(i[a]=Ju(s),i[a].c(),i[a].m(e,n))}for(;a<i.length;a+=1)i[a].d(1);i.length=r.length}},d(t){t&&d(e),p(i,t)}}}function Qu(e){let n,r,i,o,a=null!==e[1]&&$u(e),s=null!==e[2]&&Xu(e);return{c(){n=f("br"),r=g(),a&&a.c(),i=g(),s&&s.c(),o=v(),x(n,"class","svelte-hd1pqw")},m(t,e){h(t,n,e),h(t,r,e),a&&a.m(t,e),h(t,i,e),s&&s.m(t,e),h(t,o,e)},p(t,[e]){null!==t[1]?a?a.p(t,e):(a=$u(t),a.c(),a.m(i.parentNode,i)):a&&(a.d(1),a=null),null!==t[2]?s?s.p(t,e):(s=Xu(t),s.c(),s.m(o.parentNode,o)):s&&(s.d(1),s=null)},i:t,o:t,d(t){t&&d(n),t&&d(r),a&&a.d(t),t&&d(i),s&&s.d(t),t&&d(o)}}}function th(t,e,n){let{data:r}=e,{cell_func:i}=e,{table_id:o=`mtable-${Math.floor(1e4*Math.random())}`}=e,{disable:a=!1}=e;const s=`${o}-values`,l=`${o}-headers`;let c=null,u=null;function h(){const t="cai_"+function(t){let e=new Date,n=String((e.getSeconds()+t)%60);2!==n.length&&(n="0"+n);let r=Math.floor((e.getSeconds()+t)/60),i=String((e.getMinutes()+r)%60);2!==i.length&&(i="0"+i);let o=Math.floor((e.getMinutes()+r)/60),a=String((e.getHours()+o)%24);2!==a.length&&(a="0"+a);let s=Math.floor((e.getHours()+o)/24),l=String(e.getDate()+s);2!==l.length&&(l="0"+l);let c=String(e.getMonth()+1);return 2!==c.length&&(c="0"+c),String(e.getFullYear())+"-"+c+"-"+l+"_"+a+":"+i+":"+n}(0)+".csv",e=r.map((t=>t.map((t=>`"${t}"`)).join(","))).join("\n"),n=new Blob([e],{type:"text/csv"});if(window.navigator.msSaveOrOpenBlob)window.navigator.msSaveBlob(n,t);else{const e=window.document.createElement("a");e.href=window.URL.createObjectURL(n),e.download=t,document.body.appendChild(e),e.click(),document.body.removeChild(e)}}return t.$$set=t=>{"data"in t&&n(6,r=t.data),"cell_func"in t&&n(7,i=t.cell_func),"table_id"in t&&n(8,o=t.table_id),"disable"in t&&n(0,a=t.disable)},t.$$.update=()=>{64&t.$$.dirty&&function(t){if(!Array.isArray(t))return!1;if(t.length<1)return console.error("invalid data for table - array of length < 1"),!1;if(!Array.isArray(t[0]))return console.error("invalid data for table - first element not an array"),!1;if(0===t[0].length)return console.error("invalid data for table - first element of length 0"),!1;let e=t[0].length;for(let n=1;n<t.length;n++){if(!Array.isArray(t[n]))return console.error(`invalid data for table - ${n}th element not an array`),!1;if(t[n].length!==e)return console.error(`invalid data for table - ${n}th element not of same length`),!1}return!0}(r)&&(n(2,u=r.filter(((t,e)=>0!==e))),n(1,c=r[0]),setTimeout((()=>{!function(){const t=document.getElementById(s);if(null===t)return;const e=document.getElementById(l);if(null===e)return;let n=t.querySelectorAll("tr")[0];if(void 0===n)return;let r=n.querySelectorAll("th"),i=0,o=Array.from(r,(t=>{const e=1*t.getBoundingClientRect().width;return i+=e,e}));o=o.map((t=>Math.round(100*t/i))),i=o.reduce(((t,e)=>t+e),0),100!==i&&(o[0]=100-i+o[0]),r=e.querySelectorAll("tr")[0].querySelectorAll("th");for(let t=0;t<r.length;t++)r[t].style.width=`${o[t]}%`;let a=t.querySelectorAll("tr");for(let t=0;t<a.length;t++){r=a[t].querySelectorAll("th");for(let t=0;t<r.length;t++)r[t].style.width=`${o[t]}%`}}(),function(){const t=document.getElementById(s).getElementsByTagName("th");for(let e of t){const t=e.innerText,{row_id:n,col_id:r}=e.dataset;"function"==typeof i&&i(e,t,n,r)}}()}),100))},[a,c,u,s,l,h,r,i,o,()=>{h()}]}class eh extends Z{constructor(t){super(),Y(this,t,th,Qu,o,{data:6,cell_func:7,table_id:8,disable:0})}}function nh(t){let e,n;return{c(){e=f("p"),n=m(t[4]),x(e,"class","svelte-1aye3t0")},m(t,r){h(t,e,r),u(e,n)},p(t,e){16&e&&b(n,t[4])},d(t){t&&d(e)}}}function rh(t){let e,n;return{c(){e=f("p"),n=m(t[4]),_(e,"color","red"),x(e,"class","svelte-1aye3t0")},m(t,r){h(t,e,r),u(e,n)},p(t,e){16&e&&b(n,t[4])},d(t){t&&d(e)}}}function ih(t){let e,n,r,i,o,a,s,l,c,u,p,m,v,y;function b(e){t[9](e)}let w={onchange:t[5],onsubmit:t[6],placeholders:t[0]};function _(e){t[10](e)}function M(e){t[11](e)}void 0!==t[1]&&(w.disable=t[1]),r=new Wu({props:w}),C.push((()=>V(r,"disable",b)));let S={};function T(t,e){return t[3].length-1>=oh?rh:nh}void 0!==t[2]&&(S.disable=t[2]),void 0!==t[3]&&(S.data=t[3]),l=new eh({props:S}),C.push((()=>V(l,"disable",_))),C.push((()=>V(l,"data",M)));let E=T(t),L=E(t);return{c(){e=f("div"),n=g(),j(r.$$.fragment),o=g(),a=f("div"),s=g(),j(l.$$.fragment),p=g(),L.c(),m=g(),v=f("br"),x(e,"class","separator svelte-1aye3t0"),x(a,"class","separator svelte-1aye3t0")},m(t,i){h(t,e,i),h(t,n,i),$(r,t,i),h(t,o,i),h(t,a,i),h(t,s,i),$(l,t,i),h(t,p,i),L.m(t,i),h(t,m,i),h(t,v,i),y=!0},p(t,[e]){const n={};1&e&&(n.placeholders=t[0]),!i&&2&e&&(i=!0,n.disable=t[1],D((()=>i=!1))),r.$set(n);const o={};!c&&4&e&&(c=!0,o.disable=t[2],D((()=>c=!1))),!u&&8&e&&(u=!0,o.data=t[3],D((()=>u=!1))),l.$set(o),E===(E=T(t))&&L?L.p(t,e):(L.d(1),L=E(t),L&&(L.c(),L.m(m.parentNode,m)))},i(t){y||(W(r.$$.fragment,t),W(l.$$.fragment,t),y=!0)},o(t){G(r.$$.fragment,t),G(l.$$.fragment,t),y=!1},d(t){t&&d(e),t&&d(n),q(r,t),t&&d(o),t&&d(a),t&&d(s),q(l,t),t&&d(p),L.d(t),t&&d(m),t&&d(v)}}}const oh=3e3;function ah(t,e,n){let r,{word_mapping:i}=e,{documents:o}=e,{placeholders:a}=e,s=!1,l=!1,c="",u=[];const h=["Source","Keyword","Published On","Link"];let d={};Object.values(i).forEach((t=>{d[t]=[]})),o.forEach(((t,e)=>{t.wv.forEach((t=>{d[t].push(e)}))})),Object.keys(d).forEach((t=>{d[t]=[...new Set(d[t])]}));let p={};function f(t){if(null==t||0===t.length)return[];let e=t.split(" ").map((t=>i[Bu(t)]));if(e=e.filter((t=>void 0!==t)),e=[...new Set(e)],0===e.length)return[];let n=e.map((t=>d[t]));return n=n.reduce(((t,e)=>t.filter((t=>e.includes(t))))),n.map((t=>{const n=o[t],r=e.map((t=>p[t.toString()])).join(";");return[n.source_name,r,n.t,n.l]}))}return Object.keys(i).forEach((t=>{p[i[t]]=t})),u.unshift(h),r=u,t.$$set=t=>{"word_mapping"in t&&n(7,i=t.word_mapping),"documents"in t&&n(8,o=t.documents),"placeholders"in t&&n(0,a=t.placeholders)},[a,s,l,r,c,function(t){n(2,l=!0),u=f(t).splice(0,20),u.unshift(h),n(4,c=""),n(3,r=u)},function(t){n(1,s=!0),setTimeout((()=>{u=f(t).splice(0,oh),u.unshift(h),n(4,c=`${u.length-1===oh?"max ":""}${u.length-1} ${u.length-1>1?"results":"result"}`),n(3,r=u),n(1,s=!1),n(2,l=!1)}),50)},i,o,function(t){s=t,n(1,s)},function(t){l=t,n(2,l)},function(t){r=t,n(3,r)}]}class sh extends Z{constructor(t){super(),Y(this,t,ah,ih,o,{word_mapping:7,documents:8,placeholders:0})}}function lh(t,e,n){const r=t.slice();return r[2]=e[n],r}function ch(e){let n,r,i,o,a,s,c,p,v,y,b,w,_,S=e[2].name+"",T=e[2].description+"",E=e[2].html+"";return{c(){n=f("div"),r=f("img"),a=g(),s=f("h1"),c=m(S),p=g(),v=f("p"),y=m(T),b=g(),w=new M,_=g(),x(r,"alt",i=e[2].name),l(r.src,o=e[2].src)||x(r,"src",o),x(r,"class","svelte-1ruuako"),x(s,"class","svelte-1ruuako"),x(v,"class","svelte-1ruuako"),w.a=_,x(n,"class","portraits svelte-1ruuako")},m(t,e){h(t,n,e),u(n,r),u(n,a),u(n,s),u(s,c),u(n,p),u(n,v),u(v,y),u(n,b),w.m(E,n),u(n,_)},p:t,d(t){t&&d(n)}}}function uh(e){let n,r=e[0],i=[];for(let t=0;t<r.length;t+=1)i[t]=ch(lh(e,r,t));return{c(){n=f("div");for(let t=0;t<i.length;t+=1)i[t].c();x(n,"class","container svelte-1ruuako")},m(t,e){h(t,n,e);for(let t=0;t<i.length;t+=1)i[t].m(n,null)},p(t,[e]){if(1&e){let o;for(r=t[0],o=0;o<r.length;o+=1){const a=lh(t,r,o);i[o]?i[o].p(a,e):(i[o]=ch(a),i[o].c(),i[o].m(n,null))}for(;o<i.length;o+=1)i[o].d(1);i.length=r.length}},i:t,o:t,d(t){t&&d(n),p(i,t)}}}function hh(t,e,n){let{data:r}=e;const i=r.map((t=>{const e=`<div style="display: flex; justify-content: center;">${Object.keys(t.endpoint).sort().map((e=>{return`\n <a target="_blank" href="${t.endpoint[e].url}"" style="margin: 8px; width: 25%">\n <img src="${pt}assets/images/${e}.png" style="filter: brightness(0) invert(1);" width=16 height=16>\n <p style="font-size:12px;margin:0px;padding:0px">\n ${n=t.endpoint[e].followers,n>=1e9?(n/1e9).toFixed(1).replace(/\.0$/,"")+"G":n>=1e6?(n/1e6).toFixed(1).replace(/\.0$/,"")+"M":n>=1e3?(n/1e3).toFixed(1).replace(/\.0$/,"")+"K":n}\n </p>\n </a>\n `;var n})).join("")}</div>`;return{name:t.name,description:t.description,endpoint:t.endpoint,src:`${pt}assets/portraits/${t.name.replaceAll(" ","_")}.jpg`,html:e}}));return t.$$set=t=>{"data"in t&&n(1,r=t.data)},[i,r]}class dh extends Z{constructor(t){super(),Y(this,t,hh,uh,o,{data:1})}}function ph(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function fh(t){let e=t,n=t,r=t;function i(t,e,i=0,o=t.length){if(i<o){if(0!==n(e,e))return o;do{const n=i+o>>>1;r(t[n],e)<0?i=n+1:o=n}while(i<o)}return i}return 2!==t.length&&(e=(e,n)=>t(e)-n,n=ph,r=(e,n)=>ph(t(e),n)),{left:i,center:function(t,n,r=0,o=t.length){const a=i(t,n,r,o-1);return a>r&&e(t[a-1],n)>-e(t[a],n)?a-1:a},right:function(t,e,i=0,o=t.length){if(i<o){if(0!==n(e,e))return o;do{const n=i+o>>>1;r(t[n],e)<=0?i=n+1:o=n}while(i<o)}return i}}}const mh=fh(ph).right;fh((function(t){return null===t?NaN:+t})).center;var gh=mh,vh=Math.sqrt(50),yh=Math.sqrt(10),xh=Math.sqrt(2);function bh(t,e,n){var r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=vh?10:o>=yh?5:o>=xh?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=vh?10:o>=yh?5:o>=xh?2:1)}function wh(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=vh?i*=10:o>=yh?i*=5:o>=xh&&(i*=2),e<t?-i:i}function _h(t){return t}var Mh=1e-6;function Sh(t){return"translate("+t+",0)"}function Th(t){return"translate(0,"+t+")"}function Eh(t){return e=>+t(e)}function Ch(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function Lh(){return!this.__axis}function Ah(t,e){var n=[],r=null,i=null,o=6,a=6,s=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,c=1===t||4===t?-1:1,u=4===t||2===t?"x":"y",h=1===t||3===t?Sh:Th;function d(d){var p=null==r?e.ticks?e.ticks.apply(e,n):e.domain():r,f=null==i?e.tickFormat?e.tickFormat.apply(e,n):_h:i,m=Math.max(o,0)+s,g=e.range(),v=+g[0]+l,y=+g[g.length-1]+l,x=(e.bandwidth?Ch:Eh)(e.copy(),l),b=d.selection?d.selection():d,w=b.selectAll(".domain").data([null]),_=b.selectAll(".tick").data(p,e).order(),M=_.exit(),S=_.enter().append("g").attr("class","tick"),T=_.select("line"),E=_.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),_=_.merge(S),T=T.merge(S.append("line").attr("stroke","currentColor").attr(u+"2",c*o)),E=E.merge(S.append("text").attr("fill","currentColor").attr(u,c*m).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),d!==b&&(w=w.transition(d),_=_.transition(d),T=T.transition(d),E=E.transition(d),M=M.transition(d).attr("opacity",Mh).attr("transform",(function(t){return isFinite(t=x(t))?h(t+l):this.getAttribute("transform")})),S.attr("opacity",Mh).attr("transform",(function(t){var e=this.parentNode.__axis;return h((e&&isFinite(e=e(t))?e:x(t))+l)}))),M.remove(),w.attr("d",4===t||2===t?a?"M"+c*a+","+v+"H"+l+"V"+y+"H"+c*a:"M"+l+","+v+"V"+y:a?"M"+v+","+c*a+"V"+l+"H"+y+"V"+c*a:"M"+v+","+l+"H"+y),_.attr("opacity",1).attr("transform",(function(t){return h(x(t)+l)})),T.attr(u+"2",c*o),E.attr(u,c*m).text(f),b.filter(Lh).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),b.each((function(){this.__axis=x}))}return d.scale=function(t){return arguments.length?(e=t,d):e},d.ticks=function(){return n=Array.from(arguments),d},d.tickArguments=function(t){return arguments.length?(n=null==t?[]:Array.from(t),d):n.slice()},d.tickValues=function(t){return arguments.length?(r=null==t?null:Array.from(t),d):r&&r.slice()},d.tickFormat=function(t){return arguments.length?(i=t,d):i},d.tickSize=function(t){return arguments.length?(o=a=+t,d):o},d.tickSizeInner=function(t){return arguments.length?(o=+t,d):o},d.tickSizeOuter=function(t){return arguments.length?(a=+t,d):a},d.tickPadding=function(t){return arguments.length?(s=+t,d):s},d.offset=function(t){return arguments.length?(l=+t,d):l},d}function Rh(t){return Ah(3,t)}var Ph={value:()=>{}};function Nh(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new Dh(r)}function Dh(t){this._=t}function kh(t,e){return t.trim().split(/^|\s+/).map((function(t){var n="",r=t.indexOf(".");if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function Ih(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Oh(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Ph,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}Dh.prototype=Nh.prototype={constructor:Dh,on:function(t,e){var n,r=this._,i=kh(t+"",r),o=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<a;)if(n=(t=i[o]).type)r[n]=Oh(r[n],t.name,e);else if(null==e)for(n in r)r[n]=Oh(r[n],t.name,null);return this}for(;++o<a;)if((n=(t=i[o]).type)&&(n=Ih(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Dh(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};var zh="http://www.w3.org/1999/xhtml",Fh={svg:"http://www.w3.org/2000/svg",xhtml:zh,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Bh(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),Fh.hasOwnProperty(e)?{space:Fh[e],local:t}:t}function Uh(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===zh&&e.documentElement.namespaceURI===zh?e.createElement(t):e.createElementNS(n,t)}}function Hh(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Wh(t){var e=Bh(t);return(e.local?Hh:Uh)(e)}function Gh(){}function Vh(t){return null==t?Gh:function(){return this.querySelector(t)}}function jh(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function $h(){return[]}function qh(t){return null==t?$h:function(){return this.querySelectorAll(t)}}function Xh(t){return function(){return this.matches(t)}}function Yh(t){return function(e){return e.matches(t)}}var Zh=Array.prototype.find;function Jh(){return this.firstElementChild}var Kh=Array.prototype.filter;function Qh(){return Array.from(this.children)}function td(t){return new Array(t.length)}function ed(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function nd(t){return function(){return t}}function rd(t,e,n,r,i,o){for(var a,s=0,l=e.length,c=o.length;s<c;++s)(a=e[s])?(a.__data__=o[s],r[s]=a):n[s]=new ed(t,o[s]);for(;s<l;++s)(a=e[s])&&(i[s]=a)}function id(t,e,n,r,i,o,a){var s,l,c,u=new Map,h=e.length,d=o.length,p=new Array(h);for(s=0;s<h;++s)(l=e[s])&&(p[s]=c=a.call(l,l.__data__,s,e)+"",u.has(c)?i[s]=l:u.set(c,l));for(s=0;s<d;++s)c=a.call(t,o[s],s,o)+"",(l=u.get(c))?(r[s]=l,l.__data__=o[s],u.delete(c)):n[s]=new ed(t,o[s]);for(s=0;s<h;++s)(l=e[s])&&u.get(p[s])===l&&(i[s]=l)}function od(t){return t.__data__}function ad(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function sd(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ld(t){return function(){this.removeAttribute(t)}}function cd(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ud(t,e){return function(){this.setAttribute(t,e)}}function hd(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function dd(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function pd(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function fd(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function md(t){return function(){this.style.removeProperty(t)}}function gd(t,e,n){return function(){this.style.setProperty(t,e,n)}}function vd(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function yd(t,e){return t.style.getPropertyValue(e)||fd(t).getComputedStyle(t,null).getPropertyValue(e)}function xd(t){return function(){delete this[t]}}function bd(t,e){return function(){this[t]=e}}function wd(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function _d(t){return t.trim().split(/^|\s+/)}function Md(t){return t.classList||new Sd(t)}function Sd(t){this._node=t,this._names=_d(t.getAttribute("class")||"")}function Td(t,e){for(var n=Md(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function Ed(t,e){for(var n=Md(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function Cd(t){return function(){Td(this,t)}}function Ld(t){return function(){Ed(this,t)}}function Ad(t,e){return function(){(e.apply(this,arguments)?Td:Ed)(this,t)}}function Rd(){this.textContent=""}function Pd(t){return function(){this.textContent=t}}function Nd(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function Dd(){this.innerHTML=""}function kd(t){return function(){this.innerHTML=t}}function Id(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Od(){this.nextSibling&&this.parentNode.appendChild(this)}function zd(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Fd(){return null}function Bd(){var t=this.parentNode;t&&t.removeChild(this)}function Ud(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Hd(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Wd(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function Gd(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r<o;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?e.length=i:delete this.__on}}}function Vd(t,e,n){return function(){var r,i=this.__on,o=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var a=0,s=i.length;a<s;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),void(r.value=e);this.addEventListener(t.type,o,n),r={type:t.type,name:t.name,value:e,listener:o,options:n},i?i.push(r):this.__on=[r]}}function jd(t,e,n){var r=fd(t),i=r.CustomEvent;"function"==typeof i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function $d(t,e){return function(){return jd(this,t,e)}}function qd(t,e){return function(){return jd(this,t,e.apply(this,arguments))}}ed.prototype={constructor:ed,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},Sd.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Xd=[null];function Yd(t,e){this._groups=t,this._parents=e}function Zd(){return new Yd([[document.documentElement]],Xd)}function Jd(t){return"string"==typeof t?new Yd([[document.querySelector(t)]],[document.documentElement]):new Yd([[t]],Xd)}function Kd(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Qd(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function tp(){}Yd.prototype=Zd.prototype={constructor:Yd,select:function(t){"function"!=typeof t&&(t=Vh(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a,s=e[i],l=s.length,c=r[i]=new Array(l),u=0;u<l;++u)(o=s[u])&&(a=t.call(o,o.__data__,u,s))&&("__data__"in o&&(a.__data__=o.__data__),c[u]=a);return new Yd(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return jh(t.apply(this,arguments))}}(t):qh(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var a,s=e[o],l=s.length,c=0;c<l;++c)(a=s[c])&&(r.push(t.call(a,a.__data__,c,s)),i.push(a));return new Yd(r,i)},selectChild:function(t){return this.select(null==t?Jh:function(t){return function(){return Zh.call(this.children,t)}}("function"==typeof t?t:Yh(t)))},selectChildren:function(t){return this.selectAll(null==t?Qh:function(t){return function(){return Kh.call(this.children,t)}}("function"==typeof t?t:Yh(t)))},filter:function(t){"function"!=typeof t&&(t=Xh(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,l=r[i]=[],c=0;c<s;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&l.push(o);return new Yd(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,od);var n=e?id:rd,r=this._parents,i=this._groups;"function"!=typeof t&&(t=nd(t));for(var o=i.length,a=new Array(o),s=new Array(o),l=new Array(o),c=0;c<o;++c){var u=r[c],h=i[c],d=h.length,p=ad(t.call(u,u&&u.__data__,c,r)),f=p.length,m=s[c]=new Array(f),g=a[c]=new Array(f),v=l[c]=new Array(d);n(u,h,m,g,v,p,e);for(var y,x,b=0,w=0;b<f;++b)if(y=m[b]){for(b>=w&&(w=b+1);!(x=g[w])&&++w<f;);y._next=x||null}}return(a=new Yd(a,r))._enter=s,a._exit=l,a},enter:function(){return new Yd(this._enter||this._groups.map(td),this._parents)},exit:function(){return new Yd(this._exit||this._groups.map(td),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=e&&(i=e(i))&&(i=i.selection()),null==n?o.remove():n(o),r&&i?r.merge(i).order():i},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,a=Math.min(i,o),s=new Array(i),l=0;l<a;++l)for(var c,u=n[l],h=r[l],d=u.length,p=s[l]=new Array(d),f=0;f<d;++f)(c=u[f]||h[f])&&(p[f]=c);for(;l<i;++l)s[l]=n[l];return new Yd(s,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=sd);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a,s=n[o],l=s.length,c=i[o]=new Array(l),u=0;u<l;++u)(a=s[u])&&(c[u]=a);c.sort(e)}return new Yd(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i,o=e[n],a=0,s=o.length;a<s;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,e){var n=Bh(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?cd:ld:"function"==typeof e?n.local?pd:dd:n.local?hd:ud)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?md:"function"==typeof e?vd:gd)(t,e,null==n?"":n)):yd(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?xd:"function"==typeof e?wd:bd)(t,e)):this.node()[t]},classed:function(t,e){var n=_d(t+"");if(arguments.length<2){for(var r=Md(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?Ad:e?Cd:Ld)(n,e))},text:function(t){return arguments.length?this.each(null==t?Rd:("function"==typeof t?Nd:Pd)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Dd:("function"==typeof t?Id:kd)(t)):this.node().innerHTML},raise:function(){return this.each(Od)},lower:function(){return this.each(zd)},append:function(t){var e="function"==typeof t?t:Wh(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:Wh(t),r=null==e?Fd:"function"==typeof e?e:Vh(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(Bd)},clone:function(t){return this.select(t?Hd:Ud)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,o=Wd(t+""),a=o.length;if(!(arguments.length<2)){for(s=e?Vd:Gd,r=0;r<a;++r)this.each(s(o[r],e,n));return this}var s=this.node().__on;if(s)for(var l,c=0,u=s.length;c<u;++c)for(r=0,l=s[c];r<a;++r)if((i=o[r]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?qd:$d)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,i=t[e],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};var ep=.7,np=1/ep,rp="\\s*([+-]?\\d+)\\s*",ip="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",op="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ap=/^#([0-9a-f]{3,8})$/,sp=new RegExp("^rgb\\("+[rp,rp,rp]+"\\)$"),lp=new RegExp("^rgb\\("+[op,op,op]+"\\)$"),cp=new RegExp("^rgba\\("+[rp,rp,rp,ip]+"\\)$"),up=new RegExp("^rgba\\("+[op,op,op,ip]+"\\)$"),hp=new RegExp("^hsl\\("+[ip,op,op]+"\\)$"),dp=new RegExp("^hsla\\("+[ip,op,op,ip]+"\\)$"),pp={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};function fp(){return this.rgb().formatHex()}function mp(){return this.rgb().formatRgb()}function gp(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=ap.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?vp(e):3===n?new wp(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?yp(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?yp(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=sp.exec(t))?new wp(e[1],e[2],e[3],1):(e=lp.exec(t))?new wp(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=cp.exec(t))?yp(e[1],e[2],e[3],e[4]):(e=up.exec(t))?yp(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=hp.exec(t))?Tp(e[1],e[2]/100,e[3]/100,1):(e=dp.exec(t))?Tp(e[1],e[2]/100,e[3]/100,e[4]):pp.hasOwnProperty(t)?vp(pp[t]):"transparent"===t?new wp(NaN,NaN,NaN,0):null}function vp(t){return new wp(t>>16&255,t>>8&255,255&t,1)}function yp(t,e,n,r){return r<=0&&(t=e=n=NaN),new wp(t,e,n,r)}function xp(t){return t instanceof tp||(t=gp(t)),t?new wp((t=t.rgb()).r,t.g,t.b,t.opacity):new wp}function bp(t,e,n,r){return 1===arguments.length?xp(t):new wp(t,e,n,null==r?1:r)}function wp(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function _p(){return"#"+Sp(this.r)+Sp(this.g)+Sp(this.b)}function Mp(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function Sp(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Tp(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Cp(t,e,n,r)}function Ep(t){if(t instanceof Cp)return new Cp(t.h,t.s,t.l,t.opacity);if(t instanceof tp||(t=gp(t)),!t)return new Cp;if(t instanceof Cp)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n<r):n===o?(r-e)/s+2:(e-n)/s+4,s/=l<.5?o+i:2-o-i,a*=60):s=l>0&&l<1?0:a,new Cp(a,s,l,t.opacity)}function Cp(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Lp(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}Kd(tp,gp,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:fp,formatHex:fp,formatHsl:function(){return Ep(this).formatHsl()},formatRgb:mp,toString:mp}),Kd(wp,bp,Qd(tp,{brighter:function(t){return t=null==t?np:Math.pow(np,t),new wp(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?ep:Math.pow(ep,t),new wp(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:_p,formatHex:_p,formatRgb:Mp,toString:Mp})),Kd(Cp,(function(t,e,n,r){return 1===arguments.length?Ep(t):new Cp(t,e,n,null==r?1:r)}),Qd(tp,{brighter:function(t){return t=null==t?np:Math.pow(np,t),new Cp(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?ep:Math.pow(ep,t),new Cp(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new wp(Lp(t>=240?t-240:t+120,i,r),Lp(t,i,r),Lp(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var Ap=t=>()=>t;function Rp(t){return 1==(t=+t)?Pp:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Ap(isNaN(e)?n:e)}}function Pp(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Ap(isNaN(t)?e:t)}var Np=function t(e){var n=Rp(e);function r(t,e){var r=n((t=bp(t)).r,(e=bp(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=Pp(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function Dp(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,i=e.slice();return function(o){for(n=0;n<r;++n)i[n]=t[n]*(1-o)+e[n]*o;return i}}function kp(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(n=0;n<i;++n)o[n]=Hp(t[n],e[n]);for(;n<r;++n)a[n]=e[n];return function(t){for(n=0;n<i;++n)a[n]=o[n](t);return a}}function Ip(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Op(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function zp(t,e){var n,r={},i={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=Hp(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}var Fp=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Bp=new RegExp(Fp.source,"g");function Up(t,e){var n,r,i,o=Fp.lastIndex=Bp.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(n=Fp.exec(t))&&(r=Bp.exec(e));)(i=r.index)>o&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,l.push({i:a,x:Op(n,r)})),o=Bp.lastIndex;return o<e.length&&(i=e.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,r=0;r<e;++r)s[(n=l[r]).i]=n.x(t);return s.join("")})}function Hp(t,e){var n,r,i=typeof e;return null==e||"boolean"===i?Ap(e):("number"===i?Op:"string"===i?(n=gp(e))?(e=n,Np):Up:e instanceof gp?Np:e instanceof Date?Ip:(r=e,!ArrayBuffer.isView(r)||r instanceof DataView?Array.isArray(e)?kp:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?zp:Op:Dp))(t,e)}function Wp(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var Gp,Vp=180/Math.PI,jp={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function $p(t,e,n,r,i,o){var a,s,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),t*r<e*n&&(t=-t,e=-e,l=-l,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*Vp,skewX:Math.atan(l)*Vp,scaleX:a,scaleY:s}}function qp(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var s=[],l=[];return o=t(o),a=t(a),function(t,r,i,o,a,s){if(t!==i||r!==o){var l=a.push("translate(",null,e,null,n);s.push({i:l-4,x:Op(t,i)},{i:l-2,x:Op(r,o)})}else(i||o)&&a.push("translate("+i+e+o+n)}(o.translateX,o.translateY,a.translateX,a.translateY,s,l),function(t,e,n,o){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Op(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,l),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Op(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,l),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:Op(t,n)},{i:s-2,x:Op(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,l),o=a=null,function(t){for(var e,n=-1,r=l.length;++n<r;)s[(e=l[n]).i]=e.x(t);return s.join("")}}}var Xp,Yp,Zp=qp((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?jp:$p(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),Jp=qp((function(t){return null==t?jp:(Gp||(Gp=document.createElementNS("http://www.w3.org/2000/svg","g")),Gp.setAttribute("transform",t),(t=Gp.transform.baseVal.consolidate())?$p((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):jp)}),", ",")",")"),Kp=0,Qp=0,tf=0,ef=0,nf=0,rf=0,of="object"==typeof performance&&performance.now?performance:Date,af="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function sf(){return nf||(af(lf),nf=of.now()+rf)}function lf(){nf=0}function cf(){this._call=this._time=this._next=null}function uf(t,e,n){var r=new cf;return r.restart(t,e,n),r}function hf(){nf=(ef=of.now())+rf,Kp=Qp=0;try{!function(){sf(),++Kp;for(var t,e=Xp;e;)(t=nf-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Kp}()}finally{Kp=0,function(){var t,e,n=Xp,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Xp=e);Yp=t,pf(r)}(),nf=0}}function df(){var t=of.now(),e=t-ef;e>1e3&&(rf-=e,ef=t)}function pf(t){Kp||(Qp&&(Qp=clearTimeout(Qp)),t-nf>24?(t<1/0&&(Qp=setTimeout(hf,t-of.now()-rf)),tf&&(tf=clearInterval(tf))):(tf||(ef=of.now(),tf=setInterval(df,1e3)),Kp=1,af(hf)))}function ff(t,e,n){var r=new cf;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}cf.prototype=uf.prototype={constructor:cf,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?sf():+n)+(null==e?0:+e),this._next||Yp===this||(Yp?Yp._next=this:Xp=this,Yp=this),this._call=t,this._time=n,pf()},stop:function(){this._call&&(this._call=null,this._time=1/0,pf())}};var mf=Nh("start","end","cancel","interrupt"),gf=[];function vf(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(t){n.state=1,n.timer.restart(a,n.delay,n.time),n.delay<=t&&a(t-n.delay)}function a(o){var c,u,h,d;if(1!==n.state)return l();for(c in i)if((d=i[c]).name===n.name){if(3===d.state)return ff(a);4===d.state?(d.state=6,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete i[c]):+c<e&&(d.state=6,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete i[c])}if(ff((function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(o))})),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(h=n.tween.length),c=0,u=-1;c<h;++c)(d=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(r[++u]=d);r.length=u+1}}function s(e){for(var i=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(l),n.state=5,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){for(var r in n.state=6,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=uf(o,0,n.time)}(t,n,{name:e,index:r,group:i,on:mf,tween:gf,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:0})}function yf(t,e){var n=bf(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function xf(t,e){var n=bf(t,e);if(n.state>3)throw new Error("too late; already running");return n}function bf(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function wf(t,e){var n,r;return function(){var i=xf(this,t),o=i.tween;if(o!==n)for(var a=0,s=(r=n=o).length;a<s;++a)if(r[a].name===e){(r=r.slice()).splice(a,1);break}i.tween=r}}function _f(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var o=xf(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:e,value:n},l=0,c=i.length;l<c;++l)if(i[l].name===e){i[l]=s;break}l===c&&i.push(s)}o.tween=i}}function Mf(t,e,n){var r=t._id;return t.each((function(){var t=xf(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return bf(t,r).value[e]}}function Sf(t,e){var n;return("number"==typeof e?Op:e instanceof gp?Np:(n=gp(e))?(e=n,Np):Up)(t,e)}function Tf(t){return function(){this.removeAttribute(t)}}function Ef(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Cf(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=e(r=a,n)}}function Lf(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=e(r=a,n)}}function Af(t,e,n){var r,i,o;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttribute(t))===(s=l+"")?null:a===r&&s===i?o:(i=s,o=e(r=a,l));this.removeAttribute(t)}}function Rf(t,e,n){var r,i,o;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttributeNS(t.space,t.local))===(s=l+"")?null:a===r&&s===i?o:(i=s,o=e(r=a,l));this.removeAttributeNS(t.space,t.local)}}function Pf(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Nf(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Df(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&Nf(t,i)),n}return i._value=e,i}function kf(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&Pf(t,i)),n}return i._value=e,i}function If(t,e){return function(){yf(this,t).delay=+e.apply(this,arguments)}}function Of(t,e){return e=+e,function(){yf(this,t).delay=e}}function zf(t,e){return function(){xf(this,t).duration=+e.apply(this,arguments)}}function Ff(t,e){return e=+e,function(){xf(this,t).duration=e}}function Bf(t,e){if("function"!=typeof e)throw new Error;return function(){xf(this,t).ease=e}}function Uf(t,e,n){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?yf:xf;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}var Hf=Zd.prototype.constructor;function Wf(t){return function(){this.style.removeProperty(t)}}function Gf(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function Vf(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&Gf(t,o,n)),r}return o._value=e,o}function jf(t){return function(e){this.textContent=t.call(this,e)}}function $f(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&jf(r)),e}return r._value=t,r}var qf=0;function Xf(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Yf(){return++qf}var Zf=Zd.prototype;Xf.prototype={constructor:Xf,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Vh(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s,l,c=r[a],u=c.length,h=o[a]=new Array(u),d=0;d<u;++d)(s=c[d])&&(l=t.call(s,s.__data__,d,c))&&("__data__"in s&&(l.__data__=s.__data__),h[d]=l,vf(h[d],e,n,d,h,bf(s,n)));return new Xf(o,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=qh(t));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var l,c=r[s],u=c.length,h=0;h<u;++h)if(l=c[h]){for(var d,p=t.call(l,l.__data__,h,c),f=bf(l,n),m=0,g=p.length;m<g;++m)(d=p[m])&&vf(d,e,n,m,p,f);o.push(p),a.push(l)}return new Xf(o,a,e,n)},selectChild:Zf.selectChild,selectChildren:Zf.selectChildren,filter:function(t){"function"!=typeof t&&(t=Xh(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,l=r[i]=[],c=0;c<s;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&l.push(o);return new Xf(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var l,c=e[s],u=n[s],h=c.length,d=a[s]=new Array(h),p=0;p<h;++p)(l=c[p]||u[p])&&(d[p]=l);for(;s<r;++s)a[s]=e[s];return new Xf(a,this._parents,this._name,this._id)},selection:function(){return new Hf(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=Yf(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],l=s.length,c=0;c<l;++c)if(a=s[c]){var u=bf(a,e);vf(a,t,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Xf(r,this._parents,t,n)},call:Zf.call,nodes:Zf.nodes,node:Zf.node,size:Zf.size,empty:Zf.empty,each:Zf.each,on:function(t,e){var n=this._id;return arguments.length<2?bf(this.node(),n).on.on(t):this.each(Uf(n,t,e))},attr:function(t,e){var n=Bh(t),r="transform"===n?Jp:Sf;return this.attrTween(t,"function"==typeof e?(n.local?Rf:Af)(n,r,Mf(this,"attr."+t,e)):null==e?(n.local?Ef:Tf)(n):(n.local?Lf:Cf)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=Bh(t);return this.tween(n,(r.local?Df:kf)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?Zp:Sf;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=yd(this,t),a=(this.style.removeProperty(t),yd(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}(t,r)).on("end.style."+t,Wf(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var a=yd(this,t),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(t),l=s=yd(this,t)),a===l?null:a===r&&l===i?o:(i=l,o=e(r=a,s))}}(t,r,Mf(this,"style."+t,e))).each(function(t,e){var n,r,i,o,a="style."+e,s="end."+a;return function(){var l=xf(this,t),c=l.on,u=null==l.value[a]?o||(o=Wf(e)):void 0;c===n&&i===u||(r=(n=c).copy()).on(s,i=u),l.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,o=n+"";return function(){var a=yd(this,t);return a===o?null:a===r?i:i=e(r=a,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,Vf(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Mf(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,$f(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=bf(this.node(),n).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==e?wf:_f)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?If:Of)(e,t)):bf(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?zf:Ff)(e,t)):bf(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(Bf(e,t)):bf(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;xf(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,i=n.size();return new Promise((function(o,a){var s={value:a},l={value:function(){0==--i&&o()}};n.each((function(){var n=xf(this,r),i=n.on;i!==t&&((e=(t=i).copy())._.cancel.push(s),e._.interrupt.push(s),e._.end.push(l)),n.on=e})),0===i&&o()}))},[Symbol.iterator]:Zf[Symbol.iterator]};var Jf={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Kf(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Qf(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function tm(t){return(t=Qf(Math.abs(t)))?t[1]:NaN}Zd.prototype.interrupt=function(t){return this.each((function(){!function(t,e){var n,r,i,o=t.__transition,a=!0;if(o){for(i in e=null==e?null:e+"",o)(n=o[i]).name===e?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):a=!1;a&&delete t.__transition}}(this,t)}))},Zd.prototype.transition=function(t){var e,n;t instanceof Xf?(e=t._id,t=t._name):(e=Yf(),(n=Jf).time=sf(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],l=s.length,c=0;c<l;++c)(a=s[c])&&vf(a,t,e,c,s,n||Kf(a,e));return new Xf(r,this._parents,t,e)};var em,nm=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function rm(t){if(!(e=nm.exec(t)))throw new Error("invalid format: "+t);var e;return new im({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function im(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function om(t,e){var n=Qf(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}rm.prototype=im.prototype,im.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var am={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>om(100*t,e),r:om,s:function(t,e){var n=Qf(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(em=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Qf(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function sm(t){return t}var lm,cm,um,hm=Array.prototype.map,dm=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function pm(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?sm:(e=hm.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=e[0],l=0;i>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),o.push(t.substring(i-=s,i+s)),!((l+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?sm:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(hm.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function h(t){var e=(t=rm(t)).fill,n=t.align,h=t.sign,d=t.symbol,p=t.zero,f=t.width,m=t.comma,g=t.precision,v=t.trim,y=t.type;"n"===y?(m=!0,y="g"):am[y]||(void 0===g&&(g=12),v=!0,y="g"),(p||"0"===e&&"="===n)&&(p=!0,e="0",n="=");var x="$"===d?i:"#"===d&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",b="$"===d?o:/[%p]/.test(y)?l:"",w=am[y],_=/[defgprs%]/.test(y);function M(t){var i,o,l,d=x,M=b;if("c"===y)M=w(t)+M,t="";else{var S=(t=+t)<0||1/t<0;if(t=isNaN(t)?u:w(Math.abs(t),g),v&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),S&&0==+t&&"+"!==h&&(S=!1),d=(S?"("===h?h:c:"-"===h||"("===h?"":h)+d,M=("s"===y?dm[8+em/3]:"")+M+(S&&"("===h?")":""),_)for(i=-1,o=t.length;++i<o;)if(48>(l=t.charCodeAt(i))||l>57){M=(46===l?a+t.slice(i+1):t.slice(i))+M,t=t.slice(0,i);break}}m&&!p&&(t=r(t,1/0));var T=d.length+t.length+M.length,E=T<f?new Array(f-T+1).join(e):"";switch(m&&p&&(t=r(E+t,E.length?f-M.length:1/0),E=""),n){case"<":t=d+t+M+E;break;case"=":t=d+E+t+M;break;case"^":t=E.slice(0,T=E.length>>1)+d+t+M+E.slice(T);break;default:t=E+d+t+M}return s(t)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),M.toString=function(){return t+""},M}return{format:h,formatPrefix:function(t,e){var n=h(((t=rm(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(tm(e)/3))),i=Math.pow(10,-r),o=dm[8+r/3];return function(t){return n(i*t)+o}}}}function fm(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function mm(t){return+t}lm=pm({thousands:",",grouping:[3],currency:["$",""]}),cm=lm.format,um=lm.formatPrefix;var gm=[0,1];function vm(t){return t}function ym(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:(n=isNaN(e)?NaN:.5,function(){return n});var n}function xm(t,e,n){var r=t[0],i=t[1],o=e[0],a=e[1];return i<r?(r=ym(i,r),o=n(a,o)):(r=ym(r,i),o=n(o,a)),function(t){return o(r(t))}}function bm(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),a=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<r;)i[a]=ym(t[a],t[a+1]),o[a]=n(e[a],e[a+1]);return function(e){var n=gh(t,e,1,r)-1;return o[n](i[n](e))}}function wm(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function _m(){var t,e,n,r,i,o,a=gm,s=gm,l=Hp,c=vm;function u(){var t,e,n,l=Math.min(a.length,s.length);return c!==vm&&(t=a[0],e=a[l-1],t>e&&(n=t,t=e,e=n),c=function(n){return Math.max(t,Math.min(e,n))}),r=l>2?bm:xm,i=o=null,h}function h(e){return null==e||isNaN(e=+e)?n:(i||(i=r(a.map(t),s,l)))(t(c(e)))}return h.invert=function(n){return c(e((o||(o=r(s,a.map(t),Op)))(n)))},h.domain=function(t){return arguments.length?(a=Array.from(t,mm),u()):a.slice()},h.range=function(t){return arguments.length?(s=Array.from(t),u()):s.slice()},h.rangeRound=function(t){return s=Array.from(t),l=Wp,u()},h.clamp=function(t){return arguments.length?(c=!!t||vm,u()):c!==vm},h.interpolate=function(t){return arguments.length?(l=t,u()):l},h.unknown=function(t){return arguments.length?(n=t,h):n},function(n,r){return t=n,e=r,u()}}function Mm(t,e,n,r){var i,o=wh(t,e,n);switch((r=rm(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(tm(e)/3)))-tm(Math.abs(t)))}(o,a))||(r.precision=i),um(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,tm(e)-tm(t))+1}(o,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(t){return Math.max(0,-tm(Math.abs(t)))}(o))||(r.precision=i-2*("%"===r.type))}return cm(r)}function Sm(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){var r,i,o,a,s=-1;if(n=+n,(t=+t)==(e=+e)&&n>0)return[t];if((r=e<t)&&(i=t,t=e,e=i),0===(a=bh(t,e,n))||!isFinite(a))return[];if(a>0){let n=Math.round(t/a),r=Math.round(e/a);for(n*a<t&&++n,r*a>e&&--r,o=new Array(i=r-n+1);++s<i;)o[s]=(n+s)*a}else{a=-a;let n=Math.round(t*a),r=Math.round(e*a);for(n/a<t&&++n,r/a>e&&--r,o=new Array(i=r-n+1);++s<i;)o[s]=(n+s)/a}return r&&o.reverse(),o}(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return Mm(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i,o=e(),a=0,s=o.length-1,l=o[a],c=o[s],u=10;for(c<l&&(i=l,l=c,c=i,i=a,a=s,s=i);u-- >0;){if((i=bh(l,c,n))===r)return o[a]=l,o[s]=c,e(o);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i}r=i}return t},t}function Tm(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function Em(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Cm(t){return t<0?-t*t:t*t}function Lm(t){var e=t(vm,vm),n=1;function r(){return 1===n?t(vm,vm):.5===n?t(Em,Cm):t(Tm(n),Tm(1/n))}return e.exponent=function(t){return arguments.length?(n=+t,r()):n},Sm(e)}function Am(){var t=Lm(_m());return t.copy=function(){return wm(t,Am()).exponent(t.exponent())},fm.apply(t,arguments),t}var Rm=new Date,Pm=new Date;function Nm(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=function(e){return t(e=new Date(+e)),e},i.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},i.round=function(t){var e=i(t),n=i.ceil(t);return t-e<n-t?e:n},i.offset=function(t,n){return e(t=new Date(+t),null==n?1:Math.floor(n)),t},i.range=function(n,r,o){var a,s=[];if(n=i.ceil(n),o=null==o?1:Math.floor(o),!(n<r&&o>0))return s;do{s.push(a=new Date(+n)),e(n,o),t(n)}while(a<n&&n<r);return s},i.filter=function(n){return Nm((function(e){if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}))},n&&(i.count=function(e,r){return Rm.setTime(+e),Pm.setTime(+r),t(Rm),t(Pm),Math.floor(n(Rm,Pm))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(e){return r(e)%t==0}:function(e){return i.count(0,e)%t==0}):i:null}),i}var Dm=Nm((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));Dm.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Nm((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):Dm:null};var km=Dm;const Im=1e3,Om=6e4,zm=36e5,Fm=864e5,Bm=6048e5,Um=2592e6,Hm=31536e6;var Wm=Nm((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+e*Im)}),(function(t,e){return(e-t)/Im}),(function(t){return t.getUTCSeconds()})),Gm=Wm,Vm=Nm((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*Im)}),(function(t,e){t.setTime(+t+e*Om)}),(function(t,e){return(e-t)/Om}),(function(t){return t.getMinutes()})),jm=Vm,$m=Nm((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*Im-t.getMinutes()*Om)}),(function(t,e){t.setTime(+t+e*zm)}),(function(t,e){return(e-t)/zm}),(function(t){return t.getHours()})),qm=$m,Xm=Nm((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Om)/Fm),(t=>t.getDate()-1)),Ym=Xm;function Zm(t){return Nm((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Om)/Bm}))}var Jm=Zm(0),Km=Zm(1);Zm(2),Zm(3);var Qm=Zm(4);Zm(5),Zm(6);var tg=Nm((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})),eg=tg,ng=Nm((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));ng.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Nm((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var rg=ng,ig=Nm((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+e*Om)}),(function(t,e){return(e-t)/Om}),(function(t){return t.getUTCMinutes()})),og=ig,ag=Nm((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+e*zm)}),(function(t,e){return(e-t)/zm}),(function(t){return t.getUTCHours()})),sg=ag,lg=Nm((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/Fm}),(function(t){return t.getUTCDate()-1})),cg=lg;function ug(t){return Nm((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/Bm}))}var hg=ug(0),dg=ug(1);ug(2),ug(3);var pg=ug(4);ug(5),ug(6);var fg=Nm((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),mg=fg,gg=Nm((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));gg.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Nm((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};var vg=gg;function yg(t,e,n,r,i,o){const a=[[Gm,1,Im],[Gm,5,5e3],[Gm,15,15e3],[Gm,30,3e4],[o,1,Om],[o,5,3e5],[o,15,9e5],[o,30,18e5],[i,1,zm],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,Fm],[r,2,1728e5],[n,1,Bm],[e,1,Um],[e,3,7776e6],[t,1,Hm]];function s(e,n,r){const i=Math.abs(n-e)/r,o=fh((([,,t])=>t)).right(a,i);if(o===a.length)return t.every(wh(e/Hm,n/Hm,r));if(0===o)return km.every(Math.max(wh(e,n,r),1));const[s,l]=a[i/a[o-1][2]<a[o][2]/i?o-1:o];return s.every(l)}return[function(t,e,n){const r=e<t;r&&([t,e]=[e,t]);const i=n&&"function"==typeof n.range?n:s(t,e,n),o=i?i.range(t,+e+1):[];return r?o.reverse():o},s]}yg(vg,mg,hg,cg,sg,og);const[xg,bg]=yg(rg,eg,Jm,Ym,qm,jm);function wg(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function _g(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Mg(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}var Sg,Tg,Eg={"-":"",_:" ",0:"0"},Cg=/^\s*\d+/,Lg=/^%/,Ag=/[\\^$*+?|[\]().{}]/g;function Rg(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(e)+i:i)}function Pg(t){return t.replace(Ag,"\\$&")}function Ng(t){return new RegExp("^(?:"+t.map(Pg).join("|")+")","i")}function Dg(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}function kg(t,e,n){var r=Cg.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Ig(t,e,n){var r=Cg.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Og(t,e,n){var r=Cg.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function zg(t,e,n){var r=Cg.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Fg(t,e,n){var r=Cg.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Bg(t,e,n){var r=Cg.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Ug(t,e,n){var r=Cg.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Hg(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Wg(t,e,n){var r=Cg.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Gg(t,e,n){var r=Cg.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Vg(t,e,n){var r=Cg.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function jg(t,e,n){var r=Cg.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function $g(t,e,n){var r=Cg.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function qg(t,e,n){var r=Cg.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Xg(t,e,n){var r=Cg.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Yg(t,e,n){var r=Cg.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Zg(t,e,n){var r=Cg.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Jg(t,e,n){var r=Lg.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Kg(t,e,n){var r=Cg.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Qg(t,e,n){var r=Cg.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function tv(t,e){return Rg(t.getDate(),e,2)}function ev(t,e){return Rg(t.getHours(),e,2)}function nv(t,e){return Rg(t.getHours()%12||12,e,2)}function rv(t,e){return Rg(1+Ym.count(rg(t),t),e,3)}function iv(t,e){return Rg(t.getMilliseconds(),e,3)}function ov(t,e){return iv(t,e)+"000"}function av(t,e){return Rg(t.getMonth()+1,e,2)}function sv(t,e){return Rg(t.getMinutes(),e,2)}function lv(t,e){return Rg(t.getSeconds(),e,2)}function cv(t){var e=t.getDay();return 0===e?7:e}function uv(t,e){return Rg(Jm.count(rg(t)-1,t),e,2)}function hv(t){var e=t.getDay();return e>=4||0===e?Qm(t):Qm.ceil(t)}function dv(t,e){return t=hv(t),Rg(Qm.count(rg(t),t)+(4===rg(t).getDay()),e,2)}function pv(t){return t.getDay()}function fv(t,e){return Rg(Km.count(rg(t)-1,t),e,2)}function mv(t,e){return Rg(t.getFullYear()%100,e,2)}function gv(t,e){return Rg((t=hv(t)).getFullYear()%100,e,2)}function vv(t,e){return Rg(t.getFullYear()%1e4,e,4)}function yv(t,e){var n=t.getDay();return Rg((t=n>=4||0===n?Qm(t):Qm.ceil(t)).getFullYear()%1e4,e,4)}function xv(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Rg(e/60|0,"0",2)+Rg(e%60,"0",2)}function bv(t,e){return Rg(t.getUTCDate(),e,2)}function wv(t,e){return Rg(t.getUTCHours(),e,2)}function _v(t,e){return Rg(t.getUTCHours()%12||12,e,2)}function Mv(t,e){return Rg(1+cg.count(vg(t),t),e,3)}function Sv(t,e){return Rg(t.getUTCMilliseconds(),e,3)}function Tv(t,e){return Sv(t,e)+"000"}function Ev(t,e){return Rg(t.getUTCMonth()+1,e,2)}function Cv(t,e){return Rg(t.getUTCMinutes(),e,2)}function Lv(t,e){return Rg(t.getUTCSeconds(),e,2)}function Av(t){var e=t.getUTCDay();return 0===e?7:e}function Rv(t,e){return Rg(hg.count(vg(t)-1,t),e,2)}function Pv(t){var e=t.getUTCDay();return e>=4||0===e?pg(t):pg.ceil(t)}function Nv(t,e){return t=Pv(t),Rg(pg.count(vg(t),t)+(4===vg(t).getUTCDay()),e,2)}function Dv(t){return t.getUTCDay()}function kv(t,e){return Rg(dg.count(vg(t)-1,t),e,2)}function Iv(t,e){return Rg(t.getUTCFullYear()%100,e,2)}function Ov(t,e){return Rg((t=Pv(t)).getUTCFullYear()%100,e,2)}function zv(t,e){return Rg(t.getUTCFullYear()%1e4,e,4)}function Fv(t,e){var n=t.getUTCDay();return Rg((t=n>=4||0===n?pg(t):pg.ceil(t)).getUTCFullYear()%1e4,e,4)}function Bv(){return"+0000"}function Uv(){return"%"}function Hv(t){return+t}function Wv(t){return Math.floor(+t/1e3)}function Gv(t){return new Date(t)}function Vv(t){return t instanceof Date?+t:+new Date(+t)}function jv(t,e,n,r,i,o,a,s,l,c){var u=_m()(vm,vm),h=u.invert,d=u.domain,p=c(".%L"),f=c(":%S"),m=c("%I:%M"),g=c("%I %p"),v=c("%a %d"),y=c("%b %d"),x=c("%B"),b=c("%Y");function w(t){return(l(t)<t?p:s(t)<t?f:a(t)<t?m:o(t)<t?g:r(t)<t?i(t)<t?v:y:n(t)<t?x:b)(t)}return u.invert=function(t){return new Date(h(t))},u.domain=function(t){return arguments.length?d(Array.from(t,Vv)):d().map(Gv)},u.ticks=function(e){var n=d();return t(n[0],n[n.length-1],null==e?10:e)},u.tickFormat=function(t,e){return null==e?w:c(e)},u.nice=function(t){var n=d();return t&&"function"==typeof t.range||(t=e(n[0],n[n.length-1],null==t?10:t)),t?d(function(t,e){var n,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a<o&&(n=r,r=i,i=n,n=o,o=a,a=n),t[r]=e.floor(o),t[i]=e.ceil(a),t}(n,t)):u},u.copy=function(){return wm(u,jv(t,e,n,r,i,o,a,s,l,c))},u}!function(t){Sg=function(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,s=t.months,l=t.shortMonths,c=Ng(i),u=Dg(i),h=Ng(o),d=Dg(o),p=Ng(a),f=Dg(a),m=Ng(s),g=Dg(s),v=Ng(l),y=Dg(l),x={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:tv,e:tv,f:ov,g:gv,G:yv,H:ev,I:nv,j:rv,L:iv,m:av,M:sv,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Hv,s:Wv,S:lv,u:cv,U:uv,V:dv,w:pv,W:fv,x:null,X:null,y:mv,Y:vv,Z:xv,"%":Uv},b={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:bv,e:bv,f:Tv,g:Ov,G:Fv,H:wv,I:_v,j:Mv,L:Sv,m:Ev,M:Cv,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Hv,s:Wv,S:Lv,u:Av,U:Rv,V:Nv,w:Dv,W:kv,x:null,X:null,y:Iv,Y:zv,Z:Bv,"%":Uv},w={a:function(t,e,n){var r=p.exec(e.slice(n));return r?(t.w=f.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=h.exec(e.slice(n));return r?(t.w=d.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=v.exec(e.slice(n));return r?(t.m=y.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=m.exec(e.slice(n));return r?(t.m=g.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return S(t,e,n,r)},d:Vg,e:Vg,f:Zg,g:Ug,G:Bg,H:$g,I:$g,j:jg,L:Yg,m:Gg,M:qg,p:function(t,e,n){var r=c.exec(e.slice(n));return r?(t.p=u.get(r[0].toLowerCase()),n+r[0].length):-1},q:Wg,Q:Kg,s:Qg,S:Xg,u:Ig,U:Og,V:zg,w:kg,W:Fg,x:function(t,e,r){return S(t,n,e,r)},X:function(t,e,n){return S(t,r,e,n)},y:Ug,Y:Bg,Z:Hg,"%":Jg};function _(t,e){return function(n){var r,i,o,a=[],s=-1,l=0,c=t.length;for(n instanceof Date||(n=new Date(+n));++s<c;)37===t.charCodeAt(s)&&(a.push(t.slice(l,s)),null!=(i=Eg[r=t.charAt(++s)])?r=t.charAt(++s):i="e"===r?" ":"0",(o=e[r])&&(r=o(n,i)),a.push(r),l=s+1);return a.push(t.slice(l,s)),a.join("")}}function M(t,e){return function(n){var r,i,o=Mg(1900,void 0,1);if(S(o,t,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(e&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=_g(Mg(o.y,0,1))).getUTCDay(),r=i>4||0===i?dg.ceil(r):dg(r),r=cg.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=wg(Mg(o.y,0,1))).getDay(),r=i>4||0===i?Km.ceil(r):Km(r),r=Ym.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?_g(Mg(o.y,0,1)).getUTCDay():wg(Mg(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,_g(o)):wg(o)}}function S(t,e,n,r){for(var i,o,a=0,s=e.length,l=n.length;a<s;){if(r>=l)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=w[i in Eg?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return x.x=_(n,x),x.X=_(r,x),x.c=_(e,x),b.x=_(n,b),b.X=_(r,b),b.c=_(e,b),{format:function(t){var e=_(t+="",x);return e.toString=function(){return t},e},parse:function(t){var e=M(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=_(t+="",b);return e.toString=function(){return t},e},utcParse:function(t){var e=M(t+="",!0);return e.toString=function(){return t},e}}}(t),Tg=Sg.format}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),vt();vt();const $v=vt()?320:600,qv=128,Xv=8,Yv=64,Zv=8,Jv="#252525",Kv="#eee",Qv="Roboto-Mono";function ty(t){return t.includes("facebook")?"facebook":t.includes("t.me")?"telegram":t.includes("twitter")?"twitter":t.includes("youtube")?"youtube":null}function ey(t){const e=ty(t.url);let n={name:"",count:0};return"twitter"===e?(n.name="shares",n.count=t.engagement.shares):"facebook"===e?(n.name="reactions",n.count=t.engagement.reactions):["youtube","telegram"].includes(e)&&(n.name="views",n.count=t.engagement.views),n}function ny(t,e,n){const[r,i]=function(t,e=30,n="published_at"){const r=t.map((t=>new Date(t[n])));return[Math.min(...r)-24*e*60*60*1e3,Math.max(...r)+24*e*60*60*1e3]}(t,2),o=function(){return fm.apply(jv(xg,bg,rg,eg,Jm,Ym,qm,jm,Gm,Tg).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}().rangeRound([0,n-1]).domain([r,i]),a=[...new Set(t.map((t=>t.source_name)))],s=[...new Set(e.map((t=>t.name)))].filter((t=>a.includes(t)));let l=new Set;e.map((t=>Object.keys(t.endpoint))).forEach((t=>t.forEach((t=>l.add(t))))),l=[...l];const c={},u={};s.forEach(((t,e)=>{c[t]=e,u[e]=t}));const h=[...Array(s.length)].map((t=>Array(n).fill([])));t.forEach((t=>{const e=t.source_name,n=new Date(t.published_at),r=c[e];if(void 0===r)return;const i=o(n);h[r][i]=h[r][i].concat([t])}));let d={};l.forEach((e=>{t.filter((t=>ty(t.url)===e)).forEach((t=>{const n=ey(t),r=d[e];(void 0===r||+n.count>r)&&(d[e]=+n.count)}))})),h.forEach(((t,e)=>{Math.max(...t.map((t=>t.length)))}));let p={};return l.forEach((t=>{p[t]=Am().domain([0,d[t]])})),{matrix:h,source_mapping:c,time_scale:o,color_scales:p}}function ry(t){const e=t.toLowerCase().split(" ");for(let t=0;t<e.length;t++)e[t]=e[t].charAt(0).toUpperCase()+e[t].substring(1);return e.join(" ")}function iy(t,e,n,r,i,o,a){Object.keys(r).forEach((t=>{r[t]=r[t].range([Jv,"#eee","#fff"])}));const s=1*t[0].length,l=1*Object.keys(e).length,c=1*$v/s,u=800/l,h=Math.floor(Math.min(c,u))-2,d=(h+2)*s,p=(h+2)*l,f=h,{matrix_df:m,sources_df:g}=function(t,e,n,r,i){const o=[],a={};Object.keys(e).forEach((t=>{const n=+e[t];a[n]=t;const s=n*(r+2);o.push({row_id:n,y:s+i-2,text:ry(t)})}));const s=[];return t.forEach(((t,e)=>{t.forEach(((t,i)=>{const o=a[e];let l=Jv,c=0;t.length>0&&t.forEach((t=>{const e=ey(t).count;e>c&&(c=e,l=n[ty(t.url)](e))})),s.push({row_id:e,source_name:o,x:i*(r+2),y:e*(r+2),width:r,height:r,fill:l,value:t.length,data:t})}))})),{matrix_df:s,sources_df:o}}(t,e,r,h,f),v=i.append("svg").attr("width",$v+128+Zv+Xv).attr("height",800+qv+Yv),y=v.append("g").attr("transform","translate("+Zv+","+qv+")"),x=v.append("g").attr("transform","translate("+Zv+","+qv+")"),b=v.append("g").attr("transform","translate("+(Zv+d+8)+","+qv+")"),w=v.append("g").attr("transform","translate("+Zv+","+(qv+p)+")");y.selectAll("rect").data(m).enter().append("rect").attr("x",(t=>t.x)).attr("y",(t=>t.y)).attr("width",(t=>t.width)).attr("height",(t=>t.height)).attr("fill",(t=>t.fill)).attr("stroke",(t=>t.fill)).attr("stroke-width","0").attr("cursor",(t=>t.value>0?"pointer":"default")).on("mouseover",(function(t,e){0!=+e.value&&(o.style("display","inline"),o.html((()=>function(t){return`\n <h2>${t.source_name}</h2>\n <p><b>${t.data.length} ${t.data.length>1?"posts":"post"}</b></p>\n ${t.data.map((t=>{const e=ty(t.url),n=ey(t);return`<p>${t.published_at}: ${e}, ${n.name}: ${(+n.count).toLocaleString()}</p>`})).join("")}\n `}(e))),Jd(this).attr("stroke-width",3))})).on("mousemove",(t=>{o.style("left",`${t.pageX+16}px`).style("top",`${t.pageY+16}px`)})).on("mouseout",(function(){o.style("display","none"),Jd(this).attr("stroke-width",0)})).on("click",((t,e)=>{if(vt())return;const n=e.data.map((t=>t.url));0!==n.length&&eu({title:"Open URLs",text:`Pressing ok will open ${n.length} ${n.length>1?"posts":"post"} as new tabs`}).then((t=>{if(t)for(let t=0;t<n.length;t++)window.open(n[t],"_blank")}))})),b.selectAll("text").data(g).enter().append("text").attr("font-size",`${h}px`).attr("font-family",Qv).style("fill",Kv).attr("x","0px").attr("y",(t=>`${t.y}px`)).text((t=>t.text));const _=function(t){let e=0;return t.selectAll("text").each((function(t){const n=this.getBoundingClientRect().width;n>e&&(e=n)})),e}(b),M=d+8+_;v.attr("width",`${M+Zv+Xv}px`),v.attr("height",`${p+Yv+qv}px`),v.append("g").attr("transform","translate("+(Zv+M/2)+",8)");const S=n.copy();if(S.range([0,d-2]),function(t,e,n){const r=Tg("%y/%m"),i=vt()?Rh(e).tickFormat(r).ticks(5):Rh(e).tickFormat(r);t.attr("class","axis").call(i).style("font-size",n)}(w,S,h),Array.isArray(a)&&a.length>0){const t=a.filter((t=>{const e=S(new Date(t.date));return e>0&&e<d-2}));x.selectAll("rect").data(t).enter().append("rect").attr("x",(t=>`${S(new Date(t.date))}px`)).attr("y","0px").attr("width","1px").attr("height",`${p}px`).attr("fill",Kv).attr("opacity",0),x.selectAll("text").data(t).enter().append("text").attr("font-size",`${h}px`).attr("letter-spacing","0.3").attr("fill",Kv).attr("font-family",Qv).attr("x","0px").attr("y","0px").attr("transform",((t,e)=>{const n=2===e?-2:-6;return`translate(${S(new Date(t.date))-2}, ${n}), rotate(-20)`})).text((t=>t.title)).attr("opacity",0)}return{svg:x}}function oy(e){let n,r,i,o;return{c(){n=f("div"),r=f("div"),i=g(),o=f("div"),x(r,"id",e[0]),x(r,"class","svelte-1thrdwa"),x(o,"id",e[1]),x(o,"class","tooltip svelte-1thrdwa"),x(n,"class","container svelte-1thrdwa")},m(t,e){h(t,n,e),u(n,r),u(n,i),u(n,o)},p:t,i:t,o:t,d(t){t&&d(n)}}}function ay(t,e,n){let{lang:r}=e,{data:i}=e,{sources:o}=e,{events:a}=e;const s=Math.round(1e3*Math.random()),l=`heatmap-${s}`,c=`heatmaptooltip-${s}`;return T((async()=>{if(!Array.isArray(i))return;const{matrix:t,source_mapping:e,time_scale:n,color_scales:r}=ny(i,o,60),s=document.querySelector("main"),u=Jd(`#${l}`),h=Jd(`#${c}`),d=window.screen.height,{svg:p}=iy(t,e,n,r,u,h,a);let f=!1;s.addEventListener("scroll",(()=>{const{top:t,bottom:e}=p.node().getBoundingClientRect();t>-(e-t)/2&&t<2*d/3?f||(f=!0,function(t){t.selectAll("rect").transition().duration(1e3).attr("opacity",1).delay(((t,e)=>100*e)),t.selectAll("text").transition().duration(1e3).attr("opacity",1).delay(((t,e)=>100*e))}(p)):(f=!1,function(t){t.selectAll("rect").attr("opacity",0),t.selectAll("text").attr("opacity",0)}(p))}))})),t.$$set=t=>{"lang"in t&&n(2,r=t.lang),"data"in t&&n(3,i=t.data),"sources"in t&&n(4,o=t.sources),"events"in t&&n(5,a=t.events)},[l,c,r,i,o,a]}class sy extends Z{constructor(t){super(),Y(this,t,ay,oy,o,{lang:2,data:3,sources:4,events:5})}}function ly(t){let e,n,r,i,o,a,s,l,c,p,v,y,b,w,M,S,T,E,C,L,A,R,P,N,D,k,I,O,z,F,B,U,H,V,X,Y,Z,J,K,Q,tt,et,nt,rt,it,ot,at,st,lt,ct,ut,ht,dt,pt,ft,mt,gt,vt,yt,xt,bt,wt,_t,Mt,St,Tt,Et,Ct,Lt,At,Rt,Pt,Nt,Dt,kt,It,Ot,zt,Ft,Bt,Ut,Ht,Wt,Gt,Vt,jt,$t,qt,Xt,Yt;return T=new eh({props:{data:t[7]}}),J=new sh({props:{placeholders:t[0].examples.queries,documents:t[1],word_mapping:t[3]}}),lt=new eh({props:{data:t[5]}}),ft=new eh({props:{data:t[6]}}),bt=new eh({props:{data:[["Type","Minimum Value"],["Views","30000"],["Reactions","800"],["Comments","150"],["Shares","50"]]}}),Dt=new sy({props:{data:t[12],sources:t[11],events:t[4]}}),Vt=new dh({props:{data:t[11]}}),{c(){e=f("section"),n=f("p"),n.textContent="Brazil",r=g(),i=f("p"),i.textContent="In the wake of shocks, people want answers but facts have yet to emerge. As a result, deliberate and spontaneous falsehoods \n can proliferate with incredible velocity. Forums, digital and non-digital, become a capharnaum. In charge of managing the \n response to the shock, the State and institutions can take steps to inform and guide a concerned public. Opportunistic leaders \n can leverage their position for power consolidation. They overlook, condone, or amplify false information to undermine the \n integrity of the information space for their own political advantage. In extremis, they employ propaganda to manipulate \n public opinion.",o=g(),a=f("br"),s=g(),l=f("p"),l.innerHTML='In this study, undertaken in partnership with the <a target="_blank" href="https://www.ndi.org/">National Democratic Institute</a>\n and <a target="_blank" href="https://www.internetlab.org.br/en/">InternetLab</a> we seek to establish the prevalence \n and nature of disinformation campaigns throughout of the COVID pandemic.',c=g(),p=f("p"),p.textContent="Political Network",v=g(),y=f("p"),b=m("In-country participants identified "),w=f("b"),w.textContent=`${t[8]}`,M=m(" Telegram, Facebook, Twitter and Youtube accounts as being part of \n the political network."),S=g(),j(T.$$.fragment),E=g(),C=f("p"),C.textContent="Dataset",L=g(),A=f("p"),R=m("Data collection returned a total of "),P=f("b"),P.textContent=`${t[1].length.toLocaleString()}`,N=m(" posts between "),D=m(t[9]),k=m(" and "),I=m(t[10]),O=m("."),z=g(),F=f("br"),B=g(),U=f("p"),U.textContent="This search bar allows you to find social media posts based on space-separated keywords (click for full results). \n Some keywords have been removed if they either had low or high occurrence.",H=g(),V=f("br"),X=g(),Y=f("p"),Y.textContent="Some posts might have been taken down by the author or the platform since this data collection activity.",Z=g(),j(J.$$.fragment),K=g(),Q=f("p"),Q.textContent="Filtering",tt=g(),et=f("p"),et.textContent="Lexicon",nt=g(),rt=f("p"),it=m("Participants came up with a list of "),ot=f("b"),ot.textContent=`${t[2].length} words`,at=m(" prone to be used in disinformation. Only posts containing at least\n one of these keywords were kept."),st=g(),j(lt.$$.fragment),ct=g(),ut=f("p"),ut.textContent="Events",ht=g(),dt=f("p"),dt.textContent=`The shock timeline developed by the participants is composed of ${t[4].length} key events. We only considered social media posts \n published during the 21 days following each event.`,pt=g(),j(ft.$$.fragment),mt=g(),gt=f("p"),gt.textContent="Engagement",vt=g(),yt=f("p"),yt.textContent="Post that did not meet the minimum engagement thresholds were dismissed.",xt=g(),j(bt.$$.fragment),wt=g(),_t=f("p"),_t.textContent="Results",Mt=g(),St=f("p"),Tt=m("Using automated lexical, temporal and engagement filters, in combination with human reviews we uncovered a total of \n "),Et=f("b"),Et.textContent=`${t[12].length}`,Ct=m(" posts containing disinformation from "),Lt=f("b"),Lt.textContent=`${t[11].length}`,At=m(" belligerents."),Rt=g(),Pt=f("br"),Nt=g(),j(Dt.$$.fragment),kt=g(),It=f("p"),It.textContent="Belligerents",Ot=g(),zt=f("p"),Ft=m("Here is a short description of the "),Bt=f("b"),Bt.textContent=`${t[11].length.toLocaleString()} state-affiliated accounts`,Ut=m(" that published \n disinformation."),Ht=g(),Wt=f("br"),Gt=g(),j(Vt.$$.fragment),jt=g(),$t=f("p"),$t.textContent="Discussion",qt=g(),Xt=f("p"),Xt.textContent="[ in progress ]",x(n,"class","title"),x(p,"class","subtitle"),x(C,"class","subtitle"),_(Y,"font-style","italic"),x(Q,"class","subtitle"),x(et,"class","subsubtitle"),x(ut,"class","subsubtitle"),x(gt,"class","subsubtitle"),x(_t,"class","subtitle"),x(It,"class","subsubtitle"),x($t,"class","subtitle")},m(t,d){h(t,e,d),u(e,n),u(e,r),u(e,i),u(e,o),u(e,a),u(e,s),u(e,l),u(e,c),u(e,p),u(e,v),u(e,y),u(y,b),u(y,w),u(y,M),u(e,S),$(T,e,null),u(e,E),u(e,C),u(e,L),u(e,A),u(A,R),u(A,P),u(A,N),u(A,D),u(A,k),u(A,I),u(A,O),u(e,z),u(e,F),u(e,B),u(e,U),u(e,H),u(e,V),u(e,X),u(e,Y),u(e,Z),$(J,e,null),u(e,K),u(e,Q),u(e,tt),u(e,et),u(e,nt),u(e,rt),u(rt,it),u(rt,ot),u(rt,at),u(e,st),$(lt,e,null),u(e,ct),u(e,ut),u(e,ht),u(e,dt),u(e,pt),$(ft,e,null),u(e,mt),u(e,gt),u(e,vt),u(e,yt),u(e,xt),$(bt,e,null),u(e,wt),u(e,_t),u(e,Mt),u(e,St),u(St,Tt),u(St,Et),u(St,Ct),u(St,Lt),u(St,At),u(e,Rt),u(e,Pt),u(e,Nt),$(Dt,e,null),u(e,kt),u(e,It),u(e,Ot),u(e,zt),u(zt,Ft),u(zt,Bt),u(zt,Ut),u(e,Ht),u(e,Wt),u(e,Gt),$(Vt,e,null),u(e,jt),u(e,$t),u(e,qt),u(e,Xt),Yt=!0},p(t,[e]){const n={};1&e&&(n.placeholders=t[0].examples.queries),J.$set(n)},i(t){Yt||(W(T.$$.fragment,t),W(J.$$.fragment,t),W(lt.$$.fragment,t),W(ft.$$.fragment,t),W(bt.$$.fragment,t),W(Dt.$$.fragment,t),W(Vt.$$.fragment,t),Yt=!0)},o(t){G(T.$$.fragment,t),G(J.$$.fragment,t),G(lt.$$.fragment,t),G(ft.$$.fragment,t),G(bt.$$.fragment,t),G(Dt.$$.fragment,t),G(Vt.$$.fragment,t),Yt=!1},d(t){t&&d(e),q(T),q(J),q(lt),q(ft),q(bt),q(Dt),q(Vt)}}}function cy(t,e,n){let{lang:r}=e,{dataset:i}=e,{params:o}=e;const{sources:a,posts:s,submissions:l,lexicon:c,dictionary:u,events:h,categories:d,lexicon_table:p,events_table:f,political_network_table:m,nbr_of_accounts:g,min_date:v,max_date:y,belligerents:x,submissions_of_interest:b}=i;return t.$$set=t=>{"lang"in t&&n(13,r=t.lang),"dataset"in t&&n(14,i=t.dataset),"params"in t&&n(0,o=t.params)},[o,s,c,u,h,p,f,m,g,v,y,x,b,r,i]}class uy extends Z{constructor(t){super(),Y(this,t,cy,ly,o,{lang:13,dataset:14,params:0})}}function hy(e){let n,r,i,o,a,s,l,c,p,v,y,b,w,_,M,S,T,E,C,L,A,R,P,N,D,k,I,O,z,F,B,U,H,V,X;return A=new eh({props:{data:e[2]}}),F=new eh({props:{data:e[1]}}),{c(){n=f("section"),r=f("p"),r.textContent="Ivory Coast",i=g(),o=f("p"),o.innerHTML='Following Ouattara's controversial re-election for a third term, a dozen opposition members were arrested, flare-ups of violence \n led to 85 deaths & 484 injured, and ten thousands Ivorians fled to neighboring countries – \n <a target="_blank" href="https://data2.unhcr.org/en/documents/download/82963">UNHCR report</a>. \n A situation all too reminiscent of the 2010-2011 civil war that claimed roughly \n <a target="_bank" href="https://www.aljazeera.com/news/2011/12/27/ivory-coast-the-brink-of-civil-war">3,000 lives</a>. \n Rumors are running rampant and fears that they are feeding the festering inter-communal hate prompted the Ivorian civil society \n and the international community to intervene.',a=g(),s=f("br"),l=g(),c=f("p"),c.innerHTML='In partnership with the <a target="_blank" href="https://www.ndi.org/">National Democratic Institute</a>, \n <a target="_blank" href="https://www.ned.org/">National Endowment for Democracy</a>, and \n <a target="_blank" href="http://www.oidh.ci/">Observatoire Ivoirien des droits de l'homme (OIDH)</a> an \n information monitoring & countering programme was implemented. Due to illiteracy and low social media penetration in areas \n of interests, the project scope goes beyond the digital domain.',p=g(),v=f("p"),v.textContent="Groundwork",y=g(),b=f("p"),b.innerHTML='Bongouanou, Daoukro, and Divo – three prefectures which witnessed horrific scenes of violence or acts of sedition. Enumerators \n were sent to each to interview community leaders, religious figures, local media, and focus groups split by age, ethnicity, and gender. \n Participants were interrogated about social media, <a target="_blank" href="https://fr.wikipedia.org/wiki/Espace_de_discussion_de_rue">grins</a>, \n <a target="_blank" href="https://en.wikipedia.org/wiki/Griot">griots</a> & crieurs publiques, "word of mouth" and traditional media \n (radio, tv, journal). Favored online forums, popular influencers & polemists, dubious narratives, local idioms, and perspectives on \n recent events were recorded. Moreover, communication channels were established with individuals who displayed shrewdness and leadership \n during the sessions.',w=g(),_=f("p"),_.textContent="Influential Pages",M=g(),S=f("p"),T=m("Interviews surfaced "),E=f("b"),E.textContent=`${e[3]}`,C=m(" Facebook groups, pages and accounts. Some of these are private and require approval of a request \n to join."),L=g(),j(A.$$.fragment),R=g(),P=f("p"),P.textContent="Lexicon",N=g(),D=f("p"),k=m("Interviews surfaced "),I=f("b"),I.textContent=`${e[0].length}`,O=m(" words and expressions prone to be used in narratives of interest."),z=g(),j(F.$$.fragment),B=g(),U=f("p"),U.textContent="Discussion",H=g(),V=f("p"),V.textContent="[ in progress ]",x(r,"class","title"),x(v,"class","subtitle"),x(_,"class","subtitle"),x(P,"class","subtitle"),x(U,"class","subtitle")},m(t,e){h(t,n,e),u(n,r),u(n,i),u(n,o),u(n,a),u(n,s),u(n,l),u(n,c),u(n,p),u(n,v),u(n,y),u(n,b),u(n,w),u(n,_),u(n,M),u(n,S),u(S,T),u(S,E),u(S,C),u(n,L),$(A,n,null),u(n,R),u(n,P),u(n,N),u(n,D),u(D,k),u(D,I),u(D,O),u(n,z),$(F,n,null),u(n,B),u(n,U),u(n,H),u(n,V),X=!0},p:t,i(t){X||(W(A.$$.fragment,t),W(F.$$.fragment,t),X=!0)},o(t){G(A.$$.fragment,t),G(F.$$.fragment,t),X=!1},d(t){t&&d(n),q(A),q(F)}}}function dy(t,e,n){let{lang:r}=e,{dataset:i}=e,{params:o}=e;const{sources:a,lexicon:s,events:l}=i;let c=s.sort().map((t=>[t]));c.unshift(["Lexicon"]),l.map((t=>[t.date,t.title,t.description])).unshift(["Date","Title","Description"]);let u=[];a.forEach((t=>{const{name:e,endpoint:n}=t;Object.keys(n).forEach((t=>{const{url:r}=n[t];u.push([e,t,r])}))})),u.unshift(["Source","Platform","Link"]);const h=u.length-1;return t.$$set=t=>{"lang"in t&&n(4,r=t.lang),"dataset"in t&&n(5,i=t.dataset),"params"in t&&n(6,o=t.params)},[s,c,u,h,r,i,o]}class py extends Z{constructor(t){super(),Y(this,t,dy,hy,o,{lang:4,dataset:5,params:6})}}function fy(t){let e,n,r,i,o;function a(e){t[12](e)}let s={sample_posts:t[7]};return void 0!==t[0]&&(s.lang=t[0]),r=new Cu({props:s}),C.push((()=>V(r,"lang",a))),{c(){e=f("div"),n=g(),j(r.$$.fragment),x(e,"class","separator")},m(t,i){h(t,e,i),h(t,n,i),$(r,t,i),o=!0},p(t,e){const n={};128&e&&(n.sample_posts=t[7]),!i&&1&e&&(i=!0,n.lang=t[0],D((()=>i=!1))),r.$set(n)},i(t){o||(W(r.$$.fragment,t),o=!0)},o(t){G(r.$$.fragment,t),o=!1},d(t){t&&d(e),t&&d(n),q(r,t)}}}function my(t){let e,n,r,i;return r=new uy({props:{lang:t[0],params:t[4],dataset:t[8]}}),{c(){e=f("div"),n=g(),j(r.$$.fragment),x(e,"class","separator")},m(t,o){h(t,e,o),h(t,n,o),$(r,t,o),i=!0},p(t,e){const n={};1&e&&(n.lang=t[0]),16&e&&(n.params=t[4]),256&e&&(n.dataset=t[8]),r.$set(n)},i(t){i||(W(r.$$.fragment,t),i=!0)},o(t){G(r.$$.fragment,t),i=!1},d(t){t&&d(e),t&&d(n),q(r,t)}}}function gy(t){let e,n,r,i;return r=new py({props:{lang:t[0],params:t[6],dataset:t[9]}}),{c(){e=f("div"),n=g(),j(r.$$.fragment),x(e,"class","separator")},m(t,o){h(t,e,o),h(t,n,o),$(r,t,o),i=!0},p(t,e){const n={};1&e&&(n.lang=t[0]),64&e&&(n.params=t[6]),512&e&&(n.dataset=t[9]),r.$set(n)},i(t){i||(W(r.$$.fragment,t),i=!0)},o(t){G(r.$$.fragment,t),i=!1},d(t){t&&d(e),t&&d(n),q(r,t)}}}function vy(e){let n,r,i,o,a,s,l,c,p,v,y,w,_,M,S,T,E,L,A,R,P,N,k,I,O,z,F,B,X,Y,Z,J,K,Q,tt,et,nt,rt,it=gt(e[0],"title")+"",ot=gt(e[0],"subtitle")+"",at=ft.length>0&&function(e){let n,r,i,o,a,s;return{c(){n=f("div"),r=g(),i=f("div"),o=f("p"),a=f("a"),s=m("Tor Link"),x(n,"class","vert-cell svelte-12zyis9"),x(a,"href",""+(ft+pt)),x(a,"target","_blank"),x(o,"id","onion-location"),x(o,"class","svelte-12zyis9"),x(i,"class","vert-cell svelte-12zyis9")},m(t,e){h(t,n,e),h(t,r,e),h(t,i,e),u(i,o),u(o,a),u(a,s)},p:t,d(t){t&&d(n),t&&d(r),t&&d(i)}}}();function st(t){e[11](t)}let lt={};void 0!==e[0]&&(lt.lang=e[0]),F=new cu({props:lt}),C.push((()=>V(F,"lang",st)));let ct=e[1]&&fy(e);function ut(t){e[13](t)}let ht={};void 0!==e[0]&&(ht.lang=e[0]),K=new Fu({props:ht}),C.push((()=>V(K,"lang",ut)));let dt=e[2]&&my(e),mt=yy,vt=e[3]&&gy(e);return{c(){n=f("main"),r=f("div"),i=g(),o=f("div"),a=f("div"),s=g(),l=f("div"),c=f("p"),p=m(it),v=g(),y=f("p"),w=m(ot),_=g(),M=f("div"),S=g(),T=f("div"),E=g(),L=f("div"),L.innerHTML='<p>by</p> \n <p class="authors svelte-12zyis9"><a href="https://jeanromainroy.com/" target="_blank">Jean-Romain Roy</a></p>',A=g(),R=f("div"),P=g(),at&&at.c(),N=g(),k=f("div"),I=g(),O=f("div"),z=g(),j(F.$$.fragment),X=g(),ct&&ct.c(),Y=g(),Z=f("div"),J=g(),j(K.$$.fragment),tt=g(),dt&&dt.c(),et=g(),nt=g(),vt&&vt.c(),x(r,"class","spacing-before-title svelte-12zyis9"),x(a,"class","vert-cell svelte-12zyis9"),x(c,"class","top-title svelte-12zyis9"),x(y,"class","top-subtitle svelte-12zyis9"),x(l,"class","vert-cell svelte-12zyis9"),x(M,"class","vert-cell svelte-12zyis9"),x(T,"class","vert-cell svelte-12zyis9"),x(L,"class","vert-cell svelte-12zyis9"),x(R,"class","vert-cell svelte-12zyis9"),x(o,"class","top-title-container svelte-12zyis9"),x(k,"class","spacing-before-report svelte-12zyis9"),x(O,"class","separator"),x(Z,"class","separator"),x(n,"class","svelte-12zyis9")},m(t,e){h(t,n,e),u(n,r),u(n,i),u(n,o),u(o,a),u(o,s),u(o,l),u(l,c),u(c,p),u(l,v),u(l,y),u(y,w),u(o,_),u(o,M),u(o,S),u(o,T),u(o,E),u(o,L),u(o,A),u(o,R),u(o,P),at&&at.m(o,null),u(n,N),u(n,k),u(n,I),u(n,O),u(n,z),$(F,n,null),u(n,X),ct&&ct.m(n,null),u(n,Y),u(n,Z),u(n,J),$(K,n,null),u(n,tt),dt&&dt.m(n,null),u(n,et),u(n,nt),vt&&vt.m(n,null),rt=!0},p(t,[e]){(!rt||1&e)&&it!==(it=gt(t[0],"title")+"")&&b(p,it),(!rt||1&e)&&ot!==(ot=gt(t[0],"subtitle")+"")&&b(w,ot),ft.length>0&&at.p(t,e);const r={};!B&&1&e&&(B=!0,r.lang=t[0],D((()=>B=!1))),F.$set(r),t[1]?ct?(ct.p(t,e),2&e&&W(ct,1)):(ct=fy(t),ct.c(),W(ct,1),ct.m(n,Y)):ct&&(U(),G(ct,1,1,(()=>{ct=null})),H());const i={};!Q&&1&e&&(Q=!0,i.lang=t[0],D((()=>Q=!1))),K.$set(i),t[2]?dt?(dt.p(t,e),4&e&&W(dt,1)):(dt=my(t),dt.c(),W(dt,1),dt.m(n,et)):dt&&(U(),G(dt,1,1,(()=>{dt=null})),H()),t[3]?vt?(vt.p(t,e),8&e&&W(vt,1)):(vt=gy(t),vt.c(),W(vt,1),vt.m(n,null)):vt&&(U(),G(vt,1,1,(()=>{vt=null})),H())},i(t){rt||(W(F.$$.fragment,t),W(ct),W(K.$$.fragment,t),W(dt),W(mt),W(vt),rt=!0)},o(t){G(F.$$.fragment,t),G(ct),G(K.$$.fragment,t),G(dt),G(mt),G(vt),rt=!1},d(t){t&&d(n),at&&at.d(),q(F),ct&&ct.d(),q(K),dt&&dt.d(),vt&&vt.d()}}}let yy=!1;function xy(t,e,n){let r,i,o,a,s,{lang:l}=e,c=!1,u=!1,h=!1,d=null;return T((async()=>{n(4,r=await ou("brazil")),n(5,i=await ou("lebanon")),n(6,o=await ou("ivory_coast")),n(7,d=au(r.examples.lexicon,i.examples.lexicon)),n(7,d=au(d,o.examples.lexicon)),n(1,c=!0);const[t,e,l]=await iu("brazil"),[p,f,m]=await async function(t){const e=[];e.push(nu(`${pt}assets/data/${t}/submissions.json`)),e.push(nu(`${pt}assets/data/${t}/dictionary.json`)),e.push(nu(`${pt}assets/data/${t}/categories.json`));const n=await Promise.all(e);return null!==n&&Array.isArray(n)&&0!==n.length?n:null}("brazil"),g={sources:t,posts_zipped:await async function(t){const e=await ru(`${pt}assets/data/${t}/posts.json.zip`,"eng","blob");return null===e?null:e}("brazil"),submissions:p,lexicon:e,events:l,categories:m,dictionary:f,OF_INTEREST:mt,MIN_NBR_OF_PUBLICATION_OF_INTEREST:3};var v=new Worker("assets/scripts/task_preproc.js",{type:"module"});v.addEventListener("message",(function(t){n(8,a=t.data),n(2,u=!0)}),!1),v.postMessage(g);const[y,x,b]=await iu("ivory_coast");n(9,s={sources:y,lexicon:x,events:b}),n(3,h=!0)})),t.$$set=t=>{"lang"in t&&n(0,l=t.lang)},[l,c,u,h,r,i,o,d,a,s,undefined,function(t){l=t,n(0,l)},function(t){l=t,n(0,l)},function(t){l=t,n(0,l)}]}class by extends Z{constructor(t){super(),Y(this,t,xy,vy,o,{lang:0})}}function wy(t){let e,n,r;function i(e){t[7](e)}let o={};return void 0!==t[0]&&(o.lang=t[0]),e=new Rt({props:o}),C.push((()=>V(e,"lang",i))),{c(){j(e.$$.fragment)},m(t,n){$(e,t,n),r=!0},p(t,r){const i={};!n&&1&r&&(n=!0,i.lang=t[0],D((()=>n=!1))),e.$set(i)},i(t){r||(W(e.$$.fragment,t),r=!0)},o(t){G(e.$$.fragment,t),r=!1},d(t){q(e,t)}}}function _y(t){let e,n,r,i,o,a,s,l,c,p,y,x,w,_,M,S,T,E=gt(t[0],"title")+"";function L(e){t[3](e)}let A={};function R(e){t[4](e)}function P(e){t[5](e)}void 0!==t[0]&&(A.lang=t[0]),i=new Ct({props:A}),C.push((()=>V(i,"lang",L))),s=new Yc({});let N={};function k(e){t[6](e)}void 0!==t[1]&&(N.scrollTop=t[1]),void 0!==t[0]&&(N.lang=t[0]),c=new Kc({props:N}),C.push((()=>V(c,"scrollTop",R))),C.push((()=>V(c,"lang",P)));let I={};void 0!==t[0]&&(I.lang=t[0]),w=new by({props:I}),C.push((()=>V(w,"lang",k)));let O=t[2]&&wy(t);return{c(){e=f("title"),n=m(E),r=g(),j(i.$$.fragment),a=g(),j(s.$$.fragment),l=g(),j(c.$$.fragment),x=g(),j(w.$$.fragment),M=g(),O&&O.c(),S=v()},m(t,o){h(t,e,o),u(e,n),h(t,r,o),$(i,t,o),h(t,a,o),$(s,t,o),h(t,l,o),$(c,t,o),h(t,x,o),$(w,t,o),h(t,M,o),O&&O.m(t,o),h(t,S,o),T=!0},p(t,[e]){(!T||1&e)&&E!==(E=gt(t[0],"title")+"")&&b(n,E);const r={};!o&&1&e&&(o=!0,r.lang=t[0],D((()=>o=!1))),i.$set(r);const a={};!p&&2&e&&(p=!0,a.scrollTop=t[1],D((()=>p=!1))),!y&&1&e&&(y=!0,a.lang=t[0],D((()=>y=!1))),c.$set(a);const s={};!_&&1&e&&(_=!0,s.lang=t[0],D((()=>_=!1))),w.$set(s),t[2]?O?(O.p(t,e),4&e&&W(O,1)):(O=wy(t),O.c(),W(O,1),O.m(S.parentNode,S)):O&&(U(),G(O,1,1,(()=>{O=null})),H())},i(t){T||(W(i.$$.fragment,t),W(s.$$.fragment,t),W(c.$$.fragment,t),W(w.$$.fragment,t),W(O),T=!0)},o(t){G(i.$$.fragment,t),G(s.$$.fragment,t),G(c.$$.fragment,t),G(w.$$.fragment,t),G(O),T=!1},d(t){t&&d(e),t&&d(r),q(i,t),t&&d(a),q(s,t),t&&d(l),q(c,t),t&&d(x),q(w,t),t&&d(M),O&&O.d(t),t&&d(S)}}}function My(t,e,n){const r=function(){const t={};let e=window.location.href.split("?");return 2!==e.length||(e=e[1],e=e.split("&"),e.forEach((e=>{if(!e.includes("="))return;const n=e.split("=");2===n.length&&(t[n[0]]=n[1])}))),t}();let{lang:i}=r;i=i||"eng";let o=0,a=0,s=!1;return T((()=>{a=window.innerHeight,setTimeout((()=>{const t=document.querySelector("main");t.addEventListener("scroll",(function(e){n(1,o=t.scrollTop),n(2,s=o>.1*a)}))}),200)})),[i,o,s,function(t){i=t,n(0,i)},function(t){o=t,n(1,o)},function(t){i=t,n(0,i)},function(t){i=t,n(0,i)},function(t){i=t,n(0,i)}]}return new class extends Z{constructor(t){super(),Y(this,t,My,_y,o,{})}}({target:document.body})}();
//# sourceMappingURL=bundle.js.map