import{c as N,d as S,r as d,aa as M,ab as H,W as c,ac as I,a as $,ad as k,ae as E,af as T,u as A}from"./index.16929924.js";var j={};(function(n){(function(l,h){if(typeof n.nodeName!="string")h(n);else{var u={};h(u),l.AnsiUp=u.default}})(N,function(l){function h(a){var t=a.raw[0],e=/^\s+|\s+\n|\s+#[\s\S]+?\n/gm,i=t.replace(e,"");return new RegExp(i,"m")}var u=function(){function a(){this.VERSION="3.0.0",this.ansi_colors=[[{rgb:[0,0,0],class_name:"ansi-black"},{rgb:[187,0,0],class_name:"ansi-red"},{rgb:[0,187,0],class_name:"ansi-green"},{rgb:[187,187,0],class_name:"ansi-yellow"},{rgb:[0,0,187],class_name:"ansi-blue"},{rgb:[187,0,187],class_name:"ansi-magenta"},{rgb:[0,187,187],class_name:"ansi-cyan"},{rgb:[255,255,255],class_name:"ansi-white"}],[{rgb:[85,85,85],class_name:"ansi-bright-black"},{rgb:[255,85,85],class_name:"ansi-bright-red"},{rgb:[0,255,0],class_name:"ansi-bright-green"},{rgb:[255,255,85],class_name:"ansi-bright-yellow"},{rgb:[85,85,255],class_name:"ansi-bright-blue"},{rgb:[255,85,255],class_name:"ansi-bright-magenta"},{rgb:[85,255,255],class_name:"ansi-bright-cyan"},{rgb:[255,255,255],class_name:"ansi-bright-white"}]],this.htmlFormatter={transform:function(t,e){var i=t.text;if(i.length===0||(e._escape_for_html&&(i=e.old_escape_for_html(i)),!t.bold&&t.fg===null&&t.bg===null))return i;var s=[],o=[],r=t.fg,f=t.bg;t.bold&&s.push("font-weight:bold"),e._use_classes?(r&&(r.class_name!=="truecolor"?o.push(r.class_name+"-fg"):s.push("color:rgb("+r.rgb.join(",")+")")),f&&(f.class_name!=="truecolor"?o.push(f.class_name+"-bg"):s.push("background-color:rgb("+f.rgb.join(",")+")"))):(r&&s.push("color:rgb("+r.rgb.join(",")+")"),f&&s.push("background-color:rgb("+f.rgb+")"));var g="",p="";return o.length&&(g=' class="'+o.join(" ")+'"'),s.length&&(p=' style="'+s.join(";")+'"'),"<span"+p+g+">"+i+"</span>"},compose:function(t,e){return t.join("")}},this.textFormatter={transform:function(t,e){return t.text},compose:function(t,e){return t.join("")}},this.setup_256_palette(),this._use_classes=!1,this._escape_for_html=!0,this.bold=!1,this.fg=this.bg=null,this._buffer=""}return Object.defineProperty(a.prototype,"use_classes",{get:function(){return this._use_classes},set:function(t){this._use_classes=t},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"escape_for_html",{get:function(){return this._escape_for_html},set:function(t){this._escape_for_html=t},enumerable:!0,configurable:!0}),a.prototype.setup_256_palette=function(){var t=this;this.palette_256=[],this.ansi_colors.forEach(function(m){m.forEach(function(_){t.palette_256.push(_)})});for(var e=[0,95,135,175,215,255],i=0;i<6;++i)for(var s=0;s<6;++s)for(var o=0;o<6;++o){var r={rgb:[e[i],e[s],e[o]],class_name:"truecolor"};this.palette_256.push(r)}for(var f=8,g=0;g<24;++g,f+=10){var p={rgb:[f,f,f],class_name:"truecolor"};this.palette_256.push(p)}},a.prototype.old_escape_for_html=function(t){return t.replace(/[&<>]/gm,function(e){if(e==="&")return"&amp;";if(e==="<")return"&lt;";if(e===">")return"&gt;"})},a.prototype.old_linkify=function(t){return t.replace(/(https?:\/\/[^\s]+)/gm,function(e){return'<a href="'+e+'">'+e+"</a>"})},a.prototype.detect_incomplete_ansi=function(t){return!/.*?[\x40-\x7e]/.test(t)},a.prototype.detect_incomplete_link=function(t){for(var e=!1,i=t.length-1;i>0;i--)if(/\s|\x1B/.test(t[i])){e=!0;break}if(!e)return/(https?:\/\/[^\s]+)/.test(t)?0:-1;var s=t.substr(i+1,4);if(s.length===0)return-1;if("http".indexOf(s)===0)return i+1},a.prototype.ansi_to=function(t,e){var i=this._buffer+t;this._buffer="";var s=i.split(/\x1B\[/);s.length===1&&s.push(""),this.handle_incomplete_sequences(s);for(var o=this.with_state(s.shift()),r=new Array(s.length),f=0,g=s.length;f<g;++f)r[f]=e.transform(this.process_ansi(s[f]),this);return o.text.length>0&&r.unshift(e.transform(o,this)),e.compose(r,this)},a.prototype.ansi_to_html=function(t){return this.ansi_to(t,this.htmlFormatter)},a.prototype.ansi_to_text=function(t){return this.ansi_to(t,this.textFormatter)},a.prototype.with_state=function(t){return{bold:this.bold,fg:this.fg,bg:this.bg,text:t}},a.prototype.handle_incomplete_sequences=function(t){var e=t[t.length-1];e.length>0&&this.detect_incomplete_ansi(e)?(this._buffer="\x1B["+e,t.pop(),t.push("")):(e.slice(-1)==="\x1B"&&(this._buffer="\x1B",console.log("raw",t),t.pop(),t.push(e.substr(0,e.length-1)),console.log(t),console.log(e)),t.length===2&&t[1]===""&&t[0].slice(-1)==="\x1B"&&(this._buffer="\x1B",e=t.shift(),t.unshift(e.substr(0,e.length-1))))},a.prototype.process_ansi=function(t){this._sgr_regex||(this._sgr_regex=(w=[`
            ^                           # beginning of line
            ([!<-?]?)             # a private-mode char (!, <, =, >, ?)
            ([d;]*)                    # any digits or semicolons
            ([ -/]?               # an intermediate modifier
            [@-~])                # the command
            ([sS]*)                   # any text following this CSI sequence
          `],w.raw=[`
            ^                           # beginning of line
            ([!\\x3c-\\x3f]?)             # a private-mode char (!, <, =, >, ?)
            ([\\d;]*)                    # any digits or semicolons
            ([\\x20-\\x2f]?               # an intermediate modifier
            [\\x40-\\x7e])                # the command
            ([\\s\\S]*)                   # any text following this CSI sequence
          `],h(w)));var e=t.match(this._sgr_regex);if(!e)return this.with_state(t);var i=e[4];if(e[1]!==""||e[3]!=="m")return this.with_state(i);for(var s=e[2].split(";");s.length>0;){var o=s.shift(),r=parseInt(o,10);if(isNaN(r)||r===0)this.fg=this.bg=null,this.bold=!1;else if(r===1)this.bold=!0;else if(r===22)this.bold=!1;else if(r===39)this.fg=null;else if(r===49)this.bg=null;else if(r>=30&&r<38)this.fg=this.ansi_colors[0][r-30];else if(r>=40&&r<48)this.bg=this.ansi_colors[0][r-40];else if(r>=90&&r<98)this.fg=this.ansi_colors[1][r-90];else if(r>=100&&r<108)this.bg=this.ansi_colors[1][r-100];else if((r===38||r===48)&&s.length>0){var f=r===38,g=s.shift();if(g==="5"&&s.length>0){var p=parseInt(s.shift(),10);p>=0&&p<=255&&(f?this.fg=this.palette_256[p]:this.bg=this.palette_256[p])}if(g==="2"&&s.length>2){var m=parseInt(s.shift(),10),_=parseInt(s.shift(),10),y=parseInt(s.shift(),10);if(m>=0&&m<=255&&_>=0&&_<=255&&y>=0&&y<=255){var x={rgb:[m,_,y],class_name:"truecolor"};f?this.fg=x:this.bg=x}}}}return this.with_state(i);var w},a}();Object.defineProperty(l,"__esModule",{value:!0}),l.default=u})})(j);const L=S(j);function b(n){return typeof n=="string"?[n]:n}function O(n){return["image/png","image/jpeg","image/gif","image/bmp"].find(l=>n.data[l])}function v(n){return Array.isArray(n)?n.join(""):n}function P(n,l,h){return c.createElement("img",{key:h,alt:n.data["text/plain"]||h,src:`data:${l};base64,`+n.data[l]})}const B=(n,l)=>`<html>
  <head>
    <link rel="stylesheet" type="text/css" href="/normalize.css" />
    <script>
    let height;
    const sendPostMessage = () => {
      if (height !== document.body.offsetHeight) {
        height = document.body.offsetHeight;
        window.parent.postMessage({frameHeight: height, id: "${l}"}, '*');
      }
    }
    window.onload = () => sendPostMessage();
    window.onresize = () => sendPostMessage();
    <\/script>
  </head>${n}</html>`;function C(n,l,h){if(n.cell_type!=="code")return[];const u=new L;if(n.outputs==null)return console.warn("Empty cell",n),[];let a="";const t=[];if(n.outputs.forEach((e,i)=>{const s=`${l}-output-${i}`;if(e.output_type==="stream"?t.push(c.createElement("div",{className:`${e.name} stream`,key:s,dangerouslySetInnerHTML:{__html:u.ansi_to_html(b(e.text).filter(r=>!r.startsWith("wandb:")).join(""))}})):e.output_type==="error"&&t.push(c.createElement("div",{className:"error",key:s,dangerouslySetInnerHTML:{__html:u.ansi_to_html(e.traceback.join(`
`))}})),e.output_type!=="display_data"&&e.output_type!=="execute_result"){console.warn("Skipping rendering of ",e.output_type);return}const o=O(e);if(e.data["text/html"]){const r=v(e.data["text/html"]);if(r.includes("<iframe")){console.warn("Not rendering nested iframe");return}a+=r}else o?t.push(P(e,o,s)):e.data["text/markdown"]?t.push(c.createElement("div",{className:"markdown",key:s,dangerouslySetInnerHTML:{__html:E(v(e.data["text/markdown"]))?.value||""}})):e.data["text/json"]?t.push(c.createElement("div",{className:"json",key:s},v(e.data["text/json"]))):e.data["text/plain"]&&t.push(c.createElement("div",{className:"text",key:s},v(e.data["text/plain"])))}),a!==""){const e=`${l}-iframe`;t.unshift(c.createElement("iframe",{ref:h,id:e,title:e,className:"html",sandbox:"allow-scripts allow-popups allow-downloads",key:e,style:{border:"none",width:"100%"},srcDoc:B(a,e)}))}return t}const R=({cell:n,id:l,runCode:h,saveCode:u,readonly:a})=>{const t=I("JupyterViewer"),e=d.exports.useRef(null);d.exports.useEffect(()=>{const s=o=>{if(e.current&&o.data.hasOwnProperty("frameHeight")&&o.data.id===e.current.id){const r=Math.min(500,o.data.frameHeight);e.current.style.height=r+"px"}};if(e.current)return window.addEventListener("message",s),()=>{window.removeEventListener("message",s)}},[e]);const i=d.exports.useMemo(()=>C(n,l,e),[n,l,e]);return c.createElement("div",{className:$({cell:!0,readonly:a})},n.cell_type==="code"&&c.createElement("div",{className:"input"},c.createElement("div",{className:"gutter"},c.createElement("span",null,`[${n.execution_count}]: `)),c.createElement("div",{className:"source"},c.createElement(k,{value:b(n.source).join(""),height:b(n.source).length*24,options:{readOnly:a,hideCursorInOverviewRuler:!0,renderLineHighlight:"none",lineNumbers:"off",contextmenu:!a,occurrencesHighlight:!1,folding:!1,fontSize:16,lineDecorationsWidth:0,scrollbar:{vertical:"hidden",handleMouseWheel:!1,useShadows:!1}},theme:"wandb",onChange:s=>u&&u(s||""),onMount:(s,o)=>{o.editor.defineTheme("wandb",{base:"vs",inherit:!0,rules:[],colors:{"editor.foreground":"#000000","editor.background":"#f5f5f5"}}),s.addCommand(o.KeyMod.Shift|o.KeyCode.Enter,r=>h&&h(b(n.source).join("")))},language:"python"}))),n.cell_type==="markdown"?c.createElement("div",{className:"output",dangerouslySetInnerHTML:{__html:E(b(n.source).join(""),{allowScopedStyles:t?.allowScopedStyles??!1}).toString()}}):c.createElement("div",{className:"output"},i))},F=({raw:n})=>{const l=d.exports.useRef(M());d.exports.useEffect(()=>{H.exports.highlightAll()});const h=d.exports.useMemo(()=>{try{const u=JSON.parse(n);return u.cells.forEach(a=>{typeof a.source=="string"&&(a.source=a.source.split(`
`).map(t=>t+`
`),a.source[a.source.length-1]=a.source[a.source.length-1].trim())}),u}catch{return null}},[n]);return h==null?c.createElement("div",null,"Error"):c.createElement("div",{className:"notebook",style:{position:"relative"}},h.cells.map((u,a)=>c.createElement(R,{readonly:!0,cell:u,id:`${l.current}-cell-${a}`,key:`${l.current}-cell-${a}`})))},U=n=>{const l=T({file:n.input}),h=A(l);if(h.loading)return c.createElement("div",null);const u=h.result;if(u==null)throw new Error("PanelJupyter: content is null");return c.createElement("div",{style:{width:"100%",height:"100%",flex:"1 1 auto",overflow:"auto"}},c.createElement(F,{raw:u}))};export{U as default};
//# sourceMappingURL=Component.05eef7ed.js.map
