/**
 * Copyright 2024 The Pennsylvania State University
 * @license Apache-2.0, see License.md for full text.
 */
import{LitElement as e,html as t,css as i}from"../../lit/index.js";import{ESGlobalBridgeStore as a}from"../es-global-bridge/es-global-bridge.js";class LaTex extends e{constructor(){super(),this.hydrated=!1,this.initialText=this.innerText,this.hydrateLaTeX()}hydrateLaTeX(){a.import("latex2html5",new URL("./lib/latex2html5.js",import.meta.url).href).then((()=>{setTimeout((()=>{globalThis.LaTeX2HTML5&&globalThis.LaTeX2HTML5.init()}),0)}))}static get styles(){let e=[];return super.styles&&(e=super.styles),[...e,i`
        :host {
          display: block;
        }
        /* LaTeX2JS */
        div,
        svg {
          -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        }

        .pspicture {
          position: relative;
          margin: auto;
        }

        .enumerate {
          list-style: circle;
          padding: 12px;
        }

        span.tt {
          font-family: courier;
        }

        p.quotation {
          padding: 0 0 0 15px;
          margin: 0 0 20px;
          font-size: 10pt;
        }

        .nicebox {
          margin-top: 20px;
          min-height: 20px;
          padding: 19px;
          margin-bottom: 20px;
          background-color: #f5f5f5;
          border: 1px solid #e3e3e3;
          -webkit-border-radius: 4px;
          -moz-border-radius: 4px;
          border-radius: 4px;
          -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
          -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
          box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
        }

        .latex-container {
          max-width: 870px;
          margin-right: auto;
          margin-left: auto;
          zoom: 1;
        }

        @media (min-width: 768px) and (max-width: 979px) {
          .latex-container {
            width: 724px;
          }
        }

        @media (max-width: 767px) {
          .latex-container {
            width: auto;
          }
        }

        pre {
          overflow: auto;
        }
      `]}static get properties(){return{hydrated:{type:Boolean,reflect:!0},initialText:{type:String}}}render(){return t`<div class="wrapper"></div>`}static get tag(){return"la-tex"}haxHooks(){return{preProcessNodeToContent:"haxpreProcessNodeToContent",editModeChanged:"haxeditModeChanged",activeElementChanged:"haxactiveElementChanged"}}async haxpreProcessNodeToContent(e){return e.innerHTML=this.initialText,e.hydrated=!1,e}haxactiveElementChanged(e,t){return this.innerHTML=this.initialText,this.hydrated=!1,e}haxeditModeChanged(e){this.innerHTML=this.initialText,this.hydrated=!1,setTimeout((()=>{this.hydrateLaTeX()}),0)}static get haxProperties(){return new URL(`./lib/${this.tag}.haxProperties.json`,import.meta.url).href}}customElements.define(LaTex.tag,LaTex);export{LaTex};