text: define(["exports","require","../../../@polymer/polymer/polymer-element.js","../../../@polymer/polymer/lib/utils/render-status.js","../../simple-colors/simple-colors.js","./hax-shared-styles.js"],function(_exports,_require,_polymerElement,_renderStatus,_simpleColors,_haxSharedStyles){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.HaxPreferencesDialog=void 0,_require=babelHelpers.interopRequireWildcard(_require);class HaxPreferencesDialog extends _polymerElement.PolymerElement{constructor(){super(),new Promise((res,rej)=>_require.default(["../../../@polymer/iron-icon/iron-icon.js"],res,rej)),new Promise((res,rej)=>_require.default(["../../../@polymer/iron-icons/iron-icons.js"],res,rej)),new Promise((res,rej)=>_require.default(["../../../@polymer/paper-button/paper-button.js"],res,rej)),new Promise((res,rej)=>_require.default(["../../eco-json-schema-form/eco-json-schema-form.js"],res,rej)),new Promise((res,rej)=>_require.default(["../../eco-json-schema-form/lib/eco-json-schema-object.js"],res,rej)),new Promise((res,rej)=>_require.default(["../../../@polymer/app-layout/app-drawer/app-drawer.js"],res,rej)),document.body.addEventListener("hax-store-property-updated",this._haxStorePropertyUpdated.bind(this))}static get template(){return _polymerElement.html`
        <style include="simple-colors-shared-styles hax-shared-styles">
          :host {
            display: block;
          }
          iron-icon:not(:defined),
          paper-button:not(:defined),
          app-drawer:not(:defined) {
            display: none;
          }
          #dialog {
            z-index: 1000;
            margin-top: 56px;
          }
          #closedialog {
            float: right;
            top: 124px;
            right: 0;
            position: absolute;
            padding: 8px;
            margin: 0;
            color: var(--hax-color-text);
            background-color: transparent;
            width: 40px;
            height: 40px;
            min-width: unset;
          }
          .title {
            position: relative;
            padding: 16px;
            outline: 0;
            font-weight: 600;
            text-align: left;
            margin: 0;
            background-color: var(--hax-color-menu-heading-bg);
            font-size: 18px;
            line-height: 18px;
            font-family: "Noto Serif", serif;
            color: var(--hax-color-text);
          }
          app-drawer {
            --app-drawer-content-container: {
              background-color: #ffffff;
            }
            --app-drawer-width: 320px;
          }
          eco-json-schema-object {
            color: white;
            --eco-json-schema-object-form : {
              -ms-flex: unset;
              -webkit-flex: unset;
              flex: unset;
              -webkit-flex-basis: unset;
              flex-basis: unset;
            }
            --paper-checkbox-size: 16px;
            --paper-checkbox-checked-ink-color: --hax-color-accent1;
            --paper-checkbox-label: {
              font-size: 16px;
              line-height: 16px;
            }
          }
          .pref-container {
            text-align: left;
            padding: 16px;
          }
        </style>
        <app-drawer id="dialog" align="right" transition-duration="300">
          <h3 class="title">[[title]]</h3>
          <div style="height: 100%; overflow: auto;" class="pref-container">
            <eco-json-schema-object
              schema="[[schema]]"
              value="{{preferences}}"
            ></eco-json-schema-object>
          </div>
          <paper-button id="closedialog" on-click="close">
            <iron-icon icon="icons:cancel" title="Close dialog"></iron-icon>
          </paper-button>
        </app-drawer>
      `}static get tag(){return"hax-preferences-dialog"}static get properties(){return{title:{type:String,value:"Preferences"},schema:{type:Object},preferences:{type:Object,notify:!0}}}static get observers(){return["_preferencesChanged(preferences.*)"]}ready(){super.ready();var schema={$schema:"http://json-schema.org/schema#",title:"HAX preferences",type:"object",properties:{haxShowExportButton:{title:"View source button",type:"boolean",value:!0},haxRayMode:{title:"X-Ray vision",type:"boolean",value:!1},haxDeveloperMode:{title:"Developer mode",type:"boolean",value:!1},haxVoiceCommands:{title:"Voice commands",type:"boolean",value:!1},haxGithubReport:{title:"Report issue",type:"string",value:!1,component:{name:"a",properties:{rel:"noopener",style:"color: #81a3a9;font-size: 18px;top: 100vh;position: fixed;right: 0;padding: 16px;font-style: italic;",id:"reportghissue",href:"https://github.com/elmsln/lrnwebcomponents/issues/new?body=URL%20base:%20"+window.location.pathname+"&title=[hax] Bug%20report%20from%20preference%20panel",target:"_blank"},slot:"Report an issue with HAX"}}}};this.set("schema",{}),this.set("schema",schema),this.dispatchEvent(new CustomEvent("hax-register-preferences",{bubbles:!0,cancelable:!0,composed:!0,detail:this})),(0,_renderStatus.afterNextRender)(this,function(){this.updateStyles()})}_haxStorePropertyUpdated(e){e.detail&&void 0!==e.detail.value&&e.detail.property&&"globalPreferences"===e.detail.property&&e.detail.owner!==this&&("object"==typeof e.detail.value&&this.set("preferences",{}),this.set("preferences",e.detail.value),this.notifyPath("preferences.*"))}_preferencesChanged(details){this.schema&&this.schema.properties&&window.HaxStore.ready&&window.HaxStore.write("globalPreferences",details.base,this)}toggleDialog(){if(this.shadowRoot.querySelector("#dialog").opened)this.close();else{window.HaxStore.instance.closeAllDrawers(this);var schema=this.schema;for(var key in this.preferences)this.schema.properties[key].value=this.preferences[key];this.set("schema",{}),this.set("schema",schema)}}open(){this.shadowRoot.querySelector("#dialog").open()}close(){this.shadowRoot.querySelector("#dialog").close()}}_exports.HaxPreferencesDialog=HaxPreferencesDialog,window.customElements.define(HaxPreferencesDialog.tag,HaxPreferencesDialog)});