text: /**
   * Copyright 2019 PSU
   * @license Apache-2.0, see License.md for full text.
   */
  import{LitElement as e,html as t,css as i}from"../../lit-element/lit-element.js";class GlossaryTerm extends e{static get styles(){return[i`
          :host {
            display: inline-block;
          }
  
          :host([hidden]) {
            display: none;
          }
  
          lrn-vocab {
            display: inline;
          }
        `]}render(){return t` ${this._fallback?t`<slot></slot>`:`\n<lrn-vocab term="${this.display}">\n  <div>${this.definition}</div>\n</lrn-vocab>\n`}`}static get haxProperties(){return{canScale:!0,canPosition:!0,canEditSource:!0,gizmo:{title:"Glossary term",description:"",icon:"icons:android",color:"green",groups:["Term"],handles:[{type:"todo:read-the-docs-for-usage"}],meta:{author:"heyMP",owner:"PSU"}},settings:{configure:[{property:"name",description:"",inputMethod:"textfield",required:!1,icon:"icons:android"},{property:"definition",description:"",inputMethod:"textfield",required:!1,icon:"icons:android"},{property:"display",description:"",inputMethod:"textfield",required:!1,icon:"icons:android"}],advanced:[]}}}static get properties(){return{...super.properties,name:{name:"name",type:String,value:"",reflectToAttribute:!1},definition:{name:"display",type:String,value:"",reflectToAttribute:!1},display:{name:"display",type:String,value:"",reflectToAttribute:!1},serviceType:{name:"serviceType",type:String,value:"file"},endpoint:{name:"endpoint",type:String,value:""},_fallback:{name:"_fallback",type:Boolean,value:!0,reflectToAttribute:!1,observer:!1}}}constructor(){super(),this.name="",this.definition="",this.display="",this.serviceType="file",this.endpoint="",this._fallback=!0,import("../lrn-vocab/lrn-vocab.js")}updated(e){e.forEach((e,t)=>{["endpoint","serviceType"].includes(t)&&this.__endpointMethodChanged(this.endpoint,this.serviceType)})}static get tag(){return"glossary-term"}__endpointMethodChanged(e,t){e&&("file"===t?fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{const t=e.terms.find(e=>e.name===this.name);t?(this.definition=t.definition,this._fallback=!1):this._fallback=!0}):"graphql"===t&&fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:`{ term(name: "${this.name}") { name definition } }`})}).then(e=>e.json()).then(e=>{try{this.definition=e.data.term.definition,this._fallback=!1}catch(e){}}))}}window.customElements.define(GlossaryTerm.tag,GlossaryTerm);export{GlossaryTerm};