// https://root.cern/js/ v7.2.99 !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).JSROOT=t.JSROOT||{})}(this,(function(t){"use strict";let e="dev",i="28/09/2022",n="dev 28/09/2022";t.source_dir="";let r=!!("object"==typeof process&&process.version&&"object"==typeof process.versions&&process.versions.node&&process.versions.v8),s={id_counter:1};const a="undefined"==typeof document&&"undefined"==typeof location?void 0:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("jsroot.js",document.baseURI).href;if(a&&"string"==typeof a){const e=a.indexOf("modules/core.mjs");e>=0?(t.source_dir=a.slice(0,e),console.log(`Set jsroot source_dir to ${t.source_dir}, ${n}`)):(console.log(`jsroot bundle, ${n}`),s.ignore_v6=!0)}let o=r;function l(){return o}function h(t){o=!!t}function c(){return r}const d=c()?t=>Buffer.from(t,"base64").toString("latin1"):globalThis?.atob,u=c()?t=>Buffer.from(t,"latin1").toString("base64"):globalThis?.btoa;let f={isFirefox:!0,isSafari:!1,isChrome:!1,isWin:!1,touches:!1};function m(t){if(t.length<14||0!=t.indexOf("[object "))return 0;let e=t.indexOf("Array]");return e<0||e!=t.length-6?0:14==t.length?1:2}"undefined"!=typeof document&&"undefined"!=typeof window&&(f.isFirefox=navigator.userAgent.indexOf("Firefox")>=0||"undefined"!=typeof InstallTrigger,f.isSafari=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0,f.isChrome=!!window.chrome,f.isChromeHeadless=navigator.userAgent.indexOf("HeadlessChrome")>=0,f.chromeVersion=f.isChrome||f.isChromeHeadless?parseInt(navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/)[1]):0,f.isWin=navigator.platform.indexOf("Win")>=0,f.touches="ontouchend"in document);let p={Render3D:{Default:0,WebGL:1,WebGLImage:2,SVG:3,fromString(t){return"webgl"===t||"gl"==t?this.WebGL:"img"===t?this.WebGLImage:"svg"===t?this.SVG:this.Default}},Embed3D:{NoEmbed:-1,Default:0,Overlay:1,Embed:2,EmbedSVG:3,fromString(t){return"embed"===t?this.Embed:"overlay"===t?this.Overlay:this.Default}},Latex:{Off:0,Symbols:1,Normal:2,MathJax:3,AlwaysMathJax:4,fromString(t){if(!t||"string"!=typeof t)return this.Normal;switch(t){case"off":return this.Off;case"symbols":return this.Symbols;case"normal":case"latex":case"exp":case"experimental":return this.Normal;case"MathJax":case"mathjax":case"math":return this.MathJax;case"AlwaysMathJax":case"alwaysmath":case"alwaysmathjax":return this.AlwaysMathJax}let e=parseInt(t);return Number.isInteger(e)&&e>=this.Off&&e<=this.AlwaysMathJax?e:this.Normal}}},g={Render3D:p.Render3D.Default,Render3DBatch:p.Render3D.Default,Embed3D:p.Embed3D.Default,Tooltip:!0,TooltipAnimation:500,ContextMenu:!0,Zooming:!0,ZoomMouse:!0,ZoomWheel:!0,ZoomTouch:!0,MoveResize:!0,HandleKeys:!0,DragAndDrop:!0,DragGraphs:!0,ProgressBox:!0,ToolBar:"popup",ToolBarSide:"left",ToolBarVert:!1,CanEnlarge:!0,CanAdjustFrame:!1,ApproxTextSize:!1,OptimizeDraw:1,AutoStat:!0,FrameNDC:{fX1NDC:.07,fY1NDC:.12,fX2NDC:.95,fY2NDC:.88},SmallPad:{width:150,height:100},Palette:57,Latex:p.Latex.Normal,GeoGradPerSegm:6,GeoCompressComp:!0,IgnoreUrlOptions:!1,HierarchyLimit:250,XValuesFormat:void 0,YValuesFormat:void 0,ZValuesFormat:void 0,HandleWrongHttpResponse:!1,UseStamp:!0,MaxRanges:200,SkipStreamerInfos:!1,OnlyLastCycle:!1,DarkMode:!1};r&&Object.assign(g,{ToolBar:!1,Tooltip:0,ContextMenu:!1,Zooming:!1,MoveResize:!1,DragAndDrop:!1,ProgressBox:!1});let _={fName:"Modern",fOptLogx:0,fOptLogy:0,fOptLogz:0,fOptDate:0,fOptFile:0,fDateX:.01,fDateY:.01,fOptTitle:1,fCanvasColor:0,fPadColor:0,fPadBottomMargin:.1,fPadTopMargin:.1,fPadLeftMargin:.1,fPadRightMargin:.1,fPadGridX:!1,fPadGridY:!1,fPadTickX:0,fPadTickY:0,fStatColor:0,fStatStyle:1e3,fStatTextColor:1,fStatFontSize:0,fStatFont:42,fStatBorderSize:1,fStatFormat:"6.4g",fStatX:.98,fStatY:.935,fStatW:.2,fStatH:.16,fTitleAlign:23,fTitleColor:0,fTitleTextColor:1,fTitleBorderSize:0,fTitleFont:42,fTitleFontSize:.05,fTitleStyle:0,fTitleX:.5,fTitleY:.995,fTitleW:0,fTitleH:0,fFitFormat:"5.4g",fOptStat:1111,fOptFit:0,fNumberContours:20,fGridColor:0,fGridStyle:3,fGridWidth:1,fFrameFillColor:0,fFrameFillStyle:1001,fFrameLineColor:1,fFrameLineWidth:1,fFrameLineStyle:1,fFrameBorderSize:1,fFrameBorderMode:0,fEndErrorSize:2,fErrorX:.5,fHistMinimumZero:!1,fHistTopMargin:.05,fHistFillColor:0,fHistFillStyle:1001,fHistLineColor:602,fHistLineStyle:1,fHistLineWidth:1,fPaintTextFormat:"g",fTimeOffset:788918400,fLegendBorderSize:1,fLegendFont:42,fLegendTextSize:0,fLegendFillColor:0,fHatchesLineWidth:1,fHatchesSpacing:1};function x(){return r?s.nodejs_document:"undefined"!=typeof document?document:"object"==typeof window?window.document:void 0}async function y(t){if(r){let e,i;return Promise.resolve().then((function(){return HM})).then((t=>(e=t.tmpNameSync()+".js",Promise.resolve().then((function(){return HM}))))).then((n=>(i=n,i.writeFileSync(e,t),import("file://"+e)))).finally((()=>i.unlinkSync(e)))}if("undefined"!=typeof document){let e=document.getElementsByTagName("script");for(let i=0;i=0?X():Promise.resolve(!0)).then((()=>new Promise((e=>{let i=document.createElement("script");i.setAttribute("type","text/javascript"),i.innerHTML=t,document.head.appendChild(i),setTimeout((()=>e(!0)),10)}))))}return!1}async function A(e){if(!e)return!0;if("string"==typeof e&&e.indexOf(";")>=0&&(e=e.split(";")),"string"!=typeof e){let t=e,i=()=>!t.length||A(t.shift()).then(i,i);return i()}0===e.indexOf("$$$")&&(0==(e=e.slice(3)).indexOf("style/")&&e.indexOf(".css")<0&&(e+=".css"),e=t.source_dir+e);let i,n=e.indexOf(".css")>0;if(r)return n?null:0==e.indexOf("http:")||0==e.indexOf("https:")?D(e,"text").then((t=>y(t))):import(e);const s=t=>{if(t==e)return!0;let i=t.indexOf(e);return i>0&&i+e.length==t.length&&"/"==t[i-1]};if(n){let t=document.getElementsByTagName("link");for(let e=0;e{i.onload=()=>t(!0),i.onerror=()=>{i.remove(),n(Error(`Fail to load ${e}`))},document.head.appendChild(i)}))}function v(t){return 1<=0)return e.clones[i]}else e={obj:[],clones:[],nofunc:i};let n=m(Object.prototype.toString.apply(t));if(1==n){let i=[];e.obj.push(t),e.clones.push(i);for(let n=0;n{if(null==t)return;if("string"==typeof t){if(e||t.length<6||0!==t.indexOf("$ref:"))return;let i=parseInt(t.slice(5));if(!Number.isInteger(i)||i<0||i>=n.length)return;return e=!1,n[i]}if("object"!=typeof t)return;if(m(Object.prototype.toString.apply(t))>0){for(let e=0;e=n.length)return;return e=!0,n[i]}if(!1!==e&&s>1&&"$arr"===i[0]&&"len"===i[1]){let e;switch(t.$arr){case"Int8":e=new Int8Array(t.len);break;case"Uint8":e=new Uint8Array(t.len);break;case"Int16":e=new Int16Array(t.len);break;case"Uint16":e=new Uint16Array(t.len);break;case"Int32":e=new Int32Array(t.len);break;case"Uint32":e=new Uint32Array(t.len);break;case"Float32":e=new Float32Array(t.len);break;case"Int64":case"Uint64":case"Float64":e=new Float64Array(t.len);break;default:e=new Array(t.len)}if(e.fill("Bool"!==t.$arr&&0),void 0!==t.b){let i=d(t.b);if(!e.buffer)throw new Error("base64 coding supported only for native arrays with binary data");{let n=new DataView(e.buffer,t.o||0),r=Math.min(i.length,n.byteLength);for(let t=0;t=0)){n.push(t),t._typename&&M(t);for(let e=0;e{if("function"==typeof t)return;if(null==t||"object"!=typeof t)return t;if(m(Object.prototype.toString.apply(t))>0){let e=new Array(t.length);for(let i=0;i=0)return{$ref:e};let r=Object.keys(t),s=r.length,a={};if(3==s&&"$pair"===r[0]&&"first"===r[1]&&"second"===r[2])return a.$pair=t.$pair,a.first=n(t.first),a.second=n(t.second),a;i.push(t);for(let e=0;e0;){let i=0,n=0,r=-1,s=-1;for(;i=0&&(n=(n+1)%2),s<0&&(s=i);break;case'"':n<=0&&(n=(n-1)%2),s<0&&(s=i);break;case"=":s<0&&r<0&&(r=i)}i++}if(r<0&&s<0&&(e.opts[t.slice(0,i)]=""),r>0){let n=t.slice(r+1,i);"'"!==n[0]&&'"'!==n[0]||n[0]!==n[n.length-1]||(n=n.slice(1,n.length-1)),e.opts[t.slice(0,r)]=n}if(i>=t.length||"#"==t[i])break;t=t.slice(i+1)}return e}function P(t){if("function"==typeof t)return t;if("string"!=typeof t)return null;let e=t.split("."),i=globalThis;for(let t=0;i&&t0&&(i=i.slice(0,l),o=!1),i){case"head":a="HEAD";break;case"posttext":a="POST",i="text";break;case"postbuf":a="POST",i="buf";break;case"post":case"multi":a="POST"}return t.kind=i,g.HandleWrongHttpResponse&&"GET"==a&&"function"==typeof t.addEventListener&&t.addEventListener("progress",function(t){t.lengthComputable&&this.expected_size&&t.loaded>this.expected_size&&(this.did_abort=!0,this.abort(),this.error_callback(Error(`Server sends more bytes ${t.loaded} than expected ${this.expected_size}. Abort I/O operation`),598))}.bind(t)),t.onreadystatechange=function(){if(!this.did_abort){if(2===this.readyState&&this.expected_size){let t=parseInt(this.getResponseHeader("Content-Length"));if(Number.isInteger(t)&&t>this.expected_size&&!g.HandleWrongHttpResponse)return this.did_abort=!0,this.abort(),this.error_callback(Error(`Server response size ${t} larger than expected ${this.expected_size}. Abort I/O operation`),599)}if(4==this.readyState){if(200!=this.status&&206!=this.status&&!f.qt5&&(0!=this.status||0!=e.indexOf("file://")&&0!=e.indexOf("blob:")))return this.error_callback(Error(`Fail to load url ${e}`),this.status);if(this.nodejs_checkzip&&"gzip"==this.getResponseHeader("content-encoding"))return Promise.resolve().then((function(){return HM})).then((t=>{let e=t.unzipSync(Buffer.from(this.response)),i=JSON.parse(e);return this.http_callback(T(i))}));switch(this.kind){case"xml":return this.http_callback(this.responseXML);case"text":return this.http_callback(this.responseText);case"object":return this.http_callback(T(this.responseText));case"multi":return this.http_callback(S(this.responseText));case"head":return this.http_callback(this)}if(void 0===this.responseType)return this.http_callback(this.responseText);if("bin"==this.kind&&"byteLength"in this.response){let t="",e=new Uint8Array(this.response);for(let i=0;i0&&(t.nodejs_checkzip=!0,t.responseType="arraybuffer"),t}function z(t,e,i,n,r){if(c()){if(!r)throw Error("Not allowed to create http requests in node without promise");return Promise.resolve().then((function(){return HM})).then((r=>{let s=new r.default;return k(s,t,e,i,n),s}))}let s=new XMLHttpRequest;return k(s,t,e,i,n),r?Promise.resolve(s):s}async function D(t,e,i){return new Promise(((n,r)=>{z(t,e,n,r,!0).then((t=>t.send(i||null)))}))}function O(t,e){let i=e||{};switch(t){case"TObject":w(i,{fUniqueID:0,fBits:0});break;case"TNamed":w(i,{fUniqueID:0,fBits:0,fName:"",fTitle:""});break;case"TList":case"THashList":w(i,{name:t,arr:[],opt:[]});break;case"TAttAxis":w(i,{fNdivisions:510,fAxisColor:1,fLabelColor:1,fLabelFont:42,fLabelOffset:.005,fLabelSize:.035,fTickLength:.03,fTitleOffset:1,fTitleSize:.035,fTitleColor:1,fTitleFont:42});break;case"TAxis":O("TNamed",i),O("TAttAxis",i),w(i,{fNbins:1,fXmin:0,fXmax:1,fXbins:[],fFirst:0,fLast:0,fBits2:0,fTimeDisplay:!1,fTimeFormat:"",fLabels:null,fModLabs:null});break;case"TAttLine":w(i,{fLineColor:1,fLineStyle:1,fLineWidth:1});break;case"TAttFill":w(i,{fFillColor:0,fFillStyle:0});break;case"TAttMarker":w(i,{fMarkerColor:1,fMarkerStyle:1,fMarkerSize:1});break;case"TLine":O("TObject",i),O("TAttLine",i),w(i,{fX1:0,fX2:1,fY1:0,fY2:1});break;case"TBox":O("TObject",i),O("TAttLine",i),O("TAttFill",i),w(i,{fX1:0,fX2:1,fY1:0,fY2:1});break;case"TPave":O("TBox",i),w(i,{fX1NDC:0,fY1NDC:0,fX2NDC:1,fY2NDC:1,fBorderSize:0,fInit:1,fShadowColor:1,fCornerRadius:0,fOption:"brNDC",fName:"title"});break;case"TAttText":w(i,{fTextAngle:0,fTextSize:0,fTextAlign:22,fTextColor:1,fTextFont:42});break;case"TPaveText":O("TPave",i),O("TAttText",i),w(i,{fLabel:"",fLongest:27,fMargin:.05,fLines:O("TList")});break;case"TPaveStats":O("TPaveText",i),w(i,{fFillColor:_.fStatColor,fFillStyle:_.fStatStyle,fTextFont:_.fStatFont,fTextSize:_.fStatFontSize,fTextColor:_.fStatTextColor,fBorderSize:_.fStatBorderSize,fOptFit:0,fOptStat:0,fFitFormat:"",fStatFormat:"",fParent:null});break;case"TLegend":O("TPave",i),O("TAttText",i),w(i,{fColumnSeparation:0,fEntrySeparation:.1,fMargin:.25,fNColumns:1,fPrimitives:O("TList"),fBorderSize:_.fLegendBorderSize,fTextFont:_.fLegendFont,fTextSize:_.fLegendTextSize,fFillColor:_.fLegendFillColor});break;case"TLegendEntry":O("TObject",i),O("TAttText",i),O("TAttLine",i),O("TAttFill",i),O("TAttMarker",i),w(i,{fLabel:"",fObject:null,fOption:""});break;case"TText":O("TNamed",i),O("TAttText",i),w(i,{fLimitFactorSize:3,fOriginSize:.04});break;case"TLatex":O("TText",i),O("TAttLine",i),w(i,{fX:0,fY:0});break;case"TObjString":O("TObject",i),w(i,{fString:""});break;case"TH1":O("TNamed",i),O("TAttLine",i),O("TAttFill",i),O("TAttMarker",i),w(i,{fBits:8,fNcells:0,fXaxis:O("TAxis"),fYaxis:O("TAxis"),fZaxis:O("TAxis"),fFillColor:_.fHistFillColor,fFillStyle:_.fHistFillStyle,fLineColor:_.fHistLineColor,fLineStyle:_.fHistLineStyle,fLineWidth:_.fHistLineWidth,fBarOffset:0,fBarWidth:1e3,fEntries:0,fTsumw:0,fTsumw2:0,fTsumwx:0,fTsumwx2:0,fMaximum:-1111,fMinimum:-1111,fNormFactor:0,fContour:[],fSumw2:[],fOption:"",fFunctions:O("TList"),fBufferSize:0,fBuffer:[],fBinStatErrOpt:0,fStatOverflows:2});break;case"TH1I":case"TH1L64":case"TH1F":case"TH1D":case"TH1S":case"TH1C":O("TH1",i),i.fArray=[];break;case"TH2":O("TH1",i),w(i,{fScalefactor:1,fTsumwy:0,fTsumwy2:0,fTsumwxy:0});break;case"TH2I":case"TH2L64":case"TH2F":case"TH2D":case"TH2S":case"TH2C":O("TH2",i),i.fArray=[];break;case"TH3":O("TH1",i),w(i,{fTsumwy:0,fTsumwy2:0,fTsumwz:0,fTsumwz2:0,fTsumwxy:0,fTsumwxz:0,fTsumwyz:0});break;case"TH3I":case"TH3L64":case"TH3F":case"TH3D":case"TH3S":case"TH3C":O("TH3",i),i.fArray=[];break;case"THStack":O("TNamed",i),w(i,{fHists:O("TList"),fHistogram:null,fMaximum:-1111,fMinimum:-1111});break;case"TGraph":O("TNamed",i),O("TAttLine",i),O("TAttFill",i),O("TAttMarker",i),w(i,{fFunctions:O("TList"),fHistogram:null,fMaxSize:0,fMaximum:-1111,fMinimum:-1111,fNpoints:0,fX:[],fY:[]});break;case"TGraphAsymmErrors":O("TGraph",i),w(i,{fEXlow:[],fEXhigh:[],fEYlow:[],fEYhigh:[]});break;case"TMultiGraph":O("TNamed",i),w(i,{fFunctions:O("TList"),fGraphs:O("TList"),fHistogram:null,fMaximum:-1111,fMinimum:-1111});break;case"TGraphPolargram":O("TNamed",i),O("TAttText",i),O("TAttLine",i),w(i,{fRadian:!0,fDegree:!1,fGrad:!1,fPolarLabelColor:1,fRadialLabelColor:1,fAxisAngle:0,fPolarOffset:.04,fPolarTextSize:.04,fRadialOffset:.025,fRadialTextSize:.035,fRwrmin:0,fRwrmax:1,fRwtmin:0,fRwtmax:2*Math.PI,fTickpolarSize:.02,fPolarLabelFont:62,fRadialLabelFont:62,fCutRadial:0,fNdivRad:508,fNdivPol:508});break;case"TPolyLine":O("TObject",i),O("TAttLine",i),O("TAttFill",i),w(i,{fLastPoint:-1,fN:0,fOption:"",fX:null,fY:null});break;case"TGaxis":O("TLine",i),O("TAttText",i),w(i,{fChopt:"",fFunctionName:"",fGridLength:0,fLabelColor:1,fLabelFont:42,fLabelOffset:.005,fLabelSize:.035,fName:"",fNdiv:12,fTickSize:.02,fTimeFormat:"",fTitle:"",fTitleOffset:1,fTitleSize:.035,fWmax:100,fWmin:0});break;case"TAttPad":w(i,{fLeftMargin:_.fPadLeftMargin,fRightMargin:_.fPadRightMargin,fBottomMargin:_.fPadBottomMargin,fTopMargin:_.fPadTopMargin,fXfile:2,fYfile:2,fAfile:1,fXstat:.99,fYstat:.99,fAstat:2,fFrameFillColor:_.fFrameFillColor,fFrameFillStyle:_.fFrameFillStyle,fFrameLineColor:_.fFrameLineColor,fFrameLineWidth:_.fFrameLineWidth,fFrameLineStyle:_.fFrameLineStyle,fFrameBorderSize:_.fFrameBorderSize,fFrameBorderMode:_.fFrameBorderMode});break;case"TPad":O("TObject",i),O("TAttLine",i),O("TAttFill",i),O("TAttPad",i),w(i,{fFillColor:_.fPadColor,fFillStyle:1001,fX1:0,fY1:0,fX2:1,fY2:1,fXtoAbsPixelk:1,fXtoPixelk:1,fXtoPixel:1,fYtoAbsPixelk:1,fYtoPixelk:1,fYtoPixel:1,fUtoAbsPixelk:1,fUtoPixelk:1,fUtoPixel:1,fVtoAbsPixelk:1,fVtoPixelk:1,fVtoPixel:1,fAbsPixeltoXk:1,fPixeltoXk:1,fPixeltoX:1,fAbsPixeltoYk:1,fPixeltoYk:1,fPixeltoY:1,fXlowNDC:0,fYlowNDC:0,fXUpNDC:0,fYUpNDC:0,fWNDC:1,fHNDC:1,fAbsXlowNDC:0,fAbsYlowNDC:0,fAbsWNDC:1,fAbsHNDC:1,fUxmin:0,fUymin:0,fUxmax:0,fUymax:0,fTheta:30,fPhi:30,fAspectRatio:0,fNumber:0,fLogx:_.fOptLogx,fLogy:_.fOptLogy,fLogz:_.fOptLogz,fTickx:_.fPadTickX,fTicky:_.fPadTickY,fPadPaint:0,fCrosshair:0,fCrosshairPos:0,fBorderSize:2,fBorderMode:0,fModified:!1,fGridx:_.fPadGridX,fGridy:_.fPadGridY,fAbsCoord:!1,fEditable:!0,fFixedAspectRatio:!1,fPrimitives:O("TList"),fExecs:null,fName:"pad",fTitle:"canvas"});break;case"TAttCanvas":w(i,{fXBetween:2,fYBetween:2,fTitleFromTop:1.2,fXdate:.2,fYdate:.3,fAdate:1});break;case"TCanvas":O("TPad",i),w(i,{fFillColor:_.fCanvasColor,fFillStyle:1001,fNumPaletteColor:0,fNextPaletteColor:0,fDISPLAY:"$DISPLAY",fDoubleBuffer:0,fRetained:!0,fXsizeUser:0,fYsizeUser:0,fXsizeReal:20,fYsizeReal:10,fWindowTopX:0,fWindowTopY:0,fWindowWidth:0,fWindowHeight:0,fCw:500,fCh:300,fCatt:O("TAttCanvas"),kMoveOpaque:!0,kResizeOpaque:!0,fHighLightColor:5,fBatch:!0,kShowEventStatus:!1,kAutoExec:!0,kMenuBar:!0});break;case"TGeoVolume":O("TNamed",i),O("TAttLine",i),O("TAttFill",i),w(i,{fGeoAtt:0,fFinder:null,fMedium:null,fNodes:null,fNtotal:0,fNumber:0,fRefCount:0,fShape:null,fVoxels:null});break;case"TGeoNode":O("TNamed",i),w(i,{fGeoAtt:0,fMother:null,fNovlp:0,fNumber:0,fOverlaps:null,fVolume:null});break;case"TGeoNodeMatrix":O("TGeoNode",i),w(i,{fMatrix:null});break;case"TGeoTrack":O("TObject",i),O("TAttLine",i),O("TAttMarker",i),w(i,{fGeoAtt:0,fNpoints:0,fPoints:[]})}return i._typename=t,M(i,t),i}function L(t,e,i,n){let r=O(t);if(!r.fXaxis||!r.fYaxis||!r.fZaxis)return null;switch(r.fName="hist",r.fTitle="title",e&&w(r.fXaxis,{fNbins:e,fXmin:0,fXmax:e}),i&&w(r.fYaxis,{fNbins:i,fXmin:0,fXmax:i}),n&&w(r.fZaxis,{fNbins:n,fXmin:0,fXmax:n}),parseInt(t[2])){case 1:e&&(r.fNcells=e+2);break;case 2:e&&i&&(r.fNcells=(e+2)*(i+2));break;case 3:e&&i&&n&&(r.fNcells=(e+2)*(i+2)*(n+2))}if(r.fNcells>0){switch(t[3]){case"C":r.fArray=new Int8Array(r.fNcells);break;case"S":r.fArray=new Int16Array(r.fNcells);break;case"I":r.fArray=new Int32Array(r.fNcells);break;case"F":r.fArray=new Float32Array(r.fNcells);break;case"L":case"D":r.fArray=new Float64Array(r.fNcells);break;default:r.fArray=new Array(r.fNcells)}r.fArray.fill(0)}return r}function R(t,e){let i=O("TPolyLine");return t&&(i.fN=t,e?(i.fX=new Int32Array(t),i.fY=new Int32Array(t)):(i.fX=new Float32Array(t),i.fY=new Float32Array(t))),i}function B(t,e,i){let n=w(O("TGraph"),{fBits:1032,fName:"graph",fTitle:"title"});if(t>0){n.fMaxSize=n.fNpoints=t;const r="object"==typeof e&&e.length===t,s="object"==typeof i&&i.length===t;for(let a=0;a=e||s[n]=e)&&r[i]+(e-s[i])/(s[n]-s[i])*(r[n]-r[i])=this.fNcells&&(t=this.fNcells-1),t<0&&(t=0),t=0&&ti.fNbins+1&&(n=i.fNbins+1),this.fArray[n]+=void 0===e?1:e,this.fEntries++}),0==t.indexOf("TH2")&&(i.getBin=function(t,e){return t+(this.fXaxis.fNbins+2)*e},i.getBinContent=function(t,e){return this.fArray[this.getBin(t,e)]},i.Fill=function(t,e,i){let n=this.fXaxis,r=this.fYaxis,s=1+Math.floor((t-n.fXmin)/(n.fXmax-n.fXmin)*n.fNbins),a=1+Math.floor((e-r.fXmin)/(r.fXmax-r.fXmin)*r.fNbins);s<0?s=0:s>n.fNbins+1&&(s=n.fNbins+1),a<0?a=0:a>r.fNbins+1&&(a=r.fNbins+1),this.fArray[s+(n.fNbins+2)*a]+=void 0===i?1:i,this.fEntries++}),0==t.indexOf("TH3")&&(i.getBin=function(t,e,i){return t+(this.fXaxis.fNbins+2)*(e+(this.fYaxis.fNbins+2)*i)},i.getBinContent=function(t,e,i){return this.fArray[this.getBin(t,e,i)]},i.Fill=function(t,e,i,n){let r=this.fXaxis,s=this.fYaxis,a=this.fZaxis,o=1+Math.floor((t-r.fXmin)/(r.fXmax-r.fXmin)*r.fNbins),l=1+Math.floor((e-s.fXmin)/(s.fXmax-s.fXmin)*s.fNbins),h=1+Math.floor((i-a.fXmin)/(a.fXmax-a.fXmin)*a.fNbins);o<0?o=0:o>r.fNbins+1&&(o=r.fNbins+1),l<0?l=0:l>s.fNbins+1&&(l=s.fNbins+1),h<0?h=0:h>a.fNbins+1&&(h=a.fNbins+1),this.fArray[o+(r.fNbins+2)*(l+(s.fNbins+2)*h)]+=void 0===n?1:n,this.fEntries++}),0==t.indexOf("TProfile")&&(0==t.indexOf("TProfile2D")?(i.getBin=function(t,e){return t+(this.fXaxis.fNbins+2)*e},i.getBinContent=function(t,e){let i=this.getBin(t,e);return i<0||i>=this.fNcells||this.fBinEntries[i]<1e-300?0:this.fArray?this.fArray[i]/this.fBinEntries[i]:0},i.getBinEntries=function(t,e){let i=this.getBin(t,e);return i<0||i>=this.fNcells?0:this.fBinEntries[i]}):(i.getBin=function(t){return t},i.getBinContent=function(t){return t<0||t>=this.fNcells||this.fBinEntries[t]<1e-300?0:this.fArray?this.fArray[t]/this.fBinEntries[t]:0}),i.getBinEffectiveEntries=function(t){if(t<0||t>=this.fNcells)return 0;let e=this.fBinEntries[t];if(!this.fBinSumw2||this.fBinSumw2.length!=this.fNcells)return e;let i=this.fBinSumw2[t];return i>0?e*e/i:0},i.getBinError=function(t){if(t<0||t>=this.fNcells)return 0;let e=this.fArray[t],i=this.fBinEntries[t],n=this.fSumw2[t],r=this.getBinEffectiveEntries(t);if(i<1e-300)return 0;const s=1,a=2,o=3;if(this.fErrorMode===o)return 1/Math.sqrt(i);let l=e/i,h=Math.sqrt(Math.abs(n/i-l**2));return this.fErrorMode===a?0!=h?h/Math.sqrt(r):1/Math.sqrt(12*r):this.fErrorMode===s?h:h/Math.sqrt(r)}),"TAxis"==t&&(i.GetBinLowEdge=function(t){return this.fNbins<=0?0:this.fXbins.length>0&&t>0&&t<=this.fNbins?this.fXbins[t-1]:this.fXmin+(t-1)*(this.fXmax-this.fXmin)/this.fNbins},i.GetBinCenter=function(t){return this.fNbins<=0?0:this.fXbins.length>0&&t>0&&t=0?Math.sqrt(this.M2()):-Math.sqrt(-this.M2())},i.Perp2=i.Pt2=function(){return this.fX**2+this.fY**2},i.Pt=i.pt=function(){return Math.sqrt(this.P2())},i.Phi=i.phi=function(){return Math.atan2(this.fY,this.fX)},i.Eta=i.eta=function(){return Math.atanh(this.Pz/this.P())}),I[t]=i),i}function U(t,e){I[t]=e}function G(t,e){if(t&&"object"==typeof t){if("TList"===t.$kind||"TObjArray"===t.$kind)return!0;e||(e=t._typename)}return!!e&&("TList"===e||"THashList"===e||"TMap"===e||"TObjArray"===e||"TClonesArray"===e)}function H(t){return t&&"object"==typeof t&&"function"==typeof t.then}function X(){return(globalThis.JSROOT?Promise.resolve(!0):A(t.source_dir+"scripts/JSRoot.core.js")).then((()=>{if(globalThis.JSROOT?._complete_loading)return globalThis.JSROOT._complete_loading()})).then((()=>globalThis.JSROOT))}var $=Object.freeze({__proto__:null,version_id:e,version_date:i,version:n,get source_dir(){return t.source_dir},isNodeJs:c,isBatchMode:l,setBatchMode:h,browser:f,internals:s,constants:p,settings:g,gStyle:_,atob_func:d,btoa_func:u,isArrayProto:m,getDocument:x,BIT:v,clone:b,addMethods:M,parse:T,parseMulti:S,toJSON:C,decodeUrl:E,findFunction:P,createHttpRequest:z,httpRequest:D,loadScript:A,injectCode:y,create:O,createHistogram:L,createTPolyLine:R,createTGraph:B,createTHStack:F,createTMultiGraph:N,getMethods:q,registerMethods:U,isRootCollection:G,isPromise:H,_ensureJSROOT:X});function V(t,e,i){t.prototype=e.prototype=i,i.constructor=t}function Y(t,e){var i=Object.create(t.prototype);for(var n in e)i[n]=e[n];return i}function W(){}var Z=.7,Q=1/Z,J="\\s*([+-]?\\d+)\\s*",K="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",tt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",et=/^#([0-9a-f]{3,8})$/,it=new RegExp(`^rgb\\(${J},${J},${J}\\)$`),nt=new RegExp(`^rgb\\(${tt},${tt},${tt}\\)$`),rt=new RegExp(`^rgba\\(${J},${J},${J},${K}\\)$`),st=new RegExp(`^rgba\\(${tt},${tt},${tt},${K}\\)$`),at=new RegExp(`^hsl\\(${K},${tt},${tt}\\)$`),ot=new RegExp(`^hsla\\(${K},${tt},${tt},${K}\\)$`),lt={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 ht(){return this.rgb().formatHex()}function ct(){return this.rgb().formatRgb()}function dt(t){var e,i;return t=(t+"").trim().toLowerCase(),(e=et.exec(t))?(i=e[1].length,e=parseInt(e[1],16),6===i?ut(e):3===i?new gt(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===i?ft(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===i?ft(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=it.exec(t))?new gt(e[1],e[2],e[3],1):(e=nt.exec(t))?new gt(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=rt.exec(t))?ft(e[1],e[2],e[3],e[4]):(e=st.exec(t))?ft(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=at.exec(t))?bt(e[1],e[2]/100,e[3]/100,1):(e=ot.exec(t))?bt(e[1],e[2]/100,e[3]/100,e[4]):lt.hasOwnProperty(t)?ut(lt[t]):"transparent"===t?new gt(NaN,NaN,NaN,0):null}function ut(t){return new gt(t>>16&255,t>>8&255,255&t,1)}function ft(t,e,i,n){return n<=0&&(t=e=i=NaN),new gt(t,e,i,n)}function mt(t){return t instanceof W||(t=dt(t)),t?new gt((t=t.rgb()).r,t.g,t.b,t.opacity):new gt}function pt(t,e,i,n){return 1===arguments.length?mt(t):new gt(t,e,i,null==n?1:n)}function gt(t,e,i,n){this.r=+t,this.g=+e,this.b=+i,this.opacity=+n}function _t(){return`#${vt(this.r)}${vt(this.g)}${vt(this.b)}`}function xt(){const t=yt(this.opacity);return`${1===t?"rgb(":"rgba("}${At(this.r)}, ${At(this.g)}, ${At(this.b)}${1===t?")":`, ${t})`}`}function yt(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function At(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function vt(t){return((t=At(t))<16?"0":"")+t.toString(16)}function bt(t,e,i,n){return n<=0?t=e=i=NaN:i<=0||i>=1?t=e=NaN:e<=0&&(t=NaN),new Mt(t,e,i,n)}function wt(t){if(t instanceof Mt)return new Mt(t.h,t.s,t.l,t.opacity);if(t instanceof W||(t=dt(t)),!t)return new Mt;if(t instanceof Mt)return t;var e=(t=t.rgb()).r/255,i=t.g/255,n=t.b/255,r=Math.min(e,i,n),s=Math.max(e,i,n),a=NaN,o=s-r,l=(s+r)/2;return o?(a=e===s?(i-n)/o+6*(i0&&l<1?0:a,new Mt(a,o,l,t.opacity)}function Mt(t,e,i,n){this.h=+t,this.s=+e,this.l=+i,this.opacity=+n}function Tt(t){return(t=(t||0)%360)<0?t+360:t}function St(t){return Math.max(0,Math.min(1,t||0))}function Ct(t,e,i){return 255*(t<60?e+(i-e)*t/60:t<180?i:t<240?e+(i-e)*(240-t)/60:e)}V(W,dt,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:ht,formatHex:ht,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return wt(this).formatHsl()},formatRgb:ct,toString:ct}),V(gt,pt,Y(W,{brighter(t){return t=null==t?Q:Math.pow(Q,t),new gt(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Z:Math.pow(Z,t),new gt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new gt(At(this.r),At(this.g),At(this.b),yt(this.opacity))},displayable(){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:_t,formatHex:_t,formatHex8:function(){return`#${vt(this.r)}${vt(this.g)}${vt(this.b)}${vt(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:xt,toString:xt})),V(Mt,(function(t,e,i,n){return 1===arguments.length?wt(t):new Mt(t,e,i,null==n?1:n)}),Y(W,{brighter(t){return t=null==t?Q:Math.pow(Q,t),new Mt(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Z:Math.pow(Z,t),new Mt(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,i=this.l,n=i+(i<.5?i:1-i)*e,r=2*i-n;return new gt(Ct(t>=240?t-240:t+120,r,n),Ct(t,r,n),Ct(t<120?t+240:t-120,r,n),this.opacity)},clamp(){return new Mt(Tt(this.h),St(this.s),St(this.l),yt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=yt(this.opacity);return`${1===t?"hsl(":"hsla("}${Tt(this.h)}, ${100*St(this.s)}%, ${100*St(this.l)}%${1===t?")":`, ${t})`}`}}));const Et=Math.PI/180,Pt=180/Math.PI,kt=.96422,zt=.82521,Dt=4/29,Ot=6/29,Lt=3*Ot*Ot;function Rt(t){if(t instanceof Bt)return new Bt(t.l,t.a,t.b,t.opacity);if(t instanceof Ut)return Gt(t);t instanceof gt||(t=mt(t));var e,i,n=jt(t.r),r=jt(t.g),s=jt(t.b),a=Ft((.2225045*n+.7168786*r+.0606169*s)/1);return n===r&&r===s?e=i=a:(e=Ft((.4360747*n+.3850649*r+.1430804*s)/kt),i=Ft((.0139322*n+.0971045*r+.7141733*s)/zt)),new Bt(116*a-16,500*(e-a),200*(a-i),t.opacity)}function Bt(t,e,i,n){this.l=+t,this.a=+e,this.b=+i,this.opacity=+n}function Ft(t){return t>.008856451679035631?Math.pow(t,1/3):t/Lt+Dt}function Nt(t){return t>Ot?t*t*t:Lt*(t-Dt)}function It(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function jt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function qt(t){if(t instanceof Ut)return new Ut(t.h,t.c,t.l,t.opacity);if(t instanceof Bt||(t=Rt(t)),0===t.a&&0===t.b)return new Ut(NaN,0t+i))}function he(t){return function(e,i){return t(e.source.value+e.target.value,i.source.value+i.target.value)}}function ce(){return function(t,e){var i=0,n=null,r=null,s=null;function a(a){var o,l=a.length,h=new Array(l),c=le(0,l),d=new Array(l*l),u=new Array(l),f=0;a=Float64Array.from({length:l*l},e?(t,e)=>a[e%l][e/l|0]:(t,e)=>a[e/l|0][e%l]);for(let e=0;en(h[t],h[e])));for(const i of c){const n=e;if(t){const t=le(1+~l,l).filter((t=>t<0?a[~t*l+i]:a[i*l+t]));r&&t.sort(((t,e)=>r(t<0?-a[~t*l+i]:a[i*l+t],e<0?-a[~e*l+i]:a[i*l+e])));for(const n of t)if(n<0){(d[~n*l+i]||(d[~n*l+i]={source:null,target:null})).target={index:i,startAngle:e,endAngle:e+=a[~n*l+i]*f,value:a[~n*l+i]}}else{(d[i*l+n]||(d[i*l+n]={source:null,target:null})).source={index:i,startAngle:e,endAngle:e+=a[i*l+n]*f,value:a[i*l+n]}}u[i]={index:i,startAngle:n,endAngle:e,value:h[i]}}else{const t=le(0,l).filter((t=>a[i*l+t]||a[t*l+i]));r&&t.sort(((t,e)=>r(a[i*l+t],a[i*l+e])));for(const n of t){let t;if(ife)if(Math.abs(c*o-l*h)>fe&&r){var u=i-s,f=n-a,m=o*o+l*l,p=u*u+f*f,g=Math.sqrt(m),_=Math.sqrt(d),x=r*Math.tan((de-Math.acos((m+d-p)/(2*g*_)))/2),y=x/_,A=x/g;Math.abs(y-1)>fe&&(this._+="L"+(t+y*h)+","+(e+y*c)),this._+="A"+r+","+r+",0,0,"+ +(c*u>h*f)+","+(this._x1=t+A*o)+","+(this._y1=e+A*l)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,i,n,r,s){t=+t,e=+e,s=!!s;var a=(i=+i)*Math.cos(n),o=i*Math.sin(n),l=t+a,h=e+o,c=1^s,d=s?n-r:r-n;if(i<0)throw new Error("negative radius: "+i);null===this._x1?this._+="M"+l+","+h:(Math.abs(this._x1-l)>fe||Math.abs(this._y1-h)>fe)&&(this._+="L"+l+","+h),i&&(d<0&&(d=d%ue+ue),d>me?this._+="A"+i+","+i+",0,1,"+c+","+(t-a)+","+(e-o)+"A"+i+","+i+",0,1,"+c+","+(this._x1=l)+","+(this._y1=h):d>fe&&(this._+="A"+i+","+i+",0,"+ +(d>=de)+","+c+","+(this._x1=t+i*Math.cos(r))+","+(this._y1=e+i*Math.sin(r))))},rect:function(t,e,i,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +i+"v"+ +n+"h"+-i+"Z"},toString:function(){return this._}};var _e=Array.prototype.slice;function xe(t){return function(){return t}}function ye(t){return t.source}function Ae(t){return t.target}function ve(t){return t.radius}function be(t){return t.startAngle}function we(t){return t.endAngle}function Me(){return 0}function Te(){return function(t){var e=ye,i=Ae,n=ve,r=ve,s=be,a=we,o=Me,l=null;function h(){var h,c=e.apply(this,arguments),d=i.apply(this,arguments),u=o.apply(this,arguments)/2,f=_e.call(arguments),m=+n.apply(this,(f[0]=c,f)),p=s.apply(this,f)-re,g=a.apply(this,f)-re,_=+r.apply(this,(f[0]=d,f)),x=s.apply(this,f)-re,y=a.apply(this,f)-re;if(l||(l=h=ge()),u>oe&&(te(g-p)>2*u+oe?g>p?(p+=u,g-=u):(p-=u,g+=u):p=g=(p+g)/2,te(y-x)>2*u+oe?y>x?(x+=u,y-=u):(x-=u,y+=u):x=y=(x+y)/2),l.moveTo(m*ee(p),m*ie(p)),l.arc(0,0,m,p,g),p!==x||g!==y)if(t){var A=_-+t.apply(this,arguments),v=(x+y)/2;l.quadraticCurveTo(0,0,A*ee(x),A*ie(x)),l.lineTo(_*ee(v),_*ie(v)),l.lineTo(A*ee(y),A*ie(y))}else l.quadraticCurveTo(0,0,_*ee(x),_*ie(x)),l.arc(0,0,_,x,y);if(l.quadraticCurveTo(0,0,m*ee(p),m*ie(p)),l.closePath(),h)return l=null,h+""||null}return t&&(h.headRadius=function(e){return arguments.length?(t="function"==typeof e?e:xe(+e),h):t}),h.radius=function(t){return arguments.length?(n=r="function"==typeof t?t:xe(+t),h):n},h.sourceRadius=function(t){return arguments.length?(n="function"==typeof t?t:xe(+t),h):n},h.targetRadius=function(t){return arguments.length?(r="function"==typeof t?t:xe(+t),h):r},h.startAngle=function(t){return arguments.length?(s="function"==typeof t?t:xe(+t),h):s},h.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:xe(+t),h):a},h.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:xe(+t),h):o},h.source=function(t){return arguments.length?(e=t,h):e},h.target=function(t){return arguments.length?(i=t,h):i},h.context=function(t){return arguments.length?(l=null==t?null:t,h):l},h}()}var Se={value:()=>{}};function Ce(){for(var t,e=0,i=arguments.length,n={};e=0&&(i=t.slice(n+1),t=t.slice(0,n)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:i}}))}function ke(t,e){for(var i,n=0,r=t.length;n0)for(var i,n,r=new Array(i),s=0;s=0&&"xmlns"!==(e=t.slice(0,i))&&(t=t.slice(i+1)),Oe.hasOwnProperty(e)?{space:Oe[e],local:t}:t}function Re(t){return function(){var e=this.ownerDocument,i=this.namespaceURI;return i===De&&e.documentElement.namespaceURI===De?e.createElement(t):e.createElementNS(i,t)}}function Be(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Fe(t){var e=Le(t);return(e.local?Be:Re)(e)}function Ne(){}function Ie(t){return null==t?Ne:function(){return this.querySelector(t)}}function je(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function qe(){return[]}function Ue(t){return null==t?qe:function(){return this.querySelectorAll(t)}}function Ge(t){return function(){return this.matches(t)}}function He(t){return function(e){return e.matches(t)}}var Xe=Array.prototype.find;function $e(){return this.firstElementChild}var Ve=Array.prototype.filter;function Ye(){return Array.from(this.children)}function We(t){return new Array(t.length)}function Ze(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function Qe(t){return function(){return t}}function Je(t,e,i,n,r,s){for(var a,o=0,l=e.length,h=s.length;oe?1:t>=e?0:NaN}function ni(t){return function(){this.removeAttribute(t)}}function ri(t){return function(){this.removeAttributeNS(t.space,t.local)}}function si(t,e){return function(){this.setAttribute(t,e)}}function ai(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function oi(t,e){return function(){var i=e.apply(this,arguments);null==i?this.removeAttribute(t):this.setAttribute(t,i)}}function li(t,e){return function(){var i=e.apply(this,arguments);null==i?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,i)}}function hi(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ci(t){return function(){this.style.removeProperty(t)}}function di(t,e,i){return function(){this.style.setProperty(t,e,i)}}function ui(t,e,i){return function(){var n=e.apply(this,arguments);null==n?this.style.removeProperty(t):this.style.setProperty(t,n,i)}}function fi(t,e){return t.style.getPropertyValue(e)||hi(t).getComputedStyle(t,null).getPropertyValue(e)}function mi(t){return function(){delete this[t]}}function pi(t,e){return function(){this[t]=e}}function gi(t,e){return function(){var i=e.apply(this,arguments);null==i?delete this[t]:this[t]=i}}function _i(t){return t.trim().split(/^|\s+/)}function xi(t){return t.classList||new yi(t)}function yi(t){this._node=t,this._names=_i(t.getAttribute("class")||"")}function Ai(t,e){for(var i=xi(t),n=-1,r=e.length;++n=0&&(e=t.slice(i+1),t=t.slice(0,i)),{type:t,name:e}}))}function Ni(t){return function(){var e=this.__on;if(e){for(var i,n=0,r=-1,s=e.length;n=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Gi=[null];function Hi(t,e){this._groups=t,this._parents=e}function Xi(){return new Hi([[document.documentElement]],Gi)}function $i(t){return"string"==typeof t?new Hi([[document.querySelector(t)]],[document.documentElement]):new Hi([[t]],Gi)}Hi.prototype=Xi.prototype={constructor:Hi,select:function(t){"function"!=typeof t&&(t=Ie(t));for(var e=this._groups,i=e.length,n=new Array(i),r=0;r=v&&(v=A+1);!(y=g[v])&&++v=0;)(n=r[s])&&(a&&4^n.compareDocumentPosition(a)&&a.parentNode.insertBefore(n,a),a=n);return this},sort:function(t){function e(e,i){return e&&i?t(e.__data__,i.__data__):!e-!i}t||(t=ii);for(var i=this._groups,n=i.length,r=new Array(n),s=0;s1?this.each((null==e?ci:"function"==typeof e?ui:di)(t,e,null==i?"":i)):fi(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?mi:"function"==typeof e?gi:pi)(t,e)):this.node()[t]},classed:function(t,e){var i=_i(t+"");if(arguments.length<2){for(var n=xi(this.node()),r=-1,s=i.length;++rZi(t,e)))}Yi.prototype={constructor:Yi,get:function(t){for(var e=this._;!(e in t);)if(!(t=t.parentNode))return;return t[e]},set:function(t,e){return t[this._]=e},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};const Ji={passive:!1},Ki={capture:!0,passive:!1};function tn(t){t.stopImmediatePropagation()}function en(t){t.preventDefault(),t.stopImmediatePropagation()}var nn=t=>()=>t;function rn(t,{sourceEvent:e,subject:i,target:n,identifier:r,active:s,x:a,y:o,dx:l,dy:h,dispatch:c}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:i,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:c}})}function sn(t){return!t.ctrlKey&&!t.button}function an(){return this.parentNode}function on(t,e){return null==e?{x:t.x,y:t.y}:e}function ln(){return navigator.maxTouchPoints||"ontouchstart"in this}function hn(){var t,e,i,n,r=sn,s=an,a=on,o=ln,l={},h=Ce("start","drag","end"),c=0,d=0;function u(t){t.on("mousedown.drag",f).filter(o).on("touchstart.drag",g).on("touchmove.drag",_,Ji).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(a,o){if(!n&&r.call(this,a,o)){var l=y(this,s.call(this,a,o),a,o,"mouse");l&&($i(a.view).on("mousemove.drag",m,Ki).on("mouseup.drag",p,Ki),function(t){var e=t.document.documentElement,i=$i(t).on("dragstart.drag",en,Ki);"onselectstart"in e?i.on("selectstart.drag",en,Ki):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(a.view),tn(a),i=!1,t=a.clientX,e=a.clientY,l("start",a))}}function m(n){if(en(n),!i){var r=n.clientX-t,s=n.clientY-e;i=r*r+s*s>d}l.mouse("drag",n)}function p(t){$i(t.view).on("mousemove.drag mouseup.drag",null),function(t,e){var i=t.document.documentElement,n=$i(t).on("dragstart.drag",null);e&&(n.on("click.drag",en,Ki),setTimeout((function(){n.on("click.drag",null)}),0)),"onselectstart"in i?n.on("selectstart.drag",null):(i.style.MozUserSelect=i.__noselect,delete i.__noselect)}(t.view,i),en(t),l.mouse("end",t)}function g(t,e){if(r.call(this,t,e)){var i,n,a=t.changedTouches,o=s.call(this,t,e),l=a.length;for(i=0;ie?1:t>=e?0:NaN}function dn(t,e){return null==t||null==e?NaN:et?1:e>=t?0:NaN}function un(t){let e,i,n;function r(t,n,r=0,s=t.length){if(r>>1;i(t[e],n)<0?r=e+1:s=e}while(rcn(t(e),i),n=(e,i)=>t(e)-i):(e=t===cn||t===dn?t:fn,i=t,n=t),{left:r,center:function(t,e,i=0,s=t.length){const a=r(t,e,i,s-1);return a>i&&n(t[a-1],e)>-n(t[a],e)?a-1:a},right:function(t,n,r=0,s=t.length){if(r>>1;i(t[e],n)<=0?r=e+1:s=e}while(r0)return[t];if((n=e0){let i=Math.round(t/a),n=Math.round(e/a);for(i*ae&&--n,s=new Array(r=n-i+1);++oe&&--n,s=new Array(r=n-i+1);++o=0?(s>=gn?10:s>=_n?5:s>=xn?2:1)*Math.pow(10,r):-Math.pow(10,-r)/(s>=gn?10:s>=_n?5:s>=xn?2:1)}function vn(t,e,i){var n=Math.abs(e-t)/Math.max(0,i),r=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),s=n/r;return s>=gn?r*=10:s>=_n?r*=5:s>=xn&&(r*=2),e()=>t;function Mn(t){return 1==(t=+t)?Tn:function(e,i){return i-e?function(t,e,i){return t=Math.pow(t,i),e=Math.pow(e,i)-t,i=1/i,function(n){return Math.pow(t+n*e,i)}}(e,i,t):wn(isNaN(e)?i:e)}}function Tn(t,e){var i=e-t;return i?function(t,e){return function(i){return t+i*e}}(t,i):wn(isNaN(t)?e:t)}var Sn=function t(e){var i=Mn(e);function n(t,e){var n=i((t=pt(t)).r,(e=pt(e)).r),r=i(t.g,e.g),s=i(t.b,e.b),a=Tn(t.opacity,e.opacity);return function(e){return t.r=n(e),t.g=r(e),t.b=s(e),t.opacity=a(e),t+""}}return n.gamma=t,n}(1);function Cn(t,e){e||(e=[]);var i,n=t?Math.min(e.length,t.length):0,r=e.slice();return function(s){for(i=0;is&&(r=e.slice(s,r),o[a]?o[a]+=r:o[++a]=r),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:kn(i,n)})),s=On.lastIndex;return s180?e+=360:e-t>180&&(t+=360),s.push({i:i.push(r(i)+"rotate(",null,n)-2,x:kn(t,e)})):e&&i.push(r(i)+"rotate("+e+n)}(s.rotate,a.rotate,o,l),function(t,e,i,s){t!==e?s.push({i:i.push(r(i)+"skewX(",null,n)-2,x:kn(t,e)}):e&&i.push(r(i)+"skewX("+e+n)}(s.skewX,a.skewX,o,l),function(t,e,i,n,s,a){if(t!==i||e!==n){var o=s.push(r(s)+"scale(",null,",",null,")");a.push({i:o-4,x:kn(t,i)},{i:o-2,x:kn(e,n)})}else 1===i&&1===n||s.push(r(s)+"scale("+i+","+n+")")}(s.scaleX,s.scaleY,a.scaleX,a.scaleY,o,l),s=a=null,function(t){for(var e,i=-1,n=l.length;++ie&&(i=t,t=e,e=i),h=function(i){return Math.max(t,Math.min(e,i))}),n=l>2?Wn:Yn,r=s=null,d}function d(e){return null==e||isNaN(e=+e)?i:(r||(r=n(a.map(t),o,l)))(t(h(e)))}return d.invert=function(i){return h(e((s||(s=n(o,a.map(t),kn)))(i)))},d.domain=function(t){return arguments.length?(a=Array.from(t,Hn),c()):a.slice()},d.range=function(t){return arguments.length?(o=Array.from(t),c()):o.slice()},d.rangeRound=function(t){return o=Array.from(t),l=Bn,c()},d.clamp=function(t){return arguments.length?(h=!!t||$n,c()):h!==$n},d.interpolate=function(t){return arguments.length?(l=t,c()):l},d.unknown=function(t){return arguments.length?(i=t,d):i},function(i,n){return t=i,e=n,c()}}function Jn(){return Qn()($n,$n)}function Kn(t,e){if((i=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var i,n=t.slice(0,i);return[n.length>1?n[0]+n.slice(2):n,+t.slice(i+1)]}function tr(t){return(t=Kn(Math.abs(t)))?t[1]:NaN}var er,ir=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function nr(t){if(!(e=ir.exec(t)))throw new Error("invalid format: "+t);var e;return new rr({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 rr(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 sr(t,e){var i=Kn(t,e);if(!i)return t+"";var n=i[0],r=i[1];return r<0?"0."+new Array(-r).join("0")+n:n.length>r+1?n.slice(0,r+1)+"."+n.slice(r+1):n+new Array(r-n.length+2).join("0")}nr.prototype=rr.prototype,rr.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 ar={"%":(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)=>sr(100*t,e),r:sr,s:function(t,e){var i=Kn(t,e);if(!i)return t+"";var n=i[0],r=i[1],s=r-(er=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,a=n.length;return s===a?n:s>a?n+new Array(s-a+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+Kn(t,Math.max(0,e+s-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function or(t){return t}var lr,hr,cr,dr=Array.prototype.map,ur=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function fr(t){var e,i,n=void 0===t.grouping||void 0===t.thousands?or:(e=dr.call(t.grouping,Number),i=t.thousands+"",function(t,n){for(var r=t.length,s=[],a=0,o=e[0],l=0;r>0&&o>0&&(l+o+1>n&&(o=Math.max(1,n-l)),s.push(t.substring(r-=o,r+o)),!((l+=o+1)>n));)o=e[a=(a+1)%e.length];return s.reverse().join(i)}),r=void 0===t.currency?"":t.currency[0]+"",s=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",o=void 0===t.numerals?or:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(dr.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",h=void 0===t.minus?"−":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function d(t){var e=(t=nr(t)).fill,i=t.align,d=t.sign,u=t.symbol,f=t.zero,m=t.width,p=t.comma,g=t.precision,_=t.trim,x=t.type;"n"===x?(p=!0,x="g"):ar[x]||(void 0===g&&(g=12),_=!0,x="g"),(f||"0"===e&&"="===i)&&(f=!0,e="0",i="=");var y="$"===u?r:"#"===u&&/[boxX]/.test(x)?"0"+x.toLowerCase():"",A="$"===u?s:/[%p]/.test(x)?l:"",v=ar[x],b=/[defgprs%]/.test(x);function w(t){var r,s,l,u=y,w=A;if("c"===x)w=v(t)+w,t="";else{var M=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:v(Math.abs(t),g),_&&(t=function(t){t:for(var e,i=t.length,n=1,r=-1;n0&&(r=0)}return r>0?t.slice(0,r)+t.slice(e+1):t}(t)),M&&0==+t&&"+"!==d&&(M=!1),u=(M?"("===d?d:h:"-"===d||"("===d?"":d)+u,w=("s"===x?ur[8+er/3]:"")+w+(M&&"("===d?")":""),b)for(r=-1,s=t.length;++r(l=t.charCodeAt(r))||l>57){w=(46===l?a+t.slice(r+1):t.slice(r))+w,t=t.slice(0,r);break}}p&&!f&&(t=n(t,1/0));var T=u.length+t.length+w.length,S=T>1)+u+t+w+S.slice(T);break;default:t=S+u+t+w}return o(t)}return g=void 0===g?6:/[gprs]/.test(x)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),w.toString=function(){return t+""},w}return{format:d,formatPrefix:function(t,e){var i=d(((t=nr(t)).type="f",t)),n=3*Math.max(-8,Math.min(8,Math.floor(tr(e)/3))),r=Math.pow(10,-n),s=ur[8+n/3];return function(t){return i(r*t)+s}}}}function mr(t,e,i,n){var r,s=vn(t,e,i);switch((n=nr(null==n?",f":n)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=n.precision||isNaN(r=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(tr(e)/3)))-tr(Math.abs(t)))}(s,a))||(n.precision=r),cr(n,a);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(r=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,tr(e)-tr(t))+1}(s,Math.max(Math.abs(t),Math.abs(e))))||(n.precision=r-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(r=function(t){return Math.max(0,-tr(Math.abs(t)))}(s))||(n.precision=r-2*("%"===n.type))}return hr(n)}function pr(t){var e=t.domain;return t.ticks=function(t){var i=e();return yn(i[0],i[i.length-1],null==t?10:t)},t.tickFormat=function(t,i){var n=e();return mr(n[0],n[n.length-1],null==t?10:t,i)},t.nice=function(i){null==i&&(i=10);var n,r,s=e(),a=0,o=s.length-1,l=s[a],h=s[o],c=10;for(h0;){if((r=An(l,h,i))===n)return s[a]=l,s[o]=h,e(s);if(r>0)l=Math.floor(l/r)*r,h=Math.ceil(h/r)*r;else{if(!(r<0))break;l=Math.ceil(l*r)/r,h=Math.floor(h*r)/r}n=r}return t},t}function gr(){var t=Jn();return t.copy=function(){return Zn(t,gr())},bn.apply(t,arguments),pr(t)}function _r(t,e){var i,n=0,r=(t=t.slice()).length-1,s=t[n],a=t[r];return a-t(-e,i)}function Mr(t){const e=t(xr,yr),i=e.domain;let n,r,s=10;function a(){return n=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}(s),r=function(t){return 10===t?br:t===Math.E?Math.exp:e=>Math.pow(t,e)}(s),i()[0]<0?(n=wr(n),r=wr(r),t(Ar,vr)):t(xr,yr),e}return e.base=function(t){return arguments.length?(s=+t,a()):s},e.domain=function(t){return arguments.length?(i(t),a()):i()},e.ticks=t=>{const e=i();let a=e[0],o=e[e.length-1];const l=o0){for(;d<=u;++d)for(h=1;ho)break;m.push(c)}}else for(;d<=u;++d)for(h=s-1;h>=1;--h)if(c=d>0?h/r(-d):h*r(d),!(co)break;m.push(c)}2*m.length{if(null==t&&(t=10),null==i&&(i=10===s?"s":","),"function"!=typeof i&&(s%1||null!=(i=nr(i)).precision||(i.trim=!0),i=hr(i)),t===1/0)return i;const a=Math.max(1,s*t/e.ticks().length);return t=>{let e=t/r(Math.round(n(t)));return e*si(_r(i(),{floor:t=>r(Math.floor(n(t))),ceil:t=>r(Math.ceil(n(t)))})),e}function Tr(){const t=Mr(Qn()).domain([1,10]);return t.copy=()=>Zn(t,Tr()).base(t.base()),bn.apply(t,arguments),t}function Sr(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function Cr(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function Er(t){var e=1,i=t(Sr(e),Cr(e));return i.constant=function(i){return arguments.length?t(Sr(e=+i),Cr(e)):e},pr(i)}function Pr(){var t=Er(Qn());return t.copy=function(){return Zn(t,Pr()).constant(t.constant())},bn.apply(t,arguments)}lr=fr({thousands:",",grouping:[3],currency:["$",""]}),hr=lr.format,cr=lr.formatPrefix;var kr=new Date,zr=new Date;function Dr(t,e,i,n){function r(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return r.floor=function(e){return t(e=new Date(+e)),e},r.ceil=function(i){return t(i=new Date(i-1)),e(i,1),t(i),i},r.round=function(t){var e=r(t),i=r.ceil(t);return t-e0))return o;do{o.push(a=new Date(+i)),e(i,s),t(i)}while(a=e)for(;t(e),!i(e);)e.setTime(e-1)}),(function(t,n){if(t>=t)if(n<0)for(;++n<=0;)for(;e(t,-1),!i(t););else for(;--n>=0;)for(;e(t,1),!i(t););}))},i&&(r.count=function(e,n){return kr.setTime(+e),zr.setTime(+n),t(kr),t(zr),Math.floor(i(kr,zr))},r.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?r.filter(n?function(e){return n(e)%t==0}:function(e){return r.count(0,e)%t==0}):r:null}),r}var Or=Dr((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));Or.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Dr((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,i){e.setTime(+e+i*t)}),(function(e,i){return(i-e)/t})):Or:null};var Lr=Or;Or.range;const Rr=1e3,Br=6e4,Fr=36e5,Nr=864e5,Ir=6048e5,jr=2592e6,qr=31536e6;var Ur=Dr((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+e*Rr)}),(function(t,e){return(e-t)/Rr}),(function(t){return t.getUTCSeconds()})),Gr=Ur;Ur.range;var Hr=Dr((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*Rr)}),(function(t,e){t.setTime(+t+e*Br)}),(function(t,e){return(e-t)/Br}),(function(t){return t.getMinutes()})),Xr=Hr;Hr.range;var $r=Dr((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*Rr-t.getMinutes()*Br)}),(function(t,e){t.setTime(+t+e*Fr)}),(function(t,e){return(e-t)/Fr}),(function(t){return t.getHours()})),Vr=$r;$r.range;var Yr=Dr((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Br)/Nr),(t=>t.getDate()-1)),Wr=Yr;function Zr(t){return Dr((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())*Br)/Ir}))}Yr.range;var Qr=Zr(0),Jr=Zr(1),Kr=Zr(2),ts=Zr(3),es=Zr(4),is=Zr(5),ns=Zr(6);Qr.range,Jr.range,Kr.range,ts.range,es.range,is.range,ns.range;var rs=Dr((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()})),ss=rs;rs.range;var as=Dr((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()}));as.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Dr((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,i){e.setFullYear(e.getFullYear()+i*t)})):null};var os=as;as.range;var ls=Dr((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+e*Br)}),(function(t,e){return(e-t)/Br}),(function(t){return t.getUTCMinutes()}));ls.range;var hs=Dr((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+e*Fr)}),(function(t,e){return(e-t)/Fr}),(function(t){return t.getUTCHours()}));hs.range;var cs=Dr((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/Nr}),(function(t){return t.getUTCDate()-1})),ds=cs;function us(t){return Dr((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)/Ir}))}cs.range;var fs=us(0),ms=us(1),ps=us(2),gs=us(3),_s=us(4),xs=us(5),ys=us(6);fs.range,ms.range,ps.range,gs.range,_s.range,xs.range,ys.range;var As=Dr((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()}));As.range;var vs=Dr((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()}));vs.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Dr((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,i){e.setUTCFullYear(e.getUTCFullYear()+i*t)})):null};var bs=vs;vs.range;const[ws,Ms]=function(t,e,i,n,r,s){const a=[[Gr,1,Rr],[Gr,5,5e3],[Gr,15,15e3],[Gr,30,3e4],[s,1,Br],[s,5,3e5],[s,15,9e5],[s,30,18e5],[r,1,Fr],[r,3,108e5],[r,6,216e5],[r,12,432e5],[n,1,Nr],[n,2,1728e5],[i,1,Ir],[e,1,jr],[e,3,7776e6],[t,1,qr]];function o(e,i,n){const r=Math.abs(i-e)/n,s=un((([,,t])=>t)).right(a,r);if(s===a.length)return t.every(vn(e/qr,i/qr,n));if(0===s)return Lr.every(Math.max(vn(e,i,n),1));const[o,l]=a[r/a[s-1][2][t.toLowerCase(),e])))}function js(t,e,i){var n=Os.exec(e.slice(i,i+1));return n?(t.w=+n[0],i+n[0].length):-1}function qs(t,e,i){var n=Os.exec(e.slice(i,i+1));return n?(t.u=+n[0],i+n[0].length):-1}function Us(t,e,i){var n=Os.exec(e.slice(i,i+2));return n?(t.U=+n[0],i+n[0].length):-1}function Gs(t,e,i){var n=Os.exec(e.slice(i,i+2));return n?(t.V=+n[0],i+n[0].length):-1}function Hs(t,e,i){var n=Os.exec(e.slice(i,i+2));return n?(t.W=+n[0],i+n[0].length):-1}function Xs(t,e,i){var n=Os.exec(e.slice(i,i+4));return n?(t.y=+n[0],i+n[0].length):-1}function $s(t,e,i){var n=Os.exec(e.slice(i,i+2));return n?(t.y=+n[0]+(+n[0]>68?1900:2e3),i+n[0].length):-1}function Vs(t,e,i){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(i,i+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),i+n[0].length):-1}function Ys(t,e,i){var n=Os.exec(e.slice(i,i+1));return n?(t.q=3*n[0]-3,i+n[0].length):-1}function Ws(t,e,i){var n=Os.exec(e.slice(i,i+2));return n?(t.m=n[0]-1,i+n[0].length):-1}function Zs(t,e,i){var n=Os.exec(e.slice(i,i+2));return n?(t.d=+n[0],i+n[0].length):-1}function Qs(t,e,i){var n=Os.exec(e.slice(i,i+3));return n?(t.m=0,t.d=+n[0],i+n[0].length):-1}function Js(t,e,i){var n=Os.exec(e.slice(i,i+2));return n?(t.H=+n[0],i+n[0].length):-1}function Ks(t,e,i){var n=Os.exec(e.slice(i,i+2));return n?(t.M=+n[0],i+n[0].length):-1}function ta(t,e,i){var n=Os.exec(e.slice(i,i+2));return n?(t.S=+n[0],i+n[0].length):-1}function ea(t,e,i){var n=Os.exec(e.slice(i,i+3));return n?(t.L=+n[0],i+n[0].length):-1}function ia(t,e,i){var n=Os.exec(e.slice(i,i+6));return n?(t.L=Math.floor(n[0]/1e3),i+n[0].length):-1}function na(t,e,i){var n=Ls.exec(e.slice(i,i+1));return n?i+n[0].length:-1}function ra(t,e,i){var n=Os.exec(e.slice(i));return n?(t.Q=+n[0],i+n[0].length):-1}function sa(t,e,i){var n=Os.exec(e.slice(i));return n?(t.s=+n[0],i+n[0].length):-1}function aa(t,e){return Bs(t.getDate(),e,2)}function oa(t,e){return Bs(t.getHours(),e,2)}function la(t,e){return Bs(t.getHours()%12||12,e,2)}function ha(t,e){return Bs(1+Wr.count(os(t),t),e,3)}function ca(t,e){return Bs(t.getMilliseconds(),e,3)}function da(t,e){return ca(t,e)+"000"}function ua(t,e){return Bs(t.getMonth()+1,e,2)}function fa(t,e){return Bs(t.getMinutes(),e,2)}function ma(t,e){return Bs(t.getSeconds(),e,2)}function pa(t){var e=t.getDay();return 0===e?7:e}function ga(t,e){return Bs(Qr.count(os(t)-1,t),e,2)}function _a(t){var e=t.getDay();return e>=4||0===e?es(t):es.ceil(t)}function xa(t,e){return t=_a(t),Bs(es.count(os(t),t)+(4===os(t).getDay()),e,2)}function ya(t){return t.getDay()}function Aa(t,e){return Bs(Jr.count(os(t)-1,t),e,2)}function va(t,e){return Bs(t.getFullYear()%100,e,2)}function ba(t,e){return Bs((t=_a(t)).getFullYear()%100,e,2)}function wa(t,e){return Bs(t.getFullYear()%1e4,e,4)}function Ma(t,e){var i=t.getDay();return Bs((t=i>=4||0===i?es(t):es.ceil(t)).getFullYear()%1e4,e,4)}function Ta(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Bs(e/60|0,"0",2)+Bs(e%60,"0",2)}function Sa(t,e){return Bs(t.getUTCDate(),e,2)}function Ca(t,e){return Bs(t.getUTCHours(),e,2)}function Ea(t,e){return Bs(t.getUTCHours()%12||12,e,2)}function Pa(t,e){return Bs(1+ds.count(bs(t),t),e,3)}function ka(t,e){return Bs(t.getUTCMilliseconds(),e,3)}function za(t,e){return ka(t,e)+"000"}function Da(t,e){return Bs(t.getUTCMonth()+1,e,2)}function Oa(t,e){return Bs(t.getUTCMinutes(),e,2)}function La(t,e){return Bs(t.getUTCSeconds(),e,2)}function Ra(t){var e=t.getUTCDay();return 0===e?7:e}function Ba(t,e){return Bs(fs.count(bs(t)-1,t),e,2)}function Fa(t){var e=t.getUTCDay();return e>=4||0===e?_s(t):_s.ceil(t)}function Na(t,e){return t=Fa(t),Bs(_s.count(bs(t),t)+(4===bs(t).getUTCDay()),e,2)}function Ia(t){return t.getUTCDay()}function ja(t,e){return Bs(ms.count(bs(t)-1,t),e,2)}function qa(t,e){return Bs(t.getUTCFullYear()%100,e,2)}function Ua(t,e){return Bs((t=Fa(t)).getUTCFullYear()%100,e,2)}function Ga(t,e){return Bs(t.getUTCFullYear()%1e4,e,4)}function Ha(t,e){var i=t.getUTCDay();return Bs((t=i>=4||0===i?_s(t):_s.ceil(t)).getUTCFullYear()%1e4,e,4)}function Xa(){return"+0000"}function $a(){return"%"}function Va(t){return+t}function Ya(t){return Math.floor(+t/1e3)}!function(t){Es=function(t){var e=t.dateTime,i=t.date,n=t.time,r=t.periods,s=t.days,a=t.shortDays,o=t.months,l=t.shortMonths,h=Ns(r),c=Is(r),d=Ns(s),u=Is(s),f=Ns(a),m=Is(a),p=Ns(o),g=Is(o),_=Ns(l),x=Is(l),y={a:function(t){return a[t.getDay()]},A:function(t){return s[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return o[t.getMonth()]},c:null,d:aa,e:aa,f:da,g:ba,G:Ma,H:oa,I:la,j:ha,L:ca,m:ua,M:fa,p:function(t){return r[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Va,s:Ya,S:ma,u:pa,U:ga,V:xa,w:ya,W:Aa,x:null,X:null,y:va,Y:wa,Z:Ta,"%":$a},A={a:function(t){return a[t.getUTCDay()]},A:function(t){return s[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return o[t.getUTCMonth()]},c:null,d:Sa,e:Sa,f:za,g:Ua,G:Ha,H:Ca,I:Ea,j:Pa,L:ka,m:Da,M:Oa,p:function(t){return r[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Va,s:Ya,S:La,u:Ra,U:Ba,V:Na,w:Ia,W:ja,x:null,X:null,y:qa,Y:Ga,Z:Xa,"%":$a},v={a:function(t,e,i){var n=f.exec(e.slice(i));return n?(t.w=m.get(n[0].toLowerCase()),i+n[0].length):-1},A:function(t,e,i){var n=d.exec(e.slice(i));return n?(t.w=u.get(n[0].toLowerCase()),i+n[0].length):-1},b:function(t,e,i){var n=_.exec(e.slice(i));return n?(t.m=x.get(n[0].toLowerCase()),i+n[0].length):-1},B:function(t,e,i){var n=p.exec(e.slice(i));return n?(t.m=g.get(n[0].toLowerCase()),i+n[0].length):-1},c:function(t,i,n){return M(t,e,i,n)},d:Zs,e:Zs,f:ia,g:$s,G:Xs,H:Js,I:Js,j:Qs,L:ea,m:Ws,M:Ks,p:function(t,e,i){var n=h.exec(e.slice(i));return n?(t.p=c.get(n[0].toLowerCase()),i+n[0].length):-1},q:Ys,Q:ra,s:sa,S:ta,u:qs,U:Us,V:Gs,w:js,W:Hs,x:function(t,e,n){return M(t,i,e,n)},X:function(t,e,i){return M(t,n,e,i)},y:$s,Y:Xs,Z:Vs,"%":na};function b(t,e){return function(i){var n,r,s,a=[],o=-1,l=0,h=t.length;for(i instanceof Date||(i=new Date(+i));++o53)return null;"w"in s||(s.w=1),"Z"in s?(r=(n=Ss(Cs(s.y,0,1))).getUTCDay(),n=r>4||0===r?ms.ceil(n):ms(n),n=ds.offset(n,7*(s.V-1)),s.y=n.getUTCFullYear(),s.m=n.getUTCMonth(),s.d=n.getUTCDate()+(s.w+6)%7):(r=(n=Ts(Cs(s.y,0,1))).getDay(),n=r>4||0===r?Jr.ceil(n):Jr(n),n=Wr.offset(n,7*(s.V-1)),s.y=n.getFullYear(),s.m=n.getMonth(),s.d=n.getDate()+(s.w+6)%7)}else("W"in s||"U"in s)&&("w"in s||(s.w="u"in s?s.u%7:"W"in s?1:0),r="Z"in s?Ss(Cs(s.y,0,1)).getUTCDay():Ts(Cs(s.y,0,1)).getDay(),s.m=0,s.d="W"in s?(s.w+6)%7+7*s.W-(r+5)%7:s.w+7*s.U-(r+6)%7);return"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,Ss(s)):Ts(s)}}function M(t,e,i,n){for(var r,s,a=0,o=e.length,l=i.length;a=l)return-1;if(37===(r=e.charCodeAt(a++))){if(r=e.charAt(a++),!(s=v[r in Ds?e.charAt(a++):r])||(n=s(t,i,n))<0)return-1}else if(r!=i.charCodeAt(n++))return-1}return n}return y.x=b(i,y),y.X=b(n,y),y.c=b(e,y),A.x=b(i,A),A.X=b(n,A),A.c=b(e,A),{format:function(t){var e=b(t+="",y);return e.toString=function(){return t},e},parse:function(t){var e=w(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=b(t+="",A);return e.toString=function(){return t},e},utcParse:function(t){var e=w(t+="",!0);return e.toString=function(){return t},e}}}(t),Ps=Es.format,ks=Es.utcFormat,zs=Es.utcParse}({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"]});var Wa="%Y-%m-%dT%H:%M:%S.%LZ";function Za(t){return new Date(t)}function Qa(t){return t instanceof Date?+t:+new Date(+t)}function Ja(t,e,i,n,r,s,a,o,l,h){var c=Jn(),d=c.invert,u=c.domain,f=h(".%L"),m=h(":%S"),p=h("%I:%M"),g=h("%I %p"),_=h("%a %d"),x=h("%b %d"),y=h("%B"),A=h("%Y");function v(t){return(l(t)1?0:t<-1?ho:Math.acos(t)}function mo(t){return t>=1?co:t<=-1?-co:Math.asin(t)}function po(t){return t.innerRadius}function go(t){return t.outerRadius}function _o(t){return t.startAngle}function xo(t){return t.endAngle}function yo(t){return t&&t.padAngle}function Ao(t,e,i,n,r,s,a,o){var l=i-t,h=n-e,c=a-r,d=o-s,u=d*l-c*h;if(!(u*uk*k+z*z&&(M=S,T=C),{cx:M,cy:T,x01:-c,y01:-d,x11:M*(r/v-1),y11:T*(r/v-1)}}var bo,wo,Mo=0,To=0,So=0,Co=0,Eo=0,Po=0,ko="object"==typeof performance&&performance.now?performance:Date,zo="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Do(){return Eo||(zo(Oo),Eo=ko.now()+Po)}function Oo(){Eo=0}function Lo(){this._call=this._time=this._next=null}function Ro(t,e,i){var n=new Lo;return n.restart(t,e,i),n}function Bo(){Eo=(Co=ko.now())+Po,Mo=To=0;try{!function(){Do(),++Mo;for(var t,e=bo;e;)(t=Eo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Mo}()}finally{Mo=0,function(){var t,e,i=bo,n=1/0;for(;i;)i._call?(n>i._time&&(n=i._time),t=i,i=i._next):(e=i._next,i._next=null,i=t?t._next=e:bo=e);wo=t,No(n)}(),Eo=0}}function Fo(){var t=ko.now(),e=t-Co;e>1e3&&(Po-=e,Co=t)}function No(t){Mo||(To&&(To=clearTimeout(To)),t-Eo>24?(t<1/0&&(To=setTimeout(Bo,t-ko.now()-Po)),So&&(So=clearInterval(So))):(So||(Co=ko.now(),So=setInterval(Fo,1e3)),Mo=1,zo(Bo)))}function Io(t,e,i){var n=new Lo;return e=null==e?0:+e,n.restart((i=>{n.stop(),t(i+e)}),e,i),n}Lo.prototype=Ro.prototype={constructor:Lo,restart:function(t,e,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?Do():+i)+(null==e?0:+e),this._next||wo===this||(wo?wo._next=this:bo=this,wo=this),this._call=t,this._time=i,No()},stop:function(){this._call&&(this._call=null,this._time=1/0,No())}};var jo=Ce("start","end","cancel","interrupt"),qo=[];function Uo(t,e,i,n,r,s){var a=t.__transition;if(a){if(i in a)return}else t.__transition={};!function(t,e,i){var n,r=t.__transition;function s(t){i.state=1,i.timer.restart(a,i.delay,i.time),i.delay<=t&&a(t-i.delay)}function a(s){var h,c,d,u;if(1!==i.state)return l();for(h in r)if((u=r[h]).name===i.name){if(3===u.state)return Io(a);4===u.state?(u.state=6,u.timer.stop(),u.on.call("interrupt",t,t.__data__,u.index,u.group),delete r[h]):+h0)throw new Error("too late; already scheduled");return i}function Ho(t,e){var i=Xo(t,e);if(i.state>3)throw new Error("too late; already running");return i}function Xo(t,e){var i=t.__transition;if(!i||!(i=i[e]))throw new Error("transition not found");return i}function $o(t,e){var i,n;return function(){var r=Ho(this,t),s=r.tween;if(s!==i)for(var a=0,o=(n=i=s).length;a=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Go:Ho;return function(){var a=s(this,t),o=a.on;o!==n&&(r=(n=o).copy()).on(e,i),a.on=r}}var ul=Xi.prototype.constructor;function fl(t){return function(){this.style.removeProperty(t)}}function ml(t,e,i){return function(n){this.style.setProperty(t,e.call(this,n),i)}}function pl(t,e,i){var n,r;function s(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&ml(t,s,i)),n}return s._value=e,s}function gl(t){return function(e){this.textContent=t.call(this,e)}}function _l(t){var e,i;function n(){var n=t.apply(this,arguments);return n!==i&&(e=(i=n)&&gl(n)),e}return n._value=t,n}var xl=0;function yl(t,e,i,n){this._groups=t,this._parents=e,this._name=i,this._id=n}function Al(){return++xl}var vl=Xi.prototype;yl.prototype={constructor:yl,select:function(t){var e=this._name,i=this._id;"function"!=typeof t&&(t=Ie(t));for(var n=this._groups,r=n.length,s=new Array(r),a=0;a{let i=t.style(e);return i&&"string"==typeof i?(i=parseFloat(i.replace("px","")),Number.isFinite(i)?Math.round(i):0):0};let n=t.node().getBoundingClientRect();"bbox"==e&&parseFloat(n.width)>0&&(n=t.node().getBBox());let r={x:0,y:0,width:parseInt(n.width),height:parseInt(n.height)};return void 0!==n.left?(r.x=parseInt(n.left),r.y=parseInt(n.top)):void 0!==n.x&&(r.x=parseInt(n.x),r.y=parseInt(n.y)),void 0!==e&&"nopadding"!=e||(r.width-=i("padding-left")+i("padding-right"),r.height-=i("padding-top")+i("padding-bottom")),r}function Tl(t,e){for(;!t.empty()&&!t.classed("root_canvas")&&e;){let i=t.attr("class");i&&(i.indexOf("root_frame")>=0||i.indexOf("__root_pad_")>=0)&&(e.x+=t.property("draw_x")||0,e.y+=t.property("draw_y")||0),t=$i(t.node().parentNode)}return e}function Sl(t,e,i){e||(e="6.4g");let n=(e=e.trim()).length;if(n<2)return i?[t.toFixed(4),"6.4f"]:t.toFixed(4);let r,s=e[n-1],a=(e=e.slice(0,n-1)).indexOf(".");a=a<0?4:parseInt(e.slice(a+1)),(!Number.isInteger(a)||a<=0)&&(a=4);let o=!1;if("e"==s||"E"==s)r=!0;else if("Q"==s)r=!0,o=!0;else if("f"==s||"F"==s)r=!1;else if("W"==s)r=!1,o=!0;else{if("g"==s||"G"==s){let n=Sl(t,e+"Q",!0),r=Sl(t,e+"W",!0);return n[0].length0&&(a=20,l=t.toFixed(a));let e=0;for(;ee&&i--,0!=i&&(a-=i,a<0?a=0:a>20&&(a=20),l=t.toFixed(a))}return i?[l,"5."+a+"f"]:l}Xi.prototype.interrupt=function(t){return this.each((function(){!function(t,e){var i,n,r,s=t.__transition,a=!0;if(s){for(r in e=null==e?null:e+"",s)(i=s[r]).name===e?(n=i.state>2&&i.state<5,i.state=6,i.timer.stop(),i.on.call(n?"interrupt":"cancel",t,t.__data__,i.index,i.group),delete s[r]):a=!1;a&&delete t.__transition}}(this,t)}))},Xi.prototype.transition=function(t){var e,i;t instanceof yl?(e=t._id,t=t._name):(e=Al(),(i=bl).time=Do(),t=null==t?null:t+"");for(var n=this._groups,r=n.length,s=0;si&&(this.part=this.opt.slice(i,n),this.opt=this.opt.slice(0,i)+this.opt.slice(n)),!0}partAsInt(t,e){let i=this.part.replace(/^\D+/g,"");return i=i?parseInt(i,10):Number.NaN,Number.isInteger(i)?i+(t||0):e||0}partAsFloat(t,e){let i=this.part.replace(/^\D+/g,"");return i=i?parseFloat(i):Number.NaN,Number.isFinite(i)?i+(t||0):e||0}}class El{constructor(t){void 0!==t&&this.seed(t)}seed(t){(t=Math.abs(t))>1e8?t=Math.abs(1e8*Math.sin(t)):t<1&&(t*=1e8),this.m_w=Math.round(t),this.m_z=987654321}random(){if(void 0===this.m_z)return Math.random();this.m_z=36969*(65535&this.m_z)+(this.m_z>>16)&4294967295,this.m_w=18e3*(65535&this.m_w)+(this.m_w>>16)&4294967295;let t=(this.m_z<<16)+this.m_w&4294967295;return t/=4294967296,t+.5}}function Pl(t,e,i,n){const r=t.indexOf("bezier")>=0;void 0===n&&(n=r?2:0),void 0===i&&(i=0);const s=(t,e)=>(e.gry-t.gry)/(e.grx-t.grx);let a,o,l={path:"",close:""},h=e[0],c=Math.max(h.gry,i+5),d=Math.round(h.grx),u=Math.round(h.gry),f=e.length;const m=t=>{let e=Math.round(t);if(0==n||e===t)return e.toString();let i=t.toFixed(n);for(;"0"==i[i.length-1]&&i.lastIndexOf(".")=0)&&(t=>{let e,i,n,r,a=(t=>{let e=0,i=t.length-1,n=[],r=t[0],a=t[1],o=n[0]=s(r,a);for(;++e9&&(r=3*e/Math.sqrt(r),a[o]=r*i,a[o+1]=r*n));for(o=-1;++o<=l;)r=(t[Math.min(l,o+1)].grx-t[Math.max(0,o-1)].grx)/(6*(1+a[o]*a[o])),t[o].dgrx=r||0,t[o].dgry=a[o]*r||0})(e),r){l.path+=`C${m(h.grx+h.dgrx)},${m(h.gry+h.dgry)},`;for(let t=1;t1&&(l.path+="S"),l.path+=`${m(h.grx-h.dgrx)},${m(h.gry-h.dgry)},${m(h.grx)},${m(h.gry)}`,c=Math.max(c,i.gry)}}else if(f<1e4){let t=0,i=0;const n=()=>{t&&(l.path+="h"+t,t=0),i&&(l.path+="v"+i,i=0)};for(let r=1;r0&&(l.close=`L${m(h.grx)},${m(c)}h${m(e[0].grx-h.grx)}Z`),l}function kl(t){return(t=(t=t.replace(/url\(\"\;\#(\w+)\"\;\)/g,"url(#$1)").replace(/ class=\"\w*\"/g,"").replace(/ pad=\"\w*\"/g,"").replace(/ title=\"\"/g,"").replace(/<\/g>/g,"").replace(/<\/g>/g,"")).replace(/<\/svg>/g,"")).indexOf("xlink:href")<0&&(t=t.replace(/ xmlns:xlink=\"http:\/\/www.w3.org\/1999\/xlink\"/g,"")),t}class zl{constructor(t){this.divid=null,t&&this.setDom(t)}setDom(t){void 0!==t&&(this.divid=t,delete this._selected_main)}getDom(){return this.divid}selectDom(t){if(!this.divid)return $i(null);let e=this._selected_main;if(!e){if("string"==typeof this.divid){let t=this.divid;"#"!=t[0]&&(t="#"+t),e=$i(t),e.empty()||(this.divid=e.node())}else e=$i(this.divid);this._selected_main=e}if(!e||e.empty()||"origin"===t)return e;let i=e.property("use_enlarge"),n="simple"==(e.property("layout")||"simple")?"":e.property("layout_selector");return n&&(e=e.select(n)),t||e.empty()||!i||(e=$i("#jsroot_enlarge_div")),e}_accessTopPainter(t){let e=this.selectDom().node()?.firstChild;return e?(!0===t?e.painter=this:!1===t&&delete e.painter,e.painter):null}setTopPainter(){this._accessTopPainter(!0)}getTopPainter(){return this._accessTopPainter()}clearTopPainter(){this._accessTopPainter(!1)}cleanup(t){this.clearTopPainter();let e=this.selectDom("origin");e.empty()||t||e.html(""),this.divid=null,delete this._selected_main,"function"==typeof this._hpainter?.removePainter&&this._hpainter.removePainter(this),delete this._hitemname,delete this._hdrawopt,delete this._hpainter}checkResize(){}testMainResize(t,e,i){let n=this.enlargeMain("state"),r=this.selectDom("origin"),s=this.selectDom();"on"!==n&&e&&e.width&&e.height&&r.style("width",e.width+"px").style("height",e.height+"px");let a=Ml(r,!0),o=r.attr("can_resize"),l=!1;"height"==o&&i&&Math.abs(a.width*i-a.height)>.1*a.width&&(l=!0),(a.height<=5||a.width<=5)&&o&&"false"!==o&&(l=!0),l&&"on"!==n&&(a.width>5?(i=i||.66,r.style("height",Math.round(a.width*i)+"px")):"height"!==o&&r.style("width","200px").style("height","100px"));let h=Ml(s),c=s.property("draw_height"),d=s.property("draw_width");return h.changed=!1,c&&d&&c>0&&d>0?c===h.height&&d===h.width||(t>1||h.width/d<.66||h.width/d>1.5||h.height/c<.66&&h.height/c>1.5)&&(h.changed=!0):h.changed=!0,h}enlargeMain(t,e){let i=this.selectDom(!0),n=this.selectDom("origin");if(i.empty()||!g.CanEnlarge||!1===n.property("can_enlarge"))return!1;if(void 0===t||"verify"===t)return!0;let r=n.property("use_enlarge")?"on":"off";if("state"===t)return r;"toggle"===t&&(t="off"===r);let s=$i("#jsroot_enlarge_div");if(!0===t&&"on"!==r){if(!s.empty())return!1;s=$i(document.body).append("div").attr("id","jsroot_enlarge_div").attr("style","position: fixed; margin: 0px; border: 0px; padding: 0px; left: 1px; right: 1px; top: 1px; bottom: 1px; background: white; opacity: 0.95; z-index: 100; overflow: hidden;");let t=Ml(i),r=Ml(s);if((r.width<=t.width||r.height<=t.height)&&r.width*r.height0;)s.node().appendChild(i.node().firstChild);return n.property("use_enlarge",!0),!0}if(!1===t&&"off"!==r){for(;s.node()&&s.node().childNodes.length>0;)i.node().appendChild(s.node().firstChild);return s.remove(),n.property("use_enlarge",!1),!0}return!1}setItemName(t,e,i){"string"==typeof t?this._hitemname=t:delete this._hitemname,"string"==typeof e&&(this._hdrawopt=e),this._hpainter=i}getItemName(){return this._hitemname??null}getItemDrawOpt(){return this._hdrawopt??""}}async function Dl(){return Promise.resolve().then((function(){return HM})).then((t=>(s.nodejs_window||(s.nodejs_window=new t.JSDOM("hello").window,s.nodejs_document=s.nodejs_window.document,s.nodejs_body=$i(s.nodejs_document).select("body")),{JSDOM:t.JSDOM,doc:s.nodejs_document,body:s.nodejs_body})))}const Ol=["Arial","iTimes New Roman","bTimes New Roman","biTimes New Roman","Arial","oArial","bArial","boArial","Courier New","oCourier New","bCourier New","boCourier New","Symbol","Times New Roman","Wingdings","iSymbol","Verdana","iVerdana","bVerdana","biVerdana"],Ll=[.5778,.5314,.5809,.554,.5778,.5783,.6034,.603,.6003,.6004,.6003,.6005,.5521,.5521,.5664,.5314,.5664,.5495,.5748,.5578];class Rl{constructor(t,e,i,n,r,s){if(this.name="Arial",this.style=null,this.weight=null,i&&e<1&&(e*=i,this.scaled=!0),this.size=Math.round(e||11),this.scale=i,null!==t){let e=Math.floor(t/10),i=Ol[e]||"Arial";for(;i.length>0;){if("b"===i[0])this.weight="bold";else if("i"===i[0])this.style="italic";else{if("o"!==i[0])break;this.style="oblique"}i=i.slice(1)}this.name=i,this.aver_width=Ll[e]||.55}else this.name=n,this.style=r||null,this.weight=s||null,this.aver_width=this.weight?.58:.55;"Symbol"==this.name||"Wingdings"==this.name?(this.isSymbol=this.name,this.name="Times New Roman"):this.isSymbol="",this.func=this.setFont.bind(this)}setFont(t,e){t.attr("font-family",this.name),"without-size"!=e&&t.attr("font-size",this.size).attr("xml:space","preserve"),t.attr("font-weight",this.weight||null),t.attr("font-style",this.style||null)}setSize(t){this.size=Math.round(t)}setColor(t){this.color=t}setAlign(t){this.align=t}setAngle(t){this.angle=t}roundAngle(t,e){this.angle=parseInt(this.angle||0),Number.isInteger(this.angle)||(this.angle=0),this.angle=Math.round(this.angle/t)*t+(e||0),this.angle<0?this.angle+=360:this.angle>=360&&(this.angle-=360)}clearFont(t){t.attr("font-family",null).attr("font-size",null).attr("xml:space",null).attr("font-weight",null).attr("font-style",null)}isMonospace(){let t=this.name.toLowerCase();return 0==t.indexOf("courier")||"monospace"==t||"monaco"==t}getFontHtml(){let t=Math.round(this.size)+"pt "+this.name;return this.weight&&(t+=" "+this.weight),this.style&&(t+=" "+this.style),t}getFontName(){return this.isSymbol||this.name||"none"}}const Bl={"#alpha":"α","#beta":"β","#chi":"χ","#delta":"δ","#digamma":"ϝ","#varepsilon":"ε","#phi":"φ","#gamma":"γ","#eta":"η","#iota":"ι","#varphi":"φ","#kappa":"κ","#koppa":"ϟ","#sampi":"ϡ","#lambda":"λ","#mu":"μ","#nu":"ν","#omicron":"ο","#pi":"π","#theta":"θ","#rho":"ρ","#sigma":"σ","#stigma":"ϛ","#san":"ϻ","#sho":"ϸ","#tau":"τ","#upsilon":"υ","#varomega":"ϖ","#varcoppa":"ϙ","#omega":"ω","#xi":"ξ","#psi":"ψ","#zeta":"ζ","#Alpha":"Α","#Beta":"Β","#Chi":"Χ","#Delta":"Δ","#Digamma":"Ϝ","#Epsilon":"Ε","#Phi":"Φ","#Gamma":"Γ","#Eta":"Η","#Iota":"Ι","#vartheta":"ϑ","#Kappa":"Κ","#Koppa":"Ϟ","#varKoppa":"Ϙ","#Sampi":"Ϡ","#Lambda":"Λ","#Mu":"Μ","#Nu":"Ν","#Omicron":"Ο","#Pi":"Π","#Theta":"Θ","#Rho":"Ρ","#Sigma":"Σ","#Stigma":"Ϛ","#San":"Ϻ","#Sho":"Ϸ","#Tau":"Τ","#Upsilon":"Υ","#varsigma":"ς","#Omega":"Ω","#Xi":"Ξ","#Psi":"Ψ","#Zeta":"Ζ","#varUpsilon":"ϒ","#epsilon":"ε","#P":"¶","#sqrt":"√","#bar":"","#overline":"","#underline":"","#strike":"","#leq":"≤","#/":"⁄","#infty":"∞","#voidb":"ƒ","#club":"♣","#diamond":"♦","#heart":"♥","#spade":"♠","#leftrightarrow":"↔","#leftarrow":"←","#uparrow":"↑","#rightarrow":"→","#downarrow":"↓","#circ":"ˆ","#pm":"±","#doublequote":"″","#geq":"≥","#times":"×","#propto":"∝","#partial":"∂","#bullet":"•","#divide":"÷","#neq":"≠","#equiv":"≡","#approx":"≈","#3dots":"…","#cbar":"|","#topbar":"¯","#downleftarrow":"↵","#aleph":"ℵ","#Jgothic":"ℑ","#Rgothic":"ℜ","#voidn":"℘","#otimes":"⊗","#oplus":"⊕","#oslash":"∅","#cap":"∩","#cup":"∪","#supseteq":"⊇","#supset":"⊃","#notsubset":"⊄","#subseteq":"⊆","#subset":"⊂","#int":"∫","#in":"∈","#notin":"∉","#angle":"∠","#nabla":"∇","#oright":"®","#ocopyright":"©","#trademark":"™","#prod":"∏","#surd":"√","#upoint":"˙","#corner":"¬","#wedge":"∧","#vee":"∨","#Leftrightarrow":"⇔","#Leftarrow":"⇐","#Uparrow":"⇑","#Rightarrow":"⇒","#Downarrow":"⇓","#LT":"<","#void1":"®","#copyright":"©","#void3":"™","#sum":"∑","#arctop":"⎛","#lbar":"⎸","#arcbottom":"⎝","#void8":"","#bottombar":"⌊","#arcbar":"⎧","#ltbar":"⎨","#AA":"Å","#aa":"å","#void06":"","#GT":">","#forall":"∀","#exists":"∃","#vec":"","#dot":"⋅","#hat":"·","#ddot":"","#acute":"","#grave":"","#check":"✓","#tilde":"˜","#slash":"⁄","#hbar":"ħ","#box":"◽","#Box":"☐","#parallel":"∥","#perp":"⊥","#odot":"⊙","#left":"","#right":"","{}":""},Fl=new RegExp("("+Object.keys(Bl).join("|").replace(/\\\{/g,"{").replace(/\\\}/g,"}")+")","g"),Nl=(t,e)=>{for(;t.length>2&&"{"==t[0]&&"}"==t[t.length-1];)t=t.slice(1,t.length-1);return t.replace(Fl,(t=>Bl[t])).replace(/\{\}/g,"")},Il=[453,535,661,973,955,1448,1242,324,593,596,778,1011,431,570,468,492,947,885,947,947,947,947,947,947,947,947,511,495,980,1010,987,893,1624,1185,1147,1193,1216,1080,1028,1270,1274,531,910,1177,1004,1521,1252,1276,1111,1276,1164,1056,1073,1215,1159,1596,1150,1124,1065,540,591,540,837,874,572,929,972,879,973,901,569,967,973,453,458,903,453,1477,973,970,972,976,638,846,548,973,870,1285,884,864,835,656,430,656,1069],jl={945:1002,946:996,967:917,948:953,949:834,966:1149,947:847,951:989,953:516,954:951,955:913,956:1003,957:862,959:967,960:1070,952:954,961:973,963:1017,964:797,965:944,982:1354,969:1359,958:803,968:1232,950:825,913:1194,914:1153,935:1162,916:1178,917:1086,934:1358,915:1016,919:1275,921:539,977:995,922:1189,923:1170,924:1523,925:1253,927:1281,928:1281,920:1285,929:1102,931:1041,932:1069,933:1135,962:848,937:1279,926:1092,936:1334,918:1067,978:1154,8730:986,8804:940,8260:476,8734:1453,402:811,9827:1170,9830:931,9829:1067,9824:965,8596:1768,8592:1761,8593:895,8594:1761,8595:895,710:695,177:955,8243:680,8805:947,215:995,8733:1124,8706:916,8226:626,247:977,8800:969,8801:1031,8776:976,8230:1552,175:883,8629:1454,8501:1095,8465:1002,8476:1490,8472:1493,8855:1417,8853:1417,8709:1205,8745:1276,8746:1404,8839:1426,8835:1426,8836:1426,8838:1426,8834:1426,8747:480,8712:1426,8713:1426,8736:1608,8711:1551,174:1339,169:1339,8482:1469,8719:1364,729:522,172:1033,8743:1383,8744:1383,8660:1768,8656:1496,8657:1447,8658:1496,8659:1447,8721:1182,9115:882,9144:1e3,9117:882,8970:749,9127:1322,9128:1322,8491:1150,229:929,8704:1397,8707:1170,8901:524,183:519,10003:1477,732:692,295:984,9725:1780,9744:1581,8741:737,8869:1390,8857:1421};function ql(t,e,i){let n=t.length,r=(i||e.size)*e.aver_width;if(e.isMonospace())return n*r;let s=0;for(let e=0;e=32&&i<127?Il[i-32]:jl[i]||1e3}return s/1e3*r}const Ul=[{name:"#it{"},{name:"#bf{"},{name:"#underline{",deco:"underline"},{name:"#overline{",deco:"overline"},{name:"#strike{",deco:"line-through"},{name:"#kern[",arg:"float"},{name:"#lower[",arg:"float"},{name:"#scale[",arg:"float"},{name:"#color[",arg:"int"},{name:"#font[",arg:"int"},{name:"_{",low_up:"low"},{name:"^{",low_up:"up"},{name:"#bar{",deco:"overline"},{name:"#hat{",accent:"ˆ",hasw:!0},{name:"#check{",accent:"ˇ",hasw:!0},{name:"#acute{",accent:"ˊ"},{name:"#grave{",accent:"ˋ"},{name:"#dot{",accent:"˙"},{name:"#ddot{",accent:"ʺ",hasw:!0},{name:"#tilde{",accent:"˜",hasw:!0},{name:"#slash{",accent:"∕"},{name:"#vec{",accent:"˭",hasw:!0},{name:"#frac{",twolines:"line"},{name:"#splitline{",twolines:!0},{name:"#sqrt[",arg:"int",sqrt:!0},{name:"#sqrt{",sqrt:!0},{name:"#sum",special:"∑",w:.8,h:.9},{name:"#int",special:"∫",w:.3,h:1},{name:"#left[",right:"#right]",braces:"[]"},{name:"#left(",right:"#right)",braces:"()"},{name:"#left{",right:"#right}",braces:"{}"},{name:"#left|",right:"#right|",braces:"||"},{name:"#[]{",braces:"[]"},{name:"#(){",braces:"()"},{name:"#{}{",braces:"{}"},{name:"#||{",braces:"||"}],Gl=[0,8704,0,8707,0,0,8717,0,0,8727,0,0,8722,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8773,913,914,935,916,917,934,915,919,921,977,922,923,924,925,927,928,920,929,931,932,933,962,937,926,936,918,0,8756,0,8869,0,0,945,946,967,948,949,966,947,951,953,981,954,955,956,957,959,960,952,961,963,964,965,982,969,958,968,950,0,402,0,8764,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,978,8242,8804,8260,8734,0,9827,9830,9829,9824,8596,8592,8593,8594,8595,0,0,8243,8805,0,8733,8706,8729,0,8800,8801,8776,8230,0,0,8629,8501,8465,8476,8472,8855,8853,8709,8745,8746,8835,8839,8836,8834,8838,8712,8713,8736,8711,0,0,8482,8719,8730,8901,0,8743,8744,8660,8656,8657,8658,8659,9674,9001,0,0,8482,8721,0,0,0,0,0,0,0,0,0,0,8364,9002,8747,8992,0,8993],Hl=[128393,9986,9985,128083,128365,128366,128367,128383,9990,128386,128387,128234,128235,128236,128237,128193,128194,128196,128463,128464,128452,8987,128430,128432,128434,128435,128436,128427,128428,9991,9997,128398,9996,128076,128077,128078,9756,9758,9757,9759,128400,9786,128528,9785,128163,9760,127987,127985,9992,9788,128167,10052,128326,10014,128328,10016,10017,9770,9775,2384,9784,9800,9801,9802,9803,9804,9805,9806,9807,9808,9809,9810,9811,128624,128629,9679,128318,9632,9633,128912,10065,10066,11047,10731,9670,10070,11045,8999,11193,8984,127989,127990,128630,128631,0,9450,9312,9313,9314,9315,9316,9317,9318,9319,9320,9321,9471,10102,10103,10104,10105,10106,10107,10108,10109,10110,10111,128610,128608,128609,128611,128606,128604,128605,128607,183,8226,9642,9898,128902,128904,9673,9678,128319,9642,9723,128962,10022,9733,10038,10036,10041,10037,11216,8982,10209,8977,11217,10026,10032,128336,128337,128338,128339,128340,128341,128342,128343,128344,128345,128346,128347,11184,11185,11186,11187,11188,11189,11190,11191,128618,128619,128597,128596,128599,128598,128592,128593,128594,128595,9003,8998,11160,11162,11161,11163,11144,11146,11145,11147,129128,129130,129129,129131,129132,129133,129135,129134,129144,129146,129145,129147,129148,129149,129151,129150,8678,8680,8679,8681,11012,8691,11008,11009,11011,11010,129196,129197,128502,10004,128503,128505];function Xl(t,e){let i="",n="Wingdings"==e?Hl:Gl;for(let e=0;e32?n[r-33]:0;i+=String.fromCodePoint(s||r)}return i}function $l(t,e,i,n){let r=0;const s=()=>(n.g||(n.g=t.append("svg:g")),n.g),a=t=>{n.x+=Math.round(t)},o=(t,i,r,s)=>{n.rect?(n.rect.x1=Math.min(n.rect.x1,t),n.rect.y1=Math.min(n.rect.y1,i),n.rect.x2=Math.max(n.rect.x2,r),n.rect.y2=Math.max(n.rect.y2,s)):n.rect={x1:t,y1:i,x2:r,y2:s},n.rect.width=n.rect.x2-n.rect.x1,n.rect.height=n.rect.y2-n.rect.y1,n.parent||(e.text_rect=n.rect)},l=(t,e,i,r)=>{e=Math.round(e),(i=Math.round(i))?t.g.attr("transform",`translate(${e},${i})`):e&&t.g.attr("transform",`translate(${e})`),t.rect.x1+=e,t.rect.x2+=e,t.rect.y1+=i,t.rect.y2+=i,r?o(n.x+t.rect.x1,n.y+t.rect.y1,n.x+t.rect.x2,n.y+t.rect.y2):o(t.rect.x1,t.rect.y1,t.rect.x2,t.rect.y2)},h=()=>{let t=s();return 1!=r||i||n.x||n.y?(t=t.append("svg:g"),n.y?t.attr("transform",`translate(${n.x},${n.y})`):n.x&&t.attr("transform",`translate(${n.x})`),t):t},d=(t,e,n)=>{let r=0,s=1,a=!1;e||(e="{"),n||(n="}");const o=t=>r+t.length<=i.length&&i.slice(r,r+t.length)==t;for(t&&(o(e)?i=i.slice(e.length):a=!0);!a&&0!=s&&rt.append("svg:path").style("stroke",i?"none":n.color||e.color).style("stroke-width",i?null:Math.max(1,Math.round(n.fsize*(n.font.weight?.1:.07)))).style("fill",i?n.color||e.color:"none"),f=t=>({lvl:n.lvl+1,x:0,y:0,fsize:n.fsize*(t||1),color:n.color,font:n.font,parent:n,painter:n.painter});for(;i;){let m=i.length,p=null;for(let t=0;t=0&&e0){let l=m==i.length&&0==r&&!p;r++;let h=Nl(i.slice(0,m));if(h.length>0||l){let i=(n.g||(l?t:s())).append("svg:text");l&&!n.g&&(n.g=i),n.ufont&&n.font.setFont(n.g),void 0!==n.bold&&n.g.attr("font-weight",n.bold?"bold":"normal"),void 0!==n.italic&&n.g.attr("font-style",n.italic?"italic":"normal"),i.attr("fill",n.color||e.color||null),n.fisze!==n.font.size&&i.attr("font-size",Math.round(n.fsize)),n.font&&n.font.isSymbol?i.text(Xl(h,n.font.isSymbol)):i.text(h);let r=c()||g.ApproxTextSize||e.fast?{height:1.2*n.fsize,width:ql(h,n.font,n.fsize)}:Ml(i,"nopadding");n.x&&i.attr("x",n.x),n.y&&i.attr("y",n.y),n.last_y1=n.y-.8*r.height,n.last_y2=n.y+.2*r.height,o(n.x,n.last_y1,n.x+r.width,n.last_y2),l?n.deco&&(i.attr("text-decoration",n.deco),delete n.deco):a(r.width)}}if(!p)return!0;if(i=i.slice(m+p.name.length),r++,p.accent){let t=d();if(-1===t)return!1;let i=h(),r=f();$l(i,e,t,r);let s=.6*n.fsize,o=0,c=r.rect.width,m=Math.round(r.rect.y1),g=Math.round(.1*n.fsize),_=2*g,x=`a${g},${g},0,0,1,${_},0a${g},${g},0,0,1,${-_},0z`;p.hasw&&c0?_/2:0,x-m.rect.y1,!0),c&&c.attr("d",`M0,${Math.round(x)}h${Math.round(g-.1*n.fsize)}`),a(g),delete n.twolines;continue}const _=t=>{let e={};if(t&&(e[t]=d(),-1===e[t]))return!1;for(;i.length>0;)if("_"==i.charAt(0)){if(i=i.slice(1),e.low=e.low?-1:d(!0),-1===e.low)return console.log(`error with ${p.name} low limit`),!1}else{if("^"!=i.charAt(0))break;if(i=i.slice(1),e.up=e.up?-1:d(!0),-1===e.up)return console.log(`error with ${p.name} upper limit`),!1}return e};if(p.low_up){const t=_(p.low_up);if(!t)return!1;let i,r,o=n.x,h=-n.fsize,c=.25*n.fsize,d=0,u=0;t.up&&(i=f(.6),$l(s(),e,t.up,i)),t.low&&(r=f(.6),$l(s(),e,t.low,r)),void 0!==n.last_y1&&void 0!==n.last_y2&&(h=n.last_y1,c=n.last_y2),i&&(l(i,o,h-i.rect.y1-.1*n.fsize),d=i.rect.width),r&&(l(r,o,c-r.rect.y2+.1*n.fsize),u=r.rect.width),a(Math.max(d,u));continue}if(p.special){let t,i,r=_()||{},s=h(),c=u(s),d=Math.round(1.7*n.fsize),m=Math.round(n.fsize),g=Math.round(.1*d);if("#sum"==p.name?(t=i=m/2,c.attr("d",`M${m},${Math.round(-.75*d)}h${-m}l${Math.round(.4*m)},${Math.round(.3*d)}l${Math.round(-.4*m)},${Math.round(.7*d)}h${m}`)):(t=3*g,i=g,c.attr("d",`M0,${Math.round(.25*d-g)}a${g},${g},0,0,0,${2*g},0v${2*g-d}a${g},${g},0,1,1,${2*g},0`)),o(n.x,n.y-.6*d,n.x+m,n.y+.4*d),r.low){let t=f(.6);$l(s,e,r.low,t),l(t,i-t.rect.width/2,.25*d-t.rect.y1,!0)}if(r.up){let i=f(.6);$l(s,e,r.up,i),l(i,t-i.rect.width/2,-.75*d-i.rect.y2,!0)}a(m);continue}if(p.braces){let t=p.right,i=t?p.name:"{",r=d(!1,i,t),s=h(),c=f(),m=u(s);$l(s,e,r,c);let g=u(s),_=Math.max(2,Math.round(.2*n.fsize)),x=c.rect,y=Math.round(x.y2-x.y1),A=Math.round(x.y1),v=Math.round(x.width);switch(p.braces){case"||":m.attr("d",`M${_},${A}v${y}`),g.attr("d",`M${3*_+v},${A}v${y}`);break;case"[]":m.attr("d",`M${2*_},${A}h${-_}v${y}h${_}`),g.attr("d",`M${2*_+v},${A}h${_}v${y}h${-_}`);break;case"{}":m.attr("d",`M${2*_},${A} a${_},${_},0,0,0,${-_},${_} v${y/2-2*_} a${_},${_},0,0,1,${-_},${_} a${_},${_},0,0,1,${_},${_} v${y/2-2*_} a${_},${_},0,0,0,${_},${_}`),g.attr("d",`M${2*_+v},${A} a${_},${_},0,0,1,${_},${_} v${y/2-2*_} a${_},${_},0,0,0,${_},${_} a${_},${_},0,0,0,${-_},${_} v${y/2-2*_} a${_},${_},0,0,1,${-_},${_}`);break;default:m.attr("d",`M${_},${A}a${4*y},${4*y},0,0,0,0,${y}`),g.attr("d",`M${3*_+v},${A}a${4*y},${4*y},0,0,1,0,${y}`)}l(c,2*_,0,!0),o(n.x,n.y+x.y1,n.x+4*_+x.width,n.y+x.y2),a(4*_+x.width),n.last_y1=x.y1,n.last_y2=x.y2;continue}if(p.deco){let t=d(),i=h(),n=f();n.deco=p.deco,$l(i,e,t,n);let r=n.rect;if(n.deco){let t=u(i),e=Math.round(r.width);switch(n.deco){case"underline":t.attr("d",`M0,${Math.round(r.y2)}h${e}`);break;case"overline":t.attr("d",`M0,${Math.round(r.y1)}h${e}`);break;case"line-through":t.attr("d",`M0,${Math.round(.45*r.y1+.55*r.y2)}h${e}`)}}l(n,0,0,!0),a(r.width);continue}if("#bf{"==p.name||"#it{"==p.name){let t=d();if(-1===t)return!1;let i=f();"#bf{"==p.name?i.bold=!i.bold:i.italic=!i.italic,$l(s(),e,t,i),l(i,n.x,n.y),a(i.rect.width);continue}let x=0;if(p.arg){let t=i.indexOf("]{");if(t<0)return console.log("missing argument for ",p.name),!1;if(x=i.slice(0,t),"int"==p.arg){if(x=parseInt(x),!Number.isInteger(x))return console.log("wrong int argument",i.slice(0,t)),!1}else if("float"==p.arg&&(x=parseFloat(x),!Number.isFinite(x)))return console.log("wrong float argument",i.slice(0,t)),!1;i=i.slice(t+2)}if("#kern["!=p.name&&"#lower["!=p.name)if("#color["!=p.name&&"#scale["!=p.name&&"#font["!=p.name)if(p.sqrt){let t=d();if(-1===t)return!1;let i,r=h(),s=f();p.arg&&(i=f(.7),$l(r,e,x.toString(),i));let c=u(r);$l(r,e,t,s);let m=s.rect,g=Math.round(m.height),_=Math.round(.1*m.height),y=Math.round(m.width),A=Math.round((m.y1+m.y2)/2),v=Math.round(.2*n.fsize),b=Math.round(m.y2);i&&l(i,0,A-.3*i.fsize,!0),c.attr("d",`M0,${A}h${_}l${_},${b-A-v}l${_},${-g+v}h${Math.round(.2*g+y)}v${_}`),l(s,.4*g,0,!0),o(n.x,n.y+m.y1-.1*n.fsize,n.x+y+.6*g,n.y+m.y2),a(y+.6*g)}else;else{let t=d();if(-1===t)return!1;let i=f();"#color["==p.name?i.color=n.painter.getColor(x):"#font["==p.name?(i.font=new Rl(x),i.ufont=!0):i.fsize*=x,$l(s(),e,t,i),l(i,n.x,n.y),a(i.rect.width)}else{let t=d();if(-1===t)return!1;let i=f();$l(s(),e,t,i);let r=0,o=0;"kern["==p.name?r=x:o=x,l(i,n.x+r*i.rect.width,n.y+o*i.rect.height),a(i.rect.width*(r>0?1+x:1))}}return!0}function Vl(t,e,i){let n={lvl:0,g:e,x:0,y:0,dx:0,dy:-.1,fsize:i.font_size,font:i.font,parent:null,painter:t};return $l(e,i,i.text,n)}let Yl;async function Wl(){let e=void 0!==Yl;if(!e&&void 0!==globalThis.MathJax)return globalThis.MathJax;e||(Yl=[]);let i=new Promise((t=>{Yl?Yl.push(t):t(globalThis.MathJax)}));if(e)return i;let n,r={scale:1,minScale:.5,mtextInheritFont:!1,merrorInheritFont:!0,mathmlSpacing:!1,skipAttributes:{},exFactor:.5,displayAlign:"center",displayIndent:"0",fontCache:"local",localID:null,internalSpeechTitles:!0,titleID:0};return c()?Dl().then((t=>(n=t.JSDOM,Promise.resolve().then((function(){return HM}))))).then((t=>(t.init({loader:{load:["input/tex","output/svg","[tex]/color","[tex]/upgreek","[tex]/mathtools","[tex]/physics"]},tex:{packages:{"[+]":["color","upgreek","mathtools","physics"]}},svg:r,config:{JSDOM:n},startup:{typeset:!1,ready(){MathJax.startup.registerConstructor("jsdomAdaptor",(()=>new MathJax._.adaptors.HTMLAdaptor.HTMLAdaptor((new MathJax.config.config.JSDOM).window))),MathJax.startup.useAdaptor("jsdomAdaptor",!0),MathJax.startup.defaultReady();let t=Yl;Yl=void 0,t.forEach((t=>t(MathJax)))}}}),i))):(window.MathJax={options:{enableMenu:!1},loader:{load:["[tex]/color","[tex]/upgreek","[tex]/mathtools","[tex]/physics"]},tex:{packages:{"[+]":["color","upgreek","mathtools","physics"]}},svg:r,startup:{ready(){MathJax.startup.defaultReady();let t=Yl;Yl=void 0,t.forEach((t=>t(globalThis.MathJax)))}}},A(t.source_dir+"../mathjax/3.2.0/es5/tex-svg.js").catch((()=>A("https://cdn.jsdelivr.net/npm/mathjax@3.2.0/es5/tex-svg.js"))).then((()=>i)))}const Zl={"#LT":"\\langle","#GT":"\\rangle","#club":"\\clubsuit","#spade":"\\spadesuit","#heart":"\\heartsuit","#diamond":"\\diamondsuit","#voidn":"\\wp","#voidb":"f","#copyright":"(c)","#ocopyright":"(c)","#trademark":"TM","#void3":"TM","#oright":"R","#void1":"R","#3dots":"\\ldots","#lbar":"\\mid","#void8":"\\mid","#divide":"\\div","#Jgothic":"\\Im","#Rgothic":"\\Re","#doublequote":'"',"#plus":"+","#minus":"-","#/":"/","#upoint":".","#aa":"\\mathring{a}","#AA":"\\mathring{A}","#omicron":"o","#Alpha":"A","#Beta":"B","#Epsilon":"E","#Zeta":"Z","#Eta":"H","#Iota":"I","#Kappa":"K","#Mu":"M","#Nu":"N","#Omicron":"O","#Rho":"P","#Tau":"T","#Chi":"X","#varomega":"\\varpi","#corner":"?","#ltbar":"?","#bottombar":"?","#notsubset":"?","#arcbottom":"?","#cbar":"?","#arctop":"?","#topbar":"?","#arcbar":"?","#downleftarrow":"?","#splitline":"\\genfrac{}{}{0pt}{}","#it":"\\textit","#bf":"\\textbf","#frac":"\\frac","#left{":"\\lbrace","#right}":"\\rbrace","#left\\[":"\\lbrack","#right\\]":"\\rbrack","#\\[\\]{":"\\lbrack"," } ":"\\rbrack","#\\[":"\\lbrack","#\\]":"\\rbrack","#{":"\\lbrace","#}":"\\rbrace"," ":"\\;"},Ql={upDelta:"Updelta",upGamma:"Upgamma",upLambda:"Uplambda",upOmega:"Upomega",upPhi:"Upphi",upPi:"Uppi",upPsi:"Uppsi",upSigma:"Upsigma",upTheta:"Uptheta",upUpsilon:"Upupsilon",upXi:"Upxi",notcong:"ncong",notgeq:"ngeq",notgr:"ngtr",notless:"nless",notleq:"nleq",notsucc:"nsucc",notprec:"nprec",notsubseteq:"nsubseteq",notsupseteq:"nsupseteq",openclubsuit:"clubsuit",openspadesuit:"spadesuit",dasharrow:"dashrightarrow",comp:"circ",iiintop:"iiint",iintop:"iint",ointop:"oint"},Jl={Digamma:988,upDigamma:988,digamma:989,updigamma:989,Koppa:990,koppa:991,upkoppa:991,upKoppa:990,VarKoppa:984,upVarKoppa:984,varkoppa:985,upvarkoppa:985,varkappa:954,upvarkappa:954,varbeta:976,upvarbeta:976,Sampi:992,upSampi:992,sampi:993,upsampi:993,Stigma:986,upStigma:986,stigma:987,upstigma:987,San:1018,upSan:1018,san:1019,upsan:1019,Sho:1015,upSho:1015,sho:1016,upsho:1016,P:182,aa:176,bulletdashcirc:8887,circdashbullet:8886,downuparrows:8693,updownarrows:8645,dashdownarrow:8675,dashuparrow:8673,complement:8705,dbar:396,ddddot:8943,dddot:8943,ddots:8945,defineequal:8797,defineeq:8797,downdownharpoons:10597,downupharpoons:10607,updownharpoons:10606,upupharpoons:10595,hateq:8793,ldbrack:10214,rdbrack:10215,leadsfrom:8604,leftsquigarrow:8668,lightning:9735,napprox:8777,nasymp:8813,nequiv:8802,nsimeq:8772,nsubseteq:8840,nsubset:8836,notapprox:8777,notasymp:8813,notequiv:8802,notni:8716,notsimeq:8772,notsubseteq:8840,notsubset:8836,notsupseteq:8841,notsupset:8837,nsupset:8837,setdif:8726,simarrow:10610,t:8256,u:711,v:711,undercurvearrowright:10555,updbar:396,wwbar:8213,awointop:8754,awoint:8755,barintop:10780,barint:10779,cwintop:8753,cwint:8753,cwointop:8755,cwoint:8754,oiiintop:8752,oiiint:8752,oiintop:8751,oiint:8751,slashintop:10767,slashint:10767},Kl=['"',"'","`","=","~"];function th(t,e,i,n,r,s){let a=parseInt(i.attr("width")),o=parseInt(i.attr("height"));if(Number.isInteger(o)&&Number.isInteger(a))s>0&&(a/=s,o/=s,i.attr("width",Math.round(a)).attr("height",Math.round(o)));else{let t=Ml(e,"bbox");a=t.width||a||100,o=t.height||o||10}s>0&&n.valign&&(n.valign=n.valign/s),null===n.valign&&(n.valign=(r-o)/2);let l={x:1,y:1},h="x",c="y";180==n.rotate?l.x=l.y=-1:270!=n.rotate&&90!=n.rotate||(l.x=270==n.rotate?-1:1,l.y=-l.x,h="y",c="x"),"middle"==n.align[0]?n[h]+=l.x*(n.width-a)/2:"end"==n.align[0]&&(n[h]+=l.x*(n.width-a)),"middle"==n.align[1]?n[c]+=l.y*(n.height-o)/2:"bottom"==n.align[1]?n[c]+=l.y*(n.height-o):"bottom-base"==n.align[1]&&(n[c]+=l.y*(n.height-o-n.valign));let d=`translate(${n.x},${n.y})`;n.rotate&&(d+=` rotate(${n.rotate})`),e.attr("transform",d).attr("visibility",null)}async function eh(t,e,i){let n=function(t,e,i,n){if(2!=e){for(let e in Zl)t=t.replace(new RegExp(e,"g"),Zl[e]);for(let e in Bl)e.length>2&&(t=t.replace(new RegExp(e,"g"),"\\"+e.slice(1)));let e="",i=!0;for(;t;){let r=t.indexOf("#color[");if(r<0&&i){e=t;break}if(i=!1,0!=r&&(e+=r<0?t:t.slice(0,r),r<0))break;if(r=(t=t.slice(r+7)).indexOf("]{"),r<=0)break;let s=parseInt(t.slice(0,r));if(!Number.isInteger(s))break;let a=n.getColor(s),o=1;for(t=t.slice(r+2),r=-1;o&&++rMathJax.tex2svgPromise(n,r))).then((n=>{let r=n.querySelector("svg");return e.append((()=>r)),function(t,e,i,n){let r=t=>{if(!t||"string"!=typeof t||t.length<3)return null;let e=t.indexOf("ex");return e<0||e!==t.length-2?null:(t=parseFloat(t.slice(0,e)),Number.isFinite(t)?t*n.font.size*.5:null)},s=r(i.getAttribute("width")),a=r(i.getAttribute("height")),o=i.getAttribute("style");if(o&&o.length>18&&0==o.indexOf("vertical-align:")){let t=o.indexOf("ex;");o=t>0&&t==o.length-3?r(o.slice(16,o.length-1)):null}else o=null;if(s=!s||s<=.5?1:Math.round(s),a=!a||a<=.5?1:Math.round(a),i.setAttribute("width",s),i.setAttribute("height",a),i.removeAttribute("style"),!c()){let t=Ml(e,"bbox");s=1.05*t.width,a=1.05*t.height}n.valign=o,n.scale&&t.scaleTextDrawing(Math.max(s/n.width,a/n.height),n.draw_g)}(t,e,r,i),i.applyAttributesToMathJax=th,!0}))}function ih(t,e){let i=Math.round(t*(e||255)).toString(16);return 1==i.length?"0"+i:i}let nh=[];function rh(){return nh}function sh(t){if(!t||"TColor"!=t._typename)return null;let e="#"+ih(t.fRed)+ih(t.fGreen)+ih(t.fBlue);switch(void 0!==t.fAlpha&&1!==t.fAlpha&&(e+=ih(t.fAlpha)),e){case"#ffffff":return"white";case"#000000":return"black";case"#ff0000":return"red";case"#00ff00":return"green";case"#0000ff":return"blue";case"#ffff00":return"yellow";case"#ff00ff":return"magenta";case"#00ffff":return"cyan"}return e}function ah(t,e){if(!t){t=[];for(let e=0;e=0&&n.fNumber<=1e4&&(i[n.fNumber]=sh(n)))}}for(let e=0;ei-1?i-1:n}getColor(t){return this.palette[t]}getLength(){return this.palette.length}calcColor(t,e){return this.getColor(this.calcColorIndex(t,e))}}!function(){let t=["white","black","red","green","blue","yellow","magenta","cyan","#59d454","#5954d9","white"];t[110]="white",[{n:11,s:"c1b7ad4d4d4d6666668080809a9a9ab3b3b3cdcdcde6e6e6f3f3f3cdc8accdc8acc3c0a9bbb6a4b3a697b8a49cae9a8d9c8f83886657b1cfc885c3a48aa9a1839f8daebdc87b8f9a768a926983976e7b857d9ad280809caca6c0d4cf88dfbb88bd9f83c89a7dc08378cf5f61ac8f94a6787b946971d45a549300ff7b00ff6300ff4b00ff3300ff1b00ff0300ff0014ff002cff0044ff005cff0074ff008cff00a4ff00bcff00d4ff00ecff00fffd00ffe500ffcd00ffb500ff9d00ff8500ff6d00ff5500ff3d00ff2600ff0e0aff0022ff003aff0052ff006aff0082ff009aff00b1ff00c9ff00e1ff00f9ff00ffef00ffd700ffbf00ffa700ff8f00ff7700ff6000ff4800ff3000ff1800ff0000"},{n:201,s:"5c5c5c7b7b7bb8b8b8d7d7d78a0f0fb81414ec4848f176760f8a0f14b81448ec4876f1760f0f8a1414b84848ec7676f18a8a0fb8b814ecec48f1f1768a0f8ab814b8ec48ecf176f10f8a8a14b8b848ecec76f1f1"},{n:390,s:"ffffcdffff9acdcd9affff66cdcd669a9a66ffff33cdcd339a9a33666633ffff00cdcd009a9a00666600333300"},{n:406,s:"cdffcd9aff9a9acd9a66ff6666cd66669a6633ff3333cd33339a3333663300ff0000cd00009a00006600003300"},{n:422,s:"cdffff9affff9acdcd66ffff66cdcd669a9a33ffff33cdcd339a9a33666600ffff00cdcd009a9a006666003333"},{n:590,s:"cdcdff9a9aff9a9acd6666ff6666cd66669a3333ff3333cd33339a3333660000ff0000cd00009a000066000033"},{n:606,s:"ffcdffff9affcd9acdff66ffcd66cd9a669aff33ffcd33cd9a339a663366ff00ffcd00cd9a009a660066330033"},{n:622,s:"ffcdcdff9a9acd9a9aff6666cd66669a6666ff3333cd33339a3333663333ff0000cd00009a0000660000330000"},{n:791,s:"ffcd9acd9a669a66339a6600cd9a33ffcd66ff9a00ffcd33cd9a00ffcd00ff9a33cd66006633009a3300cd6633ff9a66ff6600ff6633cd3300ff33009aff3366cd00336600339a0066cd339aff6666ff0066ff3333cd0033ff00cdff9a9acd66669a33669a009acd33cdff669aff00cdff339acd00cdff009affcd66cd9a339a66009a6633cd9a66ffcd00ff6633ffcd00cd9a00ffcd33ff9a00cd66006633009a3333cd6666ff9a00ff9a33ff6600cd3300ff339acdff669acd33669a00339a3366cd669aff0066ff3366ff0033cd0033ff339aff0066cd00336600669a339acd66cdff009aff33cdff009acd00cdffcd9aff9a66cd66339a66009a9a33cdcd66ff9a00ffcd33ff9a00cdcd00ff9a33ff6600cd33006633009a6633cd9a66ff6600ff6633ff3300cd3300ffff339acd00666600339a0033cd3366ff669aff0066ff3366cd0033ff0033ff9acdcd669a9a33669a0066cd339aff66cdff009acd009aff33cdff009a"},{n:920,s:"cdcdcd9a9a9a666666333333"}].forEach((e=>{let i=e.s;for(let n=0;n=0&&(this.style=e),void 0!==i&&(this.size=i),this._configure()}_configure(){if(this.x0=this.y0=0,1===this.style||777===this.style)return this.fill=!1,this.marker="h1",this.size=1,this.optimized=!0,this.resetPos(),!0;this.optimized=!1;let t=dh[this.style]??104,e=t%100;this.fill=t>=100,this.scale=this.refsize||8;let i=this.getFullSize();this.ndig=i>7?0:i>2?1:2,30==e&&this.ndig++;let n=i.toFixed(this.ndig),r=(i/2).toFixed(this.ndig),s=(i/3).toFixed(this.ndig),a=(i/4).toFixed(this.ndig),o=(i/8).toFixed(this.ndig),l=(3*i/8).toFixed(this.ndig);switch(e){case 1:this.marker="h1";break;case 2:this.y0=-i/2,this.marker=`v${n}m-${r},-${r}h${n}`;break;case 3:this.x0=this.y0=-i/2,this.marker=`l${n},${n}m0,-${n}l-${n},${n}m0,-${r}h${n}m-${r},-${r}v${n}`;break;case 4:this.x0=-parseFloat(r),n=(2*parseFloat(r)).toFixed(this.ndig),this.marker=`a${r},${r},0,1,0,${n},0a${r},${r},0,1,0,-${n},0z`;break;case 5:this.x0=this.y0=-i/2,this.marker=`l${n},${n}m0,-${n}l-${n},${n}`;break;case 6:this.x0=-1,this.marker="a1,1,0,1,0,2,0a1,1,0,1,0,-2,0z";break;case 7:this.x0=-1.5,this.marker="a1.5,1.5,0,1,0,3,0a1.5,1.5,0,1,0,-3,0z";break;case 25:this.x0=this.y0=-i/2,this.marker=`v${n}h${n}v-${n}z`;break;case 26:this.y0=-i/2,this.marker=`l-${r},${n}h${n}z`;break;case 27:default:this.y0=-i/2,this.marker=`l${s},${r}l-${s},${r}l-${s},-${r}z`;break;case 28:this.x0=this.y0=i/6,this.marker=`h${s}v-${s}h-${s}v-${s}h-${s}v${s}h-${s}v${s}h${s}v${s}h${s}z`;break;case 30:this.y0=-i/2;let t=(5*i/6).toFixed(this.ndig),e=(5*i/8).toFixed(this.ndig);this.marker=`l${s},${n}l-${t},-${e}h${n}l-${t},${e}z`;break;case 32:this.y0=i/2,this.marker=`l-${r},-${n}h${n}z`;break;case 35:this.x0=-i/2,this.marker=`l${r},${r}l${r},-${r}l-${r},-${r}zh${n}m-${r},-${r}v${n}`;break;case 36:this.x0=this.y0=-i/2,this.marker=`h${n}v${n}h-${n}zl${n},${n}m0,-${n}l-${n},${n}`;break;case 37:this.x0=-i/2,this.marker=`h${n}l-${a},-${r}l-${r},${n}h${r}l-${r},-${n}z`;break;case 38:this.x0=-i/4,this.y0=-i/2,this.marker=`h${r}l${a},${a}v${r}l-${a},${a}h-${r}l-${a},-${a}v-${r}zm${a},0v${n}m-${r},-${r}h${n}`;break;case 40:this.x0=-i/4,this.y0=-i/2,this.marker=`l${r},${n}l${a},-${a}l-${n},-${r}zm${r},0l-${r},${n}l-${a},-${a}l${n},-${r}z`;break;case 42:this.y0=-i/2,this.marker=`l${o},${l}l${l},${o}l-${l},${o}l-${o},${l}l-${o},-${l}l-${l},-${o}l${l},-${o}z`;break;case 44:this.x0=-i/4,this.y0=-i/2,this.marker=`h${r}l-${o},${l}l${l},-${o}v${r}l-${l},-${o}l${o},${l}h-${r}l${o},-${l}l-${l},${o}v-${r}l${l},${o}z`;break;case 46:this.x0=-i/4,this.y0=-i/2,this.marker=`l${a},${a}l${a},-${a}l${a},${a}l-${a},${a}l${a},${a}l-${a},${a}l-${a},-${a}l-${a},${a}l-${a},-${a}l${a},-${a}l-${a},-${a}z`;break;case 48:this.x0=-i/4,this.y0=-i/2,this.marker=`l${a},${a}l-${a},${a}l-${a},-${a}zm${r},0l${a},${a}l-${a},${a}l-${a},-${a}zm0,${r}l${a},${a}l-${a},${a}l-${a},-${a}zm-${r},0l${a},${a}l-${a},${a}l-${a},-${a}z`;break;case 49:this.x0=-i/6,this.y0=-i/2,this.marker=`h${s}v${s}h-${s}zm${s},${s}h${s}v${s}h-${s}zm-${s},${s}h${s}v${s}h-${s}zm-${s},-${s}h${s}v${s}h-${s}z`}return!0}getStrokeColor(){return this.stroke?this.color:"none"}getFillColor(){return this.fill?this.color:"none"}empty(){return"none"===this.color||!this.fill&&!this.stroke}apply(t){t.style("stroke",this.stroke?this.color:"none").style("fill",this.fill?this.color:"none")}verifyDirectChange(){this.change(this.color,parseInt(this.style),parseFloat(this.size))}createSample(t,e,i,n){n&&(t=$i(t)),this.resetPos(),t.append("path").attr("d",this.create(e/2,i/2)).call(this.func)}}class fh{constructor(t){this.color="none",this.colorindx=0,this.pattern=0,this.used=!0,this.kind=t.kind||2,this.changed=!1,this.func=this.apply.bind(this),this.setArgs(t),this.changed=!1}setArgs(t){t.attr&&"object"==typeof t.attr&&(void 0===t.pattern&&void 0!==t.attr.fFillStyle&&(t.pattern=t.attr.fFillStyle),void 0===t.color&&void 0!==t.attr.fFillColor&&(t.color=t.attr.fFillColor));let e=this.changed;this.change(t.color,t.pattern,t.svg,t.color_as_svg,t.painter),this.changed=e}apply(t){this.used=!0,t.style("fill",this.getFillColor()),"opacity"in this&&t.style("opacity",this.opacity),"antialias"in this&&t.style("antialias",this.antialias)}getFillColor(){return this.pattern_url||this.color}getFillColorAlt(t){return this.color&&"none"!=this.color?this.color:t}empty(){let t=this.getFillColor();return!t||"none"==t}hasColor(){return this.color&&"none"!=this.color}setSolidColor(t){delete this.pattern_url,this.color=t,this.pattern=1001}isSolid(t){return 1001===this.pattern&&(!t||t==this.color)}verifyDirectChange(t){"string"==typeof this.pattern&&(this.pattern=parseInt(this.pattern)),Number.isInteger(this.pattern)||(this.pattern=0),this.change(this.color,this.pattern,t?t.getCanvSvg():null,!0,t)}change(t,e,i,n,r){if(delete this.pattern_url,this.changed=!0,void 0!==t&&Number.isInteger(parseInt(t))&&!n&&(this.colorindx=parseInt(t)),void 0!==e&&Number.isInteger(parseInt(e))&&(this.pattern=parseInt(e),delete this.opacity,delete this.antialias),1e3==this.pattern&&0===this.colorindx)return this.pattern_url="white",!0;if(1e3==this.pattern&&(this.pattern=1001),this.pattern<1001)return this.pattern_url="none",!0;if(this.isSolid()&&0===this.colorindx&&1===this.kind&&!n)return this.pattern_url="none",!0;let s=this.colorindx;if(n?(this.color=t,"none"!=t&&(s=dt(t).hex().slice(1))):this.color=r?r.getColor(s):lh(s),"string"!=typeof this.color&&(this.color="none"),this.isSolid())return!0;if(this.pattern>=4e3&&this.pattern<=4100)return this.opacity=(this.pattern-4e3)/100,!0;if(!i||i.empty()||this.pattern<3e3||"none"==this.color)return!1;let a=`pat_${this.pattern}_${s}`,o=i.select(".canvas_defs");if(o.empty()&&(o=i.insert("svg:defs",":first-child").attr("class","canvas_defs")),this.pattern_url=`url(#${a})`,this.antialias=!1,!o.select("."+a).empty())return!0;let l="",h=null,c="",d="",u=2,f=2;switch(this.pattern){case 3001:u=f=2,c="M0,0h1v1h-1zM1,1h1v1h-1z";break;case 3002:u=4,f=2,c="M1,0h1v1h-1zM3,1h1v1h-1z";break;case 3003:u=f=4,c="M2,1h1v1h-1zM0,3h1v1h-1z";break;case 3004:u=f=8,l="M8,0L0,8";break;case 3005:u=f=8,l="M0,0L8,8";break;case 3006:u=f=4,l="M1,0v4";break;case 3007:u=f=4,l="M0,1h4";break;case 3008:u=f=10,c="M0,3v-3h3ZM7,0h3v3ZM0,7v3h3ZM7,10h3v-3ZM5,2l3,3l-3,3l-3,-3Z",l="M0,3l5,5M3,10l5,-5M10,7l-5,-5M7,0l-5,5";break;case 3009:u=12,f=12,l="M0,0A6,6,0,0,0,12,0M6,6A6,6,0,0,0,12,12M6,6A6,6,0,0,1,0,12",h="none";break;case 3010:u=f=10,l="M0,2h10M0,7h10M2,0v2M7,2v5M2,7v3";break;case 3011:u=9,f=18,l="M5,0v8M2,1l6,6M8,1l-6,6M9,9v8M6,10l3,3l-3,3M0,9v8M3,10l-3,3l3,3",h="none";break;case 3012:u=10,f=20,l="M5,1A4,4,0,0,0,5,9A4,4,0,0,0,5,1M0,11A4,4,0,0,1,0,19M10,11A4,4,0,0,0,10,19",h="none";break;case 3013:u=f=7,l="M0,0L7,7M7,0L0,7",h="none";break;case 3014:u=f=16,l="M0,0h16v16h-16v-16M0,12h16M12,0v16M4,0v8M4,4h8M0,8h8M8,4v8",h="none";break;case 3015:u=6,f=12,l="M2,1A2,2,0,0,0,2,5A2,2,0,0,0,2,1M0,7A2,2,0,0,1,0,11M6,7A2,2,0,0,0,6,11",h="none";break;case 3016:u=12,f=7,l="M0,1A3,2,0,0,1,3,3A3,2,0,0,0,9,3A3,2,0,0,1,12,1",h="none";break;case 3017:u=f=4,l="M3,1l-2,2";break;case 3018:u=f=4,l="M1,1l2,2";break;case 3019:u=f=12,l="M1,6A5,5,0,0,0,11,6A5,5,0,0,0,1,6h-1h1A5,5,0,0,1,6,11v1v-1A5,5,0,0,1,11,6h1h-1A5,5,0,0,1,6,1v-1v1A5,5,0,0,1,1,6",h="none";break;case 3020:u=7,f=12,l="M1,0A2,3,0,0,0,3,3A2,3,0,0,1,3,9A2,3,0,0,0,1,12",h="none";break;case 3021:u=f=8,l="M8,2h-2v4h-4v2M2,0v2h-2",h="none";break;case 3022:u=f=8,l="M0,2h2v4h4v2M6,0v2h2",h="none";break;case 3023:u=f=8,c="M4,0h4v4zM8,4v4h-4z",d="M4,0L0,4L4,8L8,4Z";break;case 3024:u=f=16,c="M0,8v8h2v-8zM8,0v8h2v-8M4,14v2h12v-2z",d="M0,2h8v6h4v-6h4v12h-12v-6h-4z";break;case 3025:u=f=18,c="M5,13v-8h8ZM18,0v18h-18l5,-5h8v-8Z";break;default:if(this.pattern>3025&&this.pattern<3100){u=4,f=2,c="M1,0h1v1h-1zM3,1h1v1h-1z";break}let t=this.pattern%1e3,e=t%10,i=(t-e)%100/10,n=(t-10*i-e)/100;if(!n)break;let r,s,a,o,m,p,g,x=n*(6*Math.round(2*Math.max(.5,_.fHatchesSpacing)));u=f=6*x;const y=(t,e)=>{for(r=[],s=x,m=0,g=f,Math.abs(t)<3&&(s=Math.round(x/12*9)),0==t?(s=Math.round(x/12*8),m=s/2):t>0?g-=s:m=s;m<=g;)p=m+t*s,p<0?(o=Math.round(m/(m-p)*u),r.push(0,m,o,0),r.push(u,f-m,u-o,f)):p>f?(o=Math.round((f-m)/(p-m)*u),r.push(0,m,o,f),r.push(u,f-m,u-o,0)):r.push(0,m,u,p),m+=s;for(let t=0;t=0&&(_[t]=e)}e&&(_[e]=this.pattern)}}const mh=["","","3,3","1,2","3,4,1,4","5,3,1,3","5,3,1,3,1,3,1,3","5,5","5,3,1,3,1,3","20,5","20,10,1,10","1,3"];class ph{constructor(t){this.func=this.apply.bind(this),this.used=!0,t._typename&&void 0!==t.fLineStyle&&(t={attr:t}),this.setArgs(t)}setArgs(t){t.attr?(this.color_index=t.attr.fLineColor,t.color=t.color0||(t.painter?t.painter.getColor(this.color_index):lh(this.color_index)),void 0===t.width&&(t.width=t.attr.fLineWidth),void 0===t.style&&(t.style=t.attr.fLineStyle)):"string"==typeof t.color?"none"===t.color||t.width||(t.width=1):"number"==typeof t.color&&(this.color_index=t.color,t.color=t.painter?t.painter.getColor(t.color):lh(t.color)),void 0===t.width&&(t.width=t.color&&"none"!=t.color?1:0),this.color=0===t.width?"none":t.color,this.width=t.width,this.style=t.style,this.pattern=t.pattern||mh[this.style]||null,t.can_excl&&(this.excl_side=this.excl_width=0,Math.abs(this.width)>99&&(this.excl_side=this.width<0?-1:1,this.excl_width=5*Math.floor(this.width/100),this.width=Math.abs(this.width%100))),!this.color&&this.width>0&&(this.color="lightgrey")}changeExcl(t,e){void 0!==e&&(this.excl_width=e),void 0!==t&&(this.excl_side=t,0===this.excl_width&&0!==this.excl_side&&(this.excl_width=20)),this.changed=!0}empty(){return"none"==this.color}setBorder(t,e){this.rx=t,this.ry=e,this.func=this.applyBorder.bind(this)}apply(t){this.used=!0,this.empty()?t.style("stroke",null).style("stroke-width",null).style("stroke-dasharray",null):t.style("stroke",this.color).style("stroke-width",this.width).style("stroke-dasharray",this.pattern)}applyBorder(t){this.used=!0,this.empty()?t.style("stroke",null).style("stroke-width",null).style("stroke-dasharray",null).attr("rx",null).attr("ry",null):t.style("stroke",this.color).style("stroke-width",this.width).style("stroke-dasharray",this.pattern).attr("rx",this.rx||null).attr("ry",this.ry||null)}change(t,e,i){void 0!==t&&(this.color!==t&&delete this.color_index,this.color=t),void 0!==e&&(this.width=e),void 0!==i&&(this.style=i,this.pattern=mh[this.style]||null),this.changed=!0}createSample(t,e,i,n){n&&(t=$i(t)),t.append("path").attr("d",`M0,${i/2}h${e}`).call(this.func)}saveToStyle(t,e,i){if(t){let e=void 0!==this.color_index?this.color_index:hh(this.color);e>=0&&(_[t]=e)}e&&(_[e]=this.width),i&&(_[i]=this.style)}}function gh(t){return(t<0||t>=mh.length)&&(t=11),mh[t]}class _h extends zl{constructor(t,e,i){super(t),this.pad_name=t?this.selectCurrentPad():"",this.assignObject(e),"string"==typeof i&&(this.options={original:i})}assignObject(t){t&&"object"==typeof t?this.draw_object=t:delete this.draw_object}setPadName(t){this.pad_name="string"==typeof t?t:this.selectCurrentPad()}getPadName(){return this.pad_name||""}assignSnapId(t){this.snapid=t}cleanup(){this.removeG();let t=!0;if(this.isMainPainter()){let e=this.getPadPainter();e&&!1!==e.normal_canvas||(t=!1)}delete this.pad_name,delete this._main_painter,this.draw_object=null,delete this.snapid,delete this.fillatt,delete this.lineatt,delete this.markeratt,delete this.bins,delete this.root_colors,delete this.options,delete this.options_store,delete this.rstyle,delete this.csstype,super.cleanup(t)}getObject(){return this.draw_object}getClassName(){return this.getObject()?._typename||""}matchObjectType(t){return!(!t||!this.draw_object)&&("string"==typeof t?this.draw_object._typename===t:t._typename?this.draw_object._typename===t._typename:this.draw_object._typename.match(t))}setItemName(t,e,i){if(super.setItemName(t,e,i),this.no_default_title||!t)return;let n=this.getCanvSvg();n.empty()?this.selectDom().attr("title",t):n.select("title").text(t);let r=this.getCanvPainter();r&&(r===this||this.isMainPainter()&&r===this.getPadPainter())&&r.drawItemNameOnCanvas(t)}storeDrawOpt(t){if(!this.options)return;t||(t="");let e=t.indexOf(";;");e>=0&&(t=t.slice(0,e)),this.options.original=t,this.options_store=Object.assign({},this.options)}getDrawOpt(){if(!this.options)return"";if("function"==typeof this.options.asString){let t=!1,e=this.getPadPainter();if(!this.options_store||e?._interactively_changed)t=!0;else for(let e in this.options)this.options[e]!==this.options_store[e]&&(t=!0);if(t)return this.options.asString(this.isMainPainter(),e?.getRootPad())}return this.options.original||""}getSupportedDrawOptions(){let t=this.getPadPainter(),e=this.getObject();return e?._typename&&t?.getObjectDrawSettings?t.getObjectDrawSettings("ROOT."+e._typename,"nosame")?.opts:[]}redrawObject(t,e){if(!this.updateObject(t,e))return!1;let i=document.body.style.cursor;document.body.style.cursor="wait";let n=this.redrawPad();return document.body.style.cursor=i,n||!0}updateObject(t){return!!this.matchObjectType(t)&&(Object.assign(this.getObject(),t),!0)}getObjectHint(){let t=this.getItemName(),e=this.getObject();return t||(t=e&&e.fName?e.fName:""),t||(t=this.getClassName()),t.length>20&&(t=t.slice(0,17)+"..."),t}getColor(t){return this.root_colors||(this.root_colors=this.getCanvPainter()?.root_colors||rh()),this.root_colors[t]}addColor(t){this.root_colors||(this.root_colors=this.getCanvPainter()?.root_colors||rh());let e=this.root_colors.indexOf(t);return e>=0?e:(this.root_colors.push(t),this.root_colors.length-1)}isTooltipAllowed(){return!!(this.getCanvPainter()||this).tooltip_allowed}setTooltipAllowed(t){void 0===t&&(t=!0);let e=this.getCanvPainter()||this;e.tooltip_allowed="toggle"==t?!e.tooltip_allowed:t}checkResize(t){let e=this.getCanvPainter();return!!e&&(e.checkCanvasResize(t),!0)}removeG(){this.draw_g&&(this.draw_g.remove(),delete this.draw_g)}getG(){return this.draw_g}createG(t){let e;if(t){let i=this.getFrameSvg();if(i.empty())return console.error("Not found frame to create g element inside"),i;"string"!=typeof t&&(t="main_layer"),e=i.select("."+t)}else e=this.getLayerSvg("primitives_layer");return this.draw_g&&this.draw_g.node().parentNode!==e.node()&&(console.log("g element changes its layer!!"),this.removeG()),this.draw_g?this.draw_g.selectAll("*").remove():(this.draw_g=e.append("svg:g"),t||e.selectChildren(".most_upper_primitives").raise()),this.draw_object&&(this.draw_g.attr("objname",(this.draw_object.fName||"name").replace(/[^\w]/g,"_")),this.draw_g.attr("objtype",(this.draw_object._typename||"type").replace(/[^\w]/g,"_"))),this.draw_g.property("in_frame",!!t),this.draw_g}getCanvSvg(){return this.selectDom().select(".root_canvas")}getPadSvg(t){void 0===t&&(t=this.pad_name);let e=this.getCanvSvg();if(!t||e.empty())return e;let i=e.property("pad_painter");return i&&i.pads_cache&&i.pads_cache[t]?$i(i.pads_cache[t]):(e=e.select(".primitives_layer .__root_pad_"+t),i&&(i.pads_cache||(i.pads_cache={}),i.pads_cache[t]=e.node()),e)}getLayerSvg(t,e){let i=this.getPadSvg(e);if(i.empty())return i;0==t.indexOf("prim#")&&(i=i.select(".primitives_layer"),t=t.slice(5));let n=i.node().firstChild;for(;n;){let e=$i(n);if(e.classed(t))return e;n=n.nextSibling}return $i(null)}selectCurrentPad(t){let e=this.getCanvSvg();if(e.empty())return"";let i=e.property("current_pad");return void 0!==t&&e.property("current_pad",t),i}getPadPainter(t){let e=this.getPadSvg("string"==typeof t?t:void 0);return e.empty()?null:e.property("pad_painter")}getCanvPainter(){let t=this.getCanvSvg();return t.empty()?null:t.property("pad_painter")}getAxisToSvgFunc(t,e){let i={isndc:t,nornd:e},n=this.draw_g&&this.draw_g.property("in_frame");if(n&&(i.main=this.getFramePainter()),i.main?.grx&&i.main?.gry)e?(i.x=function(t){return this.main.grx(t)},i.y=function(t){return this.main.gry(t)}):(i.x=function(t){return Math.round(this.main.grx(t))},i.y=function(t){return Math.round(this.main.gry(t))});else if(n)console.error("Problem to create functor for",this.getClassName()),i.x=()=>0,i.y=()=>0;else{let e=this.getPadPainter();t||(i.pad=e?.getRootPad(!0)),i.padw=e?.getPadWidth()??10,i.x=function(t){return this.pad&&(this.pad.fLogx&&(t=t>0?Math.log10(t):this.pad.fUxmin),t=(t-this.pad.fX1)/(this.pad.fX2-this.pad.fX1)),t*=this.padw,this.nornd?t:Math.round(t)},i.padh=e?.getPadHeight()??10,i.y=function(t){return this.pad&&(this.pad.fLogy&&(t=t>0?Math.log10(t):this.pad.fUymin),t=(t-this.pad.fY1)/(this.pad.fY2-this.pad.fY1)),t=(1-t)*this.padh,this.nornd?t:Math.round(t)}}return i}axisToSvg(t,e,i,n){return this.getAxisToSvgFunc(i,n)[t](e)}svgToAxis(t,e,i){if(this.draw_g&&this.draw_g.property("in_frame")){return this.getFramePainter()?.revertAxis(t,e)??0}let n=this.getPadPainter(),r=n?"y"==t?1-e/n.getPadHeight():e/n.getPadWidth():0,s=i||!n?null:n.getRootPad(!0);return s&&("y"==t?(r=s.fY1+r*(s.fY2-s.fY1),s.fLogy&&(r=Math.pow(10,r))):(r=s.fX1+r*(s.fX2-s.fX1),s.fLogx&&(r=Math.pow(10,r)))),r}getFrameSvg(t){let e=this.getLayerSvg("primitives_layer",t);if(e.empty())return e;let i=e.node().firstChild;for(;i;){let t=$i(i);if(t.classed("root_frame"))return t;i=i.nextSibling}return $i(null)}getFramePainter(){return this.getPadPainter()?.getFramePainter()}getMainPainter(t){let e=this._main_painter;if(!e){let i=this.getPadPainter();e=i?i.getMainPainter():this.getTopPainter(),e||(e=null),t||(this._main_painter=e)}return e}isMainPainter(){return this===this.getMainPainter()}setAsMainPainter(t){let e=this.getPadPainter();e?e.setMainPainter(this,t):this.setTopPainter()}addToPadPrimitives(t){void 0!==t&&this.setPadName(t);let e=this.getPadPainter(t);return!(!e||e===this)&&(e.painters.indexOf(this)<0&&e.painters.push(this),!this.rstyle&&e.next_rstyle&&(this.rstyle=e.next_rstyle),!0)}removeFromPadPrimitives(){let t=this.getPadPainter();if(!t||t===this)return!1;let e=t.painters.indexOf(this);return e>=0&&t.painters.splice(e,1),!0}createAttMarker(t){t&&"object"==typeof t?void 0!==t.fMarkerColor&&void 0!==t.fMarkerStyle&&void 0!==t.fMarkerSize&&(t={attr:t,std:!1}):t={std:!0},void 0===t.std&&(t.std=!0),void 0===t.painter&&(t.painter=this);let e=t.std?this.markeratt:null;return e?e.changed&&!t.force||e.setArgs(t):e=new uh(t),t.std&&(this.markeratt=e),e}createAttLine(t){t&&"object"==typeof t?void 0!==t.fLineColor&&void 0!==t.fLineStyle&&void 0!==t.fLineWidth&&(t={attr:t,std:!1}):t={std:!0},void 0===t.std&&(t.std=!0),void 0===t.painter&&(t.painter=this);let e=t.std?this.lineatt:null;return e?e.changed&&!t.force||e.setArgs(t):e=new ph(t),t.std&&(this.lineatt=e),e}createAttFill(t){t&&"object"==typeof t?t._typename&&void 0!==t.fFillColor&&void 0!==t.fFillStyle&&(t={attr:t,std:!1}):t={std:!0},void 0===t.std&&(t.std=!0);let e=t.std?this.fillatt:null;return t.svg||(t.svg=this.getCanvSvg()),void 0===t.painter&&(t.painter=this),e?e.changed&&!t.force||e.setArgs(t):e=new fh(t),t.std&&(this.fillatt=e),e}forEachPainter(t,e){let i=this.getPadPainter();if(i)i.forEachPainterInPad(t,e);else{let i=this.getTopPainter();i&&"pads"!==e&&t(i)}}async interactiveRedraw(t,e,i){let n,r;return"string"==typeof e&&0!=e.indexOf("exec:")&&(n=e),"pad"==t?r=this.redrawPad(n):!1!==t&&(r=this.redraw(n)),H(r)||(r=Promise.resolve(!1)),r.then((()=>{let t=this.getCanvPainter();return"function"==typeof t?.producePadEvent&&t.producePadEvent("redraw",this.getPadPainter(),this,null,i),"function"==typeof t?.processChanges&&t.processChanges(e,this,i),this}))}async redrawPad(t){let e=this.getPadPainter();return!!e&&e.redrawPad(t)}executeMenuCommand(t){return"Inspect"==t.fName&&this.showInspector()}submitCanvExec(t,e){if(!t||"string"!=typeof t)return;let i=this.getCanvPainter();"function"==typeof i?.submitExec&&i.submitExec(this,t,e)}deleteAttr(){delete this.lineatt,delete this.fillatt,delete this.markeratt}showInspector(){return!1}fillContextMenu(t){let e=this.getObjectHint();return this.getObject()&&"_typename"in this.getObject()&&(e=this.getObject()._typename+"::"+e),t.add("header:"+e),t.addAttributesMenu(this),t.size()>0&&this.showInspector("check")&&t.add("Inspect",this.showInspector),t.size()>0}showObjectStatus(t,e,i,n){let r=this.getCanvPainter();if(r&&"function"!=typeof r.showCanvasStatus&&(r=null),!r&&"function"!=typeof s.showStatus)return!1;if("on"===this.enlargeMain("state"))return!1;if(void 0===t&&void 0===e){let n=this.getObject();if(!n)return;t=this.getItemName()||n.fName,e=n.fTitle||n._typename,i=n._typename}r?r.showCanvasStatus(t,e,i,n):s.showStatus(t,e,i,n)}redraw(){}startTextDrawing(t,e,i,n){if(i||(i=this.draw_g),!i||i.empty())return;let r="font"===e?t:new Rl(t,e),s=this.getPadPainter();i.call(r.func),i.property("draw_text_completed",!1).property("all_args",[]).property("text_font",r).property("text_factor",0).property("max_text_width",0).property("max_font_size",n).property("_fast_drawing",s?._fast_drawing||!1),i.property("_fast_drawing")&&i.property("_font_too_small",n&&n<5||r.size<4)}scaleTextDrawing(t,e){e||(e=this.draw_g),e&&!e.empty()&&t&&t>e.property("text_factor")&&e.property("text_factor",t)}_checkAllTextDrawing(t,e,i){let n=t.property("all_args"),r=0;if(n||(console.log("Text drawing is finished - why calling _checkAllTextDrawing?????"),n=[]),n.forEach((t=>{t.ready||r++})),r>0)return void("function"==typeof e&&(t.node().textResolveFunc=e,t.node().try_optimize=i));t.property("all_args",null);let s=t.property("text_factor"),a=t.property("text_font"),o=t.property("max_font_size"),l=a.size,h=!1,d=!0;s>0&&(s<.9||s>1)&&(a.size=Math.max(1,Math.floor(a.size/s))),o&&a.size>o&&(a.size=o),a.size!=l&&(t.call(a.func),l=a.size),n.forEach((t=>{if(t.mj_node&&t.applyAttributesToMathJax){let e=t.mj_node.select("svg");t.applyAttributesToMathJax(this,t.mj_node,e,t,l,s),delete t.mj_node,d=!1}else t.txt_g&&(d=!1)})),e||(e=t.node().textResolveFunc,i=t.node().try_optimize,delete t.node().textResolveFunc,delete t.node().try_optimize);let u=i&&d?[]:null;n.forEach((t=>{let e,i,n=1;if(t.txt_node)e=t.txt_node,delete t.txt_node,i=!0,null!==u&&u.push(e);else{if(!t.txt_g)return;e=t.txt_g,delete t.txt_g,i=!1}if(e.attr("visibility",null),h=!0,t.width&&("middle"==t.align[0]?t.x+=t.width/2:"end"==t.align[0]&&(t.x+=t.width)),t.height&&(0===t.align[1].indexOf("bottom")?t.y+=t.height:"middle"==t.align[1]&&(t.y+=t.height/2)),t.dx=t.dy=0,i)c()?t.scale&&s>0&&(t.box.width*=1/s,t.box.height*=1/s):t.plain||t.fast||(t.box=Ml(e,"bbox")),t.plain?(e.attr("text-anchor",t.align[0]),"top"==t.align[1]?e.attr("dy",".8em"):"middle"==t.align[1]&&(c()?e.attr("dy",".4em"):e.attr("dominant-baseline","middle"))):(e.attr("text-anchor","start"),t.dx=("middle"==t.align[0]?-.5:"end"==t.align[0]?-1:0)*t.box.width,t.dy=("top"==t.align[1]?t.top_shift||1:"middle"==t.align[1]?t.mid_shift||.5:0)*t.box.height);else if(t.text_rect){let e=t.text_rect;n=s>0&&Math.abs(1-s)>.01?1/s:1,t.dx=("middle"==t.align[0]?-.5:"end"==t.align[0]?-1:0)*e.width*n,"top"==t.align[1]?t.dy=-e.y1*n:"bottom"==t.align[1]?t.dy=-e.y2*n:"middle"==t.align[1]&&(t.dy=-.5*(e.y1+e.y2)*n)}else console.error("text rect not calcualted - please check code");t.rotate||(t.x+=t.dx,t.y+=t.dy,t.dx=t.dy=0);let r="";t.y?r=`translate(${Math.round(t.x)},${Math.round(t.y)})`:t.x&&(r=`translate(${Math.round(t.x)})`),t.rotate&&(r+=` rotate(${Math.round(t.rotate)})`),1!==n&&(r+=` scale(${n.toFixed(3)})`),t.dy?r+=` translate(${Math.round(t.dx)},${Math.round(t.dy)})`:t.dx&&(r+=` translate(${Math.round(t.dx)})`),r&&e.attr("transform",r)})),h||a.clearFont(t),null!==u&&u.length>1&&["fill","text-anchor"].forEach((e=>{let i=u[0].attr(e);u.forEach((t=>{let n=t.attr(e);n&&n===i||(i=void 0)})),i&&(t.attr(e,i),u.forEach((t=>{t.attr(e,null)})))})),e&&e(this)}_postprocessDrawText(t,e){return t.box=c()||g.ApproxTextSize||t.fast?t.text_rect||{height:1.2*t.font_size,width:t.text.length*t.font_size*t.font.aver_width}:Ml(e,"bbox"),e.attr("visibility","hidden"),t.box.width>t.draw_g.property("max_text_width")&&t.draw_g.property("max_text_width",t.box.width),t.scale&&this.scaleTextDrawing(Math.max(1.05*t.box.width/t.width,1*t.box.height/t.height),t.draw_g),t.result_width=t.box.width,t.result_height=t.box.height,"function"==typeof t.post_process&&t.post_process(this),t.box.width}drawText(t){if(t.text||(t.text=""),t.draw_g=t.draw_g||this.draw_g,!t.draw_g||t.draw_g.empty())return;let e=t.draw_g.property("text_font");t.font=e,e&&(e.color&&!t.color&&(t.color=e.color),e.align&&!t.align&&(t.align=e.align),e.angle&&!t.rotate&&(t.rotate=e.angle));let i=["start","middle"];if("string"==typeof t.align?(i=t.align.split(";"),1==i.length&&i.push("middle")):"number"==typeof t.align?(t.align/10>=3?i[0]="end":t.align/10>=2&&(i[0]="middle"),t.align%10==0?i[1]="bottom":t.align%10==1?i[1]="bottom-base":t.align%10==3&&(i[1]="top")):t.align&&"object"==typeof t.align&&2==t.align.length&&(i=t.align),void 0===t.latex&&(t.latex=1),t.align=i,t.x=t.x||0,t.y=t.y||0,t.scale=t.width&&t.height&&!t.font_size,t.width=t.width||0,t.height=t.height||0,t.draw_g.property("_fast_drawing"))if(t.scale){if(t.height<4)return 0}else if(t.font_size){if(t.font_size<4)return 0}else if(t.draw_g.property("_font_too_small"))return 0;t.draw_g.property("all_args").push(t),t.ready=!1;let n=2==t.latex;return 1===t.latex&&(n=g.Latex==p.Latex.AlwaysMathJax||g.Latex==p.Latex.MathJax&&t.text.match(/[#{\\]/g)||t.text.match(/[\\]/g)),!n||t.nomathjax?(t.txt_node=t.draw_g.append("svg:text"),t.color&&t.txt_node.attr("fill",t.color),t.font_size?t.txt_node.attr("font-size",t.font_size):t.font_size=e.size,t.plain=!t.latex||g.Latex==p.Latex.Off||g.Latex==p.Latex.Symbols,t.simple_latex=t.latex&&g.Latex==p.Latex.Symbols,!t.plain||t.simple_latex||t.font&&t.font.isSymbol?(t.simple_latex||(!(r=t.text)||r.indexOf("#")<0&&r.indexOf("{")<0)||t.plain?(t.simple_latex=!0,function(t,e,i){i.plain=!0,i.simple_latex&&(i.text=Nl(i.text)),i.font&&i.font.isSymbol?e.text(Xl(i.text,i.font.isSymbol)):e.text(i.text)}(0,t.txt_node,t)):(t.txt_node.remove(),delete t.txt_node,t.txt_g=t.draw_g.append("svg:g"),Vl(this,t.txt_g,t)),t.ready=!0,this._postprocessDrawText(t,t.txt_g||t.txt_node),t.draw_g.property("draw_text_completed")&&this._checkAllTextDrawing(t.draw_g),0):(t.plain=!0,t.txt_node.text(t.text),t.ready=!0,this._postprocessDrawText(t,t.txt_node))):(t.mj_node=t.draw_g.append("svg:g").attr("visibility","hidden"),eh(this,t.mj_node,t).then((()=>{t.ready=!0,t.draw_g.property("draw_text_completed")&&this._checkAllTextDrawing(t.draw_g)})),0);var r}async finishTextDrawing(t,e){return t||(t=this.draw_g),!(!t||t.empty())&&(t.property("draw_text_completed",!0),new Promise((i=>{this._checkAllTextDrawing(t,i,e)})))}configureUserContextMenu(t){t&&"function"==typeof t?this._userContextMenuFunc=t:delete this._userContextMenuFunc}async fillObjectExecMenu(t,e){if(this._userContextMenuFunc)return this._userContextMenuFunc(t,e);let i=this.getCanvPainter();if(!this.snapid||!i||i?._readonly||!i?._websocket)return t;function n(i){let n=this.exec_painter||this,r=n.getCanvPainter(),s=n.args_menu_items[parseInt(i)];if(s&&s.fName)if("Show:Editor"!=s.fExec){if(("function"!=typeof r?.executeObjectMethod||!r.executeObjectMethod(n,s,n.args_menu_id))&&!n.executeMenuCommand(s)&&n.args_menu_id){if(!s.fArgs)return r?.v7canvas?r.submitExec(n,s.fExec,e):n.submitCanvExec(s.fExec,n.args_menu_id);s.fClassName=n.getClassName(),(n.args_menu_id.indexOf("#x")>0||n.args_menu_id.indexOf("#y")>0||n.args_menu_id.indexOf("#z")>0)&&(s.fClassName="TAxis"),t.showMethodArgsDialog(s).then((t=>{if(!t)return;if(n.executeMenuCommand(s,t))return;let i=s.fExec.slice(0,s.fExec.length-1)+t+")";r?.v7canvas?r.submitExec(n,i,e):r&&r.sendWebsocket("OBJEXEC:"+n.args_menu_id+":"+i)}))}}else"function"==typeof r?.activateGed&&r.activateGed(n)}const r=(t,e,i,r)=>{if(this._got_menu)return;this._got_menu=!0,r&&e!==r.fId&&console.error(`missmatch between request ${e} and reply ${r.fId} identifiers`);let s=r?r.fItems:null;if(s&&s.length){let e;t.size()>0&&t.add("separator"),this.args_menu_items=s,this.args_menu_id=r.fId;for(let i=0;i0?e.slice(i+2):e;t.add("sub:"+n.replace(/[<>]/g,"_"))}void 0===r.fChecked||r.fChecked<0?t.add(r.fName,i,n):t.addchk(r.fChecked,r.fName,i,n)}e&&t.add("endsub:")}i(t)};let s=this.snapid;return e&&(s+="#"+e),this._got_menu=!1,t.painter&&(t.painter.exec_painter=t.painter!==this?this:void 0),new Promise((n=>{setTimeout((()=>r(t,s,n)),2e3),i.submitMenuRequest(this,e,s).then((e=>r(t,s,n,e)))}))}configureUserTooltipHandler(t,e){t&&"function"==typeof t?(this._user_tooltip_handler=t,this._user_tooltip_timeout=e||100):(delete this._user_tooltip_handler,delete this._user_tooltip_timeout)}configureUserClickHandler(t){let e=this.getFramePainter();"function"==typeof e?.configureUserClickHandler&&e.configureUserClickHandler(t)}configureUserDblclickHandler(t){let e=this.getFramePainter();"function"==typeof e?.configureUserDblclickHandler&&e.configureUserDblclickHandler(t)}hasUserTooltip(){return"function"==typeof this._user_tooltip_handler}provideUserTooltip(t){if(!this.hasUserTooltip())return;if(this._user_tooltip_timeout<=0)return this._user_tooltip_handler(t);if(this._user_tooltip_handle&&(clearTimeout(this._user_tooltip_handle),delete this._user_tooltip_handle),!t)return this._user_tooltip_handler(t);let e=t;this._user_tooltip_handle=setTimeout((()=>{delete this._user_tooltip_handle,this._user_tooltip_handler&&this._user_tooltip_handler(e)}),this._user_tooltip_timeout)}async provideSpecialDrawArea(t){return t==this._special_draw_area||this.getCanvPainter().toggleProjection(t).then((()=>(this._special_draw_area=t,!0)))}async drawInSpecialArea(t,e){let i=this.getCanvPainter();return!(!this._special_draw_area||"function"!=typeof i?.drawProjection)&&i.drawProjection(this._special_draw_area,t,e)}getToolTip(t){if(void 0===t?.clientX||void 0===t?.clientY)return null;let e=this.getFrameSvg();if(e.empty())return null;let i=e.select(".main_layer");if(i.empty())return null;let n=Zi(t,i.node()),r={touch:!1,x:n[0],y:n[1]};if("function"==typeof this.extractToolTip)return this.extractToolTip(r);r.disabled=!0;let s="function"==typeof this.processTooltipEvent?this.processTooltipEvent(r):null;return s?.user_info||s}}function xh(t,e){let i=new zl(t);return i.txt=e,i.redrawObject=function(t){return this.txt=t,this.drawText(),!0},i.drawText=async function(){let t=this.txt._typename&&"TObjString"==this.txt._typename?this.txt.fString:this.txt.value;"string"!=typeof t&&(t="");let e=this.txt.mathjax||g.Latex==p.Latex.AlwaysMathJax;if(!e&&!("as_is"in this.txt)){let e=t.split("\n");t="";for(let i=0;i"+e[i]+""}let i=this.selectDom(),n=i.select("div");return n.empty()&&(n=i.append("div").attr("style","max-width:100%;max-height:100%;overflow:auto")),n.html(t),this.setTopPainter(),e&&async function(t){Wl().then((()=>MathJax.typesetPromise(t?[t]:void 0)))}(i.node()),this},i.drawText()}function yh(t){return new _h(t).getCanvPainter()}function Ah(t){return new _h(t).getMainPainter(!0)}let vh=null;function bh(t){if(t.active){let e=vh?vh.getFramePainter():null;e&&e.setFrameActive(!1),vh=t.pp,e=vh?vh.getFramePainter():null,e&&e.setFrameActive(!0)}else vh===t.pp&&(vh=null)}function wh(){return vh}function Mh(t,e){!0===e?e={force:!0}:"object"!=typeof e&&(e=null);let i=!1;return new _h(t).forEachPainter((t=>{i||"function"!=typeof t.checkResize||(i=t.checkResize(e))})),i}function Th(t){let e=new _h(t),i=[];return e.forEachPainter((t=>{i.indexOf(t)<0&&i.push(t)})),i.forEach((t=>t.cleanup())),e.selectDom().html(""),i} /** * @license * Copyright 2010-2021 Three.js Authors * SPDX-License-Identifier: MIT */const Sh="138",Ch=0,Eh=1,Ph=2,kh=0,zh=1,Dh=2,Oh=3,Lh=100,Rh=301,Bh=302,Fh=306,Nh=1e3,Ih=1001,jh=1002,qh=1003,Uh=1006,Gh=1008,Hh=1009,Xh=1012,$h=1014,Vh=1015,Yh=1016,Wh=1020,Zh=1023,Qh=1026,Jh=1027,Kh=33776,tc=33777,ec=33778,ic=33779,nc=3e3,rc=3001,sc=7680,ac=35044,oc="300 es",lc=1035;class hc{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const i=this._listeners[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.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 i=e.slice(0);for(let e=0,n=i.length;e>8&255]+cc[t>>16&255]+cc[t>>24&255]+"-"+cc[255&e]+cc[e>>8&255]+"-"+cc[e>>16&15|64]+cc[e>>24&255]+"-"+cc[63&i|128]+cc[i>>8&255]+"-"+cc[i>>16&255]+cc[i>>24&255]+cc[255&n]+cc[n>>8&255]+cc[n>>16&255]+cc[n>>24&255]).toUpperCase()}function pc(t,e,i){return Math.max(e,Math.min(i,t))}function gc(t,e){return(t%e+e)%e}function _c(t,e,i){return(1-i)*t+i*e}function xc(t){return 0==(t&t-1)&&0!==t}function yc(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}var Ac=Object.freeze({__proto__:null,DEG2RAD:uc,RAD2DEG:fc,generateUUID:mc,clamp:pc,euclideanModulo:gc,mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},inverseLerp:function(t,e,i){return t!==e?(i-t)/(e-t):0},lerp:_c,damp:function(t,e,i,n){return _c(t,e,1-Math.exp(-i*n))},pingpong:function(t,e=1){return e-Math.abs(gc(t,2*e)-e)},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-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&&(dc=t%2147483647),dc=16807*dc%2147483647,(dc-1)/2147483646},degToRad:function(t){return t*uc},radToDeg:function(t){return t*fc},isPowerOfTwo:xc,ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:yc,setQuaternionFromProperEuler:function(t,e,i,n,r){const s=Math.cos,a=Math.sin,o=s(i/2),l=a(i/2),h=s((e+n)/2),c=a((e+n)/2),d=s((e-n)/2),u=a((e-n)/2),f=s((n-e)/2),m=a((n-e)/2);switch(r){case"XYX":t.set(o*c,l*d,l*u,o*h);break;case"YZY":t.set(l*u,o*c,l*d,o*h);break;case"ZXZ":t.set(l*d,l*u,o*c,o*h);break;case"XZX":t.set(o*c,l*m,l*f,o*h);break;case"YXY":t.set(l*f,o*c,l*m,o*h);break;case"ZYZ":t.set(l*m,l*f,o*c,o*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}});class vc{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,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[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 i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}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,i=this.y-t.y;return e*e+i*i}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,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,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,i){return void 0!==i&&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 i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*i-s*n+t.x,this.y=r*n+s*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}vc.prototype.isVector2=!0;class bc{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,i,n,r,s,a,o,l){const h=this.elements;return h[0]=t,h[1]=n,h[2]=a,h[3]=e,h[4]=r,h[5]=o,h[6]=i,h[7]=s,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.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 i=t.elements,n=e.elements,r=this.elements,s=i[0],a=i[3],o=i[6],l=i[1],h=i[4],c=i[7],d=i[2],u=i[5],f=i[8],m=n[0],p=n[3],g=n[6],_=n[1],x=n[4],y=n[7],A=n[2],v=n[5],b=n[8];return r[0]=s*m+a*_+o*A,r[3]=s*p+a*x+o*v,r[6]=s*g+a*y+o*b,r[1]=l*m+h*_+c*A,r[4]=l*p+h*x+c*v,r[7]=l*g+h*y+c*b,r[2]=d*m+u*_+f*A,r[5]=d*p+u*x+f*v,r[8]=d*g+u*y+f*b,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],i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],h=t[8];return e*s*h-e*a*l-i*r*h+i*a*o+n*r*l-n*s*o}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],h=t[8],c=h*s-a*l,d=a*o-h*r,u=l*r-s*o,f=e*c+i*d+n*u;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);const m=1/f;return t[0]=c*m,t[1]=(n*l-h*i)*m,t[2]=(a*i-n*s)*m,t[3]=d*m,t[4]=(h*e-n*o)*m,t[5]=(n*r-a*e)*m,t[6]=u*m,t[7]=(i*o-l*e)*m,t[8]=(s*e-i*r)*m,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,i,n,r,s,a){const o=Math.cos(r),l=Math.sin(r);return this.set(i*o,i*l,-i*(o*s+l*a)+s+t,-n*l,n*o,-n*(-l*s+o*a)+a+e,0,0,1),this}scale(t,e){const i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.elements,r=n[0],s=n[3],a=n[6],o=n[1],l=n[4],h=n[7];return n[0]=e*r+i*o,n[3]=e*s+i*l,n[6]=e*a+i*h,n[1]=-i*r+e*o,n[4]=-i*s+e*l,n[7]=-i*a+e*h,this}translate(t,e){const i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}function wc(t){for(let e=t.length-1;e>=0;--e)if(t[e]>65535)return!0;return!1}function Mc(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}bc.prototype.isMatrix3=!0;const Tc={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},Sc={h:0,s:0,l:0},Cc={h:0,s:0,l:0};function Ec(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}function Pc(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function kc(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class zc{constructor(t,e,i){return void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}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,i){return this.r=t,this.g=e,this.b=i,this}setHSL(t,e,i){if(t=gc(t,1),e=pc(e,0,1),i=pc(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,r=2*i-n;this.r=Ec(r,n,t+1/3),this.g=Ec(r,n,t),this.b=Ec(r,n,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 i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const n=i[1],r=i[2];switch(n){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))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(r))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(r)){const i=parseFloat(t[1])/360,n=parseInt(t[2],10)/100,r=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(i,n,r)}}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=i[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=Tc[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}copySRGBToLinear(t){return this.r=Pc(t.r),this.g=Pc(t.g),this.b=Pc(t.b),this}copyLinearToSRGB(t){return this.r=kc(t.r),this.g=kc(t.g),this.b=kc(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,i=this.g,n=this.b,r=Math.max(e,i,n),s=Math.min(e,i,n);let a,o;const l=(s+r)/2;if(s===r)a=0,o=0;else{const t=r-s;switch(o=l<=.5?t/(r+s):t/(2-r-s),r){case e:a=(i-n)/t+(i2048||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")}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=Mc("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const n=i.getImageData(0,0,t.width,t.height),r=n.data;for(let t=0;t1)switch(this.wrapS){case Nh:t.x=t.x-Math.floor(t.x);break;case Ih:t.x=t.x<0?0:1;break;case jh: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 Nh:t.y=t.y-Math.floor(t.y);break;case Ih:t.y=t.y<0?0:1;break;case jh: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++,this.source.needsUpdate=!0)}}Fc.DEFAULT_IMAGE=null,Fc.DEFAULT_MAPPING=300,Fc.prototype.isTexture=!0;class Nc{constructor(t=0,e=0,i=0,n=1){this.x=t,this.y=e,this.z=i,this.w=n}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,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,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,i=this.y,n=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*n+s[12]*r,this.y=s[1]*e+s[5]*i+s[9]*n+s[13]*r,this.z=s[2]*e+s[6]*i+s[10]*n+s[14]*r,this.w=s[3]*e+s[7]*i+s[11]*n+s[15]*r,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,i,n,r;const s=.01,a=.1,o=t.elements,l=o[0],h=o[4],c=o[8],d=o[1],u=o[5],f=o[9],m=o[2],p=o[6],g=o[10];if(Math.abs(h-d)o&&t>_?t_?o=0?1:-1,n=1-e*e;if(n>Number.EPSILON){const r=Math.sqrt(n),s=Math.atan2(r,e*i);t=Math.sin(t*s)/r,a=Math.sin(a*s)/r}const r=a*i;if(o=o*t+d*r,l=l*t+u*r,h=h*t+f*r,c=c*t+m*r,t===1-a){const t=1/Math.sqrt(o*o+l*l+h*h+c*c);o*=t,l*=t,h*=t,c*=t}}t[e]=o,t[e+1]=l,t[e+2]=h,t[e+3]=c}static multiplyQuaternionsFlat(t,e,i,n,r,s){const a=i[n],o=i[n+1],l=i[n+2],h=i[n+3],c=r[s],d=r[s+1],u=r[s+2],f=r[s+3];return t[e]=a*f+h*c+o*u-l*d,t[e+1]=o*f+h*d+l*c-a*u,t[e+2]=l*f+h*u+a*d-o*c,t[e+3]=h*f-a*c-o*d-l*u,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,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 i=t._x,n=t._y,r=t._z,s=t._order,a=Math.cos,o=Math.sin,l=a(i/2),h=a(n/2),c=a(r/2),d=o(i/2),u=o(n/2),f=o(r/2);switch(s){case"XYZ":this._x=d*h*c+l*u*f,this._y=l*u*c-d*h*f,this._z=l*h*f+d*u*c,this._w=l*h*c-d*u*f;break;case"YXZ":this._x=d*h*c+l*u*f,this._y=l*u*c-d*h*f,this._z=l*h*f-d*u*c,this._w=l*h*c+d*u*f;break;case"ZXY":this._x=d*h*c-l*u*f,this._y=l*u*c+d*h*f,this._z=l*h*f+d*u*c,this._w=l*h*c-d*u*f;break;case"ZYX":this._x=d*h*c-l*u*f,this._y=l*u*c+d*h*f,this._z=l*h*f-d*u*c,this._w=l*h*c+d*u*f;break;case"YZX":this._x=d*h*c+l*u*f,this._y=l*u*c+d*h*f,this._z=l*h*f-d*u*c,this._w=l*h*c-d*u*f;break;case"XZY":this._x=d*h*c-l*u*f,this._y=l*u*c-d*h*f,this._z=l*h*f+d*u*c,this._w=l*h*c+d*u*f;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],r=e[8],s=e[1],a=e[5],o=e[9],l=e[2],h=e[6],c=e[10],d=i+a+c;if(d>0){const t=.5/Math.sqrt(d+1);this._w=.25/t,this._x=(h-o)*t,this._y=(r-l)*t,this._z=(s-n)*t}else if(i>a&&i>c){const t=2*Math.sqrt(1+i-a-c);this._w=(h-o)/t,this._x=.25*t,this._y=(n+s)/t,this._z=(r+l)/t}else if(a>c){const t=2*Math.sqrt(1+a-i-c);this._w=(r-l)/t,this._x=(n+s)/t,this._y=.25*t,this._z=(o+h)/t}else{const t=2*Math.sqrt(1+c-i-a);this._w=(s-n)/t,this._x=(r+l)/t,this._y=(o+h)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return iMath.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(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=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(pc(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const n=Math.min(1,e/i);return this.slerp(t,n),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 i=t._x,n=t._y,r=t._z,s=t._w,a=e._x,o=e._y,l=e._z,h=e._w;return this._x=i*h+s*a+n*l-r*o,this._y=n*h+s*o+r*a-i*l,this._z=r*h+s*l+i*o-n*a,this._w=s*h-i*a-n*o-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,n=this._y,r=this._z,s=this._w;let a=s*t._w+i*t._x+n*t._y+r*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=s,this._x=i,this._y=n,this._z=r,this;const o=1-a*a;if(o<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*i+e*this._x,this._y=t*n+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(o),h=Math.atan2(l,a),c=Math.sin((1-e)*h)/l,d=Math.sin(e*h)/l;return this._w=s*c+this._w*d,this._x=i*c+this._x*d,this._y=n*c+this._y*d,this._z=r*c+this._z*d,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=Math.random(),e=Math.sqrt(1-t),i=Math.sqrt(t),n=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(n),i*Math.sin(r),i*Math.cos(r),e*Math.sin(n))}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(){}}jc.prototype.isQuaternion=!0;class qc{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,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(Gc.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Gc.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=t.elements,s=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*s,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*s,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*s,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,a=t.z,o=t.w,l=o*e+s*n-a*i,h=o*i+a*e-r*n,c=o*n+r*i-s*e,d=-r*e-s*i-a*n;return this.x=l*o+d*-r+h*-a-c*-s,this.y=h*o+d*-s+c*-r-l*-a,this.z=c*o+d*-a+l*-s-h*-r,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,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,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 i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}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,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,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 i=t.x,n=t.y,r=t.z,s=e.x,a=e.y,o=e.z;return this.x=n*o-r*a,this.y=r*s-i*o,this.z=i*a-n*s,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return Uc.copy(this).projectOnVector(t),this.sub(Uc)}reflect(t){return this.sub(Uc.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 i=this.dot(t)/e;return Math.acos(pc(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}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,i){const n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,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(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,i){return void 0!==i&&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,i=Math.sqrt(1-t**2);return this.x=i*Math.cos(e),this.y=i*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}qc.prototype.isVector3=!0;const Uc=new qc,Gc=new jc;class Hc{constructor(t=new qc(1/0,1/0,1/0),e=new qc(-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,i=1/0,n=1/0,r=-1/0,s=-1/0,a=-1/0;for(let o=0,l=t.length;or&&(r=l),h>s&&(s=h),c>a&&(a=c)}return this.min.set(e,i,n),this.max.set(r,s,a),this}setFromBufferAttribute(t){let e=1/0,i=1/0,n=1/0,r=-1/0,s=-1/0,a=-1/0;for(let o=0,l=t.count;or&&(r=l),h>s&&(s=h),c>a&&(a=c)}return this.min.set(e,i,n),this.max.set(r,s,a),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;ethis.max.x||t.ythis.max.y||t.zthis.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.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,$c),$c.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(td),ed.subVectors(this.max,td),Yc.subVectors(t.a,td),Wc.subVectors(t.b,td),Zc.subVectors(t.c,td),Qc.subVectors(Wc,Yc),Jc.subVectors(Zc,Wc),Kc.subVectors(Yc,Zc);let e=[0,-Qc.z,Qc.y,0,-Jc.z,Jc.y,0,-Kc.z,Kc.y,Qc.z,0,-Qc.x,Jc.z,0,-Jc.x,Kc.z,0,-Kc.x,-Qc.y,Qc.x,0,-Jc.y,Jc.x,0,-Kc.y,Kc.x,0];return!!rd(e,Yc,Wc,Zc,ed)&&(e=[1,0,0,0,1,0,0,0,1],!!rd(e,Yc,Wc,Zc,ed)&&(id.crossVectors(Qc,Jc),e=[id.x,id.y,id.z],rd(e,Yc,Wc,Zc,ed)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return $c.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize($c).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()||(Xc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Xc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Xc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Xc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Xc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Xc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Xc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Xc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Xc)),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)}}Hc.prototype.isBox3=!0;const Xc=[new qc,new qc,new qc,new qc,new qc,new qc,new qc,new qc],$c=new qc,Vc=new Hc,Yc=new qc,Wc=new qc,Zc=new qc,Qc=new qc,Jc=new qc,Kc=new qc,td=new qc,ed=new qc,id=new qc,nd=new qc;function rd(t,e,i,n,r){for(let s=0,a=t.length-3;s<=a;s+=3){nd.fromArray(t,s);const a=r.x*Math.abs(nd.x)+r.y*Math.abs(nd.y)+r.z*Math.abs(nd.z),o=e.dot(nd),l=i.dot(nd),h=n.dot(nd);if(Math.max(-Math.max(o,l,h),Math.min(o,l,h))>a)return!1}return!0}const sd=new Hc,ad=new qc,od=new qc,ld=new qc;class hd{constructor(t=new qc,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):sd.setFromPoints(t).getCenter(i);let n=0;for(let e=0,r=t.length;ethis.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){ld.subVectors(t,this.center);const e=ld.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.add(ld.multiplyScalar(i/t)),this.radius+=i}return this}union(t){return!0===this.center.equals(t.center)?od.set(0,0,1).multiplyScalar(t.radius):od.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(ad.copy(t.center).add(od)),this.expandByPoint(ad.copy(t.center).sub(od)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const cd=new qc,dd=new qc,ud=new bc;class fd{constructor(t=new qc(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,i,n){return this.normal.set(t,e,i),this.constant=n,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const n=cd.subVectors(i,e).cross(dd.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,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 i=t.delta(cd),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/n;return r<0||r>1?null:e.copy(i).multiplyScalar(r).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<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 i=e||ud.getNormalMatrix(t),n=this.coplanarPoint(cd).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),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)}}fd.prototype.isPlane=!0;const md=new hd,pd=new qc;class gd{constructor(t=new fd,e=new fd,i=new fd,n=new fd,r=new fd,s=new fd){this.planes=[t,e,i,n,r,s]}set(t,e,i,n,r,s){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(n),a[4].copy(r),a[5].copy(s),this}copy(t){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t){const e=this.planes,i=t.elements,n=i[0],r=i[1],s=i[2],a=i[3],o=i[4],l=i[5],h=i[6],c=i[7],d=i[8],u=i[9],f=i[10],m=i[11],p=i[12],g=i[13],_=i[14],x=i[15];return e[0].setComponents(a-n,c-o,m-d,x-p).normalize(),e[1].setComponents(a+n,c+o,m+d,x+p).normalize(),e[2].setComponents(a+r,c+l,m+u,x+g).normalize(),e[3].setComponents(a-r,c-l,m-u,x-g).normalize(),e[4].setComponents(a-s,c-h,m-f,x-_).normalize(),e[5].setComponents(a+s,c+h,m+f,x+_).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),md.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(md)}intersectsSprite(t){return md.center.set(0,0,0),md.radius=.7071067811865476,md.applyMatrix4(t.matrixWorld),this.intersectsSphere(md)}intersectsSphere(t){const e=this.planes,i=t.center,n=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(i)0?t.max.x:t.min.x,pd.y=n.normal.y>0?t.max.y:t.min.y,pd.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(pd)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}class _d{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,i,n,r,s,a,o,l,h,c,d,u,f,m,p){const g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=r,g[5]=s,g[9]=a,g[13]=o,g[2]=l,g[6]=h,g[10]=c,g[14]=d,g[3]=u,g[7]=f,g[11]=m,g[15]=p,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 _d).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[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,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,n=1/xd.setFromMatrixColumn(t,0).length(),r=1/xd.setFromMatrixColumn(t,1).length(),s=1/xd.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*s,e[9]=i[9]*s,e[10]=i[10]*s,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,i=t.x,n=t.y,r=t.z,s=Math.cos(i),a=Math.sin(i),o=Math.cos(n),l=Math.sin(n),h=Math.cos(r),c=Math.sin(r);if("XYZ"===t.order){const t=s*h,i=s*c,n=a*h,r=a*c;e[0]=o*h,e[4]=-o*c,e[8]=l,e[1]=i+n*l,e[5]=t-r*l,e[9]=-a*o,e[2]=r-t*l,e[6]=n+i*l,e[10]=s*o}else if("YXZ"===t.order){const t=o*h,i=o*c,n=l*h,r=l*c;e[0]=t+r*a,e[4]=n*a-i,e[8]=s*l,e[1]=s*c,e[5]=s*h,e[9]=-a,e[2]=i*a-n,e[6]=r+t*a,e[10]=s*o}else if("ZXY"===t.order){const t=o*h,i=o*c,n=l*h,r=l*c;e[0]=t-r*a,e[4]=-s*c,e[8]=n+i*a,e[1]=i+n*a,e[5]=s*h,e[9]=r-t*a,e[2]=-s*l,e[6]=a,e[10]=s*o}else if("ZYX"===t.order){const t=s*h,i=s*c,n=a*h,r=a*c;e[0]=o*h,e[4]=n*l-i,e[8]=t*l+r,e[1]=o*c,e[5]=r*l+t,e[9]=i*l-n,e[2]=-l,e[6]=a*o,e[10]=s*o}else if("YZX"===t.order){const t=s*o,i=s*l,n=a*o,r=a*l;e[0]=o*h,e[4]=r-t*c,e[8]=n*c+i,e[1]=c,e[5]=s*h,e[9]=-a*h,e[2]=-l*h,e[6]=i*c+n,e[10]=t-r*c}else if("XZY"===t.order){const t=s*o,i=s*l,n=a*o,r=a*l;e[0]=o*h,e[4]=-c,e[8]=l*h,e[1]=t*c+r,e[5]=s*h,e[9]=i*c-n,e[2]=n*c-i,e[6]=a*h,e[10]=r*c+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(Ad,t,vd)}lookAt(t,e,i){const n=this.elements;return Md.subVectors(t,e),0===Md.lengthSq()&&(Md.z=1),Md.normalize(),bd.crossVectors(i,Md),0===bd.lengthSq()&&(1===Math.abs(i.z)?Md.x+=1e-4:Md.z+=1e-4,Md.normalize(),bd.crossVectors(i,Md)),bd.normalize(),wd.crossVectors(Md,bd),n[0]=bd.x,n[4]=wd.x,n[8]=Md.x,n[1]=bd.y,n[5]=wd.y,n[9]=Md.y,n[2]=bd.z,n[6]=wd.z,n[10]=Md.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 i=t.elements,n=e.elements,r=this.elements,s=i[0],a=i[4],o=i[8],l=i[12],h=i[1],c=i[5],d=i[9],u=i[13],f=i[2],m=i[6],p=i[10],g=i[14],_=i[3],x=i[7],y=i[11],A=i[15],v=n[0],b=n[4],w=n[8],M=n[12],T=n[1],S=n[5],C=n[9],E=n[13],P=n[2],k=n[6],z=n[10],D=n[14],O=n[3],L=n[7],R=n[11],B=n[15];return r[0]=s*v+a*T+o*P+l*O,r[4]=s*b+a*S+o*k+l*L,r[8]=s*w+a*C+o*z+l*R,r[12]=s*M+a*E+o*D+l*B,r[1]=h*v+c*T+d*P+u*O,r[5]=h*b+c*S+d*k+u*L,r[9]=h*w+c*C+d*z+u*R,r[13]=h*M+c*E+d*D+u*B,r[2]=f*v+m*T+p*P+g*O,r[6]=f*b+m*S+p*k+g*L,r[10]=f*w+m*C+p*z+g*R,r[14]=f*M+m*E+p*D+g*B,r[3]=_*v+x*T+y*P+A*O,r[7]=_*b+x*S+y*k+A*L,r[11]=_*w+x*C+y*z+A*R,r[15]=_*M+x*E+y*D+A*B,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],i=t[4],n=t[8],r=t[12],s=t[1],a=t[5],o=t[9],l=t[13],h=t[2],c=t[6],d=t[10],u=t[14];return t[3]*(+r*o*c-n*l*c-r*a*d+i*l*d+n*a*u-i*o*u)+t[7]*(+e*o*u-e*l*d+r*s*d-n*s*u+n*l*h-r*o*h)+t[11]*(+e*l*c-e*a*u-r*s*c+i*s*u+r*a*h-i*l*h)+t[15]*(-n*a*h-e*o*c+e*a*d+n*s*c-i*s*d+i*o*h)}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,i){const n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],h=t[8],c=t[9],d=t[10],u=t[11],f=t[12],m=t[13],p=t[14],g=t[15],_=c*p*l-m*d*l+m*o*u-a*p*u-c*o*g+a*d*g,x=f*d*l-h*p*l-f*o*u+s*p*u+h*o*g-s*d*g,y=h*m*l-f*c*l+f*a*u-s*m*u-h*a*g+s*c*g,A=f*c*o-h*m*o-f*a*d+s*m*d+h*a*p-s*c*p,v=e*_+i*x+n*y+r*A;if(0===v)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/v;return t[0]=_*b,t[1]=(m*d*r-c*p*r-m*n*u+i*p*u+c*n*g-i*d*g)*b,t[2]=(a*p*r-m*o*r+m*n*l-i*p*l-a*n*g+i*o*g)*b,t[3]=(c*o*r-a*d*r-c*n*l+i*d*l+a*n*u-i*o*u)*b,t[4]=x*b,t[5]=(h*p*r-f*d*r+f*n*u-e*p*u-h*n*g+e*d*g)*b,t[6]=(f*o*r-s*p*r-f*n*l+e*p*l+s*n*g-e*o*g)*b,t[7]=(s*d*r-h*o*r+h*n*l-e*d*l-s*n*u+e*o*u)*b,t[8]=y*b,t[9]=(f*c*r-h*m*r-f*i*u+e*m*u+h*i*g-e*c*g)*b,t[10]=(s*m*r-f*a*r+f*i*l-e*m*l-s*i*g+e*a*g)*b,t[11]=(h*a*r-s*c*r-h*i*l+e*c*l+s*i*u-e*a*u)*b,t[12]=A*b,t[13]=(h*m*n-f*c*n+f*i*d-e*m*d-h*i*p+e*c*p)*b,t[14]=(f*a*n-s*m*n-f*i*o+e*m*o+s*i*p-e*a*p)*b,t[15]=(s*c*n-h*a*n+h*i*o-e*c*o-s*i*d+e*a*d)*b,this}scale(t){const e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),n=Math.sin(e),r=1-i,s=t.x,a=t.y,o=t.z,l=r*s,h=r*a;return this.set(l*s+i,l*a-n*o,l*o+n*a,0,l*a+n*o,h*a+i,h*o-n*s,0,l*o-n*a,h*o+n*s,r*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,r,s){return this.set(1,i,r,0,t,1,s,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,r=e._x,s=e._y,a=e._z,o=e._w,l=r+r,h=s+s,c=a+a,d=r*l,u=r*h,f=r*c,m=s*h,p=s*c,g=a*c,_=o*l,x=o*h,y=o*c,A=i.x,v=i.y,b=i.z;return n[0]=(1-(m+g))*A,n[1]=(u+y)*A,n[2]=(f-x)*A,n[3]=0,n[4]=(u-y)*v,n[5]=(1-(d+g))*v,n[6]=(p+_)*v,n[7]=0,n[8]=(f+x)*b,n[9]=(p-_)*b,n[10]=(1-(d+m))*b,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;let r=xd.set(n[0],n[1],n[2]).length();const s=xd.set(n[4],n[5],n[6]).length(),a=xd.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],yd.copy(this);const o=1/r,l=1/s,h=1/a;return yd.elements[0]*=o,yd.elements[1]*=o,yd.elements[2]*=o,yd.elements[4]*=l,yd.elements[5]*=l,yd.elements[6]*=l,yd.elements[8]*=h,yd.elements[9]*=h,yd.elements[10]*=h,e.setFromRotationMatrix(yd),i.x=r,i.y=s,i.z=a,this}makePerspective(t,e,i,n,r,s){void 0===s&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const a=this.elements,o=2*r/(e-t),l=2*r/(i-n),h=(e+t)/(e-t),c=(i+n)/(i-n),d=-(s+r)/(s-r),u=-2*s*r/(s-r);return a[0]=o,a[4]=0,a[8]=h,a[12]=0,a[1]=0,a[5]=l,a[9]=c,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=u,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(t,e,i,n,r,s){const a=this.elements,o=1/(e-t),l=1/(i-n),h=1/(s-r),c=(e+t)*o,d=(i+n)*l,u=(s+r)*h;return a[0]=2*o,a[4]=0,a[8]=0,a[12]=-c,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=-2*h,a[14]=-u,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}_d.prototype.isMatrix4=!0;const xd=new qc,yd=new _d,Ad=new qc(0,0,0),vd=new qc(1,1,1),bd=new qc,wd=new qc,Md=new qc;function Td(){let t=null,e=!1,i=null,n=null;function r(e,s){i(e,s),n=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==i&&(n=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function Sd(t,e){const i=e.isWebGL2,n=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),n.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const i=n.get(e);i&&(t.deleteBuffer(i.buffer),n.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=n.get(e);return void((!t||t.version>>0}enable(t){this.mask|=1<1){for(let t=0;t1){for(let t=0;t0){n.children=[];for(let e=0;e0){n.animations=[];for(let e=0;e0&&(i.geometries=e),n.length>0&&(i.materials=n),r.length>0&&(i.textures=r),a.length>0&&(i.images=a),o.length>0&&(i.shapes=o),l.length>0&&(i.skeletons=l),h.length>0&&(i.animations=h),c.length>0&&(i.nodes=c)}return i.object=n,i;function s(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}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;e0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);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 i=this.attributes;for(const e in i){const n=i[e];t.data.attributes[e]=n.toJSON(t.data)}const n={};let r=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],s=[];for(let e=0,n=i.length;e0&&(n[e]=s,r=!0)}r&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));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 i=t.index;null!==i&&this.setIndex(i.clone(e));const n=t.attributes;for(const t in n){const i=n[t];this.setAttribute(t,i.clone(e))}const r=t.morphAttributes;for(const t in r){const i=[],n=r[t];for(let t=0,r=n.length;t0?1:-1,h.push(C.x,C.y,C.z),c.push(o/p),c.push(1-s/g),T+=1}}for(let t=0;t0!=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 i=t[e];if(void 0===i){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===i;continue}const n=this[e];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i: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 i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(i.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=this.flatShading),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),e){const e=n(t.textures),r=n(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i}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.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 i=null;if(null!==e){const t=e.length;i=new Array(t);for(let n=0;n!==t;++n)i[n]=e[n].clone()}return this.clippingPlanes=i,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++}}function hu(t){const e={};for(const i in t){e[i]={};for(const n in t[i]){const r=t[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}}return e}function cu(t){const e={};for(let i=0;i0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const i={};for(const t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}uu.prototype.isShaderMaterial=!0;const fu=new qc,mu=new qc,pu=new qc,gu=new qc,_u=new qc,xu=new qc,yu=new qc;class Au{constructor(t=new qc,e=new qc(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,fu)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=fu.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(fu.copy(this.direction).multiplyScalar(e).add(this.origin),fu.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){mu.copy(t).add(e).multiplyScalar(.5),pu.copy(e).sub(t).normalize(),gu.copy(this.origin).sub(mu);const r=.5*t.distanceTo(e),s=-this.direction.dot(pu),a=gu.dot(this.direction),o=-gu.dot(pu),l=gu.lengthSq(),h=Math.abs(1-s*s);let c,d,u,f;if(h>0)if(c=s*o-a,d=s*a-o,f=r*h,c>=0)if(d>=-f)if(d<=f){const t=1/h;c*=t,d*=t,u=c*(c+s*d+2*a)+d*(s*c+d+2*o)+l}else d=r,c=Math.max(0,-(s*d+a)),u=-c*c+d*(d+2*o)+l;else d=-r,c=Math.max(0,-(s*d+a)),u=-c*c+d*(d+2*o)+l;else d<=-f?(c=Math.max(0,-(-s*r+a)),d=c>0?-r:Math.min(Math.max(-r,-o),r),u=-c*c+d*(d+2*o)+l):d<=f?(c=0,d=Math.min(Math.max(-r,-o),r),u=d*(d+2*o)+l):(c=Math.max(0,-(s*r+a)),d=c>0?r:Math.min(Math.max(-r,-o),r),u=-c*c+d*(d+2*o)+l);else d=s>0?-r:r,c=Math.max(0,-(s*d+a)),u=-c*c+d*(d+2*o)+l;return i&&i.copy(this.direction).multiplyScalar(c).add(this.origin),n&&n.copy(pu).multiplyScalar(d).add(mu),u}intersectSphere(t,e){fu.subVectors(t.center,this.origin);const i=fu.dot(this.direction),n=fu.dot(fu)-i*i,r=t.radius*t.radius;if(n>r)return null;const s=Math.sqrt(r-n),a=i-s,o=i+s;return a<0&&o<0?null:a<0?this.at(o,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 i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return null===i?null:this.at(i,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 i,n,r,s,a,o;const l=1/this.direction.x,h=1/this.direction.y,c=1/this.direction.z,d=this.origin;return l>=0?(i=(t.min.x-d.x)*l,n=(t.max.x-d.x)*l):(i=(t.max.x-d.x)*l,n=(t.min.x-d.x)*l),h>=0?(r=(t.min.y-d.y)*h,s=(t.max.y-d.y)*h):(r=(t.max.y-d.y)*h,s=(t.min.y-d.y)*h),i>s||r>n?null:((r>i||i!=i)&&(i=r),(s=0?(a=(t.min.z-d.z)*c,o=(t.max.z-d.z)*c):(a=(t.max.z-d.z)*c,o=(t.min.z-d.z)*c),i>o||a>n?null:((a>i||i!=i)&&(i=a),(o=0?i:n,e)))}intersectsBox(t){return null!==this.intersectBox(t,fu)}intersectTriangle(t,e,i,n,r){_u.subVectors(e,t),xu.subVectors(i,t),yu.crossVectors(_u,xu);let s,a=this.direction.dot(yu);if(a>0){if(n)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}gu.subVectors(this.origin,t);const o=s*this.direction.dot(xu.crossVectors(gu,xu));if(o<0)return null;const l=s*this.direction.dot(_u.cross(gu));if(l<0)return null;if(o+l>a)return null;const h=-s*gu.dot(yu);return h<0?null:this.at(h/a,r)}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)}}const vu=new qc,bu=new qc,wu=new qc,Mu=new qc,Tu=new qc,Su=new qc,Cu=new qc,Eu=new qc,Pu=new qc,ku=new qc;class zu{constructor(t=new qc,e=new qc,i=new qc){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,n){n.subVectors(i,e),vu.subVectors(t,e),n.cross(vu);const r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(t,e,i,n,r){vu.subVectors(n,e),bu.subVectors(i,e),wu.subVectors(t,e);const s=vu.dot(vu),a=vu.dot(bu),o=vu.dot(wu),l=bu.dot(bu),h=bu.dot(wu),c=s*l-a*a;if(0===c)return r.set(-2,-1,-1);const d=1/c,u=(l*o-a*h)*d,f=(s*h-a*o)*d;return r.set(1-u-f,f,u)}static containsPoint(t,e,i,n){return this.getBarycoord(t,e,i,n,Mu),Mu.x>=0&&Mu.y>=0&&Mu.x+Mu.y<=1}static getUV(t,e,i,n,r,s,a,o){return this.getBarycoord(t,e,i,n,Mu),o.set(0,0),o.addScaledVector(r,Mu.x),o.addScaledVector(s,Mu.y),o.addScaledVector(a,Mu.z),o}static isFrontFacing(t,e,i,n){return vu.subVectors(i,e),bu.subVectors(t,e),vu.cross(bu).dot(n)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this}setFromAttributeAndIndices(t,e,i,n){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,n),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 vu.subVectors(this.c,this.b),bu.subVectors(this.a,this.b),.5*vu.cross(bu).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return zu.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return zu.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,i,n,r){return zu.getUV(t,this.a,this.b,this.c,e,i,n,r)}containsPoint(t){return zu.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return zu.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,n=this.b,r=this.c;let s,a;Tu.subVectors(n,i),Su.subVectors(r,i),Eu.subVectors(t,i);const o=Tu.dot(Eu),l=Su.dot(Eu);if(o<=0&&l<=0)return e.copy(i);Pu.subVectors(t,n);const h=Tu.dot(Pu),c=Su.dot(Pu);if(h>=0&&c<=h)return e.copy(n);const d=o*c-h*l;if(d<=0&&o>=0&&h<=0)return s=o/(o-h),e.copy(i).addScaledVector(Tu,s);ku.subVectors(t,r);const u=Tu.dot(ku),f=Su.dot(ku);if(f>=0&&u<=f)return e.copy(r);const m=u*l-o*f;if(m<=0&&l>=0&&f<=0)return a=l/(l-f),e.copy(i).addScaledVector(Su,a);const p=h*f-u*c;if(p<=0&&c-h>=0&&u-f>=0)return Cu.subVectors(r,n),a=(c-h)/(c-h+(u-f)),e.copy(n).addScaledVector(Cu,a);const g=1/(p+m+d);return s=m*g,a=d*g,e.copy(i).addScaledVector(Tu,s).addScaledVector(Su,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}class Du extends lu{constructor(t){super(),this.type="MeshBasicMaterial",this.color=new zc(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}}Du.prototype.isMeshBasicMaterial=!0;const Ou=new _d,Lu=new Au,Ru=new hd,Bu=new qc,Fu=new qc,Nu=new qc,Iu=new qc,ju=new qc,qu=new qc,Uu=new qc,Gu=new qc,Hu=new qc,Xu=new vc,$u=new vc,Vu=new vc,Yu=new qc,Wu=new qc;class Zu extends Zd{constructor(t=new ru,e=new Du){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,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(t,e){const i=this.geometry,n=this.material,r=this.matrixWorld;if(void 0===n)return;if(null===i.boundingSphere&&i.computeBoundingSphere(),Ru.copy(i.boundingSphere),Ru.applyMatrix4(r),!1===t.ray.intersectsSphere(Ru))return;if(Ou.copy(r).invert(),Lu.copy(t.ray).applyMatrix4(Ou),null!==i.boundingBox&&!1===Lu.intersectsBox(i.boundingBox))return;let s;if(i.isBufferGeometry){const r=i.index,a=i.attributes.position,o=i.morphAttributes.position,l=i.morphTargetsRelative,h=i.attributes.uv,c=i.attributes.uv2,d=i.groups,u=i.drawRange;if(null!==r)if(Array.isArray(n))for(let i=0,f=d.length;ii.far?null:{distance:h,point:Wu.clone(),object:t}}(t,e,i,n,Bu,Fu,Nu,Yu);if(f){o&&(Xu.fromBufferAttribute(o,h),$u.fromBufferAttribute(o,c),Vu.fromBufferAttribute(o,d),f.uv=zu.getUV(Yu,Bu,Fu,Nu,Xu,$u,Vu,new vc)),l&&(Xu.fromBufferAttribute(l,h),$u.fromBufferAttribute(l,c),Vu.fromBufferAttribute(l,d),f.uv2=zu.getUV(Yu,Bu,Fu,Nu,Xu,$u,Vu,new vc));const t={a:h,b:c,c:d,normal:new qc,materialIndex:0};zu.getNormal(Bu,Fu,Nu,t.normal),f.face=t}return f}Zu.prototype.isMesh=!0;const Ju={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_minMipLevel 4.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\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ) + 0.5;\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\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\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_MAX_MIP );\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\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:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\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}",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#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\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 vec3( texture2D( gradientMap, coord ).r );\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 = 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 *= 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 *= 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 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\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(\t\t0, 1,\t\t0 ),\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\tsheenSpecular += 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\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\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 = 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 sampledDiffuseColor = texture2D( map, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\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\tdiffuseColor *= texture2D( map, uv );\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",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]\n\t\t#endif\n\t}\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 ).xyz * 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\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tfloat texelIndex = float( vertexIndex * MORPHTARGETS_TEXTURE_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 );\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\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\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\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.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\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.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(\t1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108,\t1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605,\t1.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( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in 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( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\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( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in 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( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in 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\tgl_FragColor = texture2D( t2D, vUv );\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \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 \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 += lightMapTexel.rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \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 \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\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 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},Ku={common:{diffuse:{value:new zc(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new bc},uv2Transform:{value:new bc},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}},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 vc(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 zc(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 zc(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new bc}},sprite:{diffuse:{value:new zc(16777215)},opacity:{value:1},center:{value:new vc(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new bc}}},tf={basic:{uniforms:cu([Ku.common,Ku.specularmap,Ku.envmap,Ku.aomap,Ku.lightmap,Ku.fog]),vertexShader:Ju.meshbasic_vert,fragmentShader:Ju.meshbasic_frag},lambert:{uniforms:cu([Ku.common,Ku.specularmap,Ku.envmap,Ku.aomap,Ku.lightmap,Ku.emissivemap,Ku.fog,Ku.lights,{emissive:{value:new zc(0)}}]),vertexShader:Ju.meshlambert_vert,fragmentShader:Ju.meshlambert_frag},phong:{uniforms:cu([Ku.common,Ku.specularmap,Ku.envmap,Ku.aomap,Ku.lightmap,Ku.emissivemap,Ku.bumpmap,Ku.normalmap,Ku.displacementmap,Ku.fog,Ku.lights,{emissive:{value:new zc(0)},specular:{value:new zc(1118481)},shininess:{value:30}}]),vertexShader:Ju.meshphong_vert,fragmentShader:Ju.meshphong_frag},standard:{uniforms:cu([Ku.common,Ku.envmap,Ku.aomap,Ku.lightmap,Ku.emissivemap,Ku.bumpmap,Ku.normalmap,Ku.displacementmap,Ku.roughnessmap,Ku.metalnessmap,Ku.fog,Ku.lights,{emissive:{value:new zc(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ju.meshphysical_vert,fragmentShader:Ju.meshphysical_frag},toon:{uniforms:cu([Ku.common,Ku.aomap,Ku.lightmap,Ku.emissivemap,Ku.bumpmap,Ku.normalmap,Ku.displacementmap,Ku.gradientmap,Ku.fog,Ku.lights,{emissive:{value:new zc(0)}}]),vertexShader:Ju.meshtoon_vert,fragmentShader:Ju.meshtoon_frag},matcap:{uniforms:cu([Ku.common,Ku.bumpmap,Ku.normalmap,Ku.displacementmap,Ku.fog,{matcap:{value:null}}]),vertexShader:Ju.meshmatcap_vert,fragmentShader:Ju.meshmatcap_frag},points:{uniforms:cu([Ku.points,Ku.fog]),vertexShader:Ju.points_vert,fragmentShader:Ju.points_frag},dashed:{uniforms:cu([Ku.common,Ku.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ju.linedashed_vert,fragmentShader:Ju.linedashed_frag},depth:{uniforms:cu([Ku.common,Ku.displacementmap]),vertexShader:Ju.depth_vert,fragmentShader:Ju.depth_frag},normal:{uniforms:cu([Ku.common,Ku.bumpmap,Ku.normalmap,Ku.displacementmap,{opacity:{value:1}}]),vertexShader:Ju.meshnormal_vert,fragmentShader:Ju.meshnormal_frag},sprite:{uniforms:cu([Ku.sprite,Ku.fog]),vertexShader:Ju.sprite_vert,fragmentShader:Ju.sprite_frag},background:{uniforms:{uvTransform:{value:new bc},t2D:{value:null}},vertexShader:Ju.background_vert,fragmentShader:Ju.background_frag},cube:{uniforms:cu([Ku.envmap,{opacity:{value:1}}]),vertexShader:Ju.cube_vert,fragmentShader:Ju.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ju.equirect_vert,fragmentShader:Ju.equirect_frag},distanceRGBA:{uniforms:cu([Ku.common,Ku.displacementmap,{referencePosition:{value:new qc},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ju.distanceRGBA_vert,fragmentShader:Ju.distanceRGBA_frag},shadow:{uniforms:cu([Ku.lights,Ku.fog,{color:{value:new zc(0)},opacity:{value:1}}]),vertexShader:Ju.shadow_vert,fragmentShader:Ju.shadow_frag}};function ef(t,e,i,n,r,s){const a=new zc(0);let o,l,h=!0===r?0:1,c=null,d=0,u=null;function f(t,e){i.buffers.color.setClear(t.r,t.g,t.b,e,s)}return{getClearColor:function(){return a},setClearColor:function(t,e=1){a.set(t),h=e,f(a,h)},getClearAlpha:function(){return h},setClearAlpha:function(t){h=t,f(a,h)},render:function(i,r){let s=!1,m=!0===r.isScene?r.background:null;m&&m.isTexture&&(m=e.get(m));const p=t.xr,g=p.getSession&&p.getSession();g&&"additive"===g.environmentBlendMode&&(m=null),null===m?f(a,h):m&&m.isColor&&(f(m,1),s=!0),(t.autoClear||s)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),m&&(m.isCubeTexture||m.mapping===Fh)?(void 0===l&&(l=new Zu(new su(1,1,1),new uu({name:"BackgroundCubeMaterial",uniforms:hu(tf.cube.uniforms),vertexShader:tf.cube.vertexShader,fragmentShader:tf.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),l.material.uniforms.envMap.value=m,l.material.uniforms.flipEnvMap.value=m.isCubeTexture&&!1===m.isRenderTargetTexture?-1:1,c===m&&d===m.version&&u===t.toneMapping||(l.material.needsUpdate=!0,c=m,d=m.version,u=t.toneMapping),i.unshift(l,l.geometry,l.material,0,0,null)):m&&m.isTexture&&(void 0===o&&(o=new Zu(new au(2,2),new uu({name:"BackgroundMaterial",uniforms:hu(tf.background.uniforms),vertexShader:tf.background.vertexShader,fragmentShader:tf.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(o)),o.material.uniforms.t2D.value=m,!0===m.matrixAutoUpdate&&m.updateMatrix(),o.material.uniforms.uvTransform.value.copy(m.matrix),c===m&&d===m.version&&u===t.toneMapping||(o.material.needsUpdate=!0,c=m,d=m.version,u=t.toneMapping),i.unshift(o,o.geometry,o.material,0,0,null))}}}function nf(t,e,i,n){const r=t.getParameter(t.MAX_VERTEX_ATTRIBS),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),a=n.isWebGL2||null!==s,o={},l=u(null);let h=l;function c(e){return n.isWebGL2?t.bindVertexArray(e):s.bindVertexArrayOES(e)}function d(e){return n.isWebGL2?t.deleteVertexArray(e):s.deleteVertexArrayOES(e)}function u(t){const e=[],i=[],n=[];for(let t=0;t=0){let s=l[e];if(void 0===s&&("instanceMatrix"===e&&r.instanceMatrix&&(s=r.instanceMatrix),"instanceColor"===e&&r.instanceColor&&(s=r.instanceColor)),void 0!==s){const e=s.normalized,a=s.itemSize,l=i.get(s);if(void 0===l)continue;const h=l.buffer,c=l.type,d=l.bytesPerElement;if(s.isInterleavedBufferAttribute){const i=s.data,l=i.stride,u=s.offset;if(i.isInstancedInterleavedBuffer){for(let t=0;t0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let a=void 0!==i.precision?i.precision:"highp";const o=r(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const l=s||e.has("WEBGL_draw_buffers"),h=!0===i.logarithmicDepthBuffer,c=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),d=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_TEXTURE_SIZE),f=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),m=t.getParameter(t.MAX_VERTEX_ATTRIBS),p=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),g=t.getParameter(t.MAX_VARYING_VECTORS),_=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),x=d>0,y=s||e.has("OES_texture_float");return{isWebGL2:s,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===e.has("EXT_texture_filter_anisotropic")){const i=e.get("EXT_texture_filter_anisotropic");n=t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:h,maxTextures:c,maxVertexTextures:d,maxTextureSize:u,maxCubemapSize:f,maxAttributes:m,maxVertexUniforms:p,maxVaryings:g,maxFragmentUniforms:_,vertexTextures:x,floatFragmentTextures:y,floatVertexTextures:x&&y,maxSamples:s?t.getParameter(t.MAX_SAMPLES):0}}function af(t){const e=this;let i=null,n=0,r=!1,s=!1;const a=new fd,o=new bc,l={value:null,needsUpdate:!1};function h(){l.value!==i&&(l.value=i,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function c(t,i,n,r){const s=null!==t?t.length:0;let h=null;if(0!==s){if(h=l.value,!0!==r||null===h){const e=n+4*s,r=i.matrixWorldInverse;o.getNormalMatrix(r),(null===h||h.length\n\t\t\t\t\t#include \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 \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"},n=new su(5,5,5),r=new uu({name:"CubemapFromEquirect",uniforms:hu(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const s=new Zu(n,r),a=e.minFilter;e.minFilter===Gh&&(e.minFilter=Uh);return new cf(1,10,this).update(t,s),e.minFilter=a,s.geometry.dispose(),s.material.dispose(),this}clear(t,e,i,n){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,n);t.setRenderTarget(r)}}function ff(t){let e=new WeakMap;function i(t,e){return 303===e?t.mapping=Rh:304===e&&(t.mapping=Bh),t}function n(t){const i=t.target;i.removeEventListener("dispose",n);const r=e.get(i);void 0!==r&&(e.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){const s=r.mapping;if(303===s||304===s){if(e.has(r)){return i(e.get(r).texture,r.mapping)}{const s=r.image;if(s&&s.height>0){const a=new uf(s.height/2);return a.fromEquirectangularTexture(t,r),e.set(r,a),r.addEventListener("dispose",n),i(a.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}uf.prototype.isWebGLCubeRenderTarget=!0;class mf extends of{constructor(t=-1,e=1,i=1,n=-1,r=.1,s=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=n,this.near=r,this.far=s,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,i,n,r,s){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=i,this.view.offsetY=n,this.view.width=r,this.view.height=s,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),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2;let r=i-t,s=i+t,a=n+e,o=n-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;r+=t*this.view.offsetX,s=r+t*this.view.width,a-=e*this.view.offsetY,o=a-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,a,o,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}}mf.prototype.isOrthographicCamera=!0;const pf=[.125,.215,.35,.446,.526,.582],gf=20,_f=new mf,xf=new zc;let yf=null;const Af=(1+Math.sqrt(5))/2,vf=1/Af,bf=[new qc(1,1,1),new qc(-1,1,1),new qc(1,1,-1),new qc(-1,1,-1),new qc(0,Af,vf),new qc(0,Af,-vf),new qc(vf,0,Af),new qc(-vf,0,Af),new qc(Af,vf,0),new qc(-Af,vf,0)];class wf{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,i=.1,n=100){yf=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,i,n,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Cf(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Sf(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;tt-4?o=pf[a-t+4-1]:0===a&&(o=0),n.push(o);const l=1/(s-1),h=-l/2,c=1+l/2,d=[h,h,c,h,c,c,h,h,c,c,h,c],u=6,f=6,m=3,p=2,g=1,_=new Float32Array(m*f*u),x=new Float32Array(p*f*u),y=new Float32Array(g*f*u);for(let t=0;t2?0:-1,n=[e,i,0,e+2/3,i,0,e+2/3,i+1,0,e,i,0,e+2/3,i+1,0,e,i+1,0];_.set(n,m*f*t),x.set(d,p*f*t);const r=[t,t,t,t,t,t];y.set(r,g*f*t)}const A=new ru;A.setAttribute("position",new Pd(_,m)),A.setAttribute("uv",new Pd(x,p)),A.setAttribute("faceIndex",new Pd(y,g)),e.push(A),r>4&&r--}return{lodPlanes:e,sizeLods:i,sigmas:n}}(n)),this._blurMaterial=function(t,e,i){const n=new Float32Array(gf),r=new qc(0,1,0);return new uu({name:"SphericalGaussianBlur",defines:{n:gf,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Ef(),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#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \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}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(n,t,e)}return n}_compileMaterial(t){const e=new Zu(this._lodPlanes[0],t);this._renderer.compile(e,_f)}_sceneToCubeUV(t,e,i,n){const r=new lf(90,1,e,i),s=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,h=o.toneMapping;o.getClearColor(xf),o.toneMapping=0,o.autoClear=!1;const c=new Du({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),d=new Zu(new su,c);let u=!1;const f=t.background;f?f.isColor&&(c.color.copy(f),t.background=null,u=!0):(c.color.copy(xf),u=!0);for(let e=0;e<6;e++){const i=e%3;0===i?(r.up.set(0,s[e],0),r.lookAt(a[e],0,0)):1===i?(r.up.set(0,0,s[e]),r.lookAt(0,a[e],0)):(r.up.set(0,s[e],0),r.lookAt(0,0,a[e]));const l=this._cubeSize;Tf(n,i*l,e>2?l:0,l,l),o.setRenderTarget(n),u&&o.render(d,r),o.render(t,r)}d.geometry.dispose(),d.material.dispose(),o.toneMapping=h,o.autoClear=l,t.background=f}_textureToCubeUV(t,e){const i=this._renderer,n=t.mapping===Rh||t.mapping===Bh;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=Cf()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Sf());const r=n?this._cubemapMaterial:this._equirectMaterial,s=new Zu(this._lodPlanes[0],r);r.uniforms.envMap.value=t;const a=this._cubeSize;Tf(e,0,0,3*a,2*a),i.setRenderTarget(e),i.render(s,_f)}_applyPMREM(t){const e=this._renderer,i=e.autoClear;e.autoClear=!1;for(let e=1;egf&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);const p=[];let g=0;for(let t=0;t_-4?n-_+4:0),4*(this._cubeSize-x),3*x,2*x),o.setRenderTarget(e),o.render(h,_f)}}function Mf(t,e,i){const n=new Ic(t,e,i);return n.texture.mapping=Fh,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Tf(t,e,i,n,r){t.viewport.set(e,i,n,r),t.scissor.set(e,i,n,r)}function Sf(){return new uu({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ef(),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\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Cf(){return new uu({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ef(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Ef(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\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 Pf(t){let e=new WeakMap,i=null;function n(t){const i=t.target;i.removeEventListener("dispose",n);const r=e.get(i);void 0!==r&&(e.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,a=303===s||304===s,o=s===Rh||s===Bh;if(a||o){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let n=e.get(r);return null===i&&(i=new wf(t)),n=a?i.fromEquirectangular(r,n):i.fromCubemap(r,n),e.set(r,n),n.texture}if(e.has(r))return e.get(r).texture;{const s=r.image;if(a&&s&&s.height>0||o&&s&&function(t){let e=0;const i=6;for(let n=0;ne.maxTextureSize&&(S=Math.ceil(T/e.maxTextureSize),T=e.maxTextureSize);const C=new Float32Array(T*S*4*m),E=new Lf(C,T,S,m);E.format=Zh,E.type=Vh,E.needsUpdate=!0;const P=4*M;for(let z=0;z0)return t;const r=e*i;let s=Xf[r];if(void 0===s&&(s=new Float32Array(r),Xf[r]=s),0!==e){n.toArray(s,0);for(let n=1,r=0;n!==e;++n)r+=i,t[n].toArray(s,r)}return s}function Qf(t,e){if(t.length!==e.length)return!1;for(let i=0,n=t.length;i/gm;function tp(t){return t.replace(Km,ep)}function ep(t,e){const i=Ju[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return tp(i)}const ip=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,np=/#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 rp(t){return t.replace(np,ap).replace(ip,sp)}function sp(t,e,i,n){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),ap(t,e,i,n)}function ap(t,e,i,n){let r="";for(let t=parseInt(e);t0&&(g+="\n"),_=[f,m].filter(Zm).join("\n"),_.length>0&&(_+="\n")):(g=[op(i),"#define SHADER_NAME "+i.shaderName,m,i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define MAX_BONES "+i.maxBones,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+c:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularColorMap?"#define USE_SPECULARCOLORMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEENCOLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors&&i.isWebGL2?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.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(Zm).join("\n"),_=[f,op(i),"#define SHADER_NAME "+i.shaderName,m,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+h:"",i.envMap?"#define "+c:"",i.envMap?"#define "+d:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularColorMap?"#define USE_SPECULARCOLORMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEENCOLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?Ju.tonemapping_pars_fragment:"",0!==i.toneMapping?Wm("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",Ju.encodings_pars_fragment,Ym("linearToOutputTexel",i.outputEncoding),i.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Zm).join("\n")),a=tp(a),a=Qm(a,i),a=Jm(a,i),o=tp(o),o=Qm(o,i),o=Jm(o,i),a=rp(a),o=rp(o),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(x="#version 300 es\n",g=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,_=["#define varying in",i.glslVersion===oc?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===oc?"":"#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"+_);const y=x+g+a,A=x+_+o,v=Xm(r,r.VERTEX_SHADER,y),b=Xm(r,r.FRAGMENT_SHADER,A);if(r.attachShader(p,v),r.attachShader(p,b),void 0!==i.index0AttributeName?r.bindAttribLocation(p,0,i.index0AttributeName):!0===i.morphTargets&&r.bindAttribLocation(p,0,"position"),r.linkProgram(p),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(p).trim(),e=r.getShaderInfoLog(v).trim(),i=r.getShaderInfoLog(b).trim();let n=!0,s=!0;if(!1===r.getProgramParameter(p,r.LINK_STATUS)){n=!1;const e=Vm(r,v,"vertex"),i=Vm(r,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(p,r.VALIDATE_STATUS)+"\n\nProgram Info Log: "+t+"\n"+e+"\n"+i)}else""!==t?console.warn("THREE.WebGLProgram: Program Info Log:",t):""!==e&&""!==i||(s=!1);s&&(this.diagnostics={runnable:n,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:i,prefix:_}})}let w,M;return r.deleteShader(v),r.deleteShader(b),this.getUniforms=function(){return void 0===w&&(w=new Hm(r,p)),w},this.getAttributes=function(){return void 0===M&&(M=function(t,e){const i={},n=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r0,R=s.clearcoat>0;return{isWebGL2:c,shaderID:M,shaderName:s.type,vertexShader:E,fragmentShader:P,defines:s.defines,customVertexShaderID:k,customFragmentShaderID:z,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:p,instancing:!0===x.isInstancedMesh,instancingColor:!0===x.isInstancedMesh&&null!==x.instanceColor,supportsVertexTextures:m,outputEncoding:null===O?t.outputEncoding:!0===O.isXRRenderTarget?O.texture.encoding:nc,map:!!s.map,matcap:!!s.matcap,envMap:!!b,envMapMode:b&&b.mapping,envMapCubeUVHeight:w,lightMap:!!s.lightMap,aoMap:!!s.aoMap,emissiveMap:!!s.emissiveMap,bumpMap:!!s.bumpMap,normalMap:!!s.normalMap,objectSpaceNormalMap:1===s.normalMapType,tangentSpaceNormalMap:0===s.normalMapType,decodeVideoTexture:!!s.map&&!0===s.map.isVideoTexture&&s.map.encoding===rc,clearcoat:R,clearcoatMap:R&&!!s.clearcoatMap,clearcoatRoughnessMap:R&&!!s.clearcoatRoughnessMap,clearcoatNormalMap:R&&!!s.clearcoatNormalMap,displacementMap:!!s.displacementMap,roughnessMap:!!s.roughnessMap,metalnessMap:!!s.metalnessMap,specularMap:!!s.specularMap,specularIntensityMap:!!s.specularIntensityMap,specularColorMap:!!s.specularColorMap,opaque:!1===s.transparent&&1===s.blending,alphaMap:!!s.alphaMap,alphaTest:L,gradientMap:!!s.gradientMap,sheen:s.sheen>0,sheenColorMap:!!s.sheenColorMap,sheenRoughnessMap:!!s.sheenRoughnessMap,transmission:s.transmission>0,transmissionMap:!!s.transmissionMap,thicknessMap:!!s.thicknessMap,combine:s.combine,vertexTangents:!!s.normalMap&&!!A.attributes.tangent,vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!A.attributes.color&&4===A.attributes.color.itemSize,vertexUvs:!!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatMap||s.clearcoatRoughnessMap||s.clearcoatNormalMap||s.displacementMap||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheenColorMap||s.sheenRoughnessMap),uvsVertexOnly:!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatNormalMap||s.transmission>0||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheen>0||s.sheenColorMap||s.sheenRoughnessMap||!s.displacementMap),fog:!!y,useFog:s.fog,fogExp2:y&&y.isFogExp2,flatShading:!!s.flatShading,sizeAttenuation:s.sizeAttenuation,logarithmicDepthBuffer:d,skinning:!0===x.isSkinnedMesh&&T>0,maxBones:T,useVertexTexture:u,morphTargets:void 0!==A.morphAttributes.position,morphNormals:void 0!==A.morphAttributes.normal,morphColors:void 0!==A.morphAttributes.color,morphTargetsCount:C,morphTextureStride:D,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:s.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.length>0,shadowMapType:t.shadowMap.type,toneMapping:s.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:s.premultipliedAlpha,doubleSided:2===s.side,flipSided:1===s.side,depthPacking:void 0!==s.depthPacking&&s.depthPacking,index0AttributeName:s.index0AttributeName,extensionDerivatives:s.extensions&&s.extensions.derivatives,extensionFragDepth:s.extensions&&s.extensions.fragDepth,extensionDrawBuffers:s.extensions&&s.extensions.drawBuffers,extensionShaderTextureLOD:s.extensions&&s.extensions.shaderTextureLOD,rendererExtensionFragDepth:c||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||n.has("EXT_shader_texture_lod"),customProgramCacheKey:s.customProgramCacheKey()}},getProgramCacheKey:function(e){const i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.customVertexShaderID),i.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)i.push(t),i.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(!function(t,e){t.push(e.precision),t.push(e.outputEncoding),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.combine),t.push(e.vertexUvs),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.maxBones),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection)}(i,e),function(t,e){o.disableAll(),e.isWebGL2&&o.enable(0);e.supportsVertexTextures&&o.enable(1);e.instancing&&o.enable(2);e.instancingColor&&o.enable(3);e.map&&o.enable(4);e.matcap&&o.enable(5);e.envMap&&o.enable(6);e.lightMap&&o.enable(7);e.aoMap&&o.enable(8);e.emissiveMap&&o.enable(9);e.bumpMap&&o.enable(10);e.normalMap&&o.enable(11);e.objectSpaceNormalMap&&o.enable(12);e.tangentSpaceNormalMap&&o.enable(13);e.clearcoat&&o.enable(14);e.clearcoatMap&&o.enable(15);e.clearcoatRoughnessMap&&o.enable(16);e.clearcoatNormalMap&&o.enable(17);e.displacementMap&&o.enable(18);e.specularMap&&o.enable(19);e.roughnessMap&&o.enable(20);e.metalnessMap&&o.enable(21);e.gradientMap&&o.enable(22);e.alphaMap&&o.enable(23);e.alphaTest&&o.enable(24);e.vertexColors&&o.enable(25);e.vertexAlphas&&o.enable(26);e.vertexUvs&&o.enable(27);e.vertexTangents&&o.enable(28);e.uvsVertexOnly&&o.enable(29);e.fog&&o.enable(30);t.push(o.mask),o.disableAll(),e.useFog&&o.enable(0);e.flatShading&&o.enable(1);e.logarithmicDepthBuffer&&o.enable(2);e.skinning&&o.enable(3);e.useVertexTexture&&o.enable(4);e.morphTargets&&o.enable(5);e.morphNormals&&o.enable(6);e.morphColors&&o.enable(7);e.premultipliedAlpha&&o.enable(8);e.shadowMapEnabled&&o.enable(9);e.physicallyCorrectLights&&o.enable(10);e.doubleSided&&o.enable(11);e.flipSided&&o.enable(12);e.depthPacking&&o.enable(13);e.dithering&&o.enable(14);e.specularIntensityMap&&o.enable(15);e.specularColorMap&&o.enable(16);e.transmission&&o.enable(17);e.transmissionMap&&o.enable(18);e.thicknessMap&&o.enable(19);e.sheen&&o.enable(20);e.sheenColorMap&&o.enable(21);e.sheenRoughnessMap&&o.enable(22);e.decodeVideoTexture&&o.enable(23);e.opaque&&o.enable(24);t.push(o.mask)}(i,e),i.push(t.outputEncoding)),i.push(e.customProgramCacheKey),i.join()},getUniforms:function(t){const e=g[t.type];let i;if(e){const t=tf[e];i=du.clone(t.uniforms)}else i=t.uniforms;return i},acquireProgram:function(e,i){let n;for(let t=0,e=h.length;t0?n.push(c):!0===a.transparent?r.push(c):i.push(c)},unshift:function(t,e,a,o,l,h){const c=s(t,e,a,o,l,h);a.transmission>0?n.unshift(c):!0===a.transparent?r.unshift(c):i.unshift(c)},finish:function(){for(let i=e,n=t.length;i1&&i.sort(t||mp),n.length>1&&n.sort(e||pp),r.length>1&&r.sort(e||pp)}}}function _p(){let t=new WeakMap;return{get:function(e,i){let n;return!1===t.has(e)?(n=new gp,t.set(e,[n])):i>=t.get(e).length?(n=new gp,t.get(e).push(n)):n=t.get(e)[i],n},dispose:function(){t=new WeakMap}}}function xp(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":i={direction:new qc,color:new zc};break;case"SpotLight":i={position:new qc,direction:new qc,color:new zc,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new qc,color:new zc,distance:0,decay:0};break;case"HemisphereLight":i={direction:new qc,skyColor:new zc,groundColor:new zc};break;case"RectAreaLight":i={color:new zc,position:new qc,halfWidth:new qc,halfHeight:new qc}}return t[e.id]=i,i}}}let yp=0;function Ap(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function vp(t,e){const i=new xp,n=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new vc};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new vc,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}}(),r={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++)r.probe.push(new qc);const s=new qc,a=new _d,o=new _d;return{setup:function(s,a){let o=0,l=0,h=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let c=0,d=0,u=0,f=0,m=0,p=0,g=0,_=0;s.sort(Ap);const x=!0!==a?Math.PI:1;for(let t=0,e=s.length;t0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=Ku.LTC_FLOAT_1,r.rectAreaLTC2=Ku.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Ku.LTC_HALF_1,r.rectAreaLTC2=Ku.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=l,r.ambient[2]=h;const y=r.hash;y.directionalLength===c&&y.pointLength===d&&y.spotLength===u&&y.rectAreaLength===f&&y.hemiLength===m&&y.numDirectionalShadows===p&&y.numPointShadows===g&&y.numSpotShadows===_||(r.directional.length=c,r.spot.length=u,r.rectArea.length=f,r.point.length=d,r.hemi.length=m,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=_,r.spotShadowMap.length=_,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=g,r.spotShadowMatrix.length=_,y.directionalLength=c,y.pointLength=d,y.spotLength=u,y.rectAreaLength=f,y.hemiLength=m,y.numDirectionalShadows=p,y.numPointShadows=g,y.numSpotShadows=_,r.version=yp++)},setupView:function(t,e){let i=0,n=0,l=0,h=0,c=0;const d=e.matrixWorldInverse;for(let e=0,u=t.length;e=i.get(n).length?(s=new bp(t,e),i.get(n).push(s)):s=i.get(n)[r],s},dispose:function(){i=new WeakMap}}}class Mp extends lu{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}}Mp.prototype.isMeshDepthMaterial=!0;class Tp extends lu{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new qc,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}}Tp.prototype.isMeshDistanceMaterial=!0;function Sp(t,e,i){let n=new gd;const r=new vc,s=new vc,a=new Nc,o=new Mp({depthPacking:3201}),l=new Tp,h={},c=i.maxTextureSize,d={0:1,1:0,2:2},u=new uu({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new vc},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 \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}"}),f=u.clone();f.defines.HORIZONTAL_PASS=1;const m=new ru;m.setAttribute("position",new Pd(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const p=new Zu(m,u),g=this;function _(i,n){const r=e.update(p);u.defines.VSM_SAMPLES!==i.blurSamples&&(u.defines.VSM_SAMPLES=i.blurSamples,f.defines.VSM_SAMPLES=i.blurSamples,u.needsUpdate=!0,f.needsUpdate=!0),u.uniforms.shadow_pass.value=i.map.texture,u.uniforms.resolution.value=i.mapSize,u.uniforms.radius.value=i.radius,t.setRenderTarget(i.mapPass),t.clear(),t.renderBufferDirect(n,null,r,u,p,null),f.uniforms.shadow_pass.value=i.mapPass.texture,f.uniforms.resolution.value=i.mapSize,f.uniforms.radius.value=i.radius,t.setRenderTarget(i.map),t.clear(),t.renderBufferDirect(n,null,r,f,p,null)}function x(e,i,n,r,s,a){let c=null;const u=!0===n.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(c=void 0!==u?u:!0===n.isPointLight?l:o,t.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0){const t=c.uuid,e=i.uuid;let n=h[t];void 0===n&&(n={},h[t]=n);let r=n[e];void 0===r&&(r=c.clone(),n[e]=r),c=r}return c.visible=i.visible,c.wireframe=i.wireframe,c.side=3===a?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:d[i.side],c.alphaMap=i.alphaMap,c.alphaTest=i.alphaTest,c.clipShadows=i.clipShadows,c.clippingPlanes=i.clippingPlanes,c.clipIntersection=i.clipIntersection,c.displacementMap=i.displacementMap,c.displacementScale=i.displacementScale,c.displacementBias=i.displacementBias,c.wireframeLinewidth=i.wireframeLinewidth,c.linewidth=i.linewidth,!0===n.isPointLight&&!0===c.isMeshDistanceMaterial&&(c.referencePosition.setFromMatrixPosition(n.matrixWorld),c.nearDistance=r,c.farDistance=s),c}function y(i,r,s,a,o){if(!1===i.visible)return;if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&3===o)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,i.matrixWorld);const n=e.update(i),r=i.material;if(Array.isArray(r)){const e=n.groups;for(let l=0,h=e.length;lc||r.y>c)&&(r.x>c&&(s.x=Math.floor(c/f.x),r.x=s.x*f.x,d.mapSize.x=s.x),r.y>c&&(s.y=Math.floor(c/f.y),r.y=s.y*f.y,d.mapSize.y=s.y)),null===d.map&&!d.isPointLightShadow&&3===this.type){const t={minFilter:Uh,magFilter:Uh,format:Zh};d.map=new Ic(r.x,r.y,t),d.map.texture.name=h.name+".shadowMap",d.mapPass=new Ic(r.x,r.y,t),d.camera.updateProjectionMatrix()}if(null===d.map){const t={minFilter:qh,magFilter:qh,format:Zh};d.map=new Ic(r.x,r.y,t),d.map.texture.name=h.name+".shadowMap",d.camera.updateProjectionMatrix()}t.setRenderTarget(d.map),t.clear();const m=d.getViewportCount();for(let t=0;t=1):-1!==P.indexOf("OpenGL ES")&&(E=parseFloat(/^OpenGL ES (\d)/.exec(P)[1]),C=E>=2);let k=null,z={};const D=t.getParameter(t.SCISSOR_BOX),O=t.getParameter(t.VIEWPORT),L=(new Nc).fromArray(D),R=(new Nc).fromArray(O);function B(e,i,n){const r=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let e=0;en||t.height>n)&&(r=n/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const n=e?yc:Math.floor,s=n(r*t.width),a=n(r*t.height);void 0===m&&(m=_(s,a));const o=i?_(s,a):m;o.width=s,o.height=a;return o.getContext("2d").drawImage(t,0,0,s,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+s+"x"+a+")."),o}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function y(t){return xc(t.width)&&xc(t.height)}function A(t,e){return t.generateMipmaps&&e&&t.minFilter!==qh&&t.minFilter!==Uh}function v(e){t.generateMipmap(e)}function b(i,n,r,s,a=!1){if(!1===o)return n;if(null!==i){if(void 0!==t[i])return t[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let l=n;return n===t.RED&&(r===t.FLOAT&&(l=t.R32F),r===t.HALF_FLOAT&&(l=t.R16F),r===t.UNSIGNED_BYTE&&(l=t.R8)),n===t.RG&&(r===t.FLOAT&&(l=t.RG32F),r===t.HALF_FLOAT&&(l=t.RG16F),r===t.UNSIGNED_BYTE&&(l=t.RG8)),n===t.RGBA&&(r===t.FLOAT&&(l=t.RGBA32F),r===t.HALF_FLOAT&&(l=t.RGBA16F),r===t.UNSIGNED_BYTE&&(l=s===rc&&!1===a?t.SRGB8_ALPHA8:t.RGBA8),r===t.UNSIGNED_SHORT_4_4_4_4&&(l=t.RGBA4),r===t.UNSIGNED_SHORT_5_5_5_1&&(l=t.RGB5_A1)),l!==t.R16F&&l!==t.R32F&&l!==t.RG16F&&l!==t.RG32F&&l!==t.RGBA16F&&l!==t.RGBA32F||e.get("EXT_color_buffer_float"),l}function w(t,e,i){return!0===A(t,i)||t.isFramebufferTexture&&t.minFilter!==qh&&t.minFilter!==Uh?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function M(e){return e===qh||1004===e||1005===e?t.NEAREST:t.LINEAR}function T(t){const e=t.target;e.removeEventListener("dispose",T),function(t){const e=n.get(t);if(void 0===e.__webglInit)return;const i=t.source,r=p.get(i);if(r){const n=r[e.__cacheKey];n.usedTimes--,0===n.usedTimes&&C(t),0===Object.keys(r).length&&p.delete(i)}n.remove(t)}(e),e.isVideoTexture&&f.delete(e)}function S(e){const i=e.target;i.removeEventListener("dispose",S),function(e){const i=e.texture,r=n.get(e),s=n.get(i);void 0!==s.__webglTexture&&(t.deleteTexture(s.__webglTexture),a.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(r.__webglFramebuffer[e]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[e]);else t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&t.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(e.isWebGLMultipleRenderTargets)for(let e=0,r=i.length;e0&&s.__version!==e.version){const t=e.image;if(null===t)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==t.complete)return void L(s,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.activeTexture(t.TEXTURE0+r),i.bindTexture(t.TEXTURE_2D,s.__webglTexture)}const k={[Nh]:t.REPEAT,[Ih]:t.CLAMP_TO_EDGE,[jh]:t.MIRRORED_REPEAT},z={[qh]:t.NEAREST,1004:t.NEAREST_MIPMAP_NEAREST,1005:t.NEAREST_MIPMAP_LINEAR,[Uh]:t.LINEAR,1007:t.LINEAR_MIPMAP_NEAREST,[Gh]:t.LINEAR_MIPMAP_LINEAR};function D(i,s,a){if(a?(t.texParameteri(i,t.TEXTURE_WRAP_S,k[s.wrapS]),t.texParameteri(i,t.TEXTURE_WRAP_T,k[s.wrapT]),i!==t.TEXTURE_3D&&i!==t.TEXTURE_2D_ARRAY||t.texParameteri(i,t.TEXTURE_WRAP_R,k[s.wrapR]),t.texParameteri(i,t.TEXTURE_MAG_FILTER,z[s.magFilter]),t.texParameteri(i,t.TEXTURE_MIN_FILTER,z[s.minFilter])):(t.texParameteri(i,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(i,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),i!==t.TEXTURE_3D&&i!==t.TEXTURE_2D_ARRAY||t.texParameteri(i,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),s.wrapS===Ih&&s.wrapT===Ih||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(i,t.TEXTURE_MAG_FILTER,M(s.magFilter)),t.texParameteri(i,t.TEXTURE_MIN_FILTER,M(s.minFilter)),s.minFilter!==qh&&s.minFilter!==Uh&&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(s.type===Vh&&!1===e.has("OES_texture_float_linear"))return;if(!1===o&&s.type===Yh&&!1===e.has("OES_texture_half_float_linear"))return;(s.anisotropy>1||n.get(s).__currentAnisotropy)&&(t.texParameterf(i,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),n.get(s).__currentAnisotropy=s.anisotropy)}}function O(e,i){let n=!1;void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",T));const r=i.source;let s=p.get(r);void 0===s&&(s={},p.set(r,s));const o=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.encoding),e.join()}(i);if(o!==e.__cacheKey){void 0===s[o]&&(s[o]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,n=!0),s[o].usedTimes++;const r=s[e.__cacheKey];void 0!==r&&(s[e.__cacheKey].usedTimes--,0===r.usedTimes&&C(i)),e.__cacheKey=o,e.__webglTexture=s[o].texture}return n}function L(e,n,r){let a=t.TEXTURE_2D;n.isDataArrayTexture&&(a=t.TEXTURE_2D_ARRAY),n.isData3DTexture&&(a=t.TEXTURE_3D);const l=O(e,n),h=n.source;if(i.activeTexture(t.TEXTURE0+r),i.bindTexture(a,e.__webglTexture),h.version!==h.__currentVersion||!0===l){t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,n.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,n.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE);const r=function(t){return!o&&(t.wrapS!==Ih||t.wrapT!==Ih||t.minFilter!==qh&&t.minFilter!==Uh)}(n)&&!1===y(n.image);let l=x(n.image,r,!1,c);l=j(n,l);const d=y(l)||o,u=s.convert(n.format,n.encoding);let f,m=s.convert(n.type),p=b(n.internalFormat,u,m,n.encoding,n.isVideoTexture);D(a,n,d);const g=n.mipmaps,_=o&&!0!==n.isVideoTexture,M=void 0===e.__version,T=w(n,l,d);if(n.isDepthTexture)p=t.DEPTH_COMPONENT,o?p=n.type===Vh?t.DEPTH_COMPONENT32F:n.type===$h?t.DEPTH_COMPONENT24:n.type===Wh?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT16:n.type===Vh&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),n.format===Qh&&p===t.DEPTH_COMPONENT&&n.type!==Xh&&n.type!==$h&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),n.type=Xh,m=s.convert(n.type)),n.format===Jh&&p===t.DEPTH_COMPONENT&&(p=t.DEPTH_STENCIL,n.type!==Wh&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),n.type=Wh,m=s.convert(n.type))),_&&M?i.texStorage2D(t.TEXTURE_2D,1,p,l.width,l.height):i.texImage2D(t.TEXTURE_2D,0,p,l.width,l.height,0,u,m,null);else if(n.isDataTexture)if(g.length>0&&d){_&&M&&i.texStorage2D(t.TEXTURE_2D,T,p,g[0].width,g[0].height);for(let e=0,n=g.length;e0&&d){_&&M&&i.texStorage2D(t.TEXTURE_2D,T,p,g[0].width,g[0].height);for(let e=0,n=g.length;e0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function j(t,i){const n=t.encoding,r=t.format,s=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||t.format===lc||n!==nc&&(n===rc?!1===o?!0===e.has("EXT_sRGB")&&r===Zh?(t.format=lc,t.minFilter=Uh,t.generateMipmaps=!1):i=Oc.sRGBToLinear(i):r===Zh&&s===Hh||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",n)),i}this.allocateTextureUnit=function(){const t=E;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),E+=1,t},this.resetTextureUnits=function(){E=0},this.setTexture2D=P,this.setTexture2DArray=function(e,r){const s=n.get(e);e.version>0&&s.__version!==e.version?L(s,e,r):(i.activeTexture(t.TEXTURE0+r),i.bindTexture(t.TEXTURE_2D_ARRAY,s.__webglTexture))},this.setTexture3D=function(e,r){const s=n.get(e);e.version>0&&s.__version!==e.version?L(s,e,r):(i.activeTexture(t.TEXTURE0+r),i.bindTexture(t.TEXTURE_3D,s.__webglTexture))},this.setTextureCube=function(e,r){const a=n.get(e);e.version>0&&a.__version!==e.version?function(e,n,r){if(6!==n.image.length)return;const a=O(e,n),l=n.source;if(i.activeTexture(t.TEXTURE0+r),i.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture),l.version!==l.__currentVersion||!0===a){t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,n.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,n.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE);const r=n.isCompressedTexture||n.image[0].isCompressedTexture,a=n.image[0]&&n.image[0].isDataTexture,c=[];for(let t=0;t<6;t++)c[t]=r||a?a?n.image[t].image:n.image[t]:x(n.image[t],!1,!0,h),c[t]=j(n,c[t]);const d=c[0],u=y(d)||o,f=s.convert(n.format,n.encoding),m=s.convert(n.type),p=b(n.internalFormat,f,m,n.encoding),g=o&&!0!==n.isVideoTexture,_=void 0===e.__version;let M,T=w(n,d,u);if(D(t.TEXTURE_CUBE_MAP,n,u),r){g&&_&&i.texStorage2D(t.TEXTURE_CUBE_MAP,T,p,d.width,d.height);for(let e=0;e<6;e++){M=c[e].mipmaps;for(let r=0;r0&&T++,i.texStorage2D(t.TEXTURE_CUBE_MAP,T,p,c[0].width,c[0].height));for(let e=0;e<6;e++)if(a){g?i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,c[e].width,c[e].height,f,m,c[e].data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,p,c[e].width,c[e].height,0,f,m,c[e].data);for(let n=0;n0&&!1===I(e)){h.__webglMultisampledFramebuffer=t.createFramebuffer(),h.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,h.__webglColorRenderbuffer);const n=s.convert(l.format,l.encoding),r=s.convert(l.type),a=b(l.internalFormat,n,r,l.encoding),o=N(e);t.renderbufferStorageMultisample(t.RENDERBUFFER,o,a,e.width,e.height),i.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,h.__webglColorRenderbuffer),t.bindRenderbuffer(t.RENDERBUFFER,null),e.depthBuffer&&(h.__webglDepthRenderbuffer=t.createRenderbuffer(),B(h.__webglDepthRenderbuffer,e,!0)),i.bindFramebuffer(t.FRAMEBUFFER,null)}if(d){i.bindTexture(t.TEXTURE_CUBE_MAP,c.__webglTexture),D(t.TEXTURE_CUBE_MAP,l,f);for(let i=0;i<6;i++)R(h.__webglFramebuffer[i],e,l,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+i);A(l,f)&&v(t.TEXTURE_CUBE_MAP),i.unbindTexture()}else if(u){const r=e.texture;for(let s=0,a=r.length;s0&&!1===I(e)){const r=e.width,s=e.height;let a=t.COLOR_BUFFER_BIT;const o=[t.COLOR_ATTACHMENT0],l=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;e.depthBuffer&&o.push(l);const h=n.get(e),c=void 0!==h.__ignoreDepthValues&&h.__ignoreDepthValues;!1===c&&(e.depthBuffer&&(a|=t.DEPTH_BUFFER_BIT),e.stencilBuffer&&(a|=t.STENCIL_BUFFER_BIT)),i.bindFramebuffer(t.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),i.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglFramebuffer),!0===c&&(t.invalidateFramebuffer(t.READ_FRAMEBUFFER,[l]),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[l])),t.blitFramebuffer(0,0,r,s,0,0,r,s,a,t.NEAREST),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,o),i.bindFramebuffer(t.READ_FRAMEBUFFER,null),i.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=F,this.setupFrameBufferTexture=R,this.useMultisampledRTT=I}function Pp(t,e,i){const n=i.isWebGL2;return{convert:function(i,r=null){let s;if(i===Hh)return t.UNSIGNED_BYTE;if(1017===i)return t.UNSIGNED_SHORT_4_4_4_4;if(1018===i)return t.UNSIGNED_SHORT_5_5_5_1;if(1010===i)return t.BYTE;if(1011===i)return t.SHORT;if(i===Xh)return t.UNSIGNED_SHORT;if(1013===i)return t.INT;if(i===$h)return t.UNSIGNED_INT;if(i===Vh)return t.FLOAT;if(i===Yh)return n?t.HALF_FLOAT:(s=e.get("OES_texture_half_float"),null!==s?s.HALF_FLOAT_OES:null);if(1021===i)return t.ALPHA;if(i===Zh)return t.RGBA;if(1024===i)return t.LUMINANCE;if(1025===i)return t.LUMINANCE_ALPHA;if(i===Qh)return t.DEPTH_COMPONENT;if(i===Jh)return t.DEPTH_STENCIL;if(1028===i)return t.RED;if(1022===i)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),t.RGBA;if(i===lc)return s=e.get("EXT_sRGB"),null!==s?s.SRGB_ALPHA_EXT:null;if(1029===i)return t.RED_INTEGER;if(1030===i)return t.RG;if(1031===i)return t.RG_INTEGER;if(1033===i)return t.RGBA_INTEGER;if(i===Kh||i===tc||i===ec||i===ic)if(r===rc){if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===s)return null;if(i===Kh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===tc)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===ec)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===ic)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(s=e.get("WEBGL_compressed_texture_s3tc"),null===s)return null;if(i===Kh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===tc)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===ec)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===ic)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===i||35841===i||35842===i||35843===i){if(s=e.get("WEBGL_compressed_texture_pvrtc"),null===s)return null;if(35840===i)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===i)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===i)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===i)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===i)return s=e.get("WEBGL_compressed_texture_etc1"),null!==s?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(37492===i||37496===i){if(s=e.get("WEBGL_compressed_texture_etc"),null===s)return null;if(37492===i)return r===rc?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(37496===i)return r===rc?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}if(37808===i||37809===i||37810===i||37811===i||37812===i||37813===i||37814===i||37815===i||37816===i||37817===i||37818===i||37819===i||37820===i||37821===i){if(s=e.get("WEBGL_compressed_texture_astc"),null===s)return null;if(37808===i)return r===rc?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===i)return r===rc?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===i)return r===rc?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===i)return r===rc?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===i)return r===rc?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===i)return r===rc?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===i)return r===rc?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===i)return r===rc?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===i)return r===rc?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===i)return r===rc?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===i)return r===rc?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===i)return r===rc?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===i)return r===rc?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===i)return r===rc?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===i){if(s=e.get("EXT_texture_compression_bptc"),null===s)return null;if(36492===i)return r===rc?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT}return i===Wh?n?t.UNSIGNED_INT_24_8:(s=e.get("WEBGL_depth_texture"),null!==s?s.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}class kp extends lf{constructor(t=[]){super(),this.cameras=t}}kp.prototype.isArrayCamera=!0;class zp extends Zd{constructor(){super(),this.type="Group"}}zp.prototype.isGroup=!0;const Dp={type:"move"};class Op{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new zp,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 zp,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new qc,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new qc),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new zp,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new qc,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new qc),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,i){let n=null,r=null,s=null;const a=this._targetRay,o=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==a&&(n=e.getPose(t.targetRaySpace,i),null!==n&&(a.matrix.fromArray(n.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),n.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(n.linearVelocity)):a.hasLinearVelocity=!1,n.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(n.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Dp))),l&&t.hand){s=!0;for(const n of t.hand.values()){const t=e.getJointPose(n,i);if(void 0===l.joints[n.jointName]){const t=new zp;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[n.jointName]=t,l.add(t)}const r=l.joints[n.jointName];null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const n=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],a=n.position.distanceTo(r.position),o=.02,h=.005;l.inputState.pinching&&a>o+h?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&a<=o-h&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,i),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));return null!==a&&(a.visible=null!==n),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==s),this}}class Lp extends Fc{constructor(t,e,i,n,r,s,a,o,l,h){if((h=void 0!==h?h:Qh)!==Qh&&h!==Jh)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&h===Qh&&(i=Xh),void 0===i&&h===Jh&&(i=Wh),super(null,n,r,s,a,o,h,i,l),this.image={width:t,height:e},this.magFilter=void 0!==a?a:qh,this.minFilter=void 0!==o?o:qh,this.flipY=!1,this.generateMipmaps=!1}}Lp.prototype.isDepthTexture=!0;class Rp extends hc{constructor(t,e){super();const i=this;let n=null,r=1,s=null,a="local-floor",o=null,l=null,h=null,c=null,d=null;const u=e.getContextAttributes();let f=null,m=null;const p=[],g=new Map,_=new lf;_.layers.enable(1),_.viewport=new Nc;const x=new lf;x.layers.enable(2),x.viewport=new Nc;const y=[_,x],A=new kp;A.layers.enable(1),A.layers.enable(2);let v=null,b=null;function w(t){const e=g.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function M(){g.forEach((function(t,e){t.disconnect(e)})),g.clear(),v=null,b=null,t.setRenderTarget(f),c=null,h=null,l=null,n=null,m=null,k.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}function T(t){const e=n.inputSources;for(let t=0;t0&&(e.alphaTest.value=i.alphaTest);const n=t.get(i).envMap;let r,s;n&&(e.envMap.value=n,e.flipEnvMap.value=n.isCubeTexture&&!1===n.isRenderTargetTexture?-1:1,e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity),i.map?r=i.map:i.specularMap?r=i.specularMap:i.displacementMap?r=i.displacementMap:i.normalMap?r=i.normalMap:i.bumpMap?r=i.bumpMap:i.roughnessMap?r=i.roughnessMap:i.metalnessMap?r=i.metalnessMap:i.alphaMap?r=i.alphaMap:i.emissiveMap?r=i.emissiveMap:i.clearcoatMap?r=i.clearcoatMap:i.clearcoatNormalMap?r=i.clearcoatNormalMap:i.clearcoatRoughnessMap?r=i.clearcoatRoughnessMap:i.specularIntensityMap?r=i.specularIntensityMap:i.specularColorMap?r=i.specularColorMap:i.transmissionMap?r=i.transmissionMap:i.thicknessMap?r=i.thicknessMap:i.sheenColorMap?r=i.sheenColorMap:i.sheenRoughnessMap&&(r=i.sheenRoughnessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix)),i.aoMap?s=i.aoMap:i.lightMap&&(s=i.lightMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),e.uv2Transform.value.copy(s.matrix))}function i(e,i){e.roughness.value=i.roughness,e.metalness.value=i.metalness,i.roughnessMap&&(e.roughnessMap.value=i.roughnessMap),i.metalnessMap&&(e.metalnessMap.value=i.metalnessMap),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap),i.bumpMap&&(e.bumpMap.value=i.bumpMap,e.bumpScale.value=i.bumpScale,1===i.side&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,e.normalScale.value.copy(i.normalScale),1===i.side&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias);t.get(i).envMap&&(e.envMapIntensity.value=i.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,n,r,s,a){n.isMeshBasicMaterial?e(t,n):n.isMeshLambertMaterial?(e(t,n),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,n)):n.isMeshToonMaterial?(e(t,n),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,n)):n.isMeshPhongMaterial?(e(t,n),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,n)):n.isMeshStandardMaterial?(e(t,n),n.isMeshPhysicalMaterial?function(t,e,n){i(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=n.texture,t.transmissionSamplerSize.value.set(n.width,n.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,n,a):i(t,n)):n.isMeshMatcapMaterial?(e(t,n),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,n)):n.isMeshDepthMaterial?(e(t,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshDistanceMaterial?(e(t,n),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,n)):n.isMeshNormalMaterial?(e(t,n),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,n)):n.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,n),n.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,n)):n.isPointsMaterial?function(t,e,i,n){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*n,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let r;e.map?r=e.map:e.alphaMap&&(r=e.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,n,r,s):n.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 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,n):n.isShadowMaterial?(t.color.value.copy(n.color),t.opacity.value=n.opacity):n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)}}}function Fp(t={}){const e=void 0!==t.canvas?t.canvas:function(){const t=Mc("canvas");return t.style.display="block",t}(),i=void 0!==t.context?t.context:null,n=void 0===t.depth||t.depth,r=void 0===t.stencil||t.stencil,s=void 0!==t.antialias&&t.antialias,a=void 0===t.premultipliedAlpha||t.premultipliedAlpha,o=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,l=void 0!==t.powerPreference?t.powerPreference:"default",h=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let c;c=void 0!==t.context?i.getContextAttributes().alpha:void 0!==t.alpha&&t.alpha;let d=null,u=null;const f=[],m=[];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.outputEncoding=nc,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;const p=this;let g=!1,_=0,x=0,y=null,A=-1,v=null;const b=new Nc,w=new Nc;let M=null,T=e.width,S=e.height,C=1,E=null,P=null;const k=new Nc(0,0,T,S),z=new Nc(0,0,T,S);let D=!1;const O=new gd;let L=!1,R=!1,B=null;const F=new _d,N=new vc,I=new qc,j={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function q(){return null===y?C:1}let U,G,H,X,$,V,Y,W,Z,Q,J,K,tt,et,it,nt,rt,st,at,ot,lt,ht,ct,dt=i;function ut(t,i){for(let n=0;n0&&function(t,e,i){const n=G.isWebGL2;null===B&&(B=new Ic(1,1,{generateMipmaps:!0,type:null!==ht.convert(Yh)?Yh:Hh,minFilter:Gh,samples:n&&!0===s?4:0}));p.getDrawingBufferSize(N),n?B.setSize(N.x,N.y):B.setSize(yc(N.x),yc(N.y));const r=p.getRenderTarget();p.setRenderTarget(B),p.clear();const a=p.toneMapping;p.toneMapping=0,Mt(t,e,i),p.toneMapping=a,V.updateMultisampleRenderTarget(B),V.updateRenderTargetMipmap(B),p.setRenderTarget(r)}(r,e,i),n&&H.viewport(b.copy(n)),r.length>0&&Mt(r,e,i),a.length>0&&Mt(a,e,i),o.length>0&&Mt(o,e,i),H.buffers.depth.setTest(!0),H.buffers.depth.setMask(!0),H.buffers.color.setMask(!0),H.setPolygonOffset(!1)}function Mt(t,e,i){const n=!0===e.isScene?e.overrideMaterial:null;for(let r=0,s=t.length;r0?m[m.length-1]:null,f.pop(),d=f.length>0?f[f.length-1]:null},this.getActiveCubeFace=function(){return _},this.getActiveMipmapLevel=function(){return x},this.getRenderTarget=function(){return y},this.setRenderTargetTextures=function(t,e,i){$.get(t.texture).__webglTexture=e,$.get(t.depthTexture).__webglTexture=i;const n=$.get(t);n.__hasExternalTextures=!0,n.__hasExternalTextures&&(n.__autoAllocateDepthBuffer=void 0===i,n.__autoAllocateDepthBuffer||!0===U.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),n.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){const i=$.get(t);i.__webglFramebuffer=e,i.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,i=0){y=t,_=e,x=i;let n=!0;if(t){const e=$.get(t);void 0!==e.__useDefaultFramebuffer?(H.bindFramebuffer(dt.FRAMEBUFFER,null),n=!1):void 0===e.__webglFramebuffer?V.setupRenderTarget(t):e.__hasExternalTextures&&V.rebindTextures(t,$.get(t.texture).__webglTexture,$.get(t.depthTexture).__webglTexture)}let r=null,s=!1,a=!1;if(t){const i=t.texture;(i.isData3DTexture||i.isDataArrayTexture)&&(a=!0);const n=$.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=n[e],s=!0):r=G.isWebGL2&&t.samples>0&&!1===V.useMultisampledRTT(t)?$.get(t).__webglMultisampledFramebuffer:n,b.copy(t.viewport),w.copy(t.scissor),M=t.scissorTest}else b.copy(k).multiplyScalar(C).floor(),w.copy(z).multiplyScalar(C).floor(),M=D;if(H.bindFramebuffer(dt.FRAMEBUFFER,r)&&G.drawBuffers&&n&&H.drawBuffers(t,r),H.viewport(b),H.scissor(w),H.setScissorTest(M),s){const n=$.get(t.texture);dt.framebufferTexture2D(dt.FRAMEBUFFER,dt.COLOR_ATTACHMENT0,dt.TEXTURE_CUBE_MAP_POSITIVE_X+e,n.__webglTexture,i)}else if(a){const n=$.get(t.texture),r=e||0;dt.framebufferTextureLayer(dt.FRAMEBUFFER,dt.COLOR_ATTACHMENT0,n.__webglTexture,i||0,r)}A=-1},this.readRenderTargetPixels=function(t,e,i,n,r,s,a){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=$.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){H.bindFramebuffer(dt.FRAMEBUFFER,o);try{const a=t.texture,o=a.format,l=a.type;if(o!==Zh&&ht.convert(o)!==dt.getParameter(dt.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const h=l===Yh&&(U.has("EXT_color_buffer_half_float")||G.isWebGL2&&U.has("EXT_color_buffer_float"));if(!(l===Hh||ht.convert(l)===dt.getParameter(dt.IMPLEMENTATION_COLOR_READ_TYPE)||l===Vh&&(G.isWebGL2||U.has("OES_texture_float")||U.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");dt.checkFramebufferStatus(dt.FRAMEBUFFER)===dt.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&dt.readPixels(e,i,n,r,ht.convert(o),ht.convert(l),s):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const t=null!==y?$.get(y).__webglFramebuffer:null;H.bindFramebuffer(dt.FRAMEBUFFER,t)}}},this.copyFramebufferToTexture=function(t,e,i=0){if(!0!==e.isFramebufferTexture)return void console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");const n=Math.pow(2,-i),r=Math.floor(e.image.width*n),s=Math.floor(e.image.height*n);V.setTexture2D(e,0),dt.copyTexSubImage2D(dt.TEXTURE_2D,i,0,0,t.x,t.y,r,s),H.unbindTexture()},this.copyTextureToTexture=function(t,e,i,n=0){const r=e.image.width,s=e.image.height,a=ht.convert(i.format),o=ht.convert(i.type);V.setTexture2D(i,0),dt.pixelStorei(dt.UNPACK_FLIP_Y_WEBGL,i.flipY),dt.pixelStorei(dt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),dt.pixelStorei(dt.UNPACK_ALIGNMENT,i.unpackAlignment),e.isDataTexture?dt.texSubImage2D(dt.TEXTURE_2D,n,t.x,t.y,r,s,a,o,e.image.data):e.isCompressedTexture?dt.compressedTexSubImage2D(dt.TEXTURE_2D,n,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,a,e.mipmaps[0].data):dt.texSubImage2D(dt.TEXTURE_2D,n,t.x,t.y,a,o,e.image),0===n&&i.generateMipmaps&&dt.generateMipmap(dt.TEXTURE_2D),H.unbindTexture()},this.copyTextureToTexture3D=function(t,e,i,n,r=0){if(p.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const s=t.max.x-t.min.x+1,a=t.max.y-t.min.y+1,o=t.max.z-t.min.z+1,l=ht.convert(n.format),h=ht.convert(n.type);let c;if(n.isData3DTexture)V.setTexture3D(n,0),c=dt.TEXTURE_3D;else{if(!n.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");V.setTexture2DArray(n,0),c=dt.TEXTURE_2D_ARRAY}dt.pixelStorei(dt.UNPACK_FLIP_Y_WEBGL,n.flipY),dt.pixelStorei(dt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),dt.pixelStorei(dt.UNPACK_ALIGNMENT,n.unpackAlignment);const d=dt.getParameter(dt.UNPACK_ROW_LENGTH),u=dt.getParameter(dt.UNPACK_IMAGE_HEIGHT),f=dt.getParameter(dt.UNPACK_SKIP_PIXELS),m=dt.getParameter(dt.UNPACK_SKIP_ROWS),g=dt.getParameter(dt.UNPACK_SKIP_IMAGES),_=i.isCompressedTexture?i.mipmaps[0]:i.image;dt.pixelStorei(dt.UNPACK_ROW_LENGTH,_.width),dt.pixelStorei(dt.UNPACK_IMAGE_HEIGHT,_.height),dt.pixelStorei(dt.UNPACK_SKIP_PIXELS,t.min.x),dt.pixelStorei(dt.UNPACK_SKIP_ROWS,t.min.y),dt.pixelStorei(dt.UNPACK_SKIP_IMAGES,t.min.z),i.isDataTexture||i.isData3DTexture?dt.texSubImage3D(c,r,e.x,e.y,e.z,s,a,o,l,h,_.data):i.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),dt.compressedTexSubImage3D(c,r,e.x,e.y,e.z,s,a,o,l,_.data)):dt.texSubImage3D(c,r,e.x,e.y,e.z,s,a,o,l,h,_),dt.pixelStorei(dt.UNPACK_ROW_LENGTH,d),dt.pixelStorei(dt.UNPACK_IMAGE_HEIGHT,u),dt.pixelStorei(dt.UNPACK_SKIP_PIXELS,f),dt.pixelStorei(dt.UNPACK_SKIP_ROWS,m),dt.pixelStorei(dt.UNPACK_SKIP_IMAGES,g),0===r&&n.generateMipmaps&&dt.generateMipmap(c),H.unbindTexture()},this.initTexture=function(t){V.setTexture2D(t,0),H.unbindTexture()},this.resetState=function(){_=0,x=0,y=null,H.reset(),ct.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Fp.prototype.isWebGLRenderer=!0;class Np{constructor(t,e=1,i=1e3){this.name="",this.color=new zc(t),this.near=e,this.far=i}clone(){return new Np(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}Np.prototype.isFog=!0;class Ip extends Zd{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}}Ip.prototype.isScene=!0;class jp extends lu{constructor(t){super(),this.type="LineBasicMaterial",this.color=new zc(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}}jp.prototype.isLineBasicMaterial=!0;const qp=new qc,Up=new qc,Gp=new _d,Hp=new Au,Xp=new hd;class $p extends Zd{constructor(t=new ru,e=new jp){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,i=[0];for(let t=1,n=e.count;to)continue;d.applyMatrix4(this.matrixWorld);const u=t.ray.origin.distanceTo(d);ut.far||e.push({distance:u,point:c.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}else{for(let i=Math.max(0,s.start),n=Math.min(r.count,s.start+s.count)-1;io)continue;d.applyMatrix4(this.matrixWorld);const n=t.ray.origin.distanceTo(d);nt.far||e.push({distance:n,point:c.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}}else i.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,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}$p.prototype.isLine=!0;const Vp=new qc,Yp=new qc;class Wp extends $p{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,i=[];for(let t=0,n=e.count;t0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function ig(t,e,i,n,r,s,a){const o=Jp.distanceSqToPoint(t);if(or.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:i,index:e,face:null,object:a})}}eg.prototype.isPoints=!0;class ng extends Fc{constructor(t=null,e=1,i=1,n,r,s,a,o,l=1003,h=1003,c,d){super(null,s,a,o,l,h,n,r,c,d),this.image={data:t,width:e,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}ng.prototype.isDataTexture=!0;class rg extends Fc{constructor(t,e,i,n,r,s,a,o,l){super(t,e,i,n,r,s,a,o,l),this.needsUpdate=!0}}rg.prototype.isCanvasTexture=!0;class sg extends ru{constructor(t=1,e=8,i=0,n=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},e=Math.max(3,e);const r=[],s=[],a=[],o=[],l=new qc,h=new vc;s.push(0,0,0),a.push(0,0,1),o.push(.5,.5);for(let r=0,c=3;r<=e;r++,c+=3){const d=i+r/e*n;l.x=t*Math.cos(d),l.y=t*Math.sin(d),s.push(l.x,l.y,l.z),a.push(0,0,1),h.x=(s[c]/t+1)/2,h.y=(s[c+1]/t+1)/2,o.push(h.x,h.y)}for(let t=1;t<=e;t++)r.push(t,t+1,0);this.setIndex(r),this.setAttribute("position",new Dd(s,3)),this.setAttribute("normal",new Dd(a,3)),this.setAttribute("uv",new Dd(o,2))}static fromJSON(t){return new sg(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class ag extends ru{constructor(t=1,e=1,i=1,n=8,r=1,s=!1,a=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o};const l=this;n=Math.floor(n),r=Math.floor(r);const h=[],c=[],d=[],u=[];let f=0;const m=[],p=i/2;let g=0;function _(i){const r=f,s=new vc,m=new qc;let _=0;const x=!0===i?t:e,y=!0===i?1:-1;for(let t=1;t<=n;t++)c.push(0,p*y,0),d.push(0,y,0),u.push(.5,.5),f++;const A=f;for(let t=0;t<=n;t++){const e=t/n*o+a,i=Math.cos(e),r=Math.sin(e);m.x=x*r,m.y=p*y,m.z=x*i,c.push(m.x,m.y,m.z),d.push(0,y,0),s.x=.5*i+.5,s.y=.5*r*y+.5,u.push(s.x,s.y),f++}for(let t=0;t0&&_(!0),e>0&&_(!1)),this.setIndex(h),this.setAttribute("position",new Dd(c,3)),this.setAttribute("normal",new Dd(d,3)),this.setAttribute("uv",new Dd(u,2))}static fromJSON(t){return new ag(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class og extends ru{constructor(t=[],e=[],i=1,n=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:n};const r=[],s=[];function a(t,e,i,n){const r=n+1,s=[];for(let n=0;n<=r;n++){s[n]=[];const a=t.clone().lerp(i,n/r),o=e.clone().lerp(i,n/r),l=r-n;for(let t=0;t<=l;t++)s[n][t]=0===t&&n===r?a:a.clone().lerp(o,t/l)}for(let t=0;t.9&&a<.1&&(e<.2&&(s[t+0]+=1),i<.2&&(s[t+2]+=1),n<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new Dd(r,3)),this.setAttribute("normal",new Dd(r.slice(),3)),this.setAttribute("uv",new Dd(s,2)),0===n?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(t){return new og(t.vertices,t.indices,t.radius,t.details)}}new qc,new qc,new qc,new zu;class lg{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/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 i,n=this.getPoint(0),r=0;e.push(0);for(let s=1;s<=t;s++)i=this.getPoint(s/t),r+=i.distanceTo(n),e.push(r),n=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const i=this.getLengths();let n=0;const r=i.length;let s;s=e||t*i[r-1];let a,o=0,l=r-1;for(;o<=l;)if(n=Math.floor(o+(l-o)/2),a=i[n]-s,a<0)o=n+1;else{if(!(a>0)){l=n;break}l=n-1}if(n=l,i[n]===s)return n/(r-1);const h=i[n];return(n+(s-h)/(i[n+1]-h))/(r-1)}getTangent(t,e){const i=1e-4;let n=t-i,r=t+i;n<0&&(n=0),r>1&&(r=1);const s=this.getPoint(n),a=this.getPoint(r),o=e||(s.isVector2?new vc:new qc);return o.copy(a).sub(s).normalize(),o}getTangentAt(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e){const i=new qc,n=[],r=[],s=[],a=new qc,o=new _d;for(let e=0;e<=t;e++){const i=e/t;n[e]=this.getTangentAt(i,new qc)}r[0]=new qc,s[0]=new qc;let l=Number.MAX_VALUE;const h=Math.abs(n[0].x),c=Math.abs(n[0].y),d=Math.abs(n[0].z);h<=l&&(l=h,i.set(1,0,0)),c<=l&&(l=c,i.set(0,1,0)),d<=l&&i.set(0,0,1),a.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],a),s[0].crossVectors(n[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),s[e]=s[e-1].clone(),a.crossVectors(n[e-1],n[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(pc(n[e-1].dot(n[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(a,t))}s[e].crossVectors(n[e],r[e])}if(!0===e){let e=Math.acos(pc(r[0].dot(r[t]),-1,1));e/=t,n[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let i=1;i<=t;i++)r[i].applyMatrix4(o.makeRotationAxis(n[i],e*i)),s[i].crossVectors(n[i],r[i])}return{tangents:n,normals:r,binormals:s}}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 hg extends lg{constructor(t=0,e=0,i=1,n=1,r=0,s=2*Math.PI,a=!1,o=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(t,e){const i=e||new vc,n=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)n;)r-=n;r0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===h&&l===r-1&&(l=r-2,h=1),this.closed||l>0?a=n[(l-1)%r]:(ug.subVectors(n[0],n[1]).add(n[0]),a=ug);const c=n[l%r],d=n[(l+1)%r];if(this.closed||l+2n.length-2?n.length-1:s+1],c=n[s>n.length-3?n.length-1:s+2];return i.set(_g(a,o.x,l.x,h.x,c.x),_g(a,o.y,l.y,h.y,c.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e=i){const t=n[r]-i,s=this.curves[r],a=s.getLength(),o=0===a?0:1-t/a;return s.getPointAt(o,e)}r++}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 i=0,n=this.curves.length;i1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const h=l.getPoint(1);return this.currentPoint.copy(h),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 Pg extends Eg{constructor(t){super(t),this.uuid=mc(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let i=0,n=this.holes.length;i80*i){o=h=t[0],l=c=t[1];for(let e=i;eh&&(h=d),u>c&&(c=u);f=Math.max(h-o,c-l),f=0!==f?1/f:0}return Og(s,a,i,o,l,f),a};function zg(t,e,i,n,r){let s,a;if(r===function(t,e,i,n){let r=0;for(let s=e,a=i-n;s0)for(s=e;s=e;s-=n)a=Jg(s,t[s],t[s+1],a);return a&&$g(a,a.next)&&(Kg(a),a=a.next),a}function Dg(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!$g(n,n.next)&&0!==Xg(n.prev,n,n.next))n=n.next;else{if(Kg(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function Og(t,e,i,n,r,s,a){if(!t)return;!a&&s&&function(t,e,i,n){let r=t;do{null===r.z&&(r.z=qg(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i,n,r,s,a,o,l,h=1;do{for(i=t,t=null,s=null,a=0;i;){for(a++,n=i,o=0,e=0;e0||l>0&&n;)0!==o&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,o--):(r=n,n=n.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,h*=2}while(a>1)}(r)}(t,n,r,s);let o,l,h=t;for(;t.prev!==t.next;)if(o=t.prev,l=t.next,s?Rg(t,n,r,s):Lg(t))e.push(o.i/i),e.push(t.i/i),e.push(l.i/i),Kg(t),t=l.next,h=l.next;else if((t=l)===h){a?1===a?Og(t=Bg(Dg(t),e,i),e,i,n,r,s,2):2===a&&Fg(t,e,i,n,r,s):Og(Dg(t),e,i,n,r,s,1);break}}function Lg(t){const e=t.prev,i=t,n=t.next;if(Xg(e,i,n)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(Gg(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&Xg(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Rg(t,e,i,n){const r=t.prev,s=t,a=t.next;if(Xg(r,s,a)>=0)return!1;const o=r.xs.x?r.x>a.x?r.x:a.x:s.x>a.x?s.x:a.x,c=r.y>s.y?r.y>a.y?r.y:a.y:s.y>a.y?s.y:a.y,d=qg(o,l,e,i,n),u=qg(h,c,e,i,n);let f=t.prevZ,m=t.nextZ;for(;f&&f.z>=d&&m&&m.z<=u;){if(f!==t.prev&&f!==t.next&&Gg(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&Xg(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,m!==t.prev&&m!==t.next&&Gg(r.x,r.y,s.x,s.y,a.x,a.y,m.x,m.y)&&Xg(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;f&&f.z>=d;){if(f!==t.prev&&f!==t.next&&Gg(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&Xg(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;m&&m.z<=u;){if(m!==t.prev&&m!==t.next&&Gg(r.x,r.y,s.x,s.y,a.x,a.y,m.x,m.y)&&Xg(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function Bg(t,e,i){let n=t;do{const r=n.prev,s=n.next.next;!$g(r,s)&&Vg(r,n,n.next,s)&&Zg(r,s)&&Zg(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),Kg(n),Kg(n.next),n=t=s),n=n.next}while(n!==t);return Dg(n)}function Fg(t,e,i,n,r,s){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&Hg(a,t)){let o=Qg(a,t);return a=Dg(a,a.next),o=Dg(o,o.next),Og(a,e,i,n,r,s),void Og(o,e,i,n,r,s)}t=t.next}a=a.next}while(a!==t)}function Ng(t,e){return t.x-e.x}function Ig(t,e){if(e=function(t,e){let i=e;const n=t.x,r=t.y;let s,a=-1/0;do{if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){const t=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=n&&t>a){if(a=t,t===n){if(r===i.y)return i;if(r===i.next.y)return i.next}s=i.x=i.x&&i.x>=l&&n!==i.x&&Gg(rs.x||i.x===s.x&&jg(s,i)))&&(s=i,d=c)),i=i.next}while(i!==o);return s}(t,e),e){const i=Qg(e,t);Dg(e,e.next),Dg(i,i.next)}}function jg(t,e){return Xg(t.prev,t,e.prev)<0&&Xg(e.next,t,t.next)<0}function qg(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ug(t){let e=t,i=t;do{(e.x=0&&(t-a)*(n-o)-(i-a)*(e-o)>=0&&(i-a)*(s-o)-(r-a)*(n-o)>=0}function Hg(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Vg(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Zg(t,e)&&Zg(e,t)&&function(t,e){let i=t,n=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(Xg(t.prev,t,e.prev)||Xg(t,e.prev,e))||$g(t,e)&&Xg(t.prev,t,t.next)>0&&Xg(e.prev,e,e.next)>0)}function Xg(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function $g(t,e){return t.x===e.x&&t.y===e.y}function Vg(t,e,i,n){const r=Wg(Xg(t,e,i)),s=Wg(Xg(t,e,n)),a=Wg(Xg(i,n,t)),o=Wg(Xg(i,n,e));return r!==s&&a!==o||(!(0!==r||!Yg(t,i,e))||(!(0!==s||!Yg(t,n,e))||(!(0!==a||!Yg(i,t,n))||!(0!==o||!Yg(i,e,n)))))}function Yg(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Wg(t){return t>0?1:t<0?-1:0}function Zg(t,e){return Xg(t.prev,t,t.next)<0?Xg(t,e,t.next)>=0&&Xg(t,t.prev,e)>=0:Xg(t,e,t.prev)<0||Xg(t,t.next,e)<0}function Qg(t,e){const i=new t_(t.i,t.x,t.y),n=new t_(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function Jg(t,e,i,n){const r=new t_(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Kg(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 t_(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class e_{static area(t){const e=t.length;let i=0;for(let n=e-1,r=0;r2&&t[e-1].equals(t[0])&&t.pop()}function n_(t,e){for(let i=0;iNumber.EPSILON){const d=Math.sqrt(c),u=Math.sqrt(l*l+h*h),f=e.x-o/d,m=e.y+a/d,p=((i.x-h/u-f)*h-(i.y+l/u-m)*l)/(a*h-o*l);n=f+a*p-t.x,r=m+o*p-t.y;const g=n*n+r*r;if(g<=2)return new vc(n,r);s=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(o)===Math.sign(h)&&(t=!0),t?(n=-o,r=a,s=Math.sqrt(c)):(n=a,r=o,s=Math.sqrt(c/2))}return new vc(n/s,r/s)}const z=[];for(let t=0,e=S.length,i=e-1,n=t+1;t=0;t--){const e=t/f,i=c*Math.cos(e*Math.PI/2),n=d*Math.sin(e*Math.PI/2)+u;for(let t=0,e=S.length;t=0;){const n=i;let r=i-1;r<0&&(r=t.length-1);for(let t=0,i=o+2*f;t0)&&u.push(e,r,l),(t!==i-1||o0!=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}}p_.prototype.isMeshPhysicalMaterial=!0;class g_ extends lu{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new zc(16777215),this.specular=new zc(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zc(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new vc(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}}g_.prototype.isMeshPhongMaterial=!0;class __ extends lu{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new zc(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zc(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new vc(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 x_ extends lu{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new vc(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}}x_.prototype.isMeshNormalMaterial=!0;class y_ extends lu{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new zc(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zc(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}}y_.prototype.isMeshLambertMaterial=!0;class A_ extends lu{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new zc(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new vc(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}}A_.prototype.isMeshMatcapMaterial=!0;class v_ extends jp{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}}v_.prototype.isLineDashedMaterial=!0;const b_={ShadowMaterial:d_,SpriteMaterial:u_,RawShaderMaterial:f_,ShaderMaterial:uu,PointsMaterial:Zp,MeshPhysicalMaterial:p_,MeshStandardMaterial:m_,MeshPhongMaterial:g_,MeshToonMaterial:__,MeshNormalMaterial:x_,MeshLambertMaterial:y_,MeshDepthMaterial:Mp,MeshDistanceMaterial:Tp,MeshBasicMaterial:Du,MeshMatcapMaterial:A_,LineDashedMaterial:v_,LineBasicMaterial:jp,Material:lu};lu.fromType=function(t){return new b_[t]};const w_={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 M_=new class{constructor(t,e,i){const n=this;let r,s=!1,a=0,o=0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){o++,!1===s&&void 0!==n.onStart&&n.onStart(t,a,o),s=!0},this.itemEnd=function(t){a++,void 0!==n.onProgress&&n.onProgress(t,a,o),a===o&&(s=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return r?r(t):t},this.setURLModifier=function(t){return r=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,i=l.length;et.far||e.push({distance:o,point:F_.clone(),uv:zu.getUV(F_,G_,H_,X_,$_,V_,Y_,new vc),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 Z_=new qc,Q_=new Nc,J_=new Nc,K_=new qc,tx=new _d;(class extends Zu{constructor(t,e){super(t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new _d,this.bindMatrixInverse=new _d}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 Nc,e=this.geometry.attributes.skinWeight;for(let i=0,n=e.count;ithis.max.x||t.ythis.max.y)}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}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))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return wx.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),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)}}Mx.prototype.isBox2=!0;const Tx=new qc,Sx=new qc;class Cx{constructor(t=new qc,e=new qc){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Tx.subVectors(t,this.start),Sx.subVectors(this.end,this.start);const i=Sx.dot(Sx);let n=Sx.dot(Tx)/i;return e&&(n=pc(n,0,1)),n}closestPointToPoint(t,e,i){const n=this.closestPointToPointParameter(t,e);return this.delta(i).multiplyScalar(n).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}class Ex extends Wp{constructor(t=10,e=10,i=4473924,n=8947848){i=new zc(i),n=new zc(n);const r=e/2,s=t/e,a=t/2,o=[],l=[];for(let t=0,h=0,c=-a;t<=e;t++,c+=s){o.push(-a,0,c,a,0,c),o.push(c,0,-a,c,0,a);const e=t===r?i:n;e.toArray(l,h),h+=3,e.toArray(l,h),h+=3,e.toArray(l,h),h+=3,e.toArray(l,h),h+=3}const h=new ru;h.setAttribute("position",new Dd(o,3)),h.setAttribute("color",new Dd(l,3));super(h,new jp({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}const Px=new Hc;class kx extends Wp{constructor(t,e=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),r=new ru;r.setIndex(new Pd(i,1)),r.setAttribute("position",new Pd(n,3)),super(r,new jp({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Px.setFromObject(this.object),Px.isEmpty())return;const e=Px.min,i=Px.max,n=this.geometry.attributes.position,r=n.array;r[0]=i.x,r[1]=i.y,r[2]=i.z,r[3]=e.x,r[4]=i.y,r[5]=i.z,r[6]=e.x,r[7]=e.y,r[8]=i.z,r[9]=i.x,r[10]=e.y,r[11]=i.z,r[12]=i.x,r[13]=i.y,r[14]=e.z,r[15]=e.x,r[16]=i.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=i.x,r[22]=e.y,r[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t){return Wp.prototype.copy.call(this,t),this.object=t.object,this}}class zx extends Wp{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],i=new ru;i.setAttribute("position",new Dd(e,3)),i.setAttribute("color",new Dd([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(i,new jp({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,i){const n=new zc,r=this.geometry.attributes.color.array;return n.set(t),n.toArray(r,0),n.toArray(r,3),n.set(e),n.toArray(r,6),n.toArray(r,9),n.set(i),n.toArray(r,12),n.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Dx{constructor(){this.type="ShapePath",this.color=new zc,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new Eg,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,s){return this.currentPath.bezierCurveTo(t,e,i,n,r,s),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t,e){function i(t){const e=[];for(let i=0,n=t.length;iNumber.EPSILON){if(l<0&&(i=e[s],o=-o,a=e[r],l=-l),t.ya.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{const e=l*(t.x-i.x)-o*(t.y-i.y);if(0===e)return!0;if(e<0)continue;n=!n}}else{if(t.y!==i.y)continue;if(a.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=a.x)return!0}}return n}const r=e_.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===e)return i(s);let a,o,l;const h=[];if(1===s.length)return o=s[0],l=new Pg,l.curves=o.curves,h.push(l),h;let c=!r(s[0].getPoints());c=t?!c:c;const d=[],u=[];let f,m,p=[],g=0;u[g]=void 0,p[g]=[];for(let e=0,i=s.length;e1){let t=!1,e=0;for(let t=0,e=u.length;t0&&!1===t&&(p=d)}for(let t=0,e=u.length;t":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},v:{x_min:0,x_max:675.15625,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 737 l 340 147 l 541 737 l 675 738 "},"τ":{x_min:.28125,x_max:644.5,ha:703,o:"m 644 628 l 382 628 l 382 179 q 388 120 382 137 q 436 91 401 91 q 474 94 447 91 q 504 97 501 97 l 504 0 q 454 -9 482 -5 q 401 -14 426 -14 q 278 67 308 -14 q 260 233 260 118 l 260 628 l 0 628 l 0 739 l 644 739 l 644 628 "},"ξ":{x_min:0,x_max:624.9375,ha:699,o:"m 624 -37 q 608 -153 624 -96 q 563 -278 593 -211 l 454 -278 q 491 -183 486 -200 q 511 -83 511 -126 q 484 -23 511 -44 q 370 1 452 1 q 323 0 354 1 q 283 -1 293 -1 q 84 76 169 -1 q 0 266 0 154 q 56 431 0 358 q 197 538 108 498 q 94 613 134 562 q 54 730 54 665 q 77 823 54 780 q 143 901 101 867 l 27 901 l 27 1012 l 576 1012 l 576 901 l 380 901 q 244 863 303 901 q 178 745 178 820 q 312 600 178 636 q 532 582 380 582 l 532 479 q 276 455 361 479 q 118 281 118 410 q 165 173 118 217 q 274 120 208 133 q 494 101 384 110 q 624 -37 624 76 "},"&":{x_min:-3,x_max:894.25,ha:992,o:"m 894 0 l 725 0 l 624 123 q 471 0 553 40 q 306 -41 390 -41 q 168 -7 231 -41 q 62 92 105 26 q 14 187 31 139 q -3 276 -3 235 q 55 433 -3 358 q 248 581 114 508 q 170 689 196 640 q 137 817 137 751 q 214 985 137 922 q 384 1041 284 1041 q 548 988 483 1041 q 622 824 622 928 q 563 666 622 739 q 431 556 516 608 l 621 326 q 649 407 639 361 q 663 493 653 426 l 781 493 q 703 229 781 352 l 894 0 m 504 818 q 468 908 504 877 q 384 940 433 940 q 293 907 331 940 q 255 818 255 875 q 289 714 255 767 q 363 628 313 678 q 477 729 446 682 q 504 818 504 771 m 556 209 l 314 499 q 179 395 223 449 q 135 283 135 341 q 146 222 135 253 q 183 158 158 192 q 333 80 241 80 q 556 209 448 80 "},"Λ":{x_min:0,x_max:862.5,ha:942,o:"m 862 0 l 719 0 l 426 847 l 143 0 l 0 0 l 356 1013 l 501 1013 l 862 0 "},I:{x_min:41,x_max:180,ha:293,o:"m 180 0 l 41 0 l 41 1013 l 180 1013 l 180 0 "},G:{x_min:0,x_max:921,ha:1011,o:"m 921 0 l 832 0 l 801 136 q 655 15 741 58 q 470 -28 568 -28 q 126 133 259 -28 q 0 499 0 284 q 125 881 0 731 q 486 1043 259 1043 q 763 957 647 1043 q 905 709 890 864 l 772 709 q 668 866 747 807 q 486 926 589 926 q 228 795 322 926 q 142 507 142 677 q 228 224 142 342 q 483 94 323 94 q 712 195 625 94 q 796 435 796 291 l 477 435 l 477 549 l 921 549 l 921 0 "},"ΰ":{x_min:0,x_max:617,ha:725,o:"m 524 800 l 414 800 l 414 925 l 524 925 l 524 800 m 183 800 l 73 800 l 73 925 l 183 925 l 183 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 489 1040 l 300 819 l 216 819 l 351 1040 l 489 1040 "},"`":{x_min:0,x_max:138.890625,ha:236,o:"m 138 699 l 0 699 l 0 861 q 36 974 0 929 q 138 1041 72 1020 l 138 977 q 82 931 95 969 q 69 839 69 893 l 138 839 l 138 699 "},"·":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},"Υ":{x_min:.328125,x_max:819.515625,ha:889,o:"m 819 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 "},r:{x_min:0,x_max:355.5625,ha:432,o:"m 355 621 l 343 621 q 179 569 236 621 q 122 411 122 518 l 122 0 l 0 0 l 0 737 l 117 737 l 117 604 q 204 719 146 686 q 355 753 262 753 l 355 621 "},x:{x_min:0,x_max:675,ha:764,o:"m 675 0 l 525 0 l 331 286 l 144 0 l 0 0 l 256 379 l 12 738 l 157 737 l 336 473 l 516 738 l 661 738 l 412 380 l 675 0 "},"μ":{x_min:0,x_max:696.609375,ha:747,o:"m 696 -4 q 628 -14 657 -14 q 498 97 513 -14 q 422 8 470 41 q 313 -24 374 -24 q 207 3 258 -24 q 120 80 157 31 l 120 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 172 124 246 q 308 82 216 82 q 451 177 402 82 q 492 358 492 254 l 492 738 l 616 738 l 616 214 q 623 136 616 160 q 673 92 636 92 q 696 95 684 92 l 696 -4 "},h:{x_min:0,x_max:615,ha:724,o:"m 615 472 l 615 0 l 490 0 l 490 454 q 456 590 490 535 q 338 654 416 654 q 186 588 251 654 q 122 436 122 522 l 122 0 l 0 0 l 0 1013 l 122 1013 l 122 633 q 218 727 149 694 q 362 760 287 760 q 552 676 484 760 q 615 472 615 600 "},".":{x_min:0,x_max:142,ha:239,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},"φ":{x_min:-2,x_max:878,ha:974,o:"m 496 -279 l 378 -279 l 378 -17 q 101 88 204 -17 q -2 367 -2 194 q 68 626 -2 510 q 283 758 151 758 l 283 646 q 167 537 209 626 q 133 373 133 462 q 192 177 133 254 q 378 93 259 93 l 378 758 q 445 764 426 763 q 476 765 464 765 q 765 659 653 765 q 878 377 878 553 q 771 96 878 209 q 496 -17 665 -17 l 496 -279 m 496 93 l 514 93 q 687 183 623 93 q 746 380 746 265 q 691 569 746 491 q 522 658 629 658 l 496 656 l 496 93 "},";":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 -12 q 105 -132 142 -82 q 0 -206 68 -182 l 0 -138 q 58 -82 43 -123 q 68 0 68 -56 l 0 0 l 0 151 l 142 151 l 142 -12 "},f:{x_min:0,x_max:378,ha:472,o:"m 378 638 l 246 638 l 246 0 l 121 0 l 121 638 l 0 638 l 0 738 l 121 738 q 137 935 121 887 q 290 1028 171 1028 q 320 1027 305 1028 q 378 1021 334 1026 l 378 908 q 323 918 346 918 q 257 870 273 918 q 246 780 246 840 l 246 738 l 378 738 l 378 638 "},"“":{x_min:1,x_max:348.21875,ha:454,o:"m 140 670 l 1 670 l 1 830 q 37 943 1 897 q 140 1011 74 990 l 140 947 q 82 900 97 940 q 68 810 68 861 l 140 810 l 140 670 m 348 670 l 209 670 l 209 830 q 245 943 209 897 q 348 1011 282 990 l 348 947 q 290 900 305 940 q 276 810 276 861 l 348 810 l 348 670 "},A:{x_min:.03125,x_max:906.953125,ha:1008,o:"m 906 0 l 756 0 l 648 303 l 251 303 l 142 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 610 421 l 452 867 l 293 421 l 610 421 "},"‘":{x_min:1,x_max:139.890625,ha:236,o:"m 139 670 l 1 670 l 1 830 q 37 943 1 897 q 139 1011 74 990 l 139 947 q 82 900 97 940 q 68 810 68 861 l 139 810 l 139 670 "},"ϊ":{x_min:-70,x_max:283,ha:361,o:"m 283 800 l 173 800 l 173 925 l 283 925 l 283 800 m 40 800 l -70 800 l -70 925 l 40 925 l 40 800 m 283 3 q 232 -10 257 -5 q 181 -15 206 -15 q 84 26 118 -15 q 41 200 41 79 l 41 737 l 166 737 l 167 215 q 171 141 167 157 q 225 101 182 101 q 247 103 238 101 q 283 112 256 104 l 283 3 "},"π":{x_min:-.21875,x_max:773.21875,ha:857,o:"m 773 -7 l 707 -11 q 575 40 607 -11 q 552 174 552 77 l 552 226 l 552 626 l 222 626 l 222 0 l 97 0 l 97 626 l 0 626 l 0 737 l 773 737 l 773 626 l 676 626 l 676 171 q 695 103 676 117 q 773 90 714 90 l 773 -7 "},"ά":{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 727 407 760 q 563 637 524 695 l 563 738 l 685 738 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 95 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 m 604 1040 l 415 819 l 332 819 l 466 1040 l 604 1040 "},O:{x_min:0,x_max:958,ha:1057,o:"m 485 1041 q 834 882 702 1041 q 958 512 958 734 q 834 136 958 287 q 481 -26 702 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 728 q 485 1041 263 1041 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 669 q 480 912 640 912 q 226 784 321 912 q 142 504 142 670 q 226 224 142 339 q 480 98 319 98 "},n:{x_min:0,x_max:615,ha:724,o:"m 615 463 l 615 0 l 490 0 l 490 454 q 453 592 490 537 q 331 656 410 656 q 178 585 240 656 q 117 421 117 514 l 117 0 l 0 0 l 0 738 l 117 738 l 117 630 q 218 728 150 693 q 359 764 286 764 q 552 675 484 764 q 615 463 615 593 "},l:{x_min:41,x_max:166,ha:279,o:"m 166 0 l 41 0 l 41 1013 l 166 1013 l 166 0 "},"¤":{x_min:40.09375,x_max:728.796875,ha:825,o:"m 728 304 l 649 224 l 512 363 q 383 331 458 331 q 256 363 310 331 l 119 224 l 40 304 l 177 441 q 150 553 150 493 q 184 673 150 621 l 40 818 l 119 898 l 267 749 q 321 766 291 759 q 384 773 351 773 q 447 766 417 773 q 501 749 477 759 l 649 898 l 728 818 l 585 675 q 612 618 604 648 q 621 553 621 587 q 591 441 621 491 l 728 304 m 384 682 q 280 643 318 682 q 243 551 243 604 q 279 461 243 499 q 383 423 316 423 q 487 461 449 423 q 525 553 525 500 q 490 641 525 605 q 384 682 451 682 "},"κ":{x_min:0,x_max:632.328125,ha:679,o:"m 632 0 l 482 0 l 225 384 l 124 288 l 124 0 l 0 0 l 0 738 l 124 738 l 124 446 l 433 738 l 596 738 l 312 466 l 632 0 "},p:{x_min:0,x_max:685,ha:786,o:"m 685 364 q 598 96 685 205 q 350 -23 504 -23 q 121 89 205 -23 l 121 -278 l 0 -278 l 0 738 l 121 738 l 121 633 q 220 726 159 691 q 351 761 280 761 q 598 636 504 761 q 685 364 685 522 m 557 371 q 501 560 557 481 q 330 651 437 651 q 162 559 223 651 q 108 366 108 479 q 162 177 108 254 q 333 87 224 87 q 502 178 441 87 q 557 371 557 258 "},"‡":{x_min:0,x_max:777,ha:835,o:"m 458 238 l 458 0 l 319 0 l 319 238 l 0 238 l 0 360 l 319 360 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 l 777 804 l 777 683 l 458 683 l 458 360 l 777 360 l 777 238 l 458 238 "},"ψ":{x_min:0,x_max:808,ha:907,o:"m 465 -278 l 341 -278 l 341 -15 q 87 102 180 -15 q 0 378 0 210 l 0 739 l 133 739 l 133 379 q 182 195 133 275 q 341 98 242 98 l 341 922 l 465 922 l 465 98 q 623 195 563 98 q 675 382 675 278 l 675 742 l 808 742 l 808 381 q 720 104 808 213 q 466 -13 627 -13 l 465 -278 "},"η":{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 720 124 755 q 200 630 193 686 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 "}},Bx="normal",Fx="normal",Nx={yMin:-334,xMin:-111,yMax:1189,xMax:1672},Ix={postscript_name:"Helvetiker-Regular",version_string:"Version 1.00 2004 initial release",vendor_url:"http://www.magenta.gr/",full_font_name:"Helvetiker",font_family_name:"Helvetiker",copyright:"Copyright (c) Μagenta ltd, 2004",description:"",trademark:"",designer:"",designer_url:"",unique_font_identifier:"Μagenta ltd:Helvetiker:22-10-104",license_url:"http://www.ellak.gr/fonts/MgOpen/license.html",license_description:'Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions: \r\n\r\nThe above copyright and this permission notice shall be included in all copies of one or more of the Font Software typefaces.\r\n\r\nThe Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing the word "MgOpen", or if the modifications are accepted for inclusion in the Font Software itself by the each appointed Administrator.\r\n\r\nThis License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "MgOpen" name.\r\n\r\nThe Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. \r\n\r\nTHE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.',manufacturer_name:"Μagenta ltd",font_sub_family_name:"Regular"},jx="Helvetiker",qx={glyphs:Rx,cssFontWeight:Bx,ascender:1189,underlinePosition:-100,cssFontStyle:Fx,boundingBox:Nx,resolution:1e3,original_font_information:Ix,descender:-334,familyName:jx,lineHeight:1522,underlineThickness:50},Ux=Object.freeze({__proto__:null,glyphs:Rx,cssFontWeight:Bx,ascender:1189,underlinePosition:-100,cssFontStyle:Fx,boundingBox:Nx,resolution:1e3,original_font_information:Ix,descender:-334,familyName:jx,lineHeight:1522,underlineThickness:50,default:qx});class Gx{constructor(t){this.type="Font",this.data=t}generateShapes(t,e=100){const i=[],n=function(t,e,i){const n=Array.from(t),r=e/i.resolution,s=(i.boundingBox.yMax-i.boundingBox.yMin+i.underlineThickness)*r,a=[];let o=0,l=0;for(let t=0;tMath.PI&&(g-=p),_<-Math.PI?_+=p:_>Math.PI&&(_-=p),a.theta=g<=_?Math.max(g,Math.min(_,a.theta)):a.theta>(g+_)/2?Math.max(g,a.theta):Math.min(_,a.theta)),a.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,a.phi)),a.makeSafe(),a.radius*=l,a.radius=Math.max(i.minDistance,Math.min(i.maxDistance,a.radius)),!0===i.enableDamping?i.target.addScaledVector(h,i.dampingFactor):i.target.add(h),e.setFromSpherical(a),e.applyQuaternion(u),t.copy(i.target).add(e),i.object.lookAt(i.target),!0===i.enableDamping?(o.theta*=1-i.dampingFactor,o.phi*=1-i.dampingFactor,h.multiplyScalar(1-i.dampingFactor)):(o.set(0,0,0),h.set(0,0,0)),l=1,!!(c||f.distanceToSquared(i.object.position)>s||8*(1-m.dot(i.object.quaternion))>s)&&(i.dispatchEvent(Xx),f.copy(i.object.position),m.copy(i.object.quaternion),c=!1,!0)}}(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",H),i.domElement.removeEventListener("pointerdown",N),i.domElement.removeEventListener("pointercancel",q),i.domElement.removeEventListener("wheel",U),i.domElement.removeEventListener("pointermove",I),i.domElement.removeEventListener("pointerup",j),null!==i._domElementKeyEvents&&i._domElementKeyEvents.removeEventListener("keydown",G)};const i=this,n={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let r=n.NONE;const s=1e-6,a=new bx,o=new bx;let l=1;const h=new qc;let c=!1;const d=new vc,u=new vc,f=new vc,m=new vc,p=new vc,g=new vc,_=new vc,x=new vc,y=new vc,A=[],v={};function b(){return Math.pow(.95,i.zoomSpeed)}function w(t){o.theta-=t}function M(t){o.phi-=t}const T=function(){const t=new qc;return function(e,i){t.setFromMatrixColumn(i,0),t.multiplyScalar(-e),h.add(t)}}(),S=function(){const t=new qc;return function(e,n){!0===i.screenSpacePanning?t.setFromMatrixColumn(n,1):(t.setFromMatrixColumn(n,0),t.crossVectors(i.object.up,t)),t.multiplyScalar(e),h.add(t)}}(),C=function(){const t=new qc;return function(e,n){const r=i.domElement;if(i.object.isPerspectiveCamera){const s=i.object.position;t.copy(s).sub(i.target);let a=t.length();a*=Math.tan(i.object.fov/2*Math.PI/180),T(2*e*a/r.clientHeight,i.object.matrix),S(2*n*a/r.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(T(e*(i.object.right-i.object.left)/i.object.zoom/r.clientWidth,i.object.matrix),S(n*(i.object.top-i.object.bottom)/i.object.zoom/r.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function E(t){i.object.isPerspectiveCamera?l/=t:i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom*t)),i.object.updateProjectionMatrix(),c=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function P(t){i.object.isPerspectiveCamera?l*=t:i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/t)),i.object.updateProjectionMatrix(),c=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function k(t){d.set(t.clientX,t.clientY)}function z(t){m.set(t.clientX,t.clientY)}function D(){if(1===A.length)d.set(A[0].pageX,A[0].pageY);else{const t=.5*(A[0].pageX+A[1].pageX),e=.5*(A[0].pageY+A[1].pageY);d.set(t,e)}}function O(){if(1===A.length)m.set(A[0].pageX,A[0].pageY);else{const t=.5*(A[0].pageX+A[1].pageX),e=.5*(A[0].pageY+A[1].pageY);m.set(t,e)}}function L(){const t=A[0].pageX-A[1].pageX,e=A[0].pageY-A[1].pageY,i=Math.sqrt(t*t+e*e);_.set(0,i)}function R(t){if(1==A.length)u.set(t.pageX,t.pageY);else{const e=V(t),i=.5*(t.pageX+e.x),n=.5*(t.pageY+e.y);u.set(i,n)}f.subVectors(u,d).multiplyScalar(i.rotateSpeed);const e=i.domElement;w(2*Math.PI*f.x/e.clientHeight),M(2*Math.PI*f.y/e.clientHeight),d.copy(u)}function B(t){if(1===A.length)p.set(t.pageX,t.pageY);else{const e=V(t),i=.5*(t.pageX+e.x),n=.5*(t.pageY+e.y);p.set(i,n)}g.subVectors(p,m).multiplyScalar(i.panSpeed),C(g.x,g.y),m.copy(p)}function F(t){const e=V(t),n=t.pageX-e.x,r=t.pageY-e.y,s=Math.sqrt(n*n+r*r);x.set(0,s),y.set(0,Math.pow(x.y/_.y,i.zoomSpeed)),E(y.y),_.copy(x)}function N(t){!1!==i.enabled&&(0===A.length&&(i.domElement.setPointerCapture(t.pointerId),i.domElement.addEventListener("pointermove",I),i.domElement.addEventListener("pointerup",j)),function(t){A.push(t)}(t),"touch"===t.pointerType?function(t){switch($(t),A.length){case 1:switch(i.touches.ONE){case kh:if(!1===i.enableRotate)return;D(),r=n.TOUCH_ROTATE;break;case zh:if(!1===i.enablePan)return;O(),r=n.TOUCH_PAN;break;default:r=n.NONE}break;case 2:switch(i.touches.TWO){case Dh:if(!1===i.enableZoom&&!1===i.enablePan)return;i.enableZoom&&L(),i.enablePan&&O(),r=n.TOUCH_DOLLY_PAN;break;case Oh:if(!1===i.enableZoom&&!1===i.enableRotate)return;i.enableZoom&&L(),i.enableRotate&&D(),r=n.TOUCH_DOLLY_ROTATE;break;default:r=n.NONE}break;default:r=n.NONE}r!==n.NONE&&i.dispatchEvent($x)}(t):function(t){let e;switch(t.button){case 0:e=i.mouseButtons.LEFT;break;case 1:e=i.mouseButtons.MIDDLE;break;case 2:e=i.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Eh:if(!1===i.enableZoom)return;!function(t){_.set(t.clientX,t.clientY)}(t),r=n.DOLLY;break;case Ch:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===i.enablePan)return;z(t),r=n.PAN}else{if(!1===i.enableRotate)return;k(t),r=n.ROTATE}break;case Ph:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===i.enableRotate)return;k(t),r=n.ROTATE}else{if(!1===i.enablePan)return;z(t),r=n.PAN}break;default:r=n.NONE}r!==n.NONE&&i.dispatchEvent($x)}(t))}function I(t){!1!==i.enabled&&("touch"===t.pointerType?function(t){switch($(t),r){case n.TOUCH_ROTATE:if(!1===i.enableRotate)return;R(t),i.update();break;case n.TOUCH_PAN:if(!1===i.enablePan)return;B(t),i.update();break;case n.TOUCH_DOLLY_PAN:if(!1===i.enableZoom&&!1===i.enablePan)return;!function(t){i.enableZoom&&F(t),i.enablePan&&B(t)}(t),i.update();break;case n.TOUCH_DOLLY_ROTATE:if(!1===i.enableZoom&&!1===i.enableRotate)return;!function(t){i.enableZoom&&F(t),i.enableRotate&&R(t)}(t),i.update();break;default:r=n.NONE}}(t):function(t){if(!1===i.enabled)return;switch(r){case n.ROTATE:if(!1===i.enableRotate)return;!function(t){u.set(t.clientX,t.clientY),f.subVectors(u,d).multiplyScalar(i.rotateSpeed);const e=i.domElement;w(2*Math.PI*f.x/e.clientHeight),M(2*Math.PI*f.y/e.clientHeight),d.copy(u),i.update()}(t);break;case n.DOLLY:if(!1===i.enableZoom)return;!function(t){x.set(t.clientX,t.clientY),y.subVectors(x,_),y.y>0?E(b()):y.y<0&&P(b()),_.copy(x),i.update()}(t);break;case n.PAN:if(!1===i.enablePan)return;!function(t){p.set(t.clientX,t.clientY),g.subVectors(p,m).multiplyScalar(i.panSpeed),C(g.x,g.y),m.copy(p),i.update()}(t)}}(t))}function j(t){X(t),0===A.length&&(i.domElement.releasePointerCapture(t.pointerId),i.domElement.removeEventListener("pointermove",I),i.domElement.removeEventListener("pointerup",j)),i.dispatchEvent(Vx),r=n.NONE}function q(t){X(t)}function U(t){!1!==i.enabled&&!1!==i.enableZoom&&r===n.NONE&&(t.preventDefault(),i.dispatchEvent($x),function(t){t.deltaY<0?P(b()):t.deltaY>0&&E(b()),i.update()}(t),i.dispatchEvent(Vx))}function G(t){!1!==i.enabled&&!1!==i.enablePan&&function(t){let e=!1;switch(t.code){case i.keys.UP:C(0,i.keyPanSpeed),e=!0;break;case i.keys.BOTTOM:C(0,-i.keyPanSpeed),e=!0;break;case i.keys.LEFT:C(i.keyPanSpeed,0),e=!0;break;case i.keys.RIGHT:C(-i.keyPanSpeed,0),e=!0}e&&(t.preventDefault(),i.update())}(t)}function H(t){!1!==i.enabled&&t.preventDefault()}function X(t){delete v[t.pointerId];for(let e=0;et&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"Y"===n.name&&Math.abs(uy.copy(Ay).applyQuaternion(e).dot(this.eye))>t&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"Z"===n.name&&Math.abs(uy.copy(vy).applyQuaternion(e).dot(this.eye))>t&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"XY"===n.name&&Math.abs(uy.copy(vy).applyQuaternion(e).dot(this.eye)).9&&(n.visible=!1)),"Y"===this.axis&&(Jx.setFromEuler(dy.set(0,0,Math.PI/2)),n.quaternion.copy(e).multiply(Jx),Math.abs(uy.copy(Ay).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),"Z"===this.axis&&(Jx.setFromEuler(dy.set(0,Math.PI/2,0)),n.quaternion.copy(e).multiply(Jx),Math.abs(uy.copy(vy).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),"XYZE"===this.axis&&(Jx.setFromEuler(dy.set(0,Math.PI/2,0)),uy.copy(this.rotationAxis),n.quaternion.setFromRotationMatrix(my.lookAt(fy,uy,Ay)),n.quaternion.multiply(Jx),n.visible=this.dragging),"E"===this.axis&&(n.visible=!1)):"START"===n.name?(n.position.copy(this.worldPositionStart),n.visible=this.dragging):"END"===n.name?(n.position.copy(this.worldPosition),n.visible=this.dragging):"DELTA"===n.name?(n.position.copy(this.worldPositionStart),n.quaternion.copy(this.worldQuaternionStart),Zx.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Zx.applyQuaternion(this.worldQuaternionStart.clone().invert()),n.scale.copy(Zx),n.visible=this.dragging):(n.quaternion.copy(e),this.dragging?n.position.copy(this.worldPositionStart):n.position.copy(this.worldPosition),this.axis&&(n.visible=-1!==this.axis.search(n.name)))}super.updateMatrixWorld(t)}}Ty.prototype.isTransformControlsGizmo=!0;class Sy extends Zu{constructor(){super(new au(1e5,1e5,2,2),new Du({visible:!1,wireframe:!0,side:2,transparent:!0,opacity:.1,toneMapped:!1})),this.type="TransformControlsPlane"}updateMatrixWorld(t){let e=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(e="local"),by.copy(yy).applyQuaternion("local"===e?this.worldQuaternion:gy),wy.copy(Ay).applyQuaternion("local"===e?this.worldQuaternion:gy),My.copy(vy).applyQuaternion("local"===e?this.worldQuaternion:gy),uy.copy(wy),this.mode){case"translate":case"scale":switch(this.axis){case"X":uy.copy(this.eye).cross(by),_y.copy(by).cross(uy);break;case"Y":uy.copy(this.eye).cross(wy),_y.copy(wy).cross(uy);break;case"Z":uy.copy(this.eye).cross(My),_y.copy(My).cross(uy);break;case"XY":_y.copy(My);break;case"YZ":_y.copy(by);break;case"XZ":uy.copy(My),_y.copy(wy);break;case"XYZ":case"E":_y.set(0,0,0)}break;default:_y.set(0,0,0)}0===_y.length()?this.quaternion.copy(this.cameraQuaternion):(xy.lookAt(Zx.set(0,0,0),_y,uy),this.quaternion.setFromRotationMatrix(xy)),super.updateMatrixWorld(t)}}Sy.prototype.isTransformControlsPlane=!0;const Cy={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor = opacity * texel;\n\n\t\t}"};class Ey{constructor(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}const Py=new mf(-1,1,1,-1,0,1),ky=new ru;ky.setAttribute("position",new Dd([-1,3,0,-1,-1,0,3,-1,0],3)),ky.setAttribute("uv",new Dd([0,2,0,0,2,0],2));class zy{constructor(t){this._mesh=new Zu(ky,t)}dispose(){this._mesh.geometry.dispose()}render(t){t.render(this._mesh,Py)}get material(){return this._mesh.material}set material(t){this._mesh.material=t}}class Dy extends Ey{constructor(t,e){super(),this.textureID=void 0!==e?e:"tDiffuse",t instanceof uu?(this.uniforms=t.uniforms,this.material=t):t&&(this.uniforms=du.clone(t.uniforms),this.material=new uu({defines:Object.assign({},t.defines),uniforms:this.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader})),this.fsQuad=new zy(this.material)}render(t,e,i){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=i.texture),this.fsQuad.material=this.material,this.renderToScreen?(t.setRenderTarget(null),this.fsQuad.render(t)):(t.setRenderTarget(e),this.clear&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),this.fsQuad.render(t))}}class Oy extends Ey{constructor(t,e){super(),this.scene=t,this.camera=e,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(t,e,i){const n=t.getContext(),r=t.state;let s,a;r.buffers.color.setMask(!1),r.buffers.depth.setMask(!1),r.buffers.color.setLocked(!0),r.buffers.depth.setLocked(!0),this.inverse?(s=0,a=1):(s=1,a=0),r.buffers.stencil.setTest(!0),r.buffers.stencil.setOp(n.REPLACE,n.REPLACE,n.REPLACE),r.buffers.stencil.setFunc(n.ALWAYS,s,4294967295),r.buffers.stencil.setClear(a),r.buffers.stencil.setLocked(!0),t.setRenderTarget(i),this.clear&&t.clear(),t.render(this.scene,this.camera),t.setRenderTarget(e),this.clear&&t.clear(),t.render(this.scene,this.camera),r.buffers.color.setLocked(!1),r.buffers.depth.setLocked(!1),r.buffers.stencil.setLocked(!1),r.buffers.stencil.setFunc(n.EQUAL,1,4294967295),r.buffers.stencil.setOp(n.KEEP,n.KEEP,n.KEEP),r.buffers.stencil.setLocked(!0)}}class Ly extends Ey{constructor(){super(),this.needsSwap=!1}render(t){t.state.buffers.stencil.setLocked(!1),t.state.buffers.stencil.setTest(!1)}}class Ry{constructor(t,e){if(this.renderer=t,void 0===e){const i={minFilter:Uh,magFilter:Uh,format:Zh},n=t.getSize(new vc);this._pixelRatio=t.getPixelRatio(),this._width=n.width,this._height=n.height,(e=new Ic(this._width*this._pixelRatio,this._height*this._pixelRatio,i)).texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=e.width,this._height=e.height;this.renderTarget1=e,this.renderTarget2=e.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],void 0===Cy&&console.error("THREE.EffectComposer relies on CopyShader"),void 0===Dy&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new Dy(Cy),this.clock=new Ax}swapBuffers(){const t=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=t}addPass(t){this.passes.push(t),t.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(t,e){this.passes.splice(e,0,t),t.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(t){const e=this.passes.indexOf(t);-1!==e&&this.passes.splice(e,1)}isLastEnabledPass(t){for(let e=t+1;e\n\n\t\tfloat getDepth( const in vec2 screenPosition ) {\n\n\t\t\treturn texture2D( tDepth, screenPosition ).x;\n\n\t\t}\n\n\t\tfloat getLinearDepth( const in vec2 screenPosition ) {\n\n\t\t\t#if PERSPECTIVE_CAMERA == 1\n\n\t\t\t\tfloat fragCoordZ = texture2D( tDepth, screenPosition ).x;\n\t\t\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );\n\t\t\t\treturn viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );\n\n\t\t\t#else\n\n\t\t\t\treturn texture2D( tDepth, screenPosition ).x;\n\n\t\t\t#endif\n\n\t\t}\n\n\t\tfloat getViewZ( const in float depth ) {\n\n\t\t\t#if PERSPECTIVE_CAMERA == 1\n\n\t\t\t\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );\n\n\t\t\t#else\n\n\t\t\t\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );\n\n\t\t\t#endif\n\n\t\t}\n\n\t\tvec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {\n\n\t\t\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];\n\n\t\t\tvec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );\n\n\t\t\tclipPosition *= clipW; // unprojection.\n\n\t\t\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;\n\n\t\t}\n\n\t\tvec3 getViewNormal( const in vec2 screenPosition ) {\n\n\t\t\treturn unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tfloat depth = getDepth( vUv );\n\t\t\tfloat viewZ = getViewZ( depth );\n\n\t\t\tvec3 viewPosition = getViewPosition( vUv, depth, viewZ );\n\t\t\tvec3 viewNormal = getViewNormal( vUv );\n\n\t\t\tvec2 noiseScale = vec2( resolution.x / 4.0, resolution.y / 4.0 );\n\t\t\tvec3 random = vec3( texture2D( tNoise, vUv * noiseScale ).r );\n\n\t\t\t// compute matrix used to reorient a kernel vector\n\n\t\t\tvec3 tangent = normalize( random - viewNormal * dot( random, viewNormal ) );\n\t\t\tvec3 bitangent = cross( viewNormal, tangent );\n\t\t\tmat3 kernelMatrix = mat3( tangent, bitangent, viewNormal );\n\n\t\t float occlusion = 0.0;\n\n\t\t for ( int i = 0; i < KERNEL_SIZE; i ++ ) {\n\n\t\t\t\tvec3 sampleVector = kernelMatrix * kernel[ i ]; // reorient sample vector in view space\n\t\t\t\tvec3 samplePoint = viewPosition + ( sampleVector * kernelRadius ); // calculate sample point\n\n\t\t\t\tvec4 samplePointNDC = cameraProjectionMatrix * vec4( samplePoint, 1.0 ); // project point and calculate NDC\n\t\t\t\tsamplePointNDC /= samplePointNDC.w;\n\n\t\t\t\tvec2 samplePointUv = samplePointNDC.xy * 0.5 + 0.5; // compute uv coordinates\n\n\t\t\t\tfloat realDepth = getLinearDepth( samplePointUv ); // get linear depth from depth texture\n\t\t\t\tfloat sampleDepth = viewZToOrthographicDepth( samplePoint.z, cameraNear, cameraFar ); // compute linear depth of the sample view Z value\n\t\t\t\tfloat delta = sampleDepth - realDepth;\n\n\t\t\t\tif ( delta > minDistance && delta < maxDistance ) { // if fragment is before sample point, increase occlusion\n\n\t\t\t\t\tocclusion += 1.0;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tocclusion = clamp( occlusion / float( KERNEL_SIZE ), 0.0, 1.0 );\n\n\t\t\tgl_FragColor = vec4( vec3( 1.0 - occlusion ), 1.0 );\n\n\t\t}"},Iy={defines:{PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},cameraNear:{value:null},cameraFar:{value:null}},vertexShader:"varying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"uniform sampler2D tDepth;\n\n\t\tuniform float cameraNear;\n\t\tuniform float cameraFar;\n\n\t\tvarying vec2 vUv;\n\n\t\t#include \n\n\t\tfloat getLinearDepth( const in vec2 screenPosition ) {\n\n\t\t\t#if PERSPECTIVE_CAMERA == 1\n\n\t\t\t\tfloat fragCoordZ = texture2D( tDepth, screenPosition ).x;\n\t\t\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );\n\t\t\t\treturn viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );\n\n\t\t\t#else\n\n\t\t\t\treturn texture2D( tDepth, screenPosition ).x;\n\n\t\t\t#endif\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tfloat depth = getLinearDepth( vUv );\n\t\t\tgl_FragColor = vec4( vec3( 1.0 - depth ), 1.0 );\n\n\t\t}"},jy={uniforms:{tDiffuse:{value:null},resolution:{value:new vc}},vertexShader:"varying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"uniform sampler2D tDiffuse;\n\n\t\tuniform vec2 resolution;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec2 texelSize = ( 1.0 / resolution );\n\t\t\tfloat result = 0.0;\n\n\t\t\tfor ( int i = - 2; i <= 2; i ++ ) {\n\n\t\t\t\tfor ( int j = - 2; j <= 2; j ++ ) {\n\n\t\t\t\t\tvec2 offset = ( vec2( float( i ), float( j ) ) ) * texelSize;\n\t\t\t\t\tresult += texture2D( tDiffuse, vUv + offset ).r;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tgl_FragColor = vec4( vec3( result / ( 5.0 * 5.0 ) ), 1.0 );\n\n\t\t}"};class qy{constructor(t=Math){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.grad4=[[0,1,1,1],[0,1,1,-1],[0,1,-1,1],[0,1,-1,-1],[0,-1,1,1],[0,-1,1,-1],[0,-1,-1,1],[0,-1,-1,-1],[1,0,1,1],[1,0,1,-1],[1,0,-1,1],[1,0,-1,-1],[-1,0,1,1],[-1,0,1,-1],[-1,0,-1,1],[-1,0,-1,-1],[1,1,0,1],[1,1,0,-1],[1,-1,0,1],[1,-1,0,-1],[-1,1,0,1],[-1,1,0,-1],[-1,-1,0,1],[-1,-1,0,-1],[1,1,1,0],[1,1,-1,0],[1,-1,1,0],[1,-1,-1,0],[-1,1,1,0],[-1,1,-1,0],[-1,-1,1,0],[-1,-1,-1,0]],this.p=[];for(let e=0;e<256;e++)this.p[e]=Math.floor(256*t.random());this.perm=[];for(let t=0;t<512;t++)this.perm[t]=this.p[255&t];this.simplex=[[0,1,2,3],[0,1,3,2],[0,0,0,0],[0,2,3,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,3,0],[0,2,1,3],[0,0,0,0],[0,3,1,2],[0,3,2,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,3,2,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,0,3],[0,0,0,0],[1,3,0,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,3,0,1],[2,3,1,0],[1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,3,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0],[2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0]]}dot(t,e,i){return t[0]*e+t[1]*i}dot3(t,e,i,n){return t[0]*e+t[1]*i+t[2]*n}dot4(t,e,i,n,r){return t[0]*e+t[1]*i+t[2]*n+t[3]*r}noise(t,e){let i,n,r;const s=(t+e)*(.5*(Math.sqrt(3)-1)),a=Math.floor(t+s),o=Math.floor(e+s),l=(3-Math.sqrt(3))/6,h=(a+o)*l,c=t-(a-h),d=e-(o-h);let u,f;c>d?(u=1,f=0):(u=0,f=1);const m=c-u+l,p=d-f+l,g=c-1+2*l,_=d-1+2*l,x=255&a,y=255&o,A=this.perm[x+this.perm[y]]%12,v=this.perm[x+u+this.perm[y+f]]%12,b=this.perm[x+1+this.perm[y+1]]%12;let w=.5-c*c-d*d;w<0?i=0:(w*=w,i=w*w*this.dot(this.grad3[A],c,d));let M=.5-m*m-p*p;M<0?n=0:(M*=M,n=M*M*this.dot(this.grad3[v],m,p));let T=.5-g*g-_*_;return T<0?r=0:(T*=T,r=T*T*this.dot(this.grad3[b],g,_)),70*(i+n+r)}noise3d(t,e,i){let n,r,s,a;const o=(t+e+i)*(1/3),l=Math.floor(t+o),h=Math.floor(e+o),c=Math.floor(i+o),d=1/6,u=(l+h+c)*d,f=t-(l-u),m=e-(h-u),p=i-(c-u);let g,_,x,y,A,v;f>=m?m>=p?(g=1,_=0,x=0,y=1,A=1,v=0):f>=p?(g=1,_=0,x=0,y=1,A=0,v=1):(g=0,_=0,x=1,y=1,A=0,v=1):mv?32:0)+(A>b?16:0)+(v>b?8:0)+(A>w?4:0)+(v>w?2:0)+(b>w?1:0),T=s[M][0]>=3?1:0,S=s[M][1]>=3?1:0,C=s[M][2]>=3?1:0,E=s[M][3]>=3?1:0,P=s[M][0]>=2?1:0,k=s[M][1]>=2?1:0,z=s[M][2]>=2?1:0,D=s[M][3]>=2?1:0,O=s[M][0]>=1?1:0,L=s[M][1]>=1?1:0,R=s[M][2]>=1?1:0,B=s[M][3]>=1?1:0,F=A-T+l,N=v-S+l,I=b-C+l,j=w-E+l,q=A-P+2*l,U=v-k+2*l,G=b-z+2*l,H=w-D+2*l,X=A-O+3*l,$=v-L+3*l,V=b-R+3*l,Y=w-B+3*l,W=A-1+4*l,Z=v-1+4*l,Q=b-1+4*l,J=w-1+4*l,K=255&p,tt=255&g,et=255&_,it=255&x,nt=a[K+a[tt+a[et+a[it]]]]%32,rt=a[K+T+a[tt+S+a[et+C+a[it+E]]]]%32,st=a[K+P+a[tt+k+a[et+z+a[it+D]]]]%32,at=a[K+O+a[tt+L+a[et+R+a[it+B]]]]%32,ot=a[K+1+a[tt+1+a[et+1+a[it+1]]]]%32;let lt=.6-A*A-v*v-b*b-w*w;lt<0?h=0:(lt*=lt,h=lt*lt*this.dot4(r[nt],A,v,b,w));let ht=.6-F*F-N*N-I*I-j*j;ht<0?c=0:(ht*=ht,c=ht*ht*this.dot4(r[rt],F,N,I,j));let ct=.6-q*q-U*U-G*G-H*H;ct<0?d=0:(ct*=ct,d=ct*ct*this.dot4(r[st],q,U,G,H));let dt=.6-X*X-$*$-V*V-Y*Y;dt<0?u=0:(dt*=dt,u=dt*dt*this.dot4(r[at],X,$,V,Y));let ut=.6-W*W-Z*Z-Q*Q-J*J;return ut<0?f=0:(ut*=ut,f=ut*ut*this.dot4(r[ot],W,Z,Q,J)),27*(h+c+d+u+f)}}class Uy extends Ey{constructor(t,e,i,n){super(),this.width=void 0!==i?i:512,this.height=void 0!==n?n:512,this.clear=!0,this.camera=e,this.scene=t,this.kernelRadius=8,this.kernelSize=32,this.kernel=[],this.noiseTexture=null,this.output=0,this.minDistance=.005,this.maxDistance=.1,this._visibilityCache=new Map,this.generateSampleKernel(),this.generateRandomKernelRotations();const r=new Lp;r.format=Jh,r.type=Wh,this.beautyRenderTarget=new Ic(this.width,this.height),this.normalRenderTarget=new Ic(this.width,this.height,{minFilter:qh,magFilter:qh,depthTexture:r}),this.ssaoRenderTarget=new Ic(this.width,this.height),this.blurRenderTarget=this.ssaoRenderTarget.clone(),void 0===Ny&&console.error("THREE.SSAOPass: The pass relies on SSAOShader."),this.ssaoMaterial=new uu({defines:Object.assign({},Ny.defines),uniforms:du.clone(Ny.uniforms),vertexShader:Ny.vertexShader,fragmentShader:Ny.fragmentShader,blending:0}),this.ssaoMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.ssaoMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture,this.ssaoMaterial.uniforms.tDepth.value=this.normalRenderTarget.depthTexture,this.ssaoMaterial.uniforms.tNoise.value=this.noiseTexture,this.ssaoMaterial.uniforms.kernel.value=this.kernel,this.ssaoMaterial.uniforms.cameraNear.value=this.camera.near,this.ssaoMaterial.uniforms.cameraFar.value=this.camera.far,this.ssaoMaterial.uniforms.resolution.value.set(this.width,this.height),this.ssaoMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssaoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.normalMaterial=new x_,this.normalMaterial.blending=0,this.blurMaterial=new uu({defines:Object.assign({},jy.defines),uniforms:du.clone(jy.uniforms),vertexShader:jy.vertexShader,fragmentShader:jy.fragmentShader}),this.blurMaterial.uniforms.tDiffuse.value=this.ssaoRenderTarget.texture,this.blurMaterial.uniforms.resolution.value.set(this.width,this.height),this.depthRenderMaterial=new uu({defines:Object.assign({},Iy.defines),uniforms:du.clone(Iy.uniforms),vertexShader:Iy.vertexShader,fragmentShader:Iy.fragmentShader,blending:0}),this.depthRenderMaterial.uniforms.tDepth.value=this.normalRenderTarget.depthTexture,this.depthRenderMaterial.uniforms.cameraNear.value=this.camera.near,this.depthRenderMaterial.uniforms.cameraFar.value=this.camera.far,this.copyMaterial=new uu({uniforms:du.clone(Cy.uniforms),vertexShader:Cy.vertexShader,fragmentShader:Cy.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blendSrc:208,blendDst:200,blendEquation:Lh,blendSrcAlpha:206,blendDstAlpha:200,blendEquationAlpha:Lh}),this.fsQuad=new zy(null),this.originalClearColor=new zc}dispose(){this.beautyRenderTarget.dispose(),this.normalRenderTarget.dispose(),this.ssaoRenderTarget.dispose(),this.blurRenderTarget.dispose(),this.normalMaterial.dispose(),this.blurMaterial.dispose(),this.copyMaterial.dispose(),this.depthRenderMaterial.dispose(),this.fsQuad.dispose()}render(t,e){switch(!1===t.capabilities.isWebGL2&&(this.noiseTexture.format=1024),t.setRenderTarget(this.beautyRenderTarget),t.clear(),t.render(this.scene,this.camera),this.overrideVisibility(),this.renderOverride(t,this.normalMaterial,this.normalRenderTarget,7829503,1),this.restoreVisibility(),this.ssaoMaterial.uniforms.kernelRadius.value=this.kernelRadius,this.ssaoMaterial.uniforms.minDistance.value=this.minDistance,this.ssaoMaterial.uniforms.maxDistance.value=this.maxDistance,this.renderPass(t,this.ssaoMaterial,this.ssaoRenderTarget),this.renderPass(t,this.blurMaterial,this.blurRenderTarget),this.output){case Uy.OUTPUT.SSAO:this.copyMaterial.uniforms.tDiffuse.value=this.ssaoRenderTarget.texture,this.copyMaterial.blending=0,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:e);break;case Uy.OUTPUT.Blur:this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.copyMaterial.blending=0,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:e);break;case Uy.OUTPUT.Beauty:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=0,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:e);break;case Uy.OUTPUT.Depth:this.renderPass(t,this.depthRenderMaterial,this.renderToScreen?null:e);break;case Uy.OUTPUT.Normal:this.copyMaterial.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.copyMaterial.blending=0,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:e);break;case Uy.OUTPUT.Default:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=0,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:e),this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.copyMaterial.blending=5,this.renderPass(t,this.copyMaterial,this.renderToScreen?null:e);break;default:console.warn("THREE.SSAOPass: Unknown output type.")}}renderPass(t,e,i,n,r){t.getClearColor(this.originalClearColor);const s=t.getClearAlpha(),a=t.autoClear;t.setRenderTarget(i),t.autoClear=!1,null!=n&&(t.setClearColor(n),t.setClearAlpha(r||0),t.clear()),this.fsQuad.material=e,this.fsQuad.render(t),t.autoClear=a,t.setClearColor(this.originalClearColor),t.setClearAlpha(s)}renderOverride(t,e,i,n,r){t.getClearColor(this.originalClearColor);const s=t.getClearAlpha(),a=t.autoClear;t.setRenderTarget(i),t.autoClear=!1,n=e.clearColor||n,r=e.clearAlpha||r,null!=n&&(t.setClearColor(n),t.setClearAlpha(r||0),t.clear()),this.scene.overrideMaterial=e,t.render(this.scene,this.camera),this.scene.overrideMaterial=null,t.autoClear=a,t.setClearColor(this.originalClearColor),t.setClearAlpha(s)}setSize(t,e){this.width=t,this.height=e,this.beautyRenderTarget.setSize(t,e),this.ssaoRenderTarget.setSize(t,e),this.normalRenderTarget.setSize(t,e),this.blurRenderTarget.setSize(t,e),this.ssaoMaterial.uniforms.resolution.value.set(t,e),this.ssaoMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssaoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.blurMaterial.uniforms.resolution.value.set(t,e)}generateSampleKernel(){const t=this.kernelSize,e=this.kernel;for(let i=0;i\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat fSigma = float(SIGMA);\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, fSigma);\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})}getCompositeMaterial(t){return new uu({defines:{NUM_MIPS:t},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},dirtTexture:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform sampler2D dirtTexture;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}"})}}Hy.BlurDirectionX=new vc(1,0),Hy.BlurDirectionY=new vc(0,1);class Xy{constructor(){this.id=0,this.object=null,this.z=0,this.renderOrder=0}}class $y{constructor(){this.id=0,this.v1=new Vy,this.v2=new Vy,this.v3=new Vy,this.normalModel=new qc,this.vertexNormalsModel=[new qc,new qc,new qc],this.vertexNormalsLength=0,this.color=new zc,this.material=null,this.uvs=[new vc,new vc,new vc],this.z=0,this.renderOrder=0}}class Vy{constructor(){this.position=new qc,this.positionWorld=new qc,this.positionScreen=new Nc,this.visible=!0}copy(t){this.positionWorld.copy(t.positionWorld),this.positionScreen.copy(t.positionScreen)}}class Yy{constructor(){this.id=0,this.v1=new Vy,this.v2=new Vy,this.vertexColors=[new zc,new zc],this.material=null,this.z=0,this.renderOrder=0}}class Wy{constructor(){this.id=0,this.object=null,this.x=0,this.y=0,this.z=0,this.rotation=0,this.scale=new vc,this.material=null,this.renderOrder=0}}class Zy{constructor(){let t,e,i,n,r,s,a,o,l,h,c,d=0,u=0,f=0,m=0,p=0;const g={objects:[],lights:[],elements:[]},_=new qc,x=new Nc,y=new Hc(new qc(-1,-1,-1),new qc(1,1,1)),A=new Hc,v=new Array(3),b=new _d,w=new _d,M=new _d,T=new gd,S=[],C=[],E=[],P=[],k=[];this.projectVector=function(t,e){console.warn("THREE.Projector: .projectVector() is now vector.project()."),t.project(e)},this.unprojectVector=function(t,e){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),t.unproject(e)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")};const z=new function(){const t=[],e=[],s=[];let l=null;const h=new bc;function d(t){const e=t.position,i=t.positionWorld,n=t.positionScreen;i.copy(e).applyMatrix4(c),n.copy(i).applyMatrix4(w);const r=1/n.w;n.x*=r,n.y*=r,n.z*=r,t.visible=n.x>=-1&&n.x<=1&&n.y>=-1&&n.y<=1&&n.z>=-1&&n.z<=1}function f(t,e,i){return!0===t.visible||!0===e.visible||!0===i.visible||(v[0]=t.positionScreen,v[1]=e.positionScreen,v[2]=i.positionScreen,y.intersectsBox(A.setFromPoints(v)))}function p(t,e,i){return(i.positionScreen.x-t.positionScreen.x)*(e.positionScreen.y-t.positionScreen.y)-(i.positionScreen.y-t.positionScreen.y)*(e.positionScreen.x-t.positionScreen.x)<0}return{setObject:function(i){l=i,h.getNormalMatrix(l.matrixWorld),t.length=0,e.length=0,s.length=0},projectVertex:d,checkTriangleVisibility:f,checkBackfaceCulling:p,pushVertex:function(t,e,r){i=function(){if(n===u){const t=new Vy;return C.push(t),u++,n++,t}return C[n++]}(),i.position.set(t,e,r),d(i)},pushNormal:function(e,i,n){t.push(e,i,n)},pushColor:function(t,i,n){e.push(t,i,n)},pushUv:function(t,e){s.push(t,e)},pushLine:function(t,i){const n=C[t],r=C[i];n.positionScreen.copy(n.position).applyMatrix4(M),r.positionScreen.copy(r.position).applyMatrix4(M),!0===function(t,e){let i=0,n=1;const r=t.z+t.w,s=e.z+e.w,a=-t.z+t.w,o=-e.z+e.w;return r>=0&&s>=0&&a>=0&&o>=0||!(r<0&&s<0||a<0&&o<0)&&(r<0?i=Math.max(i,r/(r-s)):s<0&&(n=Math.min(n,r/(r-s))),a<0?i=Math.max(i,a/(a-o)):o<0&&(n=Math.min(n,a/(a-o))),!(n=-1&&t.z<=1&&(l=function(){if(h===p){const t=new Wy;return k.push(t),p++,h++,t}return k[h++]}(),l.id=e.id,l.x=t.x*n,l.y=t.y*n,l.z=t.z,l.renderOrder=e.renderOrder,l.object=e,l.rotation=e.rotation,l.scale.x=e.scale.x*Math.abs(l.x-(t.x+i.projectionMatrix.elements[0])/(t.w+i.projectionMatrix.elements[12])),l.scale.y=e.scale.y*Math.abs(l.y-(t.y+i.projectionMatrix.elements[5])/(t.w+i.projectionMatrix.elements[13])),l.material=e.material,g.elements.push(l))}function R(){if(s===f){const t=new $y;return E.push(t),f++,s++,t}return E[s++]}function B(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id!==e.id?t.id-e.id:0}this.projectScene=function(t,i,r,a){s=0,o=0,h=0,g.elements.length=0,!0===t.autoUpdate&&t.updateMatrixWorld(),null===i.parent&&i.updateMatrixWorld(),b.copy(i.matrixWorldInverse),w.multiplyMatrices(i.projectionMatrix,b),T.setFromProjectionMatrix(w),e=0,g.objects.length=0,g.lights.length=0,D(t),!0===r&&g.objects.sort(B);const l=g.objects;for(let t=0,e=l.length;t0)for(let r=0;r0)for(let n=0;n0;)O.removeChild(O.childNodes[0])}function R(t){return null!==m?t.toFixed(m):t}function B(t,e,i){let n=e.scale.x*s,r=e.scale.y*a;i.isPointsMaterial&&(n*=i.size,r*=i.size);const o="M"+R(t.x-.5*n)+","+R(t.y-.5*r)+"h"+R(n)+"v"+R(r)+"h"+R(-n)+"z";let l="";(i.isSpriteMaterial||i.isPointsMaterial)&&(l="fill:"+i.color.getStyle()+";fill-opacity:"+i.opacity),j(l,o)}function F(t,e,i){const n="M"+R(t.positionScreen.x)+","+R(t.positionScreen.y)+"L"+R(e.positionScreen.x)+","+R(e.positionScreen.y);if(i.isLineBasicMaterial){let t="fill:none;stroke:"+i.color.getStyle()+";stroke-opacity:"+i.opacity+";stroke-width:"+i.linewidth+";stroke-linecap:"+i.linecap;i.isLineDashedMaterial&&(t=t+";stroke-dasharray:"+i.dashSize+","+i.gapSize),j(t,n)}}function N(t,e,n,r,s){g.info.render.vertices+=3,g.info.render.faces++;const a="M"+R(t.positionScreen.x)+","+R(t.positionScreen.y)+"L"+R(e.positionScreen.x)+","+R(e.positionScreen.y)+"L"+R(n.positionScreen.x)+","+R(n.positionScreen.y)+"z";let o="";s.isMeshBasicMaterial?(y.copy(s.color),s.vertexColors&&y.multiply(r.color)):s.isMeshLambertMaterial||s.isMeshPhongMaterial||s.isMeshStandardMaterial?(A.copy(s.color),s.vertexColors&&A.multiply(r.color),y.copy(v),S.copy(t.positionWorld).add(e.positionWorld).add(n.positionWorld).divideScalar(3),function(t,e,i,n){for(let r=0,s=t.length;r1)continue;if(l.positionScreen.z<-1||l.positionScreen.z>1)continue;if(h.positionScreen.z<-1||h.positionScreen.z>1)continue;o.positionScreen.x*=s,o.positionScreen.y*=-a,l.positionScreen.x*=s,l.positionScreen.y*=-a,h.positionScreen.x*=s,h.positionScreen.y*=-a,this.overdraw>0&&(I(o.positionScreen,l.positionScreen,this.overdraw),I(l.positionScreen,h.positionScreen,this.overdraw),I(h.positionScreen,o.positionScreen,this.overdraw)),x.setFromPoints([o.positionScreen,l.positionScreen,h.positionScreen]),!0===_.intersectsBox(x)&&N(o,l,h,i,n)}}q(),n.traverseVisible((function(t){if(t.isSVGObject){if(T.setFromMatrixPosition(t.matrixWorld),T.applyMatrix4(k),T.z<-1||T.z>1)return;const e=T.x*s,i=-T.y*a,n=t.node;n.setAttribute("transform","translate("+e+","+i+")"),O.appendChild(n)}}))}}}let Jy=Ux;"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Sh}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Sh);const Ky=new Gx(Jy);function tA(t,e,i){if(t){void 0!==i&&(globalThis.docuemnt=i);let t=new Qy;return t.setPrecision(e),t}const n=";stroke-opacity:1;stroke-width:1;stroke-linecap:round",r=";fill-opacity:1";let s={svg_attr:{},svg_style:{},path_attr:{},accPath:"",createElementNS(t,e){return"path"==e?{_wrapper:this,setAttribute(t,e){if("style"==t&&e){let t=e.indexOf(n);t>=0&&t==e.length-n.length&&(e=e.slice(0,e.length-n.length));let i=e.indexOf(r);i>=0&&i==e.length-r.length&&(e=e.slice(0,e.length-r.length))}this._wrapper.path_attr[t]=e}}:"svg"!=e?(console.error("not supported element for SVGRenderer",e),null):{_wrapper:this,childNodes:[],style:this.svg_style,setAttribute(t,e){this._wrapper.svg_attr[t]=e},appendChild(t){this._wrapper.accPath+='',this._wrapper.path_attr={}},removeChild(t){this.childNodes=[]}}}},a=globalThis.document;globalThis.document=s;let o=new Qy;return globalThis.document=a,o.doc_wrapper=s,o.originalRender=o.render,o.render=function(t,e){let i=globalThis.document;globalThis.document=this.doc_wrapper,this.originalRender(t,e),globalThis.document=i},o.clearHTML=function(){this.doc_wrapper.accPath=""},o.makeOuterHTML=function(){let t=this.doc_wrapper,e=' viewBox="'+t.svg_attr.viewBox+'" width="'+t.svg_attr.width+'" height="'+t.svg_attr.height+'"',i="";return t.svg_style.backgroundColor&&(i=' style="background:'+t.svg_style.backgroundColor+'"'),'"+t.accPath+""},o.setPrecision(e),o}function eA(t){t||(t=l()?g.Render3DBatch:g.Render3D);let e=p.Render3D;return t==e.Default&&(t=l()?e.WebGLImage:e.WebGL),l()&&t==e.WebGL&&(t=e.WebGLImage),t}let iA={access3dKind(t){let e=this.getPadSvg();if(e.empty())return-1;let i=e.property("can3d");return void 0!==t&&e.property("can3d",t),null==i?-1:i},getSizeFor3d(t,e){void 0===t&&(t=(t=eA())!==p.Render3D.WebGL?p.Embed3D.EmbedSVG:g.Embed3D!=p.Embed3D.Default?g.Embed3D:f.isFirefox||f.chromeVersion>95?p.Embed3D.Embed:p.Embed3D.Overlay);let i=this.getPadSvg(),n="draw3d_"+(this.getPadName()||"canvas");if(i.empty()){let t=Ml(this.selectDom());return t.height<10&&t.width>10&&(t.height=Math.round(.66*t.width),this.selectDom().style("height",t.height+"px")),t.x=0,t.y=0,t.clname=n,t.can3d=-1,t}let r,s=this.getFramePainter(),a=this.getPadPainter();if(s?.mode3d&&t>0)r=s.getFrameRect();else{let e=t>0?i:this.getCanvSvg();r={x:0,y:0,width:e.property("draw_width"),height:e.property("draw_height")},isNaN(r.width)||isNaN(r.height)?(r.width=a.getPadWidth(),r.height=a.getPadHeight()):s&&!s.mode3d&&(e=this.getFrameSvg(),r.x=e.property("draw_x"),r.y=e.property("draw_y"))}r.clname=n,r.can3d=t;let o=a?.getPadRect();if(o){let t=Math.round(.07*r.width),e=Math.round(.05*r.height);r.x=Math.max(0,r.x-t),r.y=Math.max(0,r.y-e),r.width=Math.min(r.width+2*t,o.width-r.x),r.height=Math.min(r.height+2*e,o.height-r.y)}return 1===t&&(r=Tl(this.getPadSvg(),r)),r},clear3dCanvas(){let t=this.access3dKind(null);if(t<0){let e=this.selectDom().node(),i=e?e.firstChild:null;return i&&!i.$jsroot&&(i=i.nextSibling),i&&i.$jsroot&&(delete i.painter,e.removeChild(i)),t}let e=this.getSizeFor3d(t);if(0===e.can3d)$i(this.getCanvSvg().node().nextSibling).remove(),this.getCanvSvg().style("display",null);else{if(this.getPadSvg().empty())return;this.apply3dSize(e).remove(),this.getFrameSvg().style("display",null)}return t},add3dCanvas(t,e,i){if(e&&!(t.can3d<-1))if(-1!==t.can3d)if(t.can3d>0&&!i&&(t.can3d=p.Embed3D.EmbedSVG),this.access3dKind(t.can3d),0===t.can3d)this.getCanvSvg().style("display","none"),this.getCanvSvg().node().parentNode.appendChild(e);else{if(this.getPadSvg().empty())return;this.getFrameSvg().style("display","none"),this.apply3dSize(t).attr("title","").node().appendChild(e)}else{let t=this.selectDom().node();null!==t&&(t.appendChild(e),e.painter=this,e.$jsroot=!0)}},apply3dSize(t,e){if(t.can3d<0)return $i(null);let i;if(t.can3d>1){if(i=this.getLayerSvg(t.clname),e)return i;let n=this.getPadSvg();t.can3d===p.Embed3D.EmbedSVG?(i.empty()&&(i=n.insert("g",".primitives_layer").attr("class",t.clname)),i.attr("transform",`translate(${t.x},${t.y})`)):(i.empty()&&(i=n.insert("foreignObject",".primitives_layer").attr("class",t.clname)),i.attr("x",t.x).attr("y",t.y).attr("width",t.width).attr("height",t.height).attr("viewBox",`0 0 ${t.width} ${t.height}`).attr("preserveAspectRatio","xMidYMid"))}else{let n=this.getCanvSvg().node().parentNode;if(i=$i(n).select("."+t.clname),e)return i;this.getCanvSvg().property("redraw_by_resize",!0),i.empty()&&(i=$i(n).append("div").attr("class",t.clname).style("user-select","none"));let r=n.getBoundingClientRect();for(;n;){if(n===document){n=null;break}try{if("static"!==getComputedStyle(n).position)break}catch(t){break}n=n.parentNode}let s=n?n.getBoundingClientRect():{top:0,left:0},a=Math.round(r.left-s.left),o=Math.round(r.top-s.top);i.style("position","absolute").style("left",t.x+a+"px").style("top",t.y+o+"px").style("width",t.width+"px").style("height",t.height+"px")}return i}};function nA(t){Object.assign(t,iA)}async function rA(t,e,i,n){let r,a=p.Render3D,o=!1,h=x();if(i=eA(i),n||(n={antialias:!0,alpha:!0}),i==a.WebGL)r=Promise.resolve(new Fp(n));else if(i==a.SVG){let t=tA(!1,0,h);l()?o=!0:t.jsroot_dom=h.createElementNS("http://www.w3.org/2000/svg","svg"),r=Promise.resolve(t)}else if(c())r=Promise.resolve().then((function(){return HM})).then((i=>(n.canvas=i.default.createCanvas(t,e),n.canvas.addEventListener=function(){},n.canvas.removeEventListener=function(){},n.canvas.style={},Promise.resolve().then((function(){return HM}))))).then((i=>{let r=i.default(t,e,{preserveDrawingBuffer:!0});if(!r)throw Error("Fail to create headless-gl");n.context=r,r.canvas=n.canvas;let s=new Fp(n);return s.jsroot_output=new Ic(t,e),s.setRenderTarget(s.jsroot_output),o=!0,s}));else{let i=new Fp(n);i.jsroot_dom=h.createElementNS("http://www.w3.org/2000/svg","image"),$i(i.jsroot_dom).attr("width",t).attr("height",e),r=Promise.resolve(i)}return r.then((n=>(o?(s.svg_3ds||(s.svg_3ds=[]),n.workaround_id=s.svg_3ds.length,s.svg_3ds[n.workaround_id]="",n.jsroot_dom=h.createElementNS("http://www.w3.org/2000/svg","path"),n.jsroot_dom.setAttribute("jsroot_svg_workaround",n.workaround_id)):n.jsroot_dom||(n.jsroot_dom=n.domElement),n.setSize(t,e),n.jsroot_render3d=i,n.setJSROOTSize=function(t,e){if(this.jsroot_render3d===p.Render3D.WebGLImage&&!l()&&!c())return $i(this.jsroot_dom).attr("width",t).attr("height",e)},n)))}function sA(t){if(t)if(c()){let e=("function"==typeof t.getContext?t.getContext():null)?.getExtension("STACKGL_destroy_context");e&&e.destroy()}else f.isChrome&&"function"==typeof t.forceContextLoss&&t.forceContextLoss(),"function"==typeof t.dispose&&t.dispose()}function aA(t){t.clearHTML&&t.clearHTML()}function oA(t){let e=p.Render3D;if(t.jsroot_render3d!=e.WebGL)if(t.jsroot_render3d==e.SVG)if(l())s.svg_3ds[t.workaround_id]=t.makeOuterHTML();else{let e=t.jsroot_dom.parentNode;e&&(e.innerHTML=t.makeOuterHTML(),t.jsroot_dom=e.firstChild)}else if(c()){let e=t.domElement,i=e.getContext("2d"),n=new Uint8Array(4*e.width*e.height);t.readRenderTargetPixels(t.jsroot_output,0,0,e.width,e.height,n);let r,a,o=0,l=4*(e.height-1)*e.width;for(;o';s.svg_3ds[t.workaround_id]=d}else{let e=t.domElement.toDataURL("image/png");$i(t.jsroot_dom).attr("xlink:href",e)}}s.processSvgWorkarounds=function(t,e){if(!s.svg_3ds)return t;for(let e=0;e`,s.svg_3ds[e]);return e||(s.svg_3ds=void 0),t};class lA{constructor(t,e){this.tt=null,this.cont=null,this.lastlbl="",this.parent=t||document.body,this.canvas=e,this.abspos=!t}checkParent(t){t&&this.parent!==t&&(this.hide(),this.parent=t)}extract_pos(t){if("object"==typeof t&&void 0!==t.u&&void 0!==t.l)return t;let e={u:0,l:0};return this.abspos?(e.l=t.pageX,e.u=t.pageY):(e.l=t.offsetX,e.u=t.offsetY),e}pos(t){if(!this.tt)return;let e=this.extract_pos(t);if(!this.abspos){let t=this.parent.getBoundingClientRect(),i=this.canvas.getBoundingClientRect();void 0!==t.left&&void 0!==i.left&&(e.l+=i.left-t.left),void 0!==t.top&&void 0!==i.top&&(e.u+=i.top-t.top),e.l+this.tt.offsetWidth+3>=this.parent.offsetWidth&&(e.l=this.parent.offsetWidth-this.tt.offsetWidth-3),e.u+this.tt.offsetHeight+15>=this.parent.offsetHeight&&(e.u=this.parent.offsetHeight-this.tt.offsetHeight-15);let n=this.parent;for(;n;){let t=getComputedStyle(n);if(!t||"static"!==t.position)break;if(!n.parentNode||1!=n.parentNode.nodeType)break;n=n.parentNode}if(n&&n!==this.parent){let i=n.getBoundingClientRect();e.l+=t.left-i.left,e.u+=t.top-i.top}}this.tt.style.top=e.u+15+"px",this.tt.style.left=e.l+3+"px"}show(t){if(!t||""===t)return this.hide();if("object"==typeof t&&(t.lines||t.line)){if(t.only_status)return this.hide();if(t.line)t=t.line;else{let e=t.lines[0];for(let i=1;i"+t.lines[i];t=e}}null===this.tt&&(this.tt=document.createElement("div"),this.tt.setAttribute("style","opacity: 1; filter: alpha(opacity=1); position: absolute; display: block; overflow: hidden; z-index: 101;"),this.cont=document.createElement("div"),this.cont.setAttribute("style","display: block; padding: 2px 12px 3px 7px; margin-left: 5px; font-size: 11px; background: #777; color: #fff;"),this.tt.appendChild(this.cont),this.parent.appendChild(this.tt)),this.lastlbl!==t&&(this.cont.innerHTML=t,this.lastlbl=t,this.tt.style.width="auto")}hide(){null!==this.tt&&this.parent.removeChild(this.tt),this.tt=null,this.lastlbl=""}}function hA(t,e,i,n,r){let s=null,a=g.Zooming&&g.ZoomMouse,o="function"==typeof t.processMouseClick;function l(t){if(s){if(s.mouse_zoom_mesh)return t.stopImmediatePropagation(),void t.stopPropagation();if(!(void 0!==t.button&&0!==t.button||void 0!==t.buttons&&1!==t.buttons))return s.enable_zoom&&(s.mouse_zoom_mesh=s.detectZoomMesh(t),s.mouse_zoom_mesh)?(t.stopImmediatePropagation(),void t.stopPropagation()):void(s.enable_select&&(s.mouse_select_pnt=s.getMousePos(t,{})))}}function h(t){if(s){if(s.mouse_zoom_mesh&&s.mouse_zoom_mesh.point2&&s.painter.get3dZoomCoord){let t=s.mouse_zoom_mesh.object.zoom,e=s.painter.get3dZoomCoord(s.mouse_zoom_mesh.point,t),i=s.painter.get3dZoomCoord(s.mouse_zoom_mesh.point2,t);if(e>i){let t=e;e=i,i=t}"z"===t&&s.mouse_zoom_mesh.object.use_y_for_z&&(t="y"),ethis.delayedProcessMouseMove()),this.mouse_tmout):this.delayedProcessMouseMove()}},s.delayedProcessMouseMove=function(){if(delete this.tmout_handle,!this.painter)return;let t=this.tmout_mouse,e=this.getMouseIntersects(t),i=this.processMouseMove(e);if(i){let e="",n="",r="",s="";t&&(r=t.x.toFixed(0)+","+t.y.toFixed(0)),"string"==typeof i?s=i:(e=i.name,n=i.title,i.line?s=i.line:i.lines&&(s=i.lines.slice(1).join(" "),e=i.lines[0])),this.painter.showObjectStatus(e,n,s,r)}if(this.cursor_changed=!1,i&&this.painter?.isTooltipAllowed())this.tooltip.checkParent(this.painter.selectDom().node()),this.tooltip.show(i,t),this.tooltip.pos(this.tmout_ttpos);else if(this.tooltip.hide(),e)for(let t=0;ts.changeEvent())),s.addEventListener("start",(()=>s.startEvent())),s.addEventListener("end",(()=>s.endEvent())),s.lstn_contextmenu=t=>s.mainProcessContextMenu(t),s.lstn_dblclick=t=>s.mainProcessDblClick(t),s.lstn_mousemove=t=>s.mainProcessMouseMove(t),s.lstn_mouseleave=()=>s.mainProcessMouseLeave(),n.domElement.addEventListener("click",s.lstn_click),n.domElement.addEventListener("dblclick",s.lstn_dblclick),n.domElement.addEventListener("contextmenu",s.lstn_contextmenu),n.domElement.addEventListener("mousemove",s.lstn_mousemove),n.domElement.addEventListener("mouseleave",s.lstn_mouseleave),s}function cA(t,e){if(t){if(t.children)for(let e=0;e{let n={size:3*this.scale*e};i?(n.map=i,n.transparent=!0):n.color=t.color||"black";let r=new eg(this.geom,new Zp(n));return r.nvertex=1,r};if(1!==e){let t=i();return this.noPromise?t:Promise.resolve(t)}let n,r=new uh({style:t.style,color:t.color,size:7}),s=r.fill?1:7,a=``,o="data:image/svg+xml;charset=utf8,"+(c()?a:encodeURIComponent(a));if(c())n=Promise.resolve().then((function(){return HM})).then((t=>t.default.loadImage(o).then((e=>{const i=t.default.createCanvas(64,64);return i.getContext("2d").drawImage(e,0,0,64,64),new rg(i)}))));else{if(this.noPromise)return i((new C_).load(o));n=new Promise(((t,e)=>{(new C_).load(o,(e=>t(e)),void 0,(()=>e()))}))}return n.then(i)}}function mA(t,e,i=!1){if(!t||!e)return null;let n,r,s;"string"==typeof e||i?(n=t.v7EvalColor(e+"color","black"),r=parseInt(t.v7EvalAttr(e+"style",0)),s=parseInt(t.v7EvalAttr(e+"width",1))):(n=t.getColor(e.fLineColor),r=e.fLineStyle,s=e.fLineWidth);let a,o=r?gh(r):"",l=o?o.split(","):[];return a=l&&l.length>=2?new v_({color:n,dashSize:parseInt(l[0]),gapSize:parseInt(l[1])}):new jp({color:n}),s&&s>1&&(a.linewidth=s),a}function pA(t,e,i,n){let r;if(e&&e.children)for(let t=0;t=0&&(s=2),a.x>=0&&a.y>=0&&(s=3),a.x>=0&&a.y<0&&(s=4);let o=(t,e)=>(t<=s&&(t+=4),t>s&&tr?t.camera.position.set(-2*n,-3.5*r,1.4*t.size_z3d):t.camera.position.set(-3.5*n,-2*r,1.4*t.size_z3d)),i&&(e||!t.zoomChangedInteractive())&&Number.isFinite(i.fTheta)&&Number.isFinite(i.fPhi)&&(i.fTheta!==t.camera_Theta||i.fPhi!==t.camera_Phi)){t.camera_Phi=i.fPhi,t.camera_Theta=i.fTheta,n=3*Math.max(t.size_x3d,t.size_z3d),r=3*Math.max(t.size_y3d,t.size_z3d);let s=(270-i.fPhi)/180*Math.PI,a=(i.fTheta-10)/180*Math.PI;t.camera.position.set(n*Math.cos(s)*Math.cos(a),r*Math.sin(s)*Math.cos(a),t.size_z3d+.5*(n+r)*Math.sin(a)),e=!0}e&&t.camera.lookAt(t.lookat)}function _A(t,e,i){if(-1===t){if(!this.mode3d)return;return this.clear3dCanvas?(pA(null,this.toplevel),this.clear3dCanvas(),cA(this.scene),this.control&&this.control.cleanup(),sA(this.renderer),delete this.size_x3d,delete this.size_y3d,delete this.size_z3d,delete this.tooltip_mesh,delete this.scene,delete this.toplevel,delete this.camera,delete this.pointLight,delete this.renderer,delete this.control,this.render_tmout&&(clearTimeout(this.render_tmout),delete this.render_tmout),void(this.mode3d=!1)):void console.error("Strange, why mode3d is configured!!!!",this.mode3d)}if(this.mode3d=!0,"toplevel"in this){this.scene.remove(this.toplevel),cA(this.toplevel),delete this.tooltip_mesh,delete this.toplevel,this.control&&this.control.HideTooltip();let t=new Zd;return this.scene.add(t),this.toplevel=t,this.resize3D(),gA(this,!1),Promise.resolve(!0)}t=eA(t),nA(this);let n=this.getSizeFor3d(void 0,t);return this.size_z3d=100,this.size_x3d=this.size_y3d=n.height>10&&n.width>10?Math.round(n.width/n.height*this.size_z3d):this.size_z3d,e&&(this.size_x3d*=e),i&&(this.size_y3d*=i),this.scene=new Ip,this.toplevel=new Zd,this.scene.add(this.toplevel),this.scene_width=n.width,this.scene_height=n.height,this.camera=new lf(45,this.scene_width/this.scene_height,1,40*this.size_z3d),this.camera_Phi=30,this.camera_Theta=30,this.pointLight=new ux(16777215,1),this.camera.add(this.pointLight),this.pointLight.position.set(this.size_x3d/2,this.size_y3d/2,this.size_z3d/2),this.lookat=new qc(0,0,.8*this.size_z3d),this.camera.up=new qc(0,0,1),this.scene.add(this.camera),gA(this,!0),rA(this.scene_width,this.scene_height,t).then((e=>{if(this.renderer=e,this.webgl=t===p.Render3D.WebGL,this.add3dCanvas(n,this.renderer.jsroot_dom,this.webgl),this.first_render_tm=0,this.enable_highlight=!1,l()||!this.webgl)return this;this.control=hA(this,this.camera,this.scene,this.renderer,this.lookat);let i=this,r=this.getMainPainter();return this.control.processMouseMove=function(t){let e=null,n=null,r=null;for(let i=0;ie.x2||e.y1>e.y2||e.z1>e.z2)&&console.warn("check 3D hints coordinates"),e.x1-=t,e.x2+=t,e.y1-=n,e.y2+=n,e.z1-=r,e.z2+=r}if(i.highlightBin3D(e,n),!e&&r&&i.get3dZoomCoord){let t=r.globalIntersect(this.raycaster),e=r.zoom,n=i.get3dZoomCoord(t,e);return"z"===e&&r.use_y_for_z&&(e="y"),{name:e,title:"axis object",line:e+" : "+i.axisAsText(e,n),only_status:!0}}return e?.lines?e:""},this.control.processMouseLeave=function(){i.highlightBin3D(null)},this.control.contextMenu=function(t,e){let i="painter",n=r;if(e)for(let t=0;t0&&!this.usesvg&&!l())return void(this.render_tmout||(this.render_tmout=setTimeout((()=>this.render3D(0)),t)));if(this.render_tmout&&(clearTimeout(this.render_tmout),delete this.render_tmout),!this.renderer)return;aA(this.renderer);let e=new Date;this.opt3d||(this.opt3d={FrontBox:!0,BackBox:!0}),pA(this.camera,this.toplevel,this.opt3d.FrontBox,this.opt3d.BackBox),this.renderer.render(this.scene,this.camera),oA(this.renderer);let i=new Date;0===this.first_render_tm&&(this.first_render_tm=i.getTime()-e.getTime(),this.enable_highlight=this.first_render_tm<1200&&this.isTooltipAllowed(),console.log(`three.js r138, first render tm = ${this.first_render_tm}`))}function yA(){let t=this.getSizeFor3d(this.access3dKind());return this.apply3dSize(t),(this.scene_width!==t.width||this.scene_height!==t.height)&&(!(t.width<10||t.height<10)&&(this.scene_width=t.width,this.scene_height=t.height,this.camera.aspect=this.scene_width/this.scene_height,this.camera.updateProjectionMatrix(),this.renderer.setSize(this.scene_width,this.scene_height),this.renderer.setJSROOTSize&&this.renderer.setJSROOTSize(this.scene_width,this.scene_height),!0))}function AA(t,e){let i=!1,n=null,r=!0,s=!t||void 0===t.x1||!this.enable_highlight,a=this.getMainPainter();if(!a||a.provideUserTooltip&&a.hasUserTooltip()||(a=null),this.tooltip_selfmesh&&(r=this.tooltip_selfmesh!==e,this.tooltip_selfmesh.material.color=this.tooltip_selfmesh.save_color,delete this.tooltip_selfmesh,i=!0),this.tooltip_mesh&&(n=this.tooltip_mesh,this.toplevel.remove(this.tooltip_mesh),delete this.tooltip_mesh,i=!0),s)return i&&this.render3D(),void(i&&a&&a.provideUserTooltip(null));if(t.use_itself)e.save_color=e.material.color,e.material.color=new zc(t.color),this.tooltip_selfmesh=e,i=r;else{i=!0;const e=uA.Indexes,r=uA.Normals,s=uA.Vertices,a=new zc(t.color?t.color:16711680),o=t.opacity||1;let l,h;if(n)l=n.geometry.attributes.position.array,n.geometry.attributes.position.needsUpdate=!0,n.material.color=a,n.material.opacity=o;else{l=new Float32Array(3*e.length),h=new Float32Array(3*e.length);const t=new ru;t.setAttribute("position",new Pd(l,3)),t.setAttribute("normal",new Pd(h,3));const i=new Du({color:a,opacity:o,vertexColors:!1});n=new Zu(t,i)}t.x1===t.x2&&console.warn(`same tip X ${t.x1} ${t.x2}`),t.y1===t.y2&&console.warn(`same tip Y ${t.y1} ${t.y2}`),t.z1===t.z2&&(t.z2=t.z1+1e-4);for(let i=0,n=-3;i0&&(v=Math.min(v,.9*h/i))),this.x_handle.isCenteredLabels()&&(h||(h=Math.min(t-n,r-t)),e.grx+=h/2)}E.push(t,0,0,t,this.x_handle.ticksSize*(e?-1:-.6),0)}if(this.x_handle.fTitle&&i.draw){const t=new Lx(Nl(this.x_handle.fTitle),{font:Ky,size:this.x_handle.titleFont.size,height:0,curveSegments:5});t.computeBoundingBox(),t.center=this.x_handle.titleCenter,t.opposite=this.x_handle.titleOpposite,t.offsety=1.6*this.x_handle.titleOffset+.005*(a-s),t.grx=(n+r)/2,t.kind="title",P.push(t)}this.get3dZoomCoord=function(t,e){let i=t[e],n=this[`scale_${e}min`],r=this[`scale_${e}max`];switch(e){case"x":i=(i+this.size_x3d)/2/this.size_x3d;break;case"y":i=(i+this.size_y3d)/2/this.size_y3d;break;case"z":i=i/2/this.size_z3d}return i=this["log"+e]?Math.exp(Math.log(n)+i*(Math.log(r)-Math.log(n))):n+i*(r-n),i};const z=(t,e,i)=>{let n,r=new ru,s=Math.max(this[t+"_handle"].ticksSize,.005*e);n="z"===t?new Float32Array([0,0,0,4*s,0,2*e,4*s,0,0,0,0,0,0,0,2*e,4*s,0,2*e]):new Float32Array([-e,0,0,e,4*-s,0,e,0,0,-e,0,0,-e,4*-s,0,e,4*-s,0]),r.setAttribute("position",new Pd(n,3)),r.computeVertexNormals();let a=new Du({transparent:!0,vertexColors:!1,side:2,opacity:0}),o=new Zu(r,a);return o.zoom=t,o.size_3d=e,o.tsz=s,o.use_y_for_z=i,"y"==t&&o.rotateZ(Math.PI/2).rotateX(Math.PI),o.v1=new qc(n[0],n[1],n[2]),o.v2=new qc(n[6],n[7],n[8]),o.v3=new qc(n[3],n[4],n[5]),o.globalIntersect=function(t){if(!this.v1||!this.v2||!this.v3)return;let e=new fd;e.setFromCoplanarPoints(this.v1,this.v2,this.v3),e.applyMatrix4(this.matrixWorld);let i=t.ray.origin.clone(),n=i.clone().addScaledVector(t.ray.direction,1e10),r=e.intersectLine(new Cx(i,n),new qc);if(!r)return;let s=-this.size_3d,a=this.size_3d;return"z"===this.zoom&&(s=0,a=2*this.size_3d),r[this.zoom]a&&(r[this.zoom]=a),r},o.showSelection=function(t,e){let i,n=this.children?this.children[0]:null,r=this.zoom;if(!t||!e)return n&&(this.remove(n),cA(n)),n;if(!this.geometry)return!1;if(n)i=n.geometry;else{i=this.geometry.clone();let t=i.getAttribute("position").array;"z"==r?t[6]=t[3]=t[15]=this.tsz:t[4]=t[16]=t[13]=-this.tsz,n=new Zu(i,new Du({color:65280,side:2,vertexColors:!1})),this.add(n)}let s=i.getAttribute("position").array;return"z"==r?(s[2]=s[11]=s[8]=t[r],s[5]=s[17]=s[14]=e[r]):(s[0]=s[9]=s[12]=t[r],s[6]=s[3]=s[15]=e[r]),i.getAttribute("position").needsUpdate=!0,!0},o};let D,O=new Zd;for(O.position.set(0,s,o),O.rotation.x=1/4*Math.PI,O.xyid=2,i.draw&&(D=dA(E,T(this.x_handle,"ticks")),O.add(D)),P.forEach((t=>{let e=t.boundingBox.max.x-t.boundingBox.min.x,i=t.center?t.grx-e/2:t.opposite?n:r-e,s=new _d;s.set(v,0,0,i,0,v,0,-k*v-this.x_handle.ticksSize-t.offsety,0,0,1,0,0,0,0,1);let a=new Zu(t,S(this.x_handle,t.kind));a.applyMatrix4(s),O.add(a)})),i.zoom&&O.add(z("x",this.size_x3d)),C.add(O),O=new Zd,O.position.set(0,a,o),O.rotation.x=3/4*Math.PI,i.draw&&O.add(new Wp(D.geometry,D.material)),P.forEach((t=>{let e=t.boundingBox.max.x-t.boundingBox.min.x,i=t.center?t.grx+e/2:t.opposite?n+e:r,s=new _d;s.set(-v,0,0,i,0,v,0,-k*v-this.x_handle.ticksSize-t.offsety,0,0,-1,0,0,0,0,1);let a=new Zu(t,S(this.x_handle,t.kind));a.applyMatrix4(s),O.add(a)})),O.xyid=4,i.zoom&&O.add(z("x",this.size_x3d)),C.add(O),P=[],v=1,k=0,E=[];w.next();){let t=w.grpos,e=1===w.kind,o=this.y_handle.format(w.tick,2);if(w.last_major()?this.y_handle.fTitle||(o="y"):null===o&&(e=!1,o=""),e&&o&&i.draw){const e=new Lx(o,{font:Ky,size:this.y_handle.labelsFont.size,height:0,curveSegments:5});e.computeBoundingBox();let i=e.boundingBox.max.x-e.boundingBox.min.x,l=e.boundingBox.max.y-e.boundingBox.min.y;e.center=!0,k=Math.max(k,l),e.gry=t,e.offsetx=this.y_handle.labelsOffset+.005*(r-n),P.push(e);let h=0;w.last_major()||(h=w.next_major_grpos()-t,i>0&&(v=Math.min(v,.9*h/i))),this.y_handle.isCenteredLabels()&&(h||(h=Math.min(t-s,a-t)),e.gry+=h/2)}E.push(0,t,0,this.y_handle.ticksSize*(e?-1:-.6),t,0)}if(this.y_handle.fTitle&&i.draw){const t=new Lx(Nl(this.y_handle.fTitle),{font:Ky,size:this.y_handle.titleFont.size,height:0,curveSegments:5});t.computeBoundingBox(),t.center=this.y_handle.titleCenter,t.opposite=this.y_handle.titleOpposite,t.offsetx=1.6*this.y_handle.titleOffset+.005*(r-n),t.gry=(s+a)/2,t.kind="title",P.push(t)}if(!i.use_y_for_z){let t,e=new Zd;e.position.set(n,0,o),e.rotation.y=-1/4*Math.PI,i.draw&&(t=dA(E,T(this.y_handle,"ticks")),e.add(t)),P.forEach((t=>{let i=t.boundingBox.max.x-t.boundingBox.min.x,n=t.center?t.gry+i/2:t.opposite?s+i:a,r=new _d;r.set(0,v,0,-k*v-this.y_handle.ticksSize-t.offsetx,-v,0,0,n,0,0,1,0,0,0,0,1);let o=new Zu(t,S(this.y_handle,t.kind));o.applyMatrix4(r),e.add(o)})),e.xyid=3,i.zoom&&e.add(z("y",this.size_y3d)),C.add(e),e=new Zd,e.position.set(r,0,o),e.rotation.y=-3/4*Math.PI,i.draw&&e.add(new Wp(t.geometry,t.material)),P.forEach((t=>{let i=t.boundingBox.max.x-t.boundingBox.min.x,n=t.center?t.gry-i/2:t.opposite?s:a-i,r=new _d;r.set(0,v,0,-k*v-this.y_handle.ticksSize-t.offsetx,v,0,0,n,0,0,-1,0,0,0,0,1);let o=new Zu(t,S(this.y_handle,t.kind));o.applyMatrix4(r),e.add(o)})),e.xyid=1,i.zoom&&e.add(z("y",this.size_y3d)),C.add(e)}P=[],v=1,E=[];let L=null,R=null,B=null,F=0;for(this.size_z3d&&(L=[],R=[]);M.next();){let t=M.grpos,e=1==M.kind,o=this.z_handle.format(M.tick,2);if(null===o&&(e=!1,o=""),e&&o&&i.draw){let e=new Lx(o,{font:Ky,size:this.z_handle.labelsFont.size,height:0,curveSegments:5});e.computeBoundingBox();let i=e.boundingBox.max.x-e.boundingBox.min.x,n=e.boundingBox.max.y-e.boundingBox.min.y;e.translate(-i,-n/2,0),e.grz=t,P.push(e),null!==B&&n>0&&(v=Math.min(v,.9*(t-B)/n)),F=Math.max(F,i),B=t}L&&e&&L.push(n,0,t,r,0,t),R&&e&&R.push(0,s,t,0,a,t),E.push(0,0,t,this.z_handle.ticksSize*(e?1:.6),0,t)}if(L&&L.length>0){const t=new v_({color:this.x_handle.ticksColor,dashSize:2,gapSize:2}),e=dA(L,t);e.position.set(0,a,0),e.grid=2,e.visible=!1,C.add(e);const i=new Wp(e.geometry,t);i.position.set(0,s,0),i.grid=4,i.visible=!1,C.add(i)}if(R&&R.length>0){const t=new v_({color:this.y_handle.ticksColor,dashSize:2,gapSize:2}),e=dA(R,t);e.position.set(r,0,0),e.grid=3,e.visible=!1,C.add(e);const i=new Wp(e.geometry,t);i.position.set(n,0,0),i.grid=1,i.visible=!1,C.add(i)}let N=[],I=i.draw?dA(E,T(this.z_handle,"ticks")):null;for(let t=0;t<4;++t){if(N.push(new Zd),P.forEach(((e,i)=>{let s=new _d,a=e.grz;this.z_handle.isCenteredLabels()&&(i0&&(a=Math.min(1.5*a-.5*P[i-1].grz,l))),s.set(-v,0,0,this.z_handle.ticksSize+.005*(r-n)+this.z_handle.labelsOffset,0,0,1,0,0,v,0,a);let o=new Zu(e,S(this.z_handle));o.applyMatrix4(s),N[t].add(o)})),this.z_handle.fTitle&&i.draw){let e=new Lx(Nl(this.z_handle.fTitle),{font:Ky,size:this.z_handle.titleFont.size,height:0,curveSegments:5});e.computeBoundingBox();let i=e.boundingBox.max.x-e.boundingBox.min.x,s=this.z_handle.titleCenter?(l+o-i)/2:this.z_handle.titleOpposite?o:l-i;e.rotateZ(Math.PI/2);let a=new _d;a.set(-v,0,0,this.z_handle.ticksSize+.005*(r-n)+F+this.z_handle.titleOffset,0,0,1,0,0,v,0,s);let h=new Zu(e,S(this.z_handle,"title"));h.applyMatrix4(a),N[t].add(h)}i.draw&&I&&N[t].add(0==t?I:new Wp(I.geometry,I.material)),i.zoom&&N[t].add(z("z",this.size_z3d,i.use_y_for_z)),N[t].zid=t+2,C.add(N[t])}N[0].position.set(n,a,0),N[0].rotation.z=3/4*Math.PI,N[1].position.set(r,a,0),N[1].rotation.z=1/4*Math.PI,N[2].position.set(r,s,0),N[2].rotation.z=-1/4*Math.PI,N[3].position.set(n,s,0),N[3].rotation.z=-3/4*Math.PI;let j=T(this.x_handle),q=dA([n,0,0,r,0,0],j,null,!0);for(let t=0;t<2;++t){let e=new Wp(q,j);e.position.set(0,s,0===t?o:l),e.xyboxid=2,e.bottom=0==t,C.add(e),e=new Wp(q,j),e.position.set(0,a,0===t?o:l),e.xyboxid=4,e.bottom=0==t,C.add(e)}let U=T(this.y_handle),G=dA([0,s,0,0,a,0],U,null,!0);for(let t=0;t<2;++t){let e=new Wp(G,U);e.position.set(n,0,0===t?o:l),e.xyboxid=3,e.bottom=0==t,C.add(e),e=new Wp(G,U),e.position.set(r,0,0===t?o:l),e.xyboxid=1,e.bottom=0==t,C.add(e)}let H=T(this.z_handle),X=dA([0,0,o,0,0,l],H,null,!0);for(let t=0;t<4;++t){let e=new Wp(X,H);e.zboxid=N[t].zid,e.position.copy(N[t].position),C.add(e)}}function wA(t){Object.assign(t,{create3DScene:_A,render3D:xA,resize3D:yA,highlightBin3D:AA,set3DOptions:vA,drawXYZ:bA})}function MA(t,e=!1){if(!t.draw_content)return;const i=uA.Vertices,n=uA.Indexes,r=uA.Normals,s=uA.Segments,a=[0,1,1,2,2,3,3,0],o=[new qc(0,0,0),new qc(0,1,0),new qc(1,1,0),new qc(1,0,0)],l=t.getFramePainter(),h=t.prepareDraw({rounding:!1,use3d:!0,extra:1}),c=h.i1,d=h.i2,u=h.j1,f=h.j2,m=t.getHisto(),p=m?m.$baseh:null,g=11===t.options.Lego||13===t.options.Lego,_=m.getBin(d,f)<65535;if(c>=d||u>=f)return;let x,y,A,v,b,w,M,T,S,C,E,P,k,z,D,O=l.z_handle.getScaleMin(),L=l.z_handle.getScaleMax();const R=(e,i,n)=>{if(P=m.getBinContent(e+1,i+1),E=p?p.getBinContent(e+1,i+1):!1!==t.options.BaseLine?t.options.BaseLine:t.options.Zero?O:0,P=y||P=P,!k||n>0||!p&&(!!(t.options.Zero||O>0)||t._show_empty_bins))};let B=[O,L],F=null;if(12===t.options.Lego||14===t.options.Lego)if(e)F=l.getHistPalette(),t.createContour(l,F,{full_z_range:!0}),B=F.getContour(),O=B[0],L=B[B.length-1];else{B=t.createContour(m.fContour?m.fContour.length:20,l.lego_zmin,l.lego_zmax).arr,F=t.getHistPalette()}for(let s=0;s0,D=!k&&P>y&&s0,D=!k&&P>y&&sy?N:l.grz(P),V=0,$=0,k&&(V+=12,$+=24);let t=n.length,e=m.getBin(A+1,v+1);for(z&&(t-=6);$=this.face_to_bins_index.length)return null;const e=this.painter,i=this.handle,n=e.getFramePainter(),r=e.getHisto(),s=e.get3DToolTip(this.face_to_bins_index[t.faceIndex]);s.x1=Math.max(-n.size_x3d,i.grx[s.ix-1]+i.xbar1*(i.grx[s.ix]-i.grx[s.ix-1])),s.x2=Math.min(n.size_x3d,i.grx[s.ix-1]+i.xbar2*(i.grx[s.ix]-i.grx[s.ix-1])),s.y1=Math.max(-n.size_y3d,i.gry[s.iy-1]+i.ybar1*(i.gry[s.iy]-i.gry[s.iy-1])),s.y2=Math.min(n.size_y3d,i.gry[s.iy-1]+i.ybar2*(i.gry[s.iy]-i.gry[s.iy-1]));let a=this.baseline,o=s.value;if(r.$baseh&&(a=r.$baseh.getBinContent(s.ix,s.iy)),o0){const e=new ru;e.setAttribute("position",new Pd(U,3)),e.setAttribute("normal",new Pd(G,3));const i=new zc(Q<2?16711680:pt(J).darker(.5).toString()),n=new Du({color:i,vertexColors:!1}),r=new Zu(e,n);r.face_to_bins_index=H,r.painter=t,r.handle=tt.handle,r.tooltip=tt.tooltip,r.zmin=tt.zmin,r.zmax=tt.zmax,r.baseline=tt.baseline,r.tip_color=tt.tip_color,l.toplevel.add(r)}}if(t.options.Lego>12)return;let N=0,I=0;for(y=L,x=O,A=c;AL?H:l.grz(P);const t=k?a:s,e=k?o:i;if(j){for(b=0;ba||(c!==s||t.options.Zero||s>0||t._show_empty_bins)&&(0!==e?(h=n.getBin(o+1,l+1),d=n.getBinError(h),A[v/18]=h,f=r.gry[l],p=r.gry[l+1],g=i.grz(c-da?a:c+d),y[v]=u,y[v+3]=m,y[v+1]=y[v+4]=(f+p)/2,y[v+2]=y[v+5]=(g+_)/2,v+=6,y[v]=y[v+3]=(u+m)/2,y[v+1]=f,y[v+4]=p,y[v+2]=y[v+5]=(g+_)/2,v+=6,y[v]=y[v+3]=(u+m)/2,y[v+1]=y[v+4]=(f+p)/2,y[v+2]=g,y[v+5]=_,v+=6):x+=3);if(0===e){if(0===x)return;y=new Float32Array(6*x),A=new Int32Array(x/3)}}const b=e?t.v7EvalColor("line_color","lightblue"):t.getColor(n.fLineColor),w=dA(y,new jp({color:new zc(b),linewidth:e?t.v7EvalAttr("line_width",1):n.fLineWidth}));w.painter=t,w.intersect_index=A,w.zmin=s,w.zmax=a,w.tip_color=3===n.fLineColor?16711680:65280,w.tooltip=function(t){if(!Number.isInteger(t.index))return console.error("segment index not provided, three.js version 138"),null;let e=Math.floor(t.index/6);if(e<0||e>=this.intersect_index.length)return null;let i=this.painter,n=i.getHisto(),r=i.getFramePainter(),s=i.get3DToolTip(this.intersect_index[e]);return s.x1=Math.max(-r.size_x3d,r.grx(n.fXaxis.GetBinLowEdge(s.ix))),s.x2=Math.min(r.size_x3d,r.grx(n.fXaxis.GetBinLowEdge(s.ix+1))),s.y1=Math.max(-r.size_y3d,r.gry(n.fYaxis.GetBinLowEdge(s.iy))),s.y2=Math.min(r.size_y3d,r.gry(n.fYaxis.GetBinLowEdge(s.iy+1))),s.z1=r.grz(s.value-s.errorthis.zmax?this.zmax:s.value+s.error),s.color=this.tip_color,s},i.toplevel.add(w)}function SA(t,e=!1,i=!1){let n=t.getFramePainter(),r=t.prepareDraw({rounding:!1,use3d:!0,extra:100,middle:0}),s=t.getHisto(),a=t.getContourLevels(),o=t.getHistPalette(),l=2*n.size_z3d,h=[];t.buildContour(r,a,o,((t,i,r,s,o,c)=>{if(!(o-s<3||e&&(l=n.grz(a[c]),l<0||l>2*n.size_z3d)))for(let t=s;tt0&&(b=f.getHistPalette(),2==e&&t.createContour(f,b,{full_z_range:!0}),_=b.getContour())}else switch(t.options.Surf){case 11:_=t.getContourLevels(),b=t.getHistPalette();break;case 12:case 15:case 17:_=t.getContourLevels(),b=t.getHistPalette(),y=!1;break;case 14:y=!1,v=!0;break;case 16:_=t.getContourLevels(),A=!0,y=!1;break;default:_=f.z_handle.createTicks(!0),A=!0}if(_){x=new Float32Array(_.length);for(let t=0;t<_.length;++t)x[t]=g(_[t])}else x=[0,2*f.size_z3d];let w,M=[],T=[],S=[],C=0,E=null,P=0,k=0,z=null,D=0,O=[];function L(t,e,i){return ti?1:0}function R(t,e,i,n,r,s){if(!y)return;let a=L(i,0,2*f.size_z3d),o=L(s,0,2*f.size_z3d);if(a!==o||0===a){if(!w)return++C;if(0!==a){let o=s-i;t=n-(n-t)/o*(s-(i=a<0?0:2*f.size_z3d)),e=r-(r-e)/o*(s-i)}if(0!==o){let a=i-s;n=t-(t-n)/a*(i-(s=o<0?0:2*f.size_z3d)),r=e-(e-r)/a*(i-s)}E[P]=t,E[P+1]=e,E[P+2]=i,P+=3,E[P]=n,E[P+1]=r,E[P+2]=s,P+=3}}let B=new Float32Array(18),F=0,N=0,I=new Float32Array(6),j=0;function q(t,e,i,n,r,s,a,o){F>=B.length&&console.log("more than 6 points???");let l=(a-i)/(s-i),h=3;0!==N&&Math.abs(l)=0)return console.error("More than 8 vertexes for the bin");let r=n+8+O[n];O[n]--,O[r]=t}function G(t){for(let e=m.i1;e=0?n:n+9+O[n],s=n+8,a=0,o=0,l=0;for(let e=r;e2&&(void 0===M[u]&&(M[u]=0),M[u]+=t-2),!(f>0||m>0||p>0)||f===m&&m===p&&p===f||++k;continue}if(j=0,F=0,0===f&&(B[F]=t,B[F+1]=e,B[F+2]=r,F+=3),f!==m&&(N=0,(f<0||m<0)&&q(t,e,r,s,a,o,x[u-1]),(f>0||m>0)&&q(t,e,r,s,a,o,x[u],!0)),0===m&&(B[F]=s,B[F+1]=a,B[F+2]=o,F+=3),m!==p&&(N=0,(m<0||p<0)&&q(s,a,o,l,h,c,x[u-1]),(m>0||p>0)&&q(s,a,o,l,h,c,x[u],!0)),0===p&&(B[F]=l,B[F+1]=h,B[F+2]=c,F+=3),p!==f&&(N=0,(p<0||f<0)&&q(l,h,c,t,e,r,x[u-1]),(p>0||f>0)&&q(l,h,c,t,e,r,x[u],!0)),0===F)continue;if(F<9){console.log("found less than 3 points",F/3);continue}if(z&&6===j){for(let t=0;t<6;++t)z[D+t]=I[t];D+=6}let _=T[u],y=S[u];v&&9===F&&(U(y,i,n),U(y+3,i+1,d?n+1:n),U(y+6,d?i:i+1,n+1));for(let t=3;t0&&(E=new Float32Array(6*C)),A&&k>0&&(z=new Float32Array(6*k))}for(i=m.i1;i1?t.getColor(u.fFillColor):"white",14===t.options.Surf&&u.fFillColor<2&&(n=t.getColor(48))),r=14===t.options.Surf?new y_({color:n,side:2,vertexColors:!1}):new Du({color:n,side:2,vertexColors:!1});let a=new Zu(s,r);f.toplevel.add(a),a.painter=t}if(E){6*C!==P&&console.error("SURF lines mismmatch nsegm",C," lindx",P,"difference",6*C-P);const e=t.getColor(u.fLineColor),i=new jp({color:new zc(e),linewidth:u.fLineWidth}),n=dA(E,i);n.painter=t,f.toplevel.add(n)}if(z){6*k!==D&&console.error("SURF grid draw mismatch ngridsegm",k,"gindx",D,"diff",6*k-D);const e=1===t.options.Surf?new v_({color:0,dashSize:2,gapSize:2}):new jp({color:new zc(t.getColor(u.fLineColor))}),i=dA(z,e);i.painter=t,f.toplevel.add(i)}if(17===t.options.Surf&&SA(t,!1,e),13===t.options.Surf){m=t.prepareDraw({rounding:!1,use3d:!0,extra:100,middle:0});let e=t.getContourLevels(),i=t.getHistPalette(),n=-1,r=2*f.size_z3d;t.buildContour(m,e,i,((e,s,a,o,l)=>{if(s[l]===s[o]&&a[l]===a[o]&&l--,l-o<3)return;let h=[];for(let t=o;t<=l;++t)t!==o&&s[t]===s[t-1]&&a[t]===a[t-1]||h.push(new vc(s[t],a[t]));if(h.length<3)return;const c=e_.triangulateShape(h,[]);if(!c||0===c.length)return;(n<0||n!==e)&&(n=e,r+=1e-4*f.size_z3d);const d=new Float32Array(9*c.length),u=new Float32Array(9*c.length);let m=0;for(let t=0;t10?n.toExponential(this.ndig-11):n.toFixed(this.ndig):Sl(n,i||_.fStatFormat)},formatExp(t,e,i){let n="";if(i&&0!=(i=Math.round(i/Math.pow(t,e)))&&1!=i&&(n=i.toString()+(g.Latex?"#times":"x")),Math.abs(t-Math.exp(1))<.001?n+="e":n+=t.toString(),g.Latex>p.Latex.Symbols)return n+"^{"+e+"}";const r={0:"⁰",1:"¹",2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹","-":"⁻"};let s=e.toString();for(let t=0;t{let e=0,i=0;for(let n=1;n4&&i(n);)e=Math.round(.8*e),n=t.ticks(e);if(e<5&&i(n)&&this.logbase&&10!=this.logbase){let t=[];n.forEach((e=>{let i=Math.log10(e)/Math.log10(this.logbase);Math.abs(Math.round(i)-i)<.01&&t.push(e)})),t.length>0&&(n=t)}return n},produceTicks(t,e){if(!this.noticksopt){let i=t*(e||1);if(this.log)return this.poduceLogTicks(this.func,i);let n=this.func.domain();const r=t=>t.length<=i||!(t.length>i+1)&&(t[0]===n[0]||t[i]===n[1]);let s=this.func.ticks(i);if(e||r(s))return s;let a=this.func.ticks(Math.round(.7*i));return a.length>2&&r(a)?a:s}let i=this.func.domain(),n=[];e&&(t=(t-1)*e);for(let e=0;e<=t;++e)n.push((i[0]*(t-e)+i[1]*e)/t);return n},analyzeWheelEvent(t,e,i,n){i||(i={});let r=0,s=1,a=1;if("dleft"in i&&(s=i.dleft,r=1),"dright"in i&&(a=i.dright,r=1),i.delta?r=i.delta:t&&(r=t.wheelDelta?-t.wheelDelta:t.deltaY||t.detail),!r||n&&i.ignore)return;r=r<0?-.2:.2,s*=r,a*=r;let o=i.min=this.scale_min,l=i.max=this.scale_max,h=this.full_min,c=this.full_max;if(i.min===i.max&&r<0&&(i.min=h,i.max=c),!(i.min>=i.max)){if(i.reverse&&(e=1-e),e>0&&e<1){if(this.log){let t=i.min>0?Math.log10(i.max/i.min):2;t>10?t=10:t<.01&&(t=.01),i.min=i.min/Math.pow(10,t*s*e),i.max=i.max*Math.pow(10,t*a*(1-e))}else if(s!==-a||i.reverse){let t=i.max-i.min,n=t;s>0&&(t=1.001*t/(1-s)),i.min+=-s*e*t,a>0&&(n=1.001*n/(1-a)),i.max-=-a*(1-e)*n}else{let t=(i.max-i.min)*a*e;Math.round(i.max)===i.max&&Math.round(i.min)===i.min&&Math.abs(t)>1&&(t=Math.round(t)),i.min+tc&&(t=c-i.max),0!=t?(i.min+=t,i.max+=t):(delete i.min,delete i.max)}i.min>=i.max?i.min=i.max=void 0:s!==a?(i.minc&&l===c)&&(i.min=i.max=void 0):(i.minc&&(i.max=c))}else i.min=i.max=void 0;return i.changed=void 0!==i.min&&void 0!==i.max,i}}};class zA extends _h{constructor(t,e,i){super(t,e),Object.assign(this,kA),this.initAxisPainter(),this.embedded=i,this.invert_side=!1,this.lbls_both_sides=!1}cleanup(){this.cleanupAxisPainter(),super.cleanup()}getAxisType(){return"TAxis"}configureAxis(t,e,i,n,r,s,a,o){this.name=t,this.full_min=e,this.full_max=i,this.kind="normal",this.vertical=s,this.log=o.log||0,this.symlog=o.symlog||!1,this.reverse=o.reverse||!1,this.swap_side=o.swap_side||!1,this.fixed_ticks=o.fixed_ticks||null,this.maxTickSize=o.maxTickSize||0;let l=this.getObject();if(o.time_scale||l.fTimeDisplay?(this.kind="time",this.timeoffset=function(t){let e=7889184e5;if(!t)return e;let i=t.fTimeFormat.indexOf("%F");if(i<0)return 1e3*_.fTimeOffset;let n=t.fTimeFormat.slice(i+2);if(0==n.indexOf("1995-01-01 00:00:00s0"))return e;if("0"==n||""==n)return 0;const r=(t,e,i)=>{let r=n.indexOf(t);if(r<0)return e;let s=parseInt(n.slice(0,r));return n=n.slice(r+1),!Number.isInteger(s)||si?e:s},s=r("-",1970,2300),a=r("-",1,12)-1,o=r(" ",1,31),l=r(":",0,23),h=r(":",0,59),c=r("s",0,59),d=r(" ",0,999),u=new Date(Date.UTC(s,a,o,l,h,c,d));let f=u.getTime();if(n=n.toUpperCase(),0==n.indexOf("GMT")&&(f+=6e4*u.getTimezoneOffset(),n=n.slice(4).trim(),n.length>3)){let t=0,e=1e3;"-"==n[0]&&(t=1,e=-1e3),f-=e*(3600*parseInt(n.slice(t,t+2))+60*parseInt(n.slice(t+2,t+4)))}return f}(l)):this.kind=l.fLabels?"labels":"normal","time"==this.kind)this.func=Ka().domain([this.convertDate(n),this.convertDate(r)]);else if(this.log){if(this.logbase=2===this.log?2:10,r<=0&&(r=1),n<=0&&l&&!o.logcheckmin)for(let t=0;t0);++t);n<=0&&o.log_min_nz&&(n=o.log_min_nz),(n<=0||n>=r)&&(n=r*(o.logminfactor||1e-4)),this.func=Tr().base(2==this.log?2:10).domain([n,r])}else if(this.symlog){let t=Math.max(Math.abs(n),Math.abs(r));Number.isInteger(this.symlog)&&this.symlog>0?t*=Math.pow(10,-1*this.symlog):t*=.01,this.func=Pr().constant(t).domain([n,r])}else this.func=gr().domain([n,r]);if(this.vertical^this.reverse){let t=a[0];a[0]=a[1],a[1]=t}this.func.range(a),this.scale_min=n,this.scale_max=r,"time"==this.kind?this.gr=t=>this.func(this.convertDate(t)):this.log?this.gr=t=>t20&&(this.nticks=20);let d=Math.abs(this.func.range()[1]-this.func.range()[0]);if(d<=0&&(d=100),"time"==this.kind){this.nticks>8&&(this.nticks=8);let t=this.scale_max-this.scale_min,e=l.fTimeFormat.indexOf("%F"),i=e>=0?l.fTimeFormat.slice(0,e):l.fTimeFormat,n=PA(t/d,!1);(0==i.length||t<.1*(this.full_max-this.full_min))&&(i=PA(t/this.nticks,!0)),this.tfunc1=this.tfunc2=Ps(i),n!==i&&(this.tfunc2=Ps(n)),this.format=this.formatTime}else if(this.log)this.nticks2>1&&(this.nticks*=this.nticks2,this.nticks2=1),this.noexp=!!l&&l.TestBit(EA.kNoExponent),this.scale_max<300&&this.scale_min>.3&&(this.noexp=!0),this.moreloglabels=!!l&&l.TestBit(EA.kMoreLogLabels),this.format=this.formatLog;else if("labels"==this.kind){this.nticks=50;let t=this.scale_max-this.scale_min;this.nticks>t&&(this.nticks=Math.round(t)),this.regular_labels=!0,l&&l.fNbins&&l.fLabels&&(l.fNbins==Math.round(l.fXmax-l.fXmin)&&0==l.fXmin&&l.fXmax==l.fNbins||(this.regular_labels=!1)),this.nticks2=1,this.format=this.formatLabels}else this.order=0,this.ndig=0,this.format=this.formatNormal}getScaleMin(){return this.func?this.func.domain()[0]:0}getScaleMax(){return this.func?this.func.domain()[1]:0}formatLabels(t){let e=parseFloat(t),i=this.getObject();if(e=this.regular_labels?Math.floor(e):Math.round((e-i.fXmin)/(i.fXmax-i.fXmin)*i.fNbins),e<0||e>=i.fNbins)return null;for(let t=0;t{t>=this.scale_min&&t<=this.scale_max&&r.push(t)}));else if("labels"!=this.kind||this.regular_labels)r=this.produceTicks(this.nticks);else{r=[],s.lbl_pos=[];let t=this.getObject();for(let e=0;e=this.scale_min&&ithis.scale_min&&r.push(i))}}if(s.minor=s.middle=s.major=r,t){let t=s.major,e=1e-5*(this.scale_max-this.scale_min);return t[0]>this.scale_min+e&&t.unshift(this.scale_min),t[t.length-1]1&&(!this.log||10===this.logbase)&&!this.fixed_ticks){s.minor=s.middle=this.produceTicks(s.major.length,this.nticks2);let t=Math.abs(this.func.range()[1]-this.func.range()[0]);s.middle.length<=s.major.length||s.middle.length>t/3.5?s.minor=s.middle=s.major:this.nticks3>1&&!this.log&&(s.minor=this.produceTicks(s.middle.length,this.nticks3),(s.minor.length<=s.middle.length||s.minor.length>t/1.7)&&(s.minor=s.middle))}if(s.reset=function(){this.nminor=this.nmiddle=this.nmajor=0},s.next=function(t){return!(this.nminor>=this.minor.length)&&(this.tick=this.minor[this.nminor++],this.grpos=this.func(this.tick),t&&(this.grpos=Math.round(this.grpos)),this.kind=3,this.nmiddle=this.major.length?null:this.func(this.major[this.nmajor])},this.order=0,this.ndig=0,"normal"==this.kind&&!this.log&&s.major.length>0){let t=0,i=0,r=!1;if(!e){let e=Math.max(Math.abs(s.major[0]),Math.abs(s.major[s.major.length-1])),n=Math.min(Math.abs(s.major[0]),Math.abs(s.major[s.major.length-1])),a=e>0?3*Math.round(Math.log10(e)/3):0,o=n>0?3*Math.round(Math.log10(n)/3):0;r=e<2e4,(e||n)&&(t=Math.max(a,o)+3,i=Math.min(a,o)-3)}let a=0,o=this.ndig,l=1e10;for(let e=i;e<=t;e+=3){if(r&&3===e)continue;this.order=e,this.ndig=0;let t=[],i=0,n=0;for(;i15)break;t=[],i=0,n=0}}!e&&this.ndig<4&&(n-=2*s.major.length+3),n{i.sourceEvent.preventDefault(),i.sourceEvent.stopPropagation();let l=t.node().getBBox(),m=e?l.height:l.width;o=s=t.property("shift_x"),h=a=t.property("shift_y"),c=e?s>0:a>0,d=e?[r,r/2,0]:[0,r/2,r];let p=e?-m/2:m/2;"middle"==this.title_align?(d[0]+=p,d[2]-=p):"begin"==this.title_align?(d[1]-=p,d[2]-=2*p):(d[0]+=2*p,d[1]+=p),u=this.titleCenter?1:n^this.titleOpposite?0:2,d[u]=e?a:s,f=t.append("rect").classed("zoom",!0).attr("x",l.x).attr("y",l.y).attr("width",l.width).attr("height",l.height).style("cursor","move")})).on("drag",(i=>{if(!f)return;i.sourceEvent.preventDefault(),i.sourceEvent.stopPropagation(),s+=i.dx,a+=i.dy;let n,r,l=0,m=e?a:s;for(let t=1;t<3;++t)Math.abs(m-d[t])0:r>0)&&(o=n,h=r,u=l,t.attr("transform",`translate(${o},${h})`))})).on("end",(n=>{if(!f)return;n.sourceEvent.preventDefault(),n.sourceEvent.stopPropagation(),t.property("shift_x",o).property("shift_y",h);let r=this.getObject(),s=EA;const a=(t,e)=>{r.TestBit(t)!=e&&r.InvertBit(t)};this.titleOffset=(e?o:h)/i,r.fTitleOffset=this.titleOffset/this.titleSize,1==u?(a(s.kCenterTitle,!0),this.titleCenter=!0,a(s.kOppositeTitle,!1),this.titleOpposite=!1):0==u?(a(s.kCenterTitle,!1),this.titleCenter=!1,a(s.kOppositeTitle,!0),this.titleOpposite=!0):(a(s.kCenterTitle,!1),this.titleCenter=!1,a(s.kOppositeTitle,!1),this.titleOpposite=!1),f.remove(),f=null})),t.style("cursor","move").call(m)}produceTicksPath(t,e,i,n,r,s){let a="",o="";for(this.ticks=[];t.next(!0);){let s=Math.round(i/4),l=0;t.kind<3&&(s=Math.round(i/2)),1==t.kind&&(null!==this.format(t.tick,!0)&&(s=i),this.ticks.push(t.grpos)),n>0?l=-s:e<0&&(l=-s,s=0),a+=this.vertical?`M${s},${t.grpos}H${l}`:`M${t.grpos},${-s}V${-l}`,r&&(o+=this.vertical?`M${r-s},${t.grpos}H${r-l}`:`M${t.grpos},${r+s}V${r+l}`)}return s?a+o:""}findLabelModifier(t,e,i){if(!t.fModLabs)return null;for(let n=0;n20&&e>c-o&&(f=Math.min(f,(c-o)/e));f>1e-4&&f<.7&&!t.vertical&&!u&&m>5&&1==g.length&&(x=!0);let i=f*(x?3:1);i>1e-4&&i<1&&(p=1/i,t.scaleTextDrawing(p,g[0]))}this.lbls_both_sides&&g.push(t.append("svg:g").attr("class","axis_labels").attr("transform",this.vertical?`translate(${i})`:`translate(0,${-n})`));for(let t=0;t0&&(s=-s);let r=0,c=this.vertical?-o*s:(o+2)*s+h*l;this.startTextDrawing(a,"font",g[t]);for(let o=0;o<_.length;++o){let l=this.format(_[o],!0);if(null===l)continue;let h=this.findLabelModifier(e,o,_.length);if(0===h?.fTextSize)continue;h?.fLabText&&(l=h.fLabText);let p={text:l,color:a.color,latex:1,draw_g:g[t],normal_side:0==t},x=Math.round(this.func(_[o]));if(h&&h.fTextColor>0&&(p.color=this.getColor(h.fTextColor)),p.gap_before=o>0?Math.abs(Math.round(x-this.func(_[o-1]))):0,p.gap_after=o<_.length-1?Math.abs(Math.round(this.func(_[o+1])-x)):0,d){let t=p.gap_after||p.gap_before;if(x=Math.round(x-(this.vertical?.5*t:-.5*t)),x<-5||x>(this.vertical?n:i)+5)continue}if(m=Math.max(m,l.length),this.vertical?(p.x=c,p.y=x,p.align=u?s<0?23:20:s<0?12:32):(p.x=x,p.y=c,p.align=u?s<0?12:32:s<0?20:23),u&&(p.rotate=270),0==t&&(p.post_process=A),this.drawText(p),r&&x!=r&&(this.vertical&&!u||!this.vertical&&u)){let t=Math.abs(x-r);f=Math.min(f,.9*t/a.size)}r=x}this.order&&this.drawText({color:a.color,x:this.vertical?5*s:i+5,y:this.has_obstacle?c:this.vertical?-3:-3*s,align:this.vertical?s<0?30:10:this.has_obstacle^s<0?13:10,latex:1,text:"#times"+this.formatExp(10,this.order),draw_g:g[t]})}return this.finishTextDrawing(g[0],!0).then((()=>{if(g.length>1)return p&&this.scaleTextDrawing(p,g[1]),this.finishTextDrawing(g[1],!0)})).then((()=>(x&&g[0].selectAll("text").each((function(){let t=$i(this),e=t.attr("transform");t.attr("transform",e+" rotate(25)").style("text-anchor","start")})),y)))}extractDrawAttributes(t,e,i){let n,r=this.getObject(),s="TGaxis"===r?._typename,a=this.getPadPainter(),o=a?.getPadWidth()||10,l=a?.getPadHeight()||10,h=0,c=0;if(this.scalingSize=t||Math.max(Math.min(o,l),10),s){let s=r.fChopt.indexOf("S")>=0;this.optionUnlab=r.fChopt.indexOf("U")>=0,this.optionMinus=r.fChopt.indexOf("-")>=0||r.TestBit(EA.kTickMinus),this.optionPlus=r.fChopt.indexOf("+")>=0||r.TestBit(EA.kTickPlus),this.optionNoopt=r.fChopt.indexOf("N")>=0,this.optionInt=r.fChopt.indexOf("I")>=0,this.createAttLine({attr:r}),c=t||(this.vertical?1.7*i:.6*e),h=s?r.fTickSize:.03,n=this.getColor(r.fTextColor)}else this.optionUnlab=!1,this.optionMinus=this.vertical^this.invert_side,this.optionPlus=!this.optionMinus,this.optionNoopt=!1,this.optionInt=!1,this.createAttLine({color:r.fAxisColor,width:1,style:1}),c=t||(this.vertical?o:l),h=r.fTickLength,n=this.getColor(r.fTitleColor);this.optionNoexp=r.TestBit(EA.kNoExponent),this.ticksSize=Math.round(h*c),t&&this.ticksSize<0&&(this.ticksSize=-this.ticksSize),this.maxTickSize&&this.ticksSize>this.maxTickSize&&(this.ticksSize=this.maxTickSize),this.ticksColor=this.lineatt.color,this.ticksWidth=this.lineatt.width,this.labelSize=Math.round(r.fLabelSize<1?r.fLabelSize*this.scalingSize:r.fLabelSize),this.labelsOffset=Math.round(Math.abs(r.fLabelOffset)*this.scalingSize),this.labelsFont=new Rl(r.fLabelFont,this.labelSize,t),(this.labelSize<=0||Math.abs(r.fLabelOffset)>1.1)&&(this.optionUnlab=!0),this.labelsFont.setColor(this.getColor(r.fLabelColor)),this.fTitle=r.fTitle,this.fTitle?(this.titleSize=r.fTitleSize>=1?r.fTitleSize:Math.round(r.fTitleSize*this.scalingSize),this.titleFont=new Rl(r.fTitleFont,this.titleSize,t),this.titleFont.setColor(n),this.titleOffset=r.fTitleOffset*this.titleSize,this.titleCenter=r.TestBit(EA.kCenterTitle),this.titleOpposite=r.TestBit(EA.kOppositeTitle)):(delete this.titleSize,delete this.titleFont,delete this.titleOffset,delete this.titleCenter,delete this.titleOpposite)}async drawAxis(t,e,i,n,r,s,a,o){let h=this.getObject(),c="TGaxis"===h?._typename,d=t,u=!0,f=this.getPadPainter(),m=f?.getPadWidth()||10,p=f?.getPadHeight()||10,_=this.swap_side||!1;r?this.invert_side&&(r=-r):r=0,this.extractDrawAttributes(void 0,e,i),c&&(u=0!=h.fLineColor),this.lineatt.not_standard=!0,c&&"zaxis"!==this.name||(d=t.select("."+this.name+"_container"),d.empty()?d=t.append("svg:g").attr("class",this.name+"_container"):d.selectAll("*").remove());let x="";u&&(x="M0,0"+(this.vertical?`v${i}`:`h${e}`),r&&(x+=this.vertical?`M${r},0v${i}`:`M0,${r}h${e}`)),d.attr("transform",n||null);let y=1,A=0;this.optionPlus&&this.optionMinus?(y=1,A=1):this.optionMinus?y=_^this.vertical?1:-1:this.optionPlus&&(y=_^this.vertical?-1:1);const v=this.createTicks(!1,this.optionNoexp,this.optionNoopt,this.optionInt);x+=this.produceTicksPath(v,y,this.ticksSize,A,r,u&&!s&&!this.disable_ticks),s||!x||this.lineatt.empty()||d.append("svg:path").attr("d",x).call(this.lineatt.func);let b=0,w=0,M=null,T=null,S=0;return(s||this.optionUnlab?Promise.resolve(0):this.drawLabels(d,h,e,i,v,y,this.labelsFont,this.labelsOffset,this.ticksSize,A,a)).then((t=>{if(S=t,g.Zooming&&!this.disable_zooming&&!l()){let t=Math.max(this.labelsFont.size,5),n=d.append("svg:rect").attr("class","axis_zoom").style("opacity","0").style("cursor","crosshair");if(this.vertical){let e=(S||2*t)+3;n.attr("x",y>0?-e:0).attr("y",0).attr("width",e).attr("height",i)}else n.attr("x",0).attr("y",y>0?0:-t-3).attr("width",e).attr("height",t+3)}if(this.position=0,o){let t=d.node(),e=this.getPadSvg().node();if(t&&e&&t.getBoundingClientRect&&e.getBoundingClientRect){let i=t.getBoundingClientRect(),n=e.getBoundingClientRect();this.position=i.left-n.left}t&&!e&&console.warn("Why PAD element missing when search for position")}if(!this.fTitle||s)return!0;M=d.append("svg:g").attr("class","axis_title");let n=1.6/this.scalingSize,r=h.TestBit(EA.kRotateTitle)?-1:1;this.startTextDrawing(this.titleFont,"font",M);let a=_^this.titleOpposite,u=r<0^a;if(this.title_align=this.titleCenter?"middle":u?"begin":"end",this.vertical){if(n*=-y*m,b=Math.round(n*this.titleOffset),"zaxis"==this.name&&c&&"getBoundingClientRect"in d.node()){let t=d.node().getBoundingClientRect();b{if(M){if(T){let t=M.node().getBoundingClientRect();b=T.left!=T.right&&t.left!=t.right?y>0?Math.round(T.left-t.right-.3*this.titleFont.size):Math.round(T.right-t.left+.3*this.titleFont.size):-1*Math.round((y>0?this.labelsOffset+S:0)+.7*this.titleFont.size)}M.attr("transform",`translate(${b},${w})`).property("shift_x",b).property("shift_y",w)}return this}))}convertTo(t){let e=this.getObject(),i=this.axisToSvg("x",e.fX1),n=this.axisToSvg("y",e.fY1),r=this.axisToSvg("x",e.fX2),s=this.axisToSvg("y",e.fY2);if("ndc"==t){let t=this.getPadPainter().getPadWidth(),a=this.getPadPainter().getPadHeight();e.fX1=i/t,e.fX2=r/t,e.fY1=(a-n)/a,e.fY2=(a-s)/a,this.use_ndc=!0}else if("frame"==t){let t=this.getFramePainter().getFrameRect();e.fX1=(i-t.x)/t.width,e.fX2=(r-t.x)/t.width,e.fY1=(n-t.y)/t.height,e.fY2=(s-t.y)/t.height,this.bind_frame=!0}}redraw(){let t,e,i,n,r=this.getObject();if(this.bind_frame){let s=this.getFramePainter().getFrameRect();t=Math.round(s.x+r.fX1*s.width),i=Math.round(s.x+r.fX2*s.width),e=Math.round(s.y+r.fY1*s.height),n=Math.round(s.y+r.fY2*s.height)}else t=this.axisToSvg("x",r.fX1,this.use_ndc),e=this.axisToSvg("y",r.fY1,this.use_ndc),i=this.axisToSvg("x",r.fX2,this.use_ndc),n=this.axisToSvg("y",r.fY2,this.use_ndc);let s=i-t,a=e-n,o=Math.abs(s)=0,log:r.fChopt.indexOf("G")>=0?1:0,reverse:h,swap_side:h}),this.createG(),this.drawAxis(this.getG(),Math.abs(s),Math.abs(a),`translate(${t},${n})`)}}const DA=11102230246251565e-32,OA=-708.3964185322641,LA=709.782712893384,RA=108.11685576785767,BA=4503599627370496,FA=2220446049250313e-31,NA=1.4142135623730951,IA=3.141592653589793;function jA(t,e,i){if(0==i)return e[0];let n=e[0];for(let r=1;r<=i;++r)n=n*t+e[r];return n}function qA(t,e,i){if(0==i)return e[0];let n=t+e[0];for(let r=1;r=Number.MAX_VALUE||t==Number.POSITIVE_INFINITY)return Number.POSITIVE_INFINITY;if(t<-34)return i=-t,r=UA(i),e=Math.floor(i),e==i?Number.POSITIVE_INFINITY:(s=i-e,s>.5&&(e+=1,s=e-i),s=i*Math.sin(Math.PI*s),s<1e-300?Number.POSITIVE_INFINITY:(s=Math.log(Math.PI)-Math.log(s)-r,s));if(t<13){for(s=1,e=0,n=t;n>=3;)e-=1,n=t+e,s*=n;for(;n<2;){if(n<1e-300)return Number.POSITIVE_INFINITY;s/=n,e+=1,n=t+e}return s<0&&(s=-s),2==n?Math.log(s):(e-=2,e=(t+=e)*jA(t,a,5)/qA(t,o,6),Math.log(s)+e)}return t>2556348e299?Number.POSITIVE_INFINITY:(i=(t-.5)*Math.log(t)-t+.9189385332046728,t>1e8||(e=1/(t*t),i+=t>=1e3?((.0007936507936507937*e-.002777777777777778)*e+.08333333333333333)/t:jA(e,[.0008116141674705085,-.0005950619042843014,.0007936503404577169,-.002777777777300997,.08333333333333319],4)/t),i)}function GA(t){let e,i,n;const r=Math.sqrt(2*Math.PI);return i=1/t,i=1+i*jA(i,[.0007873113957930937,-.00022954996161337813,-.0026813261780578124,.0034722222160545866,.08333333333334822],4),e=Math.exp(t),t>RA?(n=Math.pow(t,.5*t-.25),e=n*(n/e)):e=Math.pow(t,t-.5)/e,e=r*e*i,e}function HA(t){const e=[2.461969814735305e-10,.5641895648310689,7.463210564422699,48.63719709856814,196.5208329560771,526.4451949954773,934.5285271719576,1027.5518868951572,557.5353353693994],i=[13.228195115474499,86.70721408859897,354.9377788878199,975.7085017432055,1823.9091668790973,2246.3376081871097,1656.6630919416134,557.5353408177277],n=[.5641895835477551,1.275366707599781,5.019050422511805,6.160210979930536,7.4097426995044895,2.9788666537210022],r=[2.2605286322011726,9.396035249380015,12.048953980809666,17.08144507475659,9.608968090632859,3.369076451000815];let s,a,o,l,h;return o=t<0?-t:t,o<1?1-XA(t):(h=-t*t,h<-LA?t<0?2:0:(h=Math.exp(h),o<8?(s=jA(o,e,8),a=qA(o,i,8)):(s=jA(o,n,5),a=qA(o,r,6)),l=h*s/a,t<0&&(l=2-l),0==l?t<0?2:0:l))}function XA(t){if(Math.abs(t)>1)return 1-HA(t);let e=t*t;return t*jA(e,[9.604973739870516,90.02601972038427,2232.005345946843,7003.325141128051,55592.30130103949],4)/qA(e,[33.56171416475031,521.3579497801527,4594.323829709801,22629.000061389095,49267.39426086359],5)}function $A(t,e,i=0){let n=(t-i)/(e*NA);return n>1?.5*HA(n):.5*(1-XA(n))}function VA(t,e,i=0){let n=(t-i)/(e*NA);return n<-1?HA(-n):.5*(1+XA(n))}function YA(t,e,i,n=0){if(t-n<=0)return 0;let r=(Math.log(t-n)-e)/i;return 1/((t-n)*Math.abs(i)*Math.sqrt(2*IA))*Math.exp(-r*r/2)}function WA(t){let e,i,n,r,s=1;if(t>=Number.MAX_VALUE)return t;if(i=Math.abs(t),i>33){if(t<0){if(e=Math.floor(i),e==i)return Number.POSITIVE_INFINITY;if(r=Math.round(e),0==(1&r)&&(s=-1),n=i-e,n>.5&&(e+=1,n=i-e),n=i*Math.sin(Math.PI*n),0==n)return s>0?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;n=Math.abs(n),n=Math.PI/(n*GA(i))}else n=GA(t);return s*n}for(n=1;t>=3;)n*=t-=1;let a=!1;for(;t<0&&!a;)t>-1e-9?a=!0:(n/=t,t+=1);for(;t<2&&!a;)t<1e-9?a=!0:(n/=t,t+=1);if(a)return 0==t?Number.POSITIVE_INFINITY:n/((1+.5772156649015329*t)*t);if(2==t)return n;return e=jA(t-=2,[.00016011952247675185,.0011913514700658638,.010421379756176158,.04763678004571372,.20744822764843598,.4942148268014971,1],6),i=jA(t,[-23158187332412014e-21,.0005396055804933034,-.004456419138517973,.011813978522206043,.035823639860549865,-.23459179571824335,.0714304917030273,1],7),n*e/i}function ZA(t){if(t<=0)return Number.NEGATIVE_INFINITY;if(t>=1)return Number.POSITIVE_INFINITY;const e=[1.9544885833814176,4.676279128988815,86.36024213908905,-225.46268785411937,200.26021238006066,-82.03722561683334,15.90562251262117,-1.1833162112133],i=.1353352832366127;let n,r,s,a,o,l=1,h=t;return h>1-i&&(h=1-h,l=0),h>i?(h-=.5,s=h*h,n=h+h*(s*jA(s,[-59.96335010141079,98.00107541859997,-56.67628574690703,13.931260938727968,-1.2391658386738125],4)/qA(s,e,8)),n*=2.5066282746310007,n):(n=Math.sqrt(-2*Math.log(h)),a=n-Math.log(n)/n,r=1/n,o=n<8?r*jA(r,[4.0554489230596245,31.525109459989388,57.16281922464213,44.08050738932008,14.684956192885803,2.1866330685079025,-.1402560791713545,-.03504246268278482,-.0008574567851546854],8)/qA(r,[15.779988325646675,45.39076351288792,41.3172038254672,15.04253856929075,2.504649462083094,-.14218292285478779,-.03808064076915783,-.0009332594808954574],8):r*jA(r,[3.2377489177694603,6.915228890689842,3.9388102529247444,1.3330346081580755,.20148538954917908,.012371663481782003,.00030158155350823543,26580697468673755e-22,6.239745391849833e-9],8)/qA(r,[6.02427039364742,3.6798356385616087,1.3770209948908132,.21623699359449663,.013420400608854318,.00032801446468212774,28924786474538068e-22,6.790194080099813e-9],8),n=a-o,0!=l&&(n=-n),n)}function QA(t,e){return e*ZA(t)}function JA(t,e){if(t<=0)return 0;if(e<=0)return 1;if(e<1||eBA&&(d*=FA,f*=FA,u*=FA,m*=FA)}while(s>DA);return p*i}function KA(t,e){if(t<=0)return 1;if(e<=0)return 0;if(e>1&&e>t)return 1-JA(t,e);let i=t*Math.log(e)-e-UA(t);if(i<-LA)return 0;i=Math.exp(i);let n=t,r=1,s=1;do{n+=1,r*=e/n,s+=r}while(r/s>DA);return s*i/t}function tv(t,e){if(t<=0)return console.error("igami : Wrong domain for parameter a (must be > 0)"),0;if(e<=0)return Number.POSITIVE_INFINITY;if(e>=1)return 0;const i=Number.MAX_VALUE;let n,r,s,a,o,l,h=i,c=0,d=0,u=1,f=5*DA;for(s=1/(9*t),r=1-s-ZA(e)*Math.sqrt(s),n=t*r*r*r,a=UA(t),o=0;o<10&&!(n>h||nu))&&(r=e?(c=n,u=r,l<0?(l=0,s=.5):s=l>1?.5*s+.5:(e-d)/(u-d),l+=1):(h=n,d=r,l>0?(l=0,s=.5):l<-1?s*=.5:s=(e-d)/(u-d),l-=1);return n}function ev(t,e,i){if(void 0===i&&(i=0),e<=0)return 0;const n=(t-i)/e;let r,s,a,o;const l=[.4259894875,-.124976255,.039842437,-.006298287635,.001511162253],h=[1,-.3388260629,.09594393323,-.01608042283,.003778942063],c=[.1788541609,.1173957403,.01488850518,-.001394989411,.0001283617211],d=[1,.7428795082,.3153932961,.06694219548,.008790609714],u=[.1788544503,.09359161662,.006325387654,6611667319e-14,-2031049101e-15],f=[1,.6097809921,.2560616665,.04746722384,.006957301675],m=[.9874054407,118.6723273,849.279436,-743.7792444,427.0262186],p=[1,106.8615961,337.6496214,2016.712389,1597.063511],g=[1.003675074,167.5702434,4789.711289,21217.86767,-22324.9491],_=[1,156.9424537,3745.310488,9834.698876,66924.28357],x=[1.000827619,664.9143136,62972.92665,475554.6998,-5743609.109],y=[1,651.4101098,56974.73333,165917.4725,-2815759.939],A=[.04166666667,-.01996527778,.02709538966],v=[-1.84556867,-4.284640743];if(n<-5.5){if(r=Math.exp(n+1),r<1e-10)return 0;s=Math.exp(-1/r),a=Math.sqrt(r),o=s/a*.3989422803*(1+(A[0]+(A[1]+A[2]*r)*r)*r)}else n<-1?(r=Math.exp(-n-1),o=Math.exp(-r)*Math.sqrt(r)*(l[0]+(l[1]+(l[2]+(l[3]+l[4]*n)*n)*n)*n)/(h[0]+(h[1]+(h[2]+(h[3]+h[4]*n)*n)*n)*n)):n<1?o=(c[0]+(c[1]+(c[2]+(c[3]+c[4]*n)*n)*n)*n)/(d[0]+(d[1]+(d[2]+(d[3]+d[4]*n)*n)*n)*n):n<5?o=(u[0]+(u[1]+(u[2]+(u[3]+u[4]*n)*n)*n)*n)/(f[0]+(f[1]+(f[2]+(f[3]+f[4]*n)*n)*n)*n):n<12?(r=1/n,o=r*r*(m[0]+(m[1]+(m[2]+(m[3]+m[4]*r)*r)*r)*r)/(p[0]+(p[1]+(p[2]+(p[3]+p[4]*r)*r)*r)*r)):n<50?(r=1/n,o=r*r*(g[0]+(g[1]+(g[2]+(g[3]+g[4]*r)*r)*r)*r)/(_[0]+(_[1]+(_[2]+(_[3]+_[4]*r)*r)*r)*r)):n<300?(r=1/n,o=r*r*(x[0]+(x[1]+(x[2]+(x[3]+x[4]*r)*r)*r)*r)/(y[0]+(y[1]+(y[2]+(y[3]+y[4]*r)*r)*r)*r)):(r=1/(n-n*Math.log(n)/(n+1)),o=r*r*(1+(v[0]+v[1]*r)*r));return o/e}function iv(t,e,i,n){if(i<=0)return 0;const r=ev((t-e)/i,1,0);return n?r/i:r}function nv(t,e){return JA(t,e)}function rv(t,e){return KA(t,e)}function sv(t){return UA(t)}function av(t,e,i){if(t<0||t>1)return 0;if(0==t){if(e<1)return Number.POSITIVE_INFINITY;if(e>1)return 0;if(1==e)return i}if(1==t){if(i<1)return Number.POSITIVE_INFINITY;if(i>1)return 0;if(1==i)return e}return Math.exp(sv(e+i)-sv(e)-sv(i)+Math.log(t)*(e-1)+Math.log1p(-t)*(i-1))}function ov(t,e,i){return void 0===i&&(i=0),nv(.5*e,.5*(t-i))}function lv(t,e,i){let n,r,s,a,o,l,h,c;for(c=1/t,s=(1-e)*i,a=s/(t+1),l=a,r=s,o=2,n=0,h=DA*c;Math.abs(a)>h;)s=(o-e)*i/o,r*=s,a=r/(t+o),n+=a,o+=1;return n+=l,n+=c,s=t*Math.log(i),t+e=1?1:(c=0,l=1-i,i>t/(t+e)?(c=1,n=e,r=t,o=i,a=l):(n=t,r=e,o=l,a=i),1==c&&r*a<=1&&a<=.95?s=lv(n,r,a):(h=a*(n+r-2)-(n-1),l=h<0?function(t,e,i){let n,r,s,a,o,l,h,c,d,u,f,m,p,g,_,x,y,A,v,b;c=t,d=t+e,u=t,f=t+1,m=1,p=e-1,g=f,_=t+2,a=0,h=1,s=1,l=1,A=1,x=1,b=0,v=3*DA;do{if(n=-i*c*d/(u*f),r=s+a*n,o=l+h*n,a=s,s=r,h=l,l=o,n=i*m*p/(g*_),r=s+a*n,o=l+h*n,a=s,s=r,h=l,l=o,0!=o&&(x=r/o),0!=x?(y=Math.abs((A-x)/x),A=x):y=1,y<33306690738754696e-32)break;c+=1,d+=1,u+=2,f+=2,m+=1,p-=1,g+=2,_+=2,Math.abs(o)+Math.abs(r)>BA&&(a*=FA,s*=FA,h*=FA,l*=FA),(Math.abs(o)BA&&(a*=FA,s*=FA,h*=FA,l*=FA),(Math.abs(o)(y&&(l=l<=DA?1-DA:1-l),l);if(x=0,i<=0)return 0;if(i>=1)return 1;if(h=0,p=0,c=1,g=1,v=0,t<=1||e<=1)m=1e-6,y=0,n=t,r=e,s=i,l=n/(n+r),o=hv(n,r,l);else{if(m=1e-4,u=-ZA(i),i>.5?(y=1,n=e,r=t,s=1-i,u=-u):(y=0,n=t,r=e,s=i),d=(u*u-3)/6,l=2/(1/(2*n-1)+1/(2*r-1)),a=u*Math.sqrt(l+d)/l-(1/(2*r-1)-1/(2*n-1))*(d+5/6-2/(3*l)),a*=2,a0;){for(;b;){for(A=0,f=.5,x=0;x<100;x++){if(0!=x){if(l=h+f*(c-h),1==l&&(l=1-DA),0==l&&(f=.5,l=h+f*(c-h),0==l))return w();if(o=hv(n,r,l),u=(c-h)/(c+h),Math.abs(u)3?1-(1-f)*(1-f):A>1?.5*f+.5:(s-o)/(g-p),A+=1,h>.75){1==y?(y=0,n=t,r=e,s=i):(y=1,n=e,r=t,s=1-i),l=1-l,o=hv(n,r,l),h=0,p=0,c=1,g=1;continue}}else{if(c=l,1==y&&c0?(A=0,f=.5):A<-3?f*=f:A<-1?f*=.5:f=(o-s)/(g-p),A-=1}}if(h>=1)return l=1-DA,w();if(l<=0)return l=0,w();break}if(b=!0,v)return w();for(v=1,d=UA(n+r)-UA(n)-UA(r),x=0;x<8&&(0!=x&&(o=hv(n,r,l)),og?(l=c,o=g):oLA)break;if(a=Math.exp(a),a=(o-s)/a,_=l-a,_<=h&&(o=(l-h)/(c-h),_=h+.5*o*(l-h),_<=0))break;if(_>=c&&(o=(c-l)/(c-h),_=c-.5*o*(c-l),_>=1))break;if(l=_,Math.abs(a/l)<128*DA)return w()}m=256*DA}return w()}function dv(t,e,i){return hv(e,i,t)}const uv=dv;function fv(t,e,i){return cv(e,i,t)}function mv(t,e,i){return dv(1-t,i,e)}function pv(t,e,i,n=0){return t-n<0?0:t-n==0?1==e?1/i:0:1==e?Math.exp(-(t-n)/i)/i:Math.exp((e-1)*Math.log((t-n)/i)-(t-n)/i-sv(e))/i}function gv(t,e,i,n=0){return e<0||i<0?Number.NaN:t-n<0?0:Math.exp(e/2*Math.log(e)+i/2*Math.log(i)+sv((e+i)/2)-sv(e/2)-sv(i/2)+(e/2-1)*Math.log(t-n)-(e+i)/2*Math.log(i+e*(t-n)))}function _v(t,e,i,n=0){if(e<0||i<0)return Number.NaN;return i/(i+e*(t-n))>.9&&e>1&&i>1?1-xv(t,e,i,n):dv(i/(i+e*(t-n)),.5*i,.5*e)}function xv(t,e,i,n=0){if(e<0||i<0)return Number.NaN;let r=e*(t-n)/(i+e*(t-n));return r>.9&&e>1&&i>1?1-_v(t,e,i,n):dv(r,.5*e,.5*i)}function yv(t,e){return e<=0?0:t<=0?t<0?0:1:ov(t,e,0)}function Av(t,e){return Math.exp(sv(t)+sv(e)-sv(t+e))}function vv(t,e,i){return t.GetParValue(i+0)*Math.exp(-.5*Math.pow((e-t.GetParValue(i+1))/t.GetParValue(i+2),2))}function bv(t,e,i,n,r=0){if(n<0)return 0;let s=(t-r)/n;e<0&&(s=-s);let a=Math.abs(e);if(s>-a)return Math.exp(-.5*s*s);let o=i/a,l=o/(o-a-s);return Math.exp(-.5*a*a)*Math.pow(l,i)}function wv(t,e,i,n,r=0){if(0==n)return 0;if(0==e)return 0;let s=1==i,a=(t-r)/n;e<0&&(a=-a);let o=Math.abs(e),l=0,h=0;const c=Math.sqrt(IA/2),d=Math.sqrt(2*IA),u=1/Math.sqrt(2);if(a<=-o){let t=Math.pow(i/o,i)*Math.exp(-.5*e*e),n=i/o-o;if(s)h=-t*Math.log(i/o)+t*Math.log(n-a);else{h=i/o*(1/(i-1))*Math.exp(-e*e/2)-t/(i-1)*Math.pow(n-a,1-i)}l=c*(1+XA(o*u))}else l=$A(a,1),l*=d,h=0;return n*(l+h)}function Mv(t,e,i){let n=0,r=0,s=2*e;for(let e=t;e>=1;e--){let t=n;n=s*n-r+i[e],r=t}return e*n-r+i[0]}function Tv(t,e,i,n){let r=(1-i)/2;return n?e==t?1:fv(1-r,e+1,t-e):0==e?0:fv(r,e,t-e+1)}function Sv(t,e,i,n){if(0==t)return n?1:0;let r=e/t,s=QA(1-(1-i)/2,Math.sqrt(r*(1-r)/t));return n?r+s>1?1:r+s:r-s<0?0:r-s}function Cv(t,e,i,n){if(0==t)return n?1:0;let r=e/t,s=QA(1-(1-i)/2,1),a=(e+.5*s*s)/(t+s*s),o=s/(t+s*s)*Math.sqrt(t*r*(1-r)+s*s/4);return n?a+o>1?1:a+o:a-o<0?0:a-o}function Ev(t,e,i,n){let r=QA(1-(1-i)/2,1),s=(e+.5*r*r)/(t+r*r),a=r*Math.sqrt(s*(1-s)/(t+r*r));return n?s+a>1?1:s+a:s-a<0?0:s-a}function Pv(t,e,i,n){const r=(1-i)/2;let s=0,a=1,o=0;if(e>0&&e<1){let r=Pv(t,0,i,n);return o=(Pv(t,1,i,n)-r)*e+r,o}for(;Math.abs(a-s)>1e-9;){o=(s+a)/2;let i=.5*av(o,e+1,t-e+1)/(t+1);e-1>=0&&(i+=mv(o,e,t-e+1)),i>(n?r:1-r)?s=o:a=o}return o}function kv(t,e,i,n,r,s){let a=e+r,o=t-e+s;return n?a>0&&o>0?fv((1+i)/2,a,o):1:a>0&&o>0?fv((1-i)/2,a,o):0}function zv(t,e){if(e)return kv;switch(t){case 0:return Tv;case 1:return Sv;case 2:return Cv;case 3:return Ev;case 4:return console.log("Feldman-Cousins interval kFFC not supported; using kFCP"),Tv;case 8:return Pv}return console.log(`Not recognized stat option ${t}, using kFCP`),Tv}var Dv=Object.freeze({__proto__:null,gamma:WA,tgamma:WA,Gamma:WA,Polynomialeval:jA,Polynomial1eval:qA,stirf:GA,gamma_pdf:pv,ndtri:ZA,normal_quantile:QA,normal_quantile_c:function(t,e){return-e*ZA(t)},lognormal_cdf_c:function(t,e,i,n){void 0===n&&(n=0);let r=(Math.log(t-n)-e)/(i*NA);return r>1?.5*HA(r):.5*(1-XA(r))},lognormal_cdf:function(t,e,i,n=0){let r=(Math.log(t-n)-e)/(i*NA);return r<-1?.5*HA(-r):.5*(1+XA(r))},igami:tv,igamc:JA,igam:KA,lgam:UA,lgamma:sv,erfc:HA,erf:XA,beta_pdf:av,inc_beta:dv,BetaIncomplete:uv,pseries:lv,incbet:hv,incbi:cv,beta_quantile:fv,chisquared_cdf_c:ov,beta:function(t,e){return Math.exp(sv(t)+sv(e)-sv(t+e))},inc_gamma:rv,inc_gamma_c:nv,landau_pdf:ev,beta_cdf_c:mv,Landau:iv,fdistribution_pdf:gv,FDist:gv,fdistribution_cdf:xv,FDistI:xv,fdistribution_cdf_c:_v,normal_cdf_c:$A,gaussian_cdf_c:$A,normal_cdf:VA,gaussian_cdf:VA,lognormal_pdf:YA,normal_pdf:function(t,e=1,i=0){let n=(t-i)/e;return 1/(Math.sqrt(2*IA)*Math.abs(e))*Math.exp(-n*n/2)},crystalball_function:bv,crystalball_pdf:function(t,e,i,n,r=0){if(n<0)return 0;if(i<=1)return Number.NaN;let s=Math.abs(e);return 1/(n*(i/s*1/(i-1)*Math.exp(-e*e/2)+Math.sqrt(IA/2)*(1+XA(s/Math.sqrt(2)))))*bv(t,e,i,n,r)},crystalball_cdf:function(t,e,i,n,r=0){if(i<=1)return Number.NaN;let s=Math.abs(e),a=n*(i/s*1/(i-1)*Math.exp(-e*e/2)+Math.sqrt(IA/2)*(1+XA(s/Math.sqrt(2)))),o=wv(t,e,i,n,r);return e>0?1-o/a:o/a},crystalball_cdf_c:function(t,e,i,n,r=0){if(i<=1)return Number.NaN;let s=Math.abs(e),a=n*(i/s*1/(i-1)*Math.exp(-e*e/2)+Math.sqrt(IA/2)*(1+XA(s/Math.sqrt(2)))),o=wv(t,e,i,n,r);return e>0?o/a:1-o/a},chisquared_cdf:function(t,e,i=0){return rv(.5*e,.5*(t-i))},gamma_quantile_c:function(t,e,i){return i*tv(e,t)},gamma_quantile:function(t,e,i){return i*tv(e,1-t)},breitwigner_cdf_c:function(t,e,i=0){return.5-Math.atan(2*(t-i)/e)/IA},breitwigner_cdf:function(t,e,i=0){return.5+Math.atan(2*(t-i)/e)/IA},cauchy_cdf_c:function(t,e,i=0){return.5-Math.atan((t-i)/e)/IA},cauchy_cdf:function(t,e,i=0){return.5+Math.atan((t-i)/e)/IA},cauchy_pdf:function(t,e=1,i=0){return e/(IA*((t-i)*(t-i)+e*e))},gaussian_pdf:function(t,e=1,i=0){let n=(t-i)/e;return 1/(Math.sqrt(2*IA)*Math.abs(e))*Math.exp(-n*n/2)},tdistribution_cdf_c:function(t,e,i=0){let n=t-i,r=n>0?1:-1;return.5-.5*dv(n*n/(e+n*n),.5,.5*e)*r},tdistribution_cdf:function(t,e,i=0){let n=t-i,r=n>0?1:-1;return.5+.5*dv(n*n/(e+n*n),.5,.5*e)*r},tdistribution_pdf:function(t,e,i=0){return Math.exp(sv((e+1)/2)-sv(e/2))/Math.sqrt(IA*e)*Math.pow(1+(t-i)*(t-i)/e,-(e+1)/2)},exponential_cdf_c:function(t,e,i=0){return t-i<0?1:Math.exp(-e*(t-i))},exponential_cdf:function(t,e,i=0){return t-i<0?0:-Math.expm1(-e*(t-i))},chisquared_pdf:function(t,e,i){return void 0===i&&(i=0),t-i<0?0:t==i&&0==e/2-1?.5:Math.exp((e/2-1)*Math.log((t-i)/2)-(t-i)/2-sv(e/2))/2},Beta:Av,GammaDist:function(t,e,i=0,n=1){return t0?1-.5*uv(i/(i+t*t),.5*i,.5):.5*uv(i/(i+t*t),.5*i,.5)},gaus:vv,gausn:function(t,e,i){return vv(t,e,i)/(Math.sqrt(2*Math.PI)*t.GetParValue(i+2))},gausxy:function(t,e,i,n){return t.GetParValue(n+0)*Math.exp(-.5*Math.pow((e-t.GetParValue(n+1))/t.GetParValue(n+2),2))*Math.exp(-.5*Math.pow((i-t.GetParValue(n+3))/t.GetParValue(n+4),2))},expo:function(t,e,i){return Math.exp(t.GetParValue(i+0)+t.GetParValue(i+1)*e)},Prob:yv,Gaus:function(t,e,i){return Math.exp(-.5*Math.pow((t-e)/i,2))},BreitWigner:function(t,e,i){return i/((t-e)*(t-e)+i*i/4)/2/Math.PI},BetaDist:function(t,e,i){if(t<0||t>1||e<=0||i<=0)return 0;let n=Av(e,i);return Math.pow(t,e-1)*Math.pow(1-t,i-1)/n},BetaDistI:function(t,e,i){return t<0||t>1||e<=0||i<=0?0:uv(t,e,i)},landau:function(t,e,i){return iv(e,t.GetParValue(i+1),t.GetParValue(i+2),!1)},landaun:function(t,e,i){return iv(e,t.GetParValue(i+1),t.GetParValue(i+2),!0)},ChebyshevN:Mv,Chebyshev1:function(t,e,i){return e+i*t},Chebyshev2:function(t,e,i,n){return e+i*t+n*(2*t*t-1)},Chebyshev3:function(t,...e){return Mv(3,t,e)},Chebyshev4:function(t,...e){return Mv(4,t,e)},Chebyshev5:function(t,...e){return Mv(5,t,e)},Chebyshev6:function(t,...e){return Mv(6,t,e)},Chebyshev7:function(t,...e){return Mv(7,t,e)},Chebyshev8:function(t,...e){return Mv(8,t,e)},Chebyshev9:function(t,...e){return Mv(9,t,e)},Chebyshev10:function(t,...e){return Mv(10,t,e)},getTEfficiencyBoundaryFunc:zv});function Ov(t,e){if(l()||"undefined"==typeof document)return;let i="jsroot_progressbox",n=$i("#"+i);if(!g.ProgressBox)return n.remove();0!=arguments.length&&t?(n.empty()&&(n=$i(document.body).append("div").attr("id",i).attr("style","position: fixed; min-width: 100px; height: auto; overflow: visible; z-index: 101; border: 1px solid #999; background: #F8F8F8; left: 10px; bottom: 10px;"),n.append("p")),n.property("with_timeout",!1),"string"==typeof t?n.select("p").html(t):(n.html(""),n.node().appendChild(t)),qv("#jsroot_progressbox p { font-size: 10px; margin-left: 10px; margin-right: 10px; margin-top: 3px; margin-bottom: 3px; }",n.node()),Number.isFinite(e)&&e>0&&(n.property("with_timeout",!0),setTimeout((()=>Ov("",-1)),e))):(-1!==e||!n.empty()&&n.property("with_timeout"))&&n.remove()}function Lv(){window&&(window.close(),window.open("","_self").close())}function Rv(t,e){if(!t||0==t.length)return void(e.rejectFunc&&(e.rejectFunc(Error("openui5 was not possible to load")),e.rejectFunc=null));let i=t.shift();0==i.indexOf("roothandler")&&i.indexOf("://")<0&&(i=i.replace(/\:\//g,"://"));let n=document.createElement("script");n.setAttribute("type","text/javascript"),n.setAttribute("id","sap-ui-bootstrap"),n.setAttribute("src",i+"resources/sap-ui-core.js"),n.setAttribute("data-sap-ui-libs",e.openui5libs??"sap.m, sap.ui.layout, sap.ui.unified, sap.ui.commons"),n.setAttribute("data-sap-ui-theme",e.openui5theme||"sap_belize"),n.setAttribute("data-sap-ui-compatVersion","edge"),n.setAttribute("data-sap-ui-preload","async"),n.setAttribute("data-sap-ui-evt-oninit","completeUI5Loading()"),n.onerror=function(){n.parentNode.removeChild(n),Rv(t,e)},n.onload=function(){console.log("Load openui5 from "+i)},document.head.appendChild(n)}async function Bv(e){if("object"==typeof sap)return sap;e||(e={});let i=t.source_dir.replace(/jsrootsys/g,"rootui5sys");i==t.source_dir&&(i=window.location.port&&window.location.pathname.indexOf("/win")>=0&&(!e.openui5src||"nojsroot"==e.openui5src||"jsroot"==e.openui5src)?window.location.origin+window.location.pathname+"../rootui5sys/":void 0);let n=[],r="https://openui5.hana.ondemand.com/1.98.0/",s=i?i+"distribution/":"";if("string"==typeof e.openui5src)switch(e.openui5src){case"nodefault":r="";break;case"default":n.push(r),r="";break;case"nojsroot":break;case"jsroot":n.push(s),s="";break;default:n.push(e.openui5src)}return s&&n.indexOf(s)<0&&n.push(s),r&&n.indexOf(r)<0&&n.push(r),new Promise(((r,s)=>{e.resolveFunc=r,e.rejectFunc=s,globalThis.completeUI5Loading=function(){sap.ui.loader.config({paths:{jsroot:t.source_dir,rootui5:i}}),e.resolveFunc&&(e.resolveFunc(sap),e.resolveFunc=null)},Rv(n,e)}))}const Fv={camera:{path:"M 152.00,304.00c0.00,57.438, 46.562,104.00, 104.00,104.00s 104.00-46.562, 104.00-104.00s-46.562-104.00-104.00-104.00S 152.00,246.562, 152.00,304.00z M 480.00,128.00L 368.00,128.00 c-8.00-32.00-16.00-64.00-48.00-64.00L 192.00,64.00 c-32.00,0.00-40.00,32.00-48.00,64.00L 32.00,128.00 c-17.60,0.00-32.00,14.40-32.00,32.00l0.00,288.00 c0.00,17.60, 14.40,32.00, 32.00,32.00l 448.00,0.00 c 17.60,0.00, 32.00-14.40, 32.00-32.00L 512.00,160.00 C 512.00,142.40, 497.60,128.00, 480.00,128.00z M 256.00,446.00c-78.425,0.00-142.00-63.574-142.00-142.00c0.00-78.425, 63.575-142.00, 142.00-142.00c 78.426,0.00, 142.00,63.575, 142.00,142.00 C 398.00,382.426, 334.427,446.00, 256.00,446.00z M 480.00,224.00l-64.00,0.00 l0.00-32.00 l 64.00,0.00 L 480.00,224.00 z"},disk:{path:"M384,0H128H32C14.336,0,0,14.336,0,32v448c0,17.656,14.336,32,32,32h448c17.656,0,32-14.344,32-32V96L416,0H384z M352,160 V32h32v128c0,17.664-14.344,32-32,32H160c-17.664,0-32-14.336-32-32V32h128v128H352z M96,288c0-17.656,14.336-32,32-32h256 c17.656,0,32,14.344,32,32v192H96V288z"},question:{path:"M256,512c141.375,0,256-114.625,256-256S397.375,0,256,0S0,114.625,0,256S114.625,512,256,512z M256,64 c63.719,0,128,36.484,128,118.016c0,47.453-23.531,84.516-69.891,110.016C300.672,299.422,288,314.047,288,320 c0,17.656-14.344,32-32,32c-17.664,0-32-14.344-32-32c0-40.609,37.25-71.938,59.266-84.031 C315.625,218.109,320,198.656,320,182.016C320,135.008,279.906,128,256,128c-30.812,0-64,20.227-64,64.672 c0,17.664-14.336,32-32,32s-32-14.336-32-32C128,109.086,193.953,64,256,64z M256,449.406c-18.211,0-32.961-14.75-32.961-32.969 c0-18.188,14.75-32.953,32.961-32.953c18.219,0,32.969,14.766,32.969,32.953C288.969,434.656,274.219,449.406,256,449.406z"},undo:{path:"M450.159,48.042c8.791,9.032,16.983,18.898,24.59,29.604c7.594,10.706,14.146,22.207,19.668,34.489 c5.509,12.296,9.82,25.269,12.92,38.938c3.113,13.669,4.663,27.834,4.663,42.499c0,14.256-1.511,28.863-4.532,43.822 c-3.009,14.952-7.997,30.217-14.953,45.795c-6.955,15.577-16.202,31.52-27.755,47.826s-25.88,32.9-42.942,49.807 c-5.51,5.444-11.787,11.67-18.834,18.651c-7.033,6.98-14.496,14.366-22.39,22.168c-7.88,7.802-15.955,15.825-24.187,24.069 c-8.258,8.231-16.333,16.203-24.252,23.888c-18.3,18.13-37.354,37.016-57.191,56.65l-56.84-57.445 c19.596-19.472,38.54-38.279,56.84-56.41c7.75-7.685,15.772-15.604,24.108-23.757s16.438-16.163,24.33-24.057 c7.894-7.893,15.356-15.33,22.402-22.312c7.034-6.98,13.312-13.193,18.821-18.651c22.351-22.402,39.165-44.648,50.471-66.738 c11.279-22.09,16.932-43.567,16.932-64.446c0-15.785-3.217-31.005-9.638-45.671c-6.422-14.665-16.229-28.504-29.437-41.529 c-3.282-3.282-7.358-6.395-12.217-9.325c-4.871-2.938-10.381-5.503-16.516-7.697c-6.121-2.201-12.815-3.992-20.058-5.373 c-7.242-1.374-14.9-2.064-23.002-2.064c-8.218,0-16.802,0.834-25.788,2.507c-8.961,1.674-18.053,4.429-27.222,8.271 c-9.189,3.842-18.456,8.869-27.808,15.089c-9.358,6.219-18.521,13.819-27.502,22.793l-59.92,60.271l93.797,94.058H0V40.91 l93.27,91.597l60.181-60.532c13.376-15.018,27.222-27.248,41.536-36.697c14.308-9.443,28.608-16.776,42.89-21.992 c14.288-5.223,28.505-8.74,42.623-10.557C294.645,0.905,308.189,0,321.162,0c13.429,0,26.389,1.185,38.84,3.562 c12.478,2.377,24.2,5.718,35.192,10.029c11.006,4.311,21.126,9.404,30.374,15.265C434.79,34.724,442.995,41.119,450.159,48.042z"},arrow_right:{path:"M30.796,226.318h377.533L294.938,339.682c-11.899,11.906-11.899,31.184,0,43.084c11.887,11.899,31.19,11.893,43.077,0 l165.393-165.386c5.725-5.712,8.924-13.453,8.924-21.539c0-8.092-3.213-15.84-8.924-21.551L338.016,8.925 C332.065,2.975,324.278,0,316.478,0c-7.802,0-15.603,2.968-21.539,8.918c-11.899,11.906-11.899,31.184,0,43.084l113.391,113.384 H30.796c-16.822,0-30.463,13.645-30.463,30.463C0.333,212.674,13.974,226.318,30.796,226.318z"},arrow_up:{path:"M295.505,629.446V135.957l148.193,148.206c15.555,15.559,40.753,15.559,56.308,0c15.555-15.538,15.546-40.767,0-56.304 L283.83,11.662C276.372,4.204,266.236,0,255.68,0c-10.568,0-20.705,4.204-28.172,11.662L11.333,227.859 c-7.777,7.777-11.666,17.965-11.666,28.158c0,10.192,3.88,20.385,11.657,28.158c15.563,15.555,40.762,15.555,56.317,0 l148.201-148.219v493.489c0,21.993,17.837,39.82,39.82,39.82C277.669,669.267,295.505,651.439,295.505,629.446z"},arrow_diag:{path:"M279.875,511.994c-1.292,0-2.607-0.102-3.924-0.312c-10.944-1.771-19.333-10.676-20.457-21.71L233.97,278.348 L22.345,256.823c-11.029-1.119-19.928-9.51-21.698-20.461c-1.776-10.944,4.031-21.716,14.145-26.262L477.792,2.149 c9.282-4.163,20.167-2.165,27.355,5.024c7.201,7.189,9.199,18.086,5.024,27.356L302.22,497.527 C298.224,506.426,289.397,511.994,279.875,511.994z M118.277,217.332l140.534,14.294c11.567,1.178,20.718,10.335,21.878,21.896 l14.294,140.519l144.09-320.792L118.277,217.332z"},auto_zoom:{path:"M505.441,242.47l-78.303-78.291c-9.18-9.177-24.048-9.171-33.216,0c-9.169,9.172-9.169,24.045,0.006,33.217l38.193,38.188 H280.088V80.194l38.188,38.199c4.587,4.584,10.596,6.881,16.605,6.881c6.003,0,12.018-2.297,16.605-6.875 c9.174-9.172,9.174-24.039,0.011-33.217L273.219,6.881C268.803,2.471,262.834,0,256.596,0c-6.229,0-12.202,2.471-16.605,6.881 l-78.296,78.302c-9.178,9.172-9.178,24.045,0,33.217c9.177,9.171,24.051,9.171,33.21,0l38.205-38.205v155.4H80.521l38.2-38.188 c9.177-9.171,9.177-24.039,0.005-33.216c-9.171-9.172-24.039-9.178-33.216,0L7.208,242.464c-4.404,4.403-6.881,10.381-6.881,16.611 c0,6.227,2.477,12.207,6.881,16.61l78.302,78.291c4.587,4.581,10.599,6.875,16.605,6.875c6.006,0,12.023-2.294,16.61-6.881 c9.172-9.174,9.172-24.036-0.005-33.211l-38.205-38.199h152.593v152.063l-38.199-38.211c-9.171-9.18-24.039-9.18-33.216-0.022 c-9.178,9.18-9.178,24.059-0.006,33.222l78.284,78.302c4.41,4.404,10.382,6.881,16.611,6.881c6.233,0,12.208-2.477,16.611-6.881 l78.302-78.296c9.181-9.18,9.181-24.048,0-33.205c-9.174-9.174-24.054-9.174-33.21,0l-38.199,38.188v-152.04h152.051l-38.205,38.199 c-9.18,9.175-9.18,24.037-0.005,33.211c4.587,4.587,10.596,6.881,16.604,6.881c6.01,0,12.024-2.294,16.605-6.875l78.303-78.285 c4.403-4.403,6.887-10.378,6.887-16.611C512.328,252.851,509.845,246.873,505.441,242.47z"},statbox:{path:"M28.782,56.902H483.88c15.707,0,28.451-12.74,28.451-28.451C512.331,12.741,499.599,0,483.885,0H28.782 C13.074,0,0.331,12.741,0.331,28.451C0.331,44.162,13.074,56.902,28.782,56.902zM483.885,136.845H28.782c-15.708,0-28.451,12.741-28.451,28.451c0,15.711,12.744,28.451,28.451,28.451H483.88 c15.707,0,28.451-12.74,28.451-28.451C512.331,149.586,499.599,136.845,483.885,136.845zM483.885,273.275H28.782c-15.708,0-28.451,12.731-28.451,28.452c0,15.707,12.744,28.451,28.451,28.451H483.88 c15.707,0,28.451-12.744,28.451-28.451C512.337,286.007,499.599,273.275,483.885,273.275zM256.065,409.704H30.492c-15.708,0-28.451,12.731-28.451,28.451c0,15.707,12.744,28.451,28.451,28.451h225.585 c15.707,0,28.451-12.744,28.451-28.451C284.516,422.436,271.785,409.704,256.065,409.704z"},circle:{path:"M256,256 m-150,0 a150,150 0 1,0 300,0 a150,150 0 1,0 -300,0"},three_circles:{path:"M256,85 m-70,0 a70,70 0 1,0 140,0 a70,70 0 1,0 -140,0 M256,255 m-70,0 a70,70 0 1,0 140,0 a70,70 0 1,0 -140,0 M256,425 m-70,0 a70,70 0 1,0 140,0 a70,70 0 1,0 -140,0 "},diamand:{path:"M256,0L384,256L256,511L128,256z"},rect:{path:"M80,80h352v352h-352z"},cross:{path:"M80,40l176,176l176,-176l40,40l-176,176l176,176l-40,40l-176,-176l-176,176l-40,-40l176,-176l-176,-176z"},vrgoggles:{size:"245.82 141.73",path:"M175.56,111.37c-22.52,0-40.77-18.84-40.77-42.07S153,27.24,175.56,27.24s40.77,18.84,40.77,42.07S198.08,111.37,175.56,111.37ZM26.84,69.31c0-23.23,18.25-42.07,40.77-42.07s40.77,18.84,40.77,42.07-18.26,42.07-40.77,42.07S26.84,92.54,26.84,69.31ZM27.27,0C11.54,0,0,12.34,0,28.58V110.9c0,16.24,11.54,30.83,27.27,30.83H99.57c2.17,0,4.19-1.83,5.4-3.7L116.47,118a8,8,0,0,1,12.52-.18l11.51,20.34c1.2,1.86,3.22,3.61,5.39,3.61h72.29c15.74,0,27.63-14.6,27.63-30.83V28.58C245.82,12.34,233.93,0,218.19,0H27.27Z"},th2colorz:{recs:[{x:128,y:486,w:256,h:26,f:"rgb(38,62,168)"},{y:461,f:"rgb(22,82,205)"},{y:435,f:"rgb(16,100,220)"},{y:410,f:"rgb(18,114,217)"},{y:384,f:"rgb(20,129,214)"},{y:358,f:"rgb(14,143,209)"},{y:333,f:"rgb(9,157,204)"},{y:307,f:"rgb(13,167,195)"},{y:282,f:"rgb(30,175,179)"},{y:256,f:"rgb(46,183,164)"},{y:230,f:"rgb(82,186,146)"},{y:205,f:"rgb(116,189,129)"},{y:179,f:"rgb(149,190,113)"},{y:154,f:"rgb(179,189,101)"},{y:128,f:"rgb(209,187,89)"},{y:102,f:"rgb(226,192,75)"},{y:77,f:"rgb(244,198,59)"},{y:51,f:"rgb(253,210,43)"},{y:26,f:"rgb(251,230,29)"},{y:0,f:"rgb(249,249,15)"}]},th2color:{recs:[{x:0,y:256,w:13,h:39,f:"rgb(38,62,168)"},{x:13,y:371,w:39,h:39},{y:294,h:39},{y:256,h:39},{y:218,h:39},{x:51,y:410,w:39,h:39},{y:371,h:39},{y:333,h:39},{y:294},{y:256,h:39},{y:218,h:39},{y:179,h:39},{y:141,h:39},{y:102,h:39},{y:64},{x:90,y:448,w:39,h:39},{y:410},{y:371,h:39},{y:333,h:39,f:"rgb(22,82,205)"},{y:294},{y:256,h:39,f:"rgb(16,100,220)"},{y:218,h:39},{y:179,h:39,f:"rgb(22,82,205)"},{y:141,h:39},{y:102,h:39,f:"rgb(38,62,168)"},{y:64},{y:0,h:27},{x:128,y:448,w:39,h:39},{y:410},{y:371,h:39},{y:333,h:39,f:"rgb(22,82,205)"},{y:294,f:"rgb(20,129,214)"},{y:256,h:39,f:"rgb(9,157,204)"},{y:218,h:39,f:"rgb(14,143,209)"},{y:179,h:39,f:"rgb(20,129,214)"},{y:141,h:39,f:"rgb(16,100,220)"},{y:102,h:39,f:"rgb(22,82,205)"},{y:64,f:"rgb(38,62,168)"},{y:26,h:39},{y:0,h:27},{x:166,y:486,h:14},{y:448,h:39},{y:410},{y:371,h:39,f:"rgb(22,82,205)"},{y:333,h:39,f:"rgb(20,129,214)"},{y:294,f:"rgb(82,186,146)"},{y:256,h:39,f:"rgb(179,189,101)"},{y:218,h:39,f:"rgb(116,189,129)"},{y:179,h:39,f:"rgb(82,186,146)"},{y:141,h:39,f:"rgb(14,143,209)"},{y:102,h:39,f:"rgb(16,100,220)"},{y:64,f:"rgb(38,62,168)"},{y:26,h:39},{x:205,y:486,w:39,h:14},{y:448,h:39},{y:410},{y:371,h:39,f:"rgb(16,100,220)"},{y:333,h:39,f:"rgb(9,157,204)"},{y:294,f:"rgb(149,190,113)"},{y:256,h:39,f:"rgb(244,198,59)"},{y:218,h:39},{y:179,h:39,f:"rgb(226,192,75)"},{y:141,h:39,f:"rgb(13,167,195)"},{y:102,h:39,f:"rgb(18,114,217)"},{y:64,f:"rgb(22,82,205)"},{y:26,h:39,f:"rgb(38,62,168)"},{x:243,y:448,w:39,h:39},{y:410},{y:371,h:39,f:"rgb(18,114,217)"},{y:333,h:39,f:"rgb(30,175,179)"},{y:294,f:"rgb(209,187,89)"},{y:256,h:39,f:"rgb(251,230,29)"},{y:218,h:39,f:"rgb(249,249,15)"},{y:179,h:39,f:"rgb(226,192,75)"},{y:141,h:39,f:"rgb(30,175,179)"},{y:102,h:39,f:"rgb(18,114,217)"},{y:64,f:"rgb(38,62,168)"},{y:26,h:39},{x:282,y:448,h:39},{y:410},{y:371,h:39,f:"rgb(18,114,217)"},{y:333,h:39,f:"rgb(14,143,209)"},{y:294,f:"rgb(149,190,113)"},{y:256,h:39,f:"rgb(226,192,75)"},{y:218,h:39,f:"rgb(244,198,59)"},{y:179,h:39,f:"rgb(149,190,113)"},{y:141,h:39,f:"rgb(9,157,204)"},{y:102,h:39,f:"rgb(18,114,217)"},{y:64,f:"rgb(38,62,168)"},{y:26,h:39},{x:320,y:448,w:39,h:39},{y:410},{y:371,h:39,f:"rgb(22,82,205)"},{y:333,h:39,f:"rgb(20,129,214)"},{y:294,f:"rgb(46,183,164)"},{y:256,h:39},{y:218,h:39,f:"rgb(82,186,146)"},{y:179,h:39,f:"rgb(9,157,204)"},{y:141,h:39,f:"rgb(20,129,214)"},{y:102,h:39,f:"rgb(16,100,220)"},{y:64,f:"rgb(38,62,168)"},{y:26,h:39},{x:358,y:448,h:39},{y:410},{y:371,h:39,f:"rgb(22,82,205)"},{y:333,h:39},{y:294,f:"rgb(16,100,220)"},{y:256,h:39,f:"rgb(20,129,214)"},{y:218,h:39,f:"rgb(14,143,209)"},{y:179,h:39,f:"rgb(18,114,217)"},{y:141,h:39,f:"rgb(22,82,205)"},{y:102,h:39,f:"rgb(38,62,168)"},{y:64},{y:26,h:39},{x:397,y:448,w:39,h:39},{y:371,h:39},{y:333,h:39},{y:294,f:"rgb(22,82,205)"},{y:256,h:39},{y:218,h:39},{y:179,h:39,f:"rgb(38,62,168)"},{y:141,h:39},{y:102,h:39},{y:64},{y:26,h:39},{x:435,y:410,h:39},{y:371,h:39},{y:333,h:39},{y:294},{y:256,h:39},{y:218,h:39},{y:179,h:39},{y:141,h:39},{y:102,h:39},{y:64},{x:474,y:256,h:39},{y:179,h:39}]},th2draw3d:{path:"M172.768,0H51.726C23.202,0,0.002,23.194,0.002,51.712v89.918c0,28.512,23.2,51.718,51.724,51.718h121.042 c28.518,0,51.724-23.2,51.724-51.718V51.712C224.486,23.194,201.286,0,172.768,0z M177.512,141.63c0,2.611-2.124,4.745-4.75,4.745 H51.726c-2.626,0-4.751-2.134-4.751-4.745V51.712c0-2.614,2.125-4.739,4.751-4.739h121.042c2.62,0,4.75,2.125,4.75,4.739 L177.512,141.63L177.512,141.63z M460.293,0H339.237c-28.521,0-51.721,23.194-51.721,51.712v89.918c0,28.512,23.2,51.718,51.721,51.718h121.045 c28.521,0,51.721-23.2,51.721-51.718V51.712C512.002,23.194,488.802,0,460.293,0z M465.03,141.63c0,2.611-2.122,4.745-4.748,4.745 H339.237c-2.614,0-4.747-2.128-4.747-4.745V51.712c0-2.614,2.133-4.739,4.747-4.739h121.045c2.626,0,4.748,2.125,4.748,4.739 V141.63z M172.768,256.149H51.726c-28.524,0-51.724,23.205-51.724,51.726v89.915c0,28.504,23.2,51.715,51.724,51.715h121.042 c28.518,0,51.724-23.199,51.724-51.715v-89.915C224.486,279.354,201.286,256.149,172.768,256.149z M177.512,397.784 c0,2.615-2.124,4.736-4.75,4.736H51.726c-2.626-0.006-4.751-2.121-4.751-4.736v-89.909c0-2.626,2.125-4.753,4.751-4.753h121.042 c2.62,0,4.75,2.116,4.75,4.753L177.512,397.784L177.512,397.784z M460.293,256.149H339.237c-28.521,0-51.721,23.199-51.721,51.726v89.915c0,28.504,23.2,51.715,51.721,51.715h121.045 c28.521,0,51.721-23.199,51.721-51.715v-89.915C512.002,279.354,488.802,256.149,460.293,256.149z M465.03,397.784 c0,2.615-2.122,4.736-4.748,4.736H339.237c-2.614,0-4.747-2.121-4.747-4.736v-89.909c0-2.626,2.121-4.753,4.747-4.753h121.045 c2.615,0,4.748,2.116,4.748,4.753V397.784z"},createSVG(t,e,i,n){qv(".jsroot_svg_toolbar_btn { fill: steelblue; cursor: pointer; opacity: 0.3; } .jsroot_svg_toolbar_btn:hover { opacity: 1.0; }",t.node());let r=t.append("svg:svg").attr("class","jsroot_svg_toolbar_btn").attr("width",i+"px").attr("height",i+"px").attr("viewBox","0 0 512 512").style("overflow","hidden");if("recs"in e){let t={};for(let i=0;i{null!==i&&clearTimeout(i),i=setTimeout(r,n)}))}function Iv(t){return"buttons"in t?2===t.buttons:"which"in t?3===t.which:"button"in t&&2===t.button}function jv(t,e){if(void 0===e&&(e=!0),!g.MoveResize||l()||!t.draw_g)return;if(!e){if(t.draw_g.property("assigned_move")){let e=hn().subject(Object);e.on("start",null).on("drag",null).on("end",null),t.draw_g.style("cursor",null).property("assigned_move",null).call(e)}return}if(t.draw_g.property("assigned_move"))return;let i=hn().subject(Object),n=!0,r=!1;i.on("start",function(t){if(r=!!this.moveEnabled&&!this.moveEnabled(),r)return;if(Iv(t.sourceEvent))return;t.sourceEvent.preventDefault(),t.sourceEvent.stopPropagation();let e=Zi(t,this.draw_g.node());n=!0,this.moveStart&&this.moveStart(e[0],e[1])}.bind(t)).on("drag",function(t){r||(t.sourceEvent.preventDefault(),t.sourceEvent.stopPropagation(),n=!1,this.moveDrag&&this.moveDrag(t.dx,t.dy))}.bind(t)).on("end",function(t){r||(t.sourceEvent.preventDefault(),t.sourceEvent.stopPropagation(),this.moveEnd&&this.moveEnd(n),this.getPadPainter()?.selectObjectPainter(this))}.bind(t)),t.draw_g.style("cursor","move").property("assigned_move",!0).call(i)}function qv(t,e,i){if(l()||!t||"undefined"==typeof document)return!0;let n=(e||document).getElementsByTagName("style");for(let e=0;e0){let i=t.slice(e+7);return d(i)}}return t}async function Zv(t,e){if("function"==typeof Yv)return Yv(t,Wv(e));if(c())return Promise.resolve().then((function(){return HM})).then((i=>(i.writeFileSync(t,Wv(e)),!0)));if("object"==typeof document){let i=document.createElement("a");return i.download=t,i.href=e,document.body.appendChild(i),new Promise((t=>{i.addEventListener("click",(()=>{i.parentNode.removeChild(i),t(!0)})),i.click()}))}return!1}function Qv(t,e){let i=-1,n=rh();if("string"==typeof t){if(t&&"none"!=t){for(let e=1;e=50){let e=dt(t);i=`TColor::GetColor(${e.r},${e.g},${e.b})`}return`exec:${e}(${i})`}class Jv{constructor(t,e,i){this.painter=t,this.menuname=e,i&&"object"==typeof i&&void 0!==i.clientX&&void 0!==i.clientY&&(this.show_evnt={clientX:i.clientX,clientY:i.clientY}),this.remove_handler=()=>this.remove(),this.element=null,this.cnt=0}native(){return!1}async load(){return this}getEventPosition(){return this.show_evnt}add(){throw Error("add() method has to be implemented in the menu")}size(){return this.cnt}remove(){null!==this.element&&(this.element.remove(),this.resolveFunc&&(this.resolveFunc(),delete this.resolveFunc),document.body.removeEventListener("click",this.remove_handler)),this.element=null}show(){throw Error("show() method has to be implemented in the menu class")}addchk(t,e,i,n,r){let s=n;"function"==typeof i&&(r=n,n=i,s=t=>n("1"==t),i=t?"0":"1"),this.add((t?"chk:":"unk:")+e,i,s,r)}addDrawMenu(t,e,i){if(!e||!e.length)return;let n=!1;if(0==t.indexOf("nosub:")&&(n=!0,t=t.slice(6)),1===e.length)return"inspect"===e[0]&&(t=t.replace("Draw","Inspect")),void this.add(t,e[0],i);n||this.add("sub:"+t,e[0],i);for(let r=0;r":"<dflt>"),a=r+1;if(e.length>5&&s.length>0)for(;a{this.input("Enter color "+(r?"(only id number)":"(name or id)"),e,r?"int":"text",r?0:void 0,r?9999:void 0).then((t=>{let e=parseInt(t);if(Number.isInteger(e)&&lh(e))t=lh(e);else if(r)return;i(r?e:t)}))}));for(let t=0;t<5;++t){this.add("column:");for(let s=0;s<10;s++){let a=10*t+s;r||--a;let o=a<0?"none":lh(a);0==a&&1==n&&(o="none");let l=a<=0||"#"!=o[0]?o:`col ${a}`,h=1==a?"red":"black",c=`${e==(r?a:o)?``:""}${l}`;this.add(c,r?a:o,(t=>i(r?parseInt(t):t)),"Select color "+o)}if(this.add("endcolumn:"),!this.native())break}this.add("endsub:")}addSizeMenu(t,e,i,n,r,s,a){if(void 0===r)return;let o=[],l=!1;if("object"==typeof n)o=n,n=1;else for(let t=e;t<=i;t+=n)o.push(t);const h=t=>Math.abs(t-r)<1e-5*(i-e),c=(t,e)=>(t===r&&l&&(e=!0),n>=1?t.toFixed(0):n>=.1?t.toFixed(e?2:1):t.toFixed(e?4:2));o.findIndex(h)<0&&(l=!0,o.push(r),o=o.sort(((t,e)=>t>e))),this.add("sub:"+t,(()=>this.input("Enter value of "+t,c(r,!0),n>=1?"int":"float").then(s)),a),o.forEach((t=>this.addchk(h(t),c(t),t,(t=>s(n>=1?parseInt(t):parseFloat(t)))))),this.add("endsub:")}addPaletteMenu(t,e){const i=(i,n,r,s)=>{n?r||(r=n):n=`pal ${i}`,r&&(r+=`, code ${i}`),this.addchk(i===t||s,""+n+"",i,e,r||n)};if(this.add("sub:Palette",(()=>this.input("Enter palette code [1..113]",t,"int",1,113).then(e))),this.add("column:"),i(57,"Bird","Default color palette",t>113),i(55,"Rainbow"),i(51,"Deep Sea"),i(52,"Grayscale","New gray scale"),i(1,"","Old gray scale",t>0&&t<10),i(50,"ROOT 5","Default color palette in ROOT 5",t>=10&&t<51),i(53,"","Dark body radiator"),i(54,"","Two-color hue"),i(56,"","Inverted dark body radiator"),i(58,"Cubehelix"),i(59,"","Green Red Violet"),i(60,"","Blue Red Yellow"),i(61,"Ocean"),this.add("endcolumn:"),!this.native())return this.add("endsub:");this.add("column:"),i(62,"","Color Printable On Grey"),i(63,"Alpine"),i(64,"Aquamarine"),i(65,"Army"),i(66,"Atlantic"),i(67,"Aurora"),i(68,"Avocado"),i(69,"Beach"),i(70,"Black Body"),i(71,"","Blue Green Yellow"),i(72,"Brown Cyan"),i(73,"CMYK"),i(74,"Candy"),this.add("endcolumn:"),this.add("column:"),i(75,"Cherry"),i(76,"Coffee"),i(77,"","Dark Rain Bow"),i(78,"","Dark Terrain"),i(79,"Fall"),i(80,"Fruit Punch"),i(81,"Fuchsia"),i(82,"Grey Yellow"),i(83,"","Green Brown Terrain"),i(84,"Green Pink"),i(85,"Island"),i(86,"Lake"),i(87,"","Light Temperature"),this.add("endcolumn:"),this.add("column:"),i(88,"","Light Terrain"),i(89,"Mint"),i(90,"Neon"),i(91,"Pastel"),i(92,"Pearl"),i(93,"Pigeon"),i(94,"Plum"),i(95,"Red Blue"),i(96,"Rose"),i(97,"Rust"),i(98,"","Sandy Terrain"),i(99,"Sienna"),i(100,"Solar"),this.add("endcolumn:"),this.add("column:"),i(101,"","South West"),i(102,"","Starry Night"),i(103,"","Sunset"),i(104,"","Temperature Map"),i(105,"","Thermometer"),i(106,"Valentine"),i(107,"","Visible Spectrum"),i(108,"","Water Melon"),i(109,"Cool"),i(110,"Copper"),i(111,"","Gist Earth"),i(112,"Viridis"),i(113,"Cividis"),this.add("endcolumn:"),this.add("endsub:")}addRebinMenu(t){this.add("sub:Rebin",(()=>this.input("Enter rebin value",2,"int",2).then(t)));for(let e=2;e<=7;e++)this.add(e.toString(),e,(e=>t(parseInt(e))));this.add("endsub:")}addSelectMenu(t,e,i,n){let r="number"==typeof i;this.add("sub:"+t);for(let t=0;tn(r?Number.parseInt(t):t)));this.add("endsub:")}addRColorMenu(t,e,i){let n=["default","black","white","red","green","blue","yellow","magenta","cyan"];this.add("sub:"+t,(()=>{this.input("Enter color name - empty string will reset color",e).then(i)}));let r="black";for(let t=0;t0?(o="background-color:"+s,r="white"==s?"black":"white","string"==typeof e&&e&&"auto"!=e&&"["!=e[0]&&(a=pt(e).toString()==pt(s).toString())):a=!e;let l=`${s}`;this.addchk(a,l,s,(t=>i("default"==t?null:t)))}this.add("endsub:")}addRAttrTextItems(t,e,i){e||(e={}),this.addRColorMenu("color",t.color,(t=>i({name:"color",value:t}))),t.scaled?this.addSizeMenu("size",.01,.1,.01,t.size/t.scale,(t=>i({name:"size",value:t}))):this.addSizeMenu("size",6,20,2,t.size,(t=>i({name:"size",value:t}))),this.addSelectMenu("family",["Arial","Times New Roman","Courier New","Symbol"],t.name,(t=>i({name:"font_family",value:t}))),this.addSelectMenu("style",["normal","italic","oblique"],t.style||"normal",(t=>i({name:"font_style",value:"normal"==t?null:t}))),this.addSelectMenu("weight",["normal","lighter","bold","bolder"],t.weight||"normal",(t=>i({name:"font_weight",value:"normal"==t?null:t}))),e.noalign||this.add("align"),e.noangle||this.add("angle")}addTextAttributesMenu(t,e){let i=t.getObject();if(void 0===i?.fTextColor||null==i?.fTextAlign)return;this.add("sub:"+(e||"Text")),this.addColorMenu("color",i.fTextColor,(e=>{i.fTextColor=e,t.interactiveRedraw(!0,Qv(e,"SetTextColor"))}));let n=[11,12,13,21,22,23,31,32,33];this.add("sub:align");for(let e=0;ethis.input("Enter line style id (1-solid)",e,"int",1,11).then((t=>{gh(t)&&i(t)}))));for(let t=1;t<11;++t){let n=""+t+"";this.addchk(e==t,n,t,(t=>i(parseInt(t))))}this.add("endsub:")}addFillStyleMenu(t,e,i,n,r){this.add("sub:"+t,(()=>{this.input("Enter fill style id (1001-solid, 3000..3010)",e,"int",0,4e3).then((t=>{t>=0&&t<=4e3&&r(t)}))}));let s=[1,1001,3001,3002,3003,3004,3005,3006,3007,3010,3021,3022];for(let t=0;t"+s[t].toString()+""}this.addchk(e==s[t],a,s[t],(t=>r(parseInt(t))))}this.add("endsub:")}addFontMenu(t,e,i){this.add("sub:"+t,(()=>{this.input("Enter font id from [0..20]",Math.floor(e/10),"int",0,20).then((t=>{t>=0&&t<=20&&i(10*t+2)}))})),this.add("column:");for(let t=1;t<20;++t){let n=new Rl(10*t+2,14),r=$i(document.createElementNS("http://www.w3.org/2000/svg","text")),s=n.getFontName(),a=" "+s.split(" ")[0]+" ";n.weight&&(a="b"+a,s+=" "+n.weight),n.style&&(a=n.style[0]+a,s+=" "+n.style),r.attr("x",1).attr("y",15).text(a),n.setFont(r);let o=e!=10*t+2?"":"",l=""+r.node().outerHTML+o+"";this.add(l,t,(t=>i(10*parseInt(t)+2)),s),10==t&&(this.add("endcolumn:"),this.add("column:"))}this.add("endcolumn:"),this.add("endsub:")}addAttributesMenu(t,e){if(e||(e=""),t.lineatt?.used&&(this.add("sub:"+e+"Line att"),this.addSizeMenu("width",1,10,1,t.lineatt.width,(e=>{t.lineatt.change(void 0,e),t.interactiveRedraw(!0,`exec:SetLineWidth(${e})`)})),this.addColorMenu("color",t.lineatt.color,(e=>{t.lineatt.change(e),t.interactiveRedraw(!0,Qv(e,"SetLineColor"))})),this.addLineStyleMenu("style",t.lineatt.style,(e=>{t.lineatt.change(void 0,void 0,e),t.interactiveRedraw(!0,`exec:SetLineStyle(${e})`)})),this.add("endsub:"),t.lineatt?.excl_side)){this.add("sub:Exclusion"),this.add("sub:side");for(let e=-1;e<=1;++e)this.addchk(t.lineatt.excl_side==e,e,e,function(t){this.lineatt.changeExcl(parseInt(t)),this.interactiveRedraw()}.bind(t));this.add("endsub:"),this.addSizeMenu("width",10,100,10,t.lineatt.excl_width,(e=>{t.lineatt.changeExcl(void 0,e),t.interactiveRedraw()})),this.add("endsub:")}if(t.fillatt?.used&&(this.add("sub:"+e+"Fill att"),this.addColorMenu("color",t.fillatt.colorindx,(e=>{t.fillatt.change(e,void 0,t.getCanvSvg()),t.interactiveRedraw(!0,Qv(e,"SetFillColor"))}),t.fillatt.kind),this.addFillStyleMenu("style",t.fillatt.pattern,t.fillatt.colorindx,t,(e=>{t.fillatt.change(void 0,e,t.getCanvSvg()),t.interactiveRedraw(!0,`exec:SetFillStyle(${e})`)})),this.add("endsub:")),t.markeratt?.used){this.add("sub:"+e+"Marker att"),this.addColorMenu("color",t.markeratt.color,(e=>{t.markeratt.change(e),t.interactiveRedraw(!0,Qv(e,"SetMarkerColor"))})),this.addSizeMenu("size",.5,6,.5,t.markeratt.size,(e=>{t.markeratt.change(void 0,void 0,e),t.interactiveRedraw(!0,`exec:SetMarkerSize(${e})`)})),this.add("sub:style");let i=[1,2,3,4,5,6,7,8,21,22,23,24,25,26,27,28,29,30,31,32,33,34];for(let e=0;e";this.addchk(t.markeratt.style==i[e],r,i[e],function(t){this.markeratt.change(void 0,parseInt(t)),this.interactiveRedraw(!0,"exec:SetMarkerStyle("+t+")")}.bind(t))}this.add("endsub:"),this.add("endsub:")}}addTAxisMenu(t,e,i,n){this.add("Divisions",(()=>this.input("Set Ndivisions",i.fNdivisions,"int",0).then((t=>{i.fNdivisions=t,e.interactiveRedraw("pad",`exec:SetNdivisions(${t})`,n)})))),this.add("sub:Labels"),this.addchk(i.TestBit(t.kCenterLabels),"Center",(r=>{i.InvertBit(t.kCenterLabels),e.interactiveRedraw("pad",`exec:CenterLabels(${r})`,n)})),this.addchk(i.TestBit(t.kLabelsVert),"Rotate",(r=>{i.InvertBit(t.kLabelsVert),e.interactiveRedraw("pad",`exec:SetBit(TAxis::kLabelsVert,${r})`,n)})),this.addColorMenu("Color",i.fLabelColor,(t=>{i.fLabelColor=t,e.interactiveRedraw("pad",Qv(t,"SetLabelColor"),n)})),this.addSizeMenu("Offset",0,.1,.01,i.fLabelOffset,(t=>{i.fLabelOffset=t,e.interactiveRedraw("pad",`exec:SetLabelOffset(${t})`,n)})),this.addSizeMenu("Size",.02,.11,.01,i.fLabelSize,(t=>{i.fLabelSize=t,e.interactiveRedraw("pad",`exec:SetLabelSize(${t})`,n)})),this.add("endsub:"),this.add("sub:Title"),this.add("SetTitle",(()=>{this.input("Enter axis title",i.fTitle).then((t=>{i.fTitle=t,e.interactiveRedraw("pad",`exec:SetTitle("${t}")`,n)}))})),this.addchk(i.TestBit(t.kCenterTitle),"Center",(r=>{i.InvertBit(t.kCenterTitle),e.interactiveRedraw("pad",`exec:CenterTitle(${r})`,n)})),this.addchk(i.TestBit(t.kOppositeTitle),"Opposite",(()=>{i.InvertBit(t.kOppositeTitle),e.redrawPad()})),this.addchk(i.TestBit(t.kRotateTitle),"Rotate",(r=>{i.InvertBit(t.kRotateTitle),e.interactiveRedraw("pad",`exec:RotateTitle(${r})`,n)})),this.addColorMenu("Color",i.fTitleColor,(t=>{i.fTitleColor=t,e.interactiveRedraw("pad",Qv(t,"SetTitleColor"),n)})),this.addSizeMenu("Offset",0,3,.2,i.fTitleOffset,(t=>{i.fTitleOffset=t,e.interactiveRedraw("pad",`exec:SetTitleOffset(${t})`,n)})),this.addSizeMenu("Size",.02,.11,.01,i.fTitleSize,(t=>{i.fTitleSize=t,e.interactiveRedraw("pad",`exec:SetTitleSize(${t})`,n)})),this.add("endsub:"),this.add("sub:Ticks"),"TGaxis"==i._typename?(this.addColorMenu("Color",i.fLineColor,(t=>{i.fLineColor=t,e.interactiveRedraw("pad")})),this.addSizeMenu("Size",-.05,.055,.01,i.fTickSize,(t=>{i.fTickSize=t,e.interactiveRedraw("pad")}))):(this.addColorMenu("Color",i.fAxisColor,(t=>{i.fAxisColor=t,e.interactiveRedraw("pad",Qv(t,"SetAxisColor"),n)})),this.addSizeMenu("Size",-.05,.055,.01,i.fTickLength,(t=>{i.fTickLength=t,e.interactiveRedraw("pad",`exec:SetTickLength(${t})`,n)}))),this.add("endsub:")}addSettingsMenu(t,e,i){e?this.add("header:Settings"):this.add("sub:Settings"),this.add("sub:Files"),t&&(this.addchk(g.OnlyLastCycle,"Last cycle",(t=>{g.OnlyLastCycle=t,i&&i("refresh")})),this.addchk(!g.SkipStreamerInfos,"Streamer infos",(t=>{g.SkipStreamerInfos=!t,i&&i("refresh")}))),this.addchk(g.UseStamp,"Use stamp arg",(t=>{g.UseStamp=t})),this.addSizeMenu("Max ranges",1,1e3,[1,10,20,50,200,1e3],g.MaxRanges,(t=>{g.MaxRanges=t}),"Maximal number of ranges in single http request"),this.addchk(g.HandleWrongHttpResponse,"Handle wrong http response",(t=>{g.HandleWrongHttpResponse=t})),this.add("endsub:"),this.add("sub:Toolbar"),this.addchk(!1===g.ToolBar,"Off",(t=>{g.ToolBar=!t})),this.addchk(!0===g.ToolBar,"On",(t=>{g.ToolBar=t})),this.addchk("popup"===g.ToolBar,"Popup",(t=>{g.ToolBar=!!t&&"popup"})),this.add("separator"),this.addchk("left"==g.ToolBarSide,"Left side",(t=>{g.ToolBarSide=t?"left":"right"})),this.addchk(g.ToolBarVert,"Vertical",(t=>{g.ToolBarVert=t})),this.add("endsub:"),this.add("sub:Interactive"),this.addchk(g.Tooltip,"Tooltip",(t=>{g.Tooltip=t})),this.addchk(g.ContextMenu,"Context menus",(t=>{g.ContextMenu=t})),this.add("sub:Zooming"),this.addchk(g.Zooming,"Global",(t=>{g.Zooming=t})),this.addchk(g.ZoomMouse,"Mouse",(t=>{g.ZoomMouse=t})),this.addchk(g.ZoomWheel,"Wheel",(t=>{g.ZoomWheel=t})),this.addchk(g.ZoomTouch,"Touch",(t=>{g.ZoomTouch=t})),this.add("endsub:"),this.addchk(g.HandleKeys,"Keypress handling",(t=>{g.HandleKeys=t})),this.addchk(g.MoveResize,"Move and resize",(t=>{g.MoveResize=t})),this.addchk(g.DragAndDrop,"Drag and drop",(t=>{g.DragAndDrop=t})),this.addchk(g.DragGraphs,"Drag graph points",(t=>{g.DragGraphs=t})),this.addchk(g.ProgressBox,"Progress box",(t=>{g.ProgressBox=t})),this.add("endsub:"),this.add("sub:Drawing"),this.addSelectMenu("Optimize",["None","Smart","Always"],g.OptimizeDraw,(t=>{g.OptimizeDraw=t})),this.addPaletteMenu(g.Palette,(t=>{g.Palette=t})),this.addchk(g.AutoStat,"Auto stat box",(t=>{g.AutoStat=t})),this.addSelectMenu("Latex",["Off","Symbols","Normal","MathJax","Force MathJax"],g.Latex,(t=>{g.Latex=t})),this.addSelectMenu("3D rendering",["Default","WebGL","Image"],g.Render3D,(t=>{g.Render3D=t})),this.addSelectMenu("WebGL embeding",["Default","Overlay","Embed"],g.Embed3D,(t=>{g.Embed3D=t})),this.add("endsub:"),this.add("sub:Geometry"),this.add("Grad per segment: "+g.GeoGradPerSegm,(()=>this.input("Grad per segment in geometry",g.GeoGradPerSegm,"int",1,60).then((t=>{g.GeoGradPerSegm=t})))),this.addchk(g.GeoCompressComp,"Compress composites",(t=>{g.GeoCompressComp=t})),this.add("endsub:"),t&&this.add("Hierarchy limit: "+g.HierarchyLimit,(()=>this.input("Max number of items in hierarchy",g.HierarchyLimit,"int",10,1e5).then((t=>{g.HierarchyLimit=t,i&&i("refresh")})))),this.add("Dark mode: "+(g.DarkMode?"On":"Off"),(()=>{g.DarkMode=!g.DarkMode,i&&i("dark")}));const n=t=>{_[t.slice(1)]=parseInt(t[0])},r=(t,e,i)=>{this.add("sub:"+t);for(let t=0;t{_.fCanvasColor=t})),this.addchk(_.fOptDate,"Draw date",(t=>{_.fOptDate=t?1:0})),this.addchk(_.fOptFile,"Draw item",(t=>{_.fOptFile=t?1:0})),this.addSizeMenu("Date X",.01,.1,.01,_.fDateX,(t=>{_.fDateX=t}),"configure gStyle.fDateX for date/item name drawings"),this.addSizeMenu("Date Y",.01,.1,.01,_.fDateY,(t=>{_.fDateY=t}),"configure gStyle.fDateY for date/item name drawings"),this.add("endsub:"),this.add("sub:Pad"),this.addColorMenu("Color",_.fPadColor,(t=>{_.fPadColor=t})),this.add("sub:Grid"),this.addchk(_.fPadGridX,"X",(t=>{_.fPadGridX=t})),this.addchk(_.fPadGridY,"Y",(t=>{_.fPadGridY=t})),this.addColorMenu("Color",_.fGridColor,(t=>{_.fGridColor=t})),this.addSizeMenu("Width",1,10,1,_.fGridWidth,(t=>{_.fGridWidth=t})),this.addLineStyleMenu("Style",_.fGridStyle,(t=>{_.fGridStyle=t})),this.add("endsub:"),r("Ticks X","fPadTickX",["normal","ticks on both sides","labels on both sides"]),r("Ticks Y","fPadTickY",["normal","ticks on both sides","labels on both sides"]),r("Log X","fOptLogx",["off","on","log 2"]),r("Log Y","fOptLogy",["off","on","log 2"]),r("Log Z","fOptLogz",["off","on","log 2"]),this.addchk(1==_.fOptTitle,"Hist title",(t=>{_.fOptTitle=t?1:0})),this.add("endsub:"),this.add("sub:Frame"),this.addColorMenu("Fill color",_.fFrameFillColor,(t=>{_.fFrameFillColor=t})),this.addFillStyleMenu("Fill style",_.fFrameFillStyle,_.fFrameFillColor,null,(t=>{_.fFrameFillStyle=t})),this.addColorMenu("Line color",_.fFrameLineColor,(t=>{_.fFrameLineColor=t})),this.addSizeMenu("Line width",1,10,1,_.fFrameLineWidth,(t=>{_.fFrameLineWidth=t})),this.addLineStyleMenu("Line style",_.fFrameLineStyle,(t=>{_.fFrameLineStyle=t})),this.addSizeMenu("Border size",0,10,1,_.fFrameBorderSize,(t=>{_.fFrameBorderSize=t})),this.add("sub:Margins"),this.addSizeMenu("Bottom",0,.5,.05,_.fPadBottomMargin,(t=>{_.fPadBottomMargin=t})),this.addSizeMenu("Top",0,.5,.05,_.fPadTopMargin,(t=>{_.fPadTopMargin=t})),this.addSizeMenu("Left",0,.5,.05,_.fPadLeftMargin,(t=>{_.fPadLeftMargin=t})),this.addSizeMenu("Right",0,.5,.05,_.fPadRightMargin,(t=>{_.fPadRightMargin=t})),this.add("endsub:"),this.add("endsub:"),this.add("sub:Title"),this.addColorMenu("Fill color",_.fTitleColor,(t=>{_.fTitleColor=t})),this.addFillStyleMenu("Fill style",_.fTitleStyle,_.fTitleColor,null,(t=>{_.fTitleStyle=t})),this.addColorMenu("Text color",_.fTitleTextColor,(t=>{_.fTitleTextColor=t})),this.addSizeMenu("Border size",0,10,1,_.fTitleBorderSize,(t=>{_.fTitleBorderSize=t})),this.addSizeMenu("Font size",.01,.1,.01,_.fTitleFontSize,(t=>{_.fTitleFontSize=t})),this.addFontMenu("Font",_.fTitleFont,(t=>{_.fTitleFont=t})),this.addSizeMenu("X: "+_.fTitleX.toFixed(2),0,1,.1,_.fTitleX,(t=>{_.fTitleX=t})),this.addSizeMenu("Y: "+_.fTitleY.toFixed(2),0,1,.1,_.fTitleY,(t=>{_.fTitleY=t})),this.addSizeMenu("W: "+_.fTitleW.toFixed(2),0,1,.1,_.fTitleW,(t=>{_.fTitleW=t})),this.addSizeMenu("H: "+_.fTitleH.toFixed(2),0,1,.1,_.fTitleH,(t=>{_.fTitleH=t})),this.add("endsub:"),this.add("sub:Stat box"),this.addColorMenu("Fill color",_.fStatColor,(t=>{_.fStatColor=t})),this.addFillStyleMenu("Fill style",_.fStatStyle,_.fStatColor,null,(t=>{_.fStatStyle=t})),this.addColorMenu("Text color",_.fStatTextColor,(t=>{_.fStatTextColor=t})),this.addSizeMenu("Border size",0,10,1,_.fStatBorderSize,(t=>{_.fStatBorderSize=t})),this.addSizeMenu("Font size",0,30,5,_.fStatFontSize,(t=>{_.fStatFontSize=t})),this.addFontMenu("Font",_.fStatFont,(t=>{_.fStatFont=t})),this.add("Stat format",(()=>this.input("Stat format",_.fStatFormat).then((t=>{_.fStatFormat=t})))),this.addSizeMenu("X: "+_.fStatX.toFixed(2),.2,1,.1,_.fStatX,(t=>{_.fStatX=t})),this.addSizeMenu("Y: "+_.fStatY.toFixed(2),.2,1,.1,_.fStatY,(t=>{_.fStatY=t})),this.addSizeMenu("Width: "+_.fStatW.toFixed(2),.1,1,.1,_.fStatW,(t=>{_.fStatW=t})),this.addSizeMenu("Height: "+_.fStatH.toFixed(2),.1,1,.1,_.fStatH,(t=>{_.fStatH=t})),this.add("endsub:"),this.add("sub:Legend"),this.addColorMenu("Fill color",_.fLegendFillColor,(t=>{_.fLegendFillColor=t})),this.addSizeMenu("Border size",0,10,1,_.fLegendBorderSize,(t=>{_.fLegendBorderSize=t})),this.addFontMenu("Font",_.fLegendFont,(t=>{_.fLegendFont=t})),this.addSizeMenu("Text size",0,.1,.01,_.fLegendTextSize,(t=>{_.fLegendTextSize=t}),"legend text size, when 0 - auto adjustment is used"),this.add("endsub:"),this.add("sub:Histogram"),this.addchk(_.fHistMinimumZero,"Base0",(t=>{_.fHistMinimumZero=t}),"when true, BAR and LEGO drawing using base = 0"),this.add("Text format",(()=>this.input("Paint text format",_.fPaintTextFormat).then((t=>{_.fPaintTextFormat=t})))),this.add("Time offset",(()=>this.input("Time offset in seconds, default is 788918400 for 1/1/1995",_.fTimeOffset,"int").then((t=>{_.fTimeOffset=t})))),this.addSizeMenu("ErrorX: "+_.fErrorX.toFixed(2),0,1,.1,_.fErrorX,(t=>{_.fErrorX=t})),this.addSizeMenu("End error",0,12,1,_.fEndErrorSize,(t=>{_.fEndErrorSize=t}),"size in pixels of end error for E1 draw options, gStyle.fEndErrorSize"),this.addSizeMenu("Top margin",0,.5,.05,_.fHistTopMargin,(t=>{_.fHistTopMargin=t}),"Margin between histogram's top and frame's top"),this.addColorMenu("Fill color",_.fHistFillColor,(t=>{_.fHistFillColor=t})),this.addFillStyleMenu("Fill style",_.fHistFillStyle,_.fHistFillColor,null,(t=>{_.fHistFillStyle=t})),this.addColorMenu("Line color",_.fHistLineColor,(t=>{_.fHistLineColor=t})),this.addSizeMenu("Line width",1,10,1,_.fHistLineWidth,(t=>{_.fHistLineWidth=t})),this.addLineStyleMenu("Line style",_.fHistLineStyle,(t=>{_.fHistLineStyle=t})),this.add("endsub:"),this.add("separator"),this.add("sub:Predefined"),["Modern","Plain","Bold"].forEach((t=>this.addchk(_.fName==t,t,t,Uv))),this.add("endsub:"),this.add("endsub:"),this.add("separator"),this.add("Save settings",(()=>{($v(!0)?Promise.resolve(!0):this.confirm("Save settings","Pressing OK one agreess that JSROOT will store settings as browser cookies")).then((t=>{t&&(Xv(),Vv())}))}),"Store settings and gStyle as cookies"),this.add("Delete settings",(()=>{Xv(-1),Vv(-1)}),"Delete settings and gStyle from cookies"),e||this.add("endsub:")}async runModal(){throw Error("runModal() must be reimplemented")}info(t,e){return this.runModal(t,`

${e}

`,{height:120,width:400,resizable:!0})}async confirm(t,e){return this.runModal(t,e,{btns:!0,height:120,width:400}).then((t=>!!t))}async input(t,e,i,n,r){i||(i="text");let s="";null==e&&(e=""),"int"==i&&(void 0!==n&&(s+=` min="${n}"`),void 0!==r&&(s+=` max="${r}"`));let a=`
`;return new Promise((e=>{this.runModal(t,a,{btns:!0,height:150,width:400}).then((t=>{if(!t)return;let n=t.querySelector(".jsroot_dlginp").value;"float"==i?(n=parseFloat(n),Number.isFinite(n)&&e(n)):"int"==i?(n=parseInt(n),Number.isInteger(n)&&e(n)):e(n)}))}))}async showMethodArgsDialog(t){let e=this.menuname+"_dialog",i='
';for(let n=0;n${r.fName}\n `}return i+="
",new Promise((n=>{this.runModal(t.fClassName+"::"+t.fName,i,{btns:!0,height:100+60*t.fArgs.length,width:400,resizable:!0}).then((i=>{if(!i)return;let r="";for(let n=0;n0?",":"")+a}n(r)}))}))}async showCommandArgsDialog(t,e){let i=this.menuname+"_dialog",n='
';for(let t=0;targ${t+1}`;return n+="
",new Promise((r=>{this.runModal("Arguments for command "+t,n,{btns:!0,height:110+60*e.length,width:400,resizable:!0}).then((t=>{if(!t)return r(null);let n=[];for(let r=0;r0;)t[0].parentNode.removeChild(t[0]);r.style.position="fixed",r.style.left=e+"px",r.style.top=i+"px",qv(".jsroot_ctxt_container {\n position: absolute; top: 0; user-select: none; z-index: 100000; background-color: rgb(250, 250, 250); margin: 0; padding: 0px; width: auto;\n min-width: 100px; box-shadow: 0px 0px 10px rgb(0, 0, 0, 0.2); border: 3px solid rgb(215, 215, 215); font-family: Arial, helvetica, sans-serif, serif;\n font-size: 13px; color: rgb(0, 0, 0, 0.8);\n }\n .jsroot_ctxt_column { float: left; }\n .jsroot_ctxt_divider { width: 85%; margin: 3px auto; border: 1px solid rgb(0, 0, 0, 0.15); }\n .jsroot_ctxt_header { background-color: lightblue; padding: 3px 7px; font-weight: bold; border-bottom: 1px; }\n .jsroot_ctxt_text { margin: 0; padding: 3px 7px; pointer-events: none; white-space: nowrap; }\n .jsroot_ctxt_extraText { margin: 0; padding: 3px 7px; color: rgb(0, 0, 0, 0.6); }\n .jsroot_ctxt_focus { background-color: rgb(220, 220, 220); }\n .jsroot_ctxt_item:hover { background-color: rgb(235, 235, 235); }",this.element)}else e<0&&i==e?(r.className="jsroot_ctxt_column",r.style.width=(100/-e).toFixed(1)+"%"):r.style.left=-n.offsetLeft+n.offsetWidth+"px";let s=!1,a=0;t.forEach((t=>{t.checked&&(s=!0),t.column&&a++})),t.forEach((t=>{if(a>0)return r.style.display="flex",void(t.column&&this._buildContextmenu(t.sub,-a,-a,r));if(t.divider){let t=document.createElement("hr");return t.className="jsroot_ctxt_divider",void r.appendChild(t)}let e=document.createElement("div");if(e.style.position="relative",r.appendChild(e),t.header)return e.className="jsroot_ctxt_header",void(e.innerHTML=t.text);let i=document.createElement("div");i.style.width="100%",i.style.height="100%",i.className="jsroot_ctxt_item",i.style.display="flex",i.style.justifyContent="space-between",i.style.cursor="pointer",t.title&&i.setAttribute("title",t.title),e.appendChild(i),t.text||(t.text="item");let n=document.createElement("div");if(n.className="jsroot_ctxt_text",t.text.indexOf("=0)if(s){n.style.display="flex";let e=document.createElement("span");e.innerHTML=t.checked?"✓":"",e.style.display="inline-block",e.style.width="1em",n.appendChild(e);let i=document.createElement("div");i.innerHTML=t.text,n.appendChild(i)}else n.innerHTML=t.text;else{if(s){let e=document.createElement("span");e.innerHTML=t.checked?"✓":"",e.style.display="inline-block",e.style.width="1em",n.appendChild(e)}let e=document.createElement("span");0==t.text.indexOf("")?e.textContent=t.text.slice(6,t.text.length-7):e.textContent=t.text,n.appendChild(e)}if(i.appendChild(n),t.hasOwnProperty("extraText")||t.sub){let e=document.createElement("span");e.className="jsroot_ctxt_extraText jsroot_ctxt_text",e.textContent=t.sub?"▶":t.extraText,i.appendChild(e)}i.addEventListener("mouseenter",(()=>{r.childNodes.forEach((t=>{t.classList.contains("jsroot_ctxt_focus")&&(t.removeChild(t.getElementsByClassName("jsroot_ctxt_container")[0]),t.classList.remove("jsroot_ctxt_focus"))}))})),t.sub&&i.addEventListener("mouseenter",(()=>{e.classList.add("jsroot_ctxt_focus"),this._buildContextmenu(t.sub,0,0,e)})),t.func&&e.addEventListener("click",(e=>{(this.painter?t.func.bind(this.painter):t.func)(t.arg),e.stopPropagation(),this.remove()}))})),n.appendChild(r);let o=document.documentElement.clientWidth,l=document.documentElement.clientHeight;if(n===document.body)e+r.offsetWidth>o&&(r.style.left=o-r.offsetWidth+"px"),r.offsetHeight>l?(r.style.top=0,r.style.overflowY="scroll",r.style.overflowX="hidden",r.style.height=l+"px"):i+r.offsetHeight>l&&(r.style.top=l-r.offsetHeight+"px");else if("jsroot_ctxt_column"!=r.className){let t=n.getBoundingClientRect(),e=r.getBoundingClientRect();e.left+e.width>o&&(r.style.left=-n.offsetLeft-e.width+"px"),e.height>l?(r.style.top=-e.top+"px",r.style.overflowY="scroll",r.style.overflowX="hidden",r.style.height=l+"px"):e.heightl/2?e.top-l/2>=0?r.style.top=-e.top-e.height+l+"px":r.style.top=-e.top+"px":e.top+e.height>l&&(r.style.top=-e.height+t.height+"px")}return r}async show(t){this.remove(),!t&&this.show_evnt&&(t=this.show_evnt),document.body.addEventListener("click",this.remove_handler);let e=document.getElementById(this.menuname);return e&&e.remove(),this.element=this._buildContextmenu(this.code,(t?.clientX||0)+window.pageXOffset,(t?.clientY||0)+window.pageYOffset,document.body),this.element.setAttribute("id",this.menuname),this}async runModal(t,e,i){i||(i={});let n=this.menuname+"_dialog";$i("#"+n).remove(),$i("#"+n+"_block").remove();let r=$i("body").append("div").attr("id",n+"_block").attr("class","jsroot_dialog_block"),s=$i("body").append("div").attr("id",n).attr("class","jsroot_dialog").style("width",(i.width||450)+"px").attr("tabindex","0").html(`
\n
${t}
\n
${e}
\n \n
`);return qv(".jsroot_dialog_block { z-index: 100000; position: absolute; top: 0; left: 0; right: 0; bottom: 0; opacity: 0.2; background-color: white; }\n .jsroot_dialog { z-index: 100001; position: absolute; left: 50%; top: 50%; }\n .jsroot_dialog_body { position: relative; left: -50%; top: -50%; border: solid green 3px; padding: 5px; display: flex; flex-flow: column; background-color: white; }\n .jsroot_dialog_header { flex: 0 1 auto; padding: 5px; }\n .jsroot_dialog_content { flex: 1 1 auto; padding: 5px; }\n .jsroot_dialog_footer { flex: 0 1 auto; padding: 5px; }\n .jsroot_dialog_button { float: right; margin-right: 1em; }",s.node()),new Promise((t=>{s.on("keyup",(e=>{"Enter"!=e.code&&"Escape"!=e.code||(e.preventDefault(),e.stopPropagation(),t("Enter"==e.code?s.node():null),s.remove(),r.remove())})),s.on("keydown",(t=>{"Enter"!=t.code&&"Escape"!=t.code||(t.preventDefault(),t.stopPropagation())})),s.selectAll(".jsroot_dialog_button").on("click",(e=>{t(i.btns&&"Ok"==$i(e.target).text()?s.node():null),s.remove(),r.remove()}));let e=s.select(".jsroot_dialog_content").select("input");e.empty()&&(e=s.select(".jsroot_dialog_footer").select("button")),e.empty()||e.node().focus()}))}}class tb extends Jv{constructor(t,e,i){super(t,e,i),this.code="",this.funcs={},this.lvl=0}loadBS(e){let i="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.2/";return(s.bs_path?Promise.resolve(!0):A(t.source_dir+"style/bootstrap.min.css").then((()=>{s.bs_path=t.source_dir+"scripts/"})).catch((()=>(s.bs_path=i+"js/",A(i+"css/bootstrap.min.css"))))).then((()=>!e||"undefined"!=typeof bootstrap||A(s.bs_path+"bootstrap.bundle.min.js")))}load(){return this.loadBS().then((()=>this))}add(t,e,i,n){if("separator"==t)return void(this.code+='');if("column:"==t||"endcolumn:"==t)return;if(0==t.indexOf("header:"))return void(this.code+=``);let r=!1,s="",a="dropdown-item btn-sm",o="";if("endsub:"==t)return this.lvl--,this.code+="",void(this.code+="");0==t.indexOf("sub:")&&(t=t.slice(4),r=!0),"function"==typeof e&&(i=e,e=t),0==t.indexOf("chk:")?(o="✓",t=t.slice(4)):0==t.indexOf("unk:")&&(t=t.slice(4)),n&&(s+=` title="${n}"`),void 0!==e&&(s+=` arg="${e}"`),r&&(s+=' data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"',a+=" dropdown-toggle");let l=``;l=r?'
  • '+l:"
  • "+l+"
  • ",this.code+=l,r&&(this.code+=`