"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3307,926],{85688:(e,t,a)=>{a.r(t),a.d(t,{MathJaxTypesetter:()=>o,default:()=>l});var n,s=a(82780),i=a(80757),r=a(449);!function(e){e.copy="mathjax:clipboard",e.scale="mathjax:scale"}(n||(n={}));class o{constructor(){this._initialized=!1}async _ensureInitialized(){this._initialized||(this._mathDocument=await c.ensureMathDocument(),this._initialized=!0)}async mathDocument(){return await this._ensureInitialized(),this._mathDocument}async typeset(e){try{await this._ensureInitialized()}catch(e){return void console.error(e)}this._mathDocument.options.elements=[e],this._mathDocument.clear().render(),delete this._mathDocument.options.elements,c.hardenAnchorLinks(e)}}const l={id:"@jupyterlab/mathjax-extension:plugin",description:"Provides the LaTeX mathematical expression interpreter.",provides:i.ILatexTypesetter,optional:[r.ITranslator],activate:(e,t)=>{const a=(null!=t?t:r.nullTranslator).load("jupyterlab"),s=new o;return e.commands.addCommand(n.copy,{execute:async()=>{const e=(await s.mathDocument()).outputJax;await navigator.clipboard.writeText(e.math.math)},label:a.__("MathJax Copy Latex"),describedBy:{args:{type:"object",properties:{}}}}),e.commands.addCommand(n.scale,{execute:async e=>{const t=await s.mathDocument(),a=e.scale||1;t.outputJax.options.scale=a,t.rerender();for(const e of t.math){const t=e.typesetRoot;t&&c.hardenAnchorLinks(t)}},label:e=>a.__("Mathjax Scale ")+(e.scale?`x${e.scale}`:a.__("Reset")),describedBy:{args:{type:"object",properties:{scale:{type:"number",description:a.__("The scale factor for MathJax rendering")}}}}}),s},autoStart:!0};var c;!function(e){let t=null;e.ensureMathDocument=async function(){if(!t){t=new s.PromiseDelegate,Promise.all([a.e(4371),a.e(2829),a.e(7259)]).then(a.t.bind(a,7259,23));const[{mathjax:e},{CHTML:n},{TeX:i},{TeXFont:r},{AllPackages:o},{SafeHandler:l},{HTMLHandler:c},{browserAdaptor:h},{AssistiveMmlHandler:d}]=await Promise.all([a.e(6074).then(a.bind(a,46074)),Promise.all([a.e(4371),a.e(4875),a.e(4486),a.e(6305)]).then(a.t.bind(a,16305,23)),Promise.all([a.e(4371),a.e(2829),a.e(7393),a.e(225)]).then(a.t.bind(a,70225,23)),Promise.all([a.e(4486),a.e(614)]).then(a.t.bind(a,84486,23)),Promise.all([a.e(4371),a.e(2829),a.e(7393),a.e(1996)]).then(a.bind(a,91996)),a.e(2121).then(a.t.bind(a,42121,23)),Promise.all([a.e(4371),a.e(4875),a.e(2772),a.e(2296)]).then(a.t.bind(a,22296,23)),a.e(7245).then(a.bind(a,7245)),Promise.all([a.e(4371),a.e(4875),a.e(2772),a.e(5992)]).then(a.t.bind(a,25992,23))]);e.handlers.register(d(l(new c(h()))));class u extends r{}u.defaultFonts={};const m=new n({font:new u}),p=new i({packages:o.concat("require"),inlineMath:[["$","$"],["\\(","\\)"]],displayMath:[["$$","$$"],["\\[","\\]"]],processEscapes:!0,processEnvironments:!0}),_=e.document(window.document,{InputJax:p,OutputJax:m});t.resolve(_)}return t.promise},e.hardenAnchorLinks=function(e){e.querySelectorAll(".MathJax a").forEach((e=>{const t=(e.rel||"").split(/\s+/).filter((e=>e.length>0));t.includes("noopener")||t.push("noopener"),e.rel=t.join(" "),"_blank"!==e.target&&(e.target="_blank")}))}}(c||(c={}))}}]);