pdit 0.5.0__py3-none-any.whl → 0.6.0__py3-none-any.whl
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.
- pdit/_static/assets/{index-1w8kifoA.js → index-DbESVfT-.js} +1 -1
- pdit/_static/export.html +1 -1
- pdit/_static/index.html +1 -1
- pdit/ipython_executor.py +26 -6
- {pdit-0.5.0.dist-info → pdit-0.6.0.dist-info}/METADATA +1 -1
- pdit-0.6.0.dist-info/RECORD +17 -0
- pdit-0.5.0.dist-info/RECORD +0 -17
- {pdit-0.5.0.dist-info → pdit-0.6.0.dist-info}/WHEEL +0 -0
- {pdit-0.5.0.dist-info → pdit-0.6.0.dist-info}/entry_points.txt +0 -0
- {pdit-0.5.0.dist-info → pdit-0.6.0.dist-info}/licenses/LICENSE +0 -0
- {pdit-0.5.0.dist-info → pdit-0.6.0.dist-info}/top_level.txt +0 -0
|
@@ -80,7 +80,7 @@ Error generating stack: `+n.message+`
|
|
|
80
80
|
`});++i<t.length;)i&&n.push({type:"text",value:`
|
|
81
81
|
`}),n.push(t[i]);return e&&t.length>0&&n.push({type:"text",value:`
|
|
82
82
|
`}),n}function Fb(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function Yb(t,e){const n=g_(t,e),i=n.one(t,void 0),r=l_(n),l=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return r&&l.children.push({type:"text",value:`
|
|
83
|
-
`},r),l}function x_(t,e){return t&&"run"in t?async function(n,i){const r=Yb(n,{file:i,...e});await t.run(r,i)}:function(n,i){return Yb(n,{file:i,...t||e})}}function Zb(t){if(t)throw t}var cc=Object.prototype.hasOwnProperty,s2=Object.prototype.toString,Kb=Object.defineProperty,Jb=Object.getOwnPropertyDescriptor,eS=function(e){return typeof Array.isArray=="function"?Array.isArray(e):s2.call(e)==="[object Array]"},tS=function(e){if(!e||s2.call(e)!=="[object Object]")return!1;var n=cc.call(e,"constructor"),i=e.constructor&&e.constructor.prototype&&cc.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!i)return!1;var r;for(r in e);return typeof r>"u"||cc.call(e,r)},nS=function(e,n){Kb&&n.name==="__proto__"?Kb(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},iS=function(e,n){if(n==="__proto__")if(cc.call(e,n)){if(Jb)return Jb(e,n).value}else return;return e[n]},v_=function t(){var e,n,i,r,l,s,o=arguments[0],a=1,u=arguments.length,c=!1;for(typeof o=="boolean"&&(c=o,o=arguments[1]||{},a=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});a<u;++a)if(e=arguments[a],e!=null)for(n in e)i=iS(o,n),r=iS(e,n),o!==r&&(c&&r&&(tS(r)||(l=eS(r)))?(l?(l=!1,s=i&&eS(i)?i:[]):s=i&&tS(i)?i:{},nS(o,{name:n,newValue:t(c,s,r)})):typeof r<"u"&&nS(o,{name:n,newValue:r}));return o};const Rd=jm(v_);function _m(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function w_(){const t=[],e={run:n,use:i};return e;function n(...r){let l=-1;const s=r.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...r);function o(a,...u){const c=t[++l];let f=-1;if(a){s(a);return}for(;++f<r.length;)(u[f]===null||u[f]===void 0)&&(u[f]=r[f]);r=u,c?k_(c,o)(...u):s(null,...u)}}function i(r){if(typeof r!="function")throw new TypeError("Expected `middelware` to be a function, not "+r);return t.push(r),e}}function k_(t,e){let n;return i;function i(...s){const o=t.length>s.length;let a;o&&s.push(r);try{a=t.apply(this,s)}catch(u){const c=u;if(o&&n)throw c;return r(c)}o||(a&&a.then&&typeof a.then=="function"?a.then(l,r):a instanceof Error?r(a):l(a))}function r(s,...o){n||(n=!0,e(s,...o))}function l(s){r(null,s)}}const jn={basename:T_,dirname:C_,extname:A_,join:E_,sep:"/"};function T_(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Ha(t);let n=0,i=-1,r=t.length,l;if(e===void 0||e.length===0||e.length>t.length){for(;r--;)if(t.codePointAt(r)===47){if(l){n=r+1;break}}else i<0&&(l=!0,i=r+1);return i<0?"":t.slice(n,i)}if(e===t)return"";let s=-1,o=e.length-1;for(;r--;)if(t.codePointAt(r)===47){if(l){n=r+1;break}}else s<0&&(l=!0,s=r+1),o>-1&&(t.codePointAt(r)===e.codePointAt(o--)?o<0&&(i=r):(o=-1,i=s));return n===i?i=s:i<0&&(i=t.length),t.slice(n,i)}function C_(t){if(Ha(t),t.length===0)return".";let e=-1,n=t.length,i;for(;--n;)if(t.codePointAt(n)===47){if(i){e=n;break}}else i||(i=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function A_(t){Ha(t);let e=t.length,n=-1,i=0,r=-1,l=0,s;for(;e--;){const o=t.codePointAt(e);if(o===47){if(s){i=e+1;break}continue}n<0&&(s=!0,n=e+1),o===46?r<0?r=e:l!==1&&(l=1):r>-1&&(l=-1)}return r<0||n<0||l===0||l===1&&r===n-1&&r===i+1?"":t.slice(r,n)}function E_(...t){let e=-1,n;for(;++e<t.length;)Ha(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":M_(n)}function M_(t){Ha(t);const e=t.codePointAt(0)===47;let n=R_(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function R_(t,e){let n="",i=0,r=-1,l=0,s=-1,o,a;for(;++s<=t.length;){if(s<t.length)o=t.codePointAt(s);else{if(o===47)break;o=47}if(o===47){if(!(r===s-1||l===1))if(r!==s-1&&l===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(a=n.lastIndexOf("/"),a!==n.length-1){a<0?(n="",i=0):(n=n.slice(0,a),i=n.length-1-n.lastIndexOf("/")),r=s,l=0;continue}}else if(n.length>0){n="",i=0,r=s,l=0;continue}}e&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+t.slice(r+1,s):n=t.slice(r+1,s),i=s-r-1;r=s,l=0}else o===46&&l>-1?l++:l=-1}return n}function Ha(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const D_={cwd:Q_};function Q_(){return"/"}function Um(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function z_(t){if(typeof t=="string")t=new URL(t);else if(!Um(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return N_(t)}function N_(t){if(t.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const i=e.codePointAt(n+2);if(i===70||i===102){const r=new TypeError("File URL path must not include encoded / characters");throw r.code="ERR_INVALID_FILE_URL_PATH",r}}return decodeURIComponent(e)}const Dd=["history","path","basename","stem","extname","dirname"];class o2{constructor(e){let n;e?Um(e)?n={path:e}:typeof e=="string"||L_(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":D_.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Dd.length;){const l=Dd[i];l in n&&n[l]!==void 0&&n[l]!==null&&(this[l]=l==="history"?[...n[l]]:n[l])}let r;for(r in n)Dd.includes(r)||(this[r]=n[r])}get basename(){return typeof this.path=="string"?jn.basename(this.path):void 0}set basename(e){zd(e,"basename"),Qd(e,"basename"),this.path=jn.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?jn.dirname(this.path):void 0}set dirname(e){rS(this.basename,"dirname"),this.path=jn.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?jn.extname(this.path):void 0}set extname(e){if(Qd(e,"extname"),rS(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=jn.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Um(e)&&(e=z_(e)),zd(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?jn.basename(this.path,this.extname):void 0}set stem(e){zd(e,"stem"),Qd(e,"stem"),this.path=jn.join(this.dirname||"",e+(this.extname||""))}fail(e,n,i){const r=this.message(e,n,i);throw r.fatal=!0,r}info(e,n,i){const r=this.message(e,n,i);return r.fatal=void 0,r}message(e,n,i){const r=new Tt(e,n,i);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Qd(t,e){if(t&&t.includes(jn.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+jn.sep+"`")}function zd(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function rS(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function L_(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const B_=function(t){const i=this.constructor.prototype,r=i[t],l=function(){return r.apply(l,arguments)};return Object.setPrototypeOf(l,i),l},P_={}.hasOwnProperty;class X0 extends B_{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=w_()}copy(){const e=new X0;let n=-1;for(;++n<this.attachers.length;){const i=this.attachers[n];e.use(...i)}return e.data(Rd(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(Bd("data",this.frozen),this.namespace[e]=n,this):P_.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Bd("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const r=n.call(e,...i);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=Lu(e),i=this.parser||this.Parser;return Nd("parse",i),i(String(n),n)}process(e,n){const i=this;return this.freeze(),Nd("process",this.parser||this.Parser),Ld("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(l,s){const o=Lu(e),a=i.parse(o);i.run(a,o,function(c,f,h){if(c||!f||!h)return u(c);const d=f,p=i.stringify(d,h);U_(p)?h.value=p:h.result=p,u(c,h)});function u(c,f){c||!f?s(c):l?l(f):n(void 0,f)}}}processSync(e){let n=!1,i;return this.freeze(),Nd("processSync",this.parser||this.Parser),Ld("processSync",this.compiler||this.Compiler),this.process(e,r),sS("processSync","process",n),i;function r(l,s){n=!0,Zb(l),i=s}}run(e,n,i){lS(e),this.freeze();const r=this.transformers;return!i&&typeof n=="function"&&(i=n,n=void 0),i?l(void 0,i):new Promise(l);function l(s,o){const a=Lu(n);r.run(e,a,u);function u(c,f,h){const d=f||e;c?o(c):s?s(d):i(void 0,d,h)}}}runSync(e,n){let i=!1,r;return this.run(e,n,l),sS("runSync","run",i),r;function l(s,o){Zb(s),r=o,i=!0}}stringify(e,n){this.freeze();const i=Lu(n),r=this.compiler||this.Compiler;return Ld("stringify",r),lS(e),r(e,i)}use(e,...n){const i=this.attachers,r=this.namespace;if(Bd("use",this.frozen),e!=null)if(typeof e=="function")a(e,n);else if(typeof e=="object")Array.isArray(e)?o(e):s(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function l(u){if(typeof u=="function")a(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...f]=u;a(c,f)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(r.settings=Rd(!0,r.settings,u.settings))}function o(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const f=u[c];l(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function a(u,c){let f=-1,h=-1;for(;++f<i.length;)if(i[f][0]===u){h=f;break}if(h===-1)i.push([u,...c]);else if(c.length>0){let[d,...p]=c;const g=i[h][1];_m(g)&&_m(d)&&(d=Rd(!0,g,d)),i[h]=[u,d,...p]}}}}const q_=new X0().freeze();function Nd(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Ld(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Bd(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function lS(t){if(!_m(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function sS(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Lu(t){return __(t)?t:new o2(t)}function __(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function U_(t){return typeof t=="string"||H_(t)}function H_(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const V_="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",oS=[],aS={allowDangerousHtml:!0},j_=/^(https?|ircs?|mailto|xmpp)$/i,$_=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function X_(t){const e=G_(t),n=I_(t);return W_(e.runSync(e.parse(n),n),t)}function G_(t){const e=t.rehypePlugins||oS,n=t.remarkPlugins||oS,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...aS}:aS;return q_().use(Cq).use(n).use(x_,i).use(e)}function I_(t){const e=t.children||"",n=new o2;return typeof e=="string"&&(n.value=e),n}function W_(t,e){const n=e.allowedElements,i=e.allowElement,r=e.components,l=e.disallowedElements,s=e.skipHtml,o=e.unwrapDisallowed,a=e.urlTransform||F_;for(const c of $_)Object.hasOwn(e,c.from)&&(""+c.from+(c.to?"use `"+c.to+"` instead":"remove it")+V_+c.id,void 0);return l2(t,u),lB(t,{Fragment:P.Fragment,components:r,ignoreInvalidStyle:!0,jsx:P.jsx,jsxs:P.jsxs,passKeys:!0,passNode:!0});function u(c,f,h){if(c.type==="raw"&&h&&typeof f=="number")return s?h.children.splice(f,1):h.children[f]={type:"text",value:c.value},f;if(c.type==="element"){let d;for(d in Ad)if(Object.hasOwn(Ad,d)&&Object.hasOwn(c.properties,d)){const p=c.properties[d],g=Ad[d];(g===null||g.includes(c.tagName))&&(c.properties[d]=a(String(p||""),d,c))}}if(c.type==="element"){let d=n?!n.includes(c.tagName):l?l.includes(c.tagName):!1;if(!d&&i&&typeof f=="number"&&(d=!i(c,f,h)),d&&h&&typeof f=="number")return o&&c.children?h.children.splice(f,1,...c.children):h.children.splice(f,1),f}}}function F_(t){const e=t.indexOf(":"),n=t.indexOf("?"),i=t.indexOf("#"),r=t.indexOf("/");return e===-1||r!==-1&&e>r||n!==-1&&e>n||i!==-1&&e>i||j_.test(t.slice(0,e))?t:""}const Y_=({content:t,mimeType:e})=>{const n=`data:${e};base64,${t}`;return P.jsx("img",{src:n,className:"output-image",alt:"Plot output"})},Z_=({html:t})=>{const e=K0.useRef(null);return K0.useEffect(()=>{if(!e.current)return;e.current.innerHTML=t,e.current.querySelectorAll("script").forEach(i=>{var l;const r=document.createElement("script");Array.from(i.attributes).forEach(s=>{r.setAttribute(s.name,s.value)}),r.textContent=i.textContent,(l=i.parentNode)==null||l.replaceChild(r,i)})},[t]),P.jsx("div",{ref:e,className:"output-html"})},K_=t=>t.replace(/\//g,"-"),J_=({expression:t,ref:e,allInvisible:n})=>{var l;const i=E.useRef(null);E.useImperativeHandle(e,()=>i.current,[]);const r=n?"output-container output-container-invisible":"output-container";return P.jsx("div",{ref:i,className:r,children:P.jsx("div",{className:"output-line",children:(l=t.result)==null?void 0:l.output.map((s,o)=>P.jsx("div",{className:`output-item output-${K_(s.type)}`,children:P.jsx("div",{className:"output-content-wrapper",children:s.type==="text/markdown"?P.jsx(X_,{children:s.content}):s.type.startsWith("image/")?P.jsx(Y_,{content:s.content,mimeType:s.type}):s.type==="text/html"?P.jsx(Z_,{html:s.content}):P.jsx("pre",{children:s.content})})},o))})})},e6=({onLineGroupHeightChange:t,expressions:e,lineGroups:n,lineGroupLayouts:i,lineGroupHeights:r,readerMode:l})=>{const s=E.useRef(null),o=E.useRef(new Map),a=E.useMemo(()=>{if(l||!i||!r||n.length===0)return;const c=n[n.length-1],f=i.get(c.id),h=r.get(c.id);return f&&h!==void 0?f.top+h:void 0},[l,n,i,r]),u=E.useCallback(()=>{const c=new Map;for(const[f,h]of o.current.entries())h&&c.set(f,Math.max(0,h.getBoundingClientRect().height));return c},[]);return E.useEffect(()=>{if(!s.current||!t)return;const c=setTimeout(()=>{t(u())},0),f=new MutationObserver(()=>{t(u())}),h=new ResizeObserver(()=>{t(u())});return s.current&&(f.observe(s.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"]}),h.observe(s.current)),()=>{clearTimeout(c),f.disconnect(),h.disconnect()}},[t,u,n]),P.jsx("div",{id:"output",ref:s,children:P.jsx("div",{className:`output-content ${l?"reader-mode":""}`,style:a?{minHeight:`${a}px`}:void 0,children:n.map(c=>{if(!c.resultIds.some(g=>{const b=e.find(m=>m.id===g);return(b==null?void 0:b.result)&&b.result.output.length>0}))return null;const h=i==null?void 0:i.get(c.id),d=["output-group",c.allInvisible?"output-group-invisible":"",c.hasError?"output-group-error":""].filter(Boolean).join(" "),p={};return h&&!l&&(p.position="absolute",p.top=h.top,p.left=8,p.right=8,p.minHeight=`${h.naturalHeight}px`),P.jsx("div",{className:d,ref:g=>{g?o.current.set(c.id,g):o.current.delete(c.id)},style:Object.keys(p).length>0?p:void 0,children:c.resultIds.map(g=>{const b=e.findIndex(O=>O.id===g);if(b===-1)return null;const m=e[b];return P.jsx(J_,{expression:m,index:b,allInvisible:c.allInvisible},m.id)})},c.id)})})})};let uS=1;class t6{constructor(){hi(this,"wsClient",null)}setWebSocketClient(e){this.wsClient=e}async*executeScript(e,n){if(!this.wsClient)throw new Error("WebSocket client not set");if(!this.wsClient.isConnected)throw new Error("WebSocket not connected");const i=[];let r=0;try{for await(const l of this.wsClient.executeStream({script:e,lineRange:n.lineRange,scriptName:n.scriptName,reset:n.reset})){if(l.type==="expressions"){const s=l.expressions.map(o=>({id:uS++,lineStart:o.lineStart,lineEnd:o.lineEnd,state:"pending"}));i.push(...s),yield{type:"expressions",expressions:s};continue}if(l.type==="cancelled"){yield{type:"cancelled",expressions:l.expressions.map(o=>({lineStart:o.lineStart,lineEnd:o.lineEnd}))};continue}if(l.type==="result"){const s=i[r++];yield{type:"done",expression:{id:(s==null?void 0:s.id)??uS++,lineStart:l.lineStart,lineEnd:l.lineEnd,state:"done",result:{output:l.output,isInvisible:l.isInvisible}}}}}}catch(l){throw l instanceof Error?l:new Error(String(l))}}async reset(){var e;(e=this.wsClient)!=null&&e.isConnected&&this.wsClient.send({type:"reset"})}interrupt(){var e;(e=this.wsClient)!=null&&e.isConnected&&this.wsClient.send({type:"interrupt"})}isAvailable(){var e;return((e=this.wsClient)==null?void 0:e.isConnected)??!1}}const Hm=new t6;async function*n6(t,e){yield*Hm.executeScript(t,e)}class i6{diff(e,n,i={}){let r;typeof i=="function"?(r=i,i={}):"callback"in i&&(r=i.callback);const l=this.castInput(e,i),s=this.castInput(n,i),o=this.removeEmpty(this.tokenize(l,i)),a=this.removeEmpty(this.tokenize(s,i));return this.diffWithOptionsObj(o,a,i,r)}diffWithOptionsObj(e,n,i,r){var l;const s=O=>{if(O=this.postProcess(O,i),r){setTimeout(function(){r(O)},0);return}else return O},o=n.length,a=e.length;let u=1,c=o+a;i.maxEditLength!=null&&(c=Math.min(c,i.maxEditLength));const f=(l=i.timeout)!==null&&l!==void 0?l:1/0,h=Date.now()+f,d=[{oldPos:-1,lastComponent:void 0}];let p=this.extractCommon(d[0],n,e,0,i);if(d[0].oldPos+1>=a&&p+1>=o)return s(this.buildValues(d[0].lastComponent,n,e));let g=-1/0,b=1/0;const m=()=>{for(let O=Math.max(g,-u);O<=Math.min(b,u);O+=2){let y;const x=d[O-1],w=d[O+1];x&&(d[O-1]=void 0);let S=!1;if(w){const A=w.oldPos-O;S=w&&0<=A&&A<o}const k=x&&x.oldPos+1<a;if(!S&&!k){d[O]=void 0;continue}if(!k||S&&x.oldPos<w.oldPos?y=this.addToPath(w,!0,!1,0,i):y=this.addToPath(x,!1,!0,1,i),p=this.extractCommon(y,n,e,O,i),y.oldPos+1>=a&&p+1>=o)return s(this.buildValues(y.lastComponent,n,e))||!0;d[O]=y,y.oldPos+1>=a&&(b=Math.min(b,O-1)),p+1>=o&&(g=Math.max(g,O+1))}u++};if(r)(function O(){setTimeout(function(){if(u>c||Date.now()>h)return r(void 0);m()||O()},0)})();else for(;u<=c&&Date.now()<=h;){const O=m();if(O)return O}}addToPath(e,n,i,r,l){const s=e.lastComponent;return s&&!l.oneChangePerToken&&s.added===n&&s.removed===i?{oldPos:e.oldPos+r,lastComponent:{count:s.count+1,added:n,removed:i,previousComponent:s.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:n,removed:i,previousComponent:s}}}extractCommon(e,n,i,r,l){const s=n.length,o=i.length;let a=e.oldPos,u=a-r,c=0;for(;u+1<s&&a+1<o&&this.equals(i[a+1],n[u+1],l);)u++,a++,c++,l.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return c&&!l.oneChangePerToken&&(e.lastComponent={count:c,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=a,u}equals(e,n,i){return i.comparator?i.comparator(e,n):e===n||!!i.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let i=0;i<e.length;i++)e[i]&&n.push(e[i]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,i){const r=[];let l;for(;e;)r.push(e),l=e.previousComponent,delete e.previousComponent,e=l;r.reverse();const s=r.length;let o=0,a=0,u=0;for(;o<s;o++){const c=r[o];if(c.removed)c.value=this.join(i.slice(u,u+c.count)),u+=c.count;else{if(!c.added&&this.useLongestToken){let f=n.slice(a,a+c.count);f=f.map(function(h,d){const p=i[u+d];return p.length>h.length?p:h}),c.value=this.join(f)}else c.value=this.join(n.slice(a,a+c.count));a+=c.count,c.added||(u+=c.count)}}return r}}class r6 extends i6{constructor(){super(...arguments),this.tokenize=o6}equals(e,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!e.includes(`
|
|
83
|
+
`},r),l}function x_(t,e){return t&&"run"in t?async function(n,i){const r=Yb(n,{file:i,...e});await t.run(r,i)}:function(n,i){return Yb(n,{file:i,...t||e})}}function Zb(t){if(t)throw t}var cc=Object.prototype.hasOwnProperty,s2=Object.prototype.toString,Kb=Object.defineProperty,Jb=Object.getOwnPropertyDescriptor,eS=function(e){return typeof Array.isArray=="function"?Array.isArray(e):s2.call(e)==="[object Array]"},tS=function(e){if(!e||s2.call(e)!=="[object Object]")return!1;var n=cc.call(e,"constructor"),i=e.constructor&&e.constructor.prototype&&cc.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!i)return!1;var r;for(r in e);return typeof r>"u"||cc.call(e,r)},nS=function(e,n){Kb&&n.name==="__proto__"?Kb(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},iS=function(e,n){if(n==="__proto__")if(cc.call(e,n)){if(Jb)return Jb(e,n).value}else return;return e[n]},v_=function t(){var e,n,i,r,l,s,o=arguments[0],a=1,u=arguments.length,c=!1;for(typeof o=="boolean"&&(c=o,o=arguments[1]||{},a=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});a<u;++a)if(e=arguments[a],e!=null)for(n in e)i=iS(o,n),r=iS(e,n),o!==r&&(c&&r&&(tS(r)||(l=eS(r)))?(l?(l=!1,s=i&&eS(i)?i:[]):s=i&&tS(i)?i:{},nS(o,{name:n,newValue:t(c,s,r)})):typeof r<"u"&&nS(o,{name:n,newValue:r}));return o};const Rd=jm(v_);function _m(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function w_(){const t=[],e={run:n,use:i};return e;function n(...r){let l=-1;const s=r.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...r);function o(a,...u){const c=t[++l];let f=-1;if(a){s(a);return}for(;++f<r.length;)(u[f]===null||u[f]===void 0)&&(u[f]=r[f]);r=u,c?k_(c,o)(...u):s(null,...u)}}function i(r){if(typeof r!="function")throw new TypeError("Expected `middelware` to be a function, not "+r);return t.push(r),e}}function k_(t,e){let n;return i;function i(...s){const o=t.length>s.length;let a;o&&s.push(r);try{a=t.apply(this,s)}catch(u){const c=u;if(o&&n)throw c;return r(c)}o||(a&&a.then&&typeof a.then=="function"?a.then(l,r):a instanceof Error?r(a):l(a))}function r(s,...o){n||(n=!0,e(s,...o))}function l(s){r(null,s)}}const jn={basename:T_,dirname:C_,extname:A_,join:E_,sep:"/"};function T_(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Ha(t);let n=0,i=-1,r=t.length,l;if(e===void 0||e.length===0||e.length>t.length){for(;r--;)if(t.codePointAt(r)===47){if(l){n=r+1;break}}else i<0&&(l=!0,i=r+1);return i<0?"":t.slice(n,i)}if(e===t)return"";let s=-1,o=e.length-1;for(;r--;)if(t.codePointAt(r)===47){if(l){n=r+1;break}}else s<0&&(l=!0,s=r+1),o>-1&&(t.codePointAt(r)===e.codePointAt(o--)?o<0&&(i=r):(o=-1,i=s));return n===i?i=s:i<0&&(i=t.length),t.slice(n,i)}function C_(t){if(Ha(t),t.length===0)return".";let e=-1,n=t.length,i;for(;--n;)if(t.codePointAt(n)===47){if(i){e=n;break}}else i||(i=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function A_(t){Ha(t);let e=t.length,n=-1,i=0,r=-1,l=0,s;for(;e--;){const o=t.codePointAt(e);if(o===47){if(s){i=e+1;break}continue}n<0&&(s=!0,n=e+1),o===46?r<0?r=e:l!==1&&(l=1):r>-1&&(l=-1)}return r<0||n<0||l===0||l===1&&r===n-1&&r===i+1?"":t.slice(r,n)}function E_(...t){let e=-1,n;for(;++e<t.length;)Ha(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":M_(n)}function M_(t){Ha(t);const e=t.codePointAt(0)===47;let n=R_(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function R_(t,e){let n="",i=0,r=-1,l=0,s=-1,o,a;for(;++s<=t.length;){if(s<t.length)o=t.codePointAt(s);else{if(o===47)break;o=47}if(o===47){if(!(r===s-1||l===1))if(r!==s-1&&l===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(a=n.lastIndexOf("/"),a!==n.length-1){a<0?(n="",i=0):(n=n.slice(0,a),i=n.length-1-n.lastIndexOf("/")),r=s,l=0;continue}}else if(n.length>0){n="",i=0,r=s,l=0;continue}}e&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+t.slice(r+1,s):n=t.slice(r+1,s),i=s-r-1;r=s,l=0}else o===46&&l>-1?l++:l=-1}return n}function Ha(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const D_={cwd:Q_};function Q_(){return"/"}function Um(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function z_(t){if(typeof t=="string")t=new URL(t);else if(!Um(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return N_(t)}function N_(t){if(t.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const i=e.codePointAt(n+2);if(i===70||i===102){const r=new TypeError("File URL path must not include encoded / characters");throw r.code="ERR_INVALID_FILE_URL_PATH",r}}return decodeURIComponent(e)}const Dd=["history","path","basename","stem","extname","dirname"];class o2{constructor(e){let n;e?Um(e)?n={path:e}:typeof e=="string"||L_(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":D_.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Dd.length;){const l=Dd[i];l in n&&n[l]!==void 0&&n[l]!==null&&(this[l]=l==="history"?[...n[l]]:n[l])}let r;for(r in n)Dd.includes(r)||(this[r]=n[r])}get basename(){return typeof this.path=="string"?jn.basename(this.path):void 0}set basename(e){zd(e,"basename"),Qd(e,"basename"),this.path=jn.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?jn.dirname(this.path):void 0}set dirname(e){rS(this.basename,"dirname"),this.path=jn.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?jn.extname(this.path):void 0}set extname(e){if(Qd(e,"extname"),rS(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=jn.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Um(e)&&(e=z_(e)),zd(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?jn.basename(this.path,this.extname):void 0}set stem(e){zd(e,"stem"),Qd(e,"stem"),this.path=jn.join(this.dirname||"",e+(this.extname||""))}fail(e,n,i){const r=this.message(e,n,i);throw r.fatal=!0,r}info(e,n,i){const r=this.message(e,n,i);return r.fatal=void 0,r}message(e,n,i){const r=new Tt(e,n,i);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Qd(t,e){if(t&&t.includes(jn.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+jn.sep+"`")}function zd(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function rS(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function L_(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const B_=function(t){const i=this.constructor.prototype,r=i[t],l=function(){return r.apply(l,arguments)};return Object.setPrototypeOf(l,i),l},P_={}.hasOwnProperty;class X0 extends B_{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=w_()}copy(){const e=new X0;let n=-1;for(;++n<this.attachers.length;){const i=this.attachers[n];e.use(...i)}return e.data(Rd(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(Bd("data",this.frozen),this.namespace[e]=n,this):P_.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Bd("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const r=n.call(e,...i);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=Lu(e),i=this.parser||this.Parser;return Nd("parse",i),i(String(n),n)}process(e,n){const i=this;return this.freeze(),Nd("process",this.parser||this.Parser),Ld("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(l,s){const o=Lu(e),a=i.parse(o);i.run(a,o,function(c,f,h){if(c||!f||!h)return u(c);const d=f,p=i.stringify(d,h);U_(p)?h.value=p:h.result=p,u(c,h)});function u(c,f){c||!f?s(c):l?l(f):n(void 0,f)}}}processSync(e){let n=!1,i;return this.freeze(),Nd("processSync",this.parser||this.Parser),Ld("processSync",this.compiler||this.Compiler),this.process(e,r),sS("processSync","process",n),i;function r(l,s){n=!0,Zb(l),i=s}}run(e,n,i){lS(e),this.freeze();const r=this.transformers;return!i&&typeof n=="function"&&(i=n,n=void 0),i?l(void 0,i):new Promise(l);function l(s,o){const a=Lu(n);r.run(e,a,u);function u(c,f,h){const d=f||e;c?o(c):s?s(d):i(void 0,d,h)}}}runSync(e,n){let i=!1,r;return this.run(e,n,l),sS("runSync","run",i),r;function l(s,o){Zb(s),r=o,i=!0}}stringify(e,n){this.freeze();const i=Lu(n),r=this.compiler||this.Compiler;return Ld("stringify",r),lS(e),r(e,i)}use(e,...n){const i=this.attachers,r=this.namespace;if(Bd("use",this.frozen),e!=null)if(typeof e=="function")a(e,n);else if(typeof e=="object")Array.isArray(e)?o(e):s(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function l(u){if(typeof u=="function")a(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...f]=u;a(c,f)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(r.settings=Rd(!0,r.settings,u.settings))}function o(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const f=u[c];l(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function a(u,c){let f=-1,h=-1;for(;++f<i.length;)if(i[f][0]===u){h=f;break}if(h===-1)i.push([u,...c]);else if(c.length>0){let[d,...p]=c;const g=i[h][1];_m(g)&&_m(d)&&(d=Rd(!0,g,d)),i[h]=[u,d,...p]}}}}const q_=new X0().freeze();function Nd(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Ld(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Bd(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function lS(t){if(!_m(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function sS(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Lu(t){return __(t)?t:new o2(t)}function __(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function U_(t){return typeof t=="string"||H_(t)}function H_(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const V_="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",oS=[],aS={allowDangerousHtml:!0},j_=/^(https?|ircs?|mailto|xmpp)$/i,$_=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function X_(t){const e=G_(t),n=I_(t);return W_(e.runSync(e.parse(n),n),t)}function G_(t){const e=t.rehypePlugins||oS,n=t.remarkPlugins||oS,i=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...aS}:aS;return q_().use(Cq).use(n).use(x_,i).use(e)}function I_(t){const e=t.children||"",n=new o2;return typeof e=="string"&&(n.value=e),n}function W_(t,e){const n=e.allowedElements,i=e.allowElement,r=e.components,l=e.disallowedElements,s=e.skipHtml,o=e.unwrapDisallowed,a=e.urlTransform||F_;for(const c of $_)Object.hasOwn(e,c.from)&&(""+c.from+(c.to?"use `"+c.to+"` instead":"remove it")+V_+c.id,void 0);return l2(t,u),lB(t,{Fragment:P.Fragment,components:r,ignoreInvalidStyle:!0,jsx:P.jsx,jsxs:P.jsxs,passKeys:!0,passNode:!0});function u(c,f,h){if(c.type==="raw"&&h&&typeof f=="number")return s?h.children.splice(f,1):h.children[f]={type:"text",value:c.value},f;if(c.type==="element"){let d;for(d in Ad)if(Object.hasOwn(Ad,d)&&Object.hasOwn(c.properties,d)){const p=c.properties[d],g=Ad[d];(g===null||g.includes(c.tagName))&&(c.properties[d]=a(String(p||""),d,c))}}if(c.type==="element"){let d=n?!n.includes(c.tagName):l?l.includes(c.tagName):!1;if(!d&&i&&typeof f=="number"&&(d=!i(c,f,h)),d&&h&&typeof f=="number")return o&&c.children?h.children.splice(f,1,...c.children):h.children.splice(f,1),f}}}function F_(t){const e=t.indexOf(":"),n=t.indexOf("?"),i=t.indexOf("#"),r=t.indexOf("/");return e===-1||r!==-1&&e>r||n!==-1&&e>n||i!==-1&&e>i||j_.test(t.slice(0,e))?t:""}const Y_=({content:t,mimeType:e,width:n,height:i})=>{const r=`data:${e};base64,${t}`,l={};return n!==void 0&&(l.width=n),i!==void 0&&(l.height=i),P.jsx("img",{src:r,className:"output-image",alt:"Plot output",style:l})},Z_=({html:t})=>{const e=K0.useRef(null);return K0.useEffect(()=>{if(!e.current)return;e.current.innerHTML=t,e.current.querySelectorAll("script").forEach(i=>{var l;const r=document.createElement("script");Array.from(i.attributes).forEach(s=>{r.setAttribute(s.name,s.value)}),r.textContent=i.textContent,(l=i.parentNode)==null||l.replaceChild(r,i)})},[t]),P.jsx("div",{ref:e,className:"output-html"})},K_=t=>t.replace(/\//g,"-"),J_=({expression:t,ref:e,allInvisible:n})=>{var l;const i=E.useRef(null);E.useImperativeHandle(e,()=>i.current,[]);const r=n?"output-container output-container-invisible":"output-container";return P.jsx("div",{ref:i,className:r,children:P.jsx("div",{className:"output-line",children:(l=t.result)==null?void 0:l.output.map((s,o)=>P.jsx("div",{className:`output-item output-${K_(s.type)}`,children:P.jsx("div",{className:"output-content-wrapper",children:s.type==="text/markdown"?P.jsx(X_,{children:s.content}):s.type.startsWith("image/")?P.jsx(Y_,{content:s.content,mimeType:s.type,width:s.width,height:s.height}):s.type==="text/html"?P.jsx(Z_,{html:s.content}):P.jsx("pre",{children:s.content})})},o))})})},e6=({onLineGroupHeightChange:t,expressions:e,lineGroups:n,lineGroupLayouts:i,lineGroupHeights:r,readerMode:l})=>{const s=E.useRef(null),o=E.useRef(new Map),a=E.useMemo(()=>{if(l||!i||!r||n.length===0)return;const c=n[n.length-1],f=i.get(c.id),h=r.get(c.id);return f&&h!==void 0?f.top+h:void 0},[l,n,i,r]),u=E.useCallback(()=>{const c=new Map;for(const[f,h]of o.current.entries())h&&c.set(f,Math.max(0,h.getBoundingClientRect().height));return c},[]);return E.useEffect(()=>{if(!s.current||!t)return;const c=setTimeout(()=>{t(u())},0),f=new MutationObserver(()=>{t(u())}),h=new ResizeObserver(()=>{t(u())});return s.current&&(f.observe(s.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class","open","hidden"]}),h.observe(s.current)),()=>{clearTimeout(c),f.disconnect(),h.disconnect()}},[t,u,n]),P.jsx("div",{id:"output",ref:s,children:P.jsx("div",{className:`output-content ${l?"reader-mode":""}`,style:a?{minHeight:`${a}px`}:void 0,children:n.map(c=>{if(!c.resultIds.some(g=>{const b=e.find(m=>m.id===g);return(b==null?void 0:b.result)&&b.result.output.length>0}))return null;const h=i==null?void 0:i.get(c.id),d=["output-group",c.allInvisible?"output-group-invisible":"",c.hasError?"output-group-error":""].filter(Boolean).join(" "),p={};return h&&!l&&(p.position="absolute",p.top=h.top,p.left=8,p.right=8,p.minHeight=`${h.naturalHeight}px`),P.jsx("div",{className:d,ref:g=>{g?o.current.set(c.id,g):o.current.delete(c.id)},style:Object.keys(p).length>0?p:void 0,children:c.resultIds.map(g=>{const b=e.findIndex(O=>O.id===g);if(b===-1)return null;const m=e[b];return P.jsx(J_,{expression:m,index:b,allInvisible:c.allInvisible},m.id)})},c.id)})})})};let uS=1;class t6{constructor(){hi(this,"wsClient",null)}setWebSocketClient(e){this.wsClient=e}async*executeScript(e,n){if(!this.wsClient)throw new Error("WebSocket client not set");if(!this.wsClient.isConnected)throw new Error("WebSocket not connected");const i=[];let r=0;try{for await(const l of this.wsClient.executeStream({script:e,lineRange:n.lineRange,scriptName:n.scriptName,reset:n.reset})){if(l.type==="expressions"){const s=l.expressions.map(o=>({id:uS++,lineStart:o.lineStart,lineEnd:o.lineEnd,state:"pending"}));i.push(...s),yield{type:"expressions",expressions:s};continue}if(l.type==="cancelled"){yield{type:"cancelled",expressions:l.expressions.map(o=>({lineStart:o.lineStart,lineEnd:o.lineEnd}))};continue}if(l.type==="result"){const s=i[r++];yield{type:"done",expression:{id:(s==null?void 0:s.id)??uS++,lineStart:l.lineStart,lineEnd:l.lineEnd,state:"done",result:{output:l.output,isInvisible:l.isInvisible}}}}}}catch(l){throw l instanceof Error?l:new Error(String(l))}}async reset(){var e;(e=this.wsClient)!=null&&e.isConnected&&this.wsClient.send({type:"reset"})}interrupt(){var e;(e=this.wsClient)!=null&&e.isConnected&&this.wsClient.send({type:"interrupt"})}isAvailable(){var e;return((e=this.wsClient)==null?void 0:e.isConnected)??!1}}const Hm=new t6;async function*n6(t,e){yield*Hm.executeScript(t,e)}class i6{diff(e,n,i={}){let r;typeof i=="function"?(r=i,i={}):"callback"in i&&(r=i.callback);const l=this.castInput(e,i),s=this.castInput(n,i),o=this.removeEmpty(this.tokenize(l,i)),a=this.removeEmpty(this.tokenize(s,i));return this.diffWithOptionsObj(o,a,i,r)}diffWithOptionsObj(e,n,i,r){var l;const s=O=>{if(O=this.postProcess(O,i),r){setTimeout(function(){r(O)},0);return}else return O},o=n.length,a=e.length;let u=1,c=o+a;i.maxEditLength!=null&&(c=Math.min(c,i.maxEditLength));const f=(l=i.timeout)!==null&&l!==void 0?l:1/0,h=Date.now()+f,d=[{oldPos:-1,lastComponent:void 0}];let p=this.extractCommon(d[0],n,e,0,i);if(d[0].oldPos+1>=a&&p+1>=o)return s(this.buildValues(d[0].lastComponent,n,e));let g=-1/0,b=1/0;const m=()=>{for(let O=Math.max(g,-u);O<=Math.min(b,u);O+=2){let y;const x=d[O-1],w=d[O+1];x&&(d[O-1]=void 0);let S=!1;if(w){const A=w.oldPos-O;S=w&&0<=A&&A<o}const k=x&&x.oldPos+1<a;if(!S&&!k){d[O]=void 0;continue}if(!k||S&&x.oldPos<w.oldPos?y=this.addToPath(w,!0,!1,0,i):y=this.addToPath(x,!1,!0,1,i),p=this.extractCommon(y,n,e,O,i),y.oldPos+1>=a&&p+1>=o)return s(this.buildValues(y.lastComponent,n,e))||!0;d[O]=y,y.oldPos+1>=a&&(b=Math.min(b,O-1)),p+1>=o&&(g=Math.max(g,O+1))}u++};if(r)(function O(){setTimeout(function(){if(u>c||Date.now()>h)return r(void 0);m()||O()},0)})();else for(;u<=c&&Date.now()<=h;){const O=m();if(O)return O}}addToPath(e,n,i,r,l){const s=e.lastComponent;return s&&!l.oneChangePerToken&&s.added===n&&s.removed===i?{oldPos:e.oldPos+r,lastComponent:{count:s.count+1,added:n,removed:i,previousComponent:s.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:n,removed:i,previousComponent:s}}}extractCommon(e,n,i,r,l){const s=n.length,o=i.length;let a=e.oldPos,u=a-r,c=0;for(;u+1<s&&a+1<o&&this.equals(i[a+1],n[u+1],l);)u++,a++,c++,l.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return c&&!l.oneChangePerToken&&(e.lastComponent={count:c,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=a,u}equals(e,n,i){return i.comparator?i.comparator(e,n):e===n||!!i.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let i=0;i<e.length;i++)e[i]&&n.push(e[i]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,i){const r=[];let l;for(;e;)r.push(e),l=e.previousComponent,delete e.previousComponent,e=l;r.reverse();const s=r.length;let o=0,a=0,u=0;for(;o<s;o++){const c=r[o];if(c.removed)c.value=this.join(i.slice(u,u+c.count)),u+=c.count;else{if(!c.added&&this.useLongestToken){let f=n.slice(a,a+c.count);f=f.map(function(h,d){const p=i[u+d];return p.length>h.length?p:h}),c.value=this.join(f)}else c.value=this.join(n.slice(a,a+c.count));a+=c.count,c.added||(u+=c.count)}}return r}}class r6 extends i6{constructor(){super(...arguments),this.tokenize=o6}equals(e,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!e.includes(`
|
|
84
84
|
`))&&(e=e.trim()),(!i.newlineIsToken||!n.includes(`
|
|
85
85
|
`))&&(n=n.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(e.endsWith(`
|
|
86
86
|
`)&&(e=e.slice(0,-1)),n.endsWith(`
|
pdit/_static/export.html
CHANGED
|
@@ -65,7 +65,7 @@ Error generating stack: `+n.message+`
|
|
|
65
65
|
`});++l<t.length;)l&&n.push({type:"text",value:`
|
|
66
66
|
`}),n.push(t[l]);return e&&t.length>0&&n.push({type:"text",value:`
|
|
67
67
|
`}),n}function dh(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function ph(t,e){const n=yx(t,e),l=n.one(t,void 0),u=ax(n),i=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return u&&i.children.push({type:"text",value:`
|
|
68
|
-
`},u),i}function Ex(t,e){return t&&"run"in t?async function(n,l){const u=ph(n,{file:l,...e});await t.run(u,l)}:function(n,l){return ph(n,{file:l,...t||e})}}function mh(t){if(t)throw t}var Vi=Object.prototype.hasOwnProperty,lg=Object.prototype.toString,gh=Object.defineProperty,yh=Object.getOwnPropertyDescriptor,vh=function(e){return typeof Array.isArray=="function"?Array.isArray(e):lg.call(e)==="[object Array]"},bh=function(e){if(!e||lg.call(e)!=="[object Object]")return!1;var n=Vi.call(e,"constructor"),l=e.constructor&&e.constructor.prototype&&Vi.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!l)return!1;var u;for(u in e);return typeof u>"u"||Vi.call(e,u)},Sh=function(e,n){gh&&n.name==="__proto__"?gh(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},xh=function(e,n){if(n==="__proto__")if(Vi.call(e,n)){if(yh)return yh(e,n).value}else return;return e[n]},Tx=function t(){var e,n,l,u,i,a,r=arguments[0],c=1,o=arguments.length,f=!1;for(typeof r=="boolean"&&(f=r,r=arguments[1]||{},c=2),(r==null||typeof r!="object"&&typeof r!="function")&&(r={});c<o;++c)if(e=arguments[c],e!=null)for(n in e)l=xh(r,n),u=xh(e,n),r!==u&&(f&&u&&(bh(u)||(i=vh(u)))?(i?(i=!1,a=l&&vh(l)?l:[]):a=l&&bh(l)?l:{},Sh(r,{name:n,newValue:t(f,a,u)})):typeof u<"u"&&Sh(r,{name:n,newValue:u}));return r};const Cr=Vc(Tx);function Yc(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function Ax(){const t=[],e={run:n,use:l};return e;function n(...u){let i=-1;const a=u.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);r(null,...u);function r(c,...o){const f=t[++i];let h=-1;if(c){a(c);return}for(;++h<u.length;)(o[h]===null||o[h]===void 0)&&(o[h]=u[h]);u=o,f?zx(f,r)(...o):a(null,...o)}}function l(u){if(typeof u!="function")throw new TypeError("Expected `middelware` to be a function, not "+u);return t.push(u),e}}function zx(t,e){let n;return l;function l(...a){const r=t.length>a.length;let c;r&&a.push(u);try{c=t.apply(this,a)}catch(o){const f=o;if(r&&n)throw f;return u(f)}r||(c&&c.then&&typeof c.then=="function"?c.then(i,u):c instanceof Error?u(c):i(c))}function u(a,...r){n||(n=!0,e(a,...r))}function i(a){u(null,a)}}const ze={basename:Ox,dirname:_x,extname:Dx,join:Mx,sep:"/"};function Ox(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');oi(t);let n=0,l=-1,u=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;u--;)if(t.codePointAt(u)===47){if(i){n=u+1;break}}else l<0&&(i=!0,l=u+1);return l<0?"":t.slice(n,l)}if(e===t)return"";let a=-1,r=e.length-1;for(;u--;)if(t.codePointAt(u)===47){if(i){n=u+1;break}}else a<0&&(i=!0,a=u+1),r>-1&&(t.codePointAt(u)===e.codePointAt(r--)?r<0&&(l=u):(r=-1,l=a));return n===l?l=a:l<0&&(l=t.length),t.slice(n,l)}function _x(t){if(oi(t),t.length===0)return".";let e=-1,n=t.length,l;for(;--n;)if(t.codePointAt(n)===47){if(l){e=n;break}}else l||(l=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function Dx(t){oi(t);let e=t.length,n=-1,l=0,u=-1,i=0,a;for(;e--;){const r=t.codePointAt(e);if(r===47){if(a){l=e+1;break}continue}n<0&&(a=!0,n=e+1),r===46?u<0?u=e:i!==1&&(i=1):u>-1&&(i=-1)}return u<0||n<0||i===0||i===1&&u===n-1&&u===l+1?"":t.slice(u,n)}function Mx(...t){let e=-1,n;for(;++e<t.length;)oi(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":Cx(n)}function Cx(t){oi(t);const e=t.codePointAt(0)===47;let n=Nx(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function Nx(t,e){let n="",l=0,u=-1,i=0,a=-1,r,c;for(;++a<=t.length;){if(a<t.length)r=t.codePointAt(a);else{if(r===47)break;r=47}if(r===47){if(!(u===a-1||i===1))if(u!==a-1&&i===2){if(n.length<2||l!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",l=0):(n=n.slice(0,c),l=n.length-1-n.lastIndexOf("/")),u=a,i=0;continue}}else if(n.length>0){n="",l=0,u=a,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",l=2)}else n.length>0?n+="/"+t.slice(u+1,a):n=t.slice(u+1,a),l=a-u-1;u=a,i=0}else r===46&&i>-1?i++:i=-1}return n}function oi(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Rx={cwd:kx};function kx(){return"/"}function Xc(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function wx(t){if(typeof t=="string")t=new URL(t);else if(!Xc(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Ux(t)}function Ux(t){if(t.hostname!==""){const l=new TypeError('File URL host must be "localhost" or empty on darwin');throw l.code="ERR_INVALID_FILE_URL_HOST",l}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const l=e.codePointAt(n+2);if(l===70||l===102){const u=new TypeError("File URL path must not include encoded / characters");throw u.code="ERR_INVALID_FILE_URL_PATH",u}}return decodeURIComponent(e)}const Nr=["history","path","basename","stem","extname","dirname"];class ug{constructor(e){let n;e?Xc(e)?n={path:e}:typeof e=="string"||Bx(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":Rx.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let l=-1;for(;++l<Nr.length;){const i=Nr[l];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let u;for(u in n)Nr.includes(u)||(this[u]=n[u])}get basename(){return typeof this.path=="string"?ze.basename(this.path):void 0}set basename(e){kr(e,"basename"),Rr(e,"basename"),this.path=ze.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?ze.dirname(this.path):void 0}set dirname(e){Eh(this.basename,"dirname"),this.path=ze.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?ze.extname(this.path):void 0}set extname(e){if(Rr(e,"extname"),Eh(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ze.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Xc(e)&&(e=wx(e)),kr(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?ze.basename(this.path,this.extname):void 0}set stem(e){kr(e,"stem"),Rr(e,"stem"),this.path=ze.join(this.dirname||"",e+(this.extname||""))}fail(e,n,l){const u=this.message(e,n,l);throw u.fatal=!0,u}info(e,n,l){const u=this.message(e,n,l);return u.fatal=void 0,u}message(e,n,l){const u=new Lt(e,n,l);return this.path&&(u.name=this.path+":"+u.name,u.file=this.path),u.fatal=!1,this.messages.push(u),u}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Rr(t,e){if(t&&t.includes(ze.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+ze.sep+"`")}function kr(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function Eh(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function Bx(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Hx=function(t){const l=this.constructor.prototype,u=l[t],i=function(){return u.apply(i,arguments)};return Object.setPrototypeOf(i,l),i},Lx={}.hasOwnProperty;class uf extends Hx{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Ax()}copy(){const e=new uf;let n=-1;for(;++n<this.attachers.length;){const l=this.attachers[n];e.use(...l)}return e.data(Cr(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(Br("data",this.frozen),this.namespace[e]=n,this):Lx.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Br("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...l]=this.attachers[this.freezeIndex];if(l[0]===!1)continue;l[0]===!0&&(l[0]=void 0);const u=n.call(e,...l);typeof u=="function"&&this.transformers.use(u)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=Di(e),l=this.parser||this.Parser;return wr("parse",l),l(String(n),n)}process(e,n){const l=this;return this.freeze(),wr("process",this.parser||this.Parser),Ur("process",this.compiler||this.Compiler),n?u(void 0,n):new Promise(u);function u(i,a){const r=Di(e),c=l.parse(r);l.run(c,r,function(f,h,d){if(f||!h||!d)return o(f);const s=h,b=l.stringify(s,d);Yx(b)?d.value=b:d.result=b,o(f,d)});function o(f,h){f||!h?a(f):i?i(h):n(void 0,h)}}}processSync(e){let n=!1,l;return this.freeze(),wr("processSync",this.parser||this.Parser),Ur("processSync",this.compiler||this.Compiler),this.process(e,u),Ah("processSync","process",n),l;function u(i,a){n=!0,mh(i),l=a}}run(e,n,l){Th(e),this.freeze();const u=this.transformers;return!l&&typeof n=="function"&&(l=n,n=void 0),l?i(void 0,l):new Promise(i);function i(a,r){const c=Di(n);u.run(e,c,o);function o(f,h,d){const s=h||e;f?r(f):a?a(s):l(void 0,s,d)}}}runSync(e,n){let l=!1,u;return this.run(e,n,i),Ah("runSync","run",l),u;function i(a,r){mh(a),u=r,l=!0}}stringify(e,n){this.freeze();const l=Di(n),u=this.compiler||this.Compiler;return Ur("stringify",u),Th(e),u(e,l)}use(e,...n){const l=this.attachers,u=this.namespace;if(Br("use",this.frozen),e!=null)if(typeof e=="function")c(e,n);else if(typeof e=="object")Array.isArray(e)?r(e):a(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function i(o){if(typeof o=="function")c(o,[]);else if(typeof o=="object")if(Array.isArray(o)){const[f,...h]=o;c(f,h)}else a(o);else throw new TypeError("Expected usable value, not `"+o+"`")}function a(o){if(!("plugins"in o)&&!("settings"in o))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");r(o.plugins),o.settings&&(u.settings=Cr(!0,u.settings,o.settings))}function r(o){let f=-1;if(o!=null)if(Array.isArray(o))for(;++f<o.length;){const h=o[f];i(h)}else throw new TypeError("Expected a list of plugins, not `"+o+"`")}function c(o,f){let h=-1,d=-1;for(;++h<l.length;)if(l[h][0]===o){d=h;break}if(d===-1)l.push([o,...f]);else if(f.length>0){let[s,...b]=f;const S=l[d][1];Yc(S)&&Yc(s)&&(s=Cr(!0,S,s)),l[d]=[o,s,...b]}}}}const qx=new uf().freeze();function wr(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Ur(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Br(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Th(t){if(!Yc(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Ah(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Di(t){return jx(t)?t:new ug(t)}function jx(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Yx(t){return typeof t=="string"||Xx(t)}function Xx(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Vx="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",zh=[],Oh={allowDangerousHtml:!0},Qx=/^(https?|ircs?|mailto|xmpp)$/i,Gx=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Zx(t){const e=Kx(t),n=Jx(t);return Fx(e.runSync(e.parse(n),n),t)}function Kx(t){const e=t.rehypePlugins||zh,n=t.remarkPlugins||zh,l=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Oh}:Oh;return qx().use(_S).use(n).use(Ex,l).use(e)}function Jx(t){const e=t.children||"",n=new ug;return typeof e=="string"&&(n.value=e),n}function Fx(t,e){const n=e.allowedElements,l=e.allowElement,u=e.components,i=e.disallowedElements,a=e.skipHtml,r=e.unwrapDisallowed,c=e.urlTransform||Ix;for(const f of Gx)Object.hasOwn(e,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+Vx+f.id,void 0);return ng(t,o),av(t,{Fragment:st.Fragment,components:u,ignoreInvalidStyle:!0,jsx:st.jsx,jsxs:st.jsxs,passKeys:!0,passNode:!0});function o(f,h,d){if(f.type==="raw"&&d&&typeof h=="number")return a?d.children.splice(h,1):d.children[h]={type:"text",value:f.value},h;if(f.type==="element"){let s;for(s in _r)if(Object.hasOwn(_r,s)&&Object.hasOwn(f.properties,s)){const b=f.properties[s],S=_r[s];(S===null||S.includes(f.tagName))&&(f.properties[s]=c(String(b||""),s,f))}}if(f.type==="element"){let s=n?!n.includes(f.tagName):i?i.includes(f.tagName):!1;if(!s&&l&&typeof h=="number"&&(s=!l(f,h,d)),s&&d&&typeof h=="number")return r&&f.children?d.children.splice(h,1,...f.children):d.children.splice(h,1),h}}}function Ix(t){const e=t.indexOf(":"),n=t.indexOf("?"),l=t.indexOf("#"),u=t.indexOf("/");return e===-1||u!==-1&&e>u||n!==-1&&e>n||l!==-1&&e>l||Qx.test(t.slice(0,e))?t:""}const $x=({content:t,mimeType:e})=>{const n=`data:${e};base64,${t}`;return st.jsx("img",{src:n,className:"output-image",alt:"Plot output"})},Wx=({html:t})=>{const e=gf.useRef(null);return gf.useEffect(()=>{if(!e.current)return;e.current.innerHTML=t,e.current.querySelectorAll("script").forEach(l=>{var i;const u=document.createElement("script");Array.from(l.attributes).forEach(a=>{u.setAttribute(a.name,a.value)}),u.textContent=l.textContent,(i=l.parentNode)==null||i.replaceChild(u,l)})},[t]),st.jsx("div",{ref:e,className:"output-html"})},Px=t=>t.replace(/\//g,"-"),t2=({expression:t,ref:e,allInvisible:n})=>{var i;const l=Oe.useRef(null);Oe.useImperativeHandle(e,()=>l.current,[]);const u=n?"output-container output-container-invisible":"output-container";return st.jsx("div",{ref:l,className:u,children:st.jsx("div",{className:"output-line",children:(i=t.result)==null?void 0:i.output.map((a,r)=>st.jsx("div",{className:`output-item output-${Px(a.type)}`,children:st.jsx("div",{className:"output-content-wrapper",children:a.type==="text/markdown"?st.jsx(Zx,{children:a.content}):a.type.startsWith("image/")?st.jsx($x,{content:a.content,mimeType:a.type}):a.type==="text/html"?st.jsx(Wx,{html:a.content}):st.jsx("pre",{children:a.content})})},r))})})},e2=({onLineGroupHeightChange:t,expressions:e,lineGroups:n,lineGroupLayouts:l,lineGroupHeights:u,readerMode:i})=>{const a=Oe.useRef(null),r=Oe.useRef(new Map),c=Oe.useMemo(()=>{if(i||!l||!u||n.length===0)return;const f=n[n.length-1],h=l.get(f.id),d=u.get(f.id);return h&&d!==void 0?h.top+d:void 0},[i,n,l,u]),o=Oe.useCallback(()=>{const f=new Map;for(const[h,d]of r.current.entries())d&&f.set(h,Math.max(0,d.getBoundingClientRect().height));return f},[]);return Oe.useEffect(()=>{if(!a.current||!t)return;const f=setTimeout(()=>{t(o())},0),h=new MutationObserver(()=>{t(o())}),d=new ResizeObserver(()=>{t(o())});return a.current&&(h.observe(a.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"]}),d.observe(a.current)),()=>{clearTimeout(f),h.disconnect(),d.disconnect()}},[t,o,n]),st.jsx("div",{id:"output",ref:a,children:st.jsx("div",{className:`output-content ${i?"reader-mode":""}`,style:c?{minHeight:`${c}px`}:void 0,children:n.map(f=>{if(!f.resultIds.some(S=>{const z=e.find(p=>p.id===S);return(z==null?void 0:z.result)&&z.result.output.length>0}))return null;const d=l==null?void 0:l.get(f.id),s=["output-group",f.allInvisible?"output-group-invisible":"",f.hasError?"output-group-error":""].filter(Boolean).join(" "),b={};return d&&!i&&(b.position="absolute",b.top=d.top,b.left=8,b.right=8,b.minHeight=`${d.naturalHeight}px`),st.jsx("div",{className:s,ref:S=>{S?r.current.set(f.id,S):r.current.delete(f.id)},style:Object.keys(b).length>0?b:void 0,children:f.resultIds.map(S=>{const z=e.findIndex(m=>m.id===S);if(z===-1)return null;const p=e[z];return st.jsx(t2,{expression:p,index:z,allInvisible:f.allInvisible},p.id)})},f.id)})})})};let n2=0;function l2(t){if(t.length===0)return[];const e=c=>{var o,f;return((f=(o=c.result)==null?void 0:o.output)==null?void 0:f.some(h=>h.type==="error"||h.type==="stderr"))??!1},n=new Map;for(const c of t)for(let o=c.lineStart;o<=c.lineEnd;o++)n.has(o)||n.set(o,new Set),n.get(o).add(c.id);const l=new Map,u=c=>{l.has(c)||l.set(c,c);const o=l.get(c);if(o!==c){const f=u(o);return l.set(c,f),f}return o},i=(c,o)=>{const f=u(c),h=u(o);f!==h&&l.set(h,f)};for(const c of n.values()){const o=Array.from(c);for(let f=1;f<o.length;f++)i(o[0],o[f])}const a=new Map;for(const c of t){const o=u(c.id);a.has(o)||a.set(o,[]),a.get(o).push(c.id)}const r=[];for(const c of a.values()){let o=Number.POSITIVE_INFINITY,f=Number.NEGATIVE_INFINITY;const h=[];for(const d of c){const s=t.find(b=>b.id===d);s&&(h.push(s),o=Math.min(o,s.lineStart),f=Math.max(f,s.lineEnd))}if(o!==Number.POSITIVE_INFINITY&&f!==Number.NEGATIVE_INFINITY){const d=h.every(S=>{var z;return((z=S.result)==null?void 0:z.isInvisible)===!0}),s=h.some(e);let b="done";for(const S of h){if(S.state==="executing"){b="executing";break}S.state==="cancelled"&&(b="cancelled"),S.state==="pending"&&b!=="cancelled"&&(b="pending")}r.push({id:`lg-${n2++}`,resultIds:[...c].sort((S,z)=>S-z),lineStart:o,lineEnd:f,allInvisible:d,hasError:s,state:b})}}return r.sort((c,o)=>c.lineStart-o.lineStart)}function u2(){const t=window.__pdit_response__;if(!t)return st.jsx("div",{style:{padding:"20px",fontFamily:"monospace"},children:"Error: No execution data found. This page should be generated by `pdit export`."});const{expressions:e}=t,n=l2(e);return st.jsx("div",{id:"app",children:st.jsxs("div",{className:"split-container reader-mode",children:[st.jsx("div",{className:"editor-half editor-hidden"}),st.jsx("div",{className:"output-half output-full",children:st.jsx(e2,{expressions:e,lineGroups:n,readerMode:!0})})]})})}const i2=document.getElementById("app"),a2=o0.createRoot(i2);a2.render(st.jsx(u2,{}));</script>
|
|
68
|
+
`},u),i}function Ex(t,e){return t&&"run"in t?async function(n,l){const u=ph(n,{file:l,...e});await t.run(u,l)}:function(n,l){return ph(n,{file:l,...t||e})}}function mh(t){if(t)throw t}var Vi=Object.prototype.hasOwnProperty,lg=Object.prototype.toString,gh=Object.defineProperty,yh=Object.getOwnPropertyDescriptor,vh=function(e){return typeof Array.isArray=="function"?Array.isArray(e):lg.call(e)==="[object Array]"},bh=function(e){if(!e||lg.call(e)!=="[object Object]")return!1;var n=Vi.call(e,"constructor"),l=e.constructor&&e.constructor.prototype&&Vi.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!l)return!1;var u;for(u in e);return typeof u>"u"||Vi.call(e,u)},Sh=function(e,n){gh&&n.name==="__proto__"?gh(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},xh=function(e,n){if(n==="__proto__")if(Vi.call(e,n)){if(yh)return yh(e,n).value}else return;return e[n]},Tx=function t(){var e,n,l,u,i,a,r=arguments[0],c=1,o=arguments.length,f=!1;for(typeof r=="boolean"&&(f=r,r=arguments[1]||{},c=2),(r==null||typeof r!="object"&&typeof r!="function")&&(r={});c<o;++c)if(e=arguments[c],e!=null)for(n in e)l=xh(r,n),u=xh(e,n),r!==u&&(f&&u&&(bh(u)||(i=vh(u)))?(i?(i=!1,a=l&&vh(l)?l:[]):a=l&&bh(l)?l:{},Sh(r,{name:n,newValue:t(f,a,u)})):typeof u<"u"&&Sh(r,{name:n,newValue:u}));return r};const Cr=Vc(Tx);function Yc(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function Ax(){const t=[],e={run:n,use:l};return e;function n(...u){let i=-1;const a=u.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);r(null,...u);function r(c,...o){const f=t[++i];let h=-1;if(c){a(c);return}for(;++h<u.length;)(o[h]===null||o[h]===void 0)&&(o[h]=u[h]);u=o,f?zx(f,r)(...o):a(null,...o)}}function l(u){if(typeof u!="function")throw new TypeError("Expected `middelware` to be a function, not "+u);return t.push(u),e}}function zx(t,e){let n;return l;function l(...a){const r=t.length>a.length;let c;r&&a.push(u);try{c=t.apply(this,a)}catch(o){const f=o;if(r&&n)throw f;return u(f)}r||(c&&c.then&&typeof c.then=="function"?c.then(i,u):c instanceof Error?u(c):i(c))}function u(a,...r){n||(n=!0,e(a,...r))}function i(a){u(null,a)}}const ze={basename:Ox,dirname:_x,extname:Dx,join:Mx,sep:"/"};function Ox(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');oi(t);let n=0,l=-1,u=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;u--;)if(t.codePointAt(u)===47){if(i){n=u+1;break}}else l<0&&(i=!0,l=u+1);return l<0?"":t.slice(n,l)}if(e===t)return"";let a=-1,r=e.length-1;for(;u--;)if(t.codePointAt(u)===47){if(i){n=u+1;break}}else a<0&&(i=!0,a=u+1),r>-1&&(t.codePointAt(u)===e.codePointAt(r--)?r<0&&(l=u):(r=-1,l=a));return n===l?l=a:l<0&&(l=t.length),t.slice(n,l)}function _x(t){if(oi(t),t.length===0)return".";let e=-1,n=t.length,l;for(;--n;)if(t.codePointAt(n)===47){if(l){e=n;break}}else l||(l=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function Dx(t){oi(t);let e=t.length,n=-1,l=0,u=-1,i=0,a;for(;e--;){const r=t.codePointAt(e);if(r===47){if(a){l=e+1;break}continue}n<0&&(a=!0,n=e+1),r===46?u<0?u=e:i!==1&&(i=1):u>-1&&(i=-1)}return u<0||n<0||i===0||i===1&&u===n-1&&u===l+1?"":t.slice(u,n)}function Mx(...t){let e=-1,n;for(;++e<t.length;)oi(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":Cx(n)}function Cx(t){oi(t);const e=t.codePointAt(0)===47;let n=Nx(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function Nx(t,e){let n="",l=0,u=-1,i=0,a=-1,r,c;for(;++a<=t.length;){if(a<t.length)r=t.codePointAt(a);else{if(r===47)break;r=47}if(r===47){if(!(u===a-1||i===1))if(u!==a-1&&i===2){if(n.length<2||l!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",l=0):(n=n.slice(0,c),l=n.length-1-n.lastIndexOf("/")),u=a,i=0;continue}}else if(n.length>0){n="",l=0,u=a,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",l=2)}else n.length>0?n+="/"+t.slice(u+1,a):n=t.slice(u+1,a),l=a-u-1;u=a,i=0}else r===46&&i>-1?i++:i=-1}return n}function oi(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Rx={cwd:kx};function kx(){return"/"}function Xc(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function wx(t){if(typeof t=="string")t=new URL(t);else if(!Xc(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Ux(t)}function Ux(t){if(t.hostname!==""){const l=new TypeError('File URL host must be "localhost" or empty on darwin');throw l.code="ERR_INVALID_FILE_URL_HOST",l}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const l=e.codePointAt(n+2);if(l===70||l===102){const u=new TypeError("File URL path must not include encoded / characters");throw u.code="ERR_INVALID_FILE_URL_PATH",u}}return decodeURIComponent(e)}const Nr=["history","path","basename","stem","extname","dirname"];class ug{constructor(e){let n;e?Xc(e)?n={path:e}:typeof e=="string"||Bx(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":Rx.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let l=-1;for(;++l<Nr.length;){const i=Nr[l];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let u;for(u in n)Nr.includes(u)||(this[u]=n[u])}get basename(){return typeof this.path=="string"?ze.basename(this.path):void 0}set basename(e){kr(e,"basename"),Rr(e,"basename"),this.path=ze.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?ze.dirname(this.path):void 0}set dirname(e){Eh(this.basename,"dirname"),this.path=ze.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?ze.extname(this.path):void 0}set extname(e){if(Rr(e,"extname"),Eh(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ze.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Xc(e)&&(e=wx(e)),kr(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?ze.basename(this.path,this.extname):void 0}set stem(e){kr(e,"stem"),Rr(e,"stem"),this.path=ze.join(this.dirname||"",e+(this.extname||""))}fail(e,n,l){const u=this.message(e,n,l);throw u.fatal=!0,u}info(e,n,l){const u=this.message(e,n,l);return u.fatal=void 0,u}message(e,n,l){const u=new Lt(e,n,l);return this.path&&(u.name=this.path+":"+u.name,u.file=this.path),u.fatal=!1,this.messages.push(u),u}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function Rr(t,e){if(t&&t.includes(ze.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+ze.sep+"`")}function kr(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function Eh(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function Bx(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Hx=function(t){const l=this.constructor.prototype,u=l[t],i=function(){return u.apply(i,arguments)};return Object.setPrototypeOf(i,l),i},Lx={}.hasOwnProperty;class uf extends Hx{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Ax()}copy(){const e=new uf;let n=-1;for(;++n<this.attachers.length;){const l=this.attachers[n];e.use(...l)}return e.data(Cr(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(Br("data",this.frozen),this.namespace[e]=n,this):Lx.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Br("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...l]=this.attachers[this.freezeIndex];if(l[0]===!1)continue;l[0]===!0&&(l[0]=void 0);const u=n.call(e,...l);typeof u=="function"&&this.transformers.use(u)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=Di(e),l=this.parser||this.Parser;return wr("parse",l),l(String(n),n)}process(e,n){const l=this;return this.freeze(),wr("process",this.parser||this.Parser),Ur("process",this.compiler||this.Compiler),n?u(void 0,n):new Promise(u);function u(i,a){const r=Di(e),c=l.parse(r);l.run(c,r,function(f,h,d){if(f||!h||!d)return o(f);const s=h,b=l.stringify(s,d);Yx(b)?d.value=b:d.result=b,o(f,d)});function o(f,h){f||!h?a(f):i?i(h):n(void 0,h)}}}processSync(e){let n=!1,l;return this.freeze(),wr("processSync",this.parser||this.Parser),Ur("processSync",this.compiler||this.Compiler),this.process(e,u),Ah("processSync","process",n),l;function u(i,a){n=!0,mh(i),l=a}}run(e,n,l){Th(e),this.freeze();const u=this.transformers;return!l&&typeof n=="function"&&(l=n,n=void 0),l?i(void 0,l):new Promise(i);function i(a,r){const c=Di(n);u.run(e,c,o);function o(f,h,d){const s=h||e;f?r(f):a?a(s):l(void 0,s,d)}}}runSync(e,n){let l=!1,u;return this.run(e,n,i),Ah("runSync","run",l),u;function i(a,r){mh(a),u=r,l=!0}}stringify(e,n){this.freeze();const l=Di(n),u=this.compiler||this.Compiler;return Ur("stringify",u),Th(e),u(e,l)}use(e,...n){const l=this.attachers,u=this.namespace;if(Br("use",this.frozen),e!=null)if(typeof e=="function")c(e,n);else if(typeof e=="object")Array.isArray(e)?r(e):a(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function i(o){if(typeof o=="function")c(o,[]);else if(typeof o=="object")if(Array.isArray(o)){const[f,...h]=o;c(f,h)}else a(o);else throw new TypeError("Expected usable value, not `"+o+"`")}function a(o){if(!("plugins"in o)&&!("settings"in o))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");r(o.plugins),o.settings&&(u.settings=Cr(!0,u.settings,o.settings))}function r(o){let f=-1;if(o!=null)if(Array.isArray(o))for(;++f<o.length;){const h=o[f];i(h)}else throw new TypeError("Expected a list of plugins, not `"+o+"`")}function c(o,f){let h=-1,d=-1;for(;++h<l.length;)if(l[h][0]===o){d=h;break}if(d===-1)l.push([o,...f]);else if(f.length>0){let[s,...b]=f;const S=l[d][1];Yc(S)&&Yc(s)&&(s=Cr(!0,S,s)),l[d]=[o,s,...b]}}}}const qx=new uf().freeze();function wr(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Ur(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Br(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Th(t){if(!Yc(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Ah(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Di(t){return jx(t)?t:new ug(t)}function jx(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Yx(t){return typeof t=="string"||Xx(t)}function Xx(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Vx="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",zh=[],Oh={allowDangerousHtml:!0},Qx=/^(https?|ircs?|mailto|xmpp)$/i,Gx=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Zx(t){const e=Kx(t),n=Jx(t);return Fx(e.runSync(e.parse(n),n),t)}function Kx(t){const e=t.rehypePlugins||zh,n=t.remarkPlugins||zh,l=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Oh}:Oh;return qx().use(_S).use(n).use(Ex,l).use(e)}function Jx(t){const e=t.children||"",n=new ug;return typeof e=="string"&&(n.value=e),n}function Fx(t,e){const n=e.allowedElements,l=e.allowElement,u=e.components,i=e.disallowedElements,a=e.skipHtml,r=e.unwrapDisallowed,c=e.urlTransform||Ix;for(const f of Gx)Object.hasOwn(e,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+Vx+f.id,void 0);return ng(t,o),av(t,{Fragment:st.Fragment,components:u,ignoreInvalidStyle:!0,jsx:st.jsx,jsxs:st.jsxs,passKeys:!0,passNode:!0});function o(f,h,d){if(f.type==="raw"&&d&&typeof h=="number")return a?d.children.splice(h,1):d.children[h]={type:"text",value:f.value},h;if(f.type==="element"){let s;for(s in _r)if(Object.hasOwn(_r,s)&&Object.hasOwn(f.properties,s)){const b=f.properties[s],S=_r[s];(S===null||S.includes(f.tagName))&&(f.properties[s]=c(String(b||""),s,f))}}if(f.type==="element"){let s=n?!n.includes(f.tagName):i?i.includes(f.tagName):!1;if(!s&&l&&typeof h=="number"&&(s=!l(f,h,d)),s&&d&&typeof h=="number")return r&&f.children?d.children.splice(h,1,...f.children):d.children.splice(h,1),h}}}function Ix(t){const e=t.indexOf(":"),n=t.indexOf("?"),l=t.indexOf("#"),u=t.indexOf("/");return e===-1||u!==-1&&e>u||n!==-1&&e>n||l!==-1&&e>l||Qx.test(t.slice(0,e))?t:""}const $x=({content:t,mimeType:e,width:n,height:l})=>{const u=`data:${e};base64,${t}`,i={};return n!==void 0&&(i.width=n),l!==void 0&&(i.height=l),st.jsx("img",{src:u,className:"output-image",alt:"Plot output",style:i})},Wx=({html:t})=>{const e=gf.useRef(null);return gf.useEffect(()=>{if(!e.current)return;e.current.innerHTML=t,e.current.querySelectorAll("script").forEach(l=>{var i;const u=document.createElement("script");Array.from(l.attributes).forEach(a=>{u.setAttribute(a.name,a.value)}),u.textContent=l.textContent,(i=l.parentNode)==null||i.replaceChild(u,l)})},[t]),st.jsx("div",{ref:e,className:"output-html"})},Px=t=>t.replace(/\//g,"-"),t2=({expression:t,ref:e,allInvisible:n})=>{var i;const l=Oe.useRef(null);Oe.useImperativeHandle(e,()=>l.current,[]);const u=n?"output-container output-container-invisible":"output-container";return st.jsx("div",{ref:l,className:u,children:st.jsx("div",{className:"output-line",children:(i=t.result)==null?void 0:i.output.map((a,r)=>st.jsx("div",{className:`output-item output-${Px(a.type)}`,children:st.jsx("div",{className:"output-content-wrapper",children:a.type==="text/markdown"?st.jsx(Zx,{children:a.content}):a.type.startsWith("image/")?st.jsx($x,{content:a.content,mimeType:a.type,width:a.width,height:a.height}):a.type==="text/html"?st.jsx(Wx,{html:a.content}):st.jsx("pre",{children:a.content})})},r))})})},e2=({onLineGroupHeightChange:t,expressions:e,lineGroups:n,lineGroupLayouts:l,lineGroupHeights:u,readerMode:i})=>{const a=Oe.useRef(null),r=Oe.useRef(new Map),c=Oe.useMemo(()=>{if(i||!l||!u||n.length===0)return;const f=n[n.length-1],h=l.get(f.id),d=u.get(f.id);return h&&d!==void 0?h.top+d:void 0},[i,n,l,u]),o=Oe.useCallback(()=>{const f=new Map;for(const[h,d]of r.current.entries())d&&f.set(h,Math.max(0,d.getBoundingClientRect().height));return f},[]);return Oe.useEffect(()=>{if(!a.current||!t)return;const f=setTimeout(()=>{t(o())},0),h=new MutationObserver(()=>{t(o())}),d=new ResizeObserver(()=>{t(o())});return a.current&&(h.observe(a.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class","open","hidden"]}),d.observe(a.current)),()=>{clearTimeout(f),h.disconnect(),d.disconnect()}},[t,o,n]),st.jsx("div",{id:"output",ref:a,children:st.jsx("div",{className:`output-content ${i?"reader-mode":""}`,style:c?{minHeight:`${c}px`}:void 0,children:n.map(f=>{if(!f.resultIds.some(S=>{const z=e.find(p=>p.id===S);return(z==null?void 0:z.result)&&z.result.output.length>0}))return null;const d=l==null?void 0:l.get(f.id),s=["output-group",f.allInvisible?"output-group-invisible":"",f.hasError?"output-group-error":""].filter(Boolean).join(" "),b={};return d&&!i&&(b.position="absolute",b.top=d.top,b.left=8,b.right=8,b.minHeight=`${d.naturalHeight}px`),st.jsx("div",{className:s,ref:S=>{S?r.current.set(f.id,S):r.current.delete(f.id)},style:Object.keys(b).length>0?b:void 0,children:f.resultIds.map(S=>{const z=e.findIndex(m=>m.id===S);if(z===-1)return null;const p=e[z];return st.jsx(t2,{expression:p,index:z,allInvisible:f.allInvisible},p.id)})},f.id)})})})};let n2=0;function l2(t){if(t.length===0)return[];const e=c=>{var o,f;return((f=(o=c.result)==null?void 0:o.output)==null?void 0:f.some(h=>h.type==="error"||h.type==="stderr"))??!1},n=new Map;for(const c of t)for(let o=c.lineStart;o<=c.lineEnd;o++)n.has(o)||n.set(o,new Set),n.get(o).add(c.id);const l=new Map,u=c=>{l.has(c)||l.set(c,c);const o=l.get(c);if(o!==c){const f=u(o);return l.set(c,f),f}return o},i=(c,o)=>{const f=u(c),h=u(o);f!==h&&l.set(h,f)};for(const c of n.values()){const o=Array.from(c);for(let f=1;f<o.length;f++)i(o[0],o[f])}const a=new Map;for(const c of t){const o=u(c.id);a.has(o)||a.set(o,[]),a.get(o).push(c.id)}const r=[];for(const c of a.values()){let o=Number.POSITIVE_INFINITY,f=Number.NEGATIVE_INFINITY;const h=[];for(const d of c){const s=t.find(b=>b.id===d);s&&(h.push(s),o=Math.min(o,s.lineStart),f=Math.max(f,s.lineEnd))}if(o!==Number.POSITIVE_INFINITY&&f!==Number.NEGATIVE_INFINITY){const d=h.every(S=>{var z;return((z=S.result)==null?void 0:z.isInvisible)===!0}),s=h.some(e);let b="done";for(const S of h){if(S.state==="executing"){b="executing";break}S.state==="cancelled"&&(b="cancelled"),S.state==="pending"&&b!=="cancelled"&&(b="pending")}r.push({id:`lg-${n2++}`,resultIds:[...c].sort((S,z)=>S-z),lineStart:o,lineEnd:f,allInvisible:d,hasError:s,state:b})}}return r.sort((c,o)=>c.lineStart-o.lineStart)}function u2(){const t=window.__pdit_response__;if(!t)return st.jsx("div",{style:{padding:"20px",fontFamily:"monospace"},children:"Error: No execution data found. This page should be generated by `pdit export`."});const{expressions:e}=t,n=l2(e);return st.jsx("div",{id:"app",children:st.jsxs("div",{className:"split-container reader-mode",children:[st.jsx("div",{className:"editor-half editor-hidden"}),st.jsx("div",{className:"output-half output-full",children:st.jsx(e2,{expressions:e,lineGroups:n,readerMode:!0})})]})})}const i2=document.getElementById("app"),a2=o0.createRoot(i2);a2.render(st.jsx(u2,{}));</script>
|
|
69
69
|
<style rel="stylesheet" crossorigin>@import"https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&display=swap";:root{--color-yellow: #FFD700;--color-red: #E63946;--color-blue: #457B9D;--color-teal: #2A9D8F;--color-orange: #F4A261;--color-black: #1a1a1a;--color-cream: #FFFEF5;--color-warm-hover: #FFF8DC;--color-gray: #555;--color-gray-light: #888;--color-link: var(--color-red);--color-link-hover: var(--color-blue);--color-code-bg: var(--color-black);--color-code-text: var(--color-yellow);--border-thick: 3px solid var(--color-black);--border-thin: 1px solid #ddd;--top-bar-height: calc(32px + 1rem) ;--gradient-rainbow: linear-gradient(90deg, var(--color-red) 25%, var(--color-yellow) 25%, var(--color-yellow) 50%, var(--color-blue) 50%, var(--color-blue) 75%, var(--color-teal) 75% );--bg-primary: #fff;--bg-secondary: #f8f8f8;--bg-tertiary: #f5f5f5;--border: #ddd;--accent: var(--color-red);--accent-alt: var(--color-blue);--text-primary: var(--color-black);--text-secondary: var(--color-gray);--text-dim: var(--color-gray-light);--error: #cc0000;--error-soft: #d97a7a;--warning: var(--color-orange);font-family:system-ui,-apple-system,sans-serif;line-height:1.5;font-weight:400;color-scheme:light;color:var(--color-black);background-color:#fff;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%}body{margin:0;width:100%;min-height:100vh;overflow-x:hidden;overflow-y:auto;background:#fff}#app{width:100%;height:auto;min-height:100vh;display:flex;flex-direction:column}#app.loading{cursor:wait}#app.loading .top-bar,#app.loading .split-container{opacity:.5;pointer-events:none}.top-bar{background:#fafafa;padding:.5rem 1rem;display:flex;align-items:center;flex-shrink:0;position:fixed;top:0;left:0;right:0;z-index:20;height:var(--top-bar-height);box-sizing:border-box;font-family:Fira Code,ui-monospace,monospace;border-bottom:1px solid #e0e0e0}.top-bar-content{display:flex;gap:.75rem;align-items:center;width:100%}.top-bar-button-wrapper{position:relative}.top-bar-button{background:transparent;color:var(--color-gray);border:1px solid var(--color-gray-light);border-radius:0;padding:0 .8rem;font-size:.75rem;cursor:pointer;font-family:inherit;transition:all .1s;font-weight:500;display:flex;align-items:center;gap:.5rem;height:32px}.top-bar-button:hover:not(:disabled){background:var(--color-warm-hover);color:var(--color-black);border-color:var(--color-gray)}.top-bar-button:disabled{cursor:not-allowed;color:#bbb;border-color:#ddd}.top-bar-tooltip{position:absolute;top:calc(100% + 4px);left:50%;transform:translate(-50%);background:var(--color-black);color:var(--color-cream);padding:.4rem .6rem;border-radius:0;font-size:.7rem;font-weight:500;font-family:ui-monospace,monospace;white-space:nowrap;border:none;z-index:1000;pointer-events:none;box-shadow:0 2px 4px #0003}.top-bar-status{display:flex;align-items:center;gap:.5rem;margin-left:.75rem}.top-bar-status-dot{width:8px;height:8px;border-radius:50%}.top-bar-status-dot.ready{background:var(--color-teal)}.top-bar-status-dot.initializing{background:var(--color-orange)}.top-bar-status-dot.connected{background:var(--color-teal)}.top-bar-status-dot.connecting{background:var(--color-orange)}.top-bar-status-dot.disconnected{background:var(--color-red)}.top-bar-conflict-compact{display:flex;align-items:center;gap:.375rem;background:transparent;border:1px solid var(--color-orange);border-radius:0;padding:.25rem .375rem;font-size:.7rem;margin-left:.75rem}.top-bar-conflict-compact-message{color:var(--color-orange);font-family:ui-monospace,monospace;white-space:nowrap;font-size:.75rem;font-weight:500}.top-bar-conflict-button-primary{position:relative;background:var(--color-orange);color:#fff;border:none;border-radius:0;padding:.25rem .5rem;font-size:.7rem;cursor:pointer;font-family:ui-monospace,monospace;transition:all .1s;font-weight:600}.top-bar-conflict-button-primary:hover{background:var(--color-red)}.top-bar-conflict-button-primary:disabled{cursor:not-allowed;background:#ccc}.top-bar-conflict-button-secondary{position:relative;background:transparent;color:var(--color-gray);border:1px solid var(--color-gray-light);border-radius:0;padding:.25rem .5rem;font-size:.7rem;cursor:pointer;font-family:ui-monospace,monospace;transition:all .1s;font-weight:500}.top-bar-conflict-button-secondary:hover{background:var(--color-warm-hover);color:var(--color-black)}.top-bar-conflict-button-secondary:disabled{cursor:not-allowed;color:#ccc;border-color:#ddd}.top-bar-status-text{font-size:.7rem;font-weight:500;color:var(--color-gray-light)}.top-bar-status-text.ready{color:var(--color-teal)}.top-bar-status-text.initializing{color:var(--color-orange)}.top-bar-status-text.connected{color:var(--color-teal)}.top-bar-status-text.connecting{color:var(--color-orange)}.top-bar-status-text.disconnected{color:var(--color-red)}.top-bar-toggle-wrapper{position:relative}.top-bar-toggle-icon{display:inline-flex;align-items:center;justify-content:center;line-height:0}.top-bar-toggle{display:inline-grid;grid-auto-flow:column;align-items:center;column-gap:.5rem;background:transparent;border:1px solid var(--color-gray-light);border-radius:0;padding:0 .8rem;cursor:pointer;font-size:.75rem;font-family:inherit;transition:all .1s;font-weight:500;color:var(--color-gray);height:32px;line-height:1}.top-bar-toggle:hover{background:var(--color-warm-hover);color:var(--color-black);border-color:var(--color-gray)}.top-bar-toggle:disabled{cursor:not-allowed;color:var(--color-gray-light);border-color:#ddd}.top-bar-toggle:disabled .top-bar-toggle-rail{background:#ddd;border-color:#ddd}.top-bar-toggle:disabled .top-bar-toggle-rail:after{background:var(--color-gray-light)}.top-bar-toggle.enabled{border-color:var(--color-teal);background:transparent;color:var(--color-teal)}.top-bar-toggle-label{font-size:.75rem;color:currentColor;line-height:1}.top-bar-toggle.enabled .top-bar-toggle-label{color:var(--color-teal)}.top-bar-toggle-rail{width:24px;height:14px;background:#ddd;border:1px solid var(--color-gray-light);border-radius:0;position:relative;transition:all .1s;box-sizing:border-box}.top-bar-toggle-rail:after{content:"";position:absolute;top:50%;left:2px;width:8px;height:8px;background:#fff;border-radius:0;transform:translateY(-50%);transition:transform .1s}.top-bar-toggle.enabled .top-bar-toggle-rail{background:var(--color-teal);border-color:var(--color-teal)}.top-bar-toggle.enabled .top-bar-toggle-rail:after{transform:translate(10px,-50%);background:#fff}.split-container{display:grid;grid-template-columns:1fr 1fr;flex:0 0 auto;min-height:100vh;box-sizing:border-box;overflow:visible;border-top:none;transition:opacity .15s ease-out;background:#fff}#app.has-topbar .split-container{padding-top:var(--top-bar-height);min-height:calc(100vh - var(--top-bar-height))}.editor-half{display:flex;flex-direction:column;flex:0 0 50%;min-width:0;border-right:1px solid #e5e5e5}.output-half{display:flex;flex:0 0 50%;min-width:0}.split-container.reader-mode{grid-template-columns:0fr 1fr}.editor-hidden{visibility:hidden;width:0;overflow:hidden}.output-full{flex:1}h1{font-size:2.5em;line-height:1.1;margin-bottom:1em;text-align:center;font-weight:800;letter-spacing:-.02em}.editor-container{display:flex;flex-direction:row;width:100%;border:none;border-radius:0;overflow:hidden;box-shadow:none;background:#fff}#editor{flex:1;width:100%;min-width:0}#editor-preview{flex:1;border-left:1px solid #e5e5e5;padding-left:.5rem}.cm-editor{font-size:14px;min-width:0;background:#fff;color:var(--color-black);font-family:ui-monospace,monospace}.cm-focused{outline:none}#output{font-size:13px;font-family:ui-monospace,monospace;width:100%;min-width:0;overflow-x:auto;overflow-y:hidden;background:#fff;border-left:none;padding-right:12px;scrollbar-gutter:stable}.output-content{display:flex;flex-direction:column;position:relative;padding:6px;gap:4px}.output-group{background:transparent;border:none;border-left:3px solid #e5e5e5;margin:0;padding:0 6px 0 8px;border-radius:0}.output-group-error{border-left-color:var(--color-red)}.output-content.reader-mode .output-group{margin:0;border:none;padding-left:8px;padding-right:8px;border-left:2px solid #ddd}.output-group-invisible{background:transparent;border:none;height:0;overflow:hidden;margin:0;padding:0;border-radius:0;box-shadow:none}.output-container,.output-container-invisible{padding:0}.output-line{position:relative}.output-line:not(.empty-line){padding:0}.output-line pre{margin:0;padding:0;font-size:13px;line-height:1.4;color:var(--color-black);font-family:ui-monospace,monospace}.output-item{color:var(--color-black);display:flex;flex-direction:column;align-items:flex-start;gap:0;margin:0}.output-content-wrapper{flex:1;min-width:0;overflow-x:auto;width:100%}.output-debug{margin-top:6px;padding-top:6px;border-top:2px solid var(--color-black)}.output-debug-button{font-size:10px;padding:2px 6px;background:transparent;border:2px solid var(--color-black);border-radius:0;cursor:pointer;font-family:ui-monospace,monospace;color:var(--color-black);transition:all .1s;font-weight:600}.output-debug-button:hover{background:var(--color-black);color:var(--color-yellow)}.output-debug-info{margin-top:6px;padding:6px;background:var(--color-black);border:2px solid var(--color-black);border-radius:0;max-height:400px;overflow:auto;position:relative}.output-debug-info:before{content:"";position:absolute;top:0;left:0;right:0;height:4px;background:var(--gradient-rainbow)}.output-debug-info pre{margin:4px 0 0;font-size:11px;line-height:1.4;color:var(--color-cream);font-family:ui-monospace,monospace}.output-item.output-stdout .output-content-wrapper{color:var(--color-black);font-family:ui-monospace,monospace}.output-item.output-stderr .output-content-wrapper,.output-item.output-error .output-content-wrapper{color:var(--color-red);font-weight:600}.output-item.output-warning .output-content-wrapper{color:var(--color-orange);font-weight:600}.output-item pre{color:var(--color-black);font-family:ui-monospace,monospace;background:transparent;margin:0;padding:0;border:none;white-space:pre-wrap;overflow-wrap:anywhere}.output-item code{color:var(--color-yellow);background:var(--color-black);padding:.2em .4em;border-radius:3px;font-family:ui-monospace,monospace}.output-text-markdown code{color:var(--color-yellow);background:var(--color-black);padding:.2em .4em;border-radius:3px;font-weight:600}.output-text-markdown pre{background:var(--color-black);border:none;padding:1.25rem;overflow-x:auto;margin:.5em 0;position:relative;border-radius:0}.output-text-markdown pre:before{content:"";position:absolute;top:0;left:0;right:0;height:4px;background:var(--gradient-rainbow)}.output-text-markdown pre code{background:none;padding:0;color:var(--color-cream);border-radius:0}.output-text-markdown blockquote{border-left:4px solid var(--color-yellow);margin:.5em 0;padding-left:1em;color:var(--color-gray)}.output-text-markdown h1,.output-text-markdown h2,.output-text-markdown h3,.output-text-markdown h4,.output-text-markdown h5,.output-text-markdown h6{font-weight:700;letter-spacing:-.02em;color:var(--color-black);margin:1em 0 .5em;text-align:left}.output-text-markdown table{margin-left:0;margin-right:auto}.output-text-markdown ul{list-style:none;padding-left:0;margin:.5em 0}.output-text-markdown ul li{padding-left:1.5rem;position:relative;margin:.25em 0}.output-text-markdown ul li:before{content:"";position:absolute;left:0;top:.55em;width:6px;height:6px;background:var(--color-yellow);border:none}.output-text-markdown ul li:nth-child(5n+1):before{background:var(--color-yellow)}.output-text-markdown ul li:nth-child(5n+2):before{background:var(--color-red)}.output-text-markdown ul li:nth-child(5n+3):before{background:var(--color-blue)}.output-text-markdown ul li:nth-child(5n+4):before{background:var(--color-teal)}.output-text-markdown ul li:nth-child(5n+5):before{background:var(--color-orange)}.output-text-markdown ol{padding-left:1.5rem;margin:.5em 0}.output-text-markdown ol li{margin:.25em 0}.output-text-markdown a{color:var(--color-red);text-decoration:none;font-weight:600}.output-text-markdown a:hover{color:var(--color-blue)}.output-text-markdown strong{font-weight:700;color:var(--color-black)}.output-text-markdown em{font-style:italic}.output-text-markdown .output-content-wrapper>*:first-child{margin-top:0;padding-top:0}.output-text-markdown .output-content-wrapper>*:last-child{margin-bottom:0;padding-bottom:0}.output-item.output-plot{margin-top:.25rem}.output-plot canvas{display:block;background:var(--color-cream);width:400px;height:300px;border:2px solid var(--color-black)}.output-image{max-width:100%;max-width:min(100%,1200px);height:auto;display:block;background:var(--color-cream);border:2px solid var(--color-black)}.output-html{width:100%;background:transparent;display:block;overflow-x:auto}.output-html table,.output-html .dt-container{margin-left:0!important;margin-right:auto!important}.output-html .dt-layout-cell{justify-content:flex-start!important;text-align:left!important}.output-table{width:100%;border-collapse:collapse;color:var(--color-gray);border:2px solid var(--color-black)}.output-table td{padding:.25rem .5rem;border:1px solid var(--color-gray);color:var(--color-gray)}.output-table .header-row td{font-weight:700;color:var(--color-black);background:var(--color-warm-hover);border-bottom:3px solid var(--color-black)}.output-table td:last-child{text-align:right;font-family:ui-monospace,monospace}.output-table tr:hover td{background:var(--color-warm-hover)}.empty-line{height:16px}.plot-chart{display:flex;align-items:end;gap:1px;height:30px}.plot-bar{min-width:6px;background-color:var(--color-red);opacity:.8}.array-items{display:flex;flex-wrap:wrap;gap:3px}.array-item{background:var(--color-black);color:var(--color-yellow);padding:2px 4px;border:2px solid var(--color-black);border-radius:0;font-family:ui-monospace,monospace}.output-spacer-container{display:block;background:transparent}.output-spacer{width:100%}.debug-panel{position:fixed;bottom:0;left:0;right:0;background:var(--color-cream);border-top:var(--border-thick);padding:1rem;max-height:300px;overflow-y:auto;font-size:.8rem}.debug-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem}.debug-header h3{margin:0;color:var(--color-black);text-transform:uppercase;letter-spacing:.5px;font-weight:700}.debug-status{color:var(--color-gray-light);font-size:.75rem}.debug-table{width:100%;border-collapse:collapse;background:var(--color-cream);border-radius:0;overflow:hidden;border:2px solid var(--color-black)}.debug-table th{background:var(--color-yellow);color:var(--color-black);padding:.5rem 1rem;text-align:right;font-weight:700;font-size:.75rem;border-bottom:3px solid var(--color-black)}.debug-table td{padding:.5rem 1rem;border-bottom:1px solid #ddd;font-size:.75rem;color:var(--color-gray)}.debug-table tbody tr:hover{background:var(--color-warm-hover)}.line-number{font-weight:600;color:var(--color-gray-light);text-align:center;width:60px}.height-value{font-family:ui-monospace,monospace;text-align:right;color:var(--color-black)}.debug-tabs{display:flex;gap:0;margin-bottom:1rem;border-bottom:3px solid var(--color-black)}.debug-tab{background:none;border:none;border-bottom:3px solid transparent;padding:.5rem 1rem;cursor:pointer;font-size:.75rem;font-weight:600;color:var(--color-gray);transition:all .1s;text-transform:uppercase;letter-spacing:.5px;margin-bottom:-3px}.debug-tab:hover{color:var(--color-black);background:var(--color-warm-hover)}.debug-tab.active{color:var(--color-black);border-bottom-color:var(--color-red);background:var(--color-yellow)}.debug-empty{text-align:center;color:var(--color-gray-light);padding:2rem;font-style:italic}.range-id{font-weight:600;color:var(--color-gray-light);text-align:center;width:60px}.range-value{font-family:ui-monospace,monospace;text-align:right;color:var(--color-black)}.top-bar-split-button-wrapper{position:relative;display:flex;align-items:stretch}.top-bar-split-button-main{background:transparent;color:var(--color-gray);border:1px solid var(--color-gray-light);border-right:none;border-radius:0;padding:0 .8rem;font-size:.75rem;cursor:pointer;font-family:inherit;transition:all .1s;font-weight:500;display:flex;align-items:center;gap:.5rem;height:32px}.top-bar-run-label{display:inline-grid}.top-bar-run-label>span{grid-area:1 / 1}.top-bar-run-label-measure{visibility:hidden}.top-bar-split-button-arrow{background:transparent;color:var(--color-gray);border:1px solid var(--color-gray-light);border-left:1px solid #ddd;border-radius:0;padding:0 .4rem;font-size:.75rem;cursor:pointer;font-family:inherit;transition:all .1s;display:flex;align-items:center;justify-content:center;min-width:24px;height:32px}.top-bar-split-button-main:hover:not(:disabled),.top-bar-split-button-arrow:hover:not(:disabled),.top-bar-split-button-arrow.active{background:var(--color-warm-hover);color:var(--color-black);border-color:var(--color-gray)}.top-bar-split-button-main:hover:not(:disabled){border-right:none}.top-bar-split-button-arrow:hover:not(:disabled),.top-bar-split-button-arrow.active{border-left-color:#ddd}.top-bar-split-button-main:disabled{cursor:not-allowed;background:transparent;color:#ccc;border-color:#ddd}.top-bar-split-button-arrow:disabled{cursor:not-allowed;background:transparent;color:#ccc;border-color:#ddd;border-left-color:#ddd}.top-bar-dropdown-menu{position:absolute;top:100%;left:0;margin-top:4px;background:#fff;border:1px solid #ddd;border-radius:0;box-shadow:0 2px 8px #0000001a;min-width:100%;width:max-content;display:flex;flex-direction:column;z-index:1000}.top-bar-dropdown-menu:before{content:"";display:block;position:absolute;top:-4px;left:0;width:100%;height:4px;background:transparent}.top-bar-dropdown-item{padding:8px 12px;cursor:pointer;color:var(--color-gray);font-size:.75rem;font-family:inherit;border:none;background:transparent;text-align:left;font-weight:500;transition:all .1s;display:flex;align-items:center;justify-content:space-between;gap:1rem}.top-bar-dropdown-item:hover,.top-bar-dropdown-item.selected{background:var(--color-warm-hover);color:var(--color-black)}.top-bar-dropdown-item.disabled{cursor:not-allowed;color:var(--color-gray)}.top-bar-dropdown-item.disabled:hover,.top-bar-dropdown-item.disabled.selected{background:transparent;color:var(--color-gray)}.top-bar-dropdown-item-shortcut{font-size:.65rem;opacity:.7}@keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}.fuzzy-finder-dropdown{position:absolute;top:100%;left:0;margin-top:4px;background:#fff;border:1px solid #ddd;border-radius:0;box-shadow:0 2px 8px #0000001a;width:320px;max-height:300px;display:flex;flex-direction:column;overflow:hidden;z-index:1000}.fuzzy-finder-input{background:#fff;color:var(--color-black);border:none;border-bottom:1px solid #ddd;padding:8px 10px;font-size:12px;font-family:inherit;outline:none;width:100%;box-sizing:border-box}.fuzzy-finder-input:focus{background:var(--color-warm-hover)}.fuzzy-finder-input::placeholder{color:var(--color-gray-light)}.fuzzy-finder-list{overflow-y:auto;flex:1}.fuzzy-finder-item{padding:6px 10px;cursor:pointer;display:flex;align-items:baseline;gap:8px;border-bottom:1px solid #ddd;min-width:0}.fuzzy-finder-item:hover{background:var(--color-warm-hover)}.fuzzy-finder-item.selected{background:var(--color-warm-hover);color:var(--color-black)}.fuzzy-finder-filename{color:var(--color-black);font-size:12px;font-family:ui-monospace,monospace;flex-shrink:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:200px;font-weight:600}.fuzzy-finder-path{color:var(--color-gray-light);font-size:10px;font-family:ui-monospace,monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}.fuzzy-match-highlight{color:var(--color-red);font-weight:700}.fuzzy-finder-item.selected .fuzzy-match-highlight{color:var(--color-red)}.fuzzy-finder-empty{padding:12px 10px;text-align:center;color:var(--color-gray-light);font-size:11px;font-family:ui-monospace,monospace;white-space:nowrap}table.dataTable{border-collapse:collapse;font-size:13px;font-family:ui-monospace,monospace;border:1px solid #ddd;background:#fff;width:100%}table.dataTable thead th{background:#f5f5f5;font-weight:600;color:var(--color-black);border-right:1px solid #ddd;border-bottom:1px solid #ddd;padding:8px;font-size:12px;text-align:left}table.dataTable thead th:last-child{border-right:none}table.dataTable tbody td{padding:6px 8px;border-right:1px solid #eee;border-bottom:1px solid #eee;color:var(--color-gray);background:#fff}table.dataTable tbody td:last-child{border-right:none}table.dataTable tbody tr:last-child td{border-bottom:none}table.dataTable tbody tr:hover td{background:#f9f9f9}table.dataTable.stripe tbody tr.odd,table.dataTable.display tbody tr.odd{background:#fff}table.dataTable.stripe tbody tr.odd:hover,table.dataTable.display tbody tr.odd:hover{background:#f9f9f9}div.dt-container{font-family:ui-monospace,monospace;font-size:11px}div.dt-layout-row{display:flex!important;justify-content:space-between!important;align-items:center!important;padding:4px 0!important}div.dt-layout-cell{padding:2px!important}div.dt-search input{background:#fff;border:1px solid #ddd;border-radius:0;padding:2px 6px;font-size:11px;font-family:ui-monospace,monospace;color:var(--color-black);height:22px}div.dt-search input:hover{border-color:#bbb}div.dt-search input:focus{outline:none;border-color:#999;background:#fff}div.dt-length select{background:#fff;border:1px solid #ddd;border-radius:0;padding:2px 6px;font-size:11px;font-family:ui-monospace,monospace;color:var(--color-black);height:22px}div.dt-length select:hover{border-color:#bbb}div.dt-length select:focus{outline:none;border-color:#999;background:#fff}div.dt-paging button{background:transparent;border:1px solid #ddd;border-radius:0;padding:2px 8px;font-size:11px;cursor:pointer;color:var(--color-gray);font-family:ui-monospace,monospace;transition:all .1s;height:22px;margin:0 1px;font-weight:500}div.dt-paging button:hover:not(.disabled){background:#f5f5f5;border-color:#bbb;color:var(--color-black)}div.dt-paging button.disabled{cursor:not-allowed;color:#ccc;border-color:#eee;opacity:.5}div.dt-paging button.current{background:#333;border-color:#333;color:#fff;font-weight:600}div.dt-info{color:var(--color-gray);font-size:11px;font-family:ui-monospace,monospace}table.dataTable.no-footer{border-bottom:1px solid #ddd}table.dataTable thead th.dt-orderable-asc,table.dataTable thead th.dt-orderable-desc,table.dataTable thead th.dt-ordering-asc,table.dataTable thead th.dt-ordering-desc{background:#f0f0f0}small.itables-dtype{color:var(--color-gray-light);font-size:10px}table tbody td{vertical-align:middle}table tbody td a{color:#06c;text-decoration:none}table tbody td a:hover{color:#049;text-decoration:underline}@media (max-width: 900px){.top-bar-label,.top-bar-toggle-label{display:none}}</style>
|
|
70
70
|
</head>
|
|
71
71
|
<body>
|
pdit/_static/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>pdit</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-DbESVfT-.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-rS96z8hq.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
pdit/ipython_executor.py
CHANGED
|
@@ -177,13 +177,15 @@ del _register_pdit_runtime_hooks
|
|
|
177
177
|
source = '\n'.join(source_lines)
|
|
178
178
|
|
|
179
179
|
is_expr = isinstance(node, ast.Expr)
|
|
180
|
-
|
|
180
|
+
is_string_literal = is_expr and isinstance(node.value, ast.Constant) and isinstance(node.value.value, str)
|
|
181
|
+
is_fstring = is_expr and isinstance(node.value, ast.JoinedStr)
|
|
181
182
|
|
|
182
183
|
statements.append({
|
|
183
184
|
"lineStart": line_start,
|
|
184
185
|
"lineEnd": line_end,
|
|
185
186
|
"source": source,
|
|
186
|
-
"isMarkdownCell":
|
|
187
|
+
"isMarkdownCell": is_string_literal,
|
|
188
|
+
"isFStringMarkdown": is_fstring
|
|
187
189
|
})
|
|
188
190
|
|
|
189
191
|
return statements
|
|
@@ -193,13 +195,18 @@ del _register_pdit_runtime_hooks
|
|
|
193
195
|
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
|
|
194
196
|
return ansi_escape.sub('', text)
|
|
195
197
|
|
|
196
|
-
def _process_mime_data(self, data: dict) -> list[dict]:
|
|
198
|
+
def _process_mime_data(self, data: dict, metadata: dict | None = None) -> list[dict]:
|
|
197
199
|
"""Process MIME bundle data into output dicts.
|
|
198
200
|
|
|
199
201
|
Passes through MIME types directly instead of translating to custom types.
|
|
200
202
|
Uses priority order: image > html > markdown > json > plain text.
|
|
203
|
+
|
|
204
|
+
Args:
|
|
205
|
+
data: MIME bundle data dict
|
|
206
|
+
metadata: Optional metadata dict (keyed by MIME type, contains width/height for images)
|
|
201
207
|
"""
|
|
202
208
|
output: list[dict] = []
|
|
209
|
+
metadata = metadata or {}
|
|
203
210
|
|
|
204
211
|
# Priority order for MIME types - pass through directly
|
|
205
212
|
# Check for any image type
|
|
@@ -207,7 +214,14 @@ del _register_pdit_runtime_hooks
|
|
|
207
214
|
if image_types:
|
|
208
215
|
# Use first image type found (they're usually in priority order)
|
|
209
216
|
mime_type = image_types[0]
|
|
210
|
-
|
|
217
|
+
item: dict[str, Any] = {"type": mime_type, "content": data[mime_type]}
|
|
218
|
+
# Include width/height from metadata if present
|
|
219
|
+
mime_metadata = metadata.get(mime_type, {})
|
|
220
|
+
if 'width' in mime_metadata:
|
|
221
|
+
item['width'] = mime_metadata['width']
|
|
222
|
+
if 'height' in mime_metadata:
|
|
223
|
+
item['height'] = mime_metadata['height']
|
|
224
|
+
output.append(item)
|
|
211
225
|
elif 'text/html' in data:
|
|
212
226
|
output.append({"type": "text/html", "content": data['text/html']})
|
|
213
227
|
elif 'text/markdown' in data:
|
|
@@ -254,11 +268,13 @@ del _register_pdit_runtime_hooks
|
|
|
254
268
|
elif msg_type == 'execute_result':
|
|
255
269
|
# Expression result
|
|
256
270
|
data = content['data']
|
|
257
|
-
|
|
271
|
+
metadata = content.get('metadata', {})
|
|
272
|
+
output.extend(self._process_mime_data(data, metadata))
|
|
258
273
|
elif msg_type == 'display_data':
|
|
259
274
|
# Display output (plots, etc.)
|
|
260
275
|
data = content['data']
|
|
261
|
-
|
|
276
|
+
metadata = content.get('metadata', {})
|
|
277
|
+
output.extend(self._process_mime_data(data, metadata))
|
|
262
278
|
elif msg_type == 'error':
|
|
263
279
|
# Exception - strip ANSI codes from traceback
|
|
264
280
|
tb = '\n'.join(content['traceback'])
|
|
@@ -335,6 +351,10 @@ del _register_pdit_runtime_hooks
|
|
|
335
351
|
output = [{"type": "text/markdown", "content": str(value).strip()}]
|
|
336
352
|
except (ValueError, SyntaxError):
|
|
337
353
|
output = await self._execute_code(stmt["source"])
|
|
354
|
+
elif stmt["isFStringMarkdown"]:
|
|
355
|
+
# Wrap f-string in Markdown() so it returns text/markdown directly
|
|
356
|
+
wrapper_code = f"__import__('IPython').display.Markdown({stmt['source']})"
|
|
357
|
+
output = await self._execute_code(wrapper_code)
|
|
338
358
|
else:
|
|
339
359
|
output = await self._execute_code(stmt["source"])
|
|
340
360
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
pdit/__init__.py,sha256=QpiMnN_x5G3QaeWMXQlCRUtCo35IEYZLPj-cz87WG_g,185
|
|
2
|
+
pdit/_demo.py,sha256=SMOGoiHBdMDq8pXRVK-uuTRFCFbRd47diUyRR8Y3wZY,2026
|
|
3
|
+
pdit/cli.py,sha256=3YkWz2Sg3-OszRssWkXbPEu3dDQAXMS8Z0c07bZ7gx8,9634
|
|
4
|
+
pdit/exporter.py,sha256=i2emLqRQNPW92vFBTamLZyOhUTDU45_0QnOWG7PcIu8,2811
|
|
5
|
+
pdit/file_watcher.py,sha256=1WlqKWjLCdgMZLdN836MEeWTisGCtZmvgRdOFN-jns8,5200
|
|
6
|
+
pdit/ipython_executor.py,sha256=5YEBpJL7IjLfNve8hXa-2_cYawfP6ro5myNAx0n97ug,16325
|
|
7
|
+
pdit/server.py,sha256=URabdsLxiLUipkl8PTc5jgDjMlQV0v8QJTMnNNy0XKs,13941
|
|
8
|
+
pdit/_static/export.html,sha256=ITKX3MKoWQYoR8EqkMTfsEYjpNWfhVVi-Mdmw_jpxoY,332339
|
|
9
|
+
pdit/_static/index.html,sha256=wjUe3SHOs1g4hvQHUiKcwoKSkHyYs2GDdk3OqtdDMSA,450
|
|
10
|
+
pdit/_static/assets/index-DbESVfT-.js,sha256=vOC5-SuA-WA-ZxZ1TkbCtOwi0sfSGNu0c1fEF1-382c,814902
|
|
11
|
+
pdit/_static/assets/index-rS96z8hq.css,sha256=0EMq2r0to1VxGznyp18tWCd97_sSZhGVC3YF7QdBXEU,22855
|
|
12
|
+
pdit-0.6.0.dist-info/licenses/LICENSE,sha256=Y9tvBURRu-1aHUHY-tnbsDpPBTRYKWpIInVmaoOUkME,1071
|
|
13
|
+
pdit-0.6.0.dist-info/METADATA,sha256=gqrL2j5vzJcOcpw3R3EKxt_hH1jHTc2ewKBWhK4KcBY,1859
|
|
14
|
+
pdit-0.6.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
15
|
+
pdit-0.6.0.dist-info/entry_points.txt,sha256=n9I4wGD7M0NQrPWJcTWOsJAzeS6bQJbTnUP8C3Sl-iY,39
|
|
16
|
+
pdit-0.6.0.dist-info/top_level.txt,sha256=wk6vel1ecJS4EZZ3U6Xue9OwDq-Tw8Pbvq_TRQz9eIQ,5
|
|
17
|
+
pdit-0.6.0.dist-info/RECORD,,
|
pdit-0.5.0.dist-info/RECORD
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
pdit/__init__.py,sha256=QpiMnN_x5G3QaeWMXQlCRUtCo35IEYZLPj-cz87WG_g,185
|
|
2
|
-
pdit/_demo.py,sha256=SMOGoiHBdMDq8pXRVK-uuTRFCFbRd47diUyRR8Y3wZY,2026
|
|
3
|
-
pdit/cli.py,sha256=3YkWz2Sg3-OszRssWkXbPEu3dDQAXMS8Z0c07bZ7gx8,9634
|
|
4
|
-
pdit/exporter.py,sha256=i2emLqRQNPW92vFBTamLZyOhUTDU45_0QnOWG7PcIu8,2811
|
|
5
|
-
pdit/file_watcher.py,sha256=1WlqKWjLCdgMZLdN836MEeWTisGCtZmvgRdOFN-jns8,5200
|
|
6
|
-
pdit/ipython_executor.py,sha256=Q4G1DwTPKLDanpg_JcNgR_qvQdyJwhRGSQfv87DV2jg,15217
|
|
7
|
-
pdit/server.py,sha256=URabdsLxiLUipkl8PTc5jgDjMlQV0v8QJTMnNNy0XKs,13941
|
|
8
|
-
pdit/_static/export.html,sha256=d64NrMEU0n1lOtD4Q6zQ49brBUVh9ajdka42mhsGlLY,332214
|
|
9
|
-
pdit/_static/index.html,sha256=EyErNmqlcJRNvrVf2hXVOzXvLb-_v4evhjkFEKN20ak,450
|
|
10
|
-
pdit/_static/assets/index-1w8kifoA.js,sha256=Xh4d_rBVjqKbduAthj54nK4pnpqUoVUd7E4Owih6454,814777
|
|
11
|
-
pdit/_static/assets/index-rS96z8hq.css,sha256=0EMq2r0to1VxGznyp18tWCd97_sSZhGVC3YF7QdBXEU,22855
|
|
12
|
-
pdit-0.5.0.dist-info/licenses/LICENSE,sha256=Y9tvBURRu-1aHUHY-tnbsDpPBTRYKWpIInVmaoOUkME,1071
|
|
13
|
-
pdit-0.5.0.dist-info/METADATA,sha256=i17RGViPldKpQB6GrhgG4Ucx2tQfMhuUG7LCs7IEGSw,1859
|
|
14
|
-
pdit-0.5.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
15
|
-
pdit-0.5.0.dist-info/entry_points.txt,sha256=n9I4wGD7M0NQrPWJcTWOsJAzeS6bQJbTnUP8C3Sl-iY,39
|
|
16
|
-
pdit-0.5.0.dist-info/top_level.txt,sha256=wk6vel1ecJS4EZZ3U6Xue9OwDq-Tw8Pbvq_TRQz9eIQ,5
|
|
17
|
-
pdit-0.5.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|