@ndmspc/ndmvr-core 1.1.0-rc.9 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/{RCanvasPainter-DQGWienR.js → RCanvasPainter-BN1wz_jA.js} +1 -1
  3. package/dist/assets/RNTuple-B19bW6t4.js +1 -0
  4. package/dist/assets/{RPavePainter-CQHUOnSn.js → RPavePainter-BOw0-OFU.js} +1 -1
  5. package/dist/assets/{RTreeMapPainter-B2r2zCJG.js → RTreeMapPainter-DNojexp9.js} +1 -1
  6. package/dist/assets/{TASImagePainter-DRdiRLt1.js → TASImagePainter-BNJ5OAGP.js} +1 -1
  7. package/dist/assets/{TAnnotation3DPainter-BCJen6cS.js → TAnnotation3DPainter-BCGBhq-q.js} +1 -1
  8. package/dist/assets/{TArrowPainter-Dspl2Ikh.js → TArrowPainter-C7a0r3SV.js} +1 -1
  9. package/dist/assets/{TBoxPainter-BQEN4gj8.js → TBoxPainter-Djh43LYY.js} +1 -1
  10. package/dist/assets/{TEfficiencyPainter-TxRejkVD.js → TEfficiencyPainter-dXd5DL3h.js} +1 -1
  11. package/dist/assets/{TF1Painter-BuwSTmhs.js → TF1Painter-DwE8KsBp.js} +1 -1
  12. package/dist/assets/{TF2Painter-BTh6LWBk.js → TF2Painter-SGNNKiK5.js} +1 -1
  13. package/dist/assets/{TF3Painter-R5EVXlD4.js → TF3Painter-yaRyTX9u.js} +1 -1
  14. package/dist/assets/{TGaxisPainter-BJuDLLel.js → TGaxisPainter-DSiIbikC.js} +1 -1
  15. package/dist/assets/{TGraph2DPainter-aeM0xqgu.js → TGraph2DPainter-COqZBIPT.js} +1 -1
  16. package/dist/assets/{TGraphPainter-DLkx_1ES.js → TGraphPainter-Bp7xEbQz.js} +1 -1
  17. package/dist/assets/{TGraphPainter-CtqNpDiH.js → TGraphPainter-CurXuifu.js} +1 -1
  18. package/dist/assets/{TGraphPolarPainter-bMuBuvEZ.js → TGraphPolarPainter-u-FCb_Gb.js} +1 -1
  19. package/dist/assets/{TGraphTimePainter-D_1RHDMz.js → TGraphTimePainter-DDPwiVGX.js} +1 -1
  20. package/dist/assets/{TH1Painter-CMr7gXzd.js → TH1Painter-BXzutgI3.js} +1 -1
  21. package/dist/assets/{TH1Painter--tuoUZTH.js → TH1Painter-DyN-WKyv.js} +1 -1
  22. package/dist/assets/{TH2Painter-DHaL_lR_.js → TH2Painter-BpixRP4j.js} +1 -1
  23. package/dist/assets/{TH2Painter-BLfyBVB5.js → TH2Painter-DceuYQAL.js} +1 -1
  24. package/dist/assets/{TH3Painter-DLCndhZ0.js → TH3Painter-BA_W8tmJ.js} +1 -1
  25. package/dist/assets/{THStackPainter-B3TUpsVt.js → THStackPainter-BWLN_w9A.js} +1 -1
  26. package/dist/assets/{THistPainter-Df-RmCQH.js → THistPainter-B2S5BnuY.js} +1 -1
  27. package/dist/assets/{TLinePainter-RinEQkrM.js → TLinePainter-D8inyuoX.js} +1 -1
  28. package/dist/assets/{TMultiGraphPainter-BQyL8zWX.js → TMultiGraphPainter-DcwdyhOr.js} +1 -1
  29. package/dist/assets/{TPavePainter-Dx40jhkF.js → TPavePainter-1yngbgp8.js} +1 -1
  30. package/dist/assets/{TPiePainter-BaTIH6-e.js → TPiePainter-BgDv4srX.js} +1 -1
  31. package/dist/assets/{TPolyLinePainter-7_jf8MLI.js → TPolyLinePainter-BYlrAjCB.js} +1 -1
  32. package/dist/assets/{TPolyMarker3D-DYlLB9Ww.js → TPolyMarker3D-BaWOSDy6.js} +1 -1
  33. package/dist/assets/{TRatioPlotPainter-BvUop_Na.js → TRatioPlotPainter-CJgkL58z.js} +1 -1
  34. package/dist/assets/{TScatterPainter-CvLCMGW2.js → TScatterPainter-Bt11j8z8.js} +1 -1
  35. package/dist/assets/{TSplinePainter-DJPtQW6I.js → TSplinePainter-p6k_OB02.js} +1 -1
  36. package/dist/assets/{TTextPainter-BwCh-g5B.js → TTextPainter-B26aOYGd.js} +1 -1
  37. package/dist/assets/{TTree-CE4EQRMu.js → TTree-BtFtnLeD.js} +1 -1
  38. package/dist/assets/{TWebPaintingPainter-CexNsDDp.js → TWebPaintingPainter-CZ6lo-7N.js} +1 -1
  39. package/dist/assets/{draw3d-BPJMZpwL.js → draw3d-ejHvJRmG.js} +1 -1
  40. package/dist/assets/{func-C1jNXIub.js → func-C6FX2eN2.js} +1 -1
  41. package/dist/assets/{hist3d-DCmav5Ga.js → hist3d-D9VevdP6.js} +1 -1
  42. package/dist/assets/{latex3d-ITrfFgp8.js → latex3d-8Hbnfz6c.js} +1 -1
  43. package/dist/assets/{main-CvPDcTGr.js → main-DwRPe_ox.js} +191 -191
  44. package/dist/assets/{more-CGvLPt4r.js → more-64laEJ4X.js} +1 -1
  45. package/dist/assets/{ndmvr-aframe-core-Cw91_9_Y.js → ndmvr-aframe-core-DEHQ38JB.js} +4 -4
  46. package/dist/assets/{rntuple-BCwqxNeP.js → rntuple-i8TaG-6V.js} +1 -1
  47. package/dist/assets/{stress-Ihg3ljmc.js → stress-KrXoDujC.js} +1 -1
  48. package/dist/assets/{v7more-H3D-KQGQ.js → v7more-C-UZAxz1.js} +1 -1
  49. package/dist/docs/components/configuration/configuration/index.html +243 -238
  50. package/dist/docs/components/tutorial/canvas/canvas/index.html +1 -1
  51. package/dist/docs/components/tutorial/configurationChapter/configuration-chapter/index.html +1 -1
  52. package/dist/docs/components/tutorial/firstVisualization/first-visualization/index.html +1 -1
  53. package/dist/docs/components/tutorial/interactions/interactions/index.html +1 -1
  54. package/dist/docs/downloads/canvas.zip +0 -0
  55. package/dist/docs/downloads/configuration.zip +0 -0
  56. package/dist/docs/downloads/first-visualization.zip +0 -0
  57. package/dist/docs/downloads/interactions.zip +0 -0
  58. package/dist/docs/index.html +1 -1
  59. package/dist/docs/search/search_index.json +1 -1
  60. package/dist/docs/sitemap.xml.gz +0 -0
  61. package/dist/index.es.js +962 -953
  62. package/dist/index.html +2 -2
  63. package/dist/index.umd.js +10 -10
  64. package/dist/stress.html +2 -2
  65. package/package.json +1 -1
  66. package/dist/assets/RNTuple-L4uyxl3s.js +0 -1
@@ -1 +1 @@
1
- import{a7 as d,ae as p,ag as y,ai as M,aU as x,az as X,a3 as P,a_ as _}from"./ndmvr-aframe-core-Cw91_9_Y.js";import{TH1Painter as b}from"./TH1Painter-CMr7gXzd.js";import"./hist3d-DCmav5Ga.js";import"./latex3d-ITrfFgp8.js";import"./THistPainter-Df-RmCQH.js";import"./TPavePainter-Dx40jhkF.js";import"./TH2Painter-DHaL_lR_.js";import"./TH1Painter--tuoUZTH.js";import"./func-C1jNXIub.js";class g extends d{#t;updateObject(t,i){const e=this.getObject();return e._typename!==t._typename?!1:(e!==t&&Object.assign(e,t),i!==void 0&&this.decodeOptions(i),!0)}eval(t,i){const e=i-t.fX;return t._typename==="TSplinePoly3"?t.fY+e*(t.fB+e*(t.fC+e*t.fD)):t._typename==="TSplinePoly5"?t.fY+e*(t.fB+e*(t.fC+e*(t.fD+e*(t.fE+e*t.fF)))):t.fY+e}findX(t){const i=this.getObject();let e=0,a=i.fNp-1;if(t<=i.fXmin)return e;if(t>=i.fXmax)return a;if(i.fKstep)e=Math.round((t-i.fXmin)/i.fDelta),t<i.fPoly[e].fX?e=Math.max(e-1,0):e<a&&t>i.fPoly[e+1].fX&&++e;else for(;a-e>1;){const r=Math.round((e+a)/2);t>i.fPoly[r].fX?e=r:a=r}return e}createDummyHisto(){const t=this.getObject();let i=0,e=1,a=0,r=1;t.fPoly&&(i=e=t.fPoly[0].fX,a=r=t.fPoly[0].fY,t.fPoly.forEach(f=>{i=Math.min(f.fX,i),e=Math.max(f.fX,e),a=Math.min(f.fY,a),r=Math.max(f.fY,r)}),r>0&&(r*=1+p.fHistTopMargin),a<0&&(a*=1+p.fHistTopMargin));const s=y(_,10);return s.fName=t.fName+"_hist",s.fTitle=t.fTitle,s.fBits|=M,s.fXaxis.fXmin=i,s.fXaxis.fXmax=e,s.fYaxis.fXmin=a,s.fYaxis.fXmax=r,s.fMinimum=a,s.fMaximum=r,s}processTooltipEvent(t){const i=this.getObject(),e=this.getOptions(),a=this.getFramePainter()?.getGrFuncs(e.second_x,e.second_y);let r=!1,s,f,n=null,l=0;t===null||!i||!a?r=!0:(s=a.revertAxis("x",t.x),l=this.findX(s),n=i.fPoly[l],f=this.eval(n,s),l<i.fN-1&&Math.abs(i.fPoly[l+1].fX-s)<Math.abs(s-n.fX)&&(n=i.fPoly[++l]),Math.abs(a.grx(n.fX)-t.x)<.5*this.#t?(s=n.fX,f=n.fY):(n=null,(s<i.fXmin||s>i.fXmax)&&(r=!0)));let c=this.getG()?.selectChild(".tooltip_bin");const h=this.lineatt.width+3;if(r||!this.getG())return c?.remove(),null;c.empty()&&(c=this.getG().append("svg:circle").attr("class","tooltip_bin").style("pointer-events","none").attr("r",h).style("fill","none").call(this.lineatt.func));const o={name:this.getObject().fName,title:this.getObject().fTitle,x:a.grx(s),y:a.gry(f),color1:this.lineatt.color,lines:[],exact:n!==null||Math.abs(a.gry(f)-t.y)<h};o.changed=c.property("current_xx")!==s,o.menu=o.exact,o.menu_dist=Math.sqrt((o.x-t.x)**2+(o.y-t.y)**2),o.changed&&c.attr("cx",Math.round(o.x)).attr("cy",Math.round(o.y)).property("current_xx",s);const m=this.getObjectHint();return m&&o.lines.push(m),o.lines.push(`x = ${a.axisAsText("x",s)}`,`y = ${a.axisAsText("y",f)}`),n!==null&&(o.lines.push(`knot = ${l}`,`B = ${x(n.fB,p.fStatFormat)}`,`C = ${x(n.fC,p.fStatFormat)}`,`D = ${x(n.fD,p.fStatFormat)}`),n.fE!==void 0&&n.fF!==void 0&&o.lines.push(`E = ${x(n.fE,p.fStatFormat)}`,`F = ${x(n.fF,p.fStatFormat)}`)),o}redraw(){const t=this.getObject(),i=this.getOptions(),e=this.getFramePainter().getGrFuncs(i.second_x,i.second_y),a=e.getFrameWidth(),r=e.getFrameHeight(),s=this.createG(!0);if(this.#t=5,this.createAttLine({attr:t}),i.Line||i.Curve){const f=Math.max(10,t.fNpx),n=[];let l=Math.max(e.scale_xmin,t.fXmin),c=Math.min(e.scale_xmax,t.fXmax),h=this.findX(l);e.logx&&(l=Math.log(l),c=Math.log(c));for(let o=0;o<f;++o){let m=l+(c-l)/f*(o-1);for(e.logx&&(m=Math.exp(m));h<t.fNp-1&&m>t.fPoly[h+1].fX;)++h;const u=this.eval(t.fPoly[h],m);n.push({x:m,y:u,grx:e.grx(m),gry:e.gry(u)})}s.append("svg:path").attr("class","line").attr("d",X(n)).style("fill","none").call(this.lineatt.func)}if(i.Mark){this.createAttMarker({attr:t}),this.markeratt.resetPos(),this.#t=this.markeratt.getFullSize();let f="";for(let n=0;n<t.fPoly.length;n++){const l=t.fPoly[n],c=e.grx(l.fX);if(c>-this.#t&&c<a+this.#t){const h=e.gry(l.fY);h>-this.#t&&h<r+this.#t&&(f+=this.markeratt.create(c,h))}}f&&s.append("svg:path").attr("d",f).call(this.markeratt.func)}}canZoomInside(t){return t!=="x"?!1:!!this.getObject()}decodeOptions(t){const i=new P(t),e=this.setOptions({Same:i.check("SAME"),Line:i.check("L"),Curve:i.check("C"),Mark:i.check("P"),Hopt:"",second_x:!1,second_y:!1});!e.Line&&!e.Curve&&!e.Mark&&(e.Curve=!0),i.check("X+")&&(e.Hopt+="X+",e.second_x=!!this.getMainPainter()),i.check("Y+")&&(e.Hopt+="Y+",e.second_y=!!this.getMainPainter()),this.storeDrawOpt(t)}static async draw(t,i,e){const a=new g(t,i);a.decodeOptions(e);const r=!a.getMainPainter();let s=Promise.resolve();if(r||a.options.second_x||a.options.second_y){if(a.options.Same&&r)return console.warn("TSpline painter requires histogram to be drawn"),null;const f=a.createDummyHisto();s=b.draw(t,f,a.options.Hopt)}return s.then(()=>(a.addToPadPrimitives(),a.redraw(),a))}}export{g as TSplinePainter};
1
+ import{a7 as d,ae as p,ag as y,ai as M,aU as x,az as X,a3 as P,a_ as _}from"./ndmvr-aframe-core-DEHQ38JB.js";import{TH1Painter as b}from"./TH1Painter-BXzutgI3.js";import"./hist3d-D9VevdP6.js";import"./latex3d-8Hbnfz6c.js";import"./THistPainter-B2S5BnuY.js";import"./TPavePainter-1yngbgp8.js";import"./TH2Painter-BpixRP4j.js";import"./TH1Painter-DyN-WKyv.js";import"./func-C6FX2eN2.js";class g extends d{#t;updateObject(t,i){const e=this.getObject();return e._typename!==t._typename?!1:(e!==t&&Object.assign(e,t),i!==void 0&&this.decodeOptions(i),!0)}eval(t,i){const e=i-t.fX;return t._typename==="TSplinePoly3"?t.fY+e*(t.fB+e*(t.fC+e*t.fD)):t._typename==="TSplinePoly5"?t.fY+e*(t.fB+e*(t.fC+e*(t.fD+e*(t.fE+e*t.fF)))):t.fY+e}findX(t){const i=this.getObject();let e=0,a=i.fNp-1;if(t<=i.fXmin)return e;if(t>=i.fXmax)return a;if(i.fKstep)e=Math.round((t-i.fXmin)/i.fDelta),t<i.fPoly[e].fX?e=Math.max(e-1,0):e<a&&t>i.fPoly[e+1].fX&&++e;else for(;a-e>1;){const r=Math.round((e+a)/2);t>i.fPoly[r].fX?e=r:a=r}return e}createDummyHisto(){const t=this.getObject();let i=0,e=1,a=0,r=1;t.fPoly&&(i=e=t.fPoly[0].fX,a=r=t.fPoly[0].fY,t.fPoly.forEach(f=>{i=Math.min(f.fX,i),e=Math.max(f.fX,e),a=Math.min(f.fY,a),r=Math.max(f.fY,r)}),r>0&&(r*=1+p.fHistTopMargin),a<0&&(a*=1+p.fHistTopMargin));const s=y(_,10);return s.fName=t.fName+"_hist",s.fTitle=t.fTitle,s.fBits|=M,s.fXaxis.fXmin=i,s.fXaxis.fXmax=e,s.fYaxis.fXmin=a,s.fYaxis.fXmax=r,s.fMinimum=a,s.fMaximum=r,s}processTooltipEvent(t){const i=this.getObject(),e=this.getOptions(),a=this.getFramePainter()?.getGrFuncs(e.second_x,e.second_y);let r=!1,s,f,n=null,l=0;t===null||!i||!a?r=!0:(s=a.revertAxis("x",t.x),l=this.findX(s),n=i.fPoly[l],f=this.eval(n,s),l<i.fN-1&&Math.abs(i.fPoly[l+1].fX-s)<Math.abs(s-n.fX)&&(n=i.fPoly[++l]),Math.abs(a.grx(n.fX)-t.x)<.5*this.#t?(s=n.fX,f=n.fY):(n=null,(s<i.fXmin||s>i.fXmax)&&(r=!0)));let c=this.getG()?.selectChild(".tooltip_bin");const h=this.lineatt.width+3;if(r||!this.getG())return c?.remove(),null;c.empty()&&(c=this.getG().append("svg:circle").attr("class","tooltip_bin").style("pointer-events","none").attr("r",h).style("fill","none").call(this.lineatt.func));const o={name:this.getObject().fName,title:this.getObject().fTitle,x:a.grx(s),y:a.gry(f),color1:this.lineatt.color,lines:[],exact:n!==null||Math.abs(a.gry(f)-t.y)<h};o.changed=c.property("current_xx")!==s,o.menu=o.exact,o.menu_dist=Math.sqrt((o.x-t.x)**2+(o.y-t.y)**2),o.changed&&c.attr("cx",Math.round(o.x)).attr("cy",Math.round(o.y)).property("current_xx",s);const m=this.getObjectHint();return m&&o.lines.push(m),o.lines.push(`x = ${a.axisAsText("x",s)}`,`y = ${a.axisAsText("y",f)}`),n!==null&&(o.lines.push(`knot = ${l}`,`B = ${x(n.fB,p.fStatFormat)}`,`C = ${x(n.fC,p.fStatFormat)}`,`D = ${x(n.fD,p.fStatFormat)}`),n.fE!==void 0&&n.fF!==void 0&&o.lines.push(`E = ${x(n.fE,p.fStatFormat)}`,`F = ${x(n.fF,p.fStatFormat)}`)),o}redraw(){const t=this.getObject(),i=this.getOptions(),e=this.getFramePainter().getGrFuncs(i.second_x,i.second_y),a=e.getFrameWidth(),r=e.getFrameHeight(),s=this.createG(!0);if(this.#t=5,this.createAttLine({attr:t}),i.Line||i.Curve){const f=Math.max(10,t.fNpx),n=[];let l=Math.max(e.scale_xmin,t.fXmin),c=Math.min(e.scale_xmax,t.fXmax),h=this.findX(l);e.logx&&(l=Math.log(l),c=Math.log(c));for(let o=0;o<f;++o){let m=l+(c-l)/f*(o-1);for(e.logx&&(m=Math.exp(m));h<t.fNp-1&&m>t.fPoly[h+1].fX;)++h;const u=this.eval(t.fPoly[h],m);n.push({x:m,y:u,grx:e.grx(m),gry:e.gry(u)})}s.append("svg:path").attr("class","line").attr("d",X(n)).style("fill","none").call(this.lineatt.func)}if(i.Mark){this.createAttMarker({attr:t}),this.markeratt.resetPos(),this.#t=this.markeratt.getFullSize();let f="";for(let n=0;n<t.fPoly.length;n++){const l=t.fPoly[n],c=e.grx(l.fX);if(c>-this.#t&&c<a+this.#t){const h=e.gry(l.fY);h>-this.#t&&h<r+this.#t&&(f+=this.markeratt.create(c,h))}}f&&s.append("svg:path").attr("d",f).call(this.markeratt.func)}}canZoomInside(t){return t!=="x"?!1:!!this.getObject()}decodeOptions(t){const i=new P(t),e=this.setOptions({Same:i.check("SAME"),Line:i.check("L"),Curve:i.check("C"),Mark:i.check("P"),Hopt:"",second_x:!1,second_y:!1});!e.Line&&!e.Curve&&!e.Mark&&(e.Curve=!0),i.check("X+")&&(e.Hopt+="X+",e.second_x=!!this.getMainPainter()),i.check("Y+")&&(e.Hopt+="Y+",e.second_y=!!this.getMainPainter()),this.storeDrawOpt(t)}static async draw(t,i,e){const a=new g(t,i);a.decodeOptions(e);const r=!a.getMainPainter();let s=Promise.resolve();if(r||a.options.second_x||a.options.second_y){if(a.options.Same&&r)return console.warn("TSpline painter requires histogram to be drawn"),null;const f=a.createDummyHisto();s=b.draw(t,f,a.options.Hopt)}return s.then(()=>(a.addToPadPrimitives(),a.redraw(),a))}}export{g as TSplinePainter};
@@ -1 +1 @@
1
- import{a7 as x,a2 as l,a3 as p,a8 as g,a9 as T,a1 as u,a0 as m,aa as w,$ as _,a6 as v}from"./ndmvr-aframe-core-Cw91_9_Y.js";const y=l(14);class f extends x{async _redrawText(e,t,i){const s=this.getObject(),a=this.getPadPainter(),d=this.getFramePainter(),r=s.fName.startsWith("http://")||s.fName.startsWith("https://");if(d?.getDrawDom()===null)return this;let o=1,n=!1;this.createAttText({attr:s}),i==="3d"||s.TestBit(y)?this.isndc=!0:!i&&a?.getRootPad(!0)?n=new p(this.getDrawOpt()).check("FRAME"):i||(this.isndc=!0,e=t=.5,s.fTextAlign=22);const h=this.createG(n?"frame2d":void 0,r);h.attr("transform",null),e=this.axisToSvg("x",e,this.isndc),t=this.axisToSvg("y",t,this.isndc),this.swap_xy=n&&d?.swap_xy(),this.swap_xy&&([e,t]=[t,e]);const c=this.textatt.createArg({x:e,y:t,text:s.fTitle,latex:0});return this.matchObjectType(g)||i?c.latex=1:this.matchObjectType(T)&&(c.latex=2,o=.8),r&&(h.attr("href",s.fName),this.isBatchMode()||h.append("svg:title").text(`link on ${s.fName}`)),this.startTextDrawingAsync(this.textatt.font,this.textatt.getSize(a,o)).then(()=>this.drawText(c)).then(()=>this.finishTextDrawing()).then(()=>this.isBatchMode()?this:a.isButton()&&!a.isEditable()?(h.on("click",()=>this.getCanvPainter().selectActivePad(a)),this):(Object.assign(this,{pos_x:e,pos_y:t,pos_dx:0,pos_dy:0}),i!=="3d"&&u(this,!0,r),m(this),this.matchObjectType(w)&&h.style("cursor","pointer").on("click",()=>this.submitCanvExec("ExecuteEvent(kButton1Up, 0, 0);;")),this))}async redraw(){return this._redrawText(this.getObject().fX,this.getObject().fY)}moveDrag(e,t){this.pos_dx+=e,this.pos_dy+=t,_(this.getG(),this.pos_dx,this.pos_dy)}moveEnd(e){if(e)return;const t=this.getObject();let i=this.svgToAxis("x",this.pos_x+this.pos_dx,this.isndc),s=this.svgToAxis("y",this.pos_y+this.pos_dy,this.isndc);this.swap_xy&&([i,s]=[s,i]),t.fX=i,t.fY=s,this.submitCanvExec(`SetX(${i});;SetY(${s});;`)}fillContextMenuItems(e){const t=this.getObject();e.add("Change text",()=>e.input("Enter new text",t.fTitle).then(i=>{t.fTitle=i,this.interactiveRedraw("pad",`exec:SetTitle("${i}")`)}))}static async draw(e,t,i){const s=new f(e,t,i);return v(s,!1).then(()=>s.redraw())}}export{f as TTextPainter};
1
+ import{a7 as x,a2 as l,a3 as p,a8 as g,a9 as T,a1 as u,a0 as m,aa as w,$ as _,a6 as v}from"./ndmvr-aframe-core-DEHQ38JB.js";const y=l(14);class f extends x{async _redrawText(e,t,i){const s=this.getObject(),a=this.getPadPainter(),d=this.getFramePainter(),r=s.fName.startsWith("http://")||s.fName.startsWith("https://");if(d?.getDrawDom()===null)return this;let o=1,n=!1;this.createAttText({attr:s}),i==="3d"||s.TestBit(y)?this.isndc=!0:!i&&a?.getRootPad(!0)?n=new p(this.getDrawOpt()).check("FRAME"):i||(this.isndc=!0,e=t=.5,s.fTextAlign=22);const h=this.createG(n?"frame2d":void 0,r);h.attr("transform",null),e=this.axisToSvg("x",e,this.isndc),t=this.axisToSvg("y",t,this.isndc),this.swap_xy=n&&d?.swap_xy(),this.swap_xy&&([e,t]=[t,e]);const c=this.textatt.createArg({x:e,y:t,text:s.fTitle,latex:0});return this.matchObjectType(g)||i?c.latex=1:this.matchObjectType(T)&&(c.latex=2,o=.8),r&&(h.attr("href",s.fName),this.isBatchMode()||h.append("svg:title").text(`link on ${s.fName}`)),this.startTextDrawingAsync(this.textatt.font,this.textatt.getSize(a,o)).then(()=>this.drawText(c)).then(()=>this.finishTextDrawing()).then(()=>this.isBatchMode()?this:a.isButton()&&!a.isEditable()?(h.on("click",()=>this.getCanvPainter().selectActivePad(a)),this):(Object.assign(this,{pos_x:e,pos_y:t,pos_dx:0,pos_dy:0}),i!=="3d"&&u(this,!0,r),m(this),this.matchObjectType(w)&&h.style("cursor","pointer").on("click",()=>this.submitCanvExec("ExecuteEvent(kButton1Up, 0, 0);;")),this))}async redraw(){return this._redrawText(this.getObject().fX,this.getObject().fY)}moveDrag(e,t){this.pos_dx+=e,this.pos_dy+=t,_(this.getG(),this.pos_dx,this.pos_dy)}moveEnd(e){if(e)return;const t=this.getObject();let i=this.svgToAxis("x",this.pos_x+this.pos_dx,this.isndc),s=this.svgToAxis("y",this.pos_y+this.pos_dy,this.isndc);this.swap_xy&&([i,s]=[s,i]),t.fX=i,t.fY=s,this.submitCanvExec(`SetX(${i});;SetY(${s});;`)}fillContextMenuItems(e){const t=this.getObject();e.add("Change text",()=>e.input("Enter new text",t.fTitle).then(i=>{t.fTitle=i,this.interactiveRedraw("pad",`exec:SetTitle("${i}")`)}))}static async draw(e,t,i){const s=new f(e,t,i);return v(s,!1).then(()=>s.redraw())}}export{f as TTextPainter};
@@ -1,4 +1,4 @@
1
- import{b1 as I,b2 as N,b3 as S,b4 as V,b5 as E,b6 as F,aK as p,a7 as g,b7 as b,b8 as L,b9 as T,ba as z,a4 as v,bb as B,bc as H,a5 as R,aq as m,s as M,aQ as C,bd as G,be as q,ay as K,bf as w,bg as A,bh as x,bi as J,aI as Q,af as U,bj as W,bk as X,bl as Y,bm as Z}from"./ndmvr-aframe-core-Cw91_9_Y.js";import{TH1Painter as j}from"./TH1Painter-CMr7gXzd.js";import{TH2Painter as ee}from"./TH2Painter-BLfyBVB5.js";import{TH3Painter as y}from"./TH3Painter-DLCndhZ0.js";import{T as re}from"./TGraphPainter-CtqNpDiH.js";import{d as te}from"./TPolyMarker3D-DYlLB9Ww.js";import"./hist3d-DCmav5Ga.js";import"./latex3d-ITrfFgp8.js";import"./THistPainter-Df-RmCQH.js";import"./TPavePainter-Dx40jhkF.js";import"./TH2Painter-DHaL_lR_.js";import"./TH1Painter--tuoUZTH.js";import"./func-C1jNXIub.js";import"./TGraphPainter-DLkx_1ES.js";Z.prototype.ShowProgress=function(i){let t,e;if(i===void 0||!Number.isFinite(i))t=e="";else if(this._break)t="Breaking ... ",e="break";else{if(this.last_progress!==i){const r=i-this.last_progress;this.aver_diff||(this.aver_diff=r),this.aver_diff=r*.3+this.aver_diff*.7}this.last_progress=i;let s=0;this.aver_diff<=0?s=0:this.aver_diff<1e-4?s=3:this.aver_diff<.001?s=2:this.aver_diff<.01&&(s=1),t=`TTree draw ${(i*100).toFixed(s)} % `}return b(t,0,()=>{this._break=1}),e};async function D(i,t,e){const s=t?._typename;return!s||!p(s)?Promise.reject(Error("Object without type cannot be draw with TTree")):s.indexOf(Q)===0?j.draw(i,t,e):s.indexOf(U)===0?ee.draw(i,t,e):s.indexOf(W)===0?y.draw(i,t,e):s.indexOf(X)===0?re.draw(i,t,e):s===Y&&t.$hist?y.draw(i,t.$hist,e).then(()=>{const r=new g(i,t,e);return r.addToPadPrimitives(),r.redraw=te,r.redraw()}):Promise.reject(Error(`Object of type ${s} cannot be draw with TTree`))}async function P(i,t){if(!(!t&&!this.last_pr)){if(this.dump||this.dump_entries||this.testio){if(!t)return;if(H()){const s=new v(this.drawid);return s.selectDom().property("_json_object_",i),s}if(R(m.drawInspector))return m.drawInspector(this.drawid,i);const e=M(C);return e.fString=G(i,2),q(this.drawid,e)}return this.last_pr||(this.last_pr=Promise.resolve(!0)),this.last_pr.then(()=>(this.obj_painter?this.last_pr=K(this.obj_painter.redrawObject(i)).then(()=>this.obj_painter):i?this.last_pr=D(this.drawid,i,this.drawopt).then(e=>(this.obj_painter=e,t||(this.last_pr=null),e)):(t&&console.log("no result after tree drawing"),this.last_pr=!1),t?this.last_pr:null))}}function k(i){return i.draw_first=!0,i.configureOnline=function(t,e,s,r,a){this.setItemName(t,"",this),this.url=e,this.root_version=r,this.askey=s,this.draw_expr=a},i.configureTree=function(t){this.local_tree=t},i.showExtraButtons=function(t){const e=this.selectDom(),s=this.local_tree?.fEntries||0;e.select(".treedraw_more").remove(),e.select(".treedraw_buttons").node().innerHTML+=`Cut: <input class="treedraw_cut ui-corner-all ui-widget" style="width:8em;margin-left:5px" title="cut expression"></input>Opt: <input class="treedraw_opt ui-corner-all ui-widget" style="width:5em;margin-left:5px" title="histogram draw options"></input>Num: <input class="treedraw_number" type='number' min="0" max="${s}" step="1000" style="width:7em;margin-left:5px" title="number of entries to process (default all)"></input>First: <input class="treedraw_first" type='number' min="0" max="${s}" step="1000" style="width:7em;margin-left:5px" title="first entry to process (default first)"></input><button class="treedraw_clear" title="Clear drawing">Clear</button>`,e.select(".treedraw_exe").on("click",()=>this.performDraw()),e.select(".treedraw_cut").property("value",t?.parse_cut||"").on("change",()=>this.performDraw()),e.select(".treedraw_opt").property("value",t?.drawopt||"").on("change",()=>this.performDraw()),e.select(".treedraw_number").attr("value",t?.numentries||""),e.select(".treedraw_first").attr("value",t?.firstentry||""),e.select(".treedraw_clear").on("click",()=>w(this.drawid))},i.showPlayer=function(t){const e=this.selectDom();this.drawid="jsroot_tree_player_"+m.id_counter+++"_draw";const s=t?.parse_cut||t?.numentries||t?.firstentry;e.html(`<div style="display:flex; flex-flow:column; height:100%; width:100%;"><div class="treedraw_buttons" style="flex: 0 1 auto;margin-top:0.2em;"><button class="treedraw_exe" title="Execute draw expression" style="margin-left:0.5em">Draw</button>Expr:<input class="treedraw_varexp treedraw_varexp_info" style="width:12em;margin-left:5px" title="draw expression"></input><label class="treedraw_varexp_info">ⓘ</label><button class="treedraw_more">More</button></div><div style="flex: 0 1 auto"><hr/></div><div id="${this.drawid}" style="flex: 1 1 auto; overflow:hidden;"></div></div>`),this.setTopPainter(),this.local_tree&&e.select(".treedraw_buttons").attr("title","Tree draw player for: "+this.local_tree.fName),e.select(".treedraw_exe").on("click",()=>this.performDraw()),e.select(".treedraw_varexp").attr("value",t?.parse_expr||this.draw_expr||"px:py").on("change",()=>this.performDraw()),e.select(".treedraw_varexp_info").attr("title",`Example of valid draw expressions:
1
+ import{b1 as I,b2 as N,b3 as S,b4 as V,b5 as E,b6 as F,aK as p,a7 as g,b7 as b,b8 as L,b9 as T,ba as z,a4 as v,bb as B,bc as H,a5 as R,aq as m,s as M,aQ as C,bd as G,be as q,ay as K,bf as w,bg as A,bh as x,bi as J,aI as Q,af as U,bj as W,bk as X,bl as Y,bm as Z}from"./ndmvr-aframe-core-DEHQ38JB.js";import{TH1Painter as j}from"./TH1Painter-BXzutgI3.js";import{TH2Painter as ee}from"./TH2Painter-DceuYQAL.js";import{TH3Painter as y}from"./TH3Painter-BA_W8tmJ.js";import{T as re}from"./TGraphPainter-CurXuifu.js";import{d as te}from"./TPolyMarker3D-BaWOSDy6.js";import"./hist3d-D9VevdP6.js";import"./latex3d-8Hbnfz6c.js";import"./THistPainter-B2S5BnuY.js";import"./TPavePainter-1yngbgp8.js";import"./TH2Painter-BpixRP4j.js";import"./TH1Painter-DyN-WKyv.js";import"./func-C6FX2eN2.js";import"./TGraphPainter-Bp7xEbQz.js";Z.prototype.ShowProgress=function(i){let t,e;if(i===void 0||!Number.isFinite(i))t=e="";else if(this._break)t="Breaking ... ",e="break";else{if(this.last_progress!==i){const r=i-this.last_progress;this.aver_diff||(this.aver_diff=r),this.aver_diff=r*.3+this.aver_diff*.7}this.last_progress=i;let s=0;this.aver_diff<=0?s=0:this.aver_diff<1e-4?s=3:this.aver_diff<.001?s=2:this.aver_diff<.01&&(s=1),t=`TTree draw ${(i*100).toFixed(s)} % `}return b(t,0,()=>{this._break=1}),e};async function D(i,t,e){const s=t?._typename;return!s||!p(s)?Promise.reject(Error("Object without type cannot be draw with TTree")):s.indexOf(Q)===0?j.draw(i,t,e):s.indexOf(U)===0?ee.draw(i,t,e):s.indexOf(W)===0?y.draw(i,t,e):s.indexOf(X)===0?re.draw(i,t,e):s===Y&&t.$hist?y.draw(i,t.$hist,e).then(()=>{const r=new g(i,t,e);return r.addToPadPrimitives(),r.redraw=te,r.redraw()}):Promise.reject(Error(`Object of type ${s} cannot be draw with TTree`))}async function P(i,t){if(!(!t&&!this.last_pr)){if(this.dump||this.dump_entries||this.testio){if(!t)return;if(H()){const s=new v(this.drawid);return s.selectDom().property("_json_object_",i),s}if(R(m.drawInspector))return m.drawInspector(this.drawid,i);const e=M(C);return e.fString=G(i,2),q(this.drawid,e)}return this.last_pr||(this.last_pr=Promise.resolve(!0)),this.last_pr.then(()=>(this.obj_painter?this.last_pr=K(this.obj_painter.redrawObject(i)).then(()=>this.obj_painter):i?this.last_pr=D(this.drawid,i,this.drawopt).then(e=>(this.obj_painter=e,t||(this.last_pr=null),e)):(t&&console.log("no result after tree drawing"),this.last_pr=!1),t?this.last_pr:null))}}function k(i){return i.draw_first=!0,i.configureOnline=function(t,e,s,r,a){this.setItemName(t,"",this),this.url=e,this.root_version=r,this.askey=s,this.draw_expr=a},i.configureTree=function(t){this.local_tree=t},i.showExtraButtons=function(t){const e=this.selectDom(),s=this.local_tree?.fEntries||0;e.select(".treedraw_more").remove(),e.select(".treedraw_buttons").node().innerHTML+=`Cut: <input class="treedraw_cut ui-corner-all ui-widget" style="width:8em;margin-left:5px" title="cut expression"></input>Opt: <input class="treedraw_opt ui-corner-all ui-widget" style="width:5em;margin-left:5px" title="histogram draw options"></input>Num: <input class="treedraw_number" type='number' min="0" max="${s}" step="1000" style="width:7em;margin-left:5px" title="number of entries to process (default all)"></input>First: <input class="treedraw_first" type='number' min="0" max="${s}" step="1000" style="width:7em;margin-left:5px" title="first entry to process (default first)"></input><button class="treedraw_clear" title="Clear drawing">Clear</button>`,e.select(".treedraw_exe").on("click",()=>this.performDraw()),e.select(".treedraw_cut").property("value",t?.parse_cut||"").on("change",()=>this.performDraw()),e.select(".treedraw_opt").property("value",t?.drawopt||"").on("change",()=>this.performDraw()),e.select(".treedraw_number").attr("value",t?.numentries||""),e.select(".treedraw_first").attr("value",t?.firstentry||""),e.select(".treedraw_clear").on("click",()=>w(this.drawid))},i.showPlayer=function(t){const e=this.selectDom();this.drawid="jsroot_tree_player_"+m.id_counter+++"_draw";const s=t?.parse_cut||t?.numentries||t?.firstentry;e.html(`<div style="display:flex; flex-flow:column; height:100%; width:100%;"><div class="treedraw_buttons" style="flex: 0 1 auto;margin-top:0.2em;"><button class="treedraw_exe" title="Execute draw expression" style="margin-left:0.5em">Draw</button>Expr:<input class="treedraw_varexp treedraw_varexp_info" style="width:12em;margin-left:5px" title="draw expression"></input><label class="treedraw_varexp_info">ⓘ</label><button class="treedraw_more">More</button></div><div style="flex: 0 1 auto"><hr/></div><div id="${this.drawid}" style="flex: 1 1 auto; overflow:hidden;"></div></div>`),this.setTopPainter(),this.local_tree&&e.select(".treedraw_buttons").attr("title","Tree draw player for: "+this.local_tree.fName),e.select(".treedraw_exe").on("click",()=>this.performDraw()),e.select(".treedraw_varexp").attr("value",t?.parse_expr||this.draw_expr||"px:py").on("change",()=>this.performDraw()),e.select(".treedraw_varexp_info").attr("title",`Example of valid draw expressions:
2
2
  px - 1-dim draw
3
3
  px:py - 2-dim draw
4
4
  px:py:pz - 3-dim draw
@@ -1 +1 @@
1
- import{a7 as M,aR as P,aE as m,a0 as w,aS as B}from"./ndmvr-aframe-core-Cw91_9_Y.js";class C extends M{updateObject(e){return this.matchObjectType(e)?(this.assignObject(e),!0):!1}getMenuHeader(){return this.getObject()?.fClassName||"TWebPainting"}fillContextMenu(e){const t=this.getMenuHeader();return e.header(t,`${P}${t}.html`),!0}handleMouseClick(e){const t=this.getPadPainter(),n=t?.getPadRect();if(t&&n&&this.getSnapId()){const a=m(e,this.getG().node());t.selectObjectPainter(this,{x:a[0]+n.x,y:a[1]+n.y})}}async redraw(){const e=this.getObject(),t=this.getAxisToSvgFunc();if(!e?.fOper||!t)return this;let n=0,a={},x=null,y="none",g="",u,p,i;const b=this.createG(),o=e.fOper.split(";"),l=r=>{if(r!==y&&(x&&(x.attr("d",g),g="",x=null,y="none"),!!r))switch(y=r,x=b.append("svg:path").attr("d",""),r){case"f":x.call(this.fillatt.func);break;case"l":x.call(this.lineatt.func).style("fill","none");break;case"m":x.call(this.markeratt.func);break}},T=(r,h)=>{let s=0;const c={_typename:"any"};for(let f=0;f<h.length;++f){const d=r.indexOf(":",s+1);c[h[f]]=parseInt(r.slice(s+1,d>s?d:void 0)),s=d}return c},S=r=>{for(;++r<o.length;)switch(u=o[r][0],u){case"z":this.createAttLine({attr:T(o[r],["fLineColor","fLineStyle","fLineWidth"]),force:!0}),l();continue;case"y":this.createAttFill({attr:T(o[r],["fFillColor","fFillStyle"]),force:!0}),l();continue;case"x":this.createAttMarker({attr:T(o[r],["fMarkerColor","fMarkerStyle","fMarkerSize"]),force:!0}),l();continue;case"o":a=T(o[r],["fTextColor","fTextFont","fTextSize","fTextAlign","fTextAngle"]),a.fTextSize<0&&(a.fTextSize*=-.001),l();continue;case"r":case"b":{l(u==="b"?"f":"l");const h=t.x(e.fBuf[n++]),s=t.y(e.fBuf[n++]),c=t.x(e.fBuf[n++]),f=t.y(e.fBuf[n++]);g+=`M${h},${s}h${c-h}v${f-s}h${h-c}z`;continue}case"l":case"f":{for(l(u),p=parseInt(o[r].slice(1)),i=0;i<p;++i)g+=`${i>0?"L":"M"}${t.x(e.fBuf[n++])},${t.y(e.fBuf[n++])}`;u==="f"&&(g+="Z");continue}case"m":{for(l(u),p=parseInt(o[r].slice(1)),this.markeratt.resetPos(),i=0;i<p;++i)g+=this.markeratt.create(t.x(e.fBuf[n++]),t.y(e.fBuf[n++]));continue}case"h":case"t":{if(a.fTextSize){l();const h=a.fTextSize>1?a.fTextSize:this.getPadPainter().getPadHeight()*a.fTextSize,s=b.append("svg:g");return this.startTextDrawingAsync(a.fTextFont,h,s).then(()=>{let c=o[r].slice(1),f=a.fTextAngle;if(f>=360&&(f-=Math.floor(f/360)*360),u==="h"){let d="";for(i=0;i<c.length;i+=2)d+=String.fromCharCode(parseInt(c.slice(i,i+2),16));c=d}return this.drawText({align:a.fTextAlign,x:t.x(e.fBuf[n++]),y:t.y(e.fBuf[n++]),rotate:-f,text:c,color:B(a.fTextColor),latex:0,draw_g:s}),this.finishTextDrawing(s)}).then(()=>S(r))}continue}default:console.log(`unsupported operation ${u}`)}return Promise.resolve(!0)};return S(-1).then(()=>(l(),w(this),this.isBatchMode()||b.on("click",r=>this.handleMouseClick(r)),this))}static async draw(e,t){const n=new C(e,t);return n.addToPadPrimitives(),n.redraw()}}export{C as TWebPaintingPainter};
1
+ import{a7 as M,aR as P,aE as m,a0 as w,aS as B}from"./ndmvr-aframe-core-DEHQ38JB.js";class C extends M{updateObject(e){return this.matchObjectType(e)?(this.assignObject(e),!0):!1}getMenuHeader(){return this.getObject()?.fClassName||"TWebPainting"}fillContextMenu(e){const t=this.getMenuHeader();return e.header(t,`${P}${t}.html`),!0}handleMouseClick(e){const t=this.getPadPainter(),n=t?.getPadRect();if(t&&n&&this.getSnapId()){const a=m(e,this.getG().node());t.selectObjectPainter(this,{x:a[0]+n.x,y:a[1]+n.y})}}async redraw(){const e=this.getObject(),t=this.getAxisToSvgFunc();if(!e?.fOper||!t)return this;let n=0,a={},x=null,y="none",g="",u,p,i;const b=this.createG(),o=e.fOper.split(";"),l=r=>{if(r!==y&&(x&&(x.attr("d",g),g="",x=null,y="none"),!!r))switch(y=r,x=b.append("svg:path").attr("d",""),r){case"f":x.call(this.fillatt.func);break;case"l":x.call(this.lineatt.func).style("fill","none");break;case"m":x.call(this.markeratt.func);break}},T=(r,h)=>{let s=0;const c={_typename:"any"};for(let f=0;f<h.length;++f){const d=r.indexOf(":",s+1);c[h[f]]=parseInt(r.slice(s+1,d>s?d:void 0)),s=d}return c},S=r=>{for(;++r<o.length;)switch(u=o[r][0],u){case"z":this.createAttLine({attr:T(o[r],["fLineColor","fLineStyle","fLineWidth"]),force:!0}),l();continue;case"y":this.createAttFill({attr:T(o[r],["fFillColor","fFillStyle"]),force:!0}),l();continue;case"x":this.createAttMarker({attr:T(o[r],["fMarkerColor","fMarkerStyle","fMarkerSize"]),force:!0}),l();continue;case"o":a=T(o[r],["fTextColor","fTextFont","fTextSize","fTextAlign","fTextAngle"]),a.fTextSize<0&&(a.fTextSize*=-.001),l();continue;case"r":case"b":{l(u==="b"?"f":"l");const h=t.x(e.fBuf[n++]),s=t.y(e.fBuf[n++]),c=t.x(e.fBuf[n++]),f=t.y(e.fBuf[n++]);g+=`M${h},${s}h${c-h}v${f-s}h${h-c}z`;continue}case"l":case"f":{for(l(u),p=parseInt(o[r].slice(1)),i=0;i<p;++i)g+=`${i>0?"L":"M"}${t.x(e.fBuf[n++])},${t.y(e.fBuf[n++])}`;u==="f"&&(g+="Z");continue}case"m":{for(l(u),p=parseInt(o[r].slice(1)),this.markeratt.resetPos(),i=0;i<p;++i)g+=this.markeratt.create(t.x(e.fBuf[n++]),t.y(e.fBuf[n++]));continue}case"h":case"t":{if(a.fTextSize){l();const h=a.fTextSize>1?a.fTextSize:this.getPadPainter().getPadHeight()*a.fTextSize,s=b.append("svg:g");return this.startTextDrawingAsync(a.fTextFont,h,s).then(()=>{let c=o[r].slice(1),f=a.fTextAngle;if(f>=360&&(f-=Math.floor(f/360)*360),u==="h"){let d="";for(i=0;i<c.length;i+=2)d+=String.fromCharCode(parseInt(c.slice(i,i+2),16));c=d}return this.drawText({align:a.fTextAlign,x:t.x(e.fBuf[n++]),y:t.y(e.fBuf[n++]),rotate:-f,text:c,color:B(a.fTextColor),latex:0,draw_g:s}),this.finishTextDrawing(s)}).then(()=>S(r))}continue}default:console.log(`unsupported operation ${u}`)}return Promise.resolve(!0)};return S(-1).then(()=>(l(),w(this),this.isBatchMode()||b.on("click",r=>this.handleMouseClick(r)),this))}static async draw(e,t){const n=new C(e,t);return n.addToPadPrimitives(),n.redraw()}}export{C as TWebPaintingPainter};
@@ -1 +1 @@
1
- import{am as m,an as g,ao as u,a5 as o,ap as c}from"./ndmvr-aframe-core-Cw91_9_Y.js";import{d as l}from"./TPolyMarker3D-DYlLB9Ww.js";function x(n){const t=n.getFramePainter();if(!t?.mode3d||!n.getObject())return null;if(t?.toplevel)return t;const r=n.getMainPainter();return r&&!o(r.drawExtras)?null:(r?Promise.resolve(r):c(n)).then(i=>{const a=n.getPadPainter();return a&&(a.options._disable_dragging=!0),i.options.dummy&&o(n.get3DBox)&&i.extendCustomBoundingBox(n.get3DBox()),i.drawExtras(n.getObject(),"",!0,!0)})}function f(){const n=this.getObject();if(!n?.fP.length)return null;const t={min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}};for(let r=0;r<n.fP.length;r+=3){const e=n.fP[r],i=n.fP[r+1],a=n.fP[r+2];r===0?(t.min.x=t.max.x=e,t.min.y=t.max.y=i,t.min.z=t.max.z=a):(t.min.x=Math.min(e,t.min.x),t.max.x=Math.max(e,t.max.x),t.min.y=Math.min(i,t.min.y),t.max.y=Math.max(i,t.max.y),t.min.z=Math.min(a,t.min.z),t.max.z=Math.max(a,t.max.z))}return t}async function d(){this.get3DBox=f;const n=x(this);return!m(n)||!n.grx||!n.gry||!n.grz?n:(this.$fp=n,l.bind(this)())}async function D(){this.get3DBox=f;const n=this.getObject(),t=x(this);if(!m(t)||!t.grx||!t.gry||!t.grz)return t;const r=3*n.fN,e=n.fP,i=[];for(let s=3;s<r;s+=3)i.push(t.grx(e[s-3]),t.gry(e[s-2]),t.grz(e[s-1]),t.grx(e[s]),t.gry(e[s+1]),t.grz(e[s+2]));const a=g(i,u(this,n));return t.add3DMesh(a,this,!0),t.render3D(100),!0}export{D as drawPolyLine3D,d as drawPolyMarker3D};
1
+ import{am as m,an as g,ao as u,a5 as o,ap as c}from"./ndmvr-aframe-core-DEHQ38JB.js";import{d as l}from"./TPolyMarker3D-BaWOSDy6.js";function x(n){const t=n.getFramePainter();if(!t?.mode3d||!n.getObject())return null;if(t?.toplevel)return t;const r=n.getMainPainter();return r&&!o(r.drawExtras)?null:(r?Promise.resolve(r):c(n)).then(i=>{const a=n.getPadPainter();return a&&(a.options._disable_dragging=!0),i.options.dummy&&o(n.get3DBox)&&i.extendCustomBoundingBox(n.get3DBox()),i.drawExtras(n.getObject(),"",!0,!0)})}function f(){const n=this.getObject();if(!n?.fP.length)return null;const t={min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}};for(let r=0;r<n.fP.length;r+=3){const e=n.fP[r],i=n.fP[r+1],a=n.fP[r+2];r===0?(t.min.x=t.max.x=e,t.min.y=t.max.y=i,t.min.z=t.max.z=a):(t.min.x=Math.min(e,t.min.x),t.max.x=Math.max(e,t.max.x),t.min.y=Math.min(i,t.min.y),t.max.y=Math.max(i,t.max.y),t.min.z=Math.min(a,t.min.z),t.max.z=Math.max(a,t.max.z))}return t}async function d(){this.get3DBox=f;const n=x(this);return!m(n)||!n.grx||!n.gry||!n.grz?n:(this.$fp=n,l.bind(this)())}async function D(){this.get3DBox=f;const n=this.getObject(),t=x(this);if(!m(t)||!t.grx||!t.gry||!t.grz)return t;const r=3*n.fN,e=n.fP,i=[];for(let s=3;s<r;s+=3)i.push(t.grx(e[s-3]),t.gry(e[s-2]),t.grz(e[s-1]),t.grx(e[s]),t.gry(e[s+1]),t.grz(e[s+2]));const a=g(i,u(this,n));return t.add3DMesh(a,this,!0),t.render3D(100),!0}export{D as drawPolyLine3D,d as drawPolyMarker3D};
@@ -1 +1 @@
1
- import{b_ as u,aK as M,aW as g,aT as c}from"./ndmvr-aframe-core-Cw91_9_Y.js";function m(a,h){a.$math=u;let e=a.fTitle,r=!1,l="[";if(e==="gaus"&&(e="gaus(0)"),M(a.fFormula?.fFormula)&&(a.fFormula.fFormula.indexOf("[](double*x,double*p)")===0?(r=!0,l="p[",e=a.fFormula.fFormula.slice(21)):(e=a.fFormula.fFormula,l="[p"),a.fFormula.fClingParameters&&a.fFormula.fParams&&a.fFormula.fParams.forEach(t=>{const i=new RegExp(`(\\[${t.first}\\])`,"g"),n=a.fFormula.fClingParameters[t.second];e=e.replace(i,n<0?`(${n})`:n)})),!e)return!h||a.fSave?.length>2;if(a.formulas?.forEach(t=>{e=e.replaceAll(t.fName,t.fTitle)}),e=e.replace(/\b(TMath::SinH)\b/g,"Math.sinh").replace(/\b(TMath::CosH)\b/g,"Math.cosh").replace(/\b(TMath::TanH)\b/g,"Math.tanh").replace(/\b(TMath::ASinH)\b/g,"Math.asinh").replace(/\b(TMath::ACosH)\b/g,"Math.acosh").replace(/\b(TMath::ATanH)\b/g,"Math.atanh").replace(/\b(TMath::ASin)\b/g,"Math.asin").replace(/\b(TMath::ACos)\b/g,"Math.acos").replace(/\b(TMath::Atan)\b/g,"Math.atan").replace(/\b(TMath::ATan2)\b/g,"Math.atan2").replace(/\b(sin|SIN|TMath::Sin)\b/g,"Math.sin").replace(/\b(cos|COS|TMath::Cos)\b/g,"Math.cos").replace(/\b(tan|TAN|TMath::Tan)\b/g,"Math.tan").replace(/\b(exp|EXP|TMath::Exp)\b/g,"Math.exp").replace(/\b(log|LOG|TMath::Log)\b/g,"Math.log").replace(/\b(log10|LOG10|TMath::Log10)\b/g,"Math.log10").replace(/\b(pow|POW|TMath::Power)\b/g,"Math.pow").replace(/\b(pi|PI)\b/g,"Math.PI").replace(/\b(abs|ABS|TMath::Abs)\b/g,"Math.abs").replace(/\bsqrt\(/g,"Math.sqrt(").replace(/\bxygaus\(/g,"this.$math.gausxy(this, x, y, ").replace(/\bgaus\(/g,"this.$math.gaus(this, x, ").replace(/\bgausn\(/g,"this.$math.gausn(this, x, ").replace(/\bexpo\(/g,"this.$math.expo(this, x, ").replace(/\blandau\(/g,"this.$math.landau(this, x, ").replace(/\blandaun\(/g,"this.$math.landaun(this, x, ").replace(/\b(TMath::|ROOT::Math::)/g,"this.$math."),e.match(/^pol[0-9]$/)&&parseInt(e[3])===a.fNpar-1){e="[0]";for(let t=1;t<a.fNpar;++t)e+=` + [${t}] * `+(t===1?"x":`Math.pow(x,${t})`)}if(e.match(/^chebyshev[0-9]$/)&&parseInt(e[9])===a.fNpar-1){e=`this.$math.ChebyshevN(${a.fNpar-1}, x, `;for(let t=0;t<a.fNpar;++t)e+=(t===0?"[":", ")+`[${t}]`;e+="])"}for(let t=0;t<a.fNpar;++t)e=e.replaceAll(l+t+"]",`(${a.GetParValue(t)})`);for(let t=2;t<10;++t)e=e.replaceAll(`x^${t}`,`Math.pow(x,${t})`);return r?(e=e.replace(/x\[0\]/g,"x"),a._typename===g?(e=e.replace(/x\[1\]/g,"y"),e=e.replace(/x\[2\]/g,"z"),a.evalPar=new Function("x","y","z",e).bind(a)):a._typename===c?(e=e.replace(/x\[1\]/g,"y"),a.evalPar=new Function("x","y",e).bind(a)):a.evalPar=new Function("x",e).bind(a)):a._typename===g?a.evalPar=new Function("x","y","z","return "+e).bind(a):a._typename===c?a.evalPar=new Function("x","y","return "+e).bind(a):a.evalPar=new Function("x","return "+e).bind(a),!0}function x(a,h){const e=a.fSave.length-3,r=a.fSave[e+1],l=a.fSave[e+2],t=(l-r)/e;if(h<r)return a.fSave[0];if(h>l)return a.fSave[e];const i=Math.min(e-1,Math.floor((h-r)/t));let n=r+i*t,f=n+t,s=a.fSave[i],p=a.fSave[i+1];return!Number.isFinite(s)&&i<e-1?(n+=t,f+=t,s=p,p=a.fSave[i+2]):!Number.isFinite(p)&&i>0&&(f-=t,n-=t,p=s,s=a.fSave[i-1]),(f*s-n*p+h*(p-s))/t}function T(a,h,e=void 0){if(!a)return 0;let r=!1;if(!e&&!a.evalPar)try{m(a)||(r=!0)}catch{r=!0}if(a.evalPar&&!r)try{return a.evalPar(h)}catch{r=!0}const l=a.fSave.length-3;return l<2||a.fSave[l+1]===a.fSave[l+2]?0:x(a,h)}export{x as _,T as g,m as p};
1
+ import{b_ as u,aK as M,aW as g,aT as c}from"./ndmvr-aframe-core-DEHQ38JB.js";function m(a,h){a.$math=u;let e=a.fTitle,r=!1,l="[";if(e==="gaus"&&(e="gaus(0)"),M(a.fFormula?.fFormula)&&(a.fFormula.fFormula.indexOf("[](double*x,double*p)")===0?(r=!0,l="p[",e=a.fFormula.fFormula.slice(21)):(e=a.fFormula.fFormula,l="[p"),a.fFormula.fClingParameters&&a.fFormula.fParams&&a.fFormula.fParams.forEach(t=>{const i=new RegExp(`(\\[${t.first}\\])`,"g"),n=a.fFormula.fClingParameters[t.second];e=e.replace(i,n<0?`(${n})`:n)})),!e)return!h||a.fSave?.length>2;if(a.formulas?.forEach(t=>{e=e.replaceAll(t.fName,t.fTitle)}),e=e.replace(/\b(TMath::SinH)\b/g,"Math.sinh").replace(/\b(TMath::CosH)\b/g,"Math.cosh").replace(/\b(TMath::TanH)\b/g,"Math.tanh").replace(/\b(TMath::ASinH)\b/g,"Math.asinh").replace(/\b(TMath::ACosH)\b/g,"Math.acosh").replace(/\b(TMath::ATanH)\b/g,"Math.atanh").replace(/\b(TMath::ASin)\b/g,"Math.asin").replace(/\b(TMath::ACos)\b/g,"Math.acos").replace(/\b(TMath::Atan)\b/g,"Math.atan").replace(/\b(TMath::ATan2)\b/g,"Math.atan2").replace(/\b(sin|SIN|TMath::Sin)\b/g,"Math.sin").replace(/\b(cos|COS|TMath::Cos)\b/g,"Math.cos").replace(/\b(tan|TAN|TMath::Tan)\b/g,"Math.tan").replace(/\b(exp|EXP|TMath::Exp)\b/g,"Math.exp").replace(/\b(log|LOG|TMath::Log)\b/g,"Math.log").replace(/\b(log10|LOG10|TMath::Log10)\b/g,"Math.log10").replace(/\b(pow|POW|TMath::Power)\b/g,"Math.pow").replace(/\b(pi|PI)\b/g,"Math.PI").replace(/\b(abs|ABS|TMath::Abs)\b/g,"Math.abs").replace(/\bsqrt\(/g,"Math.sqrt(").replace(/\bxygaus\(/g,"this.$math.gausxy(this, x, y, ").replace(/\bgaus\(/g,"this.$math.gaus(this, x, ").replace(/\bgausn\(/g,"this.$math.gausn(this, x, ").replace(/\bexpo\(/g,"this.$math.expo(this, x, ").replace(/\blandau\(/g,"this.$math.landau(this, x, ").replace(/\blandaun\(/g,"this.$math.landaun(this, x, ").replace(/\b(TMath::|ROOT::Math::)/g,"this.$math."),e.match(/^pol[0-9]$/)&&parseInt(e[3])===a.fNpar-1){e="[0]";for(let t=1;t<a.fNpar;++t)e+=` + [${t}] * `+(t===1?"x":`Math.pow(x,${t})`)}if(e.match(/^chebyshev[0-9]$/)&&parseInt(e[9])===a.fNpar-1){e=`this.$math.ChebyshevN(${a.fNpar-1}, x, `;for(let t=0;t<a.fNpar;++t)e+=(t===0?"[":", ")+`[${t}]`;e+="])"}for(let t=0;t<a.fNpar;++t)e=e.replaceAll(l+t+"]",`(${a.GetParValue(t)})`);for(let t=2;t<10;++t)e=e.replaceAll(`x^${t}`,`Math.pow(x,${t})`);return r?(e=e.replace(/x\[0\]/g,"x"),a._typename===g?(e=e.replace(/x\[1\]/g,"y"),e=e.replace(/x\[2\]/g,"z"),a.evalPar=new Function("x","y","z",e).bind(a)):a._typename===c?(e=e.replace(/x\[1\]/g,"y"),a.evalPar=new Function("x","y",e).bind(a)):a.evalPar=new Function("x",e).bind(a)):a._typename===g?a.evalPar=new Function("x","y","z","return "+e).bind(a):a._typename===c?a.evalPar=new Function("x","y","return "+e).bind(a):a.evalPar=new Function("x","return "+e).bind(a),!0}function x(a,h){const e=a.fSave.length-3,r=a.fSave[e+1],l=a.fSave[e+2],t=(l-r)/e;if(h<r)return a.fSave[0];if(h>l)return a.fSave[e];const i=Math.min(e-1,Math.floor((h-r)/t));let n=r+i*t,f=n+t,s=a.fSave[i],p=a.fSave[i+1];return!Number.isFinite(s)&&i<e-1?(n+=t,f+=t,s=p,p=a.fSave[i+2]):!Number.isFinite(p)&&i>0&&(f-=t,n-=t,p=s,s=a.fSave[i-1]),(f*s-n*p+h*(p-s))/t}function T(a,h,e=void 0){if(!a)return 0;let r=!1;if(!e&&!a.evalPar)try{m(a)||(r=!0)}catch{r=!0}if(a.evalPar&&!r)try{return a.evalPar(h)}catch{r=!0}const l=a.fSave.length-3;return l<2||a.fSave[l+1]===a.fSave[l+2]?0:x(a,h)}export{x as _,T as g,m as p};
@@ -1 +1 @@
1
- import{bu as ve,aA as Oe,aw as m,bs as ge,ax as ae,bv as Ee,an as ie,ao as He,a5 as le,bw as Ve,bx as $e,by as Ne,bz as Ze,bA as we,bB as Ge,bC as Ye,bD as Xe,bE as Ue,bF as We,bG as Ke,bH as qe}from"./ndmvr-aframe-core-Cw91_9_Y.js";import{createLatexGeometry as ze}from"./latex3d-ITrfFgp8.js";import{k as Le,a as Je,b as Qe,c as et,d as tt}from"./THistPainter-Df-RmCQH.js";import{b as je,c as it}from"./TH2Painter-DHaL_lR_.js";function Ae(e,r,i=!1,a=!1){let t;if(r?.children)for(let h=0;h<r.children.length&&(t=r.children[h],!t.axis_draw);++h)t=void 0;if(!t)return;if(!e){r.remove(t);return}const o=e.position;let d=1;o.x<0&&o.y>=0?d=2:o.x>=0&&o.y>=0?d=3:o.x>=0&&o.y<0&&(d=4);const x=(h,_)=>(h<=d&&(h+=4),h>d&&h<d+_),n=h=>{for(let _=0;_<h.children?.length;++_)h.children[_].zoom!==void 0&&(h.children[_].zoom_disabled=!h.visible)};for(let h=0;h<t.children.length;++h){const _=t.children[h];if(_.grid)_.visible=a&&x(_.grid,3);else if(_.zid)_.visible=x(_.zid,2),n(_);else if(_.xyid)_.visible=x(_.xyid,3),n(_);else if(_.xyboxid){let B=5,z=0;a&&!i?(B=3,z=-2):i&&!a?B=3:!i&&!a&&(B=_.bottom?3:0),_.visible=x(_.xyboxid+z,B),!_.visible&&_.bottom&&a&&(_.visible=x(_.xyboxid,3))}else if(_.zboxid){let B=2,z=0;i&&a?B=5:a&&!i?B=4:!a&&i&&(z=-2,B=4),_.visible=x(_.zboxid+z,B)}}}function Be(e,r,i,a){if(e.options.System===Le)return r;const t=e.getFramePainter();let o=1/t.size_x3d,d=1/t.size_y3d;if(i&&a&&(o*=i/(i-1),d*=a/(a-1)),e.options.System===Je)for(let x=0;x<r.length;x+=3){const n=(1-r[x]*o)*Math.PI,h=.5+.5*r[x+1]*d;r[x]=Math.cos(n)*h*t.size_x3d,r[x+1]=Math.sin(n)*h*t.size_y3d}else if(e.options.System===Qe)for(let x=0;x<r.length;x+=3){const n=(1-r[x]*o)*Math.PI,h=.5+r[x+2]/t.size_z3d/4;r[x]=Math.cos(n)*h*t.size_x3d,r[x+2]=(1+Math.sin(n)*h)*t.size_z3d}else if(e.options.System===et)for(let x=0;x<r.length;x+=3){const n=(1+r[x]*o)*Math.PI,h=r[x+1]*d*Math.PI,_=.5+r[x+2]/t.size_z3d/4;r[x]=_*Math.cos(h)*Math.cos(n)*t.size_x3d,r[x+1]=_*Math.cos(h)*Math.sin(n)*t.size_y3d,r[x+2]=(1+_*Math.sin(h))*t.size_z3d}else if(e.options.System===tt)for(let x=0;x<r.length;x+=3){const n=(1-r[x]*o)*Math.PI,h=r[x+1]*d*Math.PI,_=.5+r[x+2]/t.size_z3d/4;r[x]=_*Math.cos(n)*t.size_x3d,r[x+1]=_*Math.sin(h)/Math.cos(h)*t.size_y3d/2,r[x+2]=(1+_*Math.sin(n))*t.size_z3d}return r}function Ce(e,r,i,a,t){const o=new m.BufferGeometry;return e.options.System===Le?(o.setAttribute("position",new m.BufferAttribute(r,3)),i?o.setAttribute("normal",new m.BufferAttribute(i,3)):o.computeVertexNormals()):(Be(e,r,a,t),o.setAttribute("position",new m.BufferAttribute(r,3)),o.computeVertexNormals()),o}function Ie(e,r){e.camera&&(e.scene.remove(e.camera),we(e.camera),delete e.camera),r?e.camera=new m.OrthographicCamera(-1.3*e.size_x3d,1.3*e.size_x3d,2.3*e.size_z3d,-.7*e.size_z3d,.001,40*e.size_z3d):e.camera=new m.PerspectiveCamera(45,e.scene_width/e.scene_height,1,40*e.size_z3d),e.camera.up.set(0,0,1),e.pointLight=new m.DirectionalLight(16777215,3),e.pointLight.position.set(e.size_x3d/2,e.size_y3d/2,e.size_z3d/2),e.camera.add(e.pointLight),e.lookat=new m.Vector3(0,0,r?.3*e.size_z3d:.8*e.size_z3d),e.scene.add(e.camera)}function pe(e,r){const i=e.getPadPainter()?.getRootPad(!0),a=e.camera.isOrthographicCamera?1:1.4;let t=Math.max(.75*e.size_x3d,e.size_z3d),o=Math.max(.75*e.size_y3d,e.size_z3d),d=null;if(r&&(d=new m.Vector3,t===o?d.set(-1.6*t,-3.5*o,a*e.size_z3d):t>o?d.set(-2*t,-3.5*o,a*e.size_z3d):d.set(-3.5*t,-2*o,a*e.size_z3d)),i&&(r||!e.zoomChangedInteractive())&&Number.isFinite(i.fTheta)&&Number.isFinite(i.fPhi)&&(i.fTheta!==e.camera_Theta||i.fPhi!==e.camera_Phi)){d||(d=new m.Vector3),t=3*Math.max(e.size_x3d,e.size_z3d),o=3*Math.max(e.size_y3d,e.size_z3d);const x=(270-i.fPhi)/180*Math.PI,n=(i.fTheta-10)/180*Math.PI;d.set(t*Math.cos(x)*Math.cos(n),o*Math.sin(x)*Math.cos(n),e.size_z3d+(a-.9)*(t+o)*Math.sin(n))}return d}function De(e,r){const i=pe(e,r);if(i&&(e.camera.position.copy(i),r=!0),r&&e.camera.lookAt(e.lookat),r&&e.camera.isOrthographicCamera&&e.scene_width&&e.scene_height){const a=e.scene_width/e.scene_height,t=e.camera.right-e.camera.left,o=e.camera.top-e.camera.bottom;if(a>t/o){const d=(e.camera.right+e.camera.left)/2;e.camera.left=d-o*a/2,e.camera.right=d+o*a/2}else{const d=(e.camera.top+e.camera.bottom)/2;e.camera.top=d+t/a/2,e.camera.bottom=d-t/a/2}}e.camera.updateProjectionMatrix()}function st(e){const r=e.camera.position,i=e.lookat,a=r.distanceTo(i),t=Math.sqrt((r.x-i.x)**2+(r.y-i.y)**2),o=Math.atan2((r.z-i.z)/a,t/a)/Math.PI*180,d=270-Math.atan2((r.y-i.y)/t,(r.x-i.x)/t)/Math.PI*180,x=e.getPadPainter()?.getRootPad(!0);e.camera_Phi=d>=360?d-360:d,e.camera_Theta=o,x&&Number.isFinite(e.camera_Phi)&&Number.isFinite(e.camera_Theta)&&(x.fPhi=e.camera_Phi,x.fTheta=e.camera_Theta)}function Re(e){e.control=qe(e,e.camera,e.scene,e.renderer,e.lookat);const r=e,i=e.getMainPainter();if(e.access3dKind()===ve.Embed3D.Embed){const a=e.getCanvPainter()?.getPadScale();a&&e.control.tooltip?.setScale(a)}e.control.processMouseMove=function(a){let t=null,o=null,d=null;const x=r.isTooltipAllowed();for(let n=0;n<a.length;++n)if(x&&le(a[n].object?.tooltip)){if(t=a[n].object.tooltip(a[n]),t){o=a[n].object;break}}else a[n].object?.zoom&&!d&&(d=a[n].object);if(t&&!t.use_itself){const n=1e-4*r.size_x3d,h=1e-4*r.size_y3d,_=1e-4*r.size_z3d;(t.x1>t.x2||t.y1>t.y2||t.z1>t.z2)&&console.warn("check 3D hints coordinates"),t.x1-=n,t.x2+=n,t.y1-=h,t.y2+=h,t.z1-=_,t.z2+=_}if(r.highlightBin3D(t,o),!t&&d&&le(r.get3dZoomCoord)){let n=d.zoom;const h=d.globalIntersect(this.raycaster),_=r.get3dZoomCoord(h,n);return n==="z"&&d.use_y_for_z&&(n="y"),{name:n,title:"axis object",line:n+" : "+r.axisAsText(n,_),only_status:!0}}return t?.lines?t:""},e.control.processMouseLeave=function(){r.highlightBin3D(null)},e.control.contextMenu=function(a,t){let o="painter",d=i;if(t)for(let n=0;n<t.length;++n){const h=t[n].object;if(h.zoom){o=h.zoom,d=null;break}if(le(h.painter?.fillContextMenu)){d=h.painter;break}}const x=i.getFramePainter();le(x?.showContextMenu)&&x.showContextMenu(o,a,d)}}function nt(e,r,i,a){if(e===-1){if(!this.mode3d)return;if(!le(this.clear3dCanvas)){console.error(`Strange, why mode3d=${this.mode3d} is configured!`);return}const d=r?this.toplevel:null;return d&&(this.scene?.remove(d),this.toplevel=null),Ae(null,this.toplevel),this.clear3dCanvas(),we(this.scene),this.control?.cleanup(),Ge(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),this.mode3d=!1,this.getG()&&!r&&this.createFrameG(),d}if(this.mode3d=!0,"toplevel"in this){this.scene.remove(this.toplevel),we(this.toplevel),delete this.tooltip_mesh,delete this.toplevel,this.control?.hideTooltip();const d=new m.Object3D;return this.scene.add(d),this.toplevel=d,this.resize3D(),De(this,!1),Promise.resolve(!0)}e=Ye(e,this.isBatchMode()),Xe(this);const t=this.getSizeFor3d(void 0,e);this.size_z3d=100,this.x3dscale=r||1,this.y3dscale=i||1;const o=t.height>10&&t.width>10?Math.round(t.width/t.height*this.size_z3d):this.size_z3d;return this.size_x3d=o*this.x3dscale,this.size_y3d=o*this.y3dscale,Ue().then(()=>(this.scene=new m.Scene,this.toplevel=new m.Object3D,this.scene.add(this.toplevel),this.scene_width=t.width,this.scene_height=t.height,this.scene_x=t.x??0,this.scene_y=t.y??0,this.camera_Phi=30,this.camera_Theta=30,Ie(this,a),De(this,!0),We(this.scene_width,this.scene_height,e))).then(d=>(this.renderer=d,d?(this.webgl=d.jsroot_render3d===ve.Render3D.WebGL,this.add3dCanvas(t,d.jsroot_dom,this.webgl),this.first_render_tm=0,this.enable_highlight=!1,!this.isBatchMode()&&this.webgl&&!Ke()&&Re(this),this):this))}function ot(e){let r=!1;this.control&&(this.control.cleanup(),delete this.control,r=!0),Ie(this,e),De(this,!0),r&&Re(this),this.render3D()}function at(e,r,i){if(e){if(!this.toplevel)return console.error("3D objects are not yet created in the frame");r&&i&&this.remove3DMeshes(r),this.toplevel.add(e),e.painter=r}}function rt(e){const r=[];if(!e||!this.toplevel)return r;for(let i=0;i<this.toplevel.children.length;++i){const a=this.toplevel.children[i];a.painter===e&&r.push(a)}return r}function ht(e){this.get3DMeshes(e).forEach(i=>{this.toplevel.remove(i),we(i)})}function lt(e){if(e===-1111){const t=Ve(),o=$e(!1,0);if(o.setSize(this.scene_width,this.scene_height),o.render(this.scene,this.camera),o.makeOuterHTML){const d=t.createElement("div");return d.innerHTML=o.makeOuterHTML(),d.childNodes[0]}return o.domElement}e===void 0&&(e=5);const r=this.isBatchMode();if(e>0&&!this.usesvg&&!r){this.render_tmout||(this.render_tmout=setTimeout(()=>this.render3D(0),e));return}if(this.render_tmout&&(clearTimeout(this.render_tmout),delete this.render_tmout),!this.renderer)return;Ne(this.renderer);const i=new Date;Ae(this.camera,this.toplevel,this.opt3d?.FrontBox,this.opt3d?.BackBox),this.renderer.render(this.scene,this.camera),Ze(this.renderer);const a=new Date;this.first_render_tm===0?(this.first_render_tm=a.getTime()-i.getTime(),this.enable_highlight=this.first_render_tm<1200&&this.isTooltipAllowed(),this.first_render_tm>500&&console.log(`three.js r${m.REVISION}, first render tm = ${this.first_render_tm}`)):st(this),this.processRender3D&&this.forEachPainter(t=>{le(t.handleRender3D)&&t.handleRender3D()},"objects")}function dt(){return this.renderer}function ct(){const e=this.getSizeFor3d(this.access3dKind());if(this.apply3dSize(e),this.scene_width===e.width&&this.scene_height===e.height||e.width<10||e.height<10)return!1;this.scene_width=e.width,this.scene_height=e.height,this.camera.aspect=this.scene_width/this.scene_height,this.camera.updateProjectionMatrix(),this.renderer.setSize(this.scene_width,this.scene_height);const r=e.height>10&&e.width>10?Math.round(e.width/e.height*this.size_z3d):this.size_z3d,i=r*this.x3dscale,a=r*this.y3dscale;return Math.abs(i-this.size_x3d)>.15*this.size_z3d||Math.abs(a-this.size_y3d)>.15*this.size_z3d?(this.size_x3d=i,this.size_y3d=a,this.control?.position0?.copy(pe(this,!0)),1):!0}function mt(e,r){const i=!e||e.x1===void 0||!this.enable_highlight;let a=!1,t=null,o=!0,d=this.getMainPainter();if((!d?.provideUserTooltip||!d?.hasUserTooltip())&&(d=null),this.tooltip_selfmesh&&(o=this.tooltip_selfmesh!==r,this.tooltip_selfmesh.material.color=this.tooltip_selfmesh.save_color,delete this.tooltip_selfmesh,a=!0),this.tooltip_mesh&&(t=this.tooltip_mesh,this.toplevel.remove(this.tooltip_mesh),delete this.tooltip_mesh,a=!0),i){a&&(this.render3D(),d?.provideUserTooltip(null));return}if(e.use_itself)r.save_color=r.material.color,r.material.color=new m.Color(e.color),this.tooltip_selfmesh=r,a=o;else{a=!0;const x=ge.Indexes,n=ge.Normals,h=ge.Vertices,_=new m.Color(e.color?e.color:16711680),B=e.opacity||1;let z,p;if(t)z=t.geometry.attributes.position.array,t.geometry.attributes.position.needsUpdate=!0,t.material.color=_,t.material.opacity=B;else{z=new Float32Array(x.length*3),p=new Float32Array(x.length*3);const C=new m.BufferGeometry;C.setAttribute("position",new m.BufferAttribute(z,3)),C.setAttribute("normal",new m.BufferAttribute(p,3));const D=new m.MeshBasicMaterial({color:_,opacity:B,vertexColors:!1});t=new m.Mesh(C,D)}e.x1===e.x2&&console.warn(`same tip X ${e.x1} ${e.x2}`),e.y1===e.y2&&console.warn(`same tip Y ${e.y1} ${e.y2}`),e.z1===e.z2&&(e.z2=e.z1+1e-4);for(let C=0,D=-3;C<x.length;++C){const F=h[x[C]];z[C*3]=e.x1+F.x*(e.x2-e.x1),z[C*3+1]=e.y1+F.y*(e.y2-e.y1),z[C*3+2]=e.z1+F.z*(e.z2-e.z1),p&&(C%6===0&&(D+=3),p[C*3]=n[D],p[C*3+1]=n[D+1],p[C*3+2]=n[D+2])}this.tooltip_mesh=t,this.toplevel.add(t),e.$painter&&e.$painter.options.System!==Le&&(Be(e.$painter,z),t.geometry.computeVertexNormals())}a&&this.render3D(),a&&e.$projection&&le(e.$painter?.redrawProjection)&&e.$painter.redrawProjection(e.ix-1,e.ix,e.iy-1,e.iy),a&&d?.getObject()&&d.provideUserTooltip({obj:d.getObject(),name:d.getObject().fName,bin:e.bin,cont:e.value,binx:e.ix,biny:e.iy,binz:e.iz,grx:(e.x1+e.x2)/2,gry:(e.y1+e.y2)/2,grz:(e.z1+e.z2)/2})}function xt(e){this.opt3d=e}function ft(e,r,i){i||(i={ndim:2}),i.drawany===!1?i.draw=!1:i.drawany=!0;const a=i.v7?null:this.getPadPainter()?.getRootPad(!0);let t=-this.size_x3d,o=this.size_x3d,d=-this.size_y3d,x=this.size_y3d,n=0,h=2*this.size_z3d,_=this.size_z3d,B=this.xmin,z=this.xmax,p=this.ymin,C=this.ymax,D=this.zmin,F=this.zmax,A=!1,N=!1;this.size_z3d||(t=this.xmin,o=this.xmax,d=this.ymin,x=this.ymax,n=this.zmin,h=this.zmax,_=h-n),"zoom_xmin"in this&&"zoom_xmax"in this&&this.zoom_xmin!==this.zoom_xmax&&(B=this.zoom_xmin,z=this.zoom_xmax),"zoom_ymin"in this&&"zoom_ymax"in this&&this.zoom_ymin!==this.zoom_ymax&&(p=this.zoom_ymin,C=this.zoom_ymax,A=!0),"zoom_zmin"in this&&"zoom_zmax"in this&&this.zoom_zmin!==this.zoom_zmax&&(D=this.zoom_zmin,F=this.zoom_zmax,N=!0),i.use_y_for_z&&(this.zmin=this.ymin,this.zmax=this.ymax,D=p,F=C,N=A,p=0,C=1),this.lego_zmin=D,this.lego_zmax=F,i.zmult!==void 0&&!N&&(F*=i.zmult),this.x_handle=new r(null,this.xaxis),i.v7?(this.x_handle.setPadPainter(this.getPadPainter()),this.x_handle.assignSnapId(this.getSnapId())):i.hist_painter&&this.x_handle.setHistPainter(i.hist_painter,"x"),this.x_handle.configureAxis("xaxis",this.xmin,this.xmax,B,z,!1,[t,o],{log:a?.fLogx??0,reverse:i.reverse_x,logcheckmin:!0}),this.x_handle.assignFrameMembers(this,"x"),this.x_handle.extractDrawAttributes(_),this.y_handle=new r(null,this.yaxis),i.v7?(this.y_handle.setPadPainter(this.getPadPainter()),this.y_handle.assignSnapId(this.getSnapId())):i.hist_painter&&this.y_handle.setHistPainter(i.hist_painter,"y"),this.y_handle.configureAxis("yaxis",this.ymin,this.ymax,p,C,!1,[d,x],{log:a&&!i.use_y_for_z?a.fLogy:0,reverse:i.reverse_y,logcheckmin:i.ndim>1}),this.y_handle.assignFrameMembers(this,"y"),this.y_handle.extractDrawAttributes(_),this.z_handle=new r(null,this.zaxis),i.v7?(this.z_handle.setPadPainter(this.getPadPainter()),this.z_handle.assignSnapId(this.getSnapId())):i.hist_painter&&this.z_handle.setHistPainter(i.hist_painter,"z"),this.z_handle.configureAxis("zaxis",this.zmin,this.zmax,D,F,!1,[n,h],{value_axis:i.ndim===1||i.ndim===2,log:(i.use_y_for_z||i.ndim===2?a?.fLogv:void 0)??a?.fLogz??0,reverse:i.reverse_z,logcheckmin:i.ndim>2}),this.z_handle.assignFrameMembers(this,"z"),this.z_handle.extractDrawAttributes(_),this.setRootPadRange(a,!0);const E={},v={},w=this.x_handle.createTicks(!1,!0),g=this.y_handle.createTicks(!1,!0),L=this.z_handle.createTicks(!1,!0);let y=1;function I(s,l){const c=(l==="ticks"?s.ticksColor:s.lineatt.color)||"black",M=l==="ticks"?s.ticksWidth:s.lineatt.width,f=`${c}_${M}`;return v[f]||(v[f]=new m.LineBasicMaterial(ae(c,{linewidth:M,vertexColors:!1}))),v[f]}function T(s,l,c){const M=c||(l==="title"?s.titleFont?.color:s.labelsFont?.color)||"black";return E[M]||(E[M]=new m.MeshBasicMaterial(ae(M,{vertexColors:!1}))),E[M]}const k=new m.Object3D;k.axis_draw=!0,e.add(k);let H=[],P=[],Z=0,V=0;const ne=this.x_handle.isCenteredLabels(),J=this.x_handle.isRotateLabels();for(;w.next();){const s=w.grpos;let l=w.kind===1,c=this.x_handle.format(w.tick,2);if(w.last_major()?this.x_handle.fTitle||(c="x"):c===null&&(l=!1,c=""),l&&c&&i.draw&&(!ne||!w.last_major())){const M=w.get_modifier();M?.fLabText&&(c=M.fLabText);const f=ze(this,c,this.x_handle.labelsFont.size);f.computeBoundingBox();const b=f.boundingBox.max.x-f.boundingBox.min.x,S=f.boundingBox.max.y-f.boundingBox.min.y;f.center=!0,f.offsety=this.x_handle.labelsOffset+(x-d)*.005,V=Math.max(V,b),Z=Math.max(Z,S),M?.fTextColor&&(f.color=this.getColor(M.fTextColor)),f.grx=s,P.push(f);let u=0;w.last_major()||(u=Math.abs(w.next_major_grpos()-s),b>0&&u>0&&(y=Math.min(y,.9*u/b))),J&&(f.rotate=1),ne&&(u||(u=Math.min(s-t,o-s)),f.grx+=u/2)}H.push(s,0,0,s,this.x_handle.ticksSize*(l?-1:-.6),0)}if(this.x_handle.fTitle&&i.draw){const s=ze(this,this.x_handle.fTitle,this.x_handle.titleFont.size);s.computeBoundingBox(),s.center=this.x_handle.titleCenter,s.opposite=this.x_handle.titleOpposite,s.offsety=1.6*this.x_handle.titleOffset+(x-d)*.005,s.grx=(t+o)/2,s.kind="title",this.x_handle.isRotateTitle()&&(s.rotate=2),P.push(s)}this.get3dZoomCoord=function(s,l){const c=this[`scale_${l}min`],M=this[`scale_${l}max`];let f=s[l];switch(l){case"x":f=(f+this.size_x3d)/2/this.size_x3d;break;case"y":f=(f+this.size_y3d)/2/this.size_y3d;break;case"z":f=f/2/this.size_z3d;break}return this["log"+l]?f=Math.exp(Math.log(c)+f*(Math.log(M)-Math.log(c))):f=c+f*(M-c),f};const W=(s,l,c)=>{const M=new m.BufferGeometry,f=Math.max(this[s+"_handle"].ticksSize,.005*l);let b;s==="z"?b=new Float32Array([0,0,0,f*4,0,2*l,f*4,0,0,0,0,0,0,0,2*l,f*4,0,2*l]):b=new Float32Array([-l,0,0,l,-f*4,0,l,0,0,-l,0,0,-l,-f*4,0,l,-f*4,0]),M.setAttribute("position",new m.BufferAttribute(b,3)),M.computeVertexNormals();const S=new m.MeshBasicMaterial({transparent:!0,vertexColors:!1,side:m.DoubleSide,opacity:0}),u=new m.Mesh(M,S);return u.zoom=s,u.size_3d=l,u.tsz=f,u.use_y_for_z=c,s==="y"&&u.rotateZ(Math.PI/2).rotateX(Math.PI),u.v1=new m.Vector3(b[0],b[1],b[2]),u.v2=new m.Vector3(b[6],b[7],b[8]),u.v3=new m.Vector3(b[3],b[4],b[5]),u.globalIntersect=function(q){if(!this.v1||!this.v2||!this.v3)return;const O=new m.Plane;O.setFromCoplanarPoints(this.v1,this.v2,this.v3),O.applyMatrix4(this.matrixWorld);const U=q.ray.origin.clone(),oe=U.clone().addScaledVector(q.ray.direction,1e10),j=O.intersectLine(new m.Line3(U,oe),new m.Vector3);if(!j)return;let X=-this.size_3d,me=this.size_3d;return this.zoom==="z"&&(X=0,me=2*this.size_3d),j[this.zoom]<X?j[this.zoom]=X:j[this.zoom]>me&&(j[this.zoom]=me),j},u.showSelection=function(q,O){let U=this.children?this.children[0]:null,oe;if(!q||!O)return U&&(this.remove(U),we(U)),U;if(!this.geometry)return!1;if(U)oe=U.geometry;else{oe=this.geometry.clone();const X=oe.getAttribute("position").array;this.zoom==="z"?X[6]=X[3]=X[15]=this.tsz:X[4]=X[16]=X[13]=-this.tsz,U=new m.Mesh(oe,new m.MeshBasicMaterial({color:65280,side:m.DoubleSide,vertexColors:!1})),this.add(U)}const j=oe.getAttribute("position").array;return this.zoom==="z"?(j[2]=j[11]=j[8]=q[this.zoom],j[5]=j[17]=j[14]=O[this.zoom]):(j[0]=j[9]=j[12]=q[this.zoom],j[6]=j[3]=j[15]=O[this.zoom]),oe.getAttribute("position").needsUpdate=!0,!0},u};let $=new m.Object3D,de;$.position.set(0,d,n),$.rotation.x=1/4*Math.PI,$.xyid=2,$.painter=this.x_handle,i.draw&&(de=ie(H,I(this.x_handle,"ticks")),$.add(de)),P.forEach(s=>{const l=s.boundingBox.max.x-s.boundingBox.min.x,c=s.boundingBox.max.y-s.boundingBox.min.y,M=s.rotate===1?c:l,f=s.center?s.grx-M/2:s.opposite?t:o-M,b=-y*(s.rotate===1?V:Z)-this.x_handle.ticksSize-s.offsety,S=new m.Matrix4;S.set(y,0,0,f,0,y,0,b,0,0,1,0,0,0,0,1);const u=new m.Mesh(s,T(this.x_handle,s.kind,s.color));s.rotate&&u.rotateZ(s.rotate*Math.PI/2),s.rotate===1&&u.translateY(-c),s.rotate===2&&u.translateX(-l),u.applyMatrix4(S),$.add(u)}),i.zoom&&i.drawany&&$.add(W("x",this.size_x3d)),k.add($),$=new m.Object3D,$.position.set(0,x,n),$.rotation.x=3/4*Math.PI,$.painter=this.x_handle,i.draw&&$.add(new m.LineSegments(de.geometry,de.material)),P.forEach(s=>{const l=s.boundingBox.max.x-s.boundingBox.min.x,c=s.boundingBox.max.y-s.boundingBox.min.y,M=s.rotate===1?c:l,f=s.center?s.grx+M/2:s.opposite?t+M:o,b=-y*(s.rotate===1?V:Z)-this.x_handle.ticksSize-s.offsety,S=new m.Matrix4;S.set(-y,0,0,f,0,y,0,b,0,0,-1,0,0,0,0,1);const u=new m.Mesh(s,T(this.x_handle,s.kind,s.color));s.rotate&&u.rotateZ(s.rotate*Math.PI/2),s.rotate===1&&u.translateY(-c),s.rotate===2&&u.translateX(-l),u.applyMatrix4(S),$.add(u)}),$.xyid=4,i.zoom&&i.drawany&&$.add(W("x",this.size_x3d)),k.add($),P=[],y=1,V=Z=0,H=[];const xe=this.y_handle.isCenteredLabels(),re=this.y_handle.isRotateLabels();for(;g.next();){const s=g.grpos;let l=g.kind===1,c=this.y_handle.format(g.tick,2);if(g.last_major()?this.y_handle.fTitle||(c="y"):c===null&&(l=!1,c=""),l&&c&&i.draw&&(!xe||!g.last_major())){const M=g.get_modifier();M?.fLabText&&(c=M.fLabText);const f=ze(this,c,this.y_handle.labelsFont.size);f.computeBoundingBox();const b=f.boundingBox.max.x-f.boundingBox.min.x,S=f.boundingBox.max.y-f.boundingBox.min.y;f.center=!0,V=Math.max(V,b),Z=Math.max(Z,S),M?.fTextColor&&(f.color=this.getColor(M.fTextColor)),f.gry=s,f.offsetx=this.y_handle.labelsOffset+(o-t)*.005,P.push(f);let u=0;g.last_major()||(u=Math.abs(g.next_major_grpos()-s),b>0&&(y=Math.min(y,.9*u/b))),xe&&(u||(u=Math.min(s-d,x-s)),f.gry+=u/2),re&&(f.rotate=1)}H.push(0,s,0,this.y_handle.ticksSize*(l?-1:-.6),s,0)}if(this.y_handle.fTitle&&i.draw){const s=ze(this,this.y_handle.fTitle,this.y_handle.titleFont.size);s.computeBoundingBox(),s.center=this.y_handle.titleCenter,s.opposite=this.y_handle.titleOpposite,s.offsetx=1.6*this.y_handle.titleOffset+(o-t)*.005,s.gry=(d+x)/2,s.kind="title",this.y_handle.isRotateTitle()&&(s.rotate=2),P.push(s)}if(!i.use_y_for_z){let s,l=new m.Object3D;l.position.set(t,0,n),l.rotation.y=-1/4*Math.PI,l.painter=this.y_handle,i.draw&&(s=ie(H,I(this.y_handle,"ticks")),l.add(s)),P.forEach(c=>{const M=c.boundingBox.max.x-c.boundingBox.min.x,f=c.boundingBox.max.y-c.boundingBox.min.y,b=c.rotate===1?f:M,S=-y*(c.rotate===1?V:Z)-this.y_handle.ticksSize-c.offsetx,u=c.center?c.gry+b/2:c.opposite?d+b:x,q=new m.Matrix4;q.set(0,y,0,S,-y,0,0,u,0,0,1,0,0,0,0,1);const O=new m.Mesh(c,T(this.y_handle,c.kind,c.color));c.rotate&&O.rotateZ(c.rotate*Math.PI/2),c.rotate===1&&O.translateY(-f),c.rotate===2&&O.translateX(-M),O.applyMatrix4(q),l.add(O)}),l.xyid=3,i.zoom&&i.drawany&&l.add(W("y",this.size_y3d)),k.add(l),l=new m.Object3D,l.position.set(o,0,n),l.rotation.y=-3/4*Math.PI,l.painter=this.y_handle,i.draw&&l.add(new m.LineSegments(s.geometry,s.material)),P.forEach(c=>{const M=c.boundingBox.max.x-c.boundingBox.min.x,f=c.boundingBox.max.y-c.boundingBox.min.y,b=c.rotate===1?f:M,S=-y*(c.rotate===1?V:Z)-this.y_handle.ticksSize-c.offsetx,u=c.center?c.gry-b/2:c.opposite?d:x-b,q=new m.Matrix4;q.set(0,y,0,S,y,0,0,u,0,0,-1,0,0,0,0,1);const O=new m.Mesh(c,T(this.y_handle,c.kind,c.color));c.rotate&&O.rotateZ(c.rotate*Math.PI/2),c.rotate===1&&O.translateY(-f),c.rotate===2&&O.translateX(-M),O.applyMatrix4(q),l.add(O)}),l.xyid=1,i.zoom&&i.drawany&&l.add(W("y",this.size_y3d)),k.add(l)}P=[],y=1,H=[];let ce=null,fe=null,ye=null,Q=0;const Me=this.z_handle.isCenteredLabels(),Pe=this.z_handle.isRotateLabels();for(this.size_z3d&&i.drawany&&(ce=[],fe=[]);L.next();){const s=L.grpos;let l=L.kind===1,c=this.z_handle.format(L.tick,2);if(c===null&&(l=!1,c=""),l&&c&&i.draw&&(!Me||!L.last_major())){const M=L.get_modifier();M?.fLabText&&(c=M.fLabText);const f=ze(this,c,this.z_handle.labelsFont.size);f.computeBoundingBox();const b=f.boundingBox.max.x-f.boundingBox.min.x,S=f.boundingBox.max.y-f.boundingBox.min.y;f.translate(-b,-S/2,0),M?.fTextColor&&(f.color=this.getColor(M.fTextColor)),f.grz=s,P.push(f),ye!==null&&S>0&&(y=Math.min(y,.9*(s-ye)/S)),Q=Math.max(Q,b),ye=s}ce&&l&&ce.push(t,0,s,o,0,s),fe&&l&&fe.push(0,d,s,0,x,s),H.push(0,0,s,this.z_handle.ticksSize*(l?1:.6),0,s)}if(ce?.length){const s=new m.LineDashedMaterial({color:this.x_handle.ticksColor,dashSize:2,gapSize:2}),l=ie(ce,s);l.position.set(0,x,0),l.grid=2,l.visible=!1,k.add(l);const c=new m.LineSegments(l.geometry,s);c.position.set(0,d,0),c.grid=4,c.visible=!1,k.add(c)}if(fe?.length){const s=new m.LineDashedMaterial({color:this.y_handle.ticksColor,dashSize:2,gapSize:2}),l=ie(fe,s);l.position.set(o,0,0),l.grid=3,l.visible=!1,k.add(l);const c=new m.LineSegments(l.geometry,s);c.position.set(t,0,0),c.grid=1,c.visible=!1,k.add(c)}const G=[],_e=i.draw?ie(H,I(this.z_handle,"ticks")):null;for(let s=0;s<4;++s){if(G.push(new m.Object3D),P.forEach((l,c)=>{const M=new m.Matrix4,f=l.boundingBox.max.x-l.boundingBox.min.x;let b=l.grz;Me&&(c<P.length-1?b=(b+P[c+1].grz)/2:c>0&&(b=Math.min(1.5*b-P[c-1].grz*.5,h))),M.set(-y,0,0,this.z_handle.ticksSize+(o-t)*.005+this.z_handle.labelsOffset,0,0,1,0,0,y,0,b);const S=new m.Mesh(l,T(this.z_handle));Pe&&S.rotateZ(-Math.PI/2).translateX(f/2),S.applyMatrix4(M),G[s].add(S)}),this.z_handle.fTitle&&i.draw){const l=ze(this,this.z_handle.fTitle,this.z_handle.titleFont.size);l.computeBoundingBox();const c=l.boundingBox.max.x-l.boundingBox.min.x,M=l.boundingBox.max.y-l.boundingBox.min.y,f=this.z_handle.isRotateTitle(),b=this.z_handle.titleCenter?(h+n-c)/2:(this.z_handle.titleOpposite?n:h-c)+(f?c:0),S=new m.Matrix4;S.set(-y,0,0,this.z_handle.ticksSize+(o-t)*.005+Q+this.z_handle.titleOffset,0,0,1,0,0,y,0,b);const u=new m.Mesh(l,T(this.z_handle,"title"));u.rotateZ(Math.PI*(f?1.5:.5)),f&&u.translateY(-M),u.applyMatrix4(S),G[s].add(u)}i.draw&&_e&&G[s].add(s===0?_e:new m.LineSegments(_e.geometry,_e.material)),i.zoom&&i.drawany&&G[s].add(W("z",this.size_z3d,i.use_y_for_z)),G[s].zid=s+2,k.add(G[s]),G[s].painter=this.z_handle}if(G[0].position.set(t,x,0),G[0].rotation.z=3/4*Math.PI,G[1].position.set(o,x,0),G[1].rotation.z=1/4*Math.PI,G[2].position.set(o,d,0),G[2].rotation.z=-1/4*Math.PI,G[3].position.set(t,d,0),G[3].rotation.z=-3/4*Math.PI,!i.drawany)return;const R=I(this.x_handle),se=ie([t,0,0,o,0,0],R,null,!0);for(let s=0;s<2;++s){let l=new m.LineSegments(se,R);l.position.set(0,d,s===0?n:h),l.xyboxid=2,l.bottom=s===0,k.add(l),l=new m.LineSegments(se,R),l.position.set(0,x,s===0?n:h),l.xyboxid=4,l.bottom=s===0,k.add(l)}const ee=I(this.y_handle),K=ie([0,d,0,0,x,0],ee,null,!0);for(let s=0;s<2;++s){let l=new m.LineSegments(K,ee);l.position.set(t,0,s===0?n:h),l.xyboxid=3,l.bottom=s===0,k.add(l),l=new m.LineSegments(K,ee),l.position.set(o,0,s===0?n:h),l.xyboxid=1,l.bottom=s===0,k.add(l)}const Y=I(this.z_handle),he=ie([0,0,n,0,0,h],Y,null,!0);for(let s=0;s<4;++s){const l=new m.LineSegments(he,Y);l.zboxid=G[s].zid,l.position.copy(G[s].position),k.add(l)}}function gt(e,r,i){e=this.x_handle.gr(e),r=this.y_handle.gr(r),i=this.z_handle.gr(i);const a=new m.Vector3().set(e,r,i);a.project(this.camera),a.x=(a.x+1)/2,a.y=(a.y+1)/2;const t=this.getPadPainter(),o=t?.getPadWidth(),d=t?.getPadHeight();return o&&d&&(a.x=(this.scene_x+a.x*this.scene_width)/o,a.y=(this.scene_y+a.y*this.scene_height)/d),a}function _t(e){Object.assign(e,{create3DScene:nt,add3DMesh:at,get3DMeshes:rt,remove3DMeshes:ht,getRenderer:dt,render3D:lt,resize3D:ct,change3DCamera:ot,highlightBin3D:mt,set3DOptions:xt,drawXYZ:ft,convert3DtoPadNDC:gt})}async function vt(e,r,i=ve.Render3D.None){const a=e.getFramePainter(),t=e.getOptions(),o=e.getHisto(),d=e.getDimension();return _t(a),a.create3DScene(i,t.x3dscale,t.y3dscale,t.Ortho).then(()=>(a.setAxesRanges(o.fXaxis,e.xmin,e.xmax,o.fYaxis,e.ymin,e.ymax,o.fZaxis,e.zmin,e.zmax,e),a.set3DOptions(t),a.drawXYZ(a.toplevel,r,{ndim:d,use_y_for_z:d===1,hist_painter:e,zmult:t.zmult??1,zoom:i!==ve.Render3D.None&&Oe.Zooming,draw:t.Axis!==-1,drawany:t.isCartesian(),reverse_x:t.RevX,reverse_y:t.RevY}),a))}function Te(e){if(e.faceIndex<0||e.faceIndex>=this.face_to_bins_index.length)return null;const r=this.tip_painter;if(!r)return console.error("painter for tip handling is not there"),null;const i=this.handle,a=r.getFramePainter(),t=r.getHisto(),o=r.get3DToolTip(this.face_to_bins_index[e.faceIndex]),d=Math.min(a.size_x3d,Math.max(-a.size_x3d,i.grx[o.ix-1]+i.xbar1*(i.grx[o.ix]-i.grx[o.ix-1]))),x=Math.min(a.size_x3d,Math.max(-a.size_x3d,i.grx[o.ix-1]+i.xbar2*(i.grx[o.ix]-i.grx[o.ix-1]))),n=Math.min(a.size_y3d,Math.max(-a.size_y3d,i.gry[o.iy-1]+i.ybar1*(i.gry[o.iy]-i.gry[o.iy-1]))),h=Math.min(a.size_y3d,Math.max(-a.size_y3d,i.gry[o.iy-1]+i.ybar2*(i.gry[o.iy]-i.gry[o.iy-1])));o.x1=Math.min(d,x),o.x2=Math.max(d,x),o.y1=Math.min(n,h),o.y2=Math.max(n,h);let _=this.baseline,B=o.value;return t.$baseh&&(_=t.$baseh.getBinContent(o.ix,o.iy)),B<_&&([_,B]=[B,_]),o.z1=a.grz(Math.max(this.zmin,_)),o.z2=a.grz(Math.min(this.zmax,B)),o.color=this.tip_color,o.$painter=r,o.$projection=r.getDimension()===2&&le(r.isProjection)&&r.isProjection(),o}function Ct(e,r=!1){if(!e.draw_content)return;const i=ge.Vertices,a=ge.Indexes,t=ge.Normals,o=ge.Segments,d=[0,1,1,2,2,3,3,0],x=[new m.Vector3(0,0,0),new m.Vector3(0,1,0),new m.Vector3(1,1,0),new m.Vector3(1,0,0)],n=e.getFramePainter(),h=e.prepareDraw({rounding:!1,use3d:!0,extra:1}),_=e.options.cutg,B=h.i1,z=h.i2,p=h.j1,C=h.j2,D=e.getHisto(),F=D.$baseh,A=e.options.Lego===11||e.options.Lego===13,N=D.getBin(z,C)<65535;if(B>=z||p>=C)return;let E,v,w,g,L,y,I,T,k,H,P,Z=n.z_handle.getScaleMin(),V=n.z_handle.getScaleMax();const ne=(R,se,ee)=>(T=D.getBinContent(R+1,se+1),F?I=F.getBinContent(R+1,se+1):e.options.BaseLine!==!1?I=e.options.BaseLine:I=e.options.Zero?Z:0,T<I&&([I,T]=[T,I]),I>=v||T<E||_&&!_.IsInside(D.fXaxis.GetBinCoord(R+.5),D.fYaxis.GetBinCoord(se+.5))?!1:(k=T===E||I>=T,!k||ee>0?!0:F?!1:e.options.Zero||Z>0?!0:e.options.ShowEmpty));let J=[Z,V],W=null;(e.options.Lego===12||e.options.Lego===14)&&(r?(W=n.getHistPalette(),e.createContour(n,W,{full_z_range:!0}),J=W.getContour(),Z=J.at(0),V=J.at(-1)):(J=e.createContour(D.fContour?D.fContour.length:20,n.lego_zmin,n.lego_zmax).arr,W=e.getHistPalette()));for(let R=0;R<J.length-1;++R){E=J[R],v=J[R+1],W&&R===J.length-2&&v<V&&(v=V);const se=n.grz(E),ee=n.grz(v);let K=0,Y=0;for(w=B;w<z;++w)for(g=p;g<C;++g)ne(w,g,R)&&(H=!k&&R>0,P=!k&&T>v&&R<J.length-2,K+=k?12:a.length,H&&(K-=6),P&&(K-=6),A&&!k&&(K-=12,Y+=12));const he=new Float32Array(K*3),s=new Float32Array(K*3),l=N?new Uint16Array(K/3):new Uint32Array(K/3),c=Y===0?null:new Float32Array(Y*3),M=Y===0?null:new Float32Array(Y*3),f=Y===0?null:N?new Uint16Array(Y/3):new Uint32Array(Y/3);let b=0,S=0,u;for(w=B;w<z;++w){const X=h.grx[w]+h.xbar1*(h.grx[w+1]-h.grx[w]),me=h.grx[w]+h.xbar2*(h.grx[w+1]-h.grx[w]);for(g=p;g<C;++g){if(!ne(w,g,R))continue;H=!k&&R>0,P=!k&&T>v&&R<J.length-2;const ue=h.gry[g]+h.ybar1*(h.gry[g+1]-h.gry[g]),te=h.gry[g]+h.ybar2*(h.gry[g+1]-h.gry[g]),be=I<=E?se:n.grz(I),ke=T>v?ee:n.grz(T);u=0,L=0,k&&(u+=12,L+=24);const Se=D.getBin(w+1,g+1);let Fe=a.length;for(H&&(Fe-=6);L<Fe;)y=i[a[L]],A&&L<12?(c[S]=X+y.x*(me-X),c[S+1]=ue+y.y*(te-ue),c[S+2]=be+y.z*(ke-be),M[S]=t[u],M[S+1]=t[u+1],M[S+2]=t[u+2],S%9===0&&(f[S/9]=Se),S+=3):(he[b]=X+y.x*(me-X),he[b+1]=ue+y.y*(te-ue),he[b+2]=be+y.z*(ke-be),s[b]=t[u],s[b+1]=t[u+1],s[b+2]=t[u+2],b%9===0&&(l[b/9]=Se),b+=3),++L,L%6===0&&(u+=3,P&&L===a.length-12&&(L+=6,u+=3))}}const q=Ce(e,he,s);let O=r?3:D.fFillColor,U=e.getColor(O);W?U=r?W.getColor(R):W.calcColor(R,J.length):(e.options.Lego===1||O<2)&&(O=1,U="white");const oe=new m.MeshBasicMaterial(ae(U,{vertexColors:!1})),j=new m.Mesh(q,oe);if(j.face_to_bins_index=l,j.tip_painter=e,j.zmin=Z,j.zmax=V,j.baseline=e.options.BaseLine!==!1?e.options.BaseLine:e.options.Zero?Z:0,j.tip_color=O===3?16711680:65280,j.handle=h,j.tooltip=Te,n.add3DMesh(j),Y>0){const X=Ce(e,c,M),me=new m.Color(O<2?16711680:Ee(U).darker(.5).toString()),ue=new m.MeshBasicMaterial({color:me,vertexColors:!1}),te=new m.Mesh(X,ue);te.face_to_bins_index=f,te.tip_painter=e,te.handle=j.handle,te.tooltip=Te,te.zmin=j.zmin,te.zmax=j.zmax,te.baseline=j.baseline,te.tip_color=j.tip_color,n.add3DMesh(te)}}if(e.options.Lego>12)return;let $=0,de=0;for(v=V,E=Z,w=B;w<z;++w)for(g=p;g<C;++g)ne(w,g,0)&&($+=k?x.length:i.length,de+=k?d.length:o.length);const xe=$<=65520;xe||($=de*3);const re=new Float32Array($*3),ce=xe?new Uint16Array(de):null,fe=n.grz(Z),ye=n.grz(V);let Q=0,Me=0;for(w=B;w<z;++w){const R=h.grx[w]+h.xbar1*(h.grx[w+1]-h.grx[w]),se=h.grx[w]+h.xbar2*(h.grx[w+1]-h.grx[w]);for(g=p;g<C;++g){if(!ne(w,g,0))continue;const ee=h.gry[g]+h.ybar1*(h.gry[g+1]-h.gry[g]),K=h.gry[g]+h.ybar2*(h.gry[g+1]-h.gry[g]),Y=I<=Z?fe:n.grz(I),he=T>V?ye:n.grz(T),s=k?d:o,l=k?x:i;if(xe){for(L=0;L<s.length;++L)ce[Me++]=Q/3+s[L];for(L=0;L<l.length;++L)y=l[L],re[Q]=R+y.x*(se-R),re[Q+1]=ee+y.y*(K-ee),re[Q+2]=Y+y.z*(he-Y),Q+=3}else for(L=0;L<s.length;++L)y=l[s[L]],re[Q]=R+y.x*(se-R),re[Q+1]=ee+y.y*(K-ee),re[Q+2]=Y+y.z*(he-Y),Q+=3}}const Pe=r?e.v7EvalColor("line_color","lightblue"):e.getColor(D.fLineColor),G=new m.LineBasicMaterial(ae(Pe,{linewidth:r?e.v7EvalAttr("line_width",1):D.fLineWidth})),_e=ie(Be(e,re),G,xe?ce:null);n.add3DMesh(_e)}function ut(e){const r=Math.floor(e.index/6);if(r<0||r>=this.intersect_index.length)return null;const i=this.tip_painter,a=i.getHisto(),t=i.getFramePainter(),o=i.get3DToolTip(this.intersect_index[r]),d=Math.min(t.size_x3d,Math.max(-t.size_x3d,t.grx(a.fXaxis.GetBinLowEdge(o.ix)))),x=Math.min(t.size_x3d,Math.max(-t.size_x3d,t.grx(a.fXaxis.GetBinLowEdge(o.ix+1)))),n=Math.min(t.size_y3d,Math.max(-t.size_y3d,t.gry(a.fYaxis.GetBinLowEdge(o.iy)))),h=Math.min(t.size_y3d,Math.max(-t.size_y3d,t.gry(a.fYaxis.GetBinLowEdge(o.iy+1))));return o.x1=Math.min(d,x),o.x2=Math.max(d,x),o.y1=Math.min(n,h),o.y2=Math.max(n,h),o.z1=t.grz(o.value-o.error<this.zmin?this.zmin:o.value-o.error),o.z2=t.grz(o.value+o.error>this.zmax?this.zmax:o.value+o.error),o.color=this.tip_color,o}function Bt(e,r=!1){const i=e.getFramePainter(),a=e.getHisto(),t=e.prepareDraw({rounding:!1,use3d:!0,extra:1}),o=i.z_handle.getScaleMin(),d=i.z_handle.getScaleMax(),x=e.options.cutg;let n,h,_,B,z,p,C,D,F,A,N,E=0,v=null,w=null,g=0;const L=()=>e.options.Zero||o>0?!1:!e.options.ShowEmpty;for(let k=0;k<2;++k){for(n=t.i1;n<t.i2;++n)for(p=t.grx[n],D=t.grx[n+1],h=t.j1;h<t.j2;++h)if(B=a.getBinContent(n+1,h+1),!(B<o||B>d)&&!(B===o&&L())&&!(x&&!x.IsInside(a.fXaxis.GetBinCoord(n+.5),a.fYaxis.GetBinCoord(h+.5)))){if(k===0){E+=3;continue}_=a.getBin(n+1,h+1),z=e.getBinErrors(a,_,B),w[g/18]=_,C=t.gry[h],F=t.gry[h+1],A=i.grz(B-z.low<o?o:B-z.low),N=i.grz(B+z.up>d?d:B+z.up),v[g]=p,v[g+3]=D,v[g+1]=v[g+4]=(C+F)/2,v[g+2]=v[g+5]=(A+N)/2,g+=6,v[g]=v[g+3]=(p+D)/2,v[g+1]=C,v[g+4]=F,v[g+2]=v[g+5]=(A+N)/2,g+=6,v[g]=v[g+3]=(p+D)/2,v[g+1]=v[g+4]=(C+F)/2,v[g+2]=A,v[g+5]=N,g+=6}if(k===0){if(E===0)return;v=new Float32Array(E*6),w=new Int32Array(E/3)}}const y=r?e.v7EvalColor("line_color","lightblue"):e.getColor(a.fLineColor),I=new m.LineBasicMaterial(ae(y,{linewidth:r?e.v7EvalAttr("line_width",1):a.fLineWidth})),T=ie(v,I);T.tip_painter=e,T.intersect_index=w,T.zmin=o,T.zmax=d,T.tip_color=a.fLineColor===3?16711680:65280,T.tooltip=ut,i.add3DMesh(T)}function zt(e,r=!1,i=!1){const a=e.getFramePainter(),t=e.prepareDraw({rounding:!1,use3d:!0,extra:100,middle:0}),o=e.getHisto(),d=e.getContourLevels(),x=e.getHistPalette(),n=[];let h=2*a.size_z3d;je(o,t,d,x,(B,z,p,C,D,F)=>{if(!(D-C<3)&&!(r&&(h=a.grz(d[F]),h<0||h>2*a.size_z3d)))for(let A=C;A<D;++A)n.push(z[A],p[A],h),n.push(z[A+1],p[A+1],h)});const _=ie(n,He(e,i?"line_":o));a.add3DMesh(_)}function Pt(e,r=!1){const i=e.getHisto(),a=e.getFramePainter(),t=a.z_handle.getScaleMin(),o=a.logz?z=>z<t?-.1:a.grz(z):a.grz,d=0,x=2*a.size_z3d;let n=e.prepareDraw({rounding:!1,use3d:!0,extra:1,middle:.5,cutg:le(e.options?.cutg?.IsInside)?e.options?.cutg:null});if(n.i2-n.i1<2||n.j2-n.j1<2)return;let h=null,_=null,B=null;if(n.dolines=!0,r){let z=0;switch(e.options.Surf){case 11:z=2;break;case 12:case 15:case 17:z=2,n.dolines=!1;break;case 14:n.dolines=!1,n.donormals=!0;break;case 16:z=1,n.dogrid=!0,n.dolines=!1;break;default:h=a.z_handle.createTicks(!0),n.dogrid=!0;break}z>0&&(B=a.getHistPalette(),z===2&&e.createContour(a,B,{full_z_range:!0}),h=B.getContour())}else switch(e.options.Surf){case 11:h=e.getContourLevels(),B=e.getHistPalette();break;case 12:case 15:case 17:h=e.getContourLevels(),B=e.getHistPalette(),n.dolines=!1;break;case 14:n.dolines=!1,n.donormals=!0;break;case 16:h=e.getContourLevels(),n.dogrid=!0,n.dolines=!1;break;default:h=a.z_handle.createTicks(!0),n.dogrid=!0;break}if(h){_=new Float32Array(h.length);for(let z=0;z<h.length;++z)_[z]=o(h[z])}else _=[d,x];if(n.grz=o,n.grz_min=d,n.grz_max=x,it(i,n,h,(z,p,C)=>{const D=Ce(e,p,null,n.i2-n.i1,n.j2-n.j1),F=D.getAttribute("normal").array;if(n.donormals&&z===1)for(let v=n.i1;v<n.i2;++v)for(let w=n.j1;w<n.j2;++w){const g=((v-n.i1)*(n.j2-n.j1)+(w-n.j1))*8;if(C[g]===-1)continue;const L=C[g]>=0?g:g+9+C[g],y=g+8;let I=0,T=0,k=0;for(let H=L;H<y;++H){const P=C[H];if(P<0)return console.error("FAILURE in NORMALS RECALCULATIONS");I+=F[P],T+=F[P+1],k+=F[P+2]}I/=y-L,T/=y-L,k/=y-L;for(let H=L;H<y;++H){const P=C[H];F[P]=I,F[P+1]=T,F[P+2]=k}}let A,N;if(r)A=B?.getColor(z-1)??e.getColor(5);else if(B)A=B.calcColor(z,_.length);else{const v=e.options.histoFillColor||i.fFillColor;e.options.Surf===13?A="white":e.options.Surf===14?A=v>1?e.getColor(v):"grey":A=v>1?e.getColor(v):"white"}A||(A="white"),e.options.Surf===14?N=new m.MeshLambertMaterial(ae(A,{side:m.DoubleSide,vertexColors:!1})):N=new m.MeshBasicMaterial(ae(A,{side:m.DoubleSide,vertexColors:!1}));const E=new m.Mesh(D,N);a.add3DMesh(E),E.painter=e},(z,p)=>{const C=e.getColor(i.fLineColor)??"white";let D;z?D=e.options.Surf===1?new m.LineDashedMaterial({color:0,dashSize:2,gapSize:2}):new m.LineBasicMaterial(ae(C)):D=new m.LineBasicMaterial(ae(C,{linewidth:i.fLineWidth}));const F=ie(Be(e,p,n.i2-n.i1,n.j2-n.j1),D);F.painter=e,a.add3DMesh(F)}),e.options.Surf===17&&zt(e,!1,r),e.options.Surf===13){n=e.prepareDraw({rounding:!1,use3d:!0,extra:100,middle:0});const z=e.getContourLevels(),p=e.getHistPalette();let C=-1,D=x;je(i,n,z,p,(F,A,N,E,v)=>{if(A[v]===A[E]&&N[v]===N[E]&&v--,v-E<3)return;const w=[];for(let P=E;P<=v;++P)(P===E||A[P]!==A[P-1]||N[P]!==N[P-1])&&w.push(new m.Vector2(A[P],N[P]));const g=w.length<3?null:m.ShapeUtils.triangulateShape(w,[]);if(!g?.length)return;(C<0||C!==F)&&(C=F,D+=5e-5*x);const L=new Float32Array(g.length*9),y=new Float32Array(g.length*9);let I=0;for(let P=0;P<g.length;++P){const Z=g[P];for(let V=0;V<3;++V){const ne=w[Z[V]];L[I]=ne.x,L[I+1]=ne.y,L[I+2]=D,y[I]=0,y[I+1]=0,y[I+2]=1,I+=3}}const T=Ce(e,L,y,n.i2-n.i1,n.j2-n.j1),k=new m.MeshBasicMaterial(ae(p.getColor(F),{side:m.DoubleSide,opacity:.5,vertexColors:!1})),H=new m.Mesh(T,k);H.painter=e,a.add3DMesh(H)})}}export{Be as a,vt as b,Ce as c,Ct as d,zt as e,Pt as f,Bt as g};
1
+ import{bu as ve,aA as Oe,aw as m,bs as ge,ax as ae,bv as Ee,an as ie,ao as He,a5 as le,bw as Ve,bx as $e,by as Ne,bz as Ze,bA as we,bB as Ge,bC as Ye,bD as Xe,bE as Ue,bF as We,bG as Ke,bH as qe}from"./ndmvr-aframe-core-DEHQ38JB.js";import{createLatexGeometry as ze}from"./latex3d-8Hbnfz6c.js";import{k as Le,a as Je,b as Qe,c as et,d as tt}from"./THistPainter-B2S5BnuY.js";import{b as je,c as it}from"./TH2Painter-BpixRP4j.js";function Ae(e,r,i=!1,a=!1){let t;if(r?.children)for(let h=0;h<r.children.length&&(t=r.children[h],!t.axis_draw);++h)t=void 0;if(!t)return;if(!e){r.remove(t);return}const o=e.position;let d=1;o.x<0&&o.y>=0?d=2:o.x>=0&&o.y>=0?d=3:o.x>=0&&o.y<0&&(d=4);const x=(h,_)=>(h<=d&&(h+=4),h>d&&h<d+_),n=h=>{for(let _=0;_<h.children?.length;++_)h.children[_].zoom!==void 0&&(h.children[_].zoom_disabled=!h.visible)};for(let h=0;h<t.children.length;++h){const _=t.children[h];if(_.grid)_.visible=a&&x(_.grid,3);else if(_.zid)_.visible=x(_.zid,2),n(_);else if(_.xyid)_.visible=x(_.xyid,3),n(_);else if(_.xyboxid){let B=5,z=0;a&&!i?(B=3,z=-2):i&&!a?B=3:!i&&!a&&(B=_.bottom?3:0),_.visible=x(_.xyboxid+z,B),!_.visible&&_.bottom&&a&&(_.visible=x(_.xyboxid,3))}else if(_.zboxid){let B=2,z=0;i&&a?B=5:a&&!i?B=4:!a&&i&&(z=-2,B=4),_.visible=x(_.zboxid+z,B)}}}function Be(e,r,i,a){if(e.options.System===Le)return r;const t=e.getFramePainter();let o=1/t.size_x3d,d=1/t.size_y3d;if(i&&a&&(o*=i/(i-1),d*=a/(a-1)),e.options.System===Je)for(let x=0;x<r.length;x+=3){const n=(1-r[x]*o)*Math.PI,h=.5+.5*r[x+1]*d;r[x]=Math.cos(n)*h*t.size_x3d,r[x+1]=Math.sin(n)*h*t.size_y3d}else if(e.options.System===Qe)for(let x=0;x<r.length;x+=3){const n=(1-r[x]*o)*Math.PI,h=.5+r[x+2]/t.size_z3d/4;r[x]=Math.cos(n)*h*t.size_x3d,r[x+2]=(1+Math.sin(n)*h)*t.size_z3d}else if(e.options.System===et)for(let x=0;x<r.length;x+=3){const n=(1+r[x]*o)*Math.PI,h=r[x+1]*d*Math.PI,_=.5+r[x+2]/t.size_z3d/4;r[x]=_*Math.cos(h)*Math.cos(n)*t.size_x3d,r[x+1]=_*Math.cos(h)*Math.sin(n)*t.size_y3d,r[x+2]=(1+_*Math.sin(h))*t.size_z3d}else if(e.options.System===tt)for(let x=0;x<r.length;x+=3){const n=(1-r[x]*o)*Math.PI,h=r[x+1]*d*Math.PI,_=.5+r[x+2]/t.size_z3d/4;r[x]=_*Math.cos(n)*t.size_x3d,r[x+1]=_*Math.sin(h)/Math.cos(h)*t.size_y3d/2,r[x+2]=(1+_*Math.sin(n))*t.size_z3d}return r}function Ce(e,r,i,a,t){const o=new m.BufferGeometry;return e.options.System===Le?(o.setAttribute("position",new m.BufferAttribute(r,3)),i?o.setAttribute("normal",new m.BufferAttribute(i,3)):o.computeVertexNormals()):(Be(e,r,a,t),o.setAttribute("position",new m.BufferAttribute(r,3)),o.computeVertexNormals()),o}function Ie(e,r){e.camera&&(e.scene.remove(e.camera),we(e.camera),delete e.camera),r?e.camera=new m.OrthographicCamera(-1.3*e.size_x3d,1.3*e.size_x3d,2.3*e.size_z3d,-.7*e.size_z3d,.001,40*e.size_z3d):e.camera=new m.PerspectiveCamera(45,e.scene_width/e.scene_height,1,40*e.size_z3d),e.camera.up.set(0,0,1),e.pointLight=new m.DirectionalLight(16777215,3),e.pointLight.position.set(e.size_x3d/2,e.size_y3d/2,e.size_z3d/2),e.camera.add(e.pointLight),e.lookat=new m.Vector3(0,0,r?.3*e.size_z3d:.8*e.size_z3d),e.scene.add(e.camera)}function pe(e,r){const i=e.getPadPainter()?.getRootPad(!0),a=e.camera.isOrthographicCamera?1:1.4;let t=Math.max(.75*e.size_x3d,e.size_z3d),o=Math.max(.75*e.size_y3d,e.size_z3d),d=null;if(r&&(d=new m.Vector3,t===o?d.set(-1.6*t,-3.5*o,a*e.size_z3d):t>o?d.set(-2*t,-3.5*o,a*e.size_z3d):d.set(-3.5*t,-2*o,a*e.size_z3d)),i&&(r||!e.zoomChangedInteractive())&&Number.isFinite(i.fTheta)&&Number.isFinite(i.fPhi)&&(i.fTheta!==e.camera_Theta||i.fPhi!==e.camera_Phi)){d||(d=new m.Vector3),t=3*Math.max(e.size_x3d,e.size_z3d),o=3*Math.max(e.size_y3d,e.size_z3d);const x=(270-i.fPhi)/180*Math.PI,n=(i.fTheta-10)/180*Math.PI;d.set(t*Math.cos(x)*Math.cos(n),o*Math.sin(x)*Math.cos(n),e.size_z3d+(a-.9)*(t+o)*Math.sin(n))}return d}function De(e,r){const i=pe(e,r);if(i&&(e.camera.position.copy(i),r=!0),r&&e.camera.lookAt(e.lookat),r&&e.camera.isOrthographicCamera&&e.scene_width&&e.scene_height){const a=e.scene_width/e.scene_height,t=e.camera.right-e.camera.left,o=e.camera.top-e.camera.bottom;if(a>t/o){const d=(e.camera.right+e.camera.left)/2;e.camera.left=d-o*a/2,e.camera.right=d+o*a/2}else{const d=(e.camera.top+e.camera.bottom)/2;e.camera.top=d+t/a/2,e.camera.bottom=d-t/a/2}}e.camera.updateProjectionMatrix()}function st(e){const r=e.camera.position,i=e.lookat,a=r.distanceTo(i),t=Math.sqrt((r.x-i.x)**2+(r.y-i.y)**2),o=Math.atan2((r.z-i.z)/a,t/a)/Math.PI*180,d=270-Math.atan2((r.y-i.y)/t,(r.x-i.x)/t)/Math.PI*180,x=e.getPadPainter()?.getRootPad(!0);e.camera_Phi=d>=360?d-360:d,e.camera_Theta=o,x&&Number.isFinite(e.camera_Phi)&&Number.isFinite(e.camera_Theta)&&(x.fPhi=e.camera_Phi,x.fTheta=e.camera_Theta)}function Re(e){e.control=qe(e,e.camera,e.scene,e.renderer,e.lookat);const r=e,i=e.getMainPainter();if(e.access3dKind()===ve.Embed3D.Embed){const a=e.getCanvPainter()?.getPadScale();a&&e.control.tooltip?.setScale(a)}e.control.processMouseMove=function(a){let t=null,o=null,d=null;const x=r.isTooltipAllowed();for(let n=0;n<a.length;++n)if(x&&le(a[n].object?.tooltip)){if(t=a[n].object.tooltip(a[n]),t){o=a[n].object;break}}else a[n].object?.zoom&&!d&&(d=a[n].object);if(t&&!t.use_itself){const n=1e-4*r.size_x3d,h=1e-4*r.size_y3d,_=1e-4*r.size_z3d;(t.x1>t.x2||t.y1>t.y2||t.z1>t.z2)&&console.warn("check 3D hints coordinates"),t.x1-=n,t.x2+=n,t.y1-=h,t.y2+=h,t.z1-=_,t.z2+=_}if(r.highlightBin3D(t,o),!t&&d&&le(r.get3dZoomCoord)){let n=d.zoom;const h=d.globalIntersect(this.raycaster),_=r.get3dZoomCoord(h,n);return n==="z"&&d.use_y_for_z&&(n="y"),{name:n,title:"axis object",line:n+" : "+r.axisAsText(n,_),only_status:!0}}return t?.lines?t:""},e.control.processMouseLeave=function(){r.highlightBin3D(null)},e.control.contextMenu=function(a,t){let o="painter",d=i;if(t)for(let n=0;n<t.length;++n){const h=t[n].object;if(h.zoom){o=h.zoom,d=null;break}if(le(h.painter?.fillContextMenu)){d=h.painter;break}}const x=i.getFramePainter();le(x?.showContextMenu)&&x.showContextMenu(o,a,d)}}function nt(e,r,i,a){if(e===-1){if(!this.mode3d)return;if(!le(this.clear3dCanvas)){console.error(`Strange, why mode3d=${this.mode3d} is configured!`);return}const d=r?this.toplevel:null;return d&&(this.scene?.remove(d),this.toplevel=null),Ae(null,this.toplevel),this.clear3dCanvas(),we(this.scene),this.control?.cleanup(),Ge(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),this.mode3d=!1,this.getG()&&!r&&this.createFrameG(),d}if(this.mode3d=!0,"toplevel"in this){this.scene.remove(this.toplevel),we(this.toplevel),delete this.tooltip_mesh,delete this.toplevel,this.control?.hideTooltip();const d=new m.Object3D;return this.scene.add(d),this.toplevel=d,this.resize3D(),De(this,!1),Promise.resolve(!0)}e=Ye(e,this.isBatchMode()),Xe(this);const t=this.getSizeFor3d(void 0,e);this.size_z3d=100,this.x3dscale=r||1,this.y3dscale=i||1;const o=t.height>10&&t.width>10?Math.round(t.width/t.height*this.size_z3d):this.size_z3d;return this.size_x3d=o*this.x3dscale,this.size_y3d=o*this.y3dscale,Ue().then(()=>(this.scene=new m.Scene,this.toplevel=new m.Object3D,this.scene.add(this.toplevel),this.scene_width=t.width,this.scene_height=t.height,this.scene_x=t.x??0,this.scene_y=t.y??0,this.camera_Phi=30,this.camera_Theta=30,Ie(this,a),De(this,!0),We(this.scene_width,this.scene_height,e))).then(d=>(this.renderer=d,d?(this.webgl=d.jsroot_render3d===ve.Render3D.WebGL,this.add3dCanvas(t,d.jsroot_dom,this.webgl),this.first_render_tm=0,this.enable_highlight=!1,!this.isBatchMode()&&this.webgl&&!Ke()&&Re(this),this):this))}function ot(e){let r=!1;this.control&&(this.control.cleanup(),delete this.control,r=!0),Ie(this,e),De(this,!0),r&&Re(this),this.render3D()}function at(e,r,i){if(e){if(!this.toplevel)return console.error("3D objects are not yet created in the frame");r&&i&&this.remove3DMeshes(r),this.toplevel.add(e),e.painter=r}}function rt(e){const r=[];if(!e||!this.toplevel)return r;for(let i=0;i<this.toplevel.children.length;++i){const a=this.toplevel.children[i];a.painter===e&&r.push(a)}return r}function ht(e){this.get3DMeshes(e).forEach(i=>{this.toplevel.remove(i),we(i)})}function lt(e){if(e===-1111){const t=Ve(),o=$e(!1,0);if(o.setSize(this.scene_width,this.scene_height),o.render(this.scene,this.camera),o.makeOuterHTML){const d=t.createElement("div");return d.innerHTML=o.makeOuterHTML(),d.childNodes[0]}return o.domElement}e===void 0&&(e=5);const r=this.isBatchMode();if(e>0&&!this.usesvg&&!r){this.render_tmout||(this.render_tmout=setTimeout(()=>this.render3D(0),e));return}if(this.render_tmout&&(clearTimeout(this.render_tmout),delete this.render_tmout),!this.renderer)return;Ne(this.renderer);const i=new Date;Ae(this.camera,this.toplevel,this.opt3d?.FrontBox,this.opt3d?.BackBox),this.renderer.render(this.scene,this.camera),Ze(this.renderer);const a=new Date;this.first_render_tm===0?(this.first_render_tm=a.getTime()-i.getTime(),this.enable_highlight=this.first_render_tm<1200&&this.isTooltipAllowed(),this.first_render_tm>500&&console.log(`three.js r${m.REVISION}, first render tm = ${this.first_render_tm}`)):st(this),this.processRender3D&&this.forEachPainter(t=>{le(t.handleRender3D)&&t.handleRender3D()},"objects")}function dt(){return this.renderer}function ct(){const e=this.getSizeFor3d(this.access3dKind());if(this.apply3dSize(e),this.scene_width===e.width&&this.scene_height===e.height||e.width<10||e.height<10)return!1;this.scene_width=e.width,this.scene_height=e.height,this.camera.aspect=this.scene_width/this.scene_height,this.camera.updateProjectionMatrix(),this.renderer.setSize(this.scene_width,this.scene_height);const r=e.height>10&&e.width>10?Math.round(e.width/e.height*this.size_z3d):this.size_z3d,i=r*this.x3dscale,a=r*this.y3dscale;return Math.abs(i-this.size_x3d)>.15*this.size_z3d||Math.abs(a-this.size_y3d)>.15*this.size_z3d?(this.size_x3d=i,this.size_y3d=a,this.control?.position0?.copy(pe(this,!0)),1):!0}function mt(e,r){const i=!e||e.x1===void 0||!this.enable_highlight;let a=!1,t=null,o=!0,d=this.getMainPainter();if((!d?.provideUserTooltip||!d?.hasUserTooltip())&&(d=null),this.tooltip_selfmesh&&(o=this.tooltip_selfmesh!==r,this.tooltip_selfmesh.material.color=this.tooltip_selfmesh.save_color,delete this.tooltip_selfmesh,a=!0),this.tooltip_mesh&&(t=this.tooltip_mesh,this.toplevel.remove(this.tooltip_mesh),delete this.tooltip_mesh,a=!0),i){a&&(this.render3D(),d?.provideUserTooltip(null));return}if(e.use_itself)r.save_color=r.material.color,r.material.color=new m.Color(e.color),this.tooltip_selfmesh=r,a=o;else{a=!0;const x=ge.Indexes,n=ge.Normals,h=ge.Vertices,_=new m.Color(e.color?e.color:16711680),B=e.opacity||1;let z,p;if(t)z=t.geometry.attributes.position.array,t.geometry.attributes.position.needsUpdate=!0,t.material.color=_,t.material.opacity=B;else{z=new Float32Array(x.length*3),p=new Float32Array(x.length*3);const C=new m.BufferGeometry;C.setAttribute("position",new m.BufferAttribute(z,3)),C.setAttribute("normal",new m.BufferAttribute(p,3));const D=new m.MeshBasicMaterial({color:_,opacity:B,vertexColors:!1});t=new m.Mesh(C,D)}e.x1===e.x2&&console.warn(`same tip X ${e.x1} ${e.x2}`),e.y1===e.y2&&console.warn(`same tip Y ${e.y1} ${e.y2}`),e.z1===e.z2&&(e.z2=e.z1+1e-4);for(let C=0,D=-3;C<x.length;++C){const F=h[x[C]];z[C*3]=e.x1+F.x*(e.x2-e.x1),z[C*3+1]=e.y1+F.y*(e.y2-e.y1),z[C*3+2]=e.z1+F.z*(e.z2-e.z1),p&&(C%6===0&&(D+=3),p[C*3]=n[D],p[C*3+1]=n[D+1],p[C*3+2]=n[D+2])}this.tooltip_mesh=t,this.toplevel.add(t),e.$painter&&e.$painter.options.System!==Le&&(Be(e.$painter,z),t.geometry.computeVertexNormals())}a&&this.render3D(),a&&e.$projection&&le(e.$painter?.redrawProjection)&&e.$painter.redrawProjection(e.ix-1,e.ix,e.iy-1,e.iy),a&&d?.getObject()&&d.provideUserTooltip({obj:d.getObject(),name:d.getObject().fName,bin:e.bin,cont:e.value,binx:e.ix,biny:e.iy,binz:e.iz,grx:(e.x1+e.x2)/2,gry:(e.y1+e.y2)/2,grz:(e.z1+e.z2)/2})}function xt(e){this.opt3d=e}function ft(e,r,i){i||(i={ndim:2}),i.drawany===!1?i.draw=!1:i.drawany=!0;const a=i.v7?null:this.getPadPainter()?.getRootPad(!0);let t=-this.size_x3d,o=this.size_x3d,d=-this.size_y3d,x=this.size_y3d,n=0,h=2*this.size_z3d,_=this.size_z3d,B=this.xmin,z=this.xmax,p=this.ymin,C=this.ymax,D=this.zmin,F=this.zmax,A=!1,N=!1;this.size_z3d||(t=this.xmin,o=this.xmax,d=this.ymin,x=this.ymax,n=this.zmin,h=this.zmax,_=h-n),"zoom_xmin"in this&&"zoom_xmax"in this&&this.zoom_xmin!==this.zoom_xmax&&(B=this.zoom_xmin,z=this.zoom_xmax),"zoom_ymin"in this&&"zoom_ymax"in this&&this.zoom_ymin!==this.zoom_ymax&&(p=this.zoom_ymin,C=this.zoom_ymax,A=!0),"zoom_zmin"in this&&"zoom_zmax"in this&&this.zoom_zmin!==this.zoom_zmax&&(D=this.zoom_zmin,F=this.zoom_zmax,N=!0),i.use_y_for_z&&(this.zmin=this.ymin,this.zmax=this.ymax,D=p,F=C,N=A,p=0,C=1),this.lego_zmin=D,this.lego_zmax=F,i.zmult!==void 0&&!N&&(F*=i.zmult),this.x_handle=new r(null,this.xaxis),i.v7?(this.x_handle.setPadPainter(this.getPadPainter()),this.x_handle.assignSnapId(this.getSnapId())):i.hist_painter&&this.x_handle.setHistPainter(i.hist_painter,"x"),this.x_handle.configureAxis("xaxis",this.xmin,this.xmax,B,z,!1,[t,o],{log:a?.fLogx??0,reverse:i.reverse_x,logcheckmin:!0}),this.x_handle.assignFrameMembers(this,"x"),this.x_handle.extractDrawAttributes(_),this.y_handle=new r(null,this.yaxis),i.v7?(this.y_handle.setPadPainter(this.getPadPainter()),this.y_handle.assignSnapId(this.getSnapId())):i.hist_painter&&this.y_handle.setHistPainter(i.hist_painter,"y"),this.y_handle.configureAxis("yaxis",this.ymin,this.ymax,p,C,!1,[d,x],{log:a&&!i.use_y_for_z?a.fLogy:0,reverse:i.reverse_y,logcheckmin:i.ndim>1}),this.y_handle.assignFrameMembers(this,"y"),this.y_handle.extractDrawAttributes(_),this.z_handle=new r(null,this.zaxis),i.v7?(this.z_handle.setPadPainter(this.getPadPainter()),this.z_handle.assignSnapId(this.getSnapId())):i.hist_painter&&this.z_handle.setHistPainter(i.hist_painter,"z"),this.z_handle.configureAxis("zaxis",this.zmin,this.zmax,D,F,!1,[n,h],{value_axis:i.ndim===1||i.ndim===2,log:(i.use_y_for_z||i.ndim===2?a?.fLogv:void 0)??a?.fLogz??0,reverse:i.reverse_z,logcheckmin:i.ndim>2}),this.z_handle.assignFrameMembers(this,"z"),this.z_handle.extractDrawAttributes(_),this.setRootPadRange(a,!0);const E={},v={},w=this.x_handle.createTicks(!1,!0),g=this.y_handle.createTicks(!1,!0),L=this.z_handle.createTicks(!1,!0);let y=1;function I(s,l){const c=(l==="ticks"?s.ticksColor:s.lineatt.color)||"black",M=l==="ticks"?s.ticksWidth:s.lineatt.width,f=`${c}_${M}`;return v[f]||(v[f]=new m.LineBasicMaterial(ae(c,{linewidth:M,vertexColors:!1}))),v[f]}function T(s,l,c){const M=c||(l==="title"?s.titleFont?.color:s.labelsFont?.color)||"black";return E[M]||(E[M]=new m.MeshBasicMaterial(ae(M,{vertexColors:!1}))),E[M]}const k=new m.Object3D;k.axis_draw=!0,e.add(k);let H=[],P=[],Z=0,V=0;const ne=this.x_handle.isCenteredLabels(),J=this.x_handle.isRotateLabels();for(;w.next();){const s=w.grpos;let l=w.kind===1,c=this.x_handle.format(w.tick,2);if(w.last_major()?this.x_handle.fTitle||(c="x"):c===null&&(l=!1,c=""),l&&c&&i.draw&&(!ne||!w.last_major())){const M=w.get_modifier();M?.fLabText&&(c=M.fLabText);const f=ze(this,c,this.x_handle.labelsFont.size);f.computeBoundingBox();const b=f.boundingBox.max.x-f.boundingBox.min.x,S=f.boundingBox.max.y-f.boundingBox.min.y;f.center=!0,f.offsety=this.x_handle.labelsOffset+(x-d)*.005,V=Math.max(V,b),Z=Math.max(Z,S),M?.fTextColor&&(f.color=this.getColor(M.fTextColor)),f.grx=s,P.push(f);let u=0;w.last_major()||(u=Math.abs(w.next_major_grpos()-s),b>0&&u>0&&(y=Math.min(y,.9*u/b))),J&&(f.rotate=1),ne&&(u||(u=Math.min(s-t,o-s)),f.grx+=u/2)}H.push(s,0,0,s,this.x_handle.ticksSize*(l?-1:-.6),0)}if(this.x_handle.fTitle&&i.draw){const s=ze(this,this.x_handle.fTitle,this.x_handle.titleFont.size);s.computeBoundingBox(),s.center=this.x_handle.titleCenter,s.opposite=this.x_handle.titleOpposite,s.offsety=1.6*this.x_handle.titleOffset+(x-d)*.005,s.grx=(t+o)/2,s.kind="title",this.x_handle.isRotateTitle()&&(s.rotate=2),P.push(s)}this.get3dZoomCoord=function(s,l){const c=this[`scale_${l}min`],M=this[`scale_${l}max`];let f=s[l];switch(l){case"x":f=(f+this.size_x3d)/2/this.size_x3d;break;case"y":f=(f+this.size_y3d)/2/this.size_y3d;break;case"z":f=f/2/this.size_z3d;break}return this["log"+l]?f=Math.exp(Math.log(c)+f*(Math.log(M)-Math.log(c))):f=c+f*(M-c),f};const W=(s,l,c)=>{const M=new m.BufferGeometry,f=Math.max(this[s+"_handle"].ticksSize,.005*l);let b;s==="z"?b=new Float32Array([0,0,0,f*4,0,2*l,f*4,0,0,0,0,0,0,0,2*l,f*4,0,2*l]):b=new Float32Array([-l,0,0,l,-f*4,0,l,0,0,-l,0,0,-l,-f*4,0,l,-f*4,0]),M.setAttribute("position",new m.BufferAttribute(b,3)),M.computeVertexNormals();const S=new m.MeshBasicMaterial({transparent:!0,vertexColors:!1,side:m.DoubleSide,opacity:0}),u=new m.Mesh(M,S);return u.zoom=s,u.size_3d=l,u.tsz=f,u.use_y_for_z=c,s==="y"&&u.rotateZ(Math.PI/2).rotateX(Math.PI),u.v1=new m.Vector3(b[0],b[1],b[2]),u.v2=new m.Vector3(b[6],b[7],b[8]),u.v3=new m.Vector3(b[3],b[4],b[5]),u.globalIntersect=function(q){if(!this.v1||!this.v2||!this.v3)return;const O=new m.Plane;O.setFromCoplanarPoints(this.v1,this.v2,this.v3),O.applyMatrix4(this.matrixWorld);const U=q.ray.origin.clone(),oe=U.clone().addScaledVector(q.ray.direction,1e10),j=O.intersectLine(new m.Line3(U,oe),new m.Vector3);if(!j)return;let X=-this.size_3d,me=this.size_3d;return this.zoom==="z"&&(X=0,me=2*this.size_3d),j[this.zoom]<X?j[this.zoom]=X:j[this.zoom]>me&&(j[this.zoom]=me),j},u.showSelection=function(q,O){let U=this.children?this.children[0]:null,oe;if(!q||!O)return U&&(this.remove(U),we(U)),U;if(!this.geometry)return!1;if(U)oe=U.geometry;else{oe=this.geometry.clone();const X=oe.getAttribute("position").array;this.zoom==="z"?X[6]=X[3]=X[15]=this.tsz:X[4]=X[16]=X[13]=-this.tsz,U=new m.Mesh(oe,new m.MeshBasicMaterial({color:65280,side:m.DoubleSide,vertexColors:!1})),this.add(U)}const j=oe.getAttribute("position").array;return this.zoom==="z"?(j[2]=j[11]=j[8]=q[this.zoom],j[5]=j[17]=j[14]=O[this.zoom]):(j[0]=j[9]=j[12]=q[this.zoom],j[6]=j[3]=j[15]=O[this.zoom]),oe.getAttribute("position").needsUpdate=!0,!0},u};let $=new m.Object3D,de;$.position.set(0,d,n),$.rotation.x=1/4*Math.PI,$.xyid=2,$.painter=this.x_handle,i.draw&&(de=ie(H,I(this.x_handle,"ticks")),$.add(de)),P.forEach(s=>{const l=s.boundingBox.max.x-s.boundingBox.min.x,c=s.boundingBox.max.y-s.boundingBox.min.y,M=s.rotate===1?c:l,f=s.center?s.grx-M/2:s.opposite?t:o-M,b=-y*(s.rotate===1?V:Z)-this.x_handle.ticksSize-s.offsety,S=new m.Matrix4;S.set(y,0,0,f,0,y,0,b,0,0,1,0,0,0,0,1);const u=new m.Mesh(s,T(this.x_handle,s.kind,s.color));s.rotate&&u.rotateZ(s.rotate*Math.PI/2),s.rotate===1&&u.translateY(-c),s.rotate===2&&u.translateX(-l),u.applyMatrix4(S),$.add(u)}),i.zoom&&i.drawany&&$.add(W("x",this.size_x3d)),k.add($),$=new m.Object3D,$.position.set(0,x,n),$.rotation.x=3/4*Math.PI,$.painter=this.x_handle,i.draw&&$.add(new m.LineSegments(de.geometry,de.material)),P.forEach(s=>{const l=s.boundingBox.max.x-s.boundingBox.min.x,c=s.boundingBox.max.y-s.boundingBox.min.y,M=s.rotate===1?c:l,f=s.center?s.grx+M/2:s.opposite?t+M:o,b=-y*(s.rotate===1?V:Z)-this.x_handle.ticksSize-s.offsety,S=new m.Matrix4;S.set(-y,0,0,f,0,y,0,b,0,0,-1,0,0,0,0,1);const u=new m.Mesh(s,T(this.x_handle,s.kind,s.color));s.rotate&&u.rotateZ(s.rotate*Math.PI/2),s.rotate===1&&u.translateY(-c),s.rotate===2&&u.translateX(-l),u.applyMatrix4(S),$.add(u)}),$.xyid=4,i.zoom&&i.drawany&&$.add(W("x",this.size_x3d)),k.add($),P=[],y=1,V=Z=0,H=[];const xe=this.y_handle.isCenteredLabels(),re=this.y_handle.isRotateLabels();for(;g.next();){const s=g.grpos;let l=g.kind===1,c=this.y_handle.format(g.tick,2);if(g.last_major()?this.y_handle.fTitle||(c="y"):c===null&&(l=!1,c=""),l&&c&&i.draw&&(!xe||!g.last_major())){const M=g.get_modifier();M?.fLabText&&(c=M.fLabText);const f=ze(this,c,this.y_handle.labelsFont.size);f.computeBoundingBox();const b=f.boundingBox.max.x-f.boundingBox.min.x,S=f.boundingBox.max.y-f.boundingBox.min.y;f.center=!0,V=Math.max(V,b),Z=Math.max(Z,S),M?.fTextColor&&(f.color=this.getColor(M.fTextColor)),f.gry=s,f.offsetx=this.y_handle.labelsOffset+(o-t)*.005,P.push(f);let u=0;g.last_major()||(u=Math.abs(g.next_major_grpos()-s),b>0&&(y=Math.min(y,.9*u/b))),xe&&(u||(u=Math.min(s-d,x-s)),f.gry+=u/2),re&&(f.rotate=1)}H.push(0,s,0,this.y_handle.ticksSize*(l?-1:-.6),s,0)}if(this.y_handle.fTitle&&i.draw){const s=ze(this,this.y_handle.fTitle,this.y_handle.titleFont.size);s.computeBoundingBox(),s.center=this.y_handle.titleCenter,s.opposite=this.y_handle.titleOpposite,s.offsetx=1.6*this.y_handle.titleOffset+(o-t)*.005,s.gry=(d+x)/2,s.kind="title",this.y_handle.isRotateTitle()&&(s.rotate=2),P.push(s)}if(!i.use_y_for_z){let s,l=new m.Object3D;l.position.set(t,0,n),l.rotation.y=-1/4*Math.PI,l.painter=this.y_handle,i.draw&&(s=ie(H,I(this.y_handle,"ticks")),l.add(s)),P.forEach(c=>{const M=c.boundingBox.max.x-c.boundingBox.min.x,f=c.boundingBox.max.y-c.boundingBox.min.y,b=c.rotate===1?f:M,S=-y*(c.rotate===1?V:Z)-this.y_handle.ticksSize-c.offsetx,u=c.center?c.gry+b/2:c.opposite?d+b:x,q=new m.Matrix4;q.set(0,y,0,S,-y,0,0,u,0,0,1,0,0,0,0,1);const O=new m.Mesh(c,T(this.y_handle,c.kind,c.color));c.rotate&&O.rotateZ(c.rotate*Math.PI/2),c.rotate===1&&O.translateY(-f),c.rotate===2&&O.translateX(-M),O.applyMatrix4(q),l.add(O)}),l.xyid=3,i.zoom&&i.drawany&&l.add(W("y",this.size_y3d)),k.add(l),l=new m.Object3D,l.position.set(o,0,n),l.rotation.y=-3/4*Math.PI,l.painter=this.y_handle,i.draw&&l.add(new m.LineSegments(s.geometry,s.material)),P.forEach(c=>{const M=c.boundingBox.max.x-c.boundingBox.min.x,f=c.boundingBox.max.y-c.boundingBox.min.y,b=c.rotate===1?f:M,S=-y*(c.rotate===1?V:Z)-this.y_handle.ticksSize-c.offsetx,u=c.center?c.gry-b/2:c.opposite?d:x-b,q=new m.Matrix4;q.set(0,y,0,S,y,0,0,u,0,0,-1,0,0,0,0,1);const O=new m.Mesh(c,T(this.y_handle,c.kind,c.color));c.rotate&&O.rotateZ(c.rotate*Math.PI/2),c.rotate===1&&O.translateY(-f),c.rotate===2&&O.translateX(-M),O.applyMatrix4(q),l.add(O)}),l.xyid=1,i.zoom&&i.drawany&&l.add(W("y",this.size_y3d)),k.add(l)}P=[],y=1,H=[];let ce=null,fe=null,ye=null,Q=0;const Me=this.z_handle.isCenteredLabels(),Pe=this.z_handle.isRotateLabels();for(this.size_z3d&&i.drawany&&(ce=[],fe=[]);L.next();){const s=L.grpos;let l=L.kind===1,c=this.z_handle.format(L.tick,2);if(c===null&&(l=!1,c=""),l&&c&&i.draw&&(!Me||!L.last_major())){const M=L.get_modifier();M?.fLabText&&(c=M.fLabText);const f=ze(this,c,this.z_handle.labelsFont.size);f.computeBoundingBox();const b=f.boundingBox.max.x-f.boundingBox.min.x,S=f.boundingBox.max.y-f.boundingBox.min.y;f.translate(-b,-S/2,0),M?.fTextColor&&(f.color=this.getColor(M.fTextColor)),f.grz=s,P.push(f),ye!==null&&S>0&&(y=Math.min(y,.9*(s-ye)/S)),Q=Math.max(Q,b),ye=s}ce&&l&&ce.push(t,0,s,o,0,s),fe&&l&&fe.push(0,d,s,0,x,s),H.push(0,0,s,this.z_handle.ticksSize*(l?1:.6),0,s)}if(ce?.length){const s=new m.LineDashedMaterial({color:this.x_handle.ticksColor,dashSize:2,gapSize:2}),l=ie(ce,s);l.position.set(0,x,0),l.grid=2,l.visible=!1,k.add(l);const c=new m.LineSegments(l.geometry,s);c.position.set(0,d,0),c.grid=4,c.visible=!1,k.add(c)}if(fe?.length){const s=new m.LineDashedMaterial({color:this.y_handle.ticksColor,dashSize:2,gapSize:2}),l=ie(fe,s);l.position.set(o,0,0),l.grid=3,l.visible=!1,k.add(l);const c=new m.LineSegments(l.geometry,s);c.position.set(t,0,0),c.grid=1,c.visible=!1,k.add(c)}const G=[],_e=i.draw?ie(H,I(this.z_handle,"ticks")):null;for(let s=0;s<4;++s){if(G.push(new m.Object3D),P.forEach((l,c)=>{const M=new m.Matrix4,f=l.boundingBox.max.x-l.boundingBox.min.x;let b=l.grz;Me&&(c<P.length-1?b=(b+P[c+1].grz)/2:c>0&&(b=Math.min(1.5*b-P[c-1].grz*.5,h))),M.set(-y,0,0,this.z_handle.ticksSize+(o-t)*.005+this.z_handle.labelsOffset,0,0,1,0,0,y,0,b);const S=new m.Mesh(l,T(this.z_handle));Pe&&S.rotateZ(-Math.PI/2).translateX(f/2),S.applyMatrix4(M),G[s].add(S)}),this.z_handle.fTitle&&i.draw){const l=ze(this,this.z_handle.fTitle,this.z_handle.titleFont.size);l.computeBoundingBox();const c=l.boundingBox.max.x-l.boundingBox.min.x,M=l.boundingBox.max.y-l.boundingBox.min.y,f=this.z_handle.isRotateTitle(),b=this.z_handle.titleCenter?(h+n-c)/2:(this.z_handle.titleOpposite?n:h-c)+(f?c:0),S=new m.Matrix4;S.set(-y,0,0,this.z_handle.ticksSize+(o-t)*.005+Q+this.z_handle.titleOffset,0,0,1,0,0,y,0,b);const u=new m.Mesh(l,T(this.z_handle,"title"));u.rotateZ(Math.PI*(f?1.5:.5)),f&&u.translateY(-M),u.applyMatrix4(S),G[s].add(u)}i.draw&&_e&&G[s].add(s===0?_e:new m.LineSegments(_e.geometry,_e.material)),i.zoom&&i.drawany&&G[s].add(W("z",this.size_z3d,i.use_y_for_z)),G[s].zid=s+2,k.add(G[s]),G[s].painter=this.z_handle}if(G[0].position.set(t,x,0),G[0].rotation.z=3/4*Math.PI,G[1].position.set(o,x,0),G[1].rotation.z=1/4*Math.PI,G[2].position.set(o,d,0),G[2].rotation.z=-1/4*Math.PI,G[3].position.set(t,d,0),G[3].rotation.z=-3/4*Math.PI,!i.drawany)return;const R=I(this.x_handle),se=ie([t,0,0,o,0,0],R,null,!0);for(let s=0;s<2;++s){let l=new m.LineSegments(se,R);l.position.set(0,d,s===0?n:h),l.xyboxid=2,l.bottom=s===0,k.add(l),l=new m.LineSegments(se,R),l.position.set(0,x,s===0?n:h),l.xyboxid=4,l.bottom=s===0,k.add(l)}const ee=I(this.y_handle),K=ie([0,d,0,0,x,0],ee,null,!0);for(let s=0;s<2;++s){let l=new m.LineSegments(K,ee);l.position.set(t,0,s===0?n:h),l.xyboxid=3,l.bottom=s===0,k.add(l),l=new m.LineSegments(K,ee),l.position.set(o,0,s===0?n:h),l.xyboxid=1,l.bottom=s===0,k.add(l)}const Y=I(this.z_handle),he=ie([0,0,n,0,0,h],Y,null,!0);for(let s=0;s<4;++s){const l=new m.LineSegments(he,Y);l.zboxid=G[s].zid,l.position.copy(G[s].position),k.add(l)}}function gt(e,r,i){e=this.x_handle.gr(e),r=this.y_handle.gr(r),i=this.z_handle.gr(i);const a=new m.Vector3().set(e,r,i);a.project(this.camera),a.x=(a.x+1)/2,a.y=(a.y+1)/2;const t=this.getPadPainter(),o=t?.getPadWidth(),d=t?.getPadHeight();return o&&d&&(a.x=(this.scene_x+a.x*this.scene_width)/o,a.y=(this.scene_y+a.y*this.scene_height)/d),a}function _t(e){Object.assign(e,{create3DScene:nt,add3DMesh:at,get3DMeshes:rt,remove3DMeshes:ht,getRenderer:dt,render3D:lt,resize3D:ct,change3DCamera:ot,highlightBin3D:mt,set3DOptions:xt,drawXYZ:ft,convert3DtoPadNDC:gt})}async function vt(e,r,i=ve.Render3D.None){const a=e.getFramePainter(),t=e.getOptions(),o=e.getHisto(),d=e.getDimension();return _t(a),a.create3DScene(i,t.x3dscale,t.y3dscale,t.Ortho).then(()=>(a.setAxesRanges(o.fXaxis,e.xmin,e.xmax,o.fYaxis,e.ymin,e.ymax,o.fZaxis,e.zmin,e.zmax,e),a.set3DOptions(t),a.drawXYZ(a.toplevel,r,{ndim:d,use_y_for_z:d===1,hist_painter:e,zmult:t.zmult??1,zoom:i!==ve.Render3D.None&&Oe.Zooming,draw:t.Axis!==-1,drawany:t.isCartesian(),reverse_x:t.RevX,reverse_y:t.RevY}),a))}function Te(e){if(e.faceIndex<0||e.faceIndex>=this.face_to_bins_index.length)return null;const r=this.tip_painter;if(!r)return console.error("painter for tip handling is not there"),null;const i=this.handle,a=r.getFramePainter(),t=r.getHisto(),o=r.get3DToolTip(this.face_to_bins_index[e.faceIndex]),d=Math.min(a.size_x3d,Math.max(-a.size_x3d,i.grx[o.ix-1]+i.xbar1*(i.grx[o.ix]-i.grx[o.ix-1]))),x=Math.min(a.size_x3d,Math.max(-a.size_x3d,i.grx[o.ix-1]+i.xbar2*(i.grx[o.ix]-i.grx[o.ix-1]))),n=Math.min(a.size_y3d,Math.max(-a.size_y3d,i.gry[o.iy-1]+i.ybar1*(i.gry[o.iy]-i.gry[o.iy-1]))),h=Math.min(a.size_y3d,Math.max(-a.size_y3d,i.gry[o.iy-1]+i.ybar2*(i.gry[o.iy]-i.gry[o.iy-1])));o.x1=Math.min(d,x),o.x2=Math.max(d,x),o.y1=Math.min(n,h),o.y2=Math.max(n,h);let _=this.baseline,B=o.value;return t.$baseh&&(_=t.$baseh.getBinContent(o.ix,o.iy)),B<_&&([_,B]=[B,_]),o.z1=a.grz(Math.max(this.zmin,_)),o.z2=a.grz(Math.min(this.zmax,B)),o.color=this.tip_color,o.$painter=r,o.$projection=r.getDimension()===2&&le(r.isProjection)&&r.isProjection(),o}function Ct(e,r=!1){if(!e.draw_content)return;const i=ge.Vertices,a=ge.Indexes,t=ge.Normals,o=ge.Segments,d=[0,1,1,2,2,3,3,0],x=[new m.Vector3(0,0,0),new m.Vector3(0,1,0),new m.Vector3(1,1,0),new m.Vector3(1,0,0)],n=e.getFramePainter(),h=e.prepareDraw({rounding:!1,use3d:!0,extra:1}),_=e.options.cutg,B=h.i1,z=h.i2,p=h.j1,C=h.j2,D=e.getHisto(),F=D.$baseh,A=e.options.Lego===11||e.options.Lego===13,N=D.getBin(z,C)<65535;if(B>=z||p>=C)return;let E,v,w,g,L,y,I,T,k,H,P,Z=n.z_handle.getScaleMin(),V=n.z_handle.getScaleMax();const ne=(R,se,ee)=>(T=D.getBinContent(R+1,se+1),F?I=F.getBinContent(R+1,se+1):e.options.BaseLine!==!1?I=e.options.BaseLine:I=e.options.Zero?Z:0,T<I&&([I,T]=[T,I]),I>=v||T<E||_&&!_.IsInside(D.fXaxis.GetBinCoord(R+.5),D.fYaxis.GetBinCoord(se+.5))?!1:(k=T===E||I>=T,!k||ee>0?!0:F?!1:e.options.Zero||Z>0?!0:e.options.ShowEmpty));let J=[Z,V],W=null;(e.options.Lego===12||e.options.Lego===14)&&(r?(W=n.getHistPalette(),e.createContour(n,W,{full_z_range:!0}),J=W.getContour(),Z=J.at(0),V=J.at(-1)):(J=e.createContour(D.fContour?D.fContour.length:20,n.lego_zmin,n.lego_zmax).arr,W=e.getHistPalette()));for(let R=0;R<J.length-1;++R){E=J[R],v=J[R+1],W&&R===J.length-2&&v<V&&(v=V);const se=n.grz(E),ee=n.grz(v);let K=0,Y=0;for(w=B;w<z;++w)for(g=p;g<C;++g)ne(w,g,R)&&(H=!k&&R>0,P=!k&&T>v&&R<J.length-2,K+=k?12:a.length,H&&(K-=6),P&&(K-=6),A&&!k&&(K-=12,Y+=12));const he=new Float32Array(K*3),s=new Float32Array(K*3),l=N?new Uint16Array(K/3):new Uint32Array(K/3),c=Y===0?null:new Float32Array(Y*3),M=Y===0?null:new Float32Array(Y*3),f=Y===0?null:N?new Uint16Array(Y/3):new Uint32Array(Y/3);let b=0,S=0,u;for(w=B;w<z;++w){const X=h.grx[w]+h.xbar1*(h.grx[w+1]-h.grx[w]),me=h.grx[w]+h.xbar2*(h.grx[w+1]-h.grx[w]);for(g=p;g<C;++g){if(!ne(w,g,R))continue;H=!k&&R>0,P=!k&&T>v&&R<J.length-2;const ue=h.gry[g]+h.ybar1*(h.gry[g+1]-h.gry[g]),te=h.gry[g]+h.ybar2*(h.gry[g+1]-h.gry[g]),be=I<=E?se:n.grz(I),ke=T>v?ee:n.grz(T);u=0,L=0,k&&(u+=12,L+=24);const Se=D.getBin(w+1,g+1);let Fe=a.length;for(H&&(Fe-=6);L<Fe;)y=i[a[L]],A&&L<12?(c[S]=X+y.x*(me-X),c[S+1]=ue+y.y*(te-ue),c[S+2]=be+y.z*(ke-be),M[S]=t[u],M[S+1]=t[u+1],M[S+2]=t[u+2],S%9===0&&(f[S/9]=Se),S+=3):(he[b]=X+y.x*(me-X),he[b+1]=ue+y.y*(te-ue),he[b+2]=be+y.z*(ke-be),s[b]=t[u],s[b+1]=t[u+1],s[b+2]=t[u+2],b%9===0&&(l[b/9]=Se),b+=3),++L,L%6===0&&(u+=3,P&&L===a.length-12&&(L+=6,u+=3))}}const q=Ce(e,he,s);let O=r?3:D.fFillColor,U=e.getColor(O);W?U=r?W.getColor(R):W.calcColor(R,J.length):(e.options.Lego===1||O<2)&&(O=1,U="white");const oe=new m.MeshBasicMaterial(ae(U,{vertexColors:!1})),j=new m.Mesh(q,oe);if(j.face_to_bins_index=l,j.tip_painter=e,j.zmin=Z,j.zmax=V,j.baseline=e.options.BaseLine!==!1?e.options.BaseLine:e.options.Zero?Z:0,j.tip_color=O===3?16711680:65280,j.handle=h,j.tooltip=Te,n.add3DMesh(j),Y>0){const X=Ce(e,c,M),me=new m.Color(O<2?16711680:Ee(U).darker(.5).toString()),ue=new m.MeshBasicMaterial({color:me,vertexColors:!1}),te=new m.Mesh(X,ue);te.face_to_bins_index=f,te.tip_painter=e,te.handle=j.handle,te.tooltip=Te,te.zmin=j.zmin,te.zmax=j.zmax,te.baseline=j.baseline,te.tip_color=j.tip_color,n.add3DMesh(te)}}if(e.options.Lego>12)return;let $=0,de=0;for(v=V,E=Z,w=B;w<z;++w)for(g=p;g<C;++g)ne(w,g,0)&&($+=k?x.length:i.length,de+=k?d.length:o.length);const xe=$<=65520;xe||($=de*3);const re=new Float32Array($*3),ce=xe?new Uint16Array(de):null,fe=n.grz(Z),ye=n.grz(V);let Q=0,Me=0;for(w=B;w<z;++w){const R=h.grx[w]+h.xbar1*(h.grx[w+1]-h.grx[w]),se=h.grx[w]+h.xbar2*(h.grx[w+1]-h.grx[w]);for(g=p;g<C;++g){if(!ne(w,g,0))continue;const ee=h.gry[g]+h.ybar1*(h.gry[g+1]-h.gry[g]),K=h.gry[g]+h.ybar2*(h.gry[g+1]-h.gry[g]),Y=I<=Z?fe:n.grz(I),he=T>V?ye:n.grz(T),s=k?d:o,l=k?x:i;if(xe){for(L=0;L<s.length;++L)ce[Me++]=Q/3+s[L];for(L=0;L<l.length;++L)y=l[L],re[Q]=R+y.x*(se-R),re[Q+1]=ee+y.y*(K-ee),re[Q+2]=Y+y.z*(he-Y),Q+=3}else for(L=0;L<s.length;++L)y=l[s[L]],re[Q]=R+y.x*(se-R),re[Q+1]=ee+y.y*(K-ee),re[Q+2]=Y+y.z*(he-Y),Q+=3}}const Pe=r?e.v7EvalColor("line_color","lightblue"):e.getColor(D.fLineColor),G=new m.LineBasicMaterial(ae(Pe,{linewidth:r?e.v7EvalAttr("line_width",1):D.fLineWidth})),_e=ie(Be(e,re),G,xe?ce:null);n.add3DMesh(_e)}function ut(e){const r=Math.floor(e.index/6);if(r<0||r>=this.intersect_index.length)return null;const i=this.tip_painter,a=i.getHisto(),t=i.getFramePainter(),o=i.get3DToolTip(this.intersect_index[r]),d=Math.min(t.size_x3d,Math.max(-t.size_x3d,t.grx(a.fXaxis.GetBinLowEdge(o.ix)))),x=Math.min(t.size_x3d,Math.max(-t.size_x3d,t.grx(a.fXaxis.GetBinLowEdge(o.ix+1)))),n=Math.min(t.size_y3d,Math.max(-t.size_y3d,t.gry(a.fYaxis.GetBinLowEdge(o.iy)))),h=Math.min(t.size_y3d,Math.max(-t.size_y3d,t.gry(a.fYaxis.GetBinLowEdge(o.iy+1))));return o.x1=Math.min(d,x),o.x2=Math.max(d,x),o.y1=Math.min(n,h),o.y2=Math.max(n,h),o.z1=t.grz(o.value-o.error<this.zmin?this.zmin:o.value-o.error),o.z2=t.grz(o.value+o.error>this.zmax?this.zmax:o.value+o.error),o.color=this.tip_color,o}function Bt(e,r=!1){const i=e.getFramePainter(),a=e.getHisto(),t=e.prepareDraw({rounding:!1,use3d:!0,extra:1}),o=i.z_handle.getScaleMin(),d=i.z_handle.getScaleMax(),x=e.options.cutg;let n,h,_,B,z,p,C,D,F,A,N,E=0,v=null,w=null,g=0;const L=()=>e.options.Zero||o>0?!1:!e.options.ShowEmpty;for(let k=0;k<2;++k){for(n=t.i1;n<t.i2;++n)for(p=t.grx[n],D=t.grx[n+1],h=t.j1;h<t.j2;++h)if(B=a.getBinContent(n+1,h+1),!(B<o||B>d)&&!(B===o&&L())&&!(x&&!x.IsInside(a.fXaxis.GetBinCoord(n+.5),a.fYaxis.GetBinCoord(h+.5)))){if(k===0){E+=3;continue}_=a.getBin(n+1,h+1),z=e.getBinErrors(a,_,B),w[g/18]=_,C=t.gry[h],F=t.gry[h+1],A=i.grz(B-z.low<o?o:B-z.low),N=i.grz(B+z.up>d?d:B+z.up),v[g]=p,v[g+3]=D,v[g+1]=v[g+4]=(C+F)/2,v[g+2]=v[g+5]=(A+N)/2,g+=6,v[g]=v[g+3]=(p+D)/2,v[g+1]=C,v[g+4]=F,v[g+2]=v[g+5]=(A+N)/2,g+=6,v[g]=v[g+3]=(p+D)/2,v[g+1]=v[g+4]=(C+F)/2,v[g+2]=A,v[g+5]=N,g+=6}if(k===0){if(E===0)return;v=new Float32Array(E*6),w=new Int32Array(E/3)}}const y=r?e.v7EvalColor("line_color","lightblue"):e.getColor(a.fLineColor),I=new m.LineBasicMaterial(ae(y,{linewidth:r?e.v7EvalAttr("line_width",1):a.fLineWidth})),T=ie(v,I);T.tip_painter=e,T.intersect_index=w,T.zmin=o,T.zmax=d,T.tip_color=a.fLineColor===3?16711680:65280,T.tooltip=ut,i.add3DMesh(T)}function zt(e,r=!1,i=!1){const a=e.getFramePainter(),t=e.prepareDraw({rounding:!1,use3d:!0,extra:100,middle:0}),o=e.getHisto(),d=e.getContourLevels(),x=e.getHistPalette(),n=[];let h=2*a.size_z3d;je(o,t,d,x,(B,z,p,C,D,F)=>{if(!(D-C<3)&&!(r&&(h=a.grz(d[F]),h<0||h>2*a.size_z3d)))for(let A=C;A<D;++A)n.push(z[A],p[A],h),n.push(z[A+1],p[A+1],h)});const _=ie(n,He(e,i?"line_":o));a.add3DMesh(_)}function Pt(e,r=!1){const i=e.getHisto(),a=e.getFramePainter(),t=a.z_handle.getScaleMin(),o=a.logz?z=>z<t?-.1:a.grz(z):a.grz,d=0,x=2*a.size_z3d;let n=e.prepareDraw({rounding:!1,use3d:!0,extra:1,middle:.5,cutg:le(e.options?.cutg?.IsInside)?e.options?.cutg:null});if(n.i2-n.i1<2||n.j2-n.j1<2)return;let h=null,_=null,B=null;if(n.dolines=!0,r){let z=0;switch(e.options.Surf){case 11:z=2;break;case 12:case 15:case 17:z=2,n.dolines=!1;break;case 14:n.dolines=!1,n.donormals=!0;break;case 16:z=1,n.dogrid=!0,n.dolines=!1;break;default:h=a.z_handle.createTicks(!0),n.dogrid=!0;break}z>0&&(B=a.getHistPalette(),z===2&&e.createContour(a,B,{full_z_range:!0}),h=B.getContour())}else switch(e.options.Surf){case 11:h=e.getContourLevels(),B=e.getHistPalette();break;case 12:case 15:case 17:h=e.getContourLevels(),B=e.getHistPalette(),n.dolines=!1;break;case 14:n.dolines=!1,n.donormals=!0;break;case 16:h=e.getContourLevels(),n.dogrid=!0,n.dolines=!1;break;default:h=a.z_handle.createTicks(!0),n.dogrid=!0;break}if(h){_=new Float32Array(h.length);for(let z=0;z<h.length;++z)_[z]=o(h[z])}else _=[d,x];if(n.grz=o,n.grz_min=d,n.grz_max=x,it(i,n,h,(z,p,C)=>{const D=Ce(e,p,null,n.i2-n.i1,n.j2-n.j1),F=D.getAttribute("normal").array;if(n.donormals&&z===1)for(let v=n.i1;v<n.i2;++v)for(let w=n.j1;w<n.j2;++w){const g=((v-n.i1)*(n.j2-n.j1)+(w-n.j1))*8;if(C[g]===-1)continue;const L=C[g]>=0?g:g+9+C[g],y=g+8;let I=0,T=0,k=0;for(let H=L;H<y;++H){const P=C[H];if(P<0)return console.error("FAILURE in NORMALS RECALCULATIONS");I+=F[P],T+=F[P+1],k+=F[P+2]}I/=y-L,T/=y-L,k/=y-L;for(let H=L;H<y;++H){const P=C[H];F[P]=I,F[P+1]=T,F[P+2]=k}}let A,N;if(r)A=B?.getColor(z-1)??e.getColor(5);else if(B)A=B.calcColor(z,_.length);else{const v=e.options.histoFillColor||i.fFillColor;e.options.Surf===13?A="white":e.options.Surf===14?A=v>1?e.getColor(v):"grey":A=v>1?e.getColor(v):"white"}A||(A="white"),e.options.Surf===14?N=new m.MeshLambertMaterial(ae(A,{side:m.DoubleSide,vertexColors:!1})):N=new m.MeshBasicMaterial(ae(A,{side:m.DoubleSide,vertexColors:!1}));const E=new m.Mesh(D,N);a.add3DMesh(E),E.painter=e},(z,p)=>{const C=e.getColor(i.fLineColor)??"white";let D;z?D=e.options.Surf===1?new m.LineDashedMaterial({color:0,dashSize:2,gapSize:2}):new m.LineBasicMaterial(ae(C)):D=new m.LineBasicMaterial(ae(C,{linewidth:i.fLineWidth}));const F=ie(Be(e,p,n.i2-n.i1,n.j2-n.j1),D);F.painter=e,a.add3DMesh(F)}),e.options.Surf===17&&zt(e,!1,r),e.options.Surf===13){n=e.prepareDraw({rounding:!1,use3d:!0,extra:100,middle:0});const z=e.getContourLevels(),p=e.getHistPalette();let C=-1,D=x;je(i,n,z,p,(F,A,N,E,v)=>{if(A[v]===A[E]&&N[v]===N[E]&&v--,v-E<3)return;const w=[];for(let P=E;P<=v;++P)(P===E||A[P]!==A[P-1]||N[P]!==N[P-1])&&w.push(new m.Vector2(A[P],N[P]));const g=w.length<3?null:m.ShapeUtils.triangulateShape(w,[]);if(!g?.length)return;(C<0||C!==F)&&(C=F,D+=5e-5*x);const L=new Float32Array(g.length*9),y=new Float32Array(g.length*9);let I=0;for(let P=0;P<g.length;++P){const Z=g[P];for(let V=0;V<3;++V){const ne=w[Z[V]];L[I]=ne.x,L[I+1]=ne.y,L[I+2]=D,y[I]=0,y[I+1]=0,y[I+2]=1,I+=3}}const T=Ce(e,L,y,n.i2-n.i1,n.j2-n.j1),k=new m.MeshBasicMaterial(ae(p.getColor(F),{side:m.DoubleSide,opacity:.5,vertexColors:!1})),H=new m.Mesh(T,k);H.painter=e,a.add3DMesh(H)})}}export{Be as a,vt as b,Ce as c,Ct as d,zt as e,Pt as f,Bt as g};
@@ -1 +1 @@
1
- import{c1 as z,aw as x,c2 as A,c3 as B,c4 as I,a7 as k,a8 as N,aK as E,ax as O}from"./ndmvr-aframe-core-Cw91_9_Y.js";class y{constructor(s,t,u){this.kind=s??"g",this.childs=[],this.x=0,this.y=0,this.font_size=t?.font_size??u,this.stroke_width=t?.stroke_width??5,t?.childs.push(this)}append(s){if(s==="svg:g")return new y("g",this);if(s==="svg:text")return new y("text",this);if(s==="svg:path")return new y("path",this);console.warn("missing handle for svg",s)}style(s,t){return s==="stroke-width"&&t&&(this.stroke_width=Number.parseInt(t)),this}property(s,t){return t===void 0?this[s]:(this[s]=t,this)}attr(s,t){const u=()=>{if(!t)return"";const i=t[0];return t=t.slice(1),i},e=i=>{let n=0;for(;t[n]>="0"&&t[n]<="9"||t[n]==="-";)n++;const d=Number.parseInt(t.slice(0,n));return t=t.slice(n),i&&u(),d};if(s==="font-size"&&t)this.font_size=Number.parseInt(t);else if(s==="transform"&&E(t)&&t.indexOf("translate")===0){const i=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",");this.x+=i[0]?Number.parseInt(i[0])*.01:0,this.y-=i[1]?Number.parseInt(i[1])*.01:0}else if(s==="x"&&this.kind==="text")this.x+=Number.parseInt(t)*.01;else if(s==="y"&&this.kind==="text")this.y-=Number.parseInt(t)*.01;else if(s==="fill"&&this.kind==="text")this.fill=t;else if(s==="d"&&this.kind==="path"&&t!=="M0,0"){if(u()!=="M")return console.error("Not starts with M");let i=e(!0),n=e(),d;const g=[],r=(a,l)=>{const c=Math.atan2(l-n,a-i),h=.5*this.stroke_width*Math.sin(c),f=-.5*this.stroke_width*Math.cos(c);g.push(i-h,n-f,0,a-h,l-f,0,a+h,l+f,0,i-h,n-f,0,a+h,l+f,0,i+h,n+f,0),g.push(i-h,n-f,0,a+h,l+f,0,a-h,l-f,0,i-h,n-f,0,i+h,n+f,0,a+h,l+f,0),i=a,n=l};for(;d=u();)switch(d){case"L":r(e(!0),e());continue;case"l":r(i+e(!0),n+e());continue;case"H":r(e(),n);continue;case"h":r(i+e(),n);continue;case"V":r(i,e());continue;case"v":r(i,n+e());continue;case"a":{const a=e(!0),l=e(!0),c=e(!0)/180*Math.PI,h=e(!0);e(!0);const f=i+e(!0),o=n+e(),w=i+a*Math.cos(c),M=n+l*Math.sin(c);let p=Math.atan2(M-o,w-f);h&&p<c?p+=2*Math.PI:!h&&p>c&&(p-=2*Math.PI);for(let b=0;b<10;++b){const _=c+(p-c)/10*(b+1);r(w-a*Math.cos(_),M-l*Math.sin(_))}continue}default:console.log("not supported path operator",d)}if(g.length){const a=new Float32Array(g);this.geom=new x.BufferGeometry,this.geom.setAttribute("position",new x.BufferAttribute(a,3)),this.geom.scale(.01,-.01,.01),this.geom.computeVertexNormals()}}return this}text(s){this.kind==="text"&&(this._text=s)}collect(s,t,u){if(this._text){t.size=Math.round(.01*this.font_size);const e=new x.TextGeometry(this._text,t);u&&(e.scale(1,.9,1),e.translate(0,5e-4*this.font_size,0)),e.translate(this.x,this.y,0),e._fill=this.fill,s.push(e)}this.geom&&(this.geom.translate(this.x,this.y,0),this.geom._fill=this.fill,s.push(this.geom)),this.childs.forEach(e=>{e.x+=this.x,e.y+=this.y,e.collect(s,t,u)})}}function T(m,s,t,u,e=!0){const i={font:z(),size:t,height:0,curveSegments:5},n=t*100,d=new y("g",null,n),g={font_size:n,text:s,fast:!0,font:{size:n,isMonospace:()=>!1,aver_width:.9}},r=[];if(x.REVISION>162?i.depth=0:i.height=0,A(s)||(B(m,d,g),d.collect(r,i,u)),!r.length){i.size=t;const o=new x.TextGeometry(I(s),i);return u?[o]:o}if(u)return r;if(r.length===1)return r[0];let a=0;r.forEach(o=>{a+=o.getAttribute("position").array.length});const l=new Float32Array(a),c=new Float32Array(a);let h=0;r.forEach(o=>{const w=o.getAttribute("position").array,M=o.getAttribute("normal").array;for(let p=0;p<w.length;++p,++h)l[h]=w[p],c[h]=M[p]});const f=new x.BufferGeometry;return f.setAttribute("position",new x.BufferAttribute(l,3)),f.setAttribute("normal",new x.BufferAttribute(c,3)),f}function L(m,s,t,u){t||(t=new k(null,m,s));const e=t.createAttText({attr:m}),i=e.align%10,n=(e.align-i)/10,d=e.size>1?e.size:2*e.size*(u?.size_z3d||100),g=T(t,m.fTitle,d||10,!0,u||m._typename===N),r=new x.Box3().makeEmpty();g.forEach(o=>{o.computeBoundingBox(),r.expandByPoint(o.boundingBox.max),r.expandByPoint(o.boundingBox.min)});let a=0,l=0;n===2?a=.5*(r.max.x+r.min.x):n===3&&(a=r.max.x),i===2?l=.5*(r.max.y+r.min.y):i===3&&(l=r.max.y);const c=new x.Object3D,h=[],f=o=>(o||(o="black"),h[o]||(h[o]=new x.MeshBasicMaterial(O(o,{vertexColors:!1}))),h[o]);return g.forEach(o=>{o.translate(-a,-l,0),c.add(new x.Mesh(o,f(o._fill||e.color)))}),g.length===1?c.children[0]:c}export{L as build3dlatex,T as createLatexGeometry};
1
+ import{c1 as z,aw as x,c2 as A,c3 as B,c4 as I,a7 as k,a8 as N,aK as E,ax as O}from"./ndmvr-aframe-core-DEHQ38JB.js";class y{constructor(s,t,u){this.kind=s??"g",this.childs=[],this.x=0,this.y=0,this.font_size=t?.font_size??u,this.stroke_width=t?.stroke_width??5,t?.childs.push(this)}append(s){if(s==="svg:g")return new y("g",this);if(s==="svg:text")return new y("text",this);if(s==="svg:path")return new y("path",this);console.warn("missing handle for svg",s)}style(s,t){return s==="stroke-width"&&t&&(this.stroke_width=Number.parseInt(t)),this}property(s,t){return t===void 0?this[s]:(this[s]=t,this)}attr(s,t){const u=()=>{if(!t)return"";const i=t[0];return t=t.slice(1),i},e=i=>{let n=0;for(;t[n]>="0"&&t[n]<="9"||t[n]==="-";)n++;const d=Number.parseInt(t.slice(0,n));return t=t.slice(n),i&&u(),d};if(s==="font-size"&&t)this.font_size=Number.parseInt(t);else if(s==="transform"&&E(t)&&t.indexOf("translate")===0){const i=t.slice(t.indexOf("(")+1,t.lastIndexOf(")")).split(",");this.x+=i[0]?Number.parseInt(i[0])*.01:0,this.y-=i[1]?Number.parseInt(i[1])*.01:0}else if(s==="x"&&this.kind==="text")this.x+=Number.parseInt(t)*.01;else if(s==="y"&&this.kind==="text")this.y-=Number.parseInt(t)*.01;else if(s==="fill"&&this.kind==="text")this.fill=t;else if(s==="d"&&this.kind==="path"&&t!=="M0,0"){if(u()!=="M")return console.error("Not starts with M");let i=e(!0),n=e(),d;const g=[],r=(a,l)=>{const c=Math.atan2(l-n,a-i),h=.5*this.stroke_width*Math.sin(c),f=-.5*this.stroke_width*Math.cos(c);g.push(i-h,n-f,0,a-h,l-f,0,a+h,l+f,0,i-h,n-f,0,a+h,l+f,0,i+h,n+f,0),g.push(i-h,n-f,0,a+h,l+f,0,a-h,l-f,0,i-h,n-f,0,i+h,n+f,0,a+h,l+f,0),i=a,n=l};for(;d=u();)switch(d){case"L":r(e(!0),e());continue;case"l":r(i+e(!0),n+e());continue;case"H":r(e(),n);continue;case"h":r(i+e(),n);continue;case"V":r(i,e());continue;case"v":r(i,n+e());continue;case"a":{const a=e(!0),l=e(!0),c=e(!0)/180*Math.PI,h=e(!0);e(!0);const f=i+e(!0),o=n+e(),w=i+a*Math.cos(c),M=n+l*Math.sin(c);let p=Math.atan2(M-o,w-f);h&&p<c?p+=2*Math.PI:!h&&p>c&&(p-=2*Math.PI);for(let b=0;b<10;++b){const _=c+(p-c)/10*(b+1);r(w-a*Math.cos(_),M-l*Math.sin(_))}continue}default:console.log("not supported path operator",d)}if(g.length){const a=new Float32Array(g);this.geom=new x.BufferGeometry,this.geom.setAttribute("position",new x.BufferAttribute(a,3)),this.geom.scale(.01,-.01,.01),this.geom.computeVertexNormals()}}return this}text(s){this.kind==="text"&&(this._text=s)}collect(s,t,u){if(this._text){t.size=Math.round(.01*this.font_size);const e=new x.TextGeometry(this._text,t);u&&(e.scale(1,.9,1),e.translate(0,5e-4*this.font_size,0)),e.translate(this.x,this.y,0),e._fill=this.fill,s.push(e)}this.geom&&(this.geom.translate(this.x,this.y,0),this.geom._fill=this.fill,s.push(this.geom)),this.childs.forEach(e=>{e.x+=this.x,e.y+=this.y,e.collect(s,t,u)})}}function T(m,s,t,u,e=!0){const i={font:z(),size:t,height:0,curveSegments:5},n=t*100,d=new y("g",null,n),g={font_size:n,text:s,fast:!0,font:{size:n,isMonospace:()=>!1,aver_width:.9}},r=[];if(x.REVISION>162?i.depth=0:i.height=0,A(s)||(B(m,d,g),d.collect(r,i,u)),!r.length){i.size=t;const o=new x.TextGeometry(I(s),i);return u?[o]:o}if(u)return r;if(r.length===1)return r[0];let a=0;r.forEach(o=>{a+=o.getAttribute("position").array.length});const l=new Float32Array(a),c=new Float32Array(a);let h=0;r.forEach(o=>{const w=o.getAttribute("position").array,M=o.getAttribute("normal").array;for(let p=0;p<w.length;++p,++h)l[h]=w[p],c[h]=M[p]});const f=new x.BufferGeometry;return f.setAttribute("position",new x.BufferAttribute(l,3)),f.setAttribute("normal",new x.BufferAttribute(c,3)),f}function L(m,s,t,u){t||(t=new k(null,m,s));const e=t.createAttText({attr:m}),i=e.align%10,n=(e.align-i)/10,d=e.size>1?e.size:2*e.size*(u?.size_z3d||100),g=T(t,m.fTitle,d||10,!0,u||m._typename===N),r=new x.Box3().makeEmpty();g.forEach(o=>{o.computeBoundingBox(),r.expandByPoint(o.boundingBox.max),r.expandByPoint(o.boundingBox.min)});let a=0,l=0;n===2?a=.5*(r.max.x+r.min.x):n===3&&(a=r.max.x),i===2?l=.5*(r.max.y+r.min.y):i===3&&(l=r.max.y);const c=new x.Object3D,h=[],f=o=>(o||(o="black"),h[o]||(h[o]=new x.MeshBasicMaterial(O(o,{vertexColors:!1}))),h[o]);return g.forEach(o=>{o.translate(-a,-l,0),c.add(new x.Mesh(o,f(o._fill||e.color)))}),g.length===1?c.children[0]:c}export{L as build3dlatex,T as createLatexGeometry};