1"use strict";(globalThis.webpackChunkambiki||=[]).push([[7982],{97982(t,e,n){var a=n(43260),r=null;const o=function(){if(r)return console.log("Returning existing revenue universe instance"),r;var t,e,n,o,l,s,i,c="#2948a0",d="#f18e69",u="#ef3dc0",p="#3cceb7",h="#f1b241",y="#38b57c",m="#2948a0",f="#9476cc",g="#fd9843",v="#d97168",x="#3cceb7",b="#8c99b2",w=0,k=null,A=[],z=!1,_=100,M=150,C=80,I=80,N=1e3,L=function(t,e){t.html('\n <div class="alert alert-warning text-center" style="margin: 50px;">\n <i class="fas fa-exclamation-triangle"></i> '.concat(e,"\n </div>\n "))},D=function(t){console.log("Processing data, monthly_snapshots:",t.monthly_snapshots);var e,n,r=new Set;(A=t.monthly_snapshots.map(function(t,e){console.log("Processing snapshot ".concat(e,":"),t);var n="string"===typeof t.month?new Date(t.month):t.month;return console.log("Therapists in snapshot ".concat(e,":"),t.therapists),console.log("Therapists with visits > 0:",t.therapists.filter(function(t){return t.visits>0})),t.therapists.forEac
1h(function(t){t.specialty&&r.add(t.specialty)}),{month:n,monthLabel:t.month_label||a.DCK("%B %Y")(n),therapists:t.therapists.filter(function(t){return t.visits>0})}})).sort(function(t,e){return new Date(t.month)-new Date(e.month)}),console.log("Processed monthlyData:",A),console.log("All specialties found:",Array.from(r)),e=Array.from(r),n=[c,p,d,f,g,y,h,u,v,x,m,b],s=a.UMr().domain(e).range(n.slice(0,Math.min(e.length,n.length)))},F=function(r){var c=r.node().getBoundingClientRect(),d=c.width-I-M,u=600-_-C;t=r.append("svg").attr("width",c.width).attr("height",600),e=t.append("g").attr("transform","translate(".concat(I,",").concat(_,")")),n=a.m4Y().domain([0,150]).range([0,d]),o=a.m4Y().domain([70,100]).range([u,0]),l=a.Bv9().domain([0,1e4]).range([5,50]);var p=a.l78(n).ticks(8).tickFormat(function(t){return t}),h=a.V4s(o).ticks(8).tickFormat(function(t){return t+"%"});e.append("g").attr("class","x-axis").attr("transform","translate(0,".concat(u,")")).call(p),e.append("text").attr("class","axis-label").attr("x",d/2).attr("y",u+50).style("text-anchor","middle").style("font-size","14px").style("font-weight",500).style("fill","#666").text("Visits per month"),e.append("g").attr("class","y-axis").call(h),e.append("text").attr("class","axis-label").attr("transform","rotate(-90)").attr("x",-u/2).attr("y",-50).style("text-anchor","middle").style("font-size","14px").style("font-weight",500).style("fill","#666").text("Attendance rate (%)"),e.append("g").attr("class","grid x-grid").attr("transform","translate(0,".concat(u,")")).style("stroke-dasharray","3,3").style("opacity",.3),e.append("g").attr("class","grid y-grid").style("stroke-dasharray","3,3").style("opacity",.3),t.append("text").attr("class","month-label").attr("x",100).attr("y",40).style("text-anchor","middle").style("font-size","20px").style("font-weight","bold").style("fill","#333").text(""),i||(i=a.Ltv("body").append("div").attr("class","universe-tooltip").style("position","absolute").style("padding","12px").style("background","rgba(0, 0, 0, 0.9)").style("color","white").style("border-radius","8px").style("font-size","14px").style("pointer-events","none").style("opacity",0).style("transition","opacity 0.3s").style("z-index",1e3));t.append("g").attr("class","specialty-legend").attr("transform","translate(".concat(c.width-130,", ").concat(_,")"));var y=t.append("g").attr("transform","translate(".concat(c.width-150,", ").concat(u-100,")"));y.append("text").attr("y",-10).style("font-size","12px").style("font-weight","bold").style("fill","#666").text("Total revenue");var m=y.selectAll(".size-legend-item").data([1e3,3e3,6e3]).enter().append("g").attr("class","size-legend-item").attr("transform",function(t,e){return"translate(0, ".concat(30*e+10,")")});m.append("circle").attr("r",function(t){return l(t)}).style("fill","none").style("stroke","#999").style("stroke-width",1),m.append("text").attr("x",30).attr("y",5).style("font-size","12px").style("fill","#666").text(function(t){return"$".concat(a.GPZ(",")(t))}),function(){if(t){var e=t.select(".specialty-legend");if(!e.empty()){var n=s.domain();e.selectAll("*").remove(),e.append("text").attr("y",-10).style("font-size","14px").style("font-weight","bold").style("fill","#666").text("Discipline");var a=e.selectAll(".legend-item").data(n).enter().append("g").attr("class","legend-item").attr("transform",function(t,e){return"translate(0, ".concat(25*e+10,")")});a.append("circle").attr("r",8).style("fill",function(t){return s(t)}).style("opacity",.8),a.append("text").attr("x",15).attr("y",5).style("font-size","14px").style("fill","#666").text(function(t){return t})}}}()},V=function(r){if(console.log("updateChart called with monthIndex:",r),console.log("monthlyData length:",A.length),z)if(r>=A.length||r<0)console.error("Invalid month index");else{var c=A[r];w=r,console.log("Current month data:",c),t.select(".month-label").text(c.monthLabel);var d=c.therapists.filter(function(t){return t.visits>0});if(console.log("Active therapists:",d),0===d.length)return console.warn("No active therapists for this month"),e.selectAll(".bubble-group").remove(),e.selectAll(".no-data-message").remove(),void e.append("text").attr("class","no-data-message").attr("x",
1n.range()[1]/2).attr("y",o.range()[0]/2).style("text-anchor","middle").style("font-size","16px").style("fill","#999").text("No data for this month");e.selectAll(".no-data-message").remove();var u=a.Xxv(d,function(t){return t.visits}),p=a.Xxv(d,function(t){return t.attendance_rate}),h=a.Xxv(d,function(t){return Math.max(0,t.total_revenue)});n.domain([Math.max(0,u[0]-5),u[1]+5]),o.domain([Math.max(0,p[0]-2),Math.min(100,p[1]+2)]),l.domain([0,Math.max(0,1.1*h[1])]);var y=t.node().getBoundingClientRect().width-I-M,m=600-_-C;e.select(".x-axis").transition().duration(N).call(a.l78(n).ticks(8)),e.select(".y-axis").transition().duration(N).call(a.V4s(o).ticks(8).tickFormat(function(t){return t+"%"})),e.select(".x-grid").transition().duration(N).call(a.l78(n).ticks(8).tickSize(-m).tickFormat("")),e.select(".y-grid").transition().duration(N).call(a.V4s(o).ticks(8).tickSize(-y).tickFormat(""));var f=e.selectAll(".bubble-group").data(d,function(t){return t.id}),g=f.exit();g.select("circle").transition().duration(500).attr("r",0),g.select("text").transition().duration(500).style("opacity",0),g.transition().duration(500).remove();var v=f.enter().append("g").attr("class","bubble-group");v.append("circle").attr("class","bubble").attr("r",0).attr("cx",0).attr("cy",0).style("fill",function(t){return s(t.specialty)}).style("opacity",.7).style("stroke","#fff").style("stroke-width",2).style("cursor","pointer"),v.append("text").attr("class","bubble-label").attr("text-anchor","middle").attr("dy","-5").style("font-size","11px").style("font-weight","500").style("fill","#333").style("pointer-events","none").style("opacity",0).text(function(t){return t.name});var x=v.merge(f);x.transition().duration(N).attr("transform",function(t){return"translate(".concat(n(t.visits),", ").concat(o(t.attendance_rate),")")}),x.select("circle").transition().duration(N).attr("r",function(t){return Math.max(0,l(t.total_revenue))}),x.select("text").transition().duration(N).attr("dy",function(t){return-Math.max(0,l(t.total_revenue))-8}).style("opacity",1),x.select("circle").on("mouseover",function(t,e){var n=a.Ltv(this.parentNode);n.select("circle").transition().duration(200).style("opacity",1).style("stroke-width",3),n.select("text").transition().duration(200).style("font-size","13px").style("font-weight","bold"),i.html("\n <strong>".concat(e.name,"</strong><br>\n Visits: ").concat(e.visits,"<br>\n Attendance rate: ").concat(null!=e.attendance_rate?e.attendance_rate.toFixed(1)+"%":"N/A","<br>\n Revenue/visit: $").concat(null!=e.revenue_per_visit?e.revenue_per_visit.toFixed(2):"N/A","<br>\n Total revenue: $").concat(a.GPZ(",")(Math.round(e.total_revenue)),"<br>\n Discipline: ").concat(e.specialty,"<br>\n Month: ").concat(c.monthLabel,"\n ")).style("left",t.pageX+10+"px").style("top",t.pageY-10+"px").style("opacity",1)}).on("mouseout",function(){var t=a.Ltv(this.parentNode);t.select("circle").transition().duration(200).style("opacity",.7).style("stroke-width",2),t.select("text").transition().duration(200).style("font-size","11px").style("font-weight","500"),i.style("opacity",0)}).on("click",function(t,e){P(e)});var b=document.querySelector('[data-revenue-universe-target="currentMonth"]');b&&(b.textContent=c.monthLabel)}else console.error("Chart not initialized")},P=function(t){var e=new CustomEvent("revenue-universe:therapist-selected",{detail:{therapist:t}});document.dispatchEvent(e)};return r={init:function(){var t=a.Ltv("#revenue-universe-chart");if(!t.node())return console.warn("Revenue universe chart element not found"),!1;t.selectAll("*").remove();var e=t.node().dataset.metrics;if(!e)return console.error("No metrics data found"),L(t,"No data available"),!1;try{var n=JSON.parse(e);if(console.log("Parsed data:",n),!n||!n.monthly_snapshots||0===n.monthly_snapshots.length)return console.error("Invalid or empty data structure"),L(t,"No performance data available"),!1;console.log("Monthly snapshots count:",n.monthly_snapshots.length),console.log("First snapshot:",n.monthly_snapshots[0]),D(n),F(t),z=!0;var r=A.length-1;return V(r),!0}catch(o){return console.error("Error parsing metrics data:",o),L(t,"Error loading data"),!1}},playAnimation:function(){if(console.log("playAnimation called, isInitialized:",z),z)return k?(clearInterval(k),k=null,console.log("Animation paused"),!1):(w>=A.length-1&&(w=0),console.log("Starting/resuming animation from month:",w),V(w),k=setInterval(function(){++w>=A.length?(clearInterval(k),k=null,w=A.length-1,console.log("Animation completed")):V(w)},3e3),!0);console.error("Cannot play animation - chart not initialized")},pauseAnimation:function(){return console.log("pauseAnimation called"),!!k&&(clearInterval(k),k=null,console.log("Animation paused at month:",w),!0)},resetView:function(){console.log("resetView called, isInitialized:",z),z?(k&&(clearInterval(k),k=null),w=A.length-1,V(w),console.log("View reset to latest month:",w)):console.error("Cannot reset view - chart not initialized")},destroy:function(){k&&(clearInterval(k),k=null),i&&(i.remove(),i=null);var t=a.Ltv("#revenue-universe-chart");t.node()&&t.selectAll("*").remove(),z=!1,console.log("Chart destroyed")},isInitialized:function(){return z},isAnimating:function(){return null!==k}}};n.dn(o),n.d(e,["default",0,o])}}]); 2//# sourceMappingURL=7982-0f7dfa3de6f17d2518e4.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.