maidr 3.9.2 → 3.10.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.
- package/dist/maidr.js +2 -2
- package/dist/maidr.js.map +1 -1
- package/package.json +1 -1
package/dist/maidr.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(br){typeof define=="function"&&define.amd?define(br):br()})(function(){"use strict";var lae=Object.defineProperty;var sae=(br,g4,b1)=>g4 in br?lae(br,g4,{enumerable:!0,configurable:!0,writable:!0,value:b1}):br[g4]=b1;var oe=(br,g4,b1)=>sae(br,typeof g4!="symbol"?g4+"":g4,b1);function br(e,t){for(var r=0;r<t.length;r++){const s=t[r];if(typeof s!="string"&&!Array.isArray(s)){for(const o in s)if(o!=="default"&&!(o in e)){const a=Object.getOwnPropertyDescriptor(s,o);a&&Object.defineProperty(e,o,a.get?a:{enumerable:!0,get:()=>s[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var g4=(e=>(e.CLICK="click",e.DOM_LOADED="DOMContentLoaded",e.FOCUS_IN="focusin",e.FOCUS_OUT="focusout",e.SELECTION_CHANGE="selectionchange",e))(g4||{}),b1=(e=>(e.BRAILLE="BRAILLE",e.CHAT="CHAT",e.HELP="HELP",e.FIGURE_LABEL="FIGURE_LABEL",e.SUBPLOT="SUBPLOT",e.TRACE="TRACE",e.TRACE_LABEL="TRACE_LABEL",e.REVIEW="REVIEW",e.SETTINGS="SETTINGS",e))(b1||{});class Q9{constructor(){oe(this,"listeners");oe(this,"event",t=>(this.listeners.add(t),{dispose:()=>this.listeners.delete(t)}));this.listeners=new Set}dispose(){this.listeners.clear()}fire(t){for(const r of this.listeners)r(t)}}class xe{constructor(){}}oe(xe,"ARTICLE","article"),oe(xe,"DIV","div"),oe(xe,"FIGURE","figure"),oe(xe,"IMAGE","img"),oe(xe,"INPUT","input"),oe(xe,"TEXT_AREA","textarea"),oe(xe,"BRAILLE_TEXT_AREA","maidr-braille-textarea"),oe(xe,"MAIDR_ARTICLE","maidr-article"),oe(xe,"MAIDR_FIGURE","maidr-figure"),oe(xe,"MAIDR_HIGHLIGHT","maidr-highlight"),oe(xe,"REACT_CONTAINER","maidr-react-container"),oe(xe,"REVIEW_INPUT","maidr-review-input"),oe(xe,"TEXT_CONTAINER","maidr-text-container"),oe(xe,"ARIA_LABEL","aria-label"),oe(xe,"CIRCLE_X","cx"),oe(xe,"CIRCLE_Y","cy"),oe(xe,"D","d"),oe(xe,"FILL","fill"),oe(xe,"POINTS","points"),oe(xe,"RADIUS","r"),oe(xe,"ROLE","role"),oe(xe,"STROKE","stroke"),oe(xe,"STROKE_WIDTH","stroke-width"),oe(xe,"TITLE","title"),oe(xe,"VISIBILITY","visibility"),oe(xe,"X1","x1"),oe(xe,"X2","x2"),oe(xe,"Y1","y1"),oe(xe,"Y2","y2"),oe(xe,"AFTER_END","afterend"),oe(xe,"APPLICATION","application"),oe(xe,"ARE"," are "),oe(xe,"CIRCLE","circle"),oe(xe,"CLOSE_BRACKET","]"),oe(xe,"COMMA",","),oe(xe,"COMMA_SPACE",", "),oe(xe,"EMPTY",""),oe(xe,"HIDDEN","hidden"),oe(xe,"IS"," is "),oe(xe,"LINE","line"),oe(xe,"MAIDR_DATA","maidr-data"),oe(xe,"MAIDR_HIGHLIGHT_COLOR","#BADA55"),oe(xe,"NEW_LINE",`
|
|
2
|
-
`),oe(xe,"OPEN_BRACKET","["),oe(xe,"POLYLINE","polyline"),oe(xe,"SPACE"," "),oe(xe,"THROUGH"," through "),oe(xe,"TRANSPARENT","transparent"),oe(xe,"VISIBLE","visible"),oe(xe,"X","x"),oe(xe,"Y","y");let ag=class{constructor(){oe(this,"items");this.items=new Array}push(t){this.items.push(t)}pop(){return this.items.pop()}peek(){return this.items[this.items.length-1]}removeLast(t,r=1){const s=this.items.lastIndexOf(t);return s!==-1?(this.items.splice(s,r),!0):!1}isEmpty(){return this.items.length===0}size(){return this.items.length}clear(){this.items.length=0}};const og=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function lg(e,t,r,s){e.addEventListener?e.addEventListener(t,r,s):e.attachEvent&&e.attachEvent("on".concat(t),r)}function mc(e,t,r,s){e.removeEventListener?e.removeEventListener(t,r,s):e.detachEvent&&e.detachEvent("on".concat(t),r)}function kH(e,t){const r=t.slice(0,t.length-1);for(let s=0;s<r.length;s++)r[s]=e[r[s].toLowerCase()];return r}function NH(e){typeof e!="string"&&(e=""),e=e.replace(/\s/g,"");const t=e.split(",");let r=t.lastIndexOf("");for(;r>=0;)t[r-1]+=",",t.splice(r,1),r=t.lastIndexOf("");return t}function WP(e,t){const r=e.length>=t.length?e:t,s=e.length>=t.length?t:e;let o=!0;for(let a=0;a<r.length;a++)s.indexOf(r[a])===-1&&(o=!1);return o}const yc={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":og?173:189,"=":og?61:187,";":og?59:186,"'":222,"[":219,"]":221,"\\":220},o5={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},vc={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},M3={16:!1,18:!1,17:!1,91:!1},L2={};for(let e=1;e<20;e++)yc["f".concat(e)]=111+e;let d2=[],gc=null,BH="all";const M0=new Map,Lc=e=>yc[e.toLowerCase()]||o5[e.toLowerCase()]||e.toUpperCase().charCodeAt(0),YP=e=>Object.keys(yc).find(t=>yc[t]===e),KP=e=>Object.keys(o5).find(t=>o5[t]===e);function PH(e){BH=e||"all"}function xc(){return BH||"all"}function JP(){return d2.slice(0)}function ej(){return d2.map(e=>YP(e)||KP(e)||String.fromCharCode(e))}function tj(){const e=[];return Object.keys(L2).forEach(t=>{L2[t].forEach(r=>{let{key:s,scope:o,mods:a,shortcut:i}=r;e.push({scope:o,shortcut:i,mods:a,keys:s.split("+").map(l=>Lc(l))})})}),e}function nj(e){const t=e.target||e.srcElement,{tagName:r}=t;let s=!0;const o=r==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(o||r==="TEXTAREA"||r==="SELECT")&&!t.readOnly)&&(s=!1),s}function rj(e){return typeof e=="string"&&(e=Lc(e)),d2.indexOf(e)!==-1}function ij(e,t){let r,s;e||(e=xc());for(const o in L2)if(Object.prototype.hasOwnProperty.call(L2,o))for(r=L2[o],s=0;s<r.length;)r[s].scope===e?r.splice(s,1).forEach(i=>{let{element:l}=i;return sg(l)}):s++;xc()===e&&PH(t||"all")}function aj(e){let t=e.keyCode||e.which||e.charCode;const r=d2.indexOf(t);if(r>=0&&d2.splice(r,1),e.key&&e.key.toLowerCase()==="meta"&&d2.splice(0,d2.length),(t===93||t===224)&&(t=91),t in M3){M3[t]=!1;for(const s in o5)o5[s]===t&&(F3[s]=!1)}}function jH(e){if(typeof e>"u")Object.keys(L2).forEach(o=>{Array.isArray(L2[o])&&L2[o].forEach(a=>hp(a)),delete L2[o]}),sg(null);else if(Array.isArray(e))e.forEach(o=>{o.key&&hp(o)});else if(typeof e=="object")e.key&&hp(e);else if(typeof e=="string"){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];let[o,a]=r;typeof o=="function"&&(a=o,o=""),hp({key:e,scope:o,method:a,splitKey:"+"})}}const hp=e=>{let{key:t,scope:r,method:s,splitKey:o="+"}=e;NH(t).forEach(i=>{const l=i.split(o),T=l.length,u=l[T-1],Q=u==="*"?"*":Lc(u);if(!L2[Q])return;r||(r=xc());const f=T>1?kH(o5,l):[],h=[];L2[Q]=L2[Q].filter(p=>{const g=(s?p.method===s:!0)&&p.scope===r&&WP(p.mods,f);return g&&h.push(p.element),!g}),h.forEach(p=>sg(p))})};function IH(e,t,r,s){if(t.element!==s)return;let o;if(t.scope===r||t.scope==="all"){o=t.mods.length>0;for(const a in M3)Object.prototype.hasOwnProperty.call(M3,a)&&(!M3[a]&&t.mods.indexOf(+a)>-1||M3[a]&&t.mods.indexOf(+a)===-1)&&(o=!1);(t.mods.length===0&&!M3[16]&&!M3[18]&&!M3[17]&&!M3[91]||o||t.shortcut==="*")&&(t.keys=[],t.keys=t.keys.concat(d2),t.method(e,t)===!1&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0)))}}function FH(e,t){const r=L2["*"];let s=e.keyCode||e.which||e.charCode;if(!F3.filter.call(this,e))return;if((s===93||s===224)&&(s=91),d2.indexOf(s)===-1&&s!==229&&d2.push(s),["metaKey","ctrlKey","altKey","shiftKey"].forEach(l=>{const T=vc[l];e[l]&&d2.indexOf(T)===-1?d2.push(T):!e[l]&&d2.indexOf(T)>-1?d2.splice(d2.indexOf(T),1):l==="metaKey"&&e[l]&&(d2=d2.filter(u=>u in vc||u===s))}),s in M3){M3[s]=!0;for(const l in o5)if(Object.prototype.hasOwnProperty.call(o5,l)){const T=vc[o5[l]];F3[l]=e[T]}if(!r)return}for(const l in M3)Object.prototype.hasOwnProperty.call(M3,l)&&(M3[l]=e[vc[l]]);e.getModifierState&&!(e.altKey&&!e.ctrlKey)&&e.getModifierState("AltGraph")&&(d2.indexOf(17)===-1&&d2.push(17),d2.indexOf(18)===-1&&d2.push(18),M3[17]=!0,M3[18]=!0);const o=xc();if(r)for(let l=0;l<r.length;l++)r[l].scope===o&&(e.type==="keydown"&&r[l].keydown||e.type==="keyup"&&r[l].keyup)&&IH(e,r[l],o,t);if(!(s in L2))return;const a=L2[s],i=a.length;for(let l=0;l<i;l++)if((e.type==="keydown"&&a[l].keydown||e.type==="keyup"&&a[l].keyup)&&a[l].key){const T=a[l],{splitKey:u}=T,Q=T.key.split(u),f=[];for(let h=0;h<Q.length;h++)f.push(Lc(Q[h]));f.sort().join("")===d2.sort().join("")&&IH(e,T,o,t)}}function F3(e,t,r){d2=[];const s=NH(e);let o=[],a="all",i=document,l=0,T=!1,u=!0,Q="+",f=!1,h=!1;for(r===void 0&&typeof t=="function"&&(r=t),Object.prototype.toString.call(t)==="[object Object]"&&(t.scope&&(a=t.scope),t.element&&(i=t.element),t.keyup&&(T=t.keyup),t.keydown!==void 0&&(u=t.keydown),t.capture!==void 0&&(f=t.capture),typeof t.splitKey=="string"&&(Q=t.splitKey),t.single===!0&&(h=!0)),typeof t=="string"&&(a=t),h&&jH(e,a);l<s.length;l++)e=s[l].split(Q),o=[],e.length>1&&(o=kH(o5,e)),e=e[e.length-1],e=e==="*"?"*":Lc(e),e in L2||(L2[e]=[]),L2[e].push({keyup:T,keydown:u,scope:a,mods:o,shortcut:s[l],method:r,key:s[l],splitKey:Q,element:i});if(typeof i<"u"&&window){if(!M0.has(i)){const p=function(){let g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;return FH(g,i)},v=function(){let g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;FH(g,i),aj(g)};M0.set(i,{keydownListener:p,keyupListenr:v,capture:f}),lg(i,"keydown",p,f),lg(i,"keyup",v,f)}if(!gc){const p=()=>{d2=[]};gc={listener:p,capture:f},lg(window,"focus",p,f)}}}function oj(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(L2).forEach(r=>{L2[r].filter(o=>o.scope===t&&o.shortcut===e).forEach(o=>{o&&o.method&&o.method()})})}function sg(e){const t=Object.values(L2).flat();if(t.findIndex(s=>{let{element:o}=s;return o===e})<0){const{keydownListener:s,keyupListenr:o,capture:a}=M0.get(e)||{};s&&o&&(mc(e,"keyup",o,a),mc(e,"keydown",s,a),M0.delete(e))}if((t.length<=0||M0.size<=0)&&(Object.keys(M0).forEach(o=>{const{keydownListener:a,keyupListenr:i,capture:l}=M0.get(o)||{};a&&i&&(mc(o,"keyup",i,l),mc(o,"keydown",a,l),M0.delete(o))}),M0.clear(),Object.keys(L2).forEach(o=>delete L2[o]),gc)){const{listener:o,capture:a}=gc;mc(window,"focus",o,a),gc=null}}const ug={getPressedKeyString:ej,setScope:PH,getScope:xc,deleteScope:ij,getPressedKeyCodes:JP,getAllKeyCodes:tj,isPressed:rj,filter:nj,trigger:oj,unbind:jH,keyMap:yc,modifier:o5,modifierMap:vc};for(const e in ug)Object.prototype.hasOwnProperty.call(ug,e)&&(F3[e]=ug[e]);if(typeof window<"u"){const e=window.hotkeys;F3.noConflict=t=>(t&&window.hotkeys===F3&&(window.hotkeys=e),F3),window.hotkeys=F3}class lj{constructor(t){oe(this,"id");oe(this,"instructionContext");oe(this,"plotContext");oe(this,"scopeContext");this.id=t.id,this.plotContext=new ag,this.scopeContext=new ag;const r=t.state;if(r.empty||r.size!==1){this.instructionContext=t,this.plotContext.push(t),this.scopeContext.push(b1.SUBPLOT);return}this.scopeContext.push(b1.TRACE);const s=t.activeSubplot.state;if(s.empty||s.size!==1){this.instructionContext=t.activeSubplot,this.plotContext.push(t.activeSubplot),this.plotContext.push(t.activeSubplot.activeTrace);return}this.instructionContext=t.activeSubplot.activeTrace,this.plotContext.push(t.activeSubplot.activeTrace)}dispose(){this.plotContext.clear(),this.scopeContext.clear()}get active(){return this.plotContext.peek()}get state(){return this.active.state}toggleScope(t){this.scopeContext.removeLast(t)||this.scopeContext.push(t),F3.setScope(this.scope)}get scope(){return this.scopeContext.peek()}isMovable(t){return this.active.isMovable(t)}moveOnce(t){this.active.moveOnce(t)}moveToExtreme(t){this.active.moveToExtreme(t)}moveToIndex(t,r){this.active.moveToIndex(t,r)}stepTrace(t){if(this.plotContext.size()>1){this.plotContext.pop();const r=this.active;r.moveOnce(t),this.active.notifyStateUpdate(),this.plotContext.push(r.activeTrace)}}enterSubplot(){if(this.active.state.type==="figure"){const r=this.active;this.plotContext.push(r.activeSubplot),this.active.notifyStateUpdate(),this.plotContext.push(r.activeSubplot.activeTrace),this.toggleScope(b1.TRACE)}}exitSubplot(){this.plotContext.size()>2&&(this.plotContext.pop(),this.plotContext.pop(),this.active.notifyStateUpdate(),this.toggleScope(b1.TRACE))}getInstruction(t){const r=this.instructionContext.state;if(r.empty)return`No ${r.type} info available`;const s=t?"Click to activate.":xe.EMPTY;switch(r.type){case"figure":return`This is a MAIDR figure containing ${r.size} subplots. ${s} Use arrow keys to navigate subplots and press 'ENTER'.`;case"subplot":return`This is a MAIDR subplot containing ${r.size} layers, and this is layer 1 of ${r.size}: ${r.trace.traceType} plot. ${s} Use Arrows to navigate data points. Toggle B for Braille, T for Text, S for Sonification, and R for Review mode.`;case"trace":return`This is a maidr plot of type: ${r.traceType}. ${s} Use Arrows to navigate data points. Toggle B for Braille, T for Text, S for Sonification, and R for Review mode.`}}}const sj="unavailable",uj="X",cj="Y",Tj="unavailable";class cg{constructor(){oe(this,"observers");oe(this,"isInitialEntry");oe(this,"isOutOfBounds");oe(this,"row");oe(this,"col");this.observers=new Array,this.isInitialEntry=!0,this.isOutOfBounds=!1,this.row=0,this.col=0}dispose(){for(const t of this.observers)this.removeObserver(t);this.observers.length=0}moveOnce(t){if(this.isInitialEntry){this.handleInitialEntry(),this.notifyStateUpdate();return}if(!this.isMovable(t)){this.notifyOutOfBounds();return}switch(t){case"UPWARD":this.row+=1;break;case"DOWNWARD":this.row-=1;break;case"FORWARD":this.col+=1;break;case"BACKWARD":this.col-=1;break}this.notifyStateUpdate()}moveToExtreme(t){switch(this.isInitialEntry&&this.handleInitialEntry(),t){case"UPWARD":this.row=this.values.length-1;break;case"DOWNWARD":this.row=0;break;case"FORWARD":this.col=this.values[this.row].length-1;break;case"BACKWARD":this.col=0;break}this.notifyStateUpdate()}moveToIndex(t,r){this.isMovable([t,r])&&(this.row=t,this.col=r,this.isInitialEntry=!1,this.notifyStateUpdate())}isMovable(t){if(Array.isArray(t)){const[r,s]=t;return r>=0&&r<this.values.length&&s>=0&&s<this.values[this.row].length}switch(t){case"UPWARD":return this.row<this.values.length-1;case"DOWNWARD":return this.row>0;case"FORWARD":return this.col<this.values[this.row].length-1;case"BACKWARD":return this.col>0}}handleInitialEntry(){this.isInitialEntry=!1,this.row=Math.max(0,Math.min(this.row,this.values.length-1)),this.col=Math.max(0,Math.min(this.col,this.values[this.row].length-1))}addObserver(t){this.observers.push(t)}removeObserver(t){this.observers=this.observers.filter(r=>r!==t)}notifyStateUpdate(){const t=this.state;for(const r of this.observers)r.update(t)}notifyOutOfBounds(){this.isOutOfBounds=!0,this.notifyStateUpdate(),this.isOutOfBounds=!1}}class f9 extends cg{constructor(r){var s,o,a;super();oe(this,"id");oe(this,"type");oe(this,"title");oe(this,"xAxis");oe(this,"yAxis");oe(this,"fill");this.id=r.id,this.type=r.type,this.title=r.title??sj,this.xAxis=((s=r.axes)==null?void 0:s.x)??uj,this.yAxis=((o=r.axes)==null?void 0:o.y)??cj,this.fill=((a=r.axes)==null?void 0:a.fill)??Tj}dispose(){this.values.length=0,this.highlightValues&&(this.highlightValues.forEach(r=>r.forEach(s=>{(Array.isArray(s)?s:[s]).forEach(a=>a.remove())})),this.highlightValues.length=0),super.dispose()}get state(){return this.isOutOfBounds?{empty:!0,type:"trace",traceType:this.type}:{empty:!1,type:"trace",traceType:this.type,title:this.title,xAxis:this.xAxis,yAxis:this.yAxis,fill:this.fill,hasMultiPoints:this.hasMultiPoints(),audio:this.audio(),braille:this.braille(),text:this.text(),autoplay:this.autoplay,highlight:this.highlight()}}highlight(){return this.highlightValues===null||this.isInitialEntry?{empty:!0,type:"trace",traceType:this.type}:{empty:!1,elements:this.highlightValues[this.row][this.col]}}getAudioGroupIndex(){return this.values&&this.values.length>1?{groupIndex:this.row}:{}}get autoplay(){return{UPWARD:this.values.length,DOWNWARD:this.values.length,FORWARD:this.values[this.row].length,BACKWARD:this.values[this.row].length}}hasMultiPoints(){return!1}}var U2=(e=>(e.VERTICAL="vert",e.HORIZONTAL="horz",e))(U2||{}),R2=(e=>(e.BAR="bar",e.BOX="box",e.CANDLESTICK="candlestick",e.DODGED="dodged_bar",e.HEATMAP="heat",e.HISTOGRAM="hist",e.LINE="line",e.NORMALIZED="stacked_normalized_bar",e.SCATTER="point",e.SMOOTH="smooth",e.STACKED="stacked_bar",e))(R2||{});class z3{constructor(){}static safeMin(t){return t.length===0?1/0:Math.min(...t)}static safeMax(t){return t.length===0?-1/0:Math.max(...t)}static minFrom2D(t){const r=t.flat();return this.safeMin(r)}static maxFrom2D(t){const r=t.flat();return this.safeMax(r)}static minMax(t){if(t.length===0)return{min:1/0,max:-1/0};let r=t[0],s=t[0];for(let o=1;o<t.length;o++){const a=t[o];a<r&&(r=a),a>s&&(s=a)}return{min:r,max:s}}static minMaxFrom2D(t){const r=t.flat();return this.minMax(r)}}class pp{constructor(){}static parse(t){const r=t.replace(/\s/g,"").toLowerCase();if(/^#(?:[a-f0-9]{3}){1,2}$/.test(r)){let o=r.substring(1).split("");return o.length===3&&(o=[o[0],o[0],o[1],o[1],o[2],o[2]]),{r:Number.parseInt(o[0]+o[1],16),g:Number.parseInt(o[2]+o[3],16),b:Number.parseInt(o[4]+o[5],16)}}const s=r.match(/^rgba?\((\d+),(\d+),(\d+)(?:,\d*(?:\.\d*)?)?\)$/);return s?{r:Number.parseInt(s[1],10),g:Number.parseInt(s[2],10),b:Number.parseInt(s[3],10)}:null}static invert(t){return{r:255-t.r,g:255-t.g,b:255-t.b}}static getContrastRatio(t,r){const s=this.calculateLuminance(t),o=this.calculateLuminance(r);return(Math.max(s,o)+.05)/(Math.min(s,o)+.05)}static calculateLuminance(t){const[r,s,o]=[t.r,t.g,t.b].map(a=>{const i=a/255;return i<=.03928?i/12.92:((i+.055)/1.055)**2.4});return .2126*r+.7152*s+.0722*o}static rgbToString(t){return`rgb(${t.r}, ${t.g}, ${t.b})`}}class u2{constructor(){}static async toBase64(t){try{const r=new XMLSerializer().serializeToString(t).replace(/>\s+</g,"> <").replace(/\s{2,}/g," ").trim(),o=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(r).replace(/'/g,"%27").replace(/"/g,"%22")}`,a=await new Promise((T,u)=>{const Q=new Image;Q.onload=()=>T(Q),Q.onerror=()=>u(new Error("Failed to load SVG image")),Q.src=o}),i=document.createElement("canvas");[i.width,i.height]=[a.naturalWidth,a.naturalHeight];const l=i.getContext("2d");return l?(l.drawImage(a,0,0),i.toDataURL("image/jpeg",.92)):(console.error("Error converting SVG to Base 64: Canvas context unavailable"),"")}catch(r){return console.error("Error converting SVG to Base 64:",r instanceof Error?r.message:r),""}}static selectAllElements(t,r=!0){return Array.from(document.querySelectorAll(t)).map(s=>{if(!r)return s;const o=s.cloneNode(!0);return o.setAttribute(xe.VISIBILITY,xe.HIDDEN),s.insertAdjacentElement(xe.AFTER_END,o),o})}static selectElement(t,r=!0){const s=document.querySelector(t);if(!r)return s;const o=s==null?void 0:s.cloneNode(!0);return o==null||o.setAttribute(xe.VISIBILITY,xe.HIDDEN),s==null||s.insertAdjacentElement(xe.AFTER_END,o),o}static createEmptyElement(t="rect"){const r=document.createElementNS(this.SVG_NAMESPACE,t);return r.setAttribute(xe.FILL,xe.TRANSPARENT),r.setAttribute(xe.STROKE,xe.TRANSPARENT),r.setAttribute(xe.VISIBILITY,xe.HIDDEN),r}static createCircleElement(t,r,s){var u;const o=window.getComputedStyle(s),a=o.stroke||o.fill,i=o.strokeWidth||"2",l=Number.parseFloat(i)*2,T=document.createElementNS(this.SVG_NAMESPACE,xe.CIRCLE);return T.setAttribute(xe.CIRCLE_X,String(t)),T.setAttribute(xe.CIRCLE_Y,String(r)),T.setAttribute(xe.RADIUS,String(l)),T.setAttribute(xe.FILL,a),T.setAttribute(xe.STROKE,a),T.setAttribute(xe.STROKE_WIDTH,i),T.setAttribute(xe.VISIBILITY,xe.HIDDEN),(u=s.parentElement)==null||u.insertAdjacentElement(xe.AFTER_END,T),T}static createLineElement(t,r){const o=t.getBBox();let a,i,l,T;switch(r){case"top":[a,i,l,T]=[o.x,o.y,o.x+o.width,o.y];break;case"bottom":[a,i,l,T]=[o.x,o.y+o.height,o.x+o.width,o.y+o.height];break;case"left":[a,i,l,T]=[o.x,o.y,o.x,o.y+o.height];break;case"right":[a,i,l,T]=[o.x+o.width,o.y,o.x+o.width,o.y+o.height];break}const u=window.getComputedStyle(t),Q=document.createElementNS(this.SVG_NAMESPACE,xe.LINE);return Q.setAttribute(xe.X1,String(a)),Q.setAttribute(xe.Y1,String(i)),Q.setAttribute(xe.X2,String(l)),Q.setAttribute(xe.Y2,String(T)),Q.setAttribute(xe.STROKE,u.stroke),Q.setAttribute(xe.STROKE_WIDTH,u.strokeWidth||"2"),Q.setAttribute(xe.VISIBILITY,xe.HIDDEN),t.insertAdjacentElement(xe.AFTER_END,Q),Q}static createHighlightElement(t,r){const s=t.cloneNode(!0),o=t.tagName.toLowerCase(),a=o===xe.POLYLINE||o===xe.LINE,i=a?window.getComputedStyle(t).getPropertyValue(xe.STROKE):window.getComputedStyle(t).getPropertyValue(xe.FILL),l=this.getHighlightColor(i,r);if(s.setAttribute(xe.VISIBILITY,xe.VISIBLE),s.setAttribute(xe.STROKE,l),s.setAttribute(xe.FILL,l),s.style.fill=l,s.style.stroke=l,a){const T=window.getComputedStyle(s).getPropertyValue(xe.STROKE_WIDTH);s.setAttribute(xe.STROKE_WIDTH,`${T+2}`)}return t.insertAdjacentElement(xe.AFTER_END,s),s}static getHighlightColor(t,r){const s=pp.parse(t);if(!s)return r;const o=pp.invert(s);return pp.getContrastRatio(s,o)>=4.5?pp.rgbToString(o):r}}oe(u2,"SVG_NAMESPACE","http://www.w3.org/2000/svg");class Tg extends f9{constructor(r,s){super(r);oe(this,"points");oe(this,"barValues");oe(this,"highlightValues");oe(this,"orientation");oe(this,"min");oe(this,"max");this.points=s,this.orientation=r.orientation??U2.VERTICAL,this.barValues=s.map(o=>o.map(a=>this.orientation===U2.VERTICAL?Number(a.y):Number(a.x))),this.min=this.barValues.map(o=>z3.safeMin(o)),this.max=this.barValues.map(o=>z3.safeMax(o)),this.highlightValues=this.mapToSvgElements(r.selectors)}dispose(){this.points.length=0,this.min.length=0,this.max.length=0,super.dispose()}get values(){return this.barValues}audio(){const r=this.orientation===U2.VERTICAL,s=r?this.barValues[this.row].length:this.barValues.length,o=r?this.col:this.row,a=r?this.barValues[this.row][this.col]:this.barValues[this.col][this.row];return{min:z3.safeMin(this.min),max:z3.safeMax(this.max),size:s,index:o,value:a,...this.getAudioGroupIndex()}}braille(){return{empty:!1,id:this.id,values:this.barValues,min:this.min,max:this.max,row:this.row,col:this.col}}text(){const r=this.orientation===U2.VERTICAL,s=this.points[this.row][this.col],o=r?this.xAxis:this.yAxis,a=r?s.x:s.y,i=r?this.yAxis:this.xAxis,l=r?s.y:s.x;return{main:{label:o,value:a},cross:{label:i,value:l}}}mapToSvgElements(r){if(!r)return null;const s=[u2.selectAllElements(r)];if(s.length!==this.points.length)return null;for(let o=0;o<this.points.length;o++)if(s[o].length!==this.points[o].length)return null;return s}}class Qj extends Tg{constructor(t){super(t,[t.data])}}const fj="Lower outlier(s)",dj="Upper outlier(s)",hj="Minimum",pj="Maximum",mj="25%",yj="50%",vj="75%";class gj extends f9{constructor(r){super(r);oe(this,"points");oe(this,"boxValues");oe(this,"highlightValues");oe(this,"orientation");oe(this,"sections");oe(this,"min");oe(this,"max");this.points=r.data,this.orientation=r.orientation??U2.VERTICAL,this.sections=[fj,hj,mj,yj,vj,pj,dj];const s=[a=>a.lowerOutliers,a=>a.min,a=>a.q1,a=>a.q2,a=>a.q3,a=>a.max,a=>a.upperOutliers];this.orientation===U2.HORIZONTAL?this.boxValues=this.points.map(a=>s.map(i=>i(a))):this.boxValues=s.map(a=>this.points.map(i=>a(i)));const o=this.boxValues.map(a=>a.flatMap(i=>Array.isArray(i)?i:[i]));this.min=z3.minFrom2D(o),this.max=z3.maxFrom2D(o),this.row=this.boxValues.length-1,this.highlightValues=this.mapToSvgElements(r.selectors)}dispose(){this.points.length=0,this.sections.length=0,super.dispose()}moveToIndex(r,s){const o=this.orientation===U2.HORIZONTAL;r=o?r:s,s=o?s:r,super.moveToIndex(r,s)}get values(){return this.boxValues}audio(){const r=this.orientation===U2.HORIZONTAL,s=this.boxValues[this.row][this.col],o=r?this.sections.length:this.points.length,a=r?this.col:this.col;return{min:this.min,max:this.max,size:o,index:a,value:s}}braille(){const r=this.orientation===U2.HORIZONTAL,s=r?this.row:this.col,o=r?this.col:this.row;return{empty:!1,id:this.id,values:this.points,min:this.min,max:this.max,row:s,col:o}}text(){const r=this.orientation===U2.HORIZONTAL,s=r?this.points[this.row]:this.points[this.col],o=r?this.yAxis:this.xAxis,a=r?this.sections[this.col]:this.sections[this.row],i=r?this.xAxis:this.yAxis,l=this.boxValues[this.row][this.col];return{main:{label:o,value:s.fill},cross:{label:i,value:l},section:a}}mapToSvgElements(r){if(!r||r.length!==this.points.length)return null;const s=this.orientation===U2.VERTICAL,o=new Array;if(s)for(let a=0;a<this.sections.length;a++)o.push(Array.from({length:r.length}));return r.forEach((a,i)=>{const l=a.lowerOutliers.flatMap(b=>u2.selectAllElements(b)),T=a.upperOutliers.flatMap(b=>u2.selectAllElements(b)),u=u2.selectElement(a.min)??u2.createEmptyElement(),Q=u2.selectElement(a.max)??u2.createEmptyElement(),f=u2.selectElement(a.iq)??u2.createEmptyElement(),h=u2.selectElement(a.q2)??u2.createEmptyElement(),[p,v]=s?[u2.createLineElement(f,"top"),u2.createLineElement(f,"bottom")]:[u2.createLineElement(f,"left"),u2.createLineElement(f,"right")],g=[l,u,p,h,v,Q,T];s?g.forEach((b,L)=>{o[L][i]=b}):o.push(g)}),o}}const Lj="Trend";class xj extends f9{constructor(r){super(r);oe(this,"candles");oe(this,"candleValues");oe(this,"orientation");oe(this,"sections",["open","high","low","close"]);oe(this,"currentSegmentType","open");oe(this,"currentPointIndex",0);oe(this,"sortedSegmentsByPoint");oe(this,"segmentPositionMaps");oe(this,"min");oe(this,"max");const s=r.data;this.candles=s.map(o=>({...o,trend:o.close>o.open?"Bull":o.close<o.open?"Bear":"Neutral"})),this.orientation=r.orientation??U2.VERTICAL,this.candleValues=this.sections.map(o=>this.candles.map(a=>a[o])),this.min=z3.minFrom2D(this.candleValues),this.max=z3.maxFrom2D(this.candleValues),this.sortedSegmentsByPoint=this.precomputeSortedSegments(),this.segmentPositionMaps=this.precomputePositionMaps(),this.currentPointIndex=0,this.currentSegmentType="open",this.orientation===U2.HORIZONTAL?this.col=0:this.row=0}precomputeSortedSegments(){return this.candles.map(r=>this.sections.map(o=>[o,r[o]]).sort((o,a)=>o[1]-a[1]).map(o=>o[0]))}precomputePositionMaps(){return this.sortedSegmentsByPoint.map(r=>{const s=new Map;return r.forEach((o,a)=>{s.set(o,a)}),s})}getSegmentPositionInSortedOrder(r,s){return this.segmentPositionMaps[r].get(s)??0}getSegmentTypeAtSortedPosition(r,s){return this.sortedSegmentsByPoint[r][s]??"open"}updateVisualSegmentPosition(){const r=this.sections.indexOf(this.currentSegmentType);this.orientation===U2.HORIZONTAL?this.col=r:this.row=r}updateVisualPointPosition(){this.orientation===U2.HORIZONTAL?this.row=this.currentPointIndex:this.col=this.currentPointIndex}moveOnce(r){if(this.isInitialEntry){this.handleInitialEntry(),this.notifyStateUpdate();return}if(!this.isMovable(r)){this.notifyOutOfBounds();return}switch(r){case"UPWARD":case"DOWNWARD":{const s=this.getSegmentPositionInSortedOrder(this.currentPointIndex,this.currentSegmentType),o=r==="UPWARD"?s+1:s-1;if(o>=0&&o<this.sections.length)this.currentSegmentType=this.getSegmentTypeAtSortedPosition(this.currentPointIndex,o),this.updateVisualSegmentPosition();else{this.notifyOutOfBounds();return}break}case"FORWARD":case"BACKWARD":{const s=r==="FORWARD"?this.currentPointIndex+1:this.currentPointIndex-1;if(s>=0&&s<this.candles.length)this.currentPointIndex=s,this.updateVisualPointPosition(),this.updateVisualSegmentPosition();else{this.notifyOutOfBounds();return}break}}this.notifyStateUpdate()}moveToExtreme(r){switch(this.isInitialEntry&&this.handleInitialEntry(),r){case"UPWARD":{const s=this.sortedSegmentsByPoint[this.currentPointIndex];this.currentSegmentType=s[s.length-1],this.updateVisualSegmentPosition();break}case"DOWNWARD":{const s=this.sortedSegmentsByPoint[this.currentPointIndex];this.currentSegmentType=s[0],this.updateVisualSegmentPosition();break}case"FORWARD":{this.currentPointIndex=this.candles.length-1,this.updateVisualPointPosition(),this.updateVisualSegmentPosition();break}case"BACKWARD":{this.currentPointIndex=0,this.updateVisualPointPosition(),this.updateVisualSegmentPosition();break}}this.notifyStateUpdate()}isMovable(r){if(Array.isArray(r))return super.isMovable(r);if(this.isInitialEntry)return!0;switch(r){case"UPWARD":case"DOWNWARD":{const s=this.getSegmentPositionInSortedOrder(this.currentPointIndex,this.currentSegmentType),o=r==="UPWARD"?s+1:s-1;return o>=0&&o<this.sections.length}case"FORWARD":case"BACKWARD":{const s=r==="FORWARD"?this.currentPointIndex+1:this.currentPointIndex-1;return s>=0&&s<this.candles.length}}}dispose(){this.candles.length=0,super.dispose()}get values(){return this.candleValues}audio(){const r=this.candles[this.currentPointIndex][this.currentSegmentType];return{min:this.min,max:this.max,size:this.candles.length,index:this.currentPointIndex,value:r}}braille(){return{empty:!1,id:this.id,values:this.candleValues,min:this.min,max:this.max,row:this.row,col:this.col}}get highlightValues(){return null}text(){const r=this.candles[this.currentPointIndex],s=r[this.currentSegmentType];return{main:{label:this.orientation===U2.HORIZONTAL?this.yAxis:this.xAxis,value:r.value},cross:{label:this.orientation===U2.HORIZONTAL?this.xAxis:this.yAxis,value:s},section:this.currentSegmentType,fill:{label:Lj,value:r.trend}}}}class bj extends f9{constructor(r){super(r);oe(this,"heatmapValues");oe(this,"highlightValues");oe(this,"x");oe(this,"y");oe(this,"min");oe(this,"max");const s=r.data;this.x=s.x,this.y=s.y,this.heatmapValues=s.points;const{min:o,max:a}=z3.minMaxFrom2D(this.heatmapValues);this.min=o,this.max=a,this.highlightValues=this.mapToSvgElements(r.selectors)}dispose(){this.heatmapValues.length=0,this.x.length=0,this.y.length=0,super.dispose()}get values(){return this.heatmapValues}audio(){return{min:this.min,max:this.max,size:this.heatmapValues.length,index:this.col,value:this.heatmapValues[this.row][this.col]}}braille(){return{empty:!1,id:this.id,values:this.heatmapValues,min:this.min,max:this.max,row:this.row,col:this.col}}text(){return{main:{label:this.xAxis,value:this.x[this.col]},cross:{label:this.yAxis,value:this.y[this.row]},fill:{label:this.fill,value:String(this.heatmapValues[this.row][this.col])}}}mapToSvgElements(r){if(!r)return null;const s=this.heatmapValues.length,o=this.heatmapValues[0].length,a=u2.selectAllElements(r);if(a.length===0||a.length!==s*o)return null;const i=new Array;if(a[0]instanceof SVGPathElement)for(let l=0;l<s;l++){const T=s-1-l,u=new Array;for(let Q=0;Q<o;Q++){const f=T*o+Q;u.push(a[f])}i.push(u)}else if(a[0]instanceof SVGRectElement)for(let l=0;l<s;l++){const T=new Array;for(let u=0;u<o;u++){const Q=u*s+l;T.push(a[Q])}i.push(T)}return i}}class Hj extends Tg{constructor(t){super(t,[t.data])}text(){const t=this.orientation===U2.VERTICAL,r=this.points[this.row][this.col],s=t?r.xMin:r.yMin,o=t?r.xMax:r.yMax;return{...super.text(),range:{min:s,max:o}}}}const Ej="Type",zH=/[ML]\s*(-?\d+(\.\d+)?)\s+(-?\d+(\.\d+)?)/g;class qH extends f9{constructor(r){super(r);oe(this,"points");oe(this,"lineValues");oe(this,"highlightValues");oe(this,"min");oe(this,"max");this.points=r.data,this.lineValues=this.points.map(s=>s.map(o=>Number(o.y))),this.min=this.lineValues.map(s=>z3.safeMin(s)),this.max=this.lineValues.map(s=>z3.safeMax(s)),this.highlightValues=this.mapToSvgElements(r.selectors)}dispose(){this.points.length=0,this.min.length=0,this.max.length=0,super.dispose()}get values(){return this.lineValues}audio(){return{min:this.min[this.row],max:this.max[this.row],size:this.points[this.row].length,index:this.col,value:this.points[this.row][this.col].y,...this.getAudioGroupIndex()}}braille(){return{empty:!1,id:this.id,values:this.lineValues,min:this.min,max:this.max,row:this.row,col:this.col}}text(){const r=this.points[this.row][this.col],s=r.fill?{fill:{label:Ej,value:r.fill}}:{};return{main:{label:this.xAxis,value:this.points[this.row][this.col].x},cross:{label:this.yAxis,value:this.points[this.row][this.col].y},...s}}moveOnce(r){if(this.isInitialEntry){this.handleInitialEntry(),this.notifyStateUpdate();return}if(!this.isMovable(r)){this.notifyOutOfBounds();return}if(r==="UPWARD"||r==="DOWNWARD"){const s=this.findNearestLineByYValue(r);if(s!==null&&s!==this.row){this.row=s,this.notifyStateUpdate();return}else{this.notifyOutOfBounds();return}}switch(r){case"FORWARD":this.col+=1;break;case"BACKWARD":this.col-=1;break}this.notifyStateUpdate()}isMovable(r){if(Array.isArray(r)){const[s,o]=r;return s>=0&&s<this.values.length&&o>=0&&o<this.values[this.row].length}switch(r){case"UPWARD":case"DOWNWARD":return this.findNearestLineByYValue(r)!==null;case"FORWARD":return this.col<this.values[this.row].length-1;case"BACKWARD":return this.col>0}}findNearestLineByYValue(r){const s=this.col,o=this.values[this.row][s];let a=null,i=Number.POSITIVE_INFINITY;for(let l=0;l<this.values.length;l++){if(l===this.row||s>=this.values[l].length)continue;const T=this.values[l][s];if(!(r==="UPWARD"?T>o:T<o))continue;const Q=Math.abs(T-o);Q<i&&(i=Q,a=l)}return a}mapToSvgElements(r){if(!r||r.length!==this.lineValues.length)return null;const s=new Array;for(let o=0;o<r.length;o++){const a=u2.selectElement(r[o],!1);if(!a)return null;const i=new Array;if(a instanceof SVGPathElement){const T=a.getAttribute(xe.D)||xe.EMPTY;let u=zH.exec(T);for(;u!==null;)i.push({x:Number.parseFloat(u[1]),y:Number.parseFloat(u[3])}),u=zH.exec(T)}else if(a instanceof SVGPolylineElement){const u=(a.getAttribute(xe.POINTS)||xe.EMPTY).split(/\s+/).filter(Boolean);for(const Q of u){const[f,h]=Q.split(xe.COMMA);i.push({x:Number.parseFloat(f),y:Number.parseFloat(h)})}}if(i.length!==this.lineValues[o].length)return null;const l=new Array;for(const T of i){if(Number.isNaN(T.x)||Number.isNaN(T.y))return null;l.push(u2.createCircleElement(T.x,T.y,a))}s.push(l)}return s}}class Mj extends f9{constructor(r){super(r);oe(this,"mode");oe(this,"xPoints");oe(this,"yPoints");oe(this,"xValues");oe(this,"yValues");oe(this,"highlightXValues");oe(this,"highlightYValues");oe(this,"minX");oe(this,"maxX");oe(this,"minY");oe(this,"maxY");this.mode="column";const s=r.data,o=[...s].sort((T,u)=>T.x-u.x||T.y-u.y);this.xPoints=new Array;let a=null;for(const T of o)(!a||a.x!==T.x)&&(a={x:T.x,y:[]},this.xPoints.push(a)),a.y.push(T.y);const i=[...s].sort((T,u)=>T.y-u.y||T.x-u.x);this.yPoints=new Array;let l=null;for(const T of i)(!l||l.y!==T.y)&&(l={y:T.y,x:[]},this.yPoints.push(l)),l.x.push(T.x);this.xValues=this.xPoints.map(T=>T.x),this.yValues=this.yPoints.map(T=>T.y),this.minX=z3.safeMin(this.xValues),this.maxX=z3.safeMax(this.xValues),this.minY=z3.safeMin(this.yValues),this.maxY=z3.safeMax(this.yValues),[this.highlightXValues,this.highlightYValues]=this.mapToSvgElements(r.selectors)}dispose(){this.xPoints.length=0,this.yPoints.length=0,this.xValues.length=0,this.yValues.length=0,this.highlightXValues&&(this.highlightXValues.forEach(r=>r.forEach(s=>s.remove())),this.highlightXValues.length=0),this.highlightYValues&&(this.highlightYValues.forEach(r=>r.forEach(s=>s.remove())),this.highlightYValues.length=0),super.dispose()}get values(){return this.mode==="column"?[this.xValues]:[this.yValues]}get highlightValues(){return this.mode==="column"?this.highlightXValues:this.highlightYValues}getAudioGroupIndex(){return{}}audio(){if(this.mode==="column"){const r=this.xPoints[this.col];return{min:this.minY,max:this.maxY,size:r.y.length,index:this.col,value:r.y,...this.getAudioGroupIndex()}}else{const r=this.yPoints[this.row];return{min:this.minX,max:this.maxX,size:r.x.length,index:this.row,value:r.x,...this.getAudioGroupIndex()}}}braille(){return{empty:!0,type:"trace",traceType:this.type}}text(){if(this.mode==="column"){const r=this.xPoints[this.col];return{main:{label:this.xAxis,value:r.x},cross:{label:this.yAxis,value:r.y}}}else{const r=this.yPoints[this.row];return{main:{label:this.yAxis,value:r.y},cross:{label:this.xAxis,value:r.x}}}}get autoplay(){return{UPWARD:this.yValues.length,DOWNWARD:this.yValues.length,FORWARD:this.xValues.length,BACKWARD:this.xValues.length}}highlight(){if(this.highlightValues===null)return{empty:!0,type:"trace",traceType:this.type};const r=this.mode==="column"?this.col<this.highlightValues.length?this.highlightValues[this.col]:null:this.row<this.highlightValues.length?this.highlightValues[this.row]:null;return r?{empty:!1,elements:r}:{empty:!0,type:"trace",traceType:this.type}}hasMultiPoints(){return!0}toggleNavigation(){if(this.mode==="column"){const r=this.xPoints[this.col],s=r.y[Math.floor(r.y.length/2)];this.row=this.yValues.indexOf(s),this.mode="row"}else{const r=this.yPoints[this.row],s=r.x[Math.floor(r.x.length/2)];this.col=this.xValues.indexOf(s),this.mode="column"}}moveOnce(r){if(this.isInitialEntry){this.handleInitialEntry(),this.notifyStateUpdate();return}if(!this.isMovable(r)){this.notifyOutOfBounds();return}if(this.mode==="column")switch(r){case"FORWARD":this.col++;break;case"BACKWARD":this.col--;break;case"UPWARD":case"DOWNWARD":{this.toggleNavigation();break}}else switch(r){case"UPWARD":this.row++;break;case"DOWNWARD":this.row--;break;case"FORWARD":case"BACKWARD":{this.toggleNavigation();break}}this.notifyStateUpdate()}moveToExtreme(r){if(this.isInitialEntry&&this.handleInitialEntry(),this.mode==="column")switch(r){case"UPWARD":this.toggleNavigation(),this.row=this.yPoints.length-1;break;case"DOWNWARD":this.toggleNavigation(),this.row=0;break;case"FORWARD":this.col=this.xPoints.length-1;break;case"BACKWARD":this.col=0;break}else switch(r){case"UPWARD":this.row=this.yPoints.length-1;break;case"DOWNWARD":this.row=0;break;case"FORWARD":this.toggleNavigation(),this.col=this.xPoints.length-1;break;case"BACKWARD":this.toggleNavigation(),this.col=0;break}this.notifyStateUpdate()}isMovable(r){if(Array.isArray(r))return!1;if(this.mode==="column")switch(r){case"FORWARD":return this.col<this.xPoints.length-1;case"BACKWARD":return this.col>0;case"UPWARD":case"DOWNWARD":return!0}else switch(r){case"UPWARD":return this.row<this.yPoints.length-1;case"DOWNWARD":return this.row>0;case"FORWARD":case"BACKWARD":return!0}}mapToSvgElements(r){if(!r)return[null,null];const s=u2.selectAllElements(r);if(s.length===0)return[null,null];const o=new Map,a=new Map;s.forEach(T=>{const u=Number.parseFloat(T.getAttribute("x")||""),Q=Number.parseFloat(T.getAttribute("y")||"");Number.isNaN(u)||(o.has(u)||o.set(u,[]),o.get(u).push(T)),Number.isNaN(Q)||(a.has(Q)||a.set(Q,[]),a.get(Q).push(T))});const i=Array.from(o.entries()).sort(([T],[u])=>T-u).map(([T,u])=>u),l=Array.from(a.entries()).sort(([T],[u])=>u-T).map(([T,u])=>u);return[i,l]}}const $H="Sum",Sj="Level",_j="undefined";class Aj extends Tg{constructor(t){super(t,t.data),this.createSummaryLevel()}createSummaryLevel(){const t=new Array,r=new Array;for(let a=0;a<this.barValues[0].length;a++){const i=this.barValues.reduce((T,u)=>T+u[a],0);t.push(i);const l=this.orientation===U2.VERTICAL?{x:this.points[0][a].x,y:i,fill:$H}:{x:i,y:this.points[0][a].y,fill:$H};r.push(l)}this.points.push(r),this.barValues.push(t);const{min:s,max:o}=z3.minMax(t);this.min.push(s),this.max.push(o)}text(){return{...super.text(),fill:{label:Sj,value:this.points[this.row][this.col].fill??_j}}}highlight(){return this.highlightValues===null||this.row===this.barValues.length-1?{empty:!0,type:"trace",traceType:this.type}:{empty:!1,elements:this.highlightValues[this.row][this.col]}}hasMultiPoints(){return!0}mapToSvgElements(t){if(!t)return new Array;const r=u2.selectAllElements(t);if(r.length===0)return new Array;const s=new Array;if(r[0]instanceof SVGPathElement)for(let o=0,a=0;o<this.barValues.length;o++){const i=new Array;for(let l=0;l<this.barValues[o].length;l++){if(a>=r.length)return new Array;this.barValues[o][l]===0?i.push(u2.createEmptyElement()):i.push(r[a++])}s.push(i)}else if(r[0]instanceof SVGRectElement){for(let o=0;o<this.barValues.length;o++)s.push(new Array);for(let o=0,a=0;o<this.barValues[0].length;o++)for(let i=this.barValues.length-1;i>=0;i--){if(a>=r.length)return new Array;this.barValues[i][o]===0?s[i].push(u2.createEmptyElement()):s[i].push(r[a++])}}return s}}class Oj extends qH{constructor(t){super(t)}audio(){const t=this.lineValues[this.row],r=this.col,s=l=>t[Math.max(0,Math.min(l,t.length-1))],o=r>0?s(r-1):s(r),a=s(r),i=r<t.length-1?s(r+1):s(r);return{min:this.min[this.row],max:this.max[this.row],size:t.length,index:r,value:[o,a,i],isContinuous:!0,...this.getAudioGroupIndex()}}}class Cj{static create(t){switch(t.type){case R2.BAR:return new Qj(t);case R2.BOX:return new gj(t);case R2.CANDLESTICK:return new xj(t);case R2.HEATMAP:return new bj(t);case R2.HISTOGRAM:return new Hj(t);case R2.LINE:return new qH(t);case R2.SCATTER:return new Mj(t);case R2.SMOOTH:return new Oj(t);case R2.DODGED:case R2.NORMALIZED:case R2.STACKED:return new Aj(t);default:throw new Error(`Invalid trace type: ${t.type}`)}}}const wj="MAIDR Plot",Vj="unavailable",Dj="unavailable";class Rj extends cg{constructor(r){super();oe(this,"id");oe(this,"title");oe(this,"subtitle");oe(this,"caption");oe(this,"subplots");oe(this,"size");this.id=r.id,this.title=r.title??wj,this.subtitle=r.subtitle??Vj,this.caption=r.caption??Dj;const s=r.subplots;this.subplots=s.map(o=>o.map(a=>new kj(a))),this.size=this.subplots.reduce((o,a)=>o+a.length,0)}dispose(){this.subplots.forEach(r=>r.forEach(s=>s.dispose())),this.subplots.length=0,super.dispose()}get values(){return this.subplots}get activeSubplot(){return this.subplots[this.row][this.col]}get state(){if(this.isOutOfBounds)return{empty:!0,type:"figure"};const r=this.col+1+this.subplots.slice(0,this.row).reduce((s,o)=>s+o.length,0);return{empty:!1,type:"figure",title:this.title,subtitle:this.subtitle,caption:this.caption,size:this.size,index:r,subplot:this.activeSubplot.state,traceTypes:this.activeSubplot.traceTypes}}}class kj extends cg{constructor(r){super();oe(this,"traces");oe(this,"traceTypes");oe(this,"size");this.isInitialEntry=!1;const s=r.layers;this.size=s.length,this.traces=s.map(o=>[Cj.create(o)]),this.traceTypes=this.traces.flat().map(o=>{const a=o.state;return a.empty?xe.EMPTY:a.traceType})}dispose(){this.traces.forEach(r=>r.forEach(s=>s.dispose())),this.traces.length=0,super.dispose()}get values(){return this.traces}get activeTrace(){return this.traces[this.row][this.col]}get state(){return this.isOutOfBounds?{empty:!0,type:"subplot"}:{empty:!1,type:"subplot",size:this.size,index:this.row+1,trace:this.activeTrace.state}}}const es=class es{constructor(){oe(this,"basePalette");oe(this,"extendedPalette");this.basePalette=[{waveType:"sine",timbreModulation:{attack:.01,decay:.1,sustain:.8,release:.2}},{waveType:"square",timbreModulation:{attack:.005,decay:.05,sustain:.7,release:.15}},{waveType:"sawtooth",timbreModulation:{attack:.02,decay:.08,sustain:.6,release:.25}},{waveType:"triangle",timbreModulation:{attack:.015,decay:.12,sustain:.9,release:.18}}],this.extendedPalette=new Map,this.generateExtendedPalette()}dispose(){this.extendedPalette.clear()}getPaletteEntry(t){if(t<this.basePalette.length)return this.basePalette[t];const r=this.extendedPalette.get(t);if(r)return r;const s=this.generateExtendedEntry(t);return this.extendedPalette.set(t,s),s}get basePaletteSize(){return this.basePalette.length}generateExtendedPalette(){[{waveType:"sine",harmonicMix:{fundamental:1,harmonics:[{frequency:2,amplitude:.3},{frequency:3,amplitude:.15}]},timbreModulation:{attack:.02,decay:.15,sustain:.7,release:.3}},{waveType:"square",harmonicMix:{fundamental:1,harmonics:[{frequency:1.5,amplitude:.4},{frequency:2.5,amplitude:.2}]},timbreModulation:{attack:.01,decay:.08,sustain:.6,release:.4}},{waveType:"sawtooth",harmonicMix:{fundamental:1,harmonics:[{frequency:1.25,amplitude:.35},{frequency:2,amplitude:.25},{frequency:3,amplitude:.1}]},timbreModulation:{attack:.03,decay:.2,sustain:.5,release:.35}},{waveType:"triangle",harmonicMix:{fundamental:1,harmonics:[{frequency:.5,amplitude:.2},{frequency:4,amplitude:.15}]},timbreModulation:{attack:.025,decay:.18,sustain:.8,release:.25}}].forEach((r,s)=>{this.extendedPalette.set(this.basePalette.length+s,r)})}generateExtendedEntry(t){const r=t%this.basePalette.length,s=this.basePalette[r],o=Math.floor((t-this.basePalette.length)/this.basePalette.length),a=this.generateHarmonics(o),i=this.generateTimbreModulation(o,s.timbreModulation);return{waveType:s.waveType,harmonicMix:{fundamental:1,harmonics:a},timbreModulation:i}}generateHarmonics(t){const r=[],s=es.MIN_HARMONICS+t%es.HARMONIC_VARIATION;for(let o=0;o<s;o++){const a=1+(o+1)*(.5+t*.3%1),i=.4/(o+1)*(1-t*.1%.3);r.push({frequency:a,amplitude:i})}return r}generateTimbreModulation(t,r){const s=1+t*.2%.5;return{attack:Math.max(.005,Math.min(.05,r.attack*s)),decay:Math.max(.05,Math.min(.3,r.decay*s)),sustain:Math.max(.4,Math.min(.9,r.sustain+t*.1%.2)),release:Math.max(.1,Math.min(.5,r.release*s))}}};oe(es,"MIN_HARMONICS",2),oe(es,"HARMONIC_VARIATION",3);let Qg=es;const UH=200,GH=1e3,Nj=100,Bj=440,Pj=880,ZH=.3,jj=.5;class Ij{constructor(t,r){oe(this,"notification");oe(this,"audioPalette");oe(this,"isCombinedAudio");oe(this,"mode");oe(this,"activeAudioIds");oe(this,"volume");oe(this,"audioContext");oe(this,"compressor");this.notification=t,this.audioPalette=new Qg,this.isCombinedAudio=!1,this.mode="on",this.updateMode(r),this.activeAudioIds=new Map,this.volume=jj,this.audioContext=new AudioContext,this.compressor=this.initCompressor()}dispose(){this.stopAll(),this.audioPalette.dispose(),this.audioContext.state!=="closed"&&(this.compressor.disconnect(),this.audioContext.close())}initCompressor(){const t=this.audioContext.createDynamicsCompressor();t.threshold.value=-50,t.knee.value=40,t.ratio.value=12,t.attack.value=0,t.release.value=.25;const r=this.audioContext.createGain();return r.gain.value=.5,t.connect(r),r.connect(this.audioContext.destination),t}updateMode(t){if(t.empty||t.type==="figure")return;const r=t.type==="subplot"?t.trace:t;r.empty||r.hasMultiPoints===this.isCombinedAudio||(this.isCombinedAudio=r.hasMultiPoints,this.mode!=="off"&&(this.isCombinedAudio?this.mode="combined":this.mode="on"))}update(t){if(this.updateMode(t),this.mode==="off"||t.type!=="trace")return;if(t.empty){this.playEmptyTone();return}const r=t.audio,s=r.groupIndex,a=s!==void 0?this.audioPalette.getPaletteEntry(s):void 0;if(r.isContinuous)this.playSmooth(r.value,r.min,r.max,r.size,r.index,a);else if(Array.isArray(r.value)){const i=r.value;if(i.length===0){this.playZeroTone();return}let l=0;const T=this.mode==="on"?50:0,u=new Array,Q=()=>{l<i.length?(this.playTone(r.min,r.max,i[l],r.size,l++,a),u.push(setTimeout(Q,T))):this.stop(u)};Q()}else{const i=r.value;i===0?this.playZeroTone():this.playTone(r.min,r.max,i,r.size,r.index,a)}}playTone(t,r,s,o,a,i){const l={min:t,max:r},T={min:UH,max:GH},u=this.interpolate(s,l,T),Q={min:0,max:o},f={min:-1,max:1},h=this.clamp(this.interpolate(a,Q,f),-1,1);return this.playOscillator(u,h,i)}createOscillators(t,r){const s=[],o=this.audioContext.createOscillator();if(o.type=t.waveType,o.frequency.value=r,s.push(o),t.harmonicMix)for(const a of t.harmonicMix.harmonics){const i=this.audioContext.createOscillator();i.type=t.waveType,i.frequency.value=a.frequency*r,s.push(i)}return s}createGainNodes(t,r,s,o){const a=[],i=this.audioContext.currentTime;for(let l=0;l<t.length;l++){const T=this.audioContext.createGain();let u=s;if(l===0)r.harmonicMix&&(u*=r.harmonicMix.fundamental);else{const f=r.harmonicMix.harmonics[l-1];u*=f.amplitude}const Q=this.createAdsrEnvelope(T,r,u,i,o);Q!==null&&T.gain.setValueCurveAtTime(Q,i,o),a.push(T)}return a}playOscillator(t,r=0,s){const o=ZH,a=this.volume;s||(s={waveType:"sine"});const i=this.createOscillators(s,t),l=this.createGainNodes(i,s,a,o),T=this.audioContext.createStereoPanner();T.pan.value=r;const u=new PannerNode(this.audioContext,{distanceModel:"linear",positionX:0,positionY:0,positionZ:0,orientationX:0,orientationY:0,orientationZ:-1,refDistance:1,maxDistance:1e4,rolloffFactor:10,coneInnerAngle:40,coneOuterAngle:50,coneOuterGain:.4});for(let h=0;h<i.length;h++)i[h].connect(l[h]),l[h].connect(T);T.connect(u),u.connect(this.compressor),i.forEach(h=>h.start());const Q=h=>{u.disconnect(this.compressor),T.disconnect(u);for(let p=0;p<i.length;p++)l[p].disconnect(T),i[p].stop(),i[p].disconnect(l[p]);this.activeAudioIds.delete(h)},f=setTimeout(()=>Q(f),o*1e3*2);return this.activeAudioIds.set(f,i),f}createAdsrEnvelope(t,r,s,o,a){if(r!=null&&r.timbreModulation){const{attack:i,decay:l,sustain:T,release:u}=r.timbreModulation,Q=a*i,f=a*l,h=a*u,p=a-Q-f-h;return t.gain.setValueAtTime(1e-4*s,o),t.gain.linearRampToValueAtTime(s,o+Q),t.gain.linearRampToValueAtTime(T*s,o+Q+f),p>0&&t.gain.setValueAtTime(T*s,o+Q+f+p),t.gain.linearRampToValueAtTime(1e-4*s,o+a),null}else return[.5*s,s,.5*s,.5*s,.5*s,.1*s,1e-4*s]}playSmooth(t,r,s,o,a,i){const l=this.audioContext,T=l.currentTime,u=ZH,Q=(i==null?void 0:i.waveType)||"sine",f=t.map(M=>this.interpolate(M,{min:r,max:s},{min:UH,max:GH}));f.length<2&&f.push(f[0]);const h=this.clamp(this.interpolate(a,{min:0,max:o-1},{min:-1,max:1}),-1,1),p=l.createOscillator();p.type=Q,p.frequency.setValueCurveAtTime(f,T,u);const v=l.createGain(),g=this.createAdsrEnvelope(v,i,this.volume,T,u);g!==null&&v.gain.setValueCurveAtTime(g,T,u);const b=l.createStereoPanner();b.pan.value=h,p.connect(v),v.connect(b),b.connect(this.compressor),p.start(T),p.stop(T+u);const L=setTimeout(()=>{p.disconnect(),v.disconnect(),b.disconnect(),this.activeAudioIds.delete(L)},u*1e3*2);this.activeAudioIds.set(L,[p])}playEmptyTone(){const t=this.audioContext,r=t.currentTime,s=.2,o=[500,1e3,1500,2100,2700],a=[1,.6,.4,.2,.1],i=t.createGain();i.gain.setValueAtTime(.3,r),i.gain.exponentialRampToValueAtTime(.01,r+s),i.connect(this.compressor);const l=[];for(let Q=0;Q<o.length;Q++){const f=t.createOscillator(),h=t.createGain();f.frequency.value=o[Q],f.type="sine",h.gain.setValueAtTime(a[Q]*this.volume,r),h.gain.exponentialRampToValueAtTime(.001,r+s),f.connect(h),h.connect(i),f.start(r),f.stop(r+s),l.push(f)}const T=Q=>{i.disconnect(),l.forEach(f=>{f.disconnect()}),this.activeAudioIds.delete(Q)},u=setTimeout(()=>T(u),s*1e3*2);return this.activeAudioIds.set(u,l),u}playZeroTone(){return this.playOscillator(Nj,0,{waveType:"triangle"})}playWaitingTone(){return setInterval(()=>this.playOscillator(Bj,0,{waveType:"sine"}),1e3)}playCompleteTone(){return this.playOscillator(Pj,0,{waveType:"sine"})}interpolate(t,r,s){return r.min===0&&r.max===0?0:(t-r.min)/(r.max-r.min)*(s.max-s.min)+s.min}clamp(t,r,s){return Math.max(r,Math.min(t,s))}toggle(){switch(this.mode){case"off":this.mode=this.isCombinedAudio?"combined":"on";break;case"on":this.mode="off";break;case"combined":this.mode="on";break}const r=`Sound is ${this.isCombinedAudio&&this.mode==="on"?"separate":this.mode}`;this.notification.notify(r)}stop(t){(Array.isArray(t)?t:[t]).forEach(s=>{const o=this.activeAudioIds.get(s);if(!o){clearInterval(s);return}o.forEach(a=>{a==null||a.disconnect(),a==null||a.stop()}),clearTimeout(s),this.activeAudioIds.delete(s)})}stopAll(){this.activeAudioIds.entries().forEach(([t,r])=>{clearTimeout(t),r.forEach(s=>{s.disconnect(),s.stop()})}),this.activeAudioIds.clear()}setVolume(t){this.volume=Math.min(Math.max(t/100,0),1)}}const Fj=250,zj=50,qj=500,$j=4e3,Uj=20;class Gj{constructor(t,r){oe(this,"context");oe(this,"notification");oe(this,"autoplayId");oe(this,"currentDirection");oe(this,"userSpeed");oe(this,"defaultSpeed");oe(this,"minSpeed");oe(this,"maxSpeed");oe(this,"autoplayRate");oe(this,"totalDuration");oe(this,"interval");oe(this,"onChangeEmitter");oe(this,"onChange");this.notification=r,this.context=t,this.autoplayId=null,this.currentDirection=null,this.userSpeed=null,this.defaultSpeed=Fj,this.minSpeed=zj,this.maxSpeed=qj,this.autoplayRate=this.defaultSpeed,this.totalDuration=$j,this.interval=Uj,this.onChangeEmitter=new Q9,this.onChange=this.onChangeEmitter.event}dispose(){this.stop(),this.onChangeEmitter.dispose()}start(t,r){this.stop(),this.onChangeEmitter.fire({type:"start"}),this.autoplayRate=this.getAutoplayRate(t,r),this.currentDirection=t,this.autoplayId=setInterval(()=>{this.context.isMovable(t)?this.context.moveOnce(t):this.stop()},this.autoplayRate)}stop(){this.autoplayId&&clearInterval(this.autoplayId),this.autoplayId=null,this.currentDirection=null,this.onChangeEmitter.fire({type:"stop"})}restart(){this.autoplayId&&clearInterval(this.autoplayId),this.currentDirection&&this.start(this.currentDirection)}speedUp(){const t=this.userSpeed??this.autoplayRate;t-this.interval>this.minSpeed?(this.userSpeed=t-this.interval,this.autoplayRate=this.userSpeed,this.restart(),this.notification.notify("Speed up")):this.notification.notify("Max speed")}speedDown(){const t=this.userSpeed??this.autoplayRate;t+this.interval<=this.maxSpeed?(this.userSpeed=t+this.interval,this.autoplayRate=this.userSpeed,this.restart(),this.notification.notify("Speed down")):this.notification.notify("Min speed")}resetSpeed(){this.userSpeed=null,this.autoplayRate=this.defaultSpeed,this.restart(),this.notification.notify("Reset speed")}getAutoplayRate(t,r){if(this.userSpeed!==null)return this.userSpeed;if(r&&!r.empty){const s=Math.ceil(this.totalDuration/r.autoplay[t]);return this.defaultSpeed=s,this.minSpeed=Math.min(this.minSpeed,s),s}return this.defaultSpeed}}const XH=32;class bc{encode(t){const r=new Array,s=new Array,o=new Array;for(let a=0;a<t.values.length;a++){s.push(new Array);const i=(t.max[a]-t.min[a])/4,l=t.min[a]+i,T=l+i,u=T+i;for(let Q=0;Q<t.values[a].length;Q++)t.values[a][Q]===0?r.push(" "):t.values[a][Q]<=l||t.values[a][Q]<=T?r.push("⠤"):t.values[a][Q]<=u?r.push("⠒"):r.push("⠉"),s[a].push(o.length),o.push({row:a,col:Q});r.push(xe.NEW_LINE),s[a].push(o.length),o.push({row:a,col:t.values[a].length})}return{value:r.join(xe.EMPTY),cellToIndex:s,indexToCell:o}}}class Zj{constructor(){oe(this,"GLOBAL_MIN","globalMin");oe(this,"GLOBAL_MAX","globalMax");oe(this,"BLANK","blank");oe(this,"LOWER_OUTLIER","lowerOutlier");oe(this,"UPPER_OUTLIER","upperOutlier");oe(this,"MIN","min");oe(this,"MAX","max");oe(this,"Q1","q1");oe(this,"Q2","q2");oe(this,"Q3","q3")}encode(t,r=XH){const s=new Array,o=new Array,a=new Array;for(let i=0;i<t.values.length;i++){const l=t.values[i],T=[{type:this.GLOBAL_MIN,value:t.min},...l.lowerOutliers.map(V=>({type:this.LOWER_OUTLIER,value:V})),{type:this.MIN,value:l.min},{type:this.Q1,value:l.q1},{type:this.Q2,value:l.q2},{type:this.Q3,value:l.q3},{type:this.MAX,value:l.max},...l.upperOutliers.map(V=>({type:this.UPPER_OUTLIER,value:V})),{type:this.GLOBAL_MAX,value:t.max}],u=new Array;let Q=!0;for(let V=0;V<T.length-1;V++){const k=T[V],B=T[V+1],R=Math.abs(Q?B.value-k.value:k.value-T[V-1].value);k.type===this.LOWER_OUTLIER||k.type===this.UPPER_OUTLIER?(u.push({type:k.type,length:0,numChars:1}),u.push({type:this.BLANK,length:R,numChars:0})):k.type===this.Q2?(Q=!1,u.push({type:this.Q2,length:0,numChars:2})):k.type===this.GLOBAL_MIN||k.type===this.GLOBAL_MAX?u.push({type:this.BLANK,length:R,numChars:0}):u.push({type:k.type,length:R,numChars:1})}let f=u.reduce((V,k)=>V+(k.numChars>0?k.numChars:0),0),[h,p,v,g]=[-1,-1,-1,-1];for(let V=0;V<u.length;V++)u[V].type===this.MIN&&u[V].length>0&&(h=V),u[V].type===this.MAX&&u[V].length>0&&(p=V),u[V].type===this.Q1&&(v=V),u[V].type===this.Q3&&(g=V);h!==-1&&p!==-1&&u[h].length!==u[p].length&&(u[h].length>u[p].length?(u[h].numChars++,f++):(u[p].numChars++,f++)),v!==-1&&g!==-1&&u[v].length!==u[g].length&&(u[v].length>u[g].length?(u[v].numChars++,f++):(u[g].numChars++,f++));const b=Math.max(0,r-f),L=u.reduce((V,k)=>V+(k.type!==this.Q2&&k.length>0?k.length:0),0);for(const V of u)if(V.type!==this.Q2&&V.length>0){const k=Math.round(V.length/L*b);V.numChars+=k}const M=u.reduce((V,k)=>V+k.numChars,0);let A=r-M,C=0;for(;A!==0;){const V=u[C%u.length];V.type!==this.BLANK&&V.type!==this.Q2&&V.length>0&&(V.numChars+=A>0?1:-1,A+=A>0?-1:1),C++}let E=-1;const _=[this.LOWER_OUTLIER,this.MIN,this.Q1,this.Q2,this.Q3,this.MAX,this.UPPER_OUTLIER];a.push(Array.from({length:_.length}).fill(-1));for(const V of u){V.type!==this.BLANK&&V.type!==this.GLOBAL_MIN&&V.type!==this.GLOBAL_MAX&&(E=_.indexOf(V.type),a[i][E]=s.length);for(let k=0;k<V.numChars;k++){let B="⠀";V.type===this.MIN||V.type===this.MAX?B="⠒":V.type===this.Q1||V.type===this.Q3?B="⠿":V.type===this.Q2?B=k===0?"⠸":"⠇":V.type===this.LOWER_OUTLIER||V.type===this.UPPER_OUTLIER?B="⠂":V.type===this.BLANK&&(B="⠀"),s.push(B),o.push({row:i,col:E})}}for(let V=0;V<3;V++)if(a[i][V]===-1){for(let k=V+1;k<=3;k++)if(a[i][k]!==-1){a[i][V]=a[i][k];break}}for(let V=6;V>3;V--)if(a[i][V]===-1){for(let k=V-1;k>=3;k--)if(a[i][k]!==-1){a[i][V]=a[i][k];break}}s.push(xe.NEW_LINE),o.push({row:i,col:E})}return{value:s.join(xe.EMPTY),cellToIndex:a,indexToCell:o}}}class Xj{encode(t){const r=new Array,s=new Array,o=new Array,a=(t.max-t.min)/3,i=t.min+a,l=i+a;for(let T=0;T<t.values.length;T++){s.push(new Array);for(let u=0;u<t.values[T].length;u++)t.values[T][u]===0?r.push(" "):t.values[T][u]<=i?r.push("⠤"):t.values[T][u]<=l?r.push("⠒"):r.push("⠉"),s[T].push(o.length),o.push({row:T,col:u});r.push(xe.NEW_LINE),s[T].push(o.length),o.push({row:T,col:t.values[T].length})}return{value:r.join(xe.EMPTY),cellToIndex:s,indexToCell:o}}}class WH{encode(t){const r=new Array,s=new Array,o=new Array;for(let a=0;a<t.values.length;a++){s.push(new Array);const{low:i,medium:l,mediumHigh:T,high:u}=this.getThresholds(a,t);for(let Q=0;Q<t.values[a].length;Q++){const f=t.values[a][Q],h=Q>0?t.values[a][Q-1]:null,p=this.getBrailleChar(f,h,i,l,T,u);r.push(p),s[a].push(o.length),o.push({row:a,col:Q})}r.push(xe.NEW_LINE),s[a].push(o.length),o.push({row:a,col:t.values[a].length})}return{value:r.join(xe.EMPTY),cellToIndex:s,indexToCell:o}}getBrailleChar(t,r,s,o,a,i){return t<=s&&r!==null&&r>s?r<=o?"⢄":r<=a?"⢆":"⢇":t<=s?"⣀":r!==null&&r<=s?t<=o?"⡠":t<=a?"⡰":"⡸":t<=o&&r!==null&&r>o?r<=a?"⠢":"⠣":t<=o?"⠤":r!==null&&r<=o?t<=a?"⠔":"⠜":t<=a&&r!==null&&r>a?"⠑":t<=a?"⠒":r!==null&&r<=a?"⠊":t<=i?"⠉":""}}class Wj extends WH{getThresholds(t,r){const s=(r.max-r.min)/4,o=r.min+s,a=o+s,i=a+s,l=r.max;return{low:o,medium:a,mediumHigh:i,high:l}}}class Yj extends WH{getThresholds(t,r){const s=(r.max[t]-r.min[t])/4,o=r.min[t]+s,a=o+s,i=a+s,l=r.max[t];return{low:o,medium:a,mediumHigh:i,high:l}}}class Kj{constructor(t,r,s){oe(this,"context");oe(this,"notification");oe(this,"display");oe(this,"enabled");oe(this,"cacheId");oe(this,"cache");oe(this,"encoders");oe(this,"onChangeEmitter");oe(this,"onChange");this.context=t,this.notification=r,this.display=s,this.enabled=!1,this.cacheId=xe.EMPTY,this.cache=null,this.encoders=new Map([[R2.BAR,new bc],[R2.BOX,new Zj],[R2.CANDLESTICK,new Wj],[R2.DODGED,new bc],[R2.HEATMAP,new Xj],[R2.HISTOGRAM,new bc],[R2.LINE,new Yj],[R2.NORMALIZED,new bc],[R2.STACKED,new bc]]),this.onChangeEmitter=new Q9,this.onChange=this.onChangeEmitter.event}dispose(){this.onChangeEmitter.dispose(),this.cache=null,this.encoders.clear()}update(t){if(!this.enabled||t.empty)return;const r=t.type==="subplot"?t.trace:t;if(r.empty||r.braille.empty||!this.encoders.has(r.traceType))return;const s=r.braille;if(this.cacheId!==s.id||this.cache===null){const o=this.encoders.get(r.traceType);this.cache=o.encode(s,XH),this.cacheId=s.id}this.onChangeEmitter.fire({value:this.cache.value.trim(),index:this.cache.cellToIndex[s.row][s.col]})}moveToIndex(t){if(!this.enabled||this.cache===null||t<0||t>=this.cache.indexToCell.length)return;const{row:r,col:s}=this.cache.indexToCell[t];this.context.moveToIndex(r,s)}toggle(t){if(t.empty){this.notification.notify("No info for braille");return}if(t.braille.empty){const s=`Braille is not supported for plot type: ${t.braille.traceType}`;this.notification.notify(s);return}this.enabled=!this.enabled,this.update(t),this.display.toggleFocus(b1.BRAILLE);const r=`Braille is ${this.enabled?"on":"off"}`;this.notification.notify(r)}}var YH=(e=>(e[e.OK=200]="OK",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.SERVER_ERROR=500]="SERVER_ERROR",e))(YH||{});class KH{constructor(){}static async post(t,r,s){const o={...this.DEFAULT_HEADERS,...s};return this.request(t,"POST",o,r)}static async request(t,r,s,o){try{const a=await fetch(t,{method:r,headers:s,body:o});return a.ok?{success:!0,data:await a.json()}:{success:!1,error:{statusCode:a.status,message:`API Error: ${a.status} - ${a.statusText}`}}}catch(a){return console.error(`Error in API ${r} request to ${t}:`,a),{success:!1,error:{statusCode:YH.SERVER_ERROR,message:a instanceof Error?a.message:"Unknown error occurred"}}}}}oe(KH,"DEFAULT_HEADERS",{"Content-Type":"application/json"});const Jj=`You are an accessibility assistant specializing in describing statistical visualizations to blind users. Your role is to:
|
|
2
|
+
`),oe(xe,"OPEN_BRACKET","["),oe(xe,"POLYLINE","polyline"),oe(xe,"SPACE"," "),oe(xe,"THROUGH"," through "),oe(xe,"TRANSPARENT","transparent"),oe(xe,"VISIBLE","visible"),oe(xe,"X","x"),oe(xe,"Y","y");let ag=class{constructor(){oe(this,"items");this.items=new Array}push(t){this.items.push(t)}pop(){return this.items.pop()}peek(){return this.items[this.items.length-1]}removeLast(t,r=1){const s=this.items.lastIndexOf(t);return s!==-1?(this.items.splice(s,r),!0):!1}isEmpty(){return this.items.length===0}size(){return this.items.length}clear(){this.items.length=0}};const og=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function lg(e,t,r,s){e.addEventListener?e.addEventListener(t,r,s):e.attachEvent&&e.attachEvent("on".concat(t),r)}function mc(e,t,r,s){e.removeEventListener?e.removeEventListener(t,r,s):e.detachEvent&&e.detachEvent("on".concat(t),r)}function kH(e,t){const r=t.slice(0,t.length-1);for(let s=0;s<r.length;s++)r[s]=e[r[s].toLowerCase()];return r}function NH(e){typeof e!="string"&&(e=""),e=e.replace(/\s/g,"");const t=e.split(",");let r=t.lastIndexOf("");for(;r>=0;)t[r-1]+=",",t.splice(r,1),r=t.lastIndexOf("");return t}function WP(e,t){const r=e.length>=t.length?e:t,s=e.length>=t.length?t:e;let o=!0;for(let a=0;a<r.length;a++)s.indexOf(r[a])===-1&&(o=!1);return o}const yc={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":og?173:189,"=":og?61:187,";":og?59:186,"'":222,"[":219,"]":221,"\\":220},o5={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},vc={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},M3={16:!1,18:!1,17:!1,91:!1},L2={};for(let e=1;e<20;e++)yc["f".concat(e)]=111+e;let d2=[],gc=null,BH="all";const M0=new Map,Lc=e=>yc[e.toLowerCase()]||o5[e.toLowerCase()]||e.toUpperCase().charCodeAt(0),YP=e=>Object.keys(yc).find(t=>yc[t]===e),KP=e=>Object.keys(o5).find(t=>o5[t]===e);function PH(e){BH=e||"all"}function xc(){return BH||"all"}function JP(){return d2.slice(0)}function ej(){return d2.map(e=>YP(e)||KP(e)||String.fromCharCode(e))}function tj(){const e=[];return Object.keys(L2).forEach(t=>{L2[t].forEach(r=>{let{key:s,scope:o,mods:a,shortcut:i}=r;e.push({scope:o,shortcut:i,mods:a,keys:s.split("+").map(l=>Lc(l))})})}),e}function nj(e){const t=e.target||e.srcElement,{tagName:r}=t;let s=!0;const o=r==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(t.type);return(t.isContentEditable||(o||r==="TEXTAREA"||r==="SELECT")&&!t.readOnly)&&(s=!1),s}function rj(e){return typeof e=="string"&&(e=Lc(e)),d2.indexOf(e)!==-1}function ij(e,t){let r,s;e||(e=xc());for(const o in L2)if(Object.prototype.hasOwnProperty.call(L2,o))for(r=L2[o],s=0;s<r.length;)r[s].scope===e?r.splice(s,1).forEach(i=>{let{element:l}=i;return sg(l)}):s++;xc()===e&&PH(t||"all")}function aj(e){let t=e.keyCode||e.which||e.charCode;const r=d2.indexOf(t);if(r>=0&&d2.splice(r,1),e.key&&e.key.toLowerCase()==="meta"&&d2.splice(0,d2.length),(t===93||t===224)&&(t=91),t in M3){M3[t]=!1;for(const s in o5)o5[s]===t&&(F3[s]=!1)}}function jH(e){if(typeof e>"u")Object.keys(L2).forEach(o=>{Array.isArray(L2[o])&&L2[o].forEach(a=>hp(a)),delete L2[o]}),sg(null);else if(Array.isArray(e))e.forEach(o=>{o.key&&hp(o)});else if(typeof e=="object")e.key&&hp(e);else if(typeof e=="string"){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];let[o,a]=r;typeof o=="function"&&(a=o,o=""),hp({key:e,scope:o,method:a,splitKey:"+"})}}const hp=e=>{let{key:t,scope:r,method:s,splitKey:o="+"}=e;NH(t).forEach(i=>{const l=i.split(o),T=l.length,u=l[T-1],Q=u==="*"?"*":Lc(u);if(!L2[Q])return;r||(r=xc());const f=T>1?kH(o5,l):[],h=[];L2[Q]=L2[Q].filter(p=>{const g=(s?p.method===s:!0)&&p.scope===r&&WP(p.mods,f);return g&&h.push(p.element),!g}),h.forEach(p=>sg(p))})};function IH(e,t,r,s){if(t.element!==s)return;let o;if(t.scope===r||t.scope==="all"){o=t.mods.length>0;for(const a in M3)Object.prototype.hasOwnProperty.call(M3,a)&&(!M3[a]&&t.mods.indexOf(+a)>-1||M3[a]&&t.mods.indexOf(+a)===-1)&&(o=!1);(t.mods.length===0&&!M3[16]&&!M3[18]&&!M3[17]&&!M3[91]||o||t.shortcut==="*")&&(t.keys=[],t.keys=t.keys.concat(d2),t.method(e,t)===!1&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0)))}}function FH(e,t){const r=L2["*"];let s=e.keyCode||e.which||e.charCode;if(!F3.filter.call(this,e))return;if((s===93||s===224)&&(s=91),d2.indexOf(s)===-1&&s!==229&&d2.push(s),["metaKey","ctrlKey","altKey","shiftKey"].forEach(l=>{const T=vc[l];e[l]&&d2.indexOf(T)===-1?d2.push(T):!e[l]&&d2.indexOf(T)>-1?d2.splice(d2.indexOf(T),1):l==="metaKey"&&e[l]&&(d2=d2.filter(u=>u in vc||u===s))}),s in M3){M3[s]=!0;for(const l in o5)if(Object.prototype.hasOwnProperty.call(o5,l)){const T=vc[o5[l]];F3[l]=e[T]}if(!r)return}for(const l in M3)Object.prototype.hasOwnProperty.call(M3,l)&&(M3[l]=e[vc[l]]);e.getModifierState&&!(e.altKey&&!e.ctrlKey)&&e.getModifierState("AltGraph")&&(d2.indexOf(17)===-1&&d2.push(17),d2.indexOf(18)===-1&&d2.push(18),M3[17]=!0,M3[18]=!0);const o=xc();if(r)for(let l=0;l<r.length;l++)r[l].scope===o&&(e.type==="keydown"&&r[l].keydown||e.type==="keyup"&&r[l].keyup)&&IH(e,r[l],o,t);if(!(s in L2))return;const a=L2[s],i=a.length;for(let l=0;l<i;l++)if((e.type==="keydown"&&a[l].keydown||e.type==="keyup"&&a[l].keyup)&&a[l].key){const T=a[l],{splitKey:u}=T,Q=T.key.split(u),f=[];for(let h=0;h<Q.length;h++)f.push(Lc(Q[h]));f.sort().join("")===d2.sort().join("")&&IH(e,T,o,t)}}function F3(e,t,r){d2=[];const s=NH(e);let o=[],a="all",i=document,l=0,T=!1,u=!0,Q="+",f=!1,h=!1;for(r===void 0&&typeof t=="function"&&(r=t),Object.prototype.toString.call(t)==="[object Object]"&&(t.scope&&(a=t.scope),t.element&&(i=t.element),t.keyup&&(T=t.keyup),t.keydown!==void 0&&(u=t.keydown),t.capture!==void 0&&(f=t.capture),typeof t.splitKey=="string"&&(Q=t.splitKey),t.single===!0&&(h=!0)),typeof t=="string"&&(a=t),h&&jH(e,a);l<s.length;l++)e=s[l].split(Q),o=[],e.length>1&&(o=kH(o5,e)),e=e[e.length-1],e=e==="*"?"*":Lc(e),e in L2||(L2[e]=[]),L2[e].push({keyup:T,keydown:u,scope:a,mods:o,shortcut:s[l],method:r,key:s[l],splitKey:Q,element:i});if(typeof i<"u"&&window){if(!M0.has(i)){const p=function(){let g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;return FH(g,i)},v=function(){let g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;FH(g,i),aj(g)};M0.set(i,{keydownListener:p,keyupListenr:v,capture:f}),lg(i,"keydown",p,f),lg(i,"keyup",v,f)}if(!gc){const p=()=>{d2=[]};gc={listener:p,capture:f},lg(window,"focus",p,f)}}}function oj(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(L2).forEach(r=>{L2[r].filter(o=>o.scope===t&&o.shortcut===e).forEach(o=>{o&&o.method&&o.method()})})}function sg(e){const t=Object.values(L2).flat();if(t.findIndex(s=>{let{element:o}=s;return o===e})<0){const{keydownListener:s,keyupListenr:o,capture:a}=M0.get(e)||{};s&&o&&(mc(e,"keyup",o,a),mc(e,"keydown",s,a),M0.delete(e))}if((t.length<=0||M0.size<=0)&&(Object.keys(M0).forEach(o=>{const{keydownListener:a,keyupListenr:i,capture:l}=M0.get(o)||{};a&&i&&(mc(o,"keyup",i,l),mc(o,"keydown",a,l),M0.delete(o))}),M0.clear(),Object.keys(L2).forEach(o=>delete L2[o]),gc)){const{listener:o,capture:a}=gc;mc(window,"focus",o,a),gc=null}}const ug={getPressedKeyString:ej,setScope:PH,getScope:xc,deleteScope:ij,getPressedKeyCodes:JP,getAllKeyCodes:tj,isPressed:rj,filter:nj,trigger:oj,unbind:jH,keyMap:yc,modifier:o5,modifierMap:vc};for(const e in ug)Object.prototype.hasOwnProperty.call(ug,e)&&(F3[e]=ug[e]);if(typeof window<"u"){const e=window.hotkeys;F3.noConflict=t=>(t&&window.hotkeys===F3&&(window.hotkeys=e),F3),window.hotkeys=F3}class lj{constructor(t){oe(this,"id");oe(this,"instructionContext");oe(this,"plotContext");oe(this,"scopeContext");this.id=t.id,this.plotContext=new ag,this.scopeContext=new ag;const r=t.state;if(r.empty||r.size!==1){this.instructionContext=t,this.plotContext.push(t),this.scopeContext.push(b1.SUBPLOT);return}this.scopeContext.push(b1.TRACE);const s=t.activeSubplot.state;if(s.empty||s.size!==1){this.instructionContext=t.activeSubplot,this.plotContext.push(t.activeSubplot),this.plotContext.push(t.activeSubplot.activeTrace);return}this.instructionContext=t.activeSubplot.activeTrace,this.plotContext.push(t.activeSubplot.activeTrace)}dispose(){this.plotContext.clear(),this.scopeContext.clear()}get active(){return this.plotContext.peek()}get state(){return this.active.state}toggleScope(t){this.scopeContext.removeLast(t)||this.scopeContext.push(t),F3.setScope(this.scope)}get scope(){return this.scopeContext.peek()}isMovable(t){return this.active.isMovable(t)}moveOnce(t){this.active.moveOnce(t)}moveToExtreme(t){this.active.moveToExtreme(t)}moveToIndex(t,r){this.active.moveToIndex(t,r)}stepTrace(t){if(this.plotContext.size()>1){this.plotContext.pop();const r=this.active;r.moveOnce(t),this.active.notifyStateUpdate(),this.plotContext.push(r.activeTrace)}}enterSubplot(){if(this.active.state.type==="figure"){const r=this.active;this.plotContext.push(r.activeSubplot),this.active.notifyStateUpdate(),this.plotContext.push(r.activeSubplot.activeTrace),this.toggleScope(b1.TRACE)}}exitSubplot(){this.plotContext.size()>2&&(this.plotContext.pop(),this.plotContext.pop(),this.active.notifyStateUpdate(),this.toggleScope(b1.TRACE))}getInstruction(t){const r=this.instructionContext.state;if(r.empty)return`No ${r.type} info available`;const s=t?"Click to activate.":xe.EMPTY;switch(r.type){case"figure":return`This is a MAIDR figure containing ${r.size} subplots. ${s} Use arrow keys to navigate subplots and press 'ENTER'.`;case"subplot":return`This is a MAIDR subplot containing ${r.size} layers, and this is layer 1 of ${r.size}: ${r.trace.traceType} plot. ${s} Use Arrows to navigate data points. Toggle B for Braille, T for Text, S for Sonification, and R for Review mode.`;case"trace":return`This is a maidr plot of type: ${r.traceType}. ${s} Use Arrows to navigate data points. Toggle B for Braille, T for Text, S for Sonification, and R for Review mode.`}}}const sj="unavailable",uj="X",cj="Y",Tj="unavailable";class cg{constructor(){oe(this,"observers");oe(this,"isInitialEntry");oe(this,"isOutOfBounds");oe(this,"row");oe(this,"col");this.observers=new Array,this.isInitialEntry=!0,this.isOutOfBounds=!1,this.row=0,this.col=0}dispose(){for(const t of this.observers)this.removeObserver(t);this.observers.length=0}moveOnce(t){if(this.isInitialEntry){this.handleInitialEntry(),this.notifyStateUpdate();return}if(!this.isMovable(t)){this.notifyOutOfBounds();return}switch(t){case"UPWARD":this.row+=1;break;case"DOWNWARD":this.row-=1;break;case"FORWARD":this.col+=1;break;case"BACKWARD":this.col-=1;break}this.notifyStateUpdate()}moveToExtreme(t){switch(this.isInitialEntry&&this.handleInitialEntry(),t){case"UPWARD":this.row=this.values.length-1;break;case"DOWNWARD":this.row=0;break;case"FORWARD":this.col=this.values[this.row].length-1;break;case"BACKWARD":this.col=0;break}this.notifyStateUpdate()}moveToIndex(t,r){this.isMovable([t,r])&&(this.row=t,this.col=r,this.isInitialEntry=!1,this.notifyStateUpdate())}isMovable(t){if(Array.isArray(t)){const[r,s]=t;return r>=0&&r<this.values.length&&s>=0&&s<this.values[this.row].length}switch(t){case"UPWARD":return this.row<this.values.length-1;case"DOWNWARD":return this.row>0;case"FORWARD":return this.col<this.values[this.row].length-1;case"BACKWARD":return this.col>0}}handleInitialEntry(){this.isInitialEntry=!1,this.row=Math.max(0,Math.min(this.row,this.values.length-1)),this.col=Math.max(0,Math.min(this.col,this.values[this.row].length-1))}addObserver(t){this.observers.push(t)}removeObserver(t){this.observers=this.observers.filter(r=>r!==t)}notifyStateUpdate(){const t=this.state;for(const r of this.observers)r.update(t)}notifyOutOfBounds(){this.isOutOfBounds=!0,this.notifyStateUpdate(),this.isOutOfBounds=!1}}class f9 extends cg{constructor(r){var s,o,a;super();oe(this,"id");oe(this,"type");oe(this,"title");oe(this,"xAxis");oe(this,"yAxis");oe(this,"fill");this.id=r.id,this.type=r.type,this.title=r.title??sj,this.xAxis=((s=r.axes)==null?void 0:s.x)??uj,this.yAxis=((o=r.axes)==null?void 0:o.y)??cj,this.fill=((a=r.axes)==null?void 0:a.fill)??Tj}dispose(){this.values.length=0,this.highlightValues&&(this.highlightValues.forEach(r=>r.forEach(s=>{(Array.isArray(s)?s:[s]).forEach(a=>a.remove())})),this.highlightValues.length=0),super.dispose()}get state(){return this.isOutOfBounds?{empty:!0,type:"trace",traceType:this.type,audio:{size:this.values[this.row].length,index:this.col}}:{empty:!1,type:"trace",traceType:this.type,title:this.title,xAxis:this.xAxis,yAxis:this.yAxis,fill:this.fill,hasMultiPoints:this.hasMultiPoints(),audio:this.audio(),braille:this.braille(),text:this.text(),autoplay:this.autoplay,highlight:this.highlight()}}highlight(){return this.highlightValues===null||this.isInitialEntry?{empty:!0,type:"trace",traceType:this.type,audio:{size:this.values[this.row].length,index:this.col}}:{empty:!1,elements:this.highlightValues[this.row][this.col]}}getAudioGroupIndex(){return this.values&&this.values.length>1?{groupIndex:this.row}:{}}get autoplay(){return{UPWARD:this.values.length,DOWNWARD:this.values.length,FORWARD:this.values[this.row].length,BACKWARD:this.values[this.row].length}}hasMultiPoints(){return!1}}var U2=(e=>(e.VERTICAL="vert",e.HORIZONTAL="horz",e))(U2||{}),R2=(e=>(e.BAR="bar",e.BOX="box",e.CANDLESTICK="candlestick",e.DODGED="dodged_bar",e.HEATMAP="heat",e.HISTOGRAM="hist",e.LINE="line",e.NORMALIZED="stacked_normalized_bar",e.SCATTER="point",e.SMOOTH="smooth",e.STACKED="stacked_bar",e))(R2||{});class z3{constructor(){}static safeMin(t){return t.length===0?1/0:Math.min(...t)}static safeMax(t){return t.length===0?-1/0:Math.max(...t)}static minFrom2D(t){const r=t.flat();return this.safeMin(r)}static maxFrom2D(t){const r=t.flat();return this.safeMax(r)}static minMax(t){if(t.length===0)return{min:1/0,max:-1/0};let r=t[0],s=t[0];for(let o=1;o<t.length;o++){const a=t[o];a<r&&(r=a),a>s&&(s=a)}return{min:r,max:s}}static minMaxFrom2D(t){const r=t.flat();return this.minMax(r)}}class pp{constructor(){}static parse(t){const r=t.replace(/\s/g,"").toLowerCase();if(/^#(?:[a-f0-9]{3}){1,2}$/.test(r)){let o=r.substring(1).split("");return o.length===3&&(o=[o[0],o[0],o[1],o[1],o[2],o[2]]),{r:Number.parseInt(o[0]+o[1],16),g:Number.parseInt(o[2]+o[3],16),b:Number.parseInt(o[4]+o[5],16)}}const s=r.match(/^rgba?\((\d+),(\d+),(\d+)(?:,\d*(?:\.\d*)?)?\)$/);return s?{r:Number.parseInt(s[1],10),g:Number.parseInt(s[2],10),b:Number.parseInt(s[3],10)}:null}static invert(t){return{r:255-t.r,g:255-t.g,b:255-t.b}}static getContrastRatio(t,r){const s=this.calculateLuminance(t),o=this.calculateLuminance(r);return(Math.max(s,o)+.05)/(Math.min(s,o)+.05)}static calculateLuminance(t){const[r,s,o]=[t.r,t.g,t.b].map(a=>{const i=a/255;return i<=.03928?i/12.92:((i+.055)/1.055)**2.4});return .2126*r+.7152*s+.0722*o}static rgbToString(t){return`rgb(${t.r}, ${t.g}, ${t.b})`}}class u2{constructor(){}static async toBase64(t){try{const r=new XMLSerializer().serializeToString(t).replace(/>\s+</g,"> <").replace(/\s{2,}/g," ").trim(),o=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(r).replace(/'/g,"%27").replace(/"/g,"%22")}`,a=await new Promise((T,u)=>{const Q=new Image;Q.onload=()=>T(Q),Q.onerror=()=>u(new Error("Failed to load SVG image")),Q.src=o}),i=document.createElement("canvas");[i.width,i.height]=[a.naturalWidth,a.naturalHeight];const l=i.getContext("2d");return l?(l.drawImage(a,0,0),i.toDataURL("image/jpeg",.92)):(console.error("Error converting SVG to Base 64: Canvas context unavailable"),"")}catch(r){return console.error("Error converting SVG to Base 64:",r instanceof Error?r.message:r),""}}static selectAllElements(t,r=!0){return Array.from(document.querySelectorAll(t)).map(s=>{if(!r)return s;const o=s.cloneNode(!0);return o.setAttribute(xe.VISIBILITY,xe.HIDDEN),s.insertAdjacentElement(xe.AFTER_END,o),o})}static selectElement(t,r=!0){const s=document.querySelector(t);if(!r)return s;const o=s==null?void 0:s.cloneNode(!0);return o==null||o.setAttribute(xe.VISIBILITY,xe.HIDDEN),s==null||s.insertAdjacentElement(xe.AFTER_END,o),o}static createEmptyElement(t="rect"){const r=document.createElementNS(this.SVG_NAMESPACE,t);return r.setAttribute(xe.FILL,xe.TRANSPARENT),r.setAttribute(xe.STROKE,xe.TRANSPARENT),r.setAttribute(xe.VISIBILITY,xe.HIDDEN),r}static createCircleElement(t,r,s){var u;const o=window.getComputedStyle(s),a=o.stroke||o.fill,i=o.strokeWidth||"2",l=Number.parseFloat(i)*2,T=document.createElementNS(this.SVG_NAMESPACE,xe.CIRCLE);return T.setAttribute(xe.CIRCLE_X,String(t)),T.setAttribute(xe.CIRCLE_Y,String(r)),T.setAttribute(xe.RADIUS,String(l)),T.setAttribute(xe.FILL,a),T.setAttribute(xe.STROKE,a),T.setAttribute(xe.STROKE_WIDTH,i),T.setAttribute(xe.VISIBILITY,xe.HIDDEN),(u=s.parentElement)==null||u.insertAdjacentElement(xe.AFTER_END,T),T}static createLineElement(t,r){const o=t.getBBox();let a,i,l,T;switch(r){case"top":[a,i,l,T]=[o.x,o.y,o.x+o.width,o.y];break;case"bottom":[a,i,l,T]=[o.x,o.y+o.height,o.x+o.width,o.y+o.height];break;case"left":[a,i,l,T]=[o.x,o.y,o.x,o.y+o.height];break;case"right":[a,i,l,T]=[o.x+o.width,o.y,o.x+o.width,o.y+o.height];break}const u=window.getComputedStyle(t),Q=document.createElementNS(this.SVG_NAMESPACE,xe.LINE);return Q.setAttribute(xe.X1,String(a)),Q.setAttribute(xe.Y1,String(i)),Q.setAttribute(xe.X2,String(l)),Q.setAttribute(xe.Y2,String(T)),Q.setAttribute(xe.STROKE,u.stroke),Q.setAttribute(xe.STROKE_WIDTH,u.strokeWidth||"2"),Q.setAttribute(xe.VISIBILITY,xe.HIDDEN),t.insertAdjacentElement(xe.AFTER_END,Q),Q}static createHighlightElement(t,r){const s=t.cloneNode(!0),o=t.tagName.toLowerCase(),a=o===xe.POLYLINE||o===xe.LINE,i=a?window.getComputedStyle(t).getPropertyValue(xe.STROKE):window.getComputedStyle(t).getPropertyValue(xe.FILL),l=this.getHighlightColor(i,r);if(s.setAttribute(xe.VISIBILITY,xe.VISIBLE),s.setAttribute(xe.STROKE,l),s.setAttribute(xe.FILL,l),s.style.fill=l,s.style.stroke=l,a){const T=window.getComputedStyle(s).getPropertyValue(xe.STROKE_WIDTH);s.setAttribute(xe.STROKE_WIDTH,`${T+2}`)}return t.insertAdjacentElement(xe.AFTER_END,s),s}static getHighlightColor(t,r){const s=pp.parse(t);if(!s)return r;const o=pp.invert(s);return pp.getContrastRatio(s,o)>=4.5?pp.rgbToString(o):r}}oe(u2,"SVG_NAMESPACE","http://www.w3.org/2000/svg");class Tg extends f9{constructor(r,s){super(r);oe(this,"points");oe(this,"barValues");oe(this,"highlightValues");oe(this,"orientation");oe(this,"min");oe(this,"max");this.points=s,this.orientation=r.orientation??U2.VERTICAL,this.barValues=s.map(o=>o.map(a=>this.orientation===U2.VERTICAL?Number(a.y):Number(a.x))),this.min=this.barValues.map(o=>z3.safeMin(o)),this.max=this.barValues.map(o=>z3.safeMax(o)),this.highlightValues=this.mapToSvgElements(r.selectors)}dispose(){this.points.length=0,this.min.length=0,this.max.length=0,super.dispose()}get values(){return this.barValues}audio(){const r=this.orientation===U2.VERTICAL,s=r?this.barValues[this.row].length:this.barValues.length,o=r?this.col:this.row,a=r?this.barValues[this.row][this.col]:this.barValues[this.col][this.row];return{min:z3.safeMin(this.min),max:z3.safeMax(this.max),size:s,index:o,value:a,...this.getAudioGroupIndex()}}braille(){return{empty:!1,id:this.id,values:this.barValues,min:this.min,max:this.max,row:this.row,col:this.col}}text(){const r=this.orientation===U2.VERTICAL,s=this.points[this.row][this.col],o=r?this.xAxis:this.yAxis,a=r?s.x:s.y,i=r?this.yAxis:this.xAxis,l=r?s.y:s.x;return{main:{label:o,value:a},cross:{label:i,value:l}}}mapToSvgElements(r){if(!r)return null;const s=[u2.selectAllElements(r)];if(s.length!==this.points.length)return null;for(let o=0;o<this.points.length;o++)if(s[o].length!==this.points[o].length)return null;return s}}class Qj extends Tg{constructor(t){super(t,[t.data])}}const fj="Lower outlier(s)",dj="Upper outlier(s)",hj="Minimum",pj="Maximum",mj="25%",yj="50%",vj="75%";class gj extends f9{constructor(r){super(r);oe(this,"points");oe(this,"boxValues");oe(this,"highlightValues");oe(this,"orientation");oe(this,"sections");oe(this,"min");oe(this,"max");this.points=r.data,this.orientation=r.orientation??U2.VERTICAL,this.sections=[fj,hj,mj,yj,vj,pj,dj];const s=[a=>a.lowerOutliers,a=>a.min,a=>a.q1,a=>a.q2,a=>a.q3,a=>a.max,a=>a.upperOutliers];this.orientation===U2.HORIZONTAL?this.boxValues=this.points.map(a=>s.map(i=>i(a))):this.boxValues=s.map(a=>this.points.map(i=>a(i)));const o=this.boxValues.map(a=>a.flatMap(i=>Array.isArray(i)?i:[i]));this.min=z3.minFrom2D(o),this.max=z3.maxFrom2D(o),this.row=this.boxValues.length-1,this.highlightValues=this.mapToSvgElements(r.selectors)}dispose(){this.points.length=0,this.sections.length=0,super.dispose()}moveToIndex(r,s){const o=this.orientation===U2.HORIZONTAL;r=o?r:s,s=o?s:r,super.moveToIndex(r,s)}get values(){return this.boxValues}audio(){const r=this.orientation===U2.HORIZONTAL,s=this.boxValues[this.row][this.col],o=r?this.sections.length:this.points.length,a=r?this.col:this.col;return{min:this.min,max:this.max,size:o,index:a,value:s}}braille(){const r=this.orientation===U2.HORIZONTAL,s=r?this.row:this.col,o=r?this.col:this.row;return{empty:!1,id:this.id,values:this.points,min:this.min,max:this.max,row:s,col:o}}text(){const r=this.orientation===U2.HORIZONTAL,s=r?this.points[this.row]:this.points[this.col],o=r?this.yAxis:this.xAxis,a=r?this.sections[this.col]:this.sections[this.row],i=r?this.xAxis:this.yAxis,l=this.boxValues[this.row][this.col];return{main:{label:o,value:s.fill},cross:{label:i,value:l},section:a}}mapToSvgElements(r){if(!r||r.length!==this.points.length)return null;const s=this.orientation===U2.VERTICAL,o=new Array;if(s)for(let a=0;a<this.sections.length;a++)o.push(Array.from({length:r.length}));return r.forEach((a,i)=>{const l=a.lowerOutliers.flatMap(b=>u2.selectAllElements(b)),T=a.upperOutliers.flatMap(b=>u2.selectAllElements(b)),u=u2.selectElement(a.min)??u2.createEmptyElement(),Q=u2.selectElement(a.max)??u2.createEmptyElement(),f=u2.selectElement(a.iq)??u2.createEmptyElement(),h=u2.selectElement(a.q2)??u2.createEmptyElement(),[p,v]=s?[u2.createLineElement(f,"top"),u2.createLineElement(f,"bottom")]:[u2.createLineElement(f,"left"),u2.createLineElement(f,"right")],g=[l,u,p,h,v,Q,T];s?g.forEach((b,L)=>{o[L][i]=b}):o.push(g)}),o}}const Lj="Trend";class xj extends f9{constructor(r){super(r);oe(this,"candles");oe(this,"candleValues");oe(this,"orientation");oe(this,"sections",["open","high","low","close"]);oe(this,"currentSegmentType","open");oe(this,"currentPointIndex",0);oe(this,"sortedSegmentsByPoint");oe(this,"segmentPositionMaps");oe(this,"min");oe(this,"max");const s=r.data;this.candles=s.map(o=>({...o,trend:o.close>o.open?"Bull":o.close<o.open?"Bear":"Neutral"})),this.orientation=r.orientation??U2.VERTICAL,this.candleValues=this.sections.map(o=>this.candles.map(a=>a[o])),this.min=z3.minFrom2D(this.candleValues),this.max=z3.maxFrom2D(this.candleValues),this.sortedSegmentsByPoint=this.precomputeSortedSegments(),this.segmentPositionMaps=this.precomputePositionMaps(),this.currentPointIndex=0,this.currentSegmentType="open",this.orientation===U2.HORIZONTAL?this.col=0:this.row=0}precomputeSortedSegments(){return this.candles.map(r=>this.sections.map(o=>[o,r[o]]).sort((o,a)=>o[1]-a[1]).map(o=>o[0]))}precomputePositionMaps(){return this.sortedSegmentsByPoint.map(r=>{const s=new Map;return r.forEach((o,a)=>{s.set(o,a)}),s})}getSegmentPositionInSortedOrder(r,s){return this.segmentPositionMaps[r].get(s)??0}getSegmentTypeAtSortedPosition(r,s){return this.sortedSegmentsByPoint[r][s]??"open"}updateVisualSegmentPosition(){const r=this.sections.indexOf(this.currentSegmentType);this.orientation===U2.HORIZONTAL?this.col=r:this.row=r}updateVisualPointPosition(){this.orientation===U2.HORIZONTAL?this.row=this.currentPointIndex:this.col=this.currentPointIndex}moveOnce(r){if(this.isInitialEntry){this.handleInitialEntry(),this.notifyStateUpdate();return}if(!this.isMovable(r)){this.notifyOutOfBounds();return}switch(r){case"UPWARD":case"DOWNWARD":{const s=this.getSegmentPositionInSortedOrder(this.currentPointIndex,this.currentSegmentType),o=r==="UPWARD"?s+1:s-1;if(o>=0&&o<this.sections.length)this.currentSegmentType=this.getSegmentTypeAtSortedPosition(this.currentPointIndex,o),this.updateVisualSegmentPosition();else{this.notifyOutOfBounds();return}break}case"FORWARD":case"BACKWARD":{const s=r==="FORWARD"?this.currentPointIndex+1:this.currentPointIndex-1;if(s>=0&&s<this.candles.length)this.currentPointIndex=s,this.updateVisualPointPosition(),this.updateVisualSegmentPosition();else{this.notifyOutOfBounds();return}break}}this.notifyStateUpdate()}moveToExtreme(r){switch(this.isInitialEntry&&this.handleInitialEntry(),r){case"UPWARD":{const s=this.sortedSegmentsByPoint[this.currentPointIndex];this.currentSegmentType=s[s.length-1],this.updateVisualSegmentPosition();break}case"DOWNWARD":{const s=this.sortedSegmentsByPoint[this.currentPointIndex];this.currentSegmentType=s[0],this.updateVisualSegmentPosition();break}case"FORWARD":{this.currentPointIndex=this.candles.length-1,this.updateVisualPointPosition(),this.updateVisualSegmentPosition();break}case"BACKWARD":{this.currentPointIndex=0,this.updateVisualPointPosition(),this.updateVisualSegmentPosition();break}}this.notifyStateUpdate()}isMovable(r){if(Array.isArray(r))return super.isMovable(r);if(this.isInitialEntry)return!0;switch(r){case"UPWARD":case"DOWNWARD":{const s=this.getSegmentPositionInSortedOrder(this.currentPointIndex,this.currentSegmentType),o=r==="UPWARD"?s+1:s-1;return o>=0&&o<this.sections.length}case"FORWARD":case"BACKWARD":{const s=r==="FORWARD"?this.currentPointIndex+1:this.currentPointIndex-1;return s>=0&&s<this.candles.length}}}dispose(){this.candles.length=0,super.dispose()}get values(){return this.candleValues}audio(){const r=this.candles[this.currentPointIndex][this.currentSegmentType];return{min:this.min,max:this.max,size:this.candles.length,index:this.currentPointIndex,value:r}}braille(){return{empty:!1,id:this.id,values:this.candleValues,min:this.min,max:this.max,row:this.row,col:this.col}}get highlightValues(){return null}text(){const r=this.candles[this.currentPointIndex],s=r[this.currentSegmentType];return{main:{label:this.orientation===U2.HORIZONTAL?this.yAxis:this.xAxis,value:r.value},cross:{label:this.orientation===U2.HORIZONTAL?this.xAxis:this.yAxis,value:s},section:this.currentSegmentType,fill:{label:Lj,value:r.trend}}}}class bj extends f9{constructor(r){super(r);oe(this,"heatmapValues");oe(this,"highlightValues");oe(this,"x");oe(this,"y");oe(this,"min");oe(this,"max");const s=r.data;this.x=s.x,this.y=s.y,this.heatmapValues=s.points;const{min:o,max:a}=z3.minMaxFrom2D(this.heatmapValues);this.min=o,this.max=a,this.highlightValues=this.mapToSvgElements(r.selectors)}dispose(){this.heatmapValues.length=0,this.x.length=0,this.y.length=0,super.dispose()}get values(){return this.heatmapValues}audio(){return{min:this.min,max:this.max,size:this.heatmapValues.length,index:this.col,value:this.heatmapValues[this.row][this.col]}}braille(){return{empty:!1,id:this.id,values:this.heatmapValues,min:this.min,max:this.max,row:this.row,col:this.col}}text(){return{main:{label:this.xAxis,value:this.x[this.col]},cross:{label:this.yAxis,value:this.y[this.row]},fill:{label:this.fill,value:String(this.heatmapValues[this.row][this.col])}}}mapToSvgElements(r){if(!r)return null;const s=this.heatmapValues.length,o=this.heatmapValues[0].length,a=u2.selectAllElements(r);if(a.length===0||a.length!==s*o)return null;const i=new Array;if(a[0]instanceof SVGPathElement)for(let l=0;l<s;l++){const T=s-1-l,u=new Array;for(let Q=0;Q<o;Q++){const f=T*o+Q;u.push(a[f])}i.push(u)}else if(a[0]instanceof SVGRectElement)for(let l=0;l<s;l++){const T=new Array;for(let u=0;u<o;u++){const Q=u*s+l;T.push(a[Q])}i.push(T)}return i}}class Hj extends Tg{constructor(t){super(t,[t.data])}text(){const t=this.orientation===U2.VERTICAL,r=this.points[this.row][this.col],s=t?r.xMin:r.yMin,o=t?r.xMax:r.yMax;return{...super.text(),range:{min:s,max:o}}}}const Ej="Type",zH=/[ML]\s*(-?\d+(\.\d+)?)\s+(-?\d+(\.\d+)?)/g;class qH extends f9{constructor(r){super(r);oe(this,"points");oe(this,"lineValues");oe(this,"highlightValues");oe(this,"min");oe(this,"max");this.points=r.data,this.lineValues=this.points.map(s=>s.map(o=>Number(o.y))),this.min=this.lineValues.map(s=>z3.safeMin(s)),this.max=this.lineValues.map(s=>z3.safeMax(s)),this.highlightValues=this.mapToSvgElements(r.selectors)}dispose(){this.points.length=0,this.min.length=0,this.max.length=0,super.dispose()}get values(){return this.lineValues}audio(){return{min:this.min[this.row],max:this.max[this.row],size:this.points[this.row].length,index:this.col,value:this.points[this.row][this.col].y,...this.getAudioGroupIndex()}}braille(){return{empty:!1,id:this.id,values:this.lineValues,min:this.min,max:this.max,row:this.row,col:this.col}}text(){const r=this.points[this.row][this.col],s=r.fill?{fill:{label:Ej,value:r.fill}}:{};return{main:{label:this.xAxis,value:this.points[this.row][this.col].x},cross:{label:this.yAxis,value:this.points[this.row][this.col].y},...s}}moveOnce(r){if(this.isInitialEntry){this.handleInitialEntry(),this.notifyStateUpdate();return}if(!this.isMovable(r)){this.notifyOutOfBounds();return}if(r==="UPWARD"||r==="DOWNWARD"){const s=this.findNearestLineByYValue(r);if(s!==null&&s!==this.row){this.row=s,this.notifyStateUpdate();return}else{this.notifyOutOfBounds();return}}switch(r){case"FORWARD":this.col+=1;break;case"BACKWARD":this.col-=1;break}this.notifyStateUpdate()}isMovable(r){if(Array.isArray(r)){const[s,o]=r;return s>=0&&s<this.values.length&&o>=0&&o<this.values[this.row].length}switch(r){case"UPWARD":case"DOWNWARD":return this.findNearestLineByYValue(r)!==null;case"FORWARD":return this.col<this.values[this.row].length-1;case"BACKWARD":return this.col>0}}findNearestLineByYValue(r){const s=this.col,o=this.values[this.row][s];let a=null,i=Number.POSITIVE_INFINITY;for(let l=0;l<this.values.length;l++){if(l===this.row||s>=this.values[l].length)continue;const T=this.values[l][s];if(!(r==="UPWARD"?T>o:T<o))continue;const Q=Math.abs(T-o);Q<i&&(i=Q,a=l)}return a}mapToSvgElements(r){if(!r||r.length!==this.lineValues.length)return null;const s=new Array;for(let o=0;o<r.length;o++){const a=u2.selectElement(r[o],!1);if(!a)return null;const i=new Array;if(a instanceof SVGPathElement){const T=a.getAttribute(xe.D)||xe.EMPTY;let u=zH.exec(T);for(;u!==null;)i.push({x:Number.parseFloat(u[1]),y:Number.parseFloat(u[3])}),u=zH.exec(T)}else if(a instanceof SVGPolylineElement){const u=(a.getAttribute(xe.POINTS)||xe.EMPTY).split(/\s+/).filter(Boolean);for(const Q of u){const[f,h]=Q.split(xe.COMMA);i.push({x:Number.parseFloat(f),y:Number.parseFloat(h)})}}if(i.length!==this.lineValues[o].length)return null;const l=new Array;for(const T of i){if(Number.isNaN(T.x)||Number.isNaN(T.y))return null;l.push(u2.createCircleElement(T.x,T.y,a))}s.push(l)}return s}}class Mj extends f9{constructor(r){super(r);oe(this,"mode");oe(this,"xPoints");oe(this,"yPoints");oe(this,"xValues");oe(this,"yValues");oe(this,"highlightXValues");oe(this,"highlightYValues");oe(this,"minX");oe(this,"maxX");oe(this,"minY");oe(this,"maxY");this.mode="column";const s=r.data,o=[...s].sort((T,u)=>T.x-u.x||T.y-u.y);this.xPoints=new Array;let a=null;for(const T of o)(!a||a.x!==T.x)&&(a={x:T.x,y:[]},this.xPoints.push(a)),a.y.push(T.y);const i=[...s].sort((T,u)=>T.y-u.y||T.x-u.x);this.yPoints=new Array;let l=null;for(const T of i)(!l||l.y!==T.y)&&(l={y:T.y,x:[]},this.yPoints.push(l)),l.x.push(T.x);this.xValues=this.xPoints.map(T=>T.x),this.yValues=this.yPoints.map(T=>T.y),this.minX=z3.safeMin(this.xValues),this.maxX=z3.safeMax(this.xValues),this.minY=z3.safeMin(this.yValues),this.maxY=z3.safeMax(this.yValues),[this.highlightXValues,this.highlightYValues]=this.mapToSvgElements(r.selectors)}dispose(){this.xPoints.length=0,this.yPoints.length=0,this.xValues.length=0,this.yValues.length=0,this.highlightXValues&&(this.highlightXValues.forEach(r=>r.forEach(s=>s.remove())),this.highlightXValues.length=0),this.highlightYValues&&(this.highlightYValues.forEach(r=>r.forEach(s=>s.remove())),this.highlightYValues.length=0),super.dispose()}get values(){return this.mode==="column"?[this.xValues]:[this.yValues]}get highlightValues(){return this.mode==="column"?this.highlightXValues:this.highlightYValues}getAudioGroupIndex(){return{}}audio(){if(this.mode==="column"){const r=this.xPoints[this.col];return{min:this.minY,max:this.maxY,size:r.y.length,index:this.col,value:r.y,...this.getAudioGroupIndex()}}else{const r=this.yPoints[this.row];return{min:this.minX,max:this.maxX,size:r.x.length,index:this.row,value:r.x,...this.getAudioGroupIndex()}}}braille(){return{empty:!0,type:"trace",traceType:this.type}}text(){if(this.mode==="column"){const r=this.xPoints[this.col];return{main:{label:this.xAxis,value:r.x},cross:{label:this.yAxis,value:r.y}}}else{const r=this.yPoints[this.row];return{main:{label:this.yAxis,value:r.y},cross:{label:this.xAxis,value:r.x}}}}get autoplay(){return{UPWARD:this.yValues.length,DOWNWARD:this.yValues.length,FORWARD:this.xValues.length,BACKWARD:this.xValues.length}}highlight(){if(this.highlightValues===null)return{empty:!0,type:"trace",traceType:this.type};const r=this.mode==="column"?this.col<this.highlightValues.length?this.highlightValues[this.col]:null:this.row<this.highlightValues.length?this.highlightValues[this.row]:null;return r?{empty:!1,elements:r}:{empty:!0,type:"trace",traceType:this.type}}hasMultiPoints(){return!0}toggleNavigation(){if(this.mode==="column"){const r=this.xPoints[this.col],s=r.y[Math.floor(r.y.length/2)];this.row=this.yValues.indexOf(s),this.mode="row"}else{const r=this.yPoints[this.row],s=r.x[Math.floor(r.x.length/2)];this.col=this.xValues.indexOf(s),this.mode="column"}}moveOnce(r){if(this.isInitialEntry){this.handleInitialEntry(),this.notifyStateUpdate();return}if(!this.isMovable(r)){this.notifyOutOfBounds();return}if(this.mode==="column")switch(r){case"FORWARD":this.col++;break;case"BACKWARD":this.col--;break;case"UPWARD":case"DOWNWARD":{this.toggleNavigation();break}}else switch(r){case"UPWARD":this.row++;break;case"DOWNWARD":this.row--;break;case"FORWARD":case"BACKWARD":{this.toggleNavigation();break}}this.notifyStateUpdate()}moveToExtreme(r){if(this.isInitialEntry&&this.handleInitialEntry(),this.mode==="column")switch(r){case"UPWARD":this.toggleNavigation(),this.row=this.yPoints.length-1;break;case"DOWNWARD":this.toggleNavigation(),this.row=0;break;case"FORWARD":this.col=this.xPoints.length-1;break;case"BACKWARD":this.col=0;break}else switch(r){case"UPWARD":this.row=this.yPoints.length-1;break;case"DOWNWARD":this.row=0;break;case"FORWARD":this.toggleNavigation(),this.col=this.xPoints.length-1;break;case"BACKWARD":this.toggleNavigation(),this.col=0;break}this.notifyStateUpdate()}isMovable(r){if(Array.isArray(r))return!1;if(this.mode==="column")switch(r){case"FORWARD":return this.col<this.xPoints.length-1;case"BACKWARD":return this.col>0;case"UPWARD":case"DOWNWARD":return!0}else switch(r){case"UPWARD":return this.row<this.yPoints.length-1;case"DOWNWARD":return this.row>0;case"FORWARD":case"BACKWARD":return!0}}mapToSvgElements(r){if(!r)return[null,null];const s=u2.selectAllElements(r);if(s.length===0)return[null,null];const o=new Map,a=new Map;s.forEach(T=>{const u=Number.parseFloat(T.getAttribute("x")||""),Q=Number.parseFloat(T.getAttribute("y")||"");Number.isNaN(u)||(o.has(u)||o.set(u,[]),o.get(u).push(T)),Number.isNaN(Q)||(a.has(Q)||a.set(Q,[]),a.get(Q).push(T))});const i=Array.from(o.entries()).sort(([T],[u])=>T-u).map(([T,u])=>u),l=Array.from(a.entries()).sort(([T],[u])=>u-T).map(([T,u])=>u);return[i,l]}}const $H="Sum",Sj="Level",_j="undefined";class Aj extends Tg{constructor(t){super(t,t.data),this.createSummaryLevel()}createSummaryLevel(){const t=new Array,r=new Array;for(let a=0;a<this.barValues[0].length;a++){const i=this.barValues.reduce((T,u)=>T+u[a],0);t.push(i);const l=this.orientation===U2.VERTICAL?{x:this.points[0][a].x,y:i,fill:$H}:{x:i,y:this.points[0][a].y,fill:$H};r.push(l)}this.points.push(r),this.barValues.push(t);const{min:s,max:o}=z3.minMax(t);this.min.push(s),this.max.push(o)}text(){return{...super.text(),fill:{label:Sj,value:this.points[this.row][this.col].fill??_j}}}highlight(){return this.highlightValues===null||this.row===this.barValues.length-1?{empty:!0,type:"trace",traceType:this.type}:{empty:!1,elements:this.highlightValues[this.row][this.col]}}hasMultiPoints(){return!0}mapToSvgElements(t){if(!t)return new Array;const r=u2.selectAllElements(t);if(r.length===0)return new Array;const s=new Array;if(r[0]instanceof SVGPathElement)for(let o=0,a=0;o<this.barValues.length;o++){const i=new Array;for(let l=0;l<this.barValues[o].length;l++){if(a>=r.length)return new Array;this.barValues[o][l]===0?i.push(u2.createEmptyElement()):i.push(r[a++])}s.push(i)}else if(r[0]instanceof SVGRectElement){for(let o=0;o<this.barValues.length;o++)s.push(new Array);for(let o=0,a=0;o<this.barValues[0].length;o++)for(let i=this.barValues.length-1;i>=0;i--){if(a>=r.length)return new Array;this.barValues[i][o]===0?s[i].push(u2.createEmptyElement()):s[i].push(r[a++])}}return s}}class Oj extends qH{constructor(t){super(t)}audio(){const t=this.lineValues[this.row],r=this.col,s=l=>t[Math.max(0,Math.min(l,t.length-1))],o=r>0?s(r-1):s(r),a=s(r),i=r<t.length-1?s(r+1):s(r);return{min:this.min[this.row],max:this.max[this.row],size:t.length,index:r,value:[o,a,i],isContinuous:!0,...this.getAudioGroupIndex()}}}class Cj{static create(t){switch(t.type){case R2.BAR:return new Qj(t);case R2.BOX:return new gj(t);case R2.CANDLESTICK:return new xj(t);case R2.HEATMAP:return new bj(t);case R2.HISTOGRAM:return new Hj(t);case R2.LINE:return new qH(t);case R2.SCATTER:return new Mj(t);case R2.SMOOTH:return new Oj(t);case R2.DODGED:case R2.NORMALIZED:case R2.STACKED:return new Aj(t);default:throw new Error(`Invalid trace type: ${t.type}`)}}}const wj="MAIDR Plot",Vj="unavailable",Dj="unavailable";class Rj extends cg{constructor(r){super();oe(this,"id");oe(this,"title");oe(this,"subtitle");oe(this,"caption");oe(this,"subplots");oe(this,"size");this.id=r.id,this.title=r.title??wj,this.subtitle=r.subtitle??Vj,this.caption=r.caption??Dj;const s=r.subplots;this.subplots=s.map(o=>o.map(a=>new kj(a))),this.size=this.subplots.reduce((o,a)=>o+a.length,0)}dispose(){this.subplots.forEach(r=>r.forEach(s=>s.dispose())),this.subplots.length=0,super.dispose()}get values(){return this.subplots}get activeSubplot(){return this.subplots[this.row][this.col]}get state(){if(this.isOutOfBounds)return{empty:!0,type:"figure"};const r=this.col+1+this.subplots.slice(0,this.row).reduce((s,o)=>s+o.length,0);return{empty:!1,type:"figure",title:this.title,subtitle:this.subtitle,caption:this.caption,size:this.size,index:r,subplot:this.activeSubplot.state,traceTypes:this.activeSubplot.traceTypes}}}class kj extends cg{constructor(r){super();oe(this,"traces");oe(this,"traceTypes");oe(this,"size");this.isInitialEntry=!1;const s=r.layers;this.size=s.length,this.traces=s.map(o=>[Cj.create(o)]),this.traceTypes=this.traces.flat().map(o=>{const a=o.state;return a.empty?xe.EMPTY:a.traceType})}dispose(){this.traces.forEach(r=>r.forEach(s=>s.dispose())),this.traces.length=0,super.dispose()}get values(){return this.traces}get activeTrace(){return this.traces[this.row][this.col]}get state(){return this.isOutOfBounds?{empty:!0,type:"subplot"}:{empty:!1,type:"subplot",size:this.size,index:this.row+1,trace:this.activeTrace.state}}}const es=class es{constructor(){oe(this,"basePalette");oe(this,"extendedPalette");this.basePalette=[{waveType:"sine",timbreModulation:{attack:.01,decay:.1,sustain:.8,release:.2}},{waveType:"square",timbreModulation:{attack:.005,decay:.05,sustain:.7,release:.15}},{waveType:"sawtooth",timbreModulation:{attack:.02,decay:.08,sustain:.6,release:.25}},{waveType:"triangle",timbreModulation:{attack:.015,decay:.12,sustain:.9,release:.18}}],this.extendedPalette=new Map,this.generateExtendedPalette()}dispose(){this.extendedPalette.clear()}getPaletteEntry(t){if(t<this.basePalette.length)return this.basePalette[t];const r=this.extendedPalette.get(t);if(r)return r;const s=this.generateExtendedEntry(t);return this.extendedPalette.set(t,s),s}get basePaletteSize(){return this.basePalette.length}generateExtendedPalette(){[{waveType:"sine",harmonicMix:{fundamental:1,harmonics:[{frequency:2,amplitude:.3},{frequency:3,amplitude:.15}]},timbreModulation:{attack:.02,decay:.15,sustain:.7,release:.3}},{waveType:"square",harmonicMix:{fundamental:1,harmonics:[{frequency:1.5,amplitude:.4},{frequency:2.5,amplitude:.2}]},timbreModulation:{attack:.01,decay:.08,sustain:.6,release:.4}},{waveType:"sawtooth",harmonicMix:{fundamental:1,harmonics:[{frequency:1.25,amplitude:.35},{frequency:2,amplitude:.25},{frequency:3,amplitude:.1}]},timbreModulation:{attack:.03,decay:.2,sustain:.5,release:.35}},{waveType:"triangle",harmonicMix:{fundamental:1,harmonics:[{frequency:.5,amplitude:.2},{frequency:4,amplitude:.15}]},timbreModulation:{attack:.025,decay:.18,sustain:.8,release:.25}}].forEach((r,s)=>{this.extendedPalette.set(this.basePalette.length+s,r)})}generateExtendedEntry(t){const r=t%this.basePalette.length,s=this.basePalette[r],o=Math.floor((t-this.basePalette.length)/this.basePalette.length),a=this.generateHarmonics(o),i=this.generateTimbreModulation(o,s.timbreModulation);return{waveType:s.waveType,harmonicMix:{fundamental:1,harmonics:a},timbreModulation:i}}generateHarmonics(t){const r=[],s=es.MIN_HARMONICS+t%es.HARMONIC_VARIATION;for(let o=0;o<s;o++){const a=1+(o+1)*(.5+t*.3%1),i=.4/(o+1)*(1-t*.1%.3);r.push({frequency:a,amplitude:i})}return r}generateTimbreModulation(t,r){const s=1+t*.2%.5;return{attack:Math.max(.005,Math.min(.05,r.attack*s)),decay:Math.max(.05,Math.min(.3,r.decay*s)),sustain:Math.max(.4,Math.min(.9,r.sustain+t*.1%.2)),release:Math.max(.1,Math.min(.5,r.release*s))}}};oe(es,"MIN_HARMONICS",2),oe(es,"HARMONIC_VARIATION",3);let Qg=es;const UH=200,GH=1e3,Nj=100,Bj=440,Pj=880,ZH=.3,jj=.5;class Ij{constructor(t,r){oe(this,"notification");oe(this,"audioPalette");oe(this,"isCombinedAudio");oe(this,"mode");oe(this,"activeAudioIds");oe(this,"volume");oe(this,"audioContext");oe(this,"compressor");this.notification=t,this.audioPalette=new Qg,this.isCombinedAudio=!1,this.mode="on",this.updateMode(r),this.activeAudioIds=new Map,this.volume=jj,this.audioContext=new AudioContext,this.compressor=this.initCompressor()}dispose(){this.stopAll(),this.audioPalette.dispose(),this.audioContext.state!=="closed"&&(this.compressor.disconnect(),this.audioContext.close())}initCompressor(){const t=this.audioContext.createDynamicsCompressor();t.threshold.value=-50,t.knee.value=40,t.ratio.value=12,t.attack.value=0,t.release.value=.25;const r=this.audioContext.createGain();return r.gain.value=.5,t.connect(r),r.connect(this.audioContext.destination),t}updateMode(t){if(t.empty||t.type==="figure")return;const r=t.type==="subplot"?t.trace:t;r.empty||r.hasMultiPoints===this.isCombinedAudio||(this.isCombinedAudio=r.hasMultiPoints,this.mode!=="off"&&(this.isCombinedAudio?this.mode="combined":this.mode="on"))}update(t){if(this.updateMode(t),this.mode==="off"||t.type!=="trace")return;if(t.empty){this.playEmptyTone(t.audio.size,t.audio.index);return}const r=t.audio,s=r.groupIndex,a=s!==void 0?this.audioPalette.getPaletteEntry(s):void 0;if(r.isContinuous)this.playSmooth(r.value,r.min,r.max,r.size,r.index,a);else if(Array.isArray(r.value)){const i=r.value;if(i.length===0){this.playZeroTone();return}let l=0;const T=this.mode==="on"?50:0,u=new Array,Q=()=>{l<i.length?(this.playTone(r.min,r.max,i[l],r.size,l++,a),u.push(setTimeout(Q,T))):this.stop(u)};Q()}else{const i=r.value;i===0?this.playZeroTone():this.playTone(r.min,r.max,i,r.size,r.index,a)}}playTone(t,r,s,o,a,i){const l={min:t,max:r},T={min:UH,max:GH},u=this.interpolate(s,l,T),Q={min:0,max:o},f={min:-1,max:1},h=this.clamp(this.interpolate(a,Q,f),-1,1);return this.playOscillator(u,h,i)}createOscillators(t,r){const s=[],o=this.audioContext.createOscillator();if(o.type=t.waveType,o.frequency.value=r,s.push(o),t.harmonicMix)for(const a of t.harmonicMix.harmonics){const i=this.audioContext.createOscillator();i.type=t.waveType,i.frequency.value=a.frequency*r,s.push(i)}return s}createGainNodes(t,r,s,o){const a=[],i=this.audioContext.currentTime;for(let l=0;l<t.length;l++){const T=this.audioContext.createGain();let u=s;if(l===0)r.harmonicMix&&(u*=r.harmonicMix.fundamental);else{const f=r.harmonicMix.harmonics[l-1];u*=f.amplitude}const Q=this.createAdsrEnvelope(T,r,u,i,o);Q!==null&&T.gain.setValueCurveAtTime(Q,i,o),a.push(T)}return a}playOscillator(t,r=0,s){const o=ZH,a=this.volume;s||(s={waveType:"sine"});const i=this.createOscillators(s,t),l=this.createGainNodes(i,s,a,o),T=this.audioContext.createStereoPanner();T.pan.value=r;const u=new PannerNode(this.audioContext,{distanceModel:"linear",positionX:0,positionY:0,positionZ:0,orientationX:0,orientationY:0,orientationZ:-1,refDistance:1,maxDistance:1e4,rolloffFactor:10,coneInnerAngle:40,coneOuterAngle:50,coneOuterGain:.4});for(let h=0;h<i.length;h++)i[h].connect(l[h]),l[h].connect(T);T.connect(u),u.connect(this.compressor),i.forEach(h=>h.start());const Q=h=>{u.disconnect(this.compressor),T.disconnect(u);for(let p=0;p<i.length;p++)l[p].disconnect(T),i[p].stop(),i[p].disconnect(l[p]);this.activeAudioIds.delete(h)},f=setTimeout(()=>Q(f),o*1e3*2);return this.activeAudioIds.set(f,i),f}createAdsrEnvelope(t,r,s,o,a){if(r!=null&&r.timbreModulation){const{attack:i,decay:l,sustain:T,release:u}=r.timbreModulation,Q=a*i,f=a*l,h=a*u,p=a-Q-f-h;return t.gain.setValueAtTime(1e-4*s,o),t.gain.linearRampToValueAtTime(s,o+Q),t.gain.linearRampToValueAtTime(T*s,o+Q+f),p>0&&t.gain.setValueAtTime(T*s,o+Q+f+p),t.gain.linearRampToValueAtTime(1e-4*s,o+a),null}else return[.5*s,s,.5*s,.5*s,.5*s,.1*s,1e-4*s]}playSmooth(t,r,s,o,a,i){const l=this.audioContext,T=l.currentTime,u=ZH,Q=(i==null?void 0:i.waveType)||"sine",f=t.map(M=>this.interpolate(M,{min:r,max:s},{min:UH,max:GH}));f.length<2&&f.push(f[0]);const h=this.clamp(this.interpolate(a,{min:0,max:o-1},{min:-1,max:1}),-1,1),p=l.createOscillator();p.type=Q,p.frequency.setValueCurveAtTime(f,T,u);const v=l.createGain(),g=this.createAdsrEnvelope(v,i,this.volume,T,u);g!==null&&v.gain.setValueCurveAtTime(g,T,u);const b=l.createStereoPanner();b.pan.value=h,p.connect(v),v.connect(b),b.connect(this.compressor),p.start(T),p.stop(T+u);const L=setTimeout(()=>{p.disconnect(),v.disconnect(),b.disconnect(),this.activeAudioIds.delete(L)},u*1e3*2);this.activeAudioIds.set(L,[p])}playEmptyTone(t,r){const s=this.audioContext,o=s.currentTime,a=.2,i=[500,1e3,1500,2100,2700],l=[1,.6,.4,.2,.1],T=s.createGain();T.gain.setValueAtTime(.3,o),T.gain.exponentialRampToValueAtTime(.01,o+a),T.connect(this.compressor);const u={min:0,max:t},Q={min:-1,max:1},f=this.clamp(this.interpolate(r,u,Q),-1,1),h=[];for(let g=0;g<i.length;g++){const b=s.createOscillator(),L=s.createGain(),M=this.audioContext.createStereoPanner(),A=new PannerNode(this.audioContext,{distanceModel:"linear",positionX:0,positionY:0,positionZ:0,orientationX:0,orientationY:0,orientationZ:-1,refDistance:1,maxDistance:1e4,rolloffFactor:10,coneInnerAngle:40,coneOuterAngle:50,coneOuterGain:.4});b.frequency.value=i[g],b.type="sine",L.gain.setValueAtTime(l[g]*this.volume,o),L.gain.exponentialRampToValueAtTime(.001,o+a),M.pan.value=f,b.connect(L),L.connect(M),M.connect(A),A.connect(T),b.start(o),b.stop(o+a),h.push(b)}const p=g=>{T.disconnect(),h.forEach(b=>{b.disconnect()}),this.activeAudioIds.delete(g)},v=setTimeout(()=>p(v),a*1e3*2);return this.activeAudioIds.set(v,h),v}playZeroTone(){return this.playOscillator(Nj,0,{waveType:"triangle"})}playWaitingTone(){return setInterval(()=>this.playOscillator(Bj,0,{waveType:"sine"}),1e3)}playCompleteTone(){return this.playOscillator(Pj,0,{waveType:"sine"})}interpolate(t,r,s){return r.min===0&&r.max===0?0:(t-r.min)/(r.max-r.min)*(s.max-s.min)+s.min}clamp(t,r,s){return Math.max(r,Math.min(t,s))}toggle(){switch(this.mode){case"off":this.mode=this.isCombinedAudio?"combined":"on";break;case"on":this.mode="off";break;case"combined":this.mode="on";break}const r=`Sound is ${this.isCombinedAudio&&this.mode==="on"?"separate":this.mode}`;this.notification.notify(r)}stop(t){(Array.isArray(t)?t:[t]).forEach(s=>{const o=this.activeAudioIds.get(s);if(!o){clearInterval(s);return}o.forEach(a=>{a==null||a.disconnect(),a==null||a.stop()}),clearTimeout(s),this.activeAudioIds.delete(s)})}stopAll(){this.activeAudioIds.entries().forEach(([t,r])=>{clearTimeout(t),r.forEach(s=>{s.disconnect(),s.stop()})}),this.activeAudioIds.clear()}setVolume(t){this.volume=Math.min(Math.max(t/100,0),1)}}const Fj=250,zj=50,qj=500,$j=4e3,Uj=20;class Gj{constructor(t,r){oe(this,"context");oe(this,"notification");oe(this,"autoplayId");oe(this,"currentDirection");oe(this,"userSpeed");oe(this,"defaultSpeed");oe(this,"minSpeed");oe(this,"maxSpeed");oe(this,"autoplayRate");oe(this,"totalDuration");oe(this,"interval");oe(this,"onChangeEmitter");oe(this,"onChange");this.notification=r,this.context=t,this.autoplayId=null,this.currentDirection=null,this.userSpeed=null,this.defaultSpeed=Fj,this.minSpeed=zj,this.maxSpeed=qj,this.autoplayRate=this.defaultSpeed,this.totalDuration=$j,this.interval=Uj,this.onChangeEmitter=new Q9,this.onChange=this.onChangeEmitter.event}dispose(){this.stop(),this.onChangeEmitter.dispose()}start(t,r){this.stop(),this.onChangeEmitter.fire({type:"start"}),this.autoplayRate=this.getAutoplayRate(t,r),this.currentDirection=t,this.autoplayId=setInterval(()=>{this.context.isMovable(t)?this.context.moveOnce(t):this.stop()},this.autoplayRate)}stop(){this.autoplayId&&clearInterval(this.autoplayId),this.autoplayId=null,this.currentDirection=null,this.onChangeEmitter.fire({type:"stop"})}restart(){this.autoplayId&&clearInterval(this.autoplayId),this.currentDirection&&this.start(this.currentDirection)}speedUp(){const t=this.userSpeed??this.autoplayRate;t-this.interval>this.minSpeed?(this.userSpeed=t-this.interval,this.autoplayRate=this.userSpeed,this.restart(),this.notification.notify("Speed up")):this.notification.notify("Max speed")}speedDown(){const t=this.userSpeed??this.autoplayRate;t+this.interval<=this.maxSpeed?(this.userSpeed=t+this.interval,this.autoplayRate=this.userSpeed,this.restart(),this.notification.notify("Speed down")):this.notification.notify("Min speed")}resetSpeed(){this.userSpeed=null,this.autoplayRate=this.defaultSpeed,this.restart(),this.notification.notify("Reset speed")}getAutoplayRate(t,r){if(this.userSpeed!==null)return this.userSpeed;if(r&&!r.empty){const s=Math.ceil(this.totalDuration/r.autoplay[t]);return this.defaultSpeed=s,this.minSpeed=Math.min(this.minSpeed,s),s}return this.defaultSpeed}}const XH=32;class bc{encode(t){const r=new Array,s=new Array,o=new Array;for(let a=0;a<t.values.length;a++){s.push(new Array);const i=(t.max[a]-t.min[a])/4,l=t.min[a]+i,T=l+i,u=T+i;for(let Q=0;Q<t.values[a].length;Q++)t.values[a][Q]===0?r.push(" "):t.values[a][Q]<=l||t.values[a][Q]<=T?r.push("⠤"):t.values[a][Q]<=u?r.push("⠒"):r.push("⠉"),s[a].push(o.length),o.push({row:a,col:Q});r.push(xe.NEW_LINE),s[a].push(o.length),o.push({row:a,col:t.values[a].length})}return{value:r.join(xe.EMPTY),cellToIndex:s,indexToCell:o}}}class Zj{constructor(){oe(this,"GLOBAL_MIN","globalMin");oe(this,"GLOBAL_MAX","globalMax");oe(this,"BLANK","blank");oe(this,"LOWER_OUTLIER","lowerOutlier");oe(this,"UPPER_OUTLIER","upperOutlier");oe(this,"MIN","min");oe(this,"MAX","max");oe(this,"Q1","q1");oe(this,"Q2","q2");oe(this,"Q3","q3")}encode(t,r=XH){const s=new Array,o=new Array,a=new Array;for(let i=0;i<t.values.length;i++){const l=t.values[i],T=[{type:this.GLOBAL_MIN,value:t.min},...l.lowerOutliers.map(V=>({type:this.LOWER_OUTLIER,value:V})),{type:this.MIN,value:l.min},{type:this.Q1,value:l.q1},{type:this.Q2,value:l.q2},{type:this.Q3,value:l.q3},{type:this.MAX,value:l.max},...l.upperOutliers.map(V=>({type:this.UPPER_OUTLIER,value:V})),{type:this.GLOBAL_MAX,value:t.max}],u=new Array;let Q=!0;for(let V=0;V<T.length-1;V++){const k=T[V],B=T[V+1],R=Math.abs(Q?B.value-k.value:k.value-T[V-1].value);k.type===this.LOWER_OUTLIER||k.type===this.UPPER_OUTLIER?(u.push({type:k.type,length:0,numChars:1}),u.push({type:this.BLANK,length:R,numChars:0})):k.type===this.Q2?(Q=!1,u.push({type:this.Q2,length:0,numChars:2})):k.type===this.GLOBAL_MIN||k.type===this.GLOBAL_MAX?u.push({type:this.BLANK,length:R,numChars:0}):u.push({type:k.type,length:R,numChars:1})}let f=u.reduce((V,k)=>V+(k.numChars>0?k.numChars:0),0),[h,p,v,g]=[-1,-1,-1,-1];for(let V=0;V<u.length;V++)u[V].type===this.MIN&&u[V].length>0&&(h=V),u[V].type===this.MAX&&u[V].length>0&&(p=V),u[V].type===this.Q1&&(v=V),u[V].type===this.Q3&&(g=V);h!==-1&&p!==-1&&u[h].length!==u[p].length&&(u[h].length>u[p].length?(u[h].numChars++,f++):(u[p].numChars++,f++)),v!==-1&&g!==-1&&u[v].length!==u[g].length&&(u[v].length>u[g].length?(u[v].numChars++,f++):(u[g].numChars++,f++));const b=Math.max(0,r-f),L=u.reduce((V,k)=>V+(k.type!==this.Q2&&k.length>0?k.length:0),0);for(const V of u)if(V.type!==this.Q2&&V.length>0){const k=Math.round(V.length/L*b);V.numChars+=k}const M=u.reduce((V,k)=>V+k.numChars,0);let A=r-M,C=0;for(;A!==0;){const V=u[C%u.length];V.type!==this.BLANK&&V.type!==this.Q2&&V.length>0&&(V.numChars+=A>0?1:-1,A+=A>0?-1:1),C++}let E=-1;const _=[this.LOWER_OUTLIER,this.MIN,this.Q1,this.Q2,this.Q3,this.MAX,this.UPPER_OUTLIER];a.push(Array.from({length:_.length}).fill(-1));for(const V of u){V.type!==this.BLANK&&V.type!==this.GLOBAL_MIN&&V.type!==this.GLOBAL_MAX&&(E=_.indexOf(V.type),a[i][E]=s.length);for(let k=0;k<V.numChars;k++){let B="⠀";V.type===this.MIN||V.type===this.MAX?B="⠒":V.type===this.Q1||V.type===this.Q3?B="⠿":V.type===this.Q2?B=k===0?"⠸":"⠇":V.type===this.LOWER_OUTLIER||V.type===this.UPPER_OUTLIER?B="⠂":V.type===this.BLANK&&(B="⠀"),s.push(B),o.push({row:i,col:E})}}for(let V=0;V<3;V++)if(a[i][V]===-1){for(let k=V+1;k<=3;k++)if(a[i][k]!==-1){a[i][V]=a[i][k];break}}for(let V=6;V>3;V--)if(a[i][V]===-1){for(let k=V-1;k>=3;k--)if(a[i][k]!==-1){a[i][V]=a[i][k];break}}s.push(xe.NEW_LINE),o.push({row:i,col:E})}return{value:s.join(xe.EMPTY),cellToIndex:a,indexToCell:o}}}class Xj{encode(t){const r=new Array,s=new Array,o=new Array,a=(t.max-t.min)/3,i=t.min+a,l=i+a;for(let T=0;T<t.values.length;T++){s.push(new Array);for(let u=0;u<t.values[T].length;u++)t.values[T][u]===0?r.push(" "):t.values[T][u]<=i?r.push("⠤"):t.values[T][u]<=l?r.push("⠒"):r.push("⠉"),s[T].push(o.length),o.push({row:T,col:u});r.push(xe.NEW_LINE),s[T].push(o.length),o.push({row:T,col:t.values[T].length})}return{value:r.join(xe.EMPTY),cellToIndex:s,indexToCell:o}}}class WH{encode(t){const r=new Array,s=new Array,o=new Array;for(let a=0;a<t.values.length;a++){s.push(new Array);const{low:i,medium:l,mediumHigh:T,high:u}=this.getThresholds(a,t);for(let Q=0;Q<t.values[a].length;Q++){const f=t.values[a][Q],h=Q>0?t.values[a][Q-1]:null,p=this.getBrailleChar(f,h,i,l,T,u);r.push(p),s[a].push(o.length),o.push({row:a,col:Q})}r.push(xe.NEW_LINE),s[a].push(o.length),o.push({row:a,col:t.values[a].length})}return{value:r.join(xe.EMPTY),cellToIndex:s,indexToCell:o}}getBrailleChar(t,r,s,o,a,i){return t<=s&&r!==null&&r>s?r<=o?"⢄":r<=a?"⢆":"⢇":t<=s?"⣀":r!==null&&r<=s?t<=o?"⡠":t<=a?"⡰":"⡸":t<=o&&r!==null&&r>o?r<=a?"⠢":"⠣":t<=o?"⠤":r!==null&&r<=o?t<=a?"⠔":"⠜":t<=a&&r!==null&&r>a?"⠑":t<=a?"⠒":r!==null&&r<=a?"⠊":t<=i?"⠉":""}}class Wj extends WH{getThresholds(t,r){const s=(r.max-r.min)/4,o=r.min+s,a=o+s,i=a+s,l=r.max;return{low:o,medium:a,mediumHigh:i,high:l}}}class Yj extends WH{getThresholds(t,r){const s=(r.max[t]-r.min[t])/4,o=r.min[t]+s,a=o+s,i=a+s,l=r.max[t];return{low:o,medium:a,mediumHigh:i,high:l}}}class Kj{constructor(t,r,s){oe(this,"context");oe(this,"notification");oe(this,"display");oe(this,"enabled");oe(this,"cacheId");oe(this,"cache");oe(this,"encoders");oe(this,"onChangeEmitter");oe(this,"onChange");this.context=t,this.notification=r,this.display=s,this.enabled=!1,this.cacheId=xe.EMPTY,this.cache=null,this.encoders=new Map([[R2.BAR,new bc],[R2.BOX,new Zj],[R2.CANDLESTICK,new Wj],[R2.DODGED,new bc],[R2.HEATMAP,new Xj],[R2.HISTOGRAM,new bc],[R2.LINE,new Yj],[R2.NORMALIZED,new bc],[R2.STACKED,new bc]]),this.onChangeEmitter=new Q9,this.onChange=this.onChangeEmitter.event}dispose(){this.onChangeEmitter.dispose(),this.cache=null,this.encoders.clear()}update(t){if(!this.enabled||t.empty)return;const r=t.type==="subplot"?t.trace:t;if(r.empty||r.braille.empty||!this.encoders.has(r.traceType))return;const s=r.braille;if(this.cacheId!==s.id||this.cache===null){const o=this.encoders.get(r.traceType);this.cache=o.encode(s,XH),this.cacheId=s.id}this.onChangeEmitter.fire({value:this.cache.value.trim(),index:this.cache.cellToIndex[s.row][s.col]})}moveToIndex(t){if(!this.enabled||this.cache===null||t<0||t>=this.cache.indexToCell.length)return;const{row:r,col:s}=this.cache.indexToCell[t];this.context.moveToIndex(r,s)}toggle(t){if(t.empty){this.notification.notify("No info for braille");return}if(t.braille.empty){const s=`Braille is not supported for plot type: ${t.braille.traceType}`;this.notification.notify(s);return}this.enabled=!this.enabled,this.update(t),this.display.toggleFocus(b1.BRAILLE);const r=`Braille is ${this.enabled?"on":"off"}`;this.notification.notify(r)}}var YH=(e=>(e[e.OK=200]="OK",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.SERVER_ERROR=500]="SERVER_ERROR",e))(YH||{});class KH{constructor(){}static async post(t,r,s){const o={...this.DEFAULT_HEADERS,...s};return this.request(t,"POST",o,r)}static async request(t,r,s,o){try{const a=await fetch(t,{method:r,headers:s,body:o});return a.ok?{success:!0,data:await a.json()}:{success:!1,error:{statusCode:a.status,message:`API Error: ${a.status} - ${a.statusText}`}}}catch(a){return console.error(`Error in API ${r} request to ${t}:`,a),{success:!1,error:{statusCode:YH.SERVER_ERROR,message:a instanceof Error?a.message:"Unknown error occurred"}}}}}oe(KH,"DEFAULT_HEADERS",{"Content-Type":"application/json"});const Jj=`You are an accessibility assistant specializing in describing statistical visualizations to blind users. Your role is to:
|
|
3
3
|
1. Provide simple, straightforward descriptions of charts and graphs
|
|
4
4
|
2. Focus on basic patterns and key points
|
|
5
5
|
3. Use simple, everyday language with minimal statistical terms
|
|
@@ -165,7 +165,7 @@ For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.`:Hr(18,`(${t})`));return
|
|
|
165
165
|
React keys must be passed directly to JSX without using spread:
|
|
166
166
|
let props = %s;
|
|
167
167
|
<%s key={someKey} {...props} />`,fe,He,be,He),j[He+fe]=!0)}if(He=null,U!==void 0&&(s(U),He=""+U),l(te)&&(s(te.key),He=""+te.key),"key"in te){U={};for(var Se in te)Se!=="key"&&(U[Se]=te[Se])}else U=te;return He&&T(U,typeof z=="function"?z.displayName||z.name||"Unknown":z),Q(z,He,ye,he,a(),U,se,de)}function h(z){typeof z=="object"&&z!==null&&z.$$typeof===v&&z._store&&(z._store.validated=1)}var p=wa(),v=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),C=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),F=Symbol.for("react.client.reference"),q=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,Z=Array.isArray,J=console.createTask?console.createTask:function(){return null};p={"react-stack-bottom-frame":function(z){return z()}};var W,ne={},K=p["react-stack-bottom-frame"].bind(p,i)(),Y=J(o(i)),j={};qc.Fragment=b,qc.jsx=function(z,te,U,fe,he){var ye=1e4>q.recentlyCreatedOwnerStacks++;return f(z,te,U,!1,fe,he,ye?Error("react-stack-top-frame"):K,ye?J(o(z)):Y)},qc.jsxs=function(z,te,U,fe,he){var ye=1e4>q.recentlyCreatedOwnerStacks++;return f(z,te,U,!0,fe,he,ye?Error("react-stack-top-frame"):K,ye?J(o(z)):Y)}}(),qc}var YM;function C$(){if(YM)return nm.exports;YM=1;var e={};return e.NODE_ENV==="production"?nm.exports=A$():nm.exports=O$(),nm.exports}var Ve=C$(),w$={};function V$(e){return e==null||Object.keys(e).length===0}function KM(e){const{styles:t,defaultTheme:r={}}=e,s=typeof t=="function"?o=>t(V$(o)?r:o):t;return Ve.jsx(L$,{styles:s})}w$.NODE_ENV!=="production"&&(KM.propTypes={defaultTheme:S.object,styles:S.oneOfType([S.array,S.string,S.object,S.func])});var D$={};function JM(e,t){const r=aL(e,t);return D$.NODE_ENV!=="production"?(...s)=>{const o=typeof e=="string"?`"${e}"`:"component";return s.length===0?console.error([`MUI: Seems like you called \`styled(${o})()\` without a \`style\` argument.`,'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join(`
|
|
168
|
-
`)):s.some(a=>a===void 0)&&console.error(`MUI: the styled(${o})(...args) API requires all its args to be defined.`),r(...s)}:r}function R$(e,t){Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}const eS=[];function tS(e){return eS[0]=e,Ic(eS)}const k$=e=>{const t=Object.keys(e).map(r=>({key:r,val:e[r]}))||[];return t.sort((r,s)=>r.val-s.val),t.reduce((r,s)=>({...r,[s.key]:s.val}),{})};function N$(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:r="px",step:s=5,...o}=e,a=k$(t),i=Object.keys(a);function l(h){return`@media (min-width:${typeof t[h]=="number"?t[h]:h}${r})`}function T(h){return`@media (max-width:${(typeof t[h]=="number"?t[h]:h)-s/100}${r})`}function u(h,p){const v=i.indexOf(p);return`@media (min-width:${typeof t[h]=="number"?t[h]:h}${r}) and (max-width:${(v!==-1&&typeof t[i[v]]=="number"?t[i[v]]:p)-s/100}${r})`}function Q(h){return i.indexOf(h)+1<i.length?u(h,i[i.indexOf(h)+1]):l(h)}function f(h){const p=i.indexOf(h);return p===0?l(i[1]):p===i.length-1?T(i[p]):u(h,i[i.indexOf(h)+1]).replace("@media","@media not all and")}return{keys:i,values:a,up:l,down:T,between:u,only:Q,not:f,unit:r,...o}}const B$={borderRadius:4};var P$={};function nS(e=8,t=Fg({spacing:e})){if(e.mui)return e;const r=(...s)=>(P$.NODE_ENV!=="production"&&(s.length<=4||console.error(`MUI: Too many arguments provided, expected between 0 and 4, got ${s.length}`)),(s.length===0?[1]:s).map(a=>{const i=t(a);return typeof i=="number"?`${i}px`:i}).join(" "));return r.mui=!0,r}function j$(e,t){var s;const r=this;if(r.vars){if(!((s=r.colorSchemes)!=null&&s[e])||typeof r.getColorSchemeSelector!="function")return{};let o=r.getColorSchemeSelector(e);return o==="&"?t:((o.includes("data-")||o.includes("."))&&(o=`*:where(${o.replace(/\s*&$/,"")}) &`),{[o]:t})}return r.palette.mode===e?t:{}}function rm(e={},...t){const{breakpoints:r={},palette:s={},spacing:o,shape:a={},...i}=e,l=N$(r),T=nS(o);let u=q3({breakpoints:l,direction:"ltr",components:{},palette:{mode:"light",...s},spacing:T,shape:{...B$,...a}},i);return u=Nz(u),u.applyStyles=j$,u=t.reduce((Q,f)=>q3(Q,f),u),u.unstable_sxConfig={...Rc,...i==null?void 0:i.unstable_sxConfig},u.unstable_sx=function(f){return H7({sx:f,theme:this})},u}function I$(e){return Object.keys(e).length===0}function F$(e=null){const t=ae.useContext(tm);return!t||I$(t)?e:t}const z$=rm();function $c(e=z$){return F$(e)}var q$={};function rS({styles:e,themeId:t,defaultTheme:r={}}){const s=$c(r),o=typeof e=="function"?e(t&&s[t]||s):e;return Ve.jsx(KM,{styles:o})}q$.NODE_ENV!=="production"&&(rS.propTypes={defaultTheme:S.object,styles:S.oneOfType([S.array,S.func,S.number,S.object,S.string,S.bool]),themeId:S.string});function $$(e={}){const{themeId:t,defaultTheme:r,defaultClassName:s="MuiBox-root",generateClassName:o}=e,a=JM("div",{shouldForwardProp:l=>l!=="theme"&&l!=="sx"&&l!=="as"})(H7);return ae.forwardRef(function(T,u){const Q=$c(r),{className:f,component:h="div",...p}=$g(T);return Ve.jsx(a,{as:h,ref:u,className:vt(f,o?o(s):s),theme:t&&Q[t]||Q,...p})})}const U$={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function Yt(e,t,r="Mui"){const s=U$[t];return s?`${r}-${s}`:`${eM.generate(e)}-${t}`}function Zt(e,t,r="Mui"){const s={};return t.forEach(o=>{s[o]=Yt(e,o,r)}),s}function iS(e,t=""){return e.displayName||e.name||t}function aS(e,t,r){const s=iS(t);return e.displayName||(s!==""?`${r}(${s})`:r)}function G$(e){if(e!=null){if(typeof e=="string")return e;if(typeof e=="function")return iS(e,"Component");if(typeof e=="object")switch(e.$$typeof){case b7.ForwardRef:return aS(e,e.render,"ForwardRef");case b7.Memo:return aS(e,e.type,"memo");default:return}}}function oS(e){const{variants:t,...r}=e,s={variants:t,style:tS(r),isProcessed:!0};return s.style===r||t&&t.forEach(o=>{typeof o.style!="function"&&(o.style=tS(o.style))}),s}var lS={};const Z$=rm();function oL(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function X$(e){return e?(t,r)=>r[e]:null}function W$(e,t,r){e.theme=J$(e.theme)?r:e.theme[t]||e.theme}function im(e,t){const r=typeof t=="function"?t(e):t;if(Array.isArray(r))return r.flatMap(s=>im(e,s));if(Array.isArray(r==null?void 0:r.variants)){let s;if(r.isProcessed)s=r.style;else{const{variants:o,...a}=r;s=a}return sS(e,r.variants,[s])}return r!=null&&r.isProcessed?r.style:r}function sS(e,t,r=[]){var o;let s;e:for(let a=0;a<t.length;a+=1){const i=t[a];if(typeof i.props=="function"){if(s??(s={...e,...e.ownerState,ownerState:e.ownerState}),!i.props(s))continue}else for(const l in i.props)if(e[l]!==i.props[l]&&((o=e.ownerState)==null?void 0:o[l])!==i.props[l])continue e;typeof i.style=="function"?(s??(s={...e,...e.ownerState,ownerState:e.ownerState}),r.push(i.style(s))):r.push(i.style)}return r}function uS(e={}){const{themeId:t,defaultTheme:r=Z$,rootShouldForwardProp:s=oL,slotShouldForwardProp:o=oL}=e;function a(l){W$(l,t,r)}return(l,T={})=>{R$(l,E=>E.filter(_=>_!==H7));const{name:u,slot:Q,skipVariantsResolver:f,skipSx:h,overridesResolver:p=X$(cS(Q)),...v}=T,g=f!==void 0?f:Q&&Q!=="Root"&&Q!=="root"||!1,b=h||!1;let L=oL;Q==="Root"||Q==="root"?L=s:Q?L=o:eU(l)&&(L=void 0);const M=JM(l,{shouldForwardProp:L,label:K$(u,Q),...v}),A=E=>{if(typeof E=="function"
|
|
168
|
+
`)):s.some(a=>a===void 0)&&console.error(`MUI: the styled(${o})(...args) API requires all its args to be defined.`),r(...s)}:r}function R$(e,t){Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}const eS=[];function tS(e){return eS[0]=e,Ic(eS)}const k$=e=>{const t=Object.keys(e).map(r=>({key:r,val:e[r]}))||[];return t.sort((r,s)=>r.val-s.val),t.reduce((r,s)=>({...r,[s.key]:s.val}),{})};function N$(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:r="px",step:s=5,...o}=e,a=k$(t),i=Object.keys(a);function l(h){return`@media (min-width:${typeof t[h]=="number"?t[h]:h}${r})`}function T(h){return`@media (max-width:${(typeof t[h]=="number"?t[h]:h)-s/100}${r})`}function u(h,p){const v=i.indexOf(p);return`@media (min-width:${typeof t[h]=="number"?t[h]:h}${r}) and (max-width:${(v!==-1&&typeof t[i[v]]=="number"?t[i[v]]:p)-s/100}${r})`}function Q(h){return i.indexOf(h)+1<i.length?u(h,i[i.indexOf(h)+1]):l(h)}function f(h){const p=i.indexOf(h);return p===0?l(i[1]):p===i.length-1?T(i[p]):u(h,i[i.indexOf(h)+1]).replace("@media","@media not all and")}return{keys:i,values:a,up:l,down:T,between:u,only:Q,not:f,unit:r,...o}}const B$={borderRadius:4};var P$={};function nS(e=8,t=Fg({spacing:e})){if(e.mui)return e;const r=(...s)=>(P$.NODE_ENV!=="production"&&(s.length<=4||console.error(`MUI: Too many arguments provided, expected between 0 and 4, got ${s.length}`)),(s.length===0?[1]:s).map(a=>{const i=t(a);return typeof i=="number"?`${i}px`:i}).join(" "));return r.mui=!0,r}function j$(e,t){var s;const r=this;if(r.vars){if(!((s=r.colorSchemes)!=null&&s[e])||typeof r.getColorSchemeSelector!="function")return{};let o=r.getColorSchemeSelector(e);return o==="&"?t:((o.includes("data-")||o.includes("."))&&(o=`*:where(${o.replace(/\s*&$/,"")}) &`),{[o]:t})}return r.palette.mode===e?t:{}}function rm(e={},...t){const{breakpoints:r={},palette:s={},spacing:o,shape:a={},...i}=e,l=N$(r),T=nS(o);let u=q3({breakpoints:l,direction:"ltr",components:{},palette:{mode:"light",...s},spacing:T,shape:{...B$,...a}},i);return u=Nz(u),u.applyStyles=j$,u=t.reduce((Q,f)=>q3(Q,f),u),u.unstable_sxConfig={...Rc,...i==null?void 0:i.unstable_sxConfig},u.unstable_sx=function(f){return H7({sx:f,theme:this})},u}function I$(e){return Object.keys(e).length===0}function F$(e=null){const t=ae.useContext(tm);return!t||I$(t)?e:t}const z$=rm();function $c(e=z$){return F$(e)}var q$={};function rS({styles:e,themeId:t,defaultTheme:r={}}){const s=$c(r),o=typeof e=="function"?e(t&&s[t]||s):e;return Ve.jsx(KM,{styles:o})}q$.NODE_ENV!=="production"&&(rS.propTypes={defaultTheme:S.object,styles:S.oneOfType([S.array,S.func,S.number,S.object,S.string,S.bool]),themeId:S.string});function $$(e={}){const{themeId:t,defaultTheme:r,defaultClassName:s="MuiBox-root",generateClassName:o}=e,a=JM("div",{shouldForwardProp:l=>l!=="theme"&&l!=="sx"&&l!=="as"})(H7);return ae.forwardRef(function(T,u){const Q=$c(r),{className:f,component:h="div",...p}=$g(T);return Ve.jsx(a,{as:h,ref:u,className:vt(f,o?o(s):s),theme:t&&Q[t]||Q,...p})})}const U$={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function Yt(e,t,r="Mui"){const s=U$[t];return s?`${r}-${s}`:`${eM.generate(e)}-${t}`}function Zt(e,t,r="Mui"){const s={};return t.forEach(o=>{s[o]=Yt(e,o,r)}),s}function iS(e,t=""){return e.displayName||e.name||t}function aS(e,t,r){const s=iS(t);return e.displayName||(s!==""?`${r}(${s})`:r)}function G$(e){if(e!=null){if(typeof e=="string")return e;if(typeof e=="function")return iS(e,"Component");if(typeof e=="object")switch(e.$$typeof){case b7.ForwardRef:return aS(e,e.render,"ForwardRef");case b7.Memo:return aS(e,e.type,"memo");default:return}}}function oS(e){const{variants:t,...r}=e,s={variants:t,style:tS(r),isProcessed:!0};return s.style===r||t&&t.forEach(o=>{typeof o.style!="function"&&(o.style=tS(o.style))}),s}var lS={};const Z$=rm();function oL(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function X$(e){return e?(t,r)=>r[e]:null}function W$(e,t,r){e.theme=J$(e.theme)?r:e.theme[t]||e.theme}function im(e,t){const r=typeof t=="function"?t(e):t;if(Array.isArray(r))return r.flatMap(s=>im(e,s));if(Array.isArray(r==null?void 0:r.variants)){let s;if(r.isProcessed)s=r.style;else{const{variants:o,...a}=r;s=a}return sS(e,r.variants,[s])}return r!=null&&r.isProcessed?r.style:r}function sS(e,t,r=[]){var o;let s;e:for(let a=0;a<t.length;a+=1){const i=t[a];if(typeof i.props=="function"){if(s??(s={...e,...e.ownerState,ownerState:e.ownerState}),!i.props(s))continue}else for(const l in i.props)if(e[l]!==i.props[l]&&((o=e.ownerState)==null?void 0:o[l])!==i.props[l])continue e;typeof i.style=="function"?(s??(s={...e,...e.ownerState,ownerState:e.ownerState}),r.push(i.style(s))):r.push(i.style)}return r}function uS(e={}){const{themeId:t,defaultTheme:r=Z$,rootShouldForwardProp:s=oL,slotShouldForwardProp:o=oL}=e;function a(l){W$(l,t,r)}return(l,T={})=>{R$(l,E=>E.filter(_=>_!==H7));const{name:u,slot:Q,skipVariantsResolver:f,skipSx:h,overridesResolver:p=X$(cS(Q)),...v}=T,g=f!==void 0?f:Q&&Q!=="Root"&&Q!=="root"||!1,b=h||!1;let L=oL;Q==="Root"||Q==="root"?L=s:Q?L=o:eU(l)&&(L=void 0);const M=JM(l,{shouldForwardProp:L,label:K$(u,Q),...v}),A=E=>{if(E.__emotion_real===E)return E;if(typeof E=="function")return function(V){return im(V,E)};if(Er(E)){const _=oS(E);return _.variants?function(k){return im(k,_)}:_.style}return E},C=(...E)=>{const _=[],V=E.map(A),k=[];if(_.push(a),u&&p&&k.push(function(q){var W,ne;const Z=(ne=(W=q.theme.components)==null?void 0:W[u])==null?void 0:ne.styleOverrides;if(!Z)return null;const J={};for(const K in Z)J[K]=im(q,Z[K]);return p(q,J)}),u&&!g&&k.push(function(q){var J,W;const $=q.theme,Z=(W=(J=$==null?void 0:$.components)==null?void 0:J[u])==null?void 0:W.variants;return Z?sS(q,Z):null}),b||k.push(H7),Array.isArray(V[0])){const F=V.shift(),q=new Array(_.length).fill(""),$=new Array(k.length).fill("");let Z;Z=[...q,...F,...$],Z.raw=[...q,...F.raw,...$],_.unshift(Z)}const B=[..._,...V,...k],R=M(...B);return l.muiName&&(R.muiName=l.muiName),lS.NODE_ENV!=="production"&&(R.displayName=Y$(u,Q,l)),R};return M.withConfig&&(C.withConfig=M.withConfig),C}}function Y$(e,t,r){return e?`${e}${st(t||"")}`:`Styled(${G$(r)})`}function K$(e,t){let r;return lS.NODE_ENV!=="production"&&e&&(r=`${e}-${cS(t||"Root")}`),r}function J$(e){for(const t in e)return!1;return!0}function eU(e){return typeof e=="string"&&e.charCodeAt(0)>96}function cS(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}const tU=uS();function Uc(e,t){const r={...t};for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)){const o=s;if(o==="components"||o==="slots")r[o]={...e[o],...r[o]};else if(o==="componentsProps"||o==="slotProps"){const a=e[o],i=t[o];if(!i)r[o]=a||{};else if(!a)r[o]=i;else{r[o]={...i};for(const l in a)if(Object.prototype.hasOwnProperty.call(a,l)){const T=l;r[o][T]=Uc(a[T],i[T])}}}else r[o]===void 0&&(r[o]=e[o])}return r}function nU(e){const{theme:t,name:r,props:s}=e;return!t||!t.components||!t.components[r]||!t.components[r].defaultProps?s:Uc(t.components[r].defaultProps,s)}function rU({props:e,name:t,defaultTheme:r,themeId:s}){let o=$c(r);return s&&(o=o[s]||o),nU({theme:o,name:t,props:e})}const A0=typeof window<"u"?ae.useLayoutEffect:ae.useEffect;function L9(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}var Gc={};function lL(e,t=0,r=1){return Gc.NODE_ENV!=="production"&&(e<t||e>r)&&console.error(`MUI: The value provided ${e} is out of range [${t}, ${r}].`),L9(e,t,r)}function iU(e){e=e.slice(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let r=e.match(t);return r&&r[0].length===1&&(r=r.map(s=>s+s)),Gc.NODE_ENV!=="production"&&e.length!==e.trim().length&&console.error(`MUI: The color: "${e}" is invalid. Make sure the color input doesn't contain leading/trailing space.`),r?`rgb${r.length===4?"a":""}(${r.map((s,o)=>o<3?parseInt(s,16):Math.round(parseInt(s,16)/255*1e3)/1e3).join(", ")})`:""}function ka(e){if(e.type)return e;if(e.charAt(0)==="#")return ka(iU(e));const t=e.indexOf("("),r=e.substring(0,t);if(!["rgb","rgba","hsl","hsla","color"].includes(r))throw new Error(Gc.NODE_ENV!=="production"?`MUI: Unsupported \`${e}\` color.
|
|
169
169
|
The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().`:Hr(9,e));let s=e.substring(t+1,e.length-1),o;if(r==="color"){if(s=s.split(" "),o=s.shift(),s.length===4&&s[3].charAt(0)==="/"&&(s[3]=s[3].slice(1)),!["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].includes(o))throw new Error(Gc.NODE_ENV!=="production"?`MUI: unsupported \`${o}\` color space.
|
|
170
170
|
The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`:Hr(10,o))}else s=s.split(",");return s=s.map(a=>parseFloat(a)),{type:r,values:s,colorSpace:o}}const aU=e=>{const t=ka(e);return t.values.slice(0,3).map((r,s)=>t.type.includes("hsl")&&s!==0?`${r}%`:r).join(" ")},Zc=(e,t)=>{try{return aU(e)}catch{return t&&Gc.NODE_ENV!=="production"&&console.warn(t),e}};function am(e){const{type:t,colorSpace:r}=e;let{values:s}=e;return t.includes("rgb")?s=s.map((o,a)=>a<3?parseInt(o,10):o):t.includes("hsl")&&(s[1]=`${s[1]}%`,s[2]=`${s[2]}%`),t.includes("color")?s=`${r} ${s.join(" ")}`:s=`${s.join(", ")}`,`${t}(${s})`}function TS(e){e=ka(e);const{values:t}=e,r=t[0],s=t[1]/100,o=t[2]/100,a=s*Math.min(o,1-o),i=(u,Q=(u+r/30)%12)=>o-a*Math.max(Math.min(Q-3,9-Q,1),-1);let l="rgb";const T=[Math.round(i(0)*255),Math.round(i(8)*255),Math.round(i(4)*255)];return e.type==="hsla"&&(l+="a",T.push(t[3])),am({type:l,values:T})}function sL(e){e=ka(e);let t=e.type==="hsl"||e.type==="hsla"?ka(TS(e)).values:e.values;return t=t.map(r=>(e.type!=="color"&&(r/=255),r<=.03928?r/12.92:((r+.055)/1.055)**2.4)),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function QS(e,t){const r=sL(e),s=sL(t);return(Math.max(r,s)+.05)/(Math.min(r,s)+.05)}function B2(e,t){return e=ka(e),t=lL(t),(e.type==="rgb"||e.type==="hsl")&&(e.type+="a"),e.type==="color"?e.values[3]=`/${t}`:e.values[3]=t,am(e)}function om(e,t,r){try{return B2(e,t)}catch{return e}}function x9(e,t){if(e=ka(e),t=lL(t),e.type.includes("hsl"))e.values[2]*=1-t;else if(e.type.includes("rgb")||e.type.includes("color"))for(let r=0;r<3;r+=1)e.values[r]*=1-t;return am(e)}function G1(e,t,r){try{return x9(e,t)}catch{return e}}function b9(e,t){if(e=ka(e),t=lL(t),e.type.includes("hsl"))e.values[2]+=(100-e.values[2])*t;else if(e.type.includes("rgb"))for(let r=0;r<3;r+=1)e.values[r]+=(255-e.values[r])*t;else if(e.type.includes("color"))for(let r=0;r<3;r+=1)e.values[r]+=(1-e.values[r])*t;return am(e)}function Z1(e,t,r){try{return b9(e,t)}catch{return e}}function oU(e,t=.15){return sL(e)>.5?x9(e,t):b9(e,t)}function lm(e,t,r){try{return oU(e,t)}catch{return e}}var lU={};const sU="exact-prop: ";function fS(e){return lU.NODE_ENV==="production"?e:{...e,[sU]:t=>{const r=Object.keys(t).filter(s=>!e.hasOwnProperty(s));return r.length>0?new Error(`The following props are not supported: ${r.map(s=>`\`${s}\``).join(", ")}. Please remove them.`):null}}}var uU={};const cU=ae.createContext();uU.NODE_ENV!=="production"&&(S.node,S.bool);const dS=()=>ae.useContext(cU)??!1;var TU={};const QU=ae.createContext(void 0);TU.NODE_ENV!=="production"&&(S.node,S.object);function fU(e){const{theme:t,name:r,props:s}=e;if(!t||!t.components||!t.components[r])return s;const o=t.components[r];return o.defaultProps?Uc(o.defaultProps,s):!o.styleOverrides&&!o.variants?Uc(o,s):s}function dU({props:e,name:t}){const r=ae.useContext(QU);return fU({props:e,name:t,theme:{components:r}})}const hS={theme:void 0};function hU(e){let t,r;return function(o){let a=t;return(a===void 0||o.theme!==r)&&(hS.theme=o.theme,a=oS(e(hS)),t=a,r=o.theme),a}}function pU(e=""){function t(...s){if(!s.length)return"";const o=s[0];return typeof o=="string"&&!o.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)?`, var(--${e?`${e}-`:""}${o}${t(...s.slice(1))})`:`, ${o}`}return(s,...o)=>`var(--${e?`${e}-`:""}${s}${t(...o)})`}const pS=(e,t,r,s=[])=>{let o=e;t.forEach((a,i)=>{i===t.length-1?Array.isArray(o)?o[Number(a)]=r:o&&typeof o=="object"&&(o[a]=r):o&&typeof o=="object"&&(o[a]||(o[a]=s.includes(a)?[]:{}),o=o[a])})},mU=(e,t,r)=>{function s(o,a=[],i=[]){Object.entries(o).forEach(([l,T])=>{(!r||r&&!r([...a,l]))&&T!=null&&(typeof T=="object"&&Object.keys(T).length>0?s(T,[...a,l],Array.isArray(T)?[...i,l]:i):t([...a,l],T,i))})}s(e)},yU=(e,t)=>typeof t=="number"?["lineHeight","fontWeight","opacity","zIndex"].some(s=>e.includes(s))||e[e.length-1].toLowerCase().includes("opacity")?t:`${t}px`:t;function uL(e,t){const{prefix:r,shouldSkipGeneratingVar:s}=t||{},o={},a={},i={};return mU(e,(l,T,u)=>{if((typeof T=="string"||typeof T=="number")&&(!s||!s(l,T))){const Q=`--${r?`${r}-`:""}${l.join("-")}`,f=yU(l,T);Object.assign(o,{[Q]:f}),pS(a,l,`var(${Q})`,u),pS(i,l,`var(${Q}, ${f})`,u)}},l=>l[0]==="vars"),{css:o,vars:a,varsWithDefaults:i}}function vU(e,t={}){const{getSelector:r=b,disableCssColorScheme:s,colorSchemeSelector:o}=t,{colorSchemes:a={},components:i,defaultColorScheme:l="light",...T}=e,{vars:u,css:Q,varsWithDefaults:f}=uL(T,t);let h=f;const p={},{[l]:v,...g}=a;if(Object.entries(g||{}).forEach(([A,C])=>{const{vars:E,css:_,varsWithDefaults:V}=uL(C,t);h=q3(h,V),p[A]={css:_,vars:E}}),v){const{css:A,vars:C,varsWithDefaults:E}=uL(v,t);h=q3(h,E),p[l]={css:A,vars:C}}function b(A,C){var _,V;let E=o;if(o==="class"&&(E=".%s"),o==="data"&&(E="[data-%s]"),o!=null&&o.startsWith("data-")&&!o.includes("%s")&&(E=`[${o}="%s"]`),A){if(E==="media")return e.defaultColorScheme===A?":root":{[`@media (prefers-color-scheme: ${((V=(_=a[A])==null?void 0:_.palette)==null?void 0:V.mode)||A})`]:{":root":C}};if(E)return e.defaultColorScheme===A?`:root, ${E.replace("%s",String(A))}`:E.replace("%s",String(A))}return":root"}return{vars:h,generateThemeVars:()=>{let A={...u};return Object.entries(p).forEach(([,{vars:C}])=>{A=q3(A,C)}),A},generateStyleSheets:()=>{var k,B;const A=[],C=e.defaultColorScheme||"light";function E(R,F){Object.keys(F).length&&A.push(typeof R=="string"?{[R]:{...F}}:R)}E(r(void 0,{...Q}),Q);const{[C]:_,...V}=p;if(_){const{css:R}=_,F=(B=(k=a[C])==null?void 0:k.palette)==null?void 0:B.mode,q=!s&&F?{colorScheme:F,...R}:{...R};E(r(C,{...q}),q)}return Object.entries(V).forEach(([R,{css:F}])=>{var Z,J;const q=(J=(Z=a[R])==null?void 0:Z.palette)==null?void 0:J.mode,$=!s&&q?{colorScheme:q,...F}:{...F};E(r(R,{...$}),$)}),A}}}var gU={};function LU(e){return function(r){return e==="media"?(gU.NODE_ENV!=="production"&&r!=="light"&&r!=="dark"&&console.error(`MUI: @media (prefers-color-scheme) supports only 'light' or 'dark', but receive '${r}'.`),`@media (prefers-color-scheme: ${r})`):e?e.startsWith("data-")&&!e.includes("%s")?`[${e}="${r}"] &`:e==="class"?`.${r} &`:e==="data"?`[data-${r}] &`:`${e.replace("%s",r)} &`:"&"}}function sm(e,t){var r,s,o;return ae.isValidElement(e)&&t.indexOf(e.type.muiName??((o=(s=(r=e.type)==null?void 0:r._payload)==null?void 0:s.value)==null?void 0:o.muiName))!==-1}const xU=(e,t)=>e.filter(r=>t.includes(r)),H9=(e,t,r)=>{const s=e.keys[0];Array.isArray(t)?t.forEach((o,a)=>{r((i,l)=>{a<=e.keys.length-1&&(a===0?Object.assign(i,l):i[e.up(e.keys[a])]=l)},o)}):t&&typeof t=="object"?(Object.keys(t).length>e.keys.length?e.keys:xU(e.keys,Object.keys(t))).forEach(a=>{if(e.keys.includes(a)){const i=t[a];i!==void 0&&r((l,T)=>{s===a?Object.assign(l,T):l[e.up(a)]=T},i)}}):(typeof t=="number"||typeof t=="string")&&r((o,a)=>{Object.assign(o,a)},t)};function um(e){return`--Grid-${e}Spacing`}function cm(e){return`--Grid-parent-${e}Spacing`}const mS="--Grid-columns",E9="--Grid-parent-columns",bU=({theme:e,ownerState:t})=>{const r={};return H9(e.breakpoints,t.size,(s,o)=>{let a={};o==="grow"&&(a={flexBasis:0,flexGrow:1,maxWidth:"100%"}),o==="auto"&&(a={flexBasis:"auto",flexGrow:0,flexShrink:0,maxWidth:"none",width:"auto"}),typeof o=="number"&&(a={flexGrow:0,flexBasis:"auto",width:`calc(100% * ${o} / var(${E9}) - (var(${E9}) - ${o}) * (var(${cm("column")}) / var(${E9})))`}),s(r,a)}),r},HU=({theme:e,ownerState:t})=>{const r={};return H9(e.breakpoints,t.offset,(s,o)=>{let a={};o==="auto"&&(a={marginLeft:"auto"}),typeof o=="number"&&(a={marginLeft:o===0?"0px":`calc(100% * ${o} / var(${E9}) + var(${cm("column")}) * ${o} / var(${E9}))`}),s(r,a)}),r},EU=({theme:e,ownerState:t})=>{if(!t.container)return{};const r={[mS]:12};return H9(e.breakpoints,t.columns,(s,o)=>{const a=o??12;s(r,{[mS]:a,"> *":{[E9]:a}})}),r},MU=({theme:e,ownerState:t})=>{if(!t.container)return{};const r={};return H9(e.breakpoints,t.rowSpacing,(s,o)=>{var i;const a=typeof o=="string"?o:(i=e.spacing)==null?void 0:i.call(e,o);s(r,{[um("row")]:a,"> *":{[cm("row")]:a}})}),r},SU=({theme:e,ownerState:t})=>{if(!t.container)return{};const r={};return H9(e.breakpoints,t.columnSpacing,(s,o)=>{var i;const a=typeof o=="string"?o:(i=e.spacing)==null?void 0:i.call(e,o);s(r,{[um("column")]:a,"> *":{[cm("column")]:a}})}),r},_U=({theme:e,ownerState:t})=>{if(!t.container)return{};const r={};return H9(e.breakpoints,t.direction,(s,o)=>{s(r,{flexDirection:o})}),r},AU=({ownerState:e})=>({minWidth:0,boxSizing:"border-box",...e.container&&{display:"flex",flexWrap:"wrap",...e.wrap&&e.wrap!=="wrap"&&{flexWrap:e.wrap},gap:`var(${um("row")}) var(${um("column")})`}}),OU=e=>{const t=[];return Object.entries(e).forEach(([r,s])=>{s!==!1&&s!==void 0&&t.push(`grid-${r}-${String(s)}`)}),t},CU=(e,t="xs")=>{function r(s){return s===void 0?!1:typeof s=="string"&&!Number.isNaN(Number(s))||typeof s=="number"&&s>0}if(r(e))return[`spacing-${t}-${String(e)}`];if(typeof e=="object"&&!Array.isArray(e)){const s=[];return Object.entries(e).forEach(([o,a])=>{r(a)&&s.push(`spacing-${o}-${String(a)}`)}),s}return[]},wU=e=>e===void 0?[]:typeof e=="object"?Object.entries(e).map(([t,r])=>`direction-${t}-${r}`):[`direction-xs-${String(e)}`];var VU={};const DU=e=>["item","zeroMinWidth"].includes(e)?`The \`${e}\` prop has been removed and is no longer necessary. You can safely remove it.`:`The \`${e}\` prop has been removed. See https://mui.com/material-ui/migration/upgrade-to-grid-v2/ for migration instructions.`,yS=[];function RU(e,t){const r=[];e.item!==void 0&&(delete e.item,r.push("item")),e.zeroMinWidth!==void 0&&(delete e.zeroMinWidth,r.push("zeroMinWidth")),t.keys.forEach(s=>{e[s]!==void 0&&(r.push(s),delete e[s])}),VU.NODE_ENV!=="production"&&r.forEach(s=>{yS.includes(s)||(yS.push(s),console.warn(`MUI Grid: ${DU(s)}
|
|
171
171
|
`))})}var kU={};const NU=rm(),BU=tU("div",{name:"MuiGrid",slot:"Root"});function PU(e){return rU({props:e,name:"MuiGrid",defaultTheme:NU})}function jU(e={}){const{createStyledComponent:t=BU,useThemeProps:r=PU,useTheme:s=$c,componentName:o="MuiGrid"}=e,a=(u,Q)=>{const{container:f,direction:h,spacing:p,wrap:v,size:g}=u,b={root:["root",f&&"container",v!=="wrap"&&`wrap-xs-${String(v)}`,...wU(h),...OU(g),...f?CU(p,Q.breakpoints.keys[0]):[]]};return t1(b,L=>Yt(o,L),{})};function i(u,Q,f=()=>!0){const h={};return u===null||(Array.isArray(u)?u.forEach((p,v)=>{p!==null&&f(p)&&Q.keys[v]&&(h[Q.keys[v]]=p)}):typeof u=="object"?Object.keys(u).forEach(p=>{const v=u[p];v!=null&&f(v)&&(h[p]=v)}):h[Q.keys[0]]=u),h}const l=t(EU,SU,MU,bU,_U,AU,HU),T=ae.forwardRef(function(Q,f){const h=s(),p=r(Q),v=$g(p);RU(v,h.breakpoints);const{className:g,children:b,columns:L=12,container:M=!1,component:A="div",direction:C="row",wrap:E="wrap",size:_={},offset:V={},spacing:k=0,rowSpacing:B=k,columnSpacing:R=k,unstable_level:F=0,...q}=v,$=i(_,h.breakpoints,z=>z!==!1),Z=i(V,h.breakpoints),J=Q.columns??(F?void 0:L),W=Q.spacing??(F?void 0:k),ne=Q.rowSpacing??Q.spacing??(F?void 0:B),K=Q.columnSpacing??Q.spacing??(F?void 0:R),Y={...v,level:F,columns:J,container:M,direction:C,wrap:E,spacing:W,rowSpacing:ne,columnSpacing:K,size:$,offset:Z},j=a(Y,h);return Ve.jsx(l,{ref:f,as:A,ownerState:Y,className:vt(j.root,g),...q,children:ae.Children.map(b,z=>{var te;return ae.isValidElement(z)&&sm(z,["Grid"])&&M&&z.props.container?ae.cloneElement(z,{unstable_level:((te=z.props)==null?void 0:te.unstable_level)??F+1}):z})})});return kU.NODE_ENV!=="production"&&(T.propTypes={children:S.node,className:S.string,columns:S.oneOfType([S.arrayOf(S.number),S.number,S.object]),columnSpacing:S.oneOfType([S.arrayOf(S.oneOfType([S.number,S.string])),S.number,S.object,S.string]),component:S.elementType,container:S.bool,direction:S.oneOfType([S.oneOf(["column-reverse","column","row-reverse","row"]),S.arrayOf(S.oneOf(["column-reverse","column","row-reverse","row"])),S.object]),offset:S.oneOfType([S.string,S.number,S.arrayOf(S.oneOfType([S.string,S.number])),S.object]),rowSpacing:S.oneOfType([S.arrayOf(S.oneOfType([S.number,S.string])),S.number,S.object,S.string]),size:S.oneOfType([S.string,S.bool,S.number,S.arrayOf(S.oneOfType([S.string,S.bool,S.number])),S.object]),spacing:S.oneOfType([S.arrayOf(S.oneOfType([S.number,S.string])),S.number,S.object,S.string]),sx:S.oneOfType([S.arrayOf(S.oneOfType([S.func,S.object,S.bool])),S.func,S.object]),wrap:S.oneOf(["nowrap","wrap-reverse","wrap"])}),T.muiName="Grid",T}const Xc={black:"#000",white:"#fff"},IU={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},M9={50:"#f3e5f5",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",700:"#7b1fa2"},S9={300:"#e57373",400:"#ef5350",500:"#f44336",700:"#d32f2f",800:"#c62828"},Wc={300:"#ffb74d",400:"#ffa726",500:"#ff9800",700:"#f57c00",900:"#e65100"},_9={50:"#e3f2fd",200:"#90caf9",400:"#42a5f5",700:"#1976d2",800:"#1565c0"},A9={300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",700:"#0288d1",900:"#01579b"},O9={300:"#81c784",400:"#66bb6a",500:"#4caf50",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"};var Tm={};function vS(){return{text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:Xc.white,default:Xc.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}}}const FU=vS();function gS(){return{text:{primary:Xc.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:Xc.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}}}const LS=gS();function xS(e,t,r,s){const o=s.light||s,a=s.dark||s*1.5;e[t]||(e.hasOwnProperty(r)?e[t]=e[r]:t==="light"?e.light=b9(e.main,o):t==="dark"&&(e.dark=x9(e.main,a)))}function zU(e="light"){return e==="dark"?{main:_9[200],light:_9[50],dark:_9[400]}:{main:_9[700],light:_9[400],dark:_9[800]}}function qU(e="light"){return e==="dark"?{main:M9[200],light:M9[50],dark:M9[400]}:{main:M9[500],light:M9[300],dark:M9[700]}}function $U(e="light"){return e==="dark"?{main:S9[500],light:S9[300],dark:S9[700]}:{main:S9[700],light:S9[400],dark:S9[800]}}function UU(e="light"){return e==="dark"?{main:A9[400],light:A9[300],dark:A9[700]}:{main:A9[700],light:A9[500],dark:A9[900]}}function GU(e="light"){return e==="dark"?{main:O9[400],light:O9[300],dark:O9[700]}:{main:O9[800],light:O9[500],dark:O9[900]}}function ZU(e="light"){return e==="dark"?{main:Wc[400],light:Wc[300],dark:Wc[700]}:{main:"#ed6c02",light:Wc[500],dark:Wc[900]}}function cL(e){const{mode:t="light",contrastThreshold:r=3,tonalOffset:s=.2,...o}=e,a=e.primary||zU(t),i=e.secondary||qU(t),l=e.error||$U(t),T=e.info||UU(t),u=e.success||GU(t),Q=e.warning||ZU(t);function f(g){const b=QS(g,LS.text.primary)>=r?LS.text.primary:FU.text.primary;if(Tm.NODE_ENV!=="production"){const L=QS(g,b);L<3&&console.error([`MUI: The contrast ratio of ${L}:1 for ${b} on ${g}`,"falls below the WCAG recommended absolute minimum contrast ratio of 3:1.","https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast"].join(`
|