text: !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@lrnwebcomponents/rich-text-editor/rich-text-editor.js"),require("@lrnwebcomponents/code-editor/code-editor.js"),require("@lrnwebcomponents/grid-plate/grid-plate.js"),require("lit-element/lit-element.js"),require("@lrnwebcomponents/hax-body/lib/hax-toolbar.js"),require("@lrnwebcomponents/simple-toolbar/lib/simple-toolbar-menu-item.js"),require("@lrnwebcomponents/media-behaviors/media-behaviors.js"),require("@lrnwebcomponents/simple-toast/simple-toast.js"),require("@lrnwebcomponents/hal-9000/hal-9000.js"),require("@lrnwebcomponents/simple-popover/lib/simple-tour.js"),require("@lrnwebcomponents/utils/utils.js"),require("mobx"),require("@lrnwebcomponents/hax-body-behaviors/hax-body-behaviors.js"),require("@lrnwebcomponents/i18n-manager/lib/I18NMixin.js"),require("@lrnwebcomponents/simple-toolbar/lib/simple-toolbar-menu.js"),require("@lrnwebcomponents/hax-body/lib/hax-ui-styles.js"),require("@lrnwebcomponents/hax-body/lib/hax-toolbar-item.js"),require("@lrnwebcomponents/simple-icon/lib/simple-icon-lite.js"),require("@lrnwebcomponents/simple-popover/lib/SimpleTourFinder"),require("@lrnwebcomponents/hax-iconset/lib/simple-hax-iconset.js"),require("@lrnwebcomponents/hax-body/lib/hax-toolbar-menu.js"),require("@lrnwebcomponents/hax-body/lib/hax-context-item.js"),require("@lrnwebcomponents/hax-body/lib/hax-context-item-textop.js"),require("@lrnwebcomponents/utils/utils"),require("@lrnwebcomponents/simple-colors/simple-colors.js"),require("@lrnwebcomponents/undo-manager/undo-manager.js")):"function"==typeof define&&define.amd?define(["exports","@lrnwebcomponents/rich-text-editor/rich-text-editor.js","@lrnwebcomponents/code-editor/code-editor.js","@lrnwebcomponents/grid-plate/grid-plate.js","lit-element/lit-element.js","@lrnwebcomponents/hax-body/lib/hax-toolbar.js","@lrnwebcomponents/simple-toolbar/lib/simple-toolbar-menu-item.js","@lrnwebcomponents/media-behaviors/media-behaviors.js","@lrnwebcomponents/simple-toast/simple-toast.js","@lrnwebcomponents/hal-9000/hal-9000.js","@lrnwebcomponents/simple-popover/lib/simple-tour.js","@lrnwebcomponents/utils/utils.js","mobx","@lrnwebcomponents/hax-body-behaviors/hax-body-behaviors.js","@lrnwebcomponents/i18n-manager/lib/I18NMixin.js","@lrnwebcomponents/simple-toolbar/lib/simple-toolbar-menu.js","@lrnwebcomponents/hax-body/lib/hax-ui-styles.js","@lrnwebcomponents/hax-body/lib/hax-toolbar-item.js","@lrnwebcomponents/simple-icon/lib/simple-icon-lite.js","@lrnwebcomponents/simple-popover/lib/SimpleTourFinder","@lrnwebcomponents/hax-iconset/lib/simple-hax-iconset.js","@lrnwebcomponents/hax-body/lib/hax-toolbar-menu.js","@lrnwebcomponents/hax-body/lib/hax-context-item.js","@lrnwebcomponents/hax-body/lib/hax-context-item-textop.js","@lrnwebcomponents/utils/utils","@lrnwebcomponents/simple-colors/simple-colors.js","@lrnwebcomponents/undo-manager/undo-manager.js"],t):t((e=e||self).HaxBody={},e.$$0,null,null,e.litElement_js,null,null,null,e.$$2,e.$$1,e.simpleTour_js,e.utils_js,e.mobx,e.haxBodyBehaviors_js,e.I18NMixin_js,e.simpleToolbarMenu_js,e.haxUiStyles_js,e.haxToolbarItem_js,null,e.SimpleTourFinder,null,null,null,null,e.utils,e.simpleColors_js,e.undoManager_js)}(this,function(e,t,n,o,i,a,r,s,l,c,d,u,h,p,m,v,x,g,b,f,y,w,k,_,N,E,S){"use strict";function T(e){return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function C(e,t,n,o,i,a,r){try{var s=e[a](r),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(o,i)}function A(e){return function(){var t=this,n=arguments;return new Promise(function(o,i){var a=e.apply(t,n);function r(e){C(a,o,i,r,s,"next",e)}function s(e){C(a,o,i,r,s,"throw",e)}r(void 0)})}}function L(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function H(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function M(e,t,n){return t&&H(e.prototype,t),n&&H(e,n),e}function R(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function z(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?P(Object(n),!0).forEach(function(t){R(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function I(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)}function O(e){return(O=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function B(e,t){return(B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function D(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function j(e,t,n){return(j=D()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var i=new(Function.bind.apply(e,o));return n&&B(i,n.prototype),i}).apply(null,arguments)}function q(e){var t="function"==typeof Map?new Map:void 0;return(q=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return j(e,arguments,O(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),B(o,e)})(e)}function U(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function V(e){var t=D();return function(){var n,o,i,a=O(e);if(t){var r=O(this).constructor;n=Reflect.construct(a,arguments,r)}else n=a.apply(this,arguments);return o=this,!(i=n)||"object"!=typeof i&&"function"!=typeof i?U(o):i}}function G(e,t,n){return(G="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var o=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=O(e)););return e}(e,t);if(o){var i=Object.getOwnPropertyDescriptor(o,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function F(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function W(e){return function(e){if(Array.isArray(e))return Y(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||X(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function X(e,t){if(e){if("string"==typeof e)return Y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Y(e,t):void 0}}function Y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var J=function(e){I(n,q(HTMLElement));var t=V(n);function n(){var e;return L(this,n),(e=t.call(this)).eventName="hax-register-app",e}return M(n,[{key:"connectedCallback",value:function(){"undefined"!==T(this.data)&&("string"==typeof this.data&&(this.data=JSON.parse(this.data)),this.dispatchEvent(new CustomEvent(this.eventName,{bubbles:!0,composed:!0,cancelable:!1,detail:this.data})))}}],[{key:"tag",get:function(){return"hax-app"}}]),n}();window.customElements.define(J.tag,J);var K=function(e){I(n,J);var t=V(n);function n(){var e;return L(this,n),(e=t.call(this)).eventName="hax-register-stax",e}return M(n,null,[{key:"tag",get:function(){return"hax-stax"}}]),n}();function $(){var e=F([" <slot></slot> "]);return $=function(){return e},e}window.customElements.define(K.tag,K),h.configure({enforceActions:!1,useProxies:"ifavailable"});var Q=function(e){I(n,m.I18NMixin(u.winEventsElement(p.HAXElement(i.LitElement))));var t=V(n);function n(){var e;L(this,n),(e=t.call(this)).t={close:"Close"},e.registerLocalization({context:U(e),namespace:"hax",basePath:("undefined"==typeof document?new(require("url").URL)("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("hax-body.umd.js",document.baseURI).href)+"/../../",locales:["es"]}),e.method="GET",e.haxSelectedText="",e.__winEvents={"hax-register-properties":"_haxStoreRegisterProperties","hax-consent-tap":"_haxConsentTap","hax-context-item-selected":"_haxContextOperation",onbeforeunload:"_onBeforeUnload",paste:"_onPaste","hax-register-app":"_haxStoreRegisterApp","hax-register-stax":"_haxStoreRegisterStax","hax-store-write":"_writeHaxStore","hax-register-core-piece":"_haxStorePieceRegistrationManager","hax-register-body":"_haxStoreRegisterBody","hax-insert-content":"_haxStoreInsertContent","hax-insert-content-array":"_haxStoreInsertMultiple","hax-add-voice-command":"_addVoiceCommand"},window.onbeforeunload=function(t){if(!e.skipExitTrap&&e.editMode){var n="Are you sure you want to leave? Your work will not be saved!";return t.returnValue=n,n}},d.SimpleTourManager.registerNewTour({key:"hax",name:"Let's learn HAX",style:"\n      simple-popover-manager::part(simple-popover) {\n        max-width: 250px;\n      }\n      simple-popover-manager button {\n        font-size: 12px;\n        margin: 0px 2px;\n      }\n      simple-popover-manager p {\n        --hax-base-styles-p-font-size: 14px;\n        padding: 0;\n        margin: 0;\n        font-size: 14px;\n        line-height: 20px;\n      }\n      simple-popover-manager h3 {\n        --hax-base-styles-h3-font-size: 18px;\n        margin: 8px 2px;\n      }"}),e.voiceRespondsTo="(worker)",e.voiceCommands={},e.skipHAXConfirmation=!1,e.storageData={},e.appStore={url:"",params:{}},e.activeNode=null,e.activeEditingElement=null,e.haxBodies=[],e.activePlaceHolder=null,e.sessionObject={},e.editMode=!1,e.skipExitTrap=!1,e.elementList={},e.appList=[],e.gizmoList=[],e.activeHaxBody=null,e.staxList=[],e.globalPreferences={},e.activeApp={},e.connectionRewrites={},e.voiceDebug=!1,e.keyboardShortcuts={"#":{tag:"h2",content:""},"##":{tag:"h3",content:""},"###":{tag:"h4",content:""},"####":{tag:"h5",content:""},"#####":{tag:"h6",content:""},"-":{tag:"ul",content:"<li></li>"},"1.":{tag:"ol",content:"<li></li>"},"---":{tag:"hr"},"```":{tag:"code",content:""},">":{tag:"blockquote",content:""}},e.validTagList=e.__validTags(),e.validGridTagList=e.__validGridTags(),e.validGizmoTypes=e.__validGizmoTypes();var o=document.createElement("webview");return e._isSandboxed="function"==typeof o.reload,Promise.resolve(l).then(function(){window.SimpleToast.requestAvailability()}),document.body.style.setProperty("--hax-ui-headings","#d4ff77"),h.makeObservable(U(e),{gizmoList:h.observable,activeNode:h.observable,globalPreferences:h.observable,activeGizmo:h.computed,editMode:h.observable,appList:h.observable,activeApp:h.observable,haxSelectedText:h.observable,activeEditingElement:h.observable,activeHaxBody:h.observable}),h.autorun(function(){e._globalPreferencesChanged(h.toJS(e.globalPreferences))}),h.autorun(function(){e._editModeChanged(h.toJS(e.editMode))}),e}return M(n,[{key:"testHook",value:function(e,t){return e&&"function"==typeof e.haxHooks&&e.haxHooks()[t]}},{key:"runHook",value:function(){var e=A(regeneratorRuntime.mark(function e(t,n){var o,i=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o=i.length>2&&void 0!==i[2]?i[2]:[],!this.testHook(t,n)){e.next=5;break}return e.next=4,t[t.haxHooks()[n]].apply(t,W(o));case 4:return e.abrupt("return",e.sent);case 5:return e.abrupt("return",!1);case 6:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()},{key:"getSelection",value:function(){if(this.activeHaxBody&&this.activeHaxBody.parentNode){if(this.activeHaxBody.parentNode.getSelection)return this.activeHaxBody.parentNode.getSelection();try{if(u.getRange(this.activeHaxBody.parentNode))return u.getRange(this.activeHaxBody.parentNode)}catch(e){}}return window.getSelection()}},{key:"getRange",value:function(){var e=this.getSelection();return e.getRangeAt&&e.rangeCount?e.getRangeAt(0):e||void 0}},{key:"guessGizmo",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=[];if("undefined"!==T(e)&&this.validGizmoTypes.includes(e))for(var a in this.gizmoList){var r=this.gizmoList[a],s={},l=!1;if(r&&r.handles)for(var c=0;c<r.handles.length;c++)if(e===r.handles[c].type||"*"===e&&!l){for(var d in r.handles[c])"type"!==d&&"undefined"!==T(t[d])&&("inline"!==e&&r.meta&&(!r.meta||r.meta.inlineOnly||r.meta.hidden)||(l=!0,s[r.handles[c][d]]=t[d]));if(l||n){if(o&&r.handles[c].type_exclusive)return[this.haxElementPrototype(r,s,"")];i.push(this.haxElementPrototype(r,s,""))}}}return i}},{key:"insertLogicFromValues",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=this.guessGizmoType(e),i=o,a=!0;if("*"==o){if(n)return!1;a=!1,i="link"}var r=this.guessGizmo(o,e,!1,a);return r.length>0?(1===r.length?"undefined"!==T(r[0].tag)&&t.dispatchEvent(new CustomEvent("hax-insert-content",{bubbles:!0,cancelable:!0,composed:!0,detail:r[0]})):this.haxAppPicker.presentOptions(r,o,"Pick how to present this "+i,"gizmo"),!0):(this.toast("Sorry, HAX doesn't know how to handle that type of link yet."),!1)}},{key:"write",value:function(e,t,n){n&&n.dispatchEvent(new CustomEvent("hax-store-write",{composed:!0,bubbles:!0,cancelable:!1,detail:{property:e,value:t,owner:n}}))}},{key:"mimeTypeToGizmoType",value:function(e){var t=e.split("/");switch(t[0]){case"audio":return"audio";case"image":return"svg+xml"==t[1]?"svg":"image";case"video":return"video";case"text":return["csv","html","markdown"].includes(t[1])?t[1]:"document";case"application":return"pdf"==t[1]?"pdf":["zip","gzip","x-tar"].includes(t[1])?"archive":"document"}}},{key:"guessGizmoType",value:function(e){if("undefined"!==T(e.source)){var t=e.source.toLowerCase();if(-1!=t.indexOf(".mp3")||-1!=t.indexOf(".midi")||-1!=t.indexOf(".mid"))return"audio";if(-1!=t.indexOf(".png")||-1!=t.indexOf(".jpg")||-1!=t.indexOf(".jpeg")||-1!=t.indexOf(".gif"))return"image";if(-1!=t.indexOf(".pdf"))return"pdf";if(-1!=t.indexOf(".svg"))return"svg";if(-1!=t.indexOf(".csv"))return"csv";if(-1!=t.indexOf(".md"))return"markdown";if(-1!=t.indexOf(".html")||-1!=t.indexOf(".htm"))return"html";if(-1!=t.indexOf(".txt")||-1!=t.indexOf(".doc")||-1!=t.indexOf(".docx")||-1!=t.indexOf(".xls")||-1!=t.indexOf(".xlsx")||-1!=t.indexOf(".vtt")||-1!=t.indexOf(".ppt"))return"document";if(-1!=t.indexOf(".zip")||-1!=t.indexOf(".tar.gz")||-1!=t.indexOf(".tar"))return"archive";if("external"!=window.MediaBehaviors.Video.getVideoType(t))return"video"}return"*"}},{key:"render",value:function(){return i.html($())}},{key:"toast",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2e3,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"capsule",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.t.close,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;window.dispatchEvent(new CustomEvent("simple-toast-show",{bubbles:!0,composed:!0,cancelable:!0,detail:{text:e,duration:t,classStyle:n,closeText:o,eventCallback:i}}))}},{key:"_storageDataChanged",value:function(e){e&&this.ready&&this.__storageDataProcessed&&(window.localStorage.getItem("haxConfirm")?window.localStorage.setItem("haxUserData",JSON.stringify(e)):window.sessionStorage.getItem("haxConfirm")&&window.sessionStorage.setItem("haxUserData",JSON.stringify(e)))}},{key:"isTextElement",value:function(e){var t;return null!=e&&e.tagName?t=e.tagName.toLowerCase():null!=e&&e.tag&&(t=e.tag.toLowerCase()),!!(t&&this.validTagList.includes(t)&&["p","ol","ul","li","a","h1","h2","h3","h4","h5","h6","strike","u","b","sub","sup","span","i","bold","em","strong","blockquote","code","figure"].includes(t))}},{key:"isGridPlateElement",value:function(e){var t;return e&&e.tagName?t=e.tagName.toLowerCase():e&&e.tag&&(t=e.tag.toLowerCase()),!(!t||!this.validGridTagList.includes(t))}},{key:"_appStoreChanged",value:function(e,t){e&&t&&(e.url&&!e.apps&&this.shadowRoot?this.loadAppStoreFromRemote():this.__appStoreData=e)}},{key:"_loadAppStoreData",value:function(e){if(null!=e){var t={};if("undefined"!==T(e.autoloader))for(var n in e.autoloader=Object.assign({},e.autoloader),e.autoloader){var o=n,i=e.autoloader[n];isNaN(o)||(o=e.autoloader[n],i="@lrnwebcomponents/".concat(o,"/").concat(o,".js")),"string"!=typeof i&&(i.haxProperties&&this.setHaxProperties(e.autoloader[n].haxProperties,o),i=e.autoloader[n].import),this.validTagList.push(o),t[o]=i}if("undefined"!==T(e.apps)){var a=e.apps;for(n=0;n<a.length;n++){var r=document.createElement("hax-app");r.data=a[n],this.appendChild(r)}}if("undefined"!==T(e.stax)){var s=e.stax;for(n=0;n<s.length;n++){var l=document.createElement("hax-stax");l.data=s[n],this.appendChild(l)}}this.dispatchEvent(new CustomEvent("hax-store-app-store-loaded",{bubbles:!0,cancelable:!0,composed:!0,detail:!0})),this._handleDynamicImports(t,this.haxAutoloader),this.__appStoreHasLoaded=!0}}},{key:"pathFromUrl",value:function(e){return e.substring(0,e.lastIndexOf("/")+1)}},{key:"_handleDynamicImports",value:function(){var e=A(regeneratorRuntime.mark(function e(t,n){var o,i,a=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:o=this.pathFromUrl(decodeURIComponent("undefined"==typeof document?new(require("url").URL)("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("hax-body.umd.js",document.baseURI).href)),e.t0=regeneratorRuntime.keys(t);case 2:if((e.t1=e.t0()).done){e.next=12;break}if(i=e.t1.value,!window.customElements.get(i)){e.next=8;break}window.customElements.get(i).haxProperties?this.setHaxProperties(window.customElements.get(i).haxProperties,i):n.appendChild(document.createElement(i)),e.next=10;break;case 8:return e.next=10,import("".concat(o,"../../../").concat(t[i])).then(function(e){window.customElements.get(i)&&window.customElements.get(i).haxProperties?a.setHaxProperties(window.customElements.get(i).haxProperties,i):n.appendChild(document.createElement(i))}).catch(function(e){console.warn(e),n.appendChild(document.createElement(i))});case 10:e.next=2;break;case 12:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()},{key:"_editModeChanged",value:function(e){this.__hal&&(e&&this.globalPreferences.haxVoiceCommands?this.__hal.auto=!0:this.__hal.auto=!1),e&&!this.__appStoreHasLoaded&&this.__appStoreData&&this.haxAutoloader&&(clearTimeout(this.__readyToProcessAppStoreData),this._loadAppStoreData(this.__appStoreData))}},{key:"_globalPreferencesChanged",value:function(){var e=A(regeneratorRuntime.mark(function e(t){var n,o=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.__storageDataProcessed&&t&&"undefined"!==T(t.haxVoiceCommands)&&this.ready&&((n=this.storageData).globalPreferences=t,this.storageData=n,this._storageDataChanged(this.storageData),t.haxVoiceCommands&&!this.__hal&&Promise.resolve(c).then(function(e){o._initVoiceCommands(),o.__hal=document.createElement("hal-9000"),o.__hal.respondsTo=o.voiceRespondsTo,o.__hal.debug=o.voiceDebug,o.__hal.auto=!0,o.shadowRoot.appendChild(o.__hal),o.__hal.commands=z({},o.voiceCommands)}),this.__hal&&(t.haxVoiceCommands&&this.editMode?this.__hal.auto=!0:this.__hal.auto=!1),t.haxLang&&Z.editMode&&(clearTimeout(this._debounceLang),this._debounceLang=setTimeout(A(regeneratorRuntime.mark(function e(){var t,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=regeneratorRuntime.keys(o.elementList);case 1:if((e.t1=e.t0()).done){e.next=10;break}return t=e.t1.value,n=o.elementList[t],e.next=6,o.attemptGizmoTranslation(t,n);case 6:n=e.sent,o.elementList[t]=n,e.next=1;break;case 10:o.gizmoList.forEach(function(e){o.elementList[e.tag].gizmo.title&&(e.title=o.elementList[e.tag].gizmo.title),o.elementList[e.tag].gizmo.description&&(e.description=o.elementList[e.tag].gizmo.description)});case 11:case"end":return e.stop()}},e)})),100)));case 1:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_haxContextOperation",value:function(e){var t=this,n=e.detail;if(this.activeNode){var o=!1;switch(n.eventName){case"hax-align-left":this.activeNode.style.float=null,this.activeNode.style.margin=null,this.activeNode.style.display=null,o=!0;break;case"hax-align-center":this.activeNode.style.float=null,this.activeNode.style.margin="0 auto",this.activeNode.style.display="block",o=!0;break;case"hax-align-right":this.activeNode.style.float="right",this.activeNode.style.margin="0 auto",this.activeNode.style.display="block",o=!0;break;case"hax-size-change":100==n.value?this.activeNode.style.width=null:this.activeNode.style.width=n.value+"%",o=!0}o&&(clearTimeout(this.__repositionMenu),this.__repositionMenu=setTimeout(function(){t.activeHaxBody.positionContextMenus()},0))}}},{key:"_haxConsentTap",value:function(e){window.localStorage.setItem("haxConfirm",!0),window.localStorage.setItem("haxUserData",JSON.stringify(this.storageData))}},{key:"updated",value:function(e){var t=this;G(O(n.prototype),"updated",this)&&G(O(n.prototype),"updated",this).call(this,e),e.forEach(function(e,n){"appStore"==n&&t[n]&&t._appStoreChanged(t[n],e),["ready","__appStoreData","haxAutoloader"].includes(n)&&t.ready&&t.__appStoreData&&t.haxAutoloader&&(clearTimeout(t.__readyToProcessAppStoreData),t.__readyToProcessAppStoreData=setTimeout(function(){t._loadAppStoreData(t.__appStoreData)},0)),["haxAutoloader","activeHaxBody","haxTray"].includes(n)&&(clearTimeout(t.__storeReady),t.__storeReady=setTimeout(function(){t._storePiecesAllHere(t.haxAutoloader,t.activeHaxBody,t.haxTray,t.haxExport)},0))})}},{key:"_calculateActiveGizmo",value:function(e){if(null==e||!e.tagName)return null;for(var t in this.gizmoList){var n=this.gizmoList[t];if(n.tag===e.tagName.toLowerCase())return n}}},{key:"loadAppStoreFromRemote",value:function(){var e=this,t=new URLSearchParams(this.appStore.params),n=this.appStore.url;t&&(n+="?".concat(t)),fetch(n,{method:this.method}).then(function(e){if(e.ok)return e.json()}).then(function(t){e.__appStoreData=t})}},{key:"firstUpdated",value:function(e){var t=this;if(G(O(n.prototype),"firstUpdated",this)&&G(O(n.prototype),"firstUpdated",this).call(this,e),this.skipHAXConfirmation&&(window.sessionStorage.setItem("haxConfirm",!0),window.localStorage.setItem("haxConfirm",!0)),window.sessionStorage.getItem("haxConfirm")||window.localStorage.getItem("haxConfirm"))if(window.sessionStorage.getItem("haxConfirm")&&!window.localStorage.getItem("haxConfirm"))try{var o=window.sessionStorage.getItem("haxUserData")?JSON.parse(window.sessionStorage.getItem("haxUserData")):{};this.storageData=o,this._storageDataChanged(this.storageData)}catch(e){}else try{var i=window.localStorage.getItem("haxUserData")?JSON.parse(window.localStorage.getItem("haxUserData")):{};this.storageData=i,this._storageDataChanged(this.storageData)}catch(e){}else{window.sessionStorage.setItem("haxConfirm",!0);this.toast("\n    The HAX content editor keeps preferences in order to improve your experience.\n    This data is stored in your browser and is never sent anywhere.\n    Click to accept.\n    ","-1","fit-bottom","I Accept","hax-consent-tap")}setTimeout(function(){t.__storageDataProcessed=!0,t.storageData.globalPreferences&&t.write("globalPreferences",t.storageData.globalPreferences,t)},0)}},{key:"_storePiecesAllHere",value:function(e,t,n,o){!this.ready&&t&&e&&n&&o&&(this.dispatchEvent(new CustomEvent("hax-store-ready",{bubbles:!0,cancelable:!1,composed:!0,detail:!0})),Z.haxExport.shadowRoot.querySelector("#dialog").associateEvents(n.shadowRoot.querySelector("#exportbtn")),this.ready=!0,this._buildPrimitiveDefinitions())}},{key:"_initVoiceCommands",value:function(){var e=this;this.__voiceInit=!0,this.voiceCommands["scroll up ".concat(this.voiceRespondsTo)]=function(){window.scrollBy({top:-.5*window.innerHeight,left:0,behavior:"smooth"})},this.voiceCommands["scroll (down) ".concat(this.voiceRespondsTo)]=function(){window.scrollBy({top:.5*window.innerHeight,left:0,behavior:"smooth"})},this.voiceCommands["scroll to bottom ".concat(this.voiceRespondsTo)]=function(){window.scrollTo(0,document.body.scrollHeight)},this.voiceCommands["scroll to top ".concat(this.voiceRespondsTo)]=function(){window.scrollTo(0,0)},this.voiceCommands["".concat(this.voiceRespondsTo," (show)(focus) active (element)(content)")]=function(){try{e._positionCursorInNode(e.activeNode)}catch(e){}},this.voiceCommands["".concat(this.voiceRespondsTo," (focus) previous (element)(content)")]=function(){e.activeNode.previousElementSibling?(e.activeNode=e.activeNode.previousElementSibling,e.write("activeNode",e.activeNode,e),e._positionCursorInNode(e.activeNode)):e.speak("You are at the top of the document")},this.voiceCommands["".concat(this.voiceRespondsTo," (focus) next (element)(content)")]=function(){e.activeNode.nextElementSibling?(e.activeNode=e.activeNode.nextElementSibling,e.write("activeNode",e.activeNode,e),e._positionCursorInNode(e.activeNode)):e.speak("You are at the bottom of the document")},this.voiceCommands["".concat(this.voiceRespondsTo," type *mycontent")]=function(t){if(e.isTextElement(e.activeNode))try{var n=e._positionCursorInNode(e.activeNode),o=document.createTextNode(t);n.deleteContents(),n.insertNode(o)}catch(t){e.speak("That didn't work"),console.warn(t)}else e.speak("I'm sorry but I can only type in text areas. Try saying Insert Paragraph and try again.")},this.voiceCommands["hey ".concat(this.voiceRespondsTo)]=function(){e.speak("Yeah what do you want")},this.voiceCommands["".concat(this.voiceRespondsTo," now your name is *splat")]=function(t){var n=e.voiceRespondsTo;e.speak("I used to be named ".concat(n," but you can call me ").concat(t," now.")),e.voiceRespondsTo="(".concat(t,")")}}},{key:"speak",value:function(e){this.__hal&&this.__hal.speak&&this.__hal.speak(e),this.toast("".concat(this.voiceRespondsTo,": ").concat(e))}},{key:"addVoiceCommand",value:function(e,t,n){t&&(e=e.replace(":name:",this.voiceRespondsTo).toLowerCase(),this.voiceCommands[e]=t[n].bind(t),this.__voiceInit&&(this.__hal.commands=z({},this.voiceCommands)))}},{key:"_addVoiceCommand",value:function(e){var t=e.detail.context;t||(t=e.target),this.addVoiceCommand(e.detail.command,t,e.detail.callback)}},{key:"_positionCursorInNode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.activeHaxBody.positionContextMenus();var n=document.createRange(),o=this.getSelection();return n.setStart(e,t),n.collapse(!0),o.removeAllRanges(),o.addRange(n),n}},{key:"_onBeforeUnload",value:function(e){if(!this.skipExitTrap&&this.editMode)return"Are you sure you want to leave? Your work will not be saved!"}},{key:"isBase64",value:function(e){try{return btoa(atob(e))==e}catch(e){return!1}}},{key:"retrieveImageFromClipboardAsBlob",value:function(e,t){if(0==e.clipboardData&&"function"==typeof t)return t(void 0);var n=e.clipboardData.items;if(null==n&&"function"==typeof t)return t(void 0);for(var o=0;o<n.length;o++)if(-1!=n[o].type.indexOf("image")){var i=n[o].getAsFile();if("function"==typeof t)return t(i)}}},{key:"_onPaste",value:function(){var e=A(regeneratorRuntime.mark(function e(t){var n,o,i,a,r,s,l,c,d,h,p,m,v,x,g,b,f,y=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.editMode||"HAX-TRAY"===document.activeElement.tagName||"BODY"===document.activeElement.tagName||"SIMPLE-MODAL"===document.activeElement.tagName){e.next=76;break}if(this.isTextElement(this.activeNode)||(this.activeNode=this.activeHaxBody.haxInsert("p","",{})),n="",o="",t.clipboardData||t.originalEvent.clipboardData?""==(n=(t.originalEvent||t).clipboardData.getData("text/html"))&&(n=(t.originalEvent||t).clipboardData.getData("text")):window.clipboardData&&(n=window.clipboardData.getData("Text")),o=n,!this.isBase64(o)){e.next=13;break}return t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),e.abrupt("return",this.retrieveImageFromClipboardAsBlob(t,function(e){if(e){var n=window.URL||window.webkitURL,o=document.createElement("img");for(var i in o.src=n.createObjectURL(e),y.activeNode.parentNode.insertBefore(o,y.activeNode.nextElementSibling),t.clipboardData.items)!t.clipboardData.items[i].name&&t.clipboardData.items[i].type&&(t.clipboardData.items[i].name="image-"+Math.floor(Date.now()/1e3)+t.clipboardData.items[i].type.replace("image/","."));return t.dataTransfer=t.clipboardData,t.placeHolderElement=o,y.dispatchEvent(new CustomEvent("place-holder-file-drop",{bubbles:!0,cancelable:!0,composed:!0,detail:t})),o}return!1}));case 13:if(t.clipboardData.files.length>0){for(a in t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),i=this.activeHaxBody.haxInsert("p","",{}),t.dataTransfer=t.clipboardData,t.clipboardData.files)!t.clipboardData.files[a].name&&t.clipboardData.files[a].type&&(t.clipboardData.files[a].name="image-"+Math.floor(Date.now()/1e3)+t.clipboardData.files[a].type.replace("image/","."));t.placeHolderElement=i,this.dispatchEvent(new CustomEvent("place-holder-file-drop",{bubbles:!0,cancelable:!0,composed:!0,detail:t}))}case 14:if(r=!1,s="",n=(n=(n=n.replace(/<span>\s*?<\/span>/g," ")).replace(/<div/g,"<p")).replace(/<\/div>/g,"</p>"),n=u.stripMSWord(n),0!==(l=this.htmlToHaxElements(n)).length||!u.validURL(n)){e.next=29;break}if(""==this.activeNode.innerText.trim()){e.next=24;break}return e.abrupt("return",!1);case 24:if(c={source:n,title:n},this.insertLogicFromValues(c,this)){e.next=27;break}return e.abrupt("return",!1);case 27:e.next=72;break;case 29:if(0!==l.length){e.next=38;break}if(r=!0,o==n){e.next=35;break}s=n,e.next=36;break;case 35:return e.abrupt("return",!1);case 36:e.next=72;break;case 38:if(1!==l.length||"p"!==l[0].tag){e.next=43;break}s=n,r=!0,e.next=72;break;case 43:if(1!==l.length||"a"!==l[0].tag||!l[0].properties.href){e.next=54;break}if(""==this.activeNode.innerText.trim()){e.next=49;break}s=l[0].properties.href,r=!0,e.next=52;break;case 49:if(d={source:l[0].properties.href,title:l[0].content},this.insertLogicFromValues(d,this)){e.next=52;break}return e.abrupt("return",!1);case 52:e.next=72;break;case 54:if(this.isGridPlateElement(l[0])){e.next=58;break}return e.abrupt("return",!1);case 58:e.t0=regeneratorRuntime.keys(l);case 59:if((e.t1=e.t0()).done){e.next=72;break}return a=e.t1.value,"p"==l[a].tag&&["li","ol","ul"].includes(this.activeNode.tagName.toLowerCase())&&(l[a].tag="li"),delete l[a].properties.style,delete l[a].properties.start,delete l[a].properties.align,h=u.haxElementToNode({tag:l[a].tag,content:l[a].content.replace(/<span>&nbsp;<\/span>/g," ").trim(),properties:l[a].properties}),e.t2=s,e.next=69,this.nodeToContent(h);case 69:s=e.t2+=e.sent,e.next=59;break;case 72:t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation();try{if(p=this.getRange(),m=this.getSelection(),(v=document.createElement("div")).innerHTML=s,p&&m){for(a in v.children)v.children[a].tagName&&this.isTextElement(v.children[a])&&""===v.children[a].innerHTML&&v.children[a].remove();if(r)x=document.createTextNode(v.innerHTML),p.insertNode(x),setTimeout(function(){y._positionCursorInNode(x,x.length)},0);else{for(""!=this.activeNode.innerText.trim()&&p.endOffset!=this.activeNode.innerText.length&&(g=!0,document.execCommand("insertParagraph")),p.commonAncestorContainer&&p.commonAncestorContainer.parentNode&&(f||this.activeNode==p.commonAncestorContainer||(f=p.commonAncestorContainer.parentNode)||(f=p.commonAncestorContainer));v.firstElementChild;)b=v.firstElementChild,f?(f.getAttribute&&f.getAttribute("slot")&&b.setAttribute("slot",f.getAttribute("slot")),g?(this.activeHaxBody.haxReplaceNode(f.previousElementSibling,b),g=!1):f.parentNode.insertBefore(b,f.nextElementSibling)):this.activeNode?(this.activeNode.getAttribute("slot")&&b.setAttribute("slot",this.activeNode.getAttribute("slot")),""==this.activeNode.innerText.trim()?this.activeHaxBody.haxReplaceNode(this.activeNode,b):this.activeNode.parentNode.insertBefore(b,this.activeNode.nextElementSibling)):this.activeHaxBody.appendChild(b),f=b;setTimeout(function(){b&&b.childNodes&&b.childNodes[0]&&(y._positionCursorInNode(b.childNodes[0],b.childNodes[0].length),b=null,f=null)},0)}}}catch(e){console.warn(e)}case 76:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"__validGridTags",value:function(){return["p","ol","ul","li","div","h1","h2","h3","h4","h5","h6","blockquote","code","figure"]}},{key:"__validTags",value:function(){return["p","div","span","table","caption","sup","sub","u","strike","tr","th","td","ol","ul","li","a","strong","kbd","tt","em","i","b","hr","h1","h2","h3","h4","h5","h6","blockquote","code","figure","img","iframe","video","audio","section","grid-plate","template","webview"]}},{key:"__validGizmoTypes",value:function(){return["data","video","audio","text","link","file","pdf","image","csv","doc","archive","markdown","html","content","text","inline","*"]}}],[{key:"tag",get:function(){return"hax-store"}},{key:"properties",get:function(){return z(z({},G(O(n),"properties",this)),{},{voiceDebug:{type:Boolean,attribute:"voice-debug"},voiceRespondsTo:{type:String,attribute:"voice-responses-to"},skipHAXConfirmation:{type:Boolean,reflect:!0,attribute:"skip-hax-confirmation"},storageData:{type:Object},haxTray:{type:Object},haxAutoloader:{type:Object},haxBodies:{type:Array},activePlaceHolder:{type:Object},appStore:{type:Object},sessionObject:{type:Object},skipExitTrap:{type:Boolean},elementList:{type:Object},staxList:{type:Array},validTagList:{type:Array},validGridTagList:{type:Array},validGizmoTypes:{type:Array},_isSandboxed:{type:Boolean},__appStoreData:{type:Object},ready:{type:Boolean},connectionRewrites:{type:Object}})}}]),M(n,[{key:"_buildPrimitiveDefinitions",value:function(){if(this._isSandboxed){this.setHaxProperties({type:"element",editingElement:"core",canScale:!0,canPosition:!0,canEditSource:!0,settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this video.",inputMethod:"textfield",icon:"link",required:!0,validationType:"url"}],advanced:[]}},"webview")}this.setHaxProperties({type:"element",editingElement:"core",canScale:!0,canPosition:!0,canEditSource:!0,gizmo:{title:"Basic iframe",description:"A basic iframe",icon:"icons:fullscreen",color:"blue-grey",groups:["Content"],handles:[{type:"link",source:"src",height:"height",width:"width"},{type:"pdf",source:"src",height:"height",width:"width"},{type:"document",source:"src",height:"height",width:"width"},{type:"html",source:"src",height:"height",width:"width"}],meta:{author:"W3C"}},settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this video.",inputMethod:"textfield",icon:"link",required:!0,validationType:"url"}],advanced:[{attribute:"loading",title:"Loading method",description:"Whether or not to lazy load this",inputMethod:"select",options:{lazy:"Load when visible",auto:"Automatic"}}]}},"iframe");this.setHaxProperties({canScale:{min:10,step:5},type:"element",editingElement:"core",canPosition:!0,canEditSource:!0,gizmo:{title:"Image",description:"A basic img tag",icon:"image:image",color:"blue-grey",groups:["Image","Media"],handles:[{type:"link",source:"src"},{type:"image",type_exclusive:!0,source:"src",height:"height",width:"width"}],meta:{author:"W3C"}},settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this video.",inputMethod:"haxupload",icon:"link",required:!0,validationType:"url"},{attribute:"alt",title:"Alt text",description:"Useful for screen readers and improved SEO.",inputMethod:"alt",icon:"accessibility"},{attribute:"height",title:"Height",description:"height in pixels of the item. Leave blank to respond to the natural resolution",inputMethod:"textfield",icon:"icons:swap-vert"}],advanced:[{attribute:"aria-describedby",title:"Aria-describedby",description:"Space-separated list of IDs for elements that describe the image.",inputMethod:"textfield",icon:"accessibility"},{attribute:"loading",title:"Loading method",description:"Whether or not to lazy load this",inputMethod:"select",options:{lazy:"Load when visible",auto:"Automatic"}}]}},"img");var e={type:"element",editingElement:"core",canScale:!1,canPosition:!1,canEditSource:!0,contentEditable:!0,gizmo:{title:"Basic link",description:"A basic a tag",icon:"icons:link",color:"blue-grey",groups:["Link"],handles:[],meta:{author:"W3C"}},settings:{configure:[{attribute:"innerText",title:"Text",description:"Text of the link",inputMethod:"textfield",required:!0},{attribute:"href",title:"Link",description:"The URL for this video.",inputMethod:"haxupload",icon:"icons:link",required:!0,validationType:"url"},{attribute:"title",title:"Title text",description:"Useful for screen readers and improved SEO.",inputMethod:"textfield",icon:"icons:accessibility"},{attribute:"target",title:"Target",description:"Where to place the link.",inputMethod:"select",icon:"icons:launch",options:{"":"Same window",_blank:"New window",_top:"Top window",_parent:"Parent window"}}],advanced:[]}};this.validGizmoTypes.forEach(function(t){e.gizmo.handles.push({type:t,source:"href",title:"innerText",alt:"title"})}),this.setHaxProperties(e,"a");this.setHaxProperties({type:"element",editingElement:"core",canScale:!1,canPosition:!1,canEditSource:!0,contentEditable:!0,gizmo:{title:"Paragraph",description:"A basic text area",icon:"hax:paragraph",color:"blue-grey",groups:["Content"],handles:[{type:"content",content:""}],meta:{author:"W3C"}},settings:{configure:[],advanced:[]},demoSchema:[{tag:"p",content:"Text",properties:{}}]},"p");this.setHaxProperties({type:"element",editingElement:{tag:"editable-table",import:"@lrnwebcomponents/editable-table/editable-table.js"},canScale:!0,canPosition:!0,canEditSource:!0,gizmo:{title:"Table",description:"A table for displaying data",icon:"image:grid-on",color:"blue-grey",groups:["Content","Table","Data"],meta:{author:"W3C"}},settings:{configure:[],advanced:[]},demoSchema:[{tag:"table",content:"<tr><td>-</td><td>-</td><td>-</td></tr><tr><td>-</td><td>-</td><td>-</td></tr><tr><td>-</td><td>-</td><td>-</td></tr>",properties:{}}]},"table");var t={caption:{title:"Caption",icon:"av:call-to-action"},video:{title:"Video",icon:"av:play-circle-filled"},audio:{title:"Audio",icon:"image:music-note"},section:{title:"Section",icon:"image:crop-landscape"},ol:{title:"Numbered list",icon:"editor:format-list-numbered"},ul:{title:"Bulleted list",icon:"editor:format-list-bulleted"},li:{title:"List item",icon:"editor:format-list-bulleted"},h1:{title:"Heading",icon:"hax:h1"},h2:{title:"Heading",icon:"hax:h2"},h3:{title:"Heading",icon:"hax:h3"},h4:{title:"Heading",icon:"hax:h4"},h5:{title:"Heading",icon:"hax:h5"},h6:{title:"Heading",icon:"hax:h6"},strike:{title:"Cross out",icon:"editor:format-strikethrough"},u:{title:"Underline",icon:"editor:format-underlined"},sub:{title:"Subscript",icon:"mdextra:subscript"},sup:{title:"Superscript",icon:"mdextra:superscript"},div:{title:"DIV",icon:"image:crop-landscape"},span:{title:"SPAN",icon:"editor:short-text"},i:{title:"Italic",icon:"editor:format-italic"},em:{title:"Emphasis",icon:"editor:format-italic"},strong:{title:"Bold",icon:"editor:format-bold"},b:{title:"Bold",icon:"editor:format-bold"},blockquote:{title:"Block quote",icon:"editor:format-quote"},code:{title:"Code",icon:"icons:code"},figure:{title:"Figure",icon:"icons:label-outline"},embed:{title:"Embedded object",icon:"icons:fullscreen"}};for(var n in t)this.setHaxProperties({type:"element",editingElement:"core",canScale:!1,canPosition:!1,canEditSource:!0,contentEditable:!0,gizmo:{title:t[n].title,icon:t[n].icon,meta:{hidden:"h2"!=n}},settings:{configure:[],advanced:[]},demoSchema:[{tag:n,content:"h2"==n?"Heading":"",properties:{}}]},n);this.setHaxProperties({canScale:{min:25,step:25},type:"element",editingElement:"core",canPosition:!1,canEditSource:!1,contentEditable:!0,gizmo:{title:"Horizontal line",icon:"hax:hr",meta:{author:"W3C"}},settings:{configure:[],advanced:[]},demoSchema:[{tag:"hr",content:"",properties:{style:"width:50%;"}}]},"hr")}},{key:"_haxStorePieceRegistrationManager",value:function(e){e.detail&&e.detail.piece&&e.detail.object&&(this[e.detail.piece]=e.detail.object)}},{key:"setupAutocomplete",value:function(e){var t=this;e.triggers={"!":function(e){var n=[];return t.gizmoList.forEach(function(e){n.push({groups:e.groups&&e.groups.length?e.groups.join(" "):"",icon:e.icon,label:e.title,value:e.tag})}),n}}}},{key:"_haxStoreInsertContent",value:function(){var e=A(regeneratorRuntime.mark(function e(t){var n,o,i,a,r,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.detail){e.next=13;break}if(n=t.detail,!window.customElements.get(n.tag)){e.next=8;break}if(o=document.createElement(n.tag),!this.testHook(o,"preProcessInsertContent")){e.next=8;break}return e.next=7,this.runHook(o,"preProcessInsertContent",[n]);case 7:n=e.sent;case 8:i={},"undefined"!==T(n.properties)&&(i=n.properties),i.innerHTML&&(""==n.content&&(n.content=i.innerHTML),delete i.innerHTML),i.innerText&&(""==n.content&&(n.content=i.innerText),delete i.innerText),"undefined"!==T(n.__type)&&"inline"===n.__type?(a=u.haxElementToNode({tag:n.tag,content:n.content,properties:i}),null!==this.activePlaceHolder&&(this.activePlaceHolder.deleteContents(),this.activePlaceHolder.insertNode(a)),this.activePlaceHolder=null):n.replace||n.replacement||n.nextToActive?(r=u.haxElementToNode({tag:n.tag,content:n.content,properties:i}),this.activePlaceHolder?(this.activeHaxBody.haxReplaceNode(this.activePlaceHolder,r),this.activePlaceHolder=null):n.nextToActive&&this.activeNode?this.activeHaxBody.__slot&&"GRID-PLATE"===this.activeNode.tagName?this.activeNode.appendChild(r):this.activeNode.parentNode.insertBefore(r,this.activeNode):this.activeHaxBody.haxReplaceNode(this.activeNode,r)):this.activeNode.parentNode&&"HAX-BODY"!=this.activeNode.parentNode.tagName?(s=u.haxElementToNode({tag:n.tag,content:n.content,properties:i}),"GRID-PLATE"===this.activeNode.parentNode.tagName?(null!=this.activeNode.getAttribute("slot")&&s.setAttribute("slot",this.activeNode.getAttribute("slot")),this.activeHaxBody.haxInsert(n.tag,n.content,i)):this.activeHaxBody.haxInsert(n.tag,n.content,i)):this.activeHaxBody.haxInsert(n.tag,n.content,i);case 13:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"haxSchemaFromTag",value:function(e){return e=e.toLowerCase(),this.elementList&&this.elementList[e]?this.elementList[e]:{}}},{key:"_haxStoreInsertMultiple",value:function(e){var t;if(e.detail)for(var n in e.detail)t={},"undefined"!==T(e.detail[n].properties)&&(t=e.detail[n].properties),this.activeHaxBody.haxInsert(e.detail[n].tag,e.detail[n].content,t)}},{key:"_haxStoreRegisterBody",value:function(e){e.detail&&(this.haxBodies.push(e.detail),this.activeHaxBody=e.detail,this.write("activeHaxBody",this.activeHaxBody,this),this.write("editMode",this.editMode,this))}},{key:"computePolyfillSafe",value:function(){return!(!document.head.createShadowRoot&&!document.head.attachShadow)||(console.warn("Shadow DOM missing, certain operations hidden"),!1)}},{key:"_writeHaxStore",value:function(e){e.detail&&"undefined"!==T(e.detail.value)&&e.detail.property&&e.detail.owner&&(e.detail.owner!==this&&(null==e.detail.value?this[e.detail.property]=null:"object"===T(e.detail.value)&&(this[e.detail.property]={}),this[e.detail.property]=e.detail.value),this.dispatchEvent(new CustomEvent("hax-store-property-updated",{bubbles:!0,composed:!0,cancelable:!1,detail:{property:e.detail.property,value:e.detail.value,owner:e.detail.owner}})))}},{key:"_haxStoreRegisterApp",value:function(e){if(e.detail){if(e.detail.index=this.appList.length,this.appList=[].concat(W(this.appList),[e.detail]),this.write("appList",this.appList,this),e.detail.connection&&e.detail.connection.protocol&&e.detail.connection.url){var t=document.createElement("link");t.rel="preconnect",t.href=e.detail.connection.protocol+"://"+e.detail.connection.url,document.head.appendChild(t)}"undefined"!==T(e.target.parentElement)&&"HAX-STORE"===e.target.parentElement.tagName&&e.target.parentElement.removeChild(e.target)}}},{key:"_haxStoreRegisterStax",value:function(e){e.detail&&(e.detail.index=this.staxList.length,this.staxList=[].concat(W(this.staxList),[e.detail]),this.write("staxList",this.staxList,this),"undefined"!==T(e.target.parentElement)&&"HAX-STORE"===e.target.parentElement.tagName&&e.target.parentElement.removeChild(e.target))}},{key:"dashToCamel",value:function(e){return e.replace(/-([a-z])/g,function(e){return e[1].toUpperCase()})}},{key:"htmlToHaxElements",value:function(){var e=A(regeneratorRuntime.mark(function e(t){var n,o,i,a,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=[],o=this.validTagList,(i=document.createElement("div")).innerHTML=t,a=i.childNodes,r=0;case 6:if(!(r<a.length)){e.next=16;break}if("undefined"===T(a[r].tagName)||!o.includes(a[r].tagName.toLowerCase())){e.next=13;break}return e.t0=n,e.next=11,u.nodeToHaxElement(a[r],null);case 11:e.t1=e.sent,e.t0.push.call(e.t0,e.t1);case 13:r++,e.next=6;break;case 16:return e.abrupt("return",n);case 17:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"nodeToContent",value:function(){var e=A(regeneratorRuntime.mark(function e(t){var n,o,i,a,r,s,l,c,d,h,p,m,v,x;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.testHook(t,"preProcessNodeToContent")){e.next=4;break}return e.next=3,this.runHook(t,"preProcessNodeToContent",[t]);case 3:t=e.sent;case 4:for(n=t.tagName.toLowerCase(),this._isSandboxed&&"webview"===n&&(n="iframe"),o="",o+="<"+n,i=this.elementList[n],a={},r=0,s=t.attributes.length;r<s;++r)l=t.attributes.item(r).nodeName,c=t.attributes.item(r).value,"style"==l||T(c)!==("undefined"==typeof Object?"undefined":T(Object))&&c.constructor!==Array?null!=c&&"null"!=c&&(!0===c||"true"===c?a[l]=!0:!1===c||("string"==typeof c&&""!==c?(c=c.replace(new RegExp('"',"g"),"&quot;"),a[l]=c):""===c?(""==c&&""!=t.attributes.item(r).value&&(c=t.attributes.item(r).value),a[l]=c):a[l]=c)):a[l]=JSON.stringify(c).replace(new RegExp('"',"g"),"&quot;");if(customElements.get(n)&&(d=customElements.get(n).properties),"undefined"===T(d)&&(d=t.__data),"undefined"!==T(d))for(r in d)l=u.camelToDash(r),c=null,"undefined"!==T(t[r])&&(c=t[r]),d[r].readOnly||d[r].computed||c===d[r].value||l.startsWith("__")||(null==c||"object"!==T(c)&&c.constructor!==Array?null!=c&&"null"!=c&&(!0===c||"true"===c?a[l]=!0:!1===c||("string"==typeof c&&""!==c?(c=c.replace(new RegExp('"',"g"),"&quot;"),a[l]=c):""===c?""==c&&""!=d[r].value?c=d[r].value:""===c&&d[r].value:a[l]=c)):c.constructor===Array&&c!=[]?a[l]=JSON.stringify(c).replace(new RegExp('"',"g"),"&quot;"):"object"===T(c)&&c!={}&&(a[l]=JSON.stringify(c).replace(new RegExp('"',"g"),"&quot;")));if("undefined"!==T(i)&&"undefined"!==T(i.saveOptions.unsetAttributes))for(h in i.saveOptions.unsetAttributes)delete a[i.saveOptions.unsetAttributes[h]];for(m in p=["inner-text","inner-html","tabindex","guestinstance"])"undefined"!==T(a[p[m]])&&delete a[p[m]];for(h in"undefined"!==T(a.id)&&""===a.id&&delete a.id,delete a.draggable,delete a.contenteditable,delete a["data-hax-ray"],""!=a.class&&"hax-active"!=a.class||delete a.class,a)!0===a[h]?o+=" "+h:o+=" "+h+'="'+a[h]+'"';if(["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"].includes(n)?o+="/>":o+=">","undefined"!==T(i)&&i.saveOptions.wipeSlot){e.next=47;break}if(!((v=t.childNodes).length>0)){e.next=47;break}r=0,x=v.length;case 29:if(!(r<x)){e.next=47;break}if("undefined"===T(v[r].tagName)){e.next=43;break}if(this.HTMLPrimativeTest(v[r].tagName)||"TEMPLATE"===v[r].tagName){e.next=38;break}return e.t0=o,e.next=35,this.nodeToContent(v[r]);case 35:o=e.t0+=e.sent,e.next=41;break;case 38:v[r].removeAttribute("data-hax-ray"),v[r].contentEditable=!1,o+=v[r].outerHTML;case 41:e.next=44;break;case 43:8===v[r].nodeType?o+="\x3c!-- "+v[r].textContent+" --\x3e":1!==v[r].nodeType&&"undefined"!==T(v[r].textContent)&&"undefined"!==v[r].textContent&&(o+=v[r].textContent);case 44:r++,e.next=29;break;case 47:if(!this.testHook(t,"progressiveEnhancement")){e.next=52;break}return e.t1=o,e.next=51,this.runHook(t,"progressiveEnhancement",[t]);case 51:o=e.t1+=e.sent;case 52:if("span"===n?o+="</"+n+">":"hr"===n||"br"===n||"img"===n||(o+="</"+n+">\n"),o=(o=(o=(o=(o=(o=(o=(o=(o=(o=(o=(o=(o=(o=(o=(o=(o=(o=(o=o.replace(/&nbsp;/gm," ")).replace(/ data-hax-ray="(\s|.)*?"/gim,"")).replace(/ class=""/gim,"")).replace(/ class="hax-active"/gim,"")).replace(/ contenteditable="(\s|.)*?"/gim,"")).replace(/<span style="(.*?)">/gim,"<span>")).replace(/<span>\s*?<\/span>/g," ")).replace(/<span><br\/><\/span>/gm,"")).replace(/<strong style="(.*?)">/gim,"<strong>")).replace(/<b style="(.*?)">/gim,"<b>")).replace(/<strike style="(.*?)">/gim,"<strike>")).replace(/<em style="(.*?)">/gim,"<em>")).replace(/<i style="(.*?)">/gim,"<i>")).replace(/<p>(\s*)<\/p>/gm,"<p></p>")).replace(/<p>&nbsp;<\/p>/gm,"<p></p>")).replace(/<p><br\/><\/p>/gm,"<p></p>")).replace(/<p><br><\/p>/gm,"<p></p>")).replace(/<\/p>(\s*)<p>/gm,"</p><p>")).split("\n\r").join("\n").split("\r").join("\n").split("\n\n").join("\n").split("\n\n").join("\n").split("\n\n").join("\n"),!this.testHook(t,"postProcessNodeToContent")){e.next=76;break}return e.next=75,this.runHook(t,"postProcessNodeToContent",[o]);case 75:o=e.sent;case 76:return e.abrupt("return",o);case 77:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"HTMLPrimativeTest",value:function(e){return"undefined"!==T(e.tagName)&&-1==e.tagName.indexOf("-")}},{key:"getHaxAppStoreTargets",value:function(e){return this.appList.filter(function(t){if("undefined"!==T(t.connection.operations.add)){var n=t.connection.operations.add;if("undefined"!==T(n.acceptsGizmoTypes)&&n.acceptsGizmoTypes.includes(e))return!0}return!1})}},{key:"refreshActiveNodeForm",value:function(){var e=A(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.nodeToHaxElement(this.haxTray.activeNode,null);case 2:this.haxTray.activeHaxElement=e.sent,this.haxTray._setupForm();case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"haxElementPrototype",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return{tag:e.tag,properties:t,content:n,gizmo:e}}},{key:"getHAXSlot",value:function(){var e=A(regeneratorRuntime.mark(function e(t){var n,o,i,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isTextElement(t)){e.next=2;break}return e.abrupt("return",t.innerHTML);case 2:if(n="",!((o=t.childNodes).length>0)){e.next=24;break}i=0,a=o.length;case 6:if(!(i<a)){e.next=24;break}if("undefined"===T(o[i].tagName)){e.next=20;break}if(!(o[i].tagName.indexOf("-")>0)){e.next=17;break}return e.t0=n,e.next=12,this.nodeToContent(o[i]);case 12:e.t1=e.sent,e.t2="  "+e.t1,n=e.t0+=e.t2+"\n",e.next=18;break;case 17:n+="  "+o[i].outerHTML+"\n";case 18:e.next=21;break;case 20:8===o[i].nodeType?n+="\x3c!-- "+o[i].textContent+" --\x3e":1!==o[i].nodeType&&"undefined"!==T(o[i].textContent)&&"undefined"!==o[i].textContent&&(n+=o[i].textContent);case 21:i++,e.next=6;break;case 24:return e.abrupt("return",n);case 25:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_haxStoreRegisterProperties",value:function(){var e=A(regeneratorRuntime.mark(function e(t){var n,o,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t.detail&&t.detail.properties&&t.detail.tag)){e.next=15;break}if(this.elementList[t.detail.tag]){e.next=14;break}if(!window.customElements.get(t.detail.tag)||!this.testHook(document.createElement(t.detail.tag),"gizmoRegistration")){e.next=5;break}return e.next=5,this.runHook(document.createElement(t.detail.tag),"gizmoRegistration",[this]);case 5:return n=t.detail,e.next=8,this.attemptGizmoTranslation(n.tag,n.properties);case 8:n.properties=e.sent,(o=n.properties.gizmo)&&(o.tag=n.tag,(i=this.gizmoList).push(o),this.gizmoList=W(i),this.write("gizmoList",i,this)),this.elementList[n.tag]=n.properties,this.validTagList.find(function(e){return e===n.tag})||this.validTagList.push(n.tag),"grid"!=n.properties.type||this.validGridTagList.find(function(e){return e===n.tag})||this.validGridTagList.push(n.tag);case 14:"undefined"!==T(t.target.parentElement)&&"HAX-AUTOLOADER"===t.target.parentElement.tagName&&this.haxAutoloader.removeChild(t.target);case 15:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"attemptGizmoTranslation",value:function(){var e=A(regeneratorRuntime.mark(function e(t,n){var o,i,a,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,m.I18NManagerStore.loadNamespaceFile(t+".haxProperties");case 2:if((o=e.sent)||"en"!=this.globalPreferences.haxLang||!window.customElements.get(t)||!window.customElements.get(t).haxProperties){e.next=9;break}if("string"!=typeof(o=window.customElements.get(t).haxProperties)){e.next=9;break}return e.next=8,fetch(o).then(function(e){return!(!e||!e.json)&&e.json()});case 8:o=e.sent;case 9:if(o){if(n.gizmo&&o.gizmo)for(i in o.gizmo)n.gizmo[i]=o.gizmo[i];if(n.settings&&o.settings)for(a in{advanced:"advanced",configure:"configure"})if(n.settings[a]&&o.settings[a])for(i in o.settings[a])for(r in o.settings[a][i])n.settings[a][i][r]=o.settings[a][i][r];if(n.demoSchema&&o.demoSchema)for(i in o.demoSchema)if(o.demoSchema[i].properties)for(r in o.demoSchema[i].properties)n.demoSchema[i].properties[r]=o.demoSchema[i].properties[r]}return e.abrupt("return",n);case 11:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()},{key:"activeGizmo",get:function(){var e=h.toJS(this._calculateActiveGizmo(this.activeNode));return this.write("activeGizmo",e,this),e}}]),n}();window.customElements.define(Q.tag,Q),window.HaxStore=window.HaxStore||{},window.HaxStore.requestAvailability=function(){return window.HaxStore.instance||(window.HaxStore.instance=document.createElement("hax-store"),document.body.appendChild(window.HaxStore.instance)),window.HaxStore.instance};var Z=window.HaxStore.requestAvailability();function ee(){var e=F(['\n        ::slotted([slot="menuitem"]) {\n          --simple-toolbar-button-justify: flex-start;\n          --simple-toolbar-button-label-white-space: nowrap;\n        }\n      ']);return ee=function(){return e},e}function te(){var e=F(['<slot name="menuitem"></slot>']);return te=function(){return e},e}window.Hax=window.Hax||{},window.Hax.add=function(e){if(Z.elementList[e]){var t,n=Z.haxSchemaFromTag(e);t=n.gizmo.tag&&n.demoSchema&&n.demoSchema[0]?u.haxElementToNode(n.demoSchema[0]):document.createElement(e),Z.activeHaxBody.haxReplaceNode(Z.activeNode,t),Z.activeHaxBody.__focusLogic(t)}else Z.toast("".concat(e," is not a valid tag"))},window.Hax.delete=function(){null!=Z.activeNode&&Z.activeHaxBody.haxDeleteNode(Z.activeNode)},window.Hax.duplicate=function(){Z.activeHaxBody.haxDuplicateNode(Z.activeNode)},window.Hax.move=function(){!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?Z.activeHaxBody.haxMoveGridPlate("up",Z.activeNode):Z.activeHaxBody.haxMoveGridPlate("down",Z.activeNode)},window.Hax.grid=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];Z.activeHaxBody.haxGridPlateOps(e)},window.Hax.set=function(e,t){Z.write(e,t,window)},window.Hax.get=function(e){return Z[e]},window.Hax.export=A(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Z.activeHaxBody.haxToContent();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)})),window.Hax.import=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"<p></p>";return Z.activeHaxBody.importContent(e)};var ne=function(e){I(n,v.SimpleToolbarMenuBehaviors(i.LitElement));var t=V(n);function n(){var e;return L(this,n),(e=t.call(this))._blockEvent=!1,e}return M(n,null,[{key:"styles",get:function(){return W(G(O(n),"styles",this))}}]),M(n,[{key:"listItemTemplate",get:function(){return i.html(te())}}],[{key:"simpleButtonThemeStyles",get:function(){return x.HaxButton}},{key:"simpleButtonCoreStyles",get:function(){return[].concat(W(G(O(n),"simpleButtonCoreStyles",this)),[i.css(ee())])}},{key:"tag",get:function(){return"hax-toolbar-menu"}},{key:"properties",get:function(){return z(z({},G(O(n),"properties",this)),{},{_blockEvent:{type:Boolean},eventName:{type:String,attribute:"event-name"}})}}]),n}();window.customElements.define(ne.tag,ne);var oe=function(e){I(n,g.HaxToolbarItemBehaviors(i.LitElement));var t=V(n);function n(){var e;return L(this,n),(e=t.call(this)).haxUIElement=!0,e.action=!1,e.more=!1,e.eventName="button",e.inputMethod=null,e.propertyToBind=null,e.slotToBind=null,e.value="",e}return M(n,[{key:"_handleMousedown",value:function(e){this.disabled||(Z._tmpSelection=Z.getSelection())}},{key:"_handleClick",value:function(e){this.disabled||this.dispatchEvent(new CustomEvent("hax-context-item-selected",{bubbles:!0,cancelable:!0,composed:!0,detail:{target:this,eventName:this.eventName,value:this.value}}))}}],[{key:"tag",get:function(){return"hax-context-item"}},{key:"properties",get:function(){return z(z({},G(O(n),"properties",this)),{},{more:{type:Boolean},action:{type:Boolean},label:{type:String,reflect:!0},inputMethod:{type:String,reflect:!0,attribute:"input-method"},propertyToBind:{type:String,reflect:!0,attribute:"property-to-bind"},slotToBind:{type:String,reflect:!0,attribute:"slot-to-bind"},description:{type:String,reflect:!0},default:{type:Boolean},value:{type:String}})}}]),n}();function ie(){var e=F(["<slot></slot> "]);return ie=function(){return e},e}function ae(){var e=F(["\n          :host {\n            display: block;\n            pointer-events: none;\n            --hax-ui-spacing-sm: 1px;\n          }\n          :host [hidden] {\n            display: none;\n          }\n          :host > * {\n            margin: 0 auto;\n          }\n          .selected-buttons {\n            transition: 0.1s all ease-in-out;\n            width: 0;\n          }\n          :host([has-selected-text]) .selected-buttons {\n            width: 100%;\n          }\n          :host(.hax-context-pin-top) #toolbar {\n            position: fixed;\n            top: 0px;\n          }\n          :host(:hover),\n          :host(:focus-within) {\n            z-index: var(--hax-ui-focus-z-index) !important;\n          }\n          .group {\n            padding: 0;\n          }\n          hax-toolbar {\n            flex: 0 1 auto;\n            border: none !important;\n          }\n          hax-toolbar[collapse-disabled]::part(morebutton) {\n            display: none !important;\n          }\n          hax-toolbar *[hidden] {\n            display: none !important;\n          }\n          hax-toolbar[collapse-disabled]::part(morebutton) {\n            display: none !important;\n          }\n        "]);return ae=function(){return e},e}window.customElements.define(oe.tag,oe);var re=function(e){return function(t){I(o,f.SimpleTourFinder(e));var n=V(o);function o(){return L(this,o),n.call(this)}return M(o,null,[{key:"styles",get:function(){return[i.css(ae())]}}]),M(o,[{key:"render",value:function(){return i.html(ie())}}],[{key:"tag",get:function(){return"hax-context-container"}}]),o}()},se=function(e){I(n,re(i.LitElement));var t=V(n);function n(){return L(this,n),t.apply(this,arguments)}return n}();function le(){var e=F(["\n        :host {\n          width: 176px;\n        }\n        hax-toolbar {\n          flex: 0 0 auto;\n        }\n        #remove {\n          max-width: 44px;\n          overflow: visible;\n        }\n      "]);return le=function(){return e},e}function ce(){var e=F(['\n      <div id="toolbar" class="area">\n        <hax-toolbar always-expanded>\n          <div class="group">\n            <hax-toolbar-menu\n              ?disabled="','"\n              id="drag"\n              action\n              icon="hax:arrow-all"\n              label="','"\n              draggable="true"\n              reset-on-select\n              data-simple-tour-stop\n              data-stop-title="label"\n            >\n              <simple-toolbar-menu-item slot="menuitem">\n                <hax-context-item\n                  action\n                  align-horizontal="left"\n                  ?disabled="','"\n                  show-text-label\n                  role="menuitem"\n                  icon="hax:keyboard-arrow-up"\n                  label="','"\n                  event-name="hax-plate-up"\n                ></hax-context-item>\n              </simple-toolbar-menu-item>\n              <simple-toolbar-menu-item slot="menuitem">\n                <hax-context-item\n                  action\n                  align-horizontal="left"\n                  ?disabled="','"\n                  role="menuitem"\n                  show-text-label\n                  icon="hax:keyboard-arrow-down"\n                  label="','"\n                  event-name="hax-plate-down"\n                ></hax-context-item>\n              </simple-toolbar-menu-item>\n              <div slot="tour" data-stop-content>\n                Click the drag handle once to show a menu to just move up or\n                down one item in the content OR click and drag to place the item\n                exactly where you want it to go.\n              </div>\n            </hax-toolbar-menu>\n          </div>\n          <div class="group">\n            <hax-context-item\n              action\n              id="right"\n              class="paddle"\n              icon="hax:table-column-remove"\n              label="','"\n              ?disabled="','"\n              event-name="hax-plate-create-right"\n              data-simple-tour-stop\n              data-stop-title="label"\n            >\n              <div slot="tour" data-stop-content>\n                Add a column to split the current column into two pieces. This\n                can be done up to six pieces columns. For differnet layouts see\n                Grid settings panel.\n              </div>\n            </hax-context-item>\n            <hax-context-item\n              action\n              class="paddle"\n              icon="hax:table-column-plus-after"\n              label="','"\n              ?disabled="','"\n              event-name="hax-plate-remove-right"\n              id="rightremove"\n              data-simple-tour-stop\n              data-stop-title="label"\n            >\n              <div slot="tour" data-stop-content>\n                Remove a column from the split column layout. If at two columns\n                and removing it will remove the layout split and make it 100%\n                width.\n              </div>\n            </hax-context-item>\n            <hax-context-item\n              action\n              ?disabled="','"\n              label="','"\n              icon="icons:content-copy"\n              event-name="hax-plate-duplicate"\n              data-simple-tour-stop\n              data-stop-title="label"\n            >\n              <div slot="tour" data-stop-content>\n                Duplicate the active piece of content and place it below the\n                current item.\n              </div>\n            </hax-context-item>\n          </div>\n          <div class="group">\n            <hax-toolbar-menu\n              id="remove"\n              action\n              ?disabled="','"\n              icon="delete"\n              label="','"\n              reset-on-select\n              data-simple-tour-stop\n              data-stop-title="label"\n            >\n              <simple-toolbar-menu-item slot="menuitem">\n                <hax-context-item\n                  action\n                  danger\n                  align-horizontal="left"\n                  ?disabled="','"\n                  show-text-label\n                  role="menuitem"\n                  icon="delete"\n                  label="','"\n                  event-name="hax-plate-delete"\n                ></hax-context-item>\n              </simple-toolbar-menu-item>\n              <div slot="tour" data-stop-content>\n                Delete the current item. You can always use the undo arrow to\n                bring this back.\n              </div>\n            </hax-toolbar-menu>\n          </div>\n        </hax-toolbar>\n      </div>\n    ']);return ce=function(){return e},e}window.customElements.define(se.tag,se);var de=function(e){I(n,m.I18NMixin(re(i.LitElement)));var t=V(n);function n(){var e;return L(this,n),(e=t.call(this)).hasActiveEditingElement=!1,e.haxUIElement=!0,e.tourName="hax",e.t={dragHandle:"Drag handle",moveUp:"Move up",moveDown:"Move down",addColumn:"Add column",removeColumn:"Remove column",remove:"Remove",duplicate:"Duplicate",confirmDelete:"Confirm delete"},e.registerLocalization({context:U(e),namespace:"hax"}),e}return M(n,[{key:"render",value:function(){return i.html(ce(),this.hasActiveEditingElement,this.t.dragHandle,this.hasActiveEditingElement,this.t.moveUp,this.hasActiveEditingElement,this.t.moveDown,this.t.addColumn,this.hasActiveEditingElement,this.t.removeColumn,this.hasActiveEditingElement,this.hasActiveEditingElement,this.t.duplicate,this.hasActiveEditingElement,this.t.remove,this.hasActiveEditingElement,this.t.confirmDelete)}},{key:"__updatePlatePosition",value:function(e){var t=this.shadowRoot.querySelector("#right"),n=this.shadowRoot.querySelector("#rightremove");t.disabled=!1,n.disabled=!1,e&&"GRID-PLATE"==e.tagName?"1-1-1-1-1-1"==e.layout&&(t.disabled=!0):n.disabled=!0}},{key:"firstUpdated",value:function(e){var t=this;G(O(n.prototype),"firstUpdated",this).call(this,e),h.autorun(function(){var e=h.toJS(Z.activeNode);e&&t.getAttribute("on-screen")&&t.__updatePlatePosition(e)}),h.autorun(function(){h.toJS(Z.activeEditingElement)?t.hasActiveEditingElement=!0:t.hasActiveEditingElement=!1}),this.shadowRoot.querySelector("#drag").addEventListener("dragstart",this._dragStart),this.shadowRoot.querySelector("#drag").addEventListener("dragend",this._dragEnd)}},{key:"_dragEnd",value:function(e){var t=u.normalizeEventPath(e)?u.normalizeEventPath(e)[0]:void 0;t&&t.close(!0),Z._lockContextPosition=!1}},{key:"_dragStart",value:function(e){var t=h.toJS(Z.activeNode),n=u.normalizeEventPath(e)?u.normalizeEventPath(e)[0]:void 0;n&&n.close(!0),Z.__dragTarget=t,Z._lockContextPosition=!0,Z.activeHaxBody.__activeHover=null,Z.activeHaxBody._hideContextMenu(Z.activeHaxBody.contextMenus.add),e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.dropEffect="move",e.dataTransfer.setDragImage(t,-20,-20)),e.stopPropagation(),e.stopImmediatePropagation()}}],[{key:"tag",get:function(){return"hax-plate-context"}},{key:"styles",get:function(){return[].concat(W(G(O(n),"styles",this)),[i.css(le())])}},{key:"properties",get:function(){return z(z({},G(O(n),"properties",this)),{},{hasActiveEditingElement:{type:Boolean}})}}]),n}();function ue(){var e=F([' <simple-toolbar-menu-item slot="menuitem">\n                    <hax-context-item-textop\n                      action\n                      align-horizontal="left"\n                      role="menuitem"\n                      icon="','"\n                      label="','"\n                      show-text-label\n                      ?hidden="','"\n                      event-name="','"\n                      show-text-label\n                      @click="','"\n                    ></hax-context-item-textop>\n                  </simple-toolbar-menu-item>']);return ue=function(){return e},e}function he(){var e=F(['\n      <div id="toolbar">\n        <hax-toolbar always-expanded>\n          <div class="group">\n            <hax-toolbar-menu\n              id="textformat"\n              icon="','"\n              label="Format"\n              show-text-label\n              data-simple-tour-stop\n              data-stop-title="label"\n            >\n              ','\n              <div slot="tour" data-stop-content>\n                Change how the text is structured and visualized in the page.\n              </div>\n            </hax-toolbar-menu>\n            \x3c!-- comment this in when rich-text-editor is viable --\x3e\n            \x3c!--\n            <hax-context-item\n              action\n              hidden\n              icon="icons:flip-to-back"\n              label="Full text editor"\n              event-name="hax-full-text-editor-toggle"\n            ></hax-context-item> --\x3e\n            <slot name="primary"></slot>\n          </div>\n          <div class="group">\n            <hax-context-item-textop\n              mini\n              action\n              icon="editor:format-list-bulleted"\n              event-name="text-tag-ul"\n              label="','"\n              ?hidden="','"\n            ></hax-context-item-textop>\n            <hax-context-item-textop\n              mini\n              action\n              icon="editor:format-list-numbered"\n              label="','"\n              event-name="text-tag-ol"\n              ?hidden="','"\n            ></hax-context-item-textop>\n            <hax-context-item-textop\n              mini\n              action\n              icon="editor:format-indent-decrease"\n              label="','"\n              event-name="text-outdent"\n              ?hidden="','"\n            ></hax-context-item-textop>\n            <hax-context-item-textop\n              mini\n              action\n              icon="editor:format-indent-increase"\n              label="','"\n              event-name="text-indent"\n              ?hidden="','"\n            ></hax-context-item-textop>\n          </div>\n          <div class="group" ?hidden="','">\n            <hax-context-item-textop\n              mini\n              action\n              icon="editor:format-bold"\n              label="','"\n              class="selected-buttons"\n              event-name="text-bold"\n              ?hidden="','"\n            ></hax-context-item-textop>\n            <hax-context-item-textop\n              mini\n              action\n              icon="editor:format-italic"\n              label="','"\n              class="selected-buttons"\n              event-name="text-italic"\n              ?hidden="','"\n            ></hax-context-item-textop>\n          </div>\n          <div class="group" ?hidden="','">\n            <hax-context-item-textop\n              mini\n              action\n              icon="editor:insert-link"\n              label="','"\n              class="selected-buttons"\n              event-name="text-link"\n              ?hidden="','"\n            ></hax-context-item-textop>\n            <hax-context-item-textop\n              mini\n              action\n              icon="mdextra:unlink"\n              label="','"\n              class="selected-buttons"\n              event-name="text-unlink"\n              ?hidden="','"\n            ></hax-context-item-textop>\n          </div>\n          <div class="group" ?hidden="','">\n            <hax-context-item-textop\n              mini\n              action\n              icon="editor:format-clear"\n              label="','"\n              class="selected-buttons"\n              event-name="text-remove-format"\n              ?hidden="','"\n            ></hax-context-item-textop>\n            <slot name="secondary"></slot>\n          </div>\n          <div class="group" ?hidden="','">\n            <hax-context-item-textop\n              action\n              menu\n              icon="editor:format-underlined"\n              label="','"\n              event-name="text-underline"\n              ?hidden="','"\n            ></hax-context-item-textop>\n            <hax-context-item-textop\n              action\n              menu\n              icon="editor:format-strikethrough"\n              event-name="text-strikethrough"\n              ?hidden="','"\n              label="','"\n            ></hax-context-item-textop>\n            <slot name="more"></slot>\n          </div>\n          <div class="group" ?hidden="','">\n            <hax-context-item-textop\n              action\n              menu\n              icon="mdextra:subscript"\n              event-name="text-subscript"\n              ?hidden="','"\n              label="','"\n            ></hax-context-item-textop>\n            <hax-context-item-textop\n              action\n              menu\n              icon="mdextra:superscript"\n              event-name="text-superscript"\n              ?hidden="','"\n              label="','"\n            ></hax-context-item-textop>\n          </div>\n          <div class="group" ?hidden="','">\n            <hax-context-item\n              mini\n              action\n              icon="hax:add-brick"\n              label="','"\n              class="selected-buttons"\n              event-name="insert-inline-gizmo"\n              ?hidden="','"\n            ></hax-context-item>\n            <hax-context-item-textop\n              mini\n              action\n              icon="hax:add-brick"\n              label="','"\n              class="selected-buttons"\n              event-name="insert-inline-gizmo"\n              ?hidden="','"\n            ></hax-context-item-textop>\n          </div>\n          <div class="group">\n            <hax-context-item\n              action\n              icon="icons:code"\n              label="','"\n              ?hidden="','"\n              event-name="hax-source-view-toggle"\n              toggles\n              ?toggled="','"\n              @click="','"\n            ></hax-context-item>\n          </div>\n          <div class="group">\n            <hax-toolbar-menu\n              icon="add"\n              label="','"\n            >\n              <simple-toolbar-menu-item slot="menuitem">\n                <hax-context-item\n                  action\n                  align-horizontal="left"\n                  role="menuitem"\n                  show-text-label\n                  icon="hardware:keyboard-arrow-up"\n                  event-name="insert-above-active"\n                  label="','"\n                ></hax-context-item>\n              </simple-toolbar-menu-item>\n              <simple-toolbar-menu-item slot="menuitem">\n                <hax-context-item\n                  action\n                  align-horizontal="left"\n                  role="menuitem"\n                  show-text-label\n                  icon="hardware:keyboard-arrow-down"\n                  event-name="insert-below-active"\n                  label="','"\n                ></hax-context-item>\n              </simple-toolbar-menu-item>\n            </hax-toolbar-menu>\n          </div>\n        </hax-toolbar>\n      </div>\n    ']);return he=function(){return e},e}function pe(){var e=F(["\n        #toolbar {\n          position: absolute;\n          bottom: 0;\n          width: 280px;\n        }\n        .group,\n        .group > * {\n          flex: 1 1 auto;\n        }\n      "]);return pe=function(){return e},e}window.customElements.define(de.tag,de);var me=function(e){I(n,m.I18NMixin(re(i.LitElement)));var t=V(n);function n(){var e;return L(this,n),(e=t.call(this)).t={modifyHTMLSource:"Modify HTML source",bulledList:"Bulleted list",numberedList:"Numbered list",indent:"Indent",outdent:"Outdent",bold:"Bold",italic:"Italic",link:"Link",removeLink:"Remove link",removeFormat:"Remove format",addElementToSelection:"Add element to selection",subscript:"Subscript",superscript:"Superscript",underline:"Underline",crossOut:"Cross out",insertItemAbove:"Insert item above",insertItemAboveOrBelow:"Insert item above or below",insertItemBelow:"Insert item below"},e.registerLocalization({context:U(e),namespace:"hax"}),e.sourceView=!1,e.haxUIElement=!0,e.tourName="hax",setTimeout(function(){e.addEventListener("hax-context-item-selected",e._haxContextOperation.bind(U(e))),window.addEventListener("hax-context-item-selected",e._haxInMenuContextOperation.bind(U(e)))},0),e.formattingList=[{value:"p",icon:"hax:paragraph",text:"Paragraph"},{value:"ul",icon:"editor:format-list-bulleted",text:"Bulleted list"},{value:"ol",icon:"editor:format-list-numbered",text:"Numbered list"},{value:"h2",icon:"hax:h2",text:"Title"},{value:"h3",icon:"hax:h3",text:"Content heading"},{value:"h4",icon:"hax:h4",text:"Subheading"},{value:"h5",icon:"hax:h5",text:"Deep subheading"},{value:"blockquote",icon:"editor:format-quote",text:"Blockquote"},{value:"code",icon:"icons:code",text:"Code"}],e.realSelectedValue="p",e.formatIcon="hax:paragraph",e.isSafari=e._isSafari(),h.autorun(function(){e.hasSelectedText=h.toJS(Z.haxSelectedText).length>0}),h.autorun(function(){h.toJS(Z.editMode);var t=h.toJS(Z.activeNode);if(e.viewSource=!1,t&&t.tagName){var n=Z.haxSchemaFromTag(t.tagName);e.sourceView=n.canEditSource}e.shadowRoot&&e.shadowRoot.querySelector("#textformat")&&(e.shadowRoot.querySelector("#textformat").collapsed=!0),t&&Z.isTextElement(t)&&e.shadowRoot.querySelector('button[event-name="'+t.tagName.toLowerCase()+'"]')?e.updateTextIconSelection(t.tagName.toLowerCase()):t&&"LI"===t.tagName&&e.shadowRoot.querySelector('button[event-name="'+t.parentNode.tagName.toLowerCase()+'"]')&&e.updateTextIconSelection(t.parentNode.tagName.toLowerCase())}),e}return M(n,null,[{key:"styles",get:function(){return[].concat(W(G(O(n),"styles",this)),[i.css(pe())])}}]),M(n,[{key:"render",value:function(){var e=this;return i.html(he(),this._formatIcon(this.realSelectedValue),this.formattingList.map(function(t){return i.html(ue(),t.icon,t.text,!e.sourceView,t.value,function(n){return e.textFormatChanged(t.value)})}),this.t.bulledList,!this._showLists,this.t.numberedList,!this._showLists,this.t.outdent,!this._showIndent,this.t.indent,!this._showIndent,!this.hasSelectedText,this.t.bold,!this.hasSelectedText,this.t.italic,!this.hasSelectedText,!this.hasSelectedText,this.t.link,!this.hasSelectedText,this.t.removeLink,!this.hasSelectedText,!this.hasSelectedText,this.t.removeFormat,!this.hasSelectedText,!this.hasSelectedText,this.t.underline,!this.hasSelectedText,!this.hasSelectedText,this.t.crossOut,!this.hasSelectedText,!this.hasSelectedText,this.t.subscript,!this.hasSelectedText,this.t.superscript,!this.hasSelectedText,this.t.addElementToSelection,this.isSafari||!this.hasSelectedText,this.t.addElementToSelection,!this.isSafari||!this.hasSelectedText,this.t.modifyHTMLSource,!this.sourceView,this.viewSource,function(t){return e.viewSource=!e.viewSource},this.t.insertItemAboveOrBelow,this.t.insertItemAbove,this.t.insertItemBelow)}},{key:"textFormatChanged",value:function(e){this.shadowRoot.querySelector("#textformat").collapsed=!0,this.updateTextIconSelection(e),this.dispatchEvent(new CustomEvent("hax-context-item-selected",{bubbles:!0,cancelable:!0,composed:!0,detail:{eventName:"text-tag",value:this.realSelectedValue}}))}},{key:"updateTextIconSelection",value:function(e){this.realSelectedValue=e;var t=this.shadowRoot.querySelector('button[event-name="'+this.realSelectedValue+'"]');t&&(this.formatIcon=t.icon)}},{key:"_formatIcon",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.realSelectedValue||"p";return this.textFormatLookup[e]||"hax:paragraph"}},{key:"updated",value:function(e){var t=this;e.forEach(function(e,n){"realSelectedValue"==n&&(t._showIndent=t._computeShowIndent(t.realSelectedValue),"p"==t.realSelectedValue?t._showLists=!0:t._showLists=!1),"hasSelectedText"==n&&t.dispatchEvent(new CustomEvent("hax-context-menu-changed",{bubbles:!0,cancelable:!0,composed:!0,detail:t}))})}},{key:"firstUpdated",value:function(e){G(O(n.prototype),"firstUpdated",this)&&G(O(n.prototype),"firstUpdated",this).call(this,e),h.toJS(Z.activeNode)&&h.toJS(Z.activeNode).tagName&&this.updateTextIconSelection(h.toJS(Z.activeNode).tagName.toLowerCase())}},{key:"_computeShowIndent",value:function(e){return!(!Z.computePolyfillSafe()||"li"!=e&&"ol"!=e&&"ul"!=e)}},{key:"_haxInMenuContextOperation",value:function(e){var t=!1;switch(e.detail.eventName){case"insert-above-active":case"insert-below-active":this.shadowRoot.querySelector("simple-popover-selection")&&(this.shadowRoot.querySelector("simple-popover-selection").opened=!1);break;case"text-underline":document.execCommand("underline"),t=!0;break;case"text-subscript":document.execCommand("subscript"),t=!0;break;case"text-superscript":document.execCommand("superscript"),t=!0;break;case"text-strikethrough":document.execCommand("strikeThrough"),t=!0}t&&(this.shadowRoot.querySelector("simple-popover-selection")&&this.shadowRoot.querySelector("simple-popover-selection").opened&&(this.shadowRoot.querySelector("simple-popover-selection").opened=!1),e.preventDefault(),e.stopPropagation())}},{key:"_haxContextOperation",value:function(e){var t=e.detail,n=Z.getSelection(),o=!1;switch(t.eventName){case"insert-inline-gizmo":if(Z._tmpSelection&&Z.editMode)try{"HAX-BODY"!==Z._tmpRange.startContainer.parentNode.parentNode.tagName&&"HAX-BODY"!==Z._tmpRange.startContainer.parentNode.parentNode.parentNode.tagName||(Z.activePlaceHolder=Z._tmpRange)}catch(e){}if(null!=Z.activePlaceHolder){var i={text:Z.activePlaceHolder.toString()},a=Z.guessGizmo("inline",i);a.length>0&&Z.haxAppPicker.presentOptions(a,"inline","Transform selected text to..","gizmo")}break;case"text-bold":document.execCommand("bold"),o=!0;break;case"text-italic":document.execCommand("italic"),o=!0;break;case"text-remove-format":document.execCommand("removeFormat"),o=!0;break;case"text-link":var r="";n&&n.focusNode&&n.focusNode.parentNode&&"undefined"!==T(n.focusNode.parentNode.href)&&(r=n.focusNode.parentNode.href);var s=prompt("Enter a URL:",r);s&&(document.execCommand("createLink",!1,s),n.focusNode.parentNode&&(n.focusNode.parentNode.setAttribute("contenteditable",!0),n.focusNode.parentNode.removeEventListener("click",function(e){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()}),n.focusNode.parentNode.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()})),o=!0);break;case"text-unlink":document.execCommand("unlink"),o=!0;break;case"text-indent":Z.activeHaxBody.__indentTrap=!0,document.execCommand("indent"),o=!0;break;case"text-outdent":Z.activeHaxBody.__indentTrap=!0,document.execCommand("outdent"),o=!0}o&&(e.preventDefault(),e.stopPropagation())}},{key:"_isSafari",value:function(){var e=navigator.userAgent.toLowerCase();return!(-1==e.indexOf("safari")||e.indexOf("chrome")>-1)}},{key:"textFormatLookup",get:function(){var e={};return this.formattingList.forEach(function(t){e[t.value]=t.icon}),e}}],[{key:"tag",get:function(){return"hax-text-context"}},{key:"properties",get:function(){return z(z({},G(O(n),"properties",this)),{},{_showIndent:{type:Boolean},_showLists:{type:Boolean},realSelectedValue:{type:String},sourceView:{type:Boolean},formattingList:{type:Array},hasSelectedText:{type:Boolean,attribute:"has-selected-text",reflect:!0},formatIcon:{type:String,attribute:"format-icon"},isSafari:{type:Boolean,attribute:"is-safari"},viewSource:{type:Boolean}})}}]),n}();function ve(){var e=F([' <hax-context-item\n                action\n                icon="','"\n                label="','"\n                event-name="hax-ce-custom-button"\n                value="','"\n              ></hax-context-item>']);return ve=function(){return e},e}function xe(){var e=F(['\n      <div id="toolbar">\n        <hax-toolbar>\n          <div class="group">\n            <hax-context-item\n              action\n              more\n              .icon="','"\n              label="','..."\n              tooltip="',", ",'"\n              ?disabled="','"\n              event-name="hax-transform-node"\n              show-text-label\n            ></hax-context-item>\n            <slot name="primary"></slot>\n          </div>\n          <div class="group">\n            ','\n            <slot name="secondary"></slot>\n          </div>\n          <div class="group">\n            <hax-context-item\n              action\n              icon="icons:code"\n              label="','"\n              ?disabled="','"\n              event-name="hax-source-view-toggle"\n              toggles\n              ?toggled="','"\n              @click="','"\n            ></hax-context-item>\n            <slot name="more"></slot>\n          </div>\n          <div class="group">\n            <hax-toolbar-menu\n              icon="add"\n              label="','"\n            >\n              <simple-toolbar-menu-item slot="menuitem">\n                <hax-context-item\n                  action\n                  align-horizontal="left"\n                  show-text-label\n                  role="menuitem"\n                  icon="hardware:keyboard-arrow-up"\n                  event-name="insert-above-active"\n                  label="','"\n                ></hax-context-item>\n              </simple-toolbar-menu-item>\n              <simple-toolbar-menu-item slot="menuitem">\n                <hax-context-item\n                  action\n                  align-horizontal="left"\n                  show-text-label\n                  role="menuitem"\n                  icon="hardware:keyboard-arrow-down"\n                  event-name="insert-below-active"\n                  label="','"\n                ></hax-context-item>\n              </simple-toolbar-menu-item>\n            </hax-toolbar-menu>\n          </div>\n        </hax-toolbar>\n      </div>\n    ']);return xe=function(){return e},e}window.customElements.define(me.tag,me);var ge=function(e){I(n,m.I18NMixin(re(i.LitElement)));var t=V(n);function n(){var e;return L(this,n),(e=t.call(this)).t={changeTo:"Change to",modifyHTMLSource:"Modify HTML source",clickToChange:"Click to change",insertItemAbove:"Insert item above",insertItemAboveOrBelow:"Insert item above or below",insertItemBelow:"Insert item below"},e.registerLocalization({context:U(e),namespace:"hax"}),e.haxUIElement=!0,e.onScreen=!1,e.ceButtons=[],e.activeTagName="",e.activeTagIcon="hax:paragraph",e.addEventListener("hax-context-item-selected",e.handleCECustomEvent.bind(U(e))),e}return M(n,null,[{key:"styles",get:function(){return W(G(O(n),"styles",this))}}]),M(n,[{key:"updated",value:function(e){var t=this;G(O(n.prototype),"updated",this)&&G(O(n.prototype),"updated",this).call(this,e),e.forEach(function(e,n){"onScreen"===n&&t.onScreen&&t._resetCEMenu()})}},{key:"render",value:function(){var e=this;return i.html(xe(),this.activeTagIcon,this.t.changeTo,this.activeTagName,this.t.clickToChange,this.disableTransform,this.ceButtons.map(function(e){return i.html(ve(),e.icon,e.label,e.callback)}),this.t.modifyHTMLSource,!this.sourceView,this.viewSource,function(t){return e.viewSource=!e.viewSource},this.t.insertItemAboveOrBelow,this.t.insertItemAbove,this.t.insertItemBelow)}},{key:"handleCECustomEvent",value:function(e){var t=e.detail;switch(t.eventName){case"hax-ce-custom-button":this.activeNode&&"function"==typeof this.activeNode[t.value]&&this.activeNode[t.value](e)&&Z.refreshActiveNodeForm()}}},{key:"firstUpdated",value:function(e){var t=this;G(O(n.prototype),"firstUpdated",this)&&G(O(n.prototype),"firstUpdated",this).call(this,e),h.autorun(function(){t.activeNode=h.toJS(Z.activeNode),t.activeNode&&t.activeNode.classList&&t._resetCEMenu()})}},{key:"_resetCEMenu",value:function(){var e=A(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.shadowRoot&&N.wipeSlot(this,"*"),this.ceButtons=[],this.viewSource=!1,Z.activeHaxBody&&null!=this.activeNode?(t=Z.haxSchemaFromTag(this.activeNode.tagName),this.sourceView=t.canEditSource,Z.isTextElement(this.activeNode)||(this.disableTransform=!Z.activeHaxBody.canTansformNode(this.activeNode),Z.activeGizmo&&(this.activeTagName=Z.activeGizmo.title,this.activeTagIcon=Z.activeGizmo.icon))):(this.activeTagName="",this.activeTagIcon=""),e.next=6,Z.runHook(this.activeNode,"inlineContextMenu",[this]);case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}],[{key:"tag",get:function(){return"hax-ce-context"}},{key:"properties",get:function(){return z(z({},G(O(n),"properties",this)),{},{disableTransform:{type:Boolean},onScreen:{type:Boolean,attribute:"on-screen",reflect:!0},sourceView:{type:Boolean},activeTagIcon:{type:String},activeTagName:{type:String},ceButtons:{type:Array},viewSource:{type:Boolean}})}}]),n}();function be(){var e=F(["<slot></slot>"]);return be=function(){return e},e}function fe(){var e=F(["\n    h4 {\n      font-size: var(--hax-tray-detail-title-font-size);\n      color: var(--hax-ui-color-accent-secondary);\n    }\n    h5 {\n      font-size: var(--hax-tray-detail-topic-font-size);\n    }\n    h6 {\n      font-size: var(--hax-tray-detail-subtopic-font-size);\n    }\n    h4,\n    h5,\n    h6 {\n      color: var(--hax-ui-color-accent);\n      text-transform: var(--hax-tray-detail-heading-text-transform);\n      font-weight: var(--hax-tray-detail-heading-font-weight);\n      margin: var(--hax-ui-spacing-lg) 0 var(--hax-ui-spacing-xs);\n    }\n  "]);return fe=function(){return e},e}function ye(){var e=F(["\n    #tray-detail {\n      --hax-tray-detail-title-font-size: var(--hax-ui-font-size-xl);\n      --hax-tray-detail-topic-font-size: var(--hax-ui-font-size-lg);\n      --hax-tray-detail-subtopic-font-size: var(--hax-ui-font-size);\n      --hax-tray-detail-heading-text-transform: capitalize;\n      --hax-tray-detail-heading-font-weight: normal;\n    }\n    #tray-detail h4,\n    #tray-detail h5,\n    #tray-detail h6 {\n      text-transform: var(--hax-tray-detail-heading-text-transform);\n      font-weight: var(--hax-tray-detail-heading-font-weight);\n      margin: var(--hax-ui-spacing-lg) 0 var(--hax-ui-spacing-xs);\n      color: var(--hax-ui-color-accent);\n    }\n    #tray-detail h4 {\n      font-size: var(--hax-tray-detail-title-font-size);\n      margin: var(--hax-ui-spacing-sm) 0 var(--hax-ui-spacing-lg);\n      color: var(--hax-ui-color-accent-secondary);\n    }\n    #tray-detail h5 {\n      font-size: var(--hax-tray-detail-topic-font-size);\n    }\n    #tray-detail h6 {\n      font-size: var(--hax-tray-detail-subtopic-font-size);\n    }\n  "]);return ye=function(){return e},e}function we(){var e=F(["\n    simple-fields-tabs {\n      padding: 0;\n      border: none;\n      margin-left: calc(0 - var(--hax-ui-spacing-sm));\n      margin-right: calc(0 - var(--hax-ui-spacing-sm));\n    }\n    simple-fields-tabs::part(tablist) {\n      margin-bottom: var(--hax-ui-spacing);\n    }\n    simple-fields-tabs::part(tab),\n    simple-fields-tabs::part(tab-active),\n    simple-fields-tabs::part(tab-disabled),\n    hax-preferences-dialog::part(haxlink) {\n      border: 1px solid var(--hax-ui-border-color);\n      text-decoration: none;\n      border-radius: 3px;\n      color: var(--hax-ui-color);\n      background-color: var(--hax-ui-background-color);\n      outline: unset;\n      text-transform: capitalize;\n      font-size: var(--hax-ui-font-size-sm);\n      padding: var(--hax-ui-spacing-xs);\n      flex: 1 1 auto;\n    }\n    simple-fields-tabs::part(tab-active) {\n      color: var(--hax-ui-color-accent);\n    }\n    hax-preferences-dialog::part(haxlink) {\n      font-size: var(--hax-ui-font-size-xl);\n      display: block;\n      padding: var(--hax-ui-spacing-lg);\n    }\n    hax-preferences-dialog::part(haxlink):hover,\n    hax-preferences-dialog::part(haxlink):focus {\n      color: var(--hax-ui-color);\n      background-color: var(--hax-ui-background-color-accent);\n      border-color: var(--hax-ui-color-accent);\n    }\n    simple-fields-tabs::part(tab-disabled) {\n      opacity: 0.5;\n      background-color: rgba(127, 127, 127, 0.2);\n    }\n    simple-fields-tabs::part(content) {\n      border: none;\n    }\n    simple-fields-tab {\n      padding: 0;\n    }\n    simple-fields *::part(label) {\n      text-transform: captitalize;\n      margin: 0;\n    }\n  "]);return we=function(){return e},e}function ke(){var e=F(['\n    :host {\n      text-transform: capitalize;\n    }\n    :host[aria-expanded="true"] {\n      border: 1px solid var(--hax-ui-border-color);\n    }\n    absolute-position-behavior {\n      border-color: transparent;\n      color: var(--hax-ui-color);\n      background-color: var(--hax-ui-background-color);\n    }\n    :host([expanded]) absolute-position-behavior {\n      border: 1px solid var(--hax-ui-border-color);\n    }\n    button[part="button"] {\n      text-transform: capitalize;\n      font-size: var(--hax-ui-font-size-sm);\n      padding: var(--hax-ui-spacing-sm);\n      color: var(--hax-ui-color);\n      background-color: var(--hax-ui-background-color);\n      border: 1px solid var(--hax-ui-border-color);\n      border-radius: var(--hax-ui-border-radius);\n    }\n    :host([role="menuitem"]) button[part="button"] {\n      padding: 1px;\n      border-color: transparent;\n    }\n    :host(:hover) button[part="button"],\n    :host(:focus-within) button[part="button"] {\n      color: var(--hax-ui-color);\n      background-color: var(--hax-ui-background-color-accent);\n      border-color: var(--hax-ui-color-accent);\n    }\n    button[part="button"][aria-pressed="true"] {\n      color: var(--hax-ui-color-accent);\n      border-color: var(--hax-ui-color-accent);\n    }\n    :host([feature]) button[part="button"],\n    :host([danger]) button[part="button"] {\n      color: var(--hax-ui-background-color);\n    }\n    :host([feature]) button[part="button"] {\n      background-color: var(--hax-ui-color-accent);\n      border-color: var(--hax-ui-color-accent);\n    }\n    :host([danger]) button[part="button"] {\n      background-color: var(--hax-ui-color-danger);\n      border-color: var(--hax-ui-color-danger);\n    }\n    :host([feature]) button[part="button"][aria-pressed="true"],\n    :host([danger]) button[part="button"][aria-pressed="true"] {\n      color: var(--hax-ui-background-color);\n    }\n    :host([feature]) button[part="button"][aria-pressed="true"] {\n      background-color: var(--hax-ui-color-accent-secondary);\n      border-color: var(--hax-ui-color-accent);\n    }\n    :host([danger]) button[part="button"][aria-pressed="true"] {\n      background-color: var(--hax-ui-color-danger-secondary);\n      border-color: var(--hax-ui-color-danger);\n    }\n    :host([feature]:hover) button[part="button"],\n    :host([feature]:focus-within) button[part="button"],\n    :host([danger]:hover) button[part="button"],\n    :host([danger]:focus-within) button[part="button"] {\n      color: var(--hax-ui-background-color);\n    }\n    :host([feature]:hover) button[part="button"],\n    :host([feature]:focus-within) button[part="button"] {\n      background-color: var(--hax-ui-color-accent-secondary);\n      border-color: var(--hax-ui-color-accent-secondary);\n    }\n    :host([danger]:hover) button[part="button"],\n    :host([danger]:focus-within) button[part="button"] {\n      background-color: var(--hax-ui-color-danger-secondary);\n      border-color: var(--hax-ui-color-danger-secondary);\n    }\n    :host([large]) button[part="button"] {\n      font-size: var(--hax-ui-font-size);\n      padding: var(--hax-ui-spacing);\n      border-width: 2px;\n    }\n    :host([disabled]) button[part="button"][disabled] {\n      opacity: 0.5;\n      border: 1px solid var(--hax-ui-border-color);\n    }\n\n    *[show-text-label]::part(label) {\n      text-transform: capitalize;\n      margin: var(--hax-ui-spacing-sm);\n    }\n  ']);return ke=function(){return e},e}function _e(){var e=F(["\n    hexagon-loader {\n      display: none;\n      margin: 0 auto;\n      z-index: 1000;\n    }\n    hexagon-loader[loading] {\n      display: block;\n      opacity: 0.8;\n    }\n  "]);return _e=function(){return e},e}function Ne(){var e=F(['\n    simple-modal[mode="hax-ui"],\n    simple-popover-manager[mode="hax"] {\n      --simple-modal-height: 70vh;\n      --simple-modal-width: 70vw;\n      --simple-popover-border-color: var(--hax-ui-color);\n      --simple-modal-border-color: var(--hax-ui-color);\n    }\n    simple-modal[mode="hax-ui"]::part(dialog) {\n      --simple-modal-z-index: 100000001 !important;\n    }\n    simple-modal[mode="hax-ui"]::part(titlebar),\n    simple-popover-manager[mode="hax"]::part(simple-popover-heading) {\n      color: var(--hax-ui-background-color);\n      background-color: var(--hax-ui-color-accent);\n      padding: var(--hax-ui-spacing-sm) var(--hax-ui-spacing);\n      margin: 0;\n    }\n    simple-modal[mode="hax-ui"]::part(close),\n    simple-popover-manager[mode="hax"] #close {\n      color: var(--hax-ui-background-color);\n      background-color: var(--hax-ui-color-accent);\n      outline: 1px solid var(--hax-ui-color-accent);\n      --simple-icon-button-border: 0px solid transparent;\n      --simple-icon-button-border-radius: var(--hax-ui-border-radius);\n      width: 24px;\n      height: 24px;\n      padding: 0;\n    }\n    simple-modal[mode="hax-ui"]:focus-within::part(close),\n    simple-modal[mode="hax-ui"]:hover::part(close),\n    simple-popover-manager[mode="hax"] #close:focus,\n    simple-popover-manager[mode="hax"] #close:hover {\n      background-color: var(--hax-ui-color-accent-secondary);\n      --simple-icon-button-border: 0px solid transparent;\n    }\n    simple-modal[mode="hax-ui"]::part(title),\n    simple-popover-manager[mode="hax"] h1 {\n      font-family: var(--hax-ui-font-family);\n      font-size: var(--hax-ui-font-size);\n      font-weight: normal;\n      margin: 0 var(--hax-ui-spacing-sm) 0 0;\n      padding: 0;\n    }\n    simple-popover-manager[mode="hax"] h2 {\n      font-family: var(--hax-ui-font-family);\n      font-size: var(--hax-ui-font-size-lg);\n      font-weight: normal;\n      color: var(--hax-ui-color-accent-secondary);\n      margin: 0 0 var(--hax-ui-spacing-lg);\n    }\n    simple-modal[mode="hax-ui"]::part(content),\n    simple-modal[mode="hax-ui"]::part(custom),\n    simple-popover-manager[mode="hax"]::part(simple-popover-body) {\n      font-size: var(--hax-ui-font-size);\n      color: var(--hax-ui-color);\n      background-color: var(--hax-ui-background-color);\n    }\n    simple-modal[mode="hax-ui"]::part(content) {\n      padding: 0 var(--hax-ui-spacing);\n    }\n    simple-modal[mode="hax-ui"]::part(custom) {\n      padding: 0;\n    }\n    simple-popover-manager[mode="hax"]::part(simple-popover-body) {\n      padding: var(--hax-ui-spacing);\n    }\n    simple-modal[mode="hax-ui"]::part(buttons),\n    simple-popover-manager[mode="hax"]:part(simple-popover-nav) {\n      background-color: var(--hax-ui-background-color);\n    }\n    simple-popover-manager[mode="hax"]\n      simple-icon-button-lite[slot="nav"]::part(button) {\n      text-transform: capitalize;\n      font-size: var(--hax-ui-font-size-sm);\n      padding: var(--hax-ui-spacing-sm);\n      color: var(--hax-ui-color);\n      background-color: var(--hax-ui-background-color);\n      border: 1px solid var(--hax-ui-border-color);\n      border-radius: var(--hax-ui-border-radius);\n      background-color: var(--hax-ui-background-color);\n    }\n    simple-popover-manager[mode="hax"]\n      simple-icon-button-lite[slot="nav"]::part(button):hover,\n    simple-popover-manager[mode="hax"]\n      simple-icon-button-lite[slot="nav"]::part(button):focus-within {\n      color: var(--hax-ui-color);\n      background-color: var(--hax-ui-background-color-accent);\n      border-color: var(--hax-ui-color-accent);\n    }\n    simple-popover-manager[mode="hax"]\n      simple-icon-button-lite[slot="nav"][disabled]::part(button) {\n      opacity: 0.5;\n      border: 1px solid var(--hax-ui-border-color);\n    }\n  ']);return Ne=function(){return e},e}function Ee(){var e=F(["\n    body {\n      --simple-fields-field-margin: calc(2 * var(--hax-ui-font-size));\n      --simple-toolbar-focus-z-index: var(--hax-ui-focus-z-index);\n      --simple-fields-font-family: var(--hax-ui-font-family);\n      --simple-fields-font-size: var(--hax-ui-font-size);\n      --simple-fields-line-height: 135%;\n      --simple-fields-detail-font-size: var(--hax-ui-font-size-sm);\n      --simple-fields-detail-line-height: 120%;\n      --simple-fields-margin: var(--hax-ui-spacing);\n      --simple-fields-background-color: var(--hax-ui-background-color);\n      --simple-fields-color: var(--hax-tray-text-color);\n      --simple-fields-accent-color: var(--hax-ui-color-accent);\n      --simple-fields-accent-color-light: var(--hax-ui-background-color-faded);\n      --simple-fields-error-color: var(--hax-ui-color-danger-secondary);\n      --simple-fields-button-danger-background-color: var(\n        --hax-ui-color-danger\n      );\n      --simple-fields-button-danger-focus-color: var(\n        --hax-ui-color-danger-secondary\n      );\n      --simple-fields-button-danger-background-color: var(\n        --hax-ui-background-color\n      );\n      --simple-fields-secondary-accent-color: var(\n        --hax-ui-color-accent-secondary\n      );\n      --simple-fields-border-color: var(--hax-ui-color-faded);\n\n      --simple-fields-fieldset-border-color: rgba(127, 127, 127, 0.2);\n      --simple-fields-legend-text-transform: capitalize;\n      --simple-fields-legend-font-size: var(--hax-ui-font-size-xs);\n\n      --simple-fields-meta-font-size: var(--hax-ui-font-size-xs);\n      --simple-fields-meta-line-height: 120%;\n      --simple-fields-meta-opacity: 0.7;\n      --simple-fields-focus-meta-opacity: 1;\n\n      --simple-fields-button-color: var(--hax-ui-color);\n      --simple-fields-button-background-color: var(--hax-ui-background-color);\n      --simple-fields-button-border-color: var(--hax-ui-border-color);\n      --simple-fields-button-text-transform: capitalize;\n      --simple-fields-border-radius: var(--hax-ui-border-radius);\n      --simple-fields-button-padding-sm: var(--hax-ui-spacing-sm);\n      --simple-fields-button-padding: var(--hax-ui-spacing-sm);\n\n      --simple-fields-button-toggled-color: var(--hax-ui-color);\n      --simple-fields-button-toggled-background-color: var(\n        --hax-ui-background-color-accent\n      );\n      --simple-fields-button-toggled-border-color: var(--hax-ui-color-accent);\n\n      --simple-fields-button-focus-color: var(--hax-ui-color);\n      --simple-fields-button-focus-background-color: var(\n        --hax-ui-background-color-accent\n      );\n      --simple-fields-button-focus-border-color: var(--hax-ui-color-accent);\n\n      --simple-fields-button-disabled-color: unset;\n      --simple-fields-button-disabled-background-color: unset;\n      --simple-fields-button-disabled-border-color: unset;\n      --simple-fields-button-disabled-opacity: 0.5;\n      --hexagon-color: var(--hax-ui-color-accent);\n    }\n  "]);return Ee=function(){return e},e}function Se(){var e=F(["\n    body {\n      --simple-tooltip-background: var(--hax-ui-color);\n      --simple-tooltip-text-color: var(--hax-ui-background-color);\n      --simple-tooltip-opacity: 1;\n      --simple-tooltip-delay-in: 0;\n      --simple-tooltip-duration-in: 100ms;\n      --simple-tooltip-duration-out: 0;\n      --simple-tooltip-border-radius: 2px;\n      --simple-tooltip-font-size: var(--hax-ui-font-size-sm);\n    }\n  "]);return Se=function(){return e},e}function Te(){var e=F(['\n    body {\n      --hax-ui-color: #222;\n      --hax-ui-color-focus: #000;\n      --hax-ui-color-faded: #444;\n\n      --hax-ui-background-color: #fff;\n      --hax-ui-background-color-secondary: #e8e8e8;\n      --hax-ui-background-color-faded: #b0b8bb;\n\n      --hax-ui-color-accent: #009dc7;\n      --hax-ui-color-accent-secondary: #007999;\n      --hax-ui-background-color-accent: #ccf3fd;\n\n      --hax-ui-color-danger: #ee0000;\n      --hax-ui-color-danger-secondary: #850000;\n      --hax-ui-background-color-danger: #ffdddd;\n\n      --hax-ui-border-color: #ddd;\n    }\n    body[hax-ui-theme="haxdark"] {\n      --hax-ui-color: #eeeae6;\n      --hax-ui-color-focus: #fff;\n      --hax-ui-color-faded: #c5c3be;\n\n      --hax-ui-background-color: #333;\n      --hax-ui-background-color-secondary: #111;\n      --hax-ui-background-color-faded: #222;\n\n      --hax-ui-color-accent: #77e2ff;\n      --hax-ui-color-accent-secondary: #00c9ff;\n      --hax-ui-background-color-accent: #000;\n\n      --hax-ui-color-danger: #ff8f8f;\n      --hax-ui-color-danger-secondary: #ff2222;\n      --hax-ui-background-color-danger: #000;\n\n      --hax-ui-border-color: #000;\n    }\n\n    @media (prefers-color-scheme: dark) {\n      body[hax-ui-theme="system"] {\n        --hax-ui-color: #eeeae6;\n        --hax-ui-color-focus: #fff;\n        --hax-ui-color-faded: #c5c3be;\n\n        --hax-ui-background-color: #333;\n        --hax-ui-background-color-secondary: #111;\n        --hax-ui-background-color-faded: #222;\n\n        --hax-ui-color-accent: #77e2ff;\n        --hax-ui-color-accent-secondary: #00c9ff;\n        --hax-ui-background-color-accent: #000;\n\n        --hax-ui-color-danger: #ff8f8f;\n        --hax-ui-color-danger-secondary: #ff2222;\n        --hax-ui-background-color-danger: #000;\n\n        --hax-ui-border-color: #000;\n      }\n    }\n  ']);return Te=function(){return e},e}function Ce(){var e=F(["\n    body {\n      --hax-tray-width: 300px;\n      --hax-ui-spacing-xs: 4px;\n      --hax-ui-border-radius: 2px;\n      --hax-ui-spacing-sm: calc(1 * var(--hax-ui-spacing-xs, 4px));\n      --hax-ui-spacing: calc(2 * var(--hax-ui-spacing-xs, 4px));\n      --hax-ui-spacing-lg: calc(3 * var(--hax-ui-spacing-xs, 4px));\n      --hax-ui-spacing-xl: calc(4 * var(--hax-ui-spacing-xs, 4px));\n      --hax-ui-focus-z-index: 1001;\n      --simple-toolbar-focus-z-index: var(--hax-ui-focus-z-index);\n      --a11y-menu-button-focus-z-index: var(--hax-ui-focus-z-index);\n    }\n  "]);return Ce=function(){return e},e}function Ae(){var e=F(["\n    body {\n      --hax-ui-font-family: sans-serif;\n      --hax-ui-font-size: 16px;\n      --hax-ui-font-size-sm: 13px;\n      --hax-ui-font-size-xs: 12px;\n      --hax-ui-font-size-lg: calc(1.05 * var(--hax-ui-font-size, 16px));\n      --hax-ui-font-size-xl: calc(1.25 * var(--hax-ui-font-size, 16px));\n    }\n  "]);return Ae=function(){return e},e}window.customElements.define(ge.tag,ge);var Le=[i.css(Ae())],He=[i.css(Ce())],Me=[i.css(Te())],Re=[i.css(Se())],Pe=[i.css(Ee())],ze=[i.css(Ne())],Ie=[].concat(Le,He,Pe,Re,ze,Me),Oe=[i.css(_e())],Be=[i.css(ke())],De=[i.css(we())],je=[].concat(Be,Oe,De),qe=(i.css(ye()),i.css(fe()),function(e){I(n,i.LitElement);var t=V(n);function n(){return L(this,n),t.apply(this,arguments)}return M(n,[{key:"render",value:function(){return i.html(be())}}],[{key:"styles",get:function(){return je}},{key:"tag",get:function(){return"hax-ui-styles"}}]),n}());function Ue(){var e=F(['\n      <div id="bodycontainer" class="ignore-activation">\n        <slot id="body"></slot>\n      </div>\n      <hax-text-context \n        id="textcontextmenu"\n        class="hax-context-menu ignore-activation"\n        .activeNode="','"\n      ></hax-text-context>\n      <hax-ce-context\n        id="cecontextmenu"\n        class="hax-context-menu ignore-activation"\n        .activeNode="','"\n      ></hax-ce-context>\n      <hax-plate-context\n        id="platecontextmenu"\n        class="hax-context-menu ignore-activation"\n        ></hax-plate-context>\n      </hax-context-container>\n      <hax-context-container\n        id="addincontext"\n        class="hax-context-menu ignore-activation">\n        <hax-context-item\n          icon="icons:add"\n          label="','"\n          show-text-label\n        >\n        </hax-context-item>\n      </hax-context-container>\n    ']);return Ue=function(){return e},e}function Ve(){var e=F(['\n        :host([edit-mode]),\n        :host([edit-mode]) * ::slotted(*) {\n          line-height: 1.8;\n        }\n        :host([edit-mode]) ul,\n        :host([edit-mode]) ol {\n          padding-left: 20px;\n          margin-left: 20px;\n        }\n        :host([edit-mode]) ul {\n          list-style-type: disc;\n        }\n        :host([edit-mode]) li {\n          margin-bottom: 6px;\n        }\n        :host {\n          display: block;\n          position: relative;\n          min-height: 32px;\n          min-width: 32px;\n          outline: none;\n          --hax-contextual-action-text-color: var(--hax-ui-background-color);\n          --hax-contextual-action-hover-color: var(--hax-ui-color-accent);\n          --hax-contextual-action-color: var(--hax-ui-color-accent-secondary);\n          --hax-body-editable-outline: 0px solid\n            var(--hax-ui-background-color-secondary);\n          --hax-body-active-outline-hover: 1px solid\n            var(---hax-ui-background-color-faded);\n          --hax-body-active-outline: 0px solid var(---hax-ui-color-accent);\n          --hax-body-active-drag-outline: 1px solid var(--hax-ui-color-accent);\n          --hax-body-target-background-color: var(\n            --hax-ui-background-color-accent\n          );\n          --hax-body-possible-target-background-color: inherit;\n        }\n        #addincontext {\n          opacity: 0.5;\n          transition: 0.2s opacity ease-in-out;\n        }\n        #addincontext:hover,\n        #addincontext:active,\n        #addincontext:focus {\n          opacity: 1;\n          cursor: pointer;\n        }\n        #textcontextmenu,\n        #cecontextmenu {\n          max-width: 280px;\n        }\n        .hax-context-menu {\n          padding: 0;\n          margin-left: -5000px;\n          position: fixed;\n          visibility: hidden;\n          opacity: 0;\n          z-index: 1000;\n          float: left;\n          display: block;\n          pointer-events: none;\n          transition: 0.2s top ease-in-out, 0.2s left ease-in-out;\n        }\n        .hax-context-menu:hover,\n        .hax-context-menu:focus-within {\n          z-index: var(--hax-ui-focus-z-index);\n        }\n        .hax-context-visible {\n          position: absolute;\n          visibility: visible;\n          pointer-events: all;\n          opacity: 1;\n        }\n        .hax-context-menu-active {\n          margin-left: unset;\n        }\n        :host([edit-mode]) #bodycontainer ::slotted([contenteditable]) {\n          -webkit-appearance: textfield;\n          cursor: text;\n          -moz-user-select: text;\n          -khtml-user-select: text;\n          -webkit-user-select: text;\n          -o-user-select: text;\n        }\n        :host([edit-mode])\n          #bodycontainer\n          ::slotted([contenteditable][data-hax-ray]:empty)::before {\n          content: attr(data-hax-ray);\n          opacity: 0.2;\n          transition: 0.2s all ease-in-out;\n        }\n\n        :host([edit-mode])\n          #bodycontainer\n          ::slotted([contenteditable][data-hax-ray]:hover:empty)::before {\n          opacity: 0.4;\n          cursor: text;\n        }\n\n        :host([edit-mode])\n          #bodycontainer\n          ::slotted([contenteditable][data-hax-ray]:empty:focus)::before {\n          content: "";\n        }\n        :host([edit-mode]) #bodycontainer ::slotted(p) {\n          min-height: var(--hax-base-styles-p-min-height, 1rem);\n          font-size: var(--hax-base-styles-p-font-size);\n          line-height: var(--hax-base-styles-p-line-height);\n          letter-spacing: var(--hax-base-styles-p-letter-spacing);\n        }\n        :host([edit-mode]) #bodycontainer ::slotted(a) {\n          color: var(--hax-base-styles-a-color);\n          font-size: var(\n            --hax-base-styles-a-font-size,\n            var(--hax-base-styles-p-font-size)\n          );\n          font-weight: var(--hax-base-styles-a-font-weight);\n        }\n        :host([edit-mode]) #bodycontainer ::slotted(a:visited) {\n          color: var(--hax-base-styles-a-color-visited);\n        }\n        :host([edit-mode]) #bodycontainer ::slotted(a:active),\n        :host([edit-mode]) #bodycontainer ::slotted(a:focus),\n        :host([edit-mode]) #bodycontainer ::slotted(a:hover) {\n          color: var(--hax-base-styles-a-color-active);\n          font-weight: var(--hax-base-styles-a-font-weight-active);\n        }\n        :host([edit-mode]) #bodycontainer ::slotted(ol),\n        :host([edit-mode]) #bodycontainer ::slotted(ul),\n        :host([edit-mode]) #bodycontainer ::slotted(li) {\n          padding-bottom: var(--hax-base-styles-list-padding-bottom);\n          line-height: var(\n            --hax-base-styles-list-line-height,\n            var(--hax-base-styles-p-line-height)\n          );\n          font-size: var(\n            --hax-base-styles-list-font-size,\n            var(--hax-base-styles-p-font-size)\n          );\n        }\n        :host([edit-mode]) #bodycontainer ::slotted(ol > li:last-child),\n        :host([edit-mode]) #bodycontainer ::slotted(ul > li:last-child) {\n          padding-bottom: var(--hax-base-styles-list-last-child-padding-bottom);\n        }\n        :host([edit-mode]) #bodycontainer ::slotted(img[contenteditable]) {\n          max-width: 100%;\n        }\n        :host([edit-mode]) #bodycontainer ::slotted(*[contenteditable]) {\n          outline: none;\n          caret-color: auto;\n        }\n        :host([edit-mode]) #bodycontainer ::slotted(*.blinkfocus) {\n          outline: 4px solid var(--hax-contextual-action-hover-color);\n        }\n        :host([edit-mode])\n          #bodycontainer\n          ::slotted(*:not(grid-plate)[contenteditable]:hover) {\n          outline: var(--hax-body-active-outline-hover);\n          caret-color: auto;\n        }\n        :host(.hax-add-content-visible[edit-mode])\n          #bodycontainer\n          ::slotted(*.hax-active) {\n          margin-bottom: 30px;\n        }\n        :host([edit-mode])\n          #bodycontainer\n          ::slotted(*.hax-active[contenteditable]:hover) {\n          cursor: text !important;\n          caret-color: auto;\n          outline: var(--hax-body-active-outline-hover);\n        }\n        :host([edit-mode])\n          #bodycontainer\n          ::slotted(*:not(grid-plate)[contenteditable] .hax-active:hover) {\n          cursor: text !important;\n          caret-color: auto;\n          outline: var(--hax-body-active-outline-hover);\n        }\n        :host([edit-mode])\n          #bodycontainer\n          ::slotted(code.hax-active[contenteditable]) {\n          display: block;\n        }\n        :host([edit-mode])\n          #bodycontainer\n          ::slotted(*.hax-active[contenteditable]) {\n          outline: var(--hax-body-active-outline) !important;\n        }\n        :host([edit-mode]) #bodycontainer ::slotted(hr[contenteditable]) {\n          height: 2px;\n          background-color: #eeeeee;\n          padding-top: 4px;\n          padding-bottom: 4px;\n        }\n        /** Fix to support safari as it defaults to none */\n        :host([edit-mode]) #bodycontainer ::slotted(*[contenteditable]) {\n          -webkit-user-select: text;\n          cursor: pointer;\n        }\n\n        :host([edit-mode])\n          #bodycontainer\n          ::slotted(*[contenteditable]::-moz-selection),\n        :host([edit-mode])\n          #bodycontainer\n          ::slotted(*[contenteditable] *::-moz-selection) {\n          background-color: var(\n            --hax-body-highlight,\n            var(--simple-colors-default-theme-yellow-2, yellow)\n          );\n          color: black;\n        }\n        :host([edit-mode])\n          #bodycontainer\n          ::slotted(*[contenteditable]::selection),\n        :host([edit-mode])\n          #bodycontainer\n          ::slotted(*[contenteditable] *::selection) {\n          background-color: var(\n            --hax-body-highlight,\n            var(--simple-colors-default-theme-yellow-2, yellow)\n          );\n          color: black;\n        }\n        #bodycontainer {\n          -webkit-user-select: text;\n          user-select: text;\n        }\n        .hax-context-menu:not(:defined) {\n          display: none;\n        }\n        /* drag and drop */\n        :host([edit-mode][hax-mover]) #bodycontainer ::slotted(*)::before {\n          background-color: var(--hax-body-possible-target-background-color);\n          content: " ";\n          width: 100%;\n          display: block;\n          position: relative;\n          margin: -12px 0 0 0;\n          z-index: 2;\n          height: 12px;\n          transition: 0.2s all ease-in-out;\n        }\n        :host([edit-mode][hax-mover]) #bodycontainer ::slotted(img) {\n          outline: var(--hax-body-editable-outline);\n        }\n        :host([edit-mode]) #bodycontainer ::slotted(img.hax-hovered),\n        :host([edit-mode]) #bodycontainer ::slotted(*.hax-hovered)::before {\n          background-color: var(--hax-body-target-background-color) !important;\n        }\n        :host([edit-mode]) #bodycontainer ::slotted(img.hax-hovered) {\n          border-top: 8px\n            var(\n              --hax-contextual-action-hover-color,\n              var(--simple-colors-default-theme-cyan-7, #009dc7)\n            );\n          margin-top: -8px;\n        }\n\n        @media screen and (min-color-index: 0) and(-webkit-min-device-pixel-ratio:0) {\n          /*\n            Define here the CSS styles applied only to Safari browsers\n            (any version and any device) via https://solvit.io/bcf61b6\n          */\n          :host([edit-mode][hax-mover]) #bodycontainer ::slotted(*) {\n            outline: var(--hax-body-editable-outline);\n            background-color: var(--hax-body-possible-target-background-color);\n          }\n          :host([edit-mode]) #bodycontainer ::slotted(*.hax-hovered) {\n            background-color: var(\n              --hax-body-target-background-color\n            ) !important;\n            outline: var(--hax-body-active-outline);\n          }\n        }\n      ']);return Ve=function(){return e},e}window.customElements.define(qe.tag,qe),Element.prototype.replaceWith||(Element.prototype.replaceWith=u.ReplaceWithPolyfill),CharacterData.prototype.replaceWith||(CharacterData.prototype.replaceWith=u.ReplaceWithPolyfill),DocumentType.prototype.replaceWith||(DocumentType.prototype.replaceWith=u.ReplaceWithPolyfill),String.prototype.replaceAll||(String.prototype.replaceAll=function(e,t){return this.split(e).join(t)});var Ge=null,Fe=25,We=200,Xe=function(e){I(o,m.I18NMixin(S.UndoManagerBehaviors(E.SimpleColors)));var n=V(o);function o(){var e;if(L(this,o),(e=n.call(this)).__ignoreActive=!1,e.__dragMoving=!1,e.___moveLock=!1,e.editMode=!1,e.haxMover=!1,e.activeNode=null,e.t={addContent:"Add Content"},e.registerLocalization({context:U(e),namespace:"hax"}),!window.HaxUiStyles){window.HaxUiStyles=document.createElement("div");var t=document.createElement("style"),i=Ie.map(function(e){return e.cssText}).join("");t.setAttribute("data-hax",!0),t.setAttribute("type","text/css"),t.styleSheet?t.styleSheet.cssText=i:t.appendChild(document.createTextNode(i)),document.getElementsByTagName("head")[0].appendChild(t)}return setTimeout(function(){e.polyfillSafe=Z.computePolyfillSafe(),e.addEventListener("place-holder-replace",e.replacePlaceholder.bind(U(e))),e.addEventListener("focusin",e._focusIn.bind(U(e))),e.addEventListener("mousemove",e._mouseMove.bind(U(e))),e.addEventListener("mouseleave",e._mouseLeave.bind(U(e))),e.addEventListener("touchstart",e._mouseMove.bind(U(e)),{passive:!0}),e.addEventListener("mousedown",e._mouseDown.bind(U(e))),e.addEventListener("mouseup",e._mouseUp.bind(U(e))),e.addEventListener("dragenter",e.dragEnterBody.bind(U(e))),e.addEventListener("dragend",e.dragEndBody.bind(U(e))),e.addEventListener("drop",e.dropEvent.bind(U(e)))},0),h.autorun(function(){e.editMode=h.toJS(Z.editMode)}),h.autorun(function(){e.activeNode=h.toJS(Z.activeNode)}),h.autorun(function(){h.toJS(Z.activeEditingElement)}),e}return M(o,null,[{key:"tag",get:function(){return"hax-body"}},{key:"styles",get:function(){return[].concat(W(G(O(o),"styles",this)),[i.css(Ve())])}}]),M(o,[{key:"dragEndBody",value:function(e){this.__manageFakeEndCap(!1),Z._lockContextPosition=!1,this.querySelectorAll(".hax-hovered").forEach(function(e){e.classList.remove("hax-hovered")})}},{key:"_mouseLeave",value:function(e){this.editMode&&Z.ready&&(clearTimeout(this.__mouseQuickTimer),clearTimeout(this.__mouseTimer),this.__activeHover=null,this._hideContextMenu(this.contextMenus.add),this.classList.remove("hax-add-content-visible"))}},{key:"_mouseMove",value:function(e){var t=this;if(this.editMode&&Z.ready){var n=u.normalizeEventPath(e);clearTimeout(this.__mouseQuickTimer),this.__mouseQuickTimer=setTimeout(function(){if(t.__activeHover&&t.__activeHover!=n[0].closest("[data-hax-ray]:not(li)")&&!n[0].closest("#addincontext")){for(var e,o=0;o<n.length;o++)n[o].getAttribute&&"addincontext"==n[o].getAttribute("id")&&(e=!0);e||(t.__activeHover=null,t._hideContextMenu(t.contextMenus.add),t.classList.remove("hax-add-content-visible"))}},300),clearTimeout(this.__mouseTimer),this.__mouseTimer=setTimeout(function(){t.__addActiveVisible();var o=n[0].closest("[data-hax-ray]:not(li)");if(o){t.__activeHover=o;var i=t.__activeHover.getBoundingClientRect(),a=t.contextMenus.add.getBoundingClientRect(),r=(e.pageY-(i.top+window.scrollY))/i.height,s=-a.height-1;r>.3?(s=i.height+1,t.__addAbove=!1):t.__addAbove=!0,t._positionContextMenu(t.contextMenus.add,t.__activeHover,i.width/2-a.width/2,s),t.classList.add("hax-add-content-visible")}else if(n[0].closest(".column")&&n[3]&&n[3].closest("grid-plate")){var l,c,d=t.contextMenus.add.getBoundingClientRect(),u=-d.height-1;if(n[0].closest(".column:not(.has-nodes")){if(t.__addAbove=!1,t.__slot=n[0].closest(".column").getAttribute("id").replace("col","col-"),0==n[0].closest(".column").parentNode.parentNode.host.children.length){var h=document.createElement("p");n[0].closest(".column").parentNode.parentNode.host.appendChild(h)}t.__activeHover=n[0].closest(".column").parentNode.parentNode.host.children[0],u=(l=n[0].closest(".column").getBoundingClientRect()).height/2-d.height/2,c=n[0].closest(".column")}else{t.__activeHover=n[0].closest(".column").parentNode.parentNode.host,c=t.__activeHover,l=t.__activeHover.getBoundingClientRect(),(e.pageY-(l.top+window.scrollY))/l.height>.3?(u=l.height+1,t.__addAbove=!1):t.__addAbove=!0}t._positionContextMenu(t.contextMenus.add,c,l.width/2-d.width/2,u),t.classList.add("hax-add-content-visible")}else n[0].closest("#bodycontainer")&&(t.__activeHover=null,t._hideContextMenu(t.contextMenus.add),t.classList.remove("hax-add-content-visible"))},400)}}},{key:"_mouseDown",value:function(e){if(this.editMode){this.__mouseDown=!0;var t=e.target;t.closest("[draggable]")?t=t.closest("[draggable]"):t.closest("[slot]")?t=t.closest("[slot]"):t.closest("[data-hax-ray]")?t=t.closest("[data-hax-ray]"):t.closest("[contenteditable]")?t=t.closest("[contenteditable]"):Z.validTagList.includes(t.tagName.toLowerCase())||"HAX-BODY"===t.tagName||t.haxUIElement||console.warn(t),!t.haxUIElement&&this.__focusLogic(t)&&(e.stopPropagation(),e.stopImmediatePropagation())}}},{key:"_mouseUp",value:function(e){var t=this;setTimeout(function(){t.__mouseDown=!1},0),clearTimeout(Ge),this.__manageFakeEndCap(!1)}},{key:"clickEvent",value:function(e){clearTimeout(Ge)}},{key:"blurEvent",value:function(e){this.editMode&&Z.activeEditingElement}},{key:"__manageFakeEndCap",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(e&&!this.__fakeEndCap){var t=document.createElement("fake-hax-body-end");t.style.width="100%",t.style.height="20px",t.style.zIndex="2",t.style.display="block",this.__fakeEndCap=t,this.haxMover=!0,this.appendChild(this.__fakeEndCap),this.__applyNodeEditableState(this.__fakeEndCap,!0)}else!e&&this.__fakeEndCap&&(this.__fakeEndCap.remove(),this.haxMover=!1,this.__fakeEndCap=null)}},{key:"dragEnterBody",value:function(e){this.__manageFakeEndCap(!0)}},{key:"render",value:function(){return i.html(Ue(),this.activeNode,this.activeNode,this.t.addContent)}},{key:"firstUpdated",value:function(e){var t=this;this.dispatchEvent(new CustomEvent("hax-register-body",{bubbles:!0,cancelable:!0,composed:!0,detail:this}));try{document.execCommand("enableObjectResizing",!1,!1),document.execCommand("defaultParagraphSeparator",!1,"p")}catch(e){console.warn(e)}this.contextMenus={text:this.shadowRoot.querySelector("#textcontextmenu"),plate:this.shadowRoot.querySelector("#platecontextmenu"),ce:this.shadowRoot.querySelector("#cecontextmenu"),add:this.shadowRoot.querySelector("#addincontext")},this.contextMenus.add.addEventListener("click",this._addInContextClick.bind(this)),this.shadowRoot.querySelector("slot").addEventListener("mouseup",function(e){t.editMode&&setTimeout(function(){var e=Z.getSelection();Z._tmpSelection=e,Z.haxSelectedText=e.toString();try{var t=Z.getRange();t.cloneRange&&(Z._tmpRange=t.cloneRange())}catch(e){console.warn(e)}},10)}),this.editMode=Z.editMode,this.__tabTrap=!1,this.ready=!0,G(O(o.prototype),"firstUpdated",this)&&G(O(o.prototype),"firstUpdated",this).call(this,e)}},{key:"_addInContextClick",value:function(e){this.__mouseDown=!1;["ul","ol"].includes(this.__activeHover.parentNode.tagName.toLowerCase())&&(this.__activeHover=this.__activeHover.parentNode),this.haxInsert("p","",{},this.__activeHover),this.__activeHover=null,this._hideContextMenu(this.contextMenus.add),this.classList.remove("hax-add-content-visible")}},{key:"updated",value:function(e){var t=this;e.forEach(function(e,n){"editMode"==n&&void 0!==e&&setTimeout(function(){t._editModeChanged(t[n],e),t[n]?(t._activeNodeChanged(t.activeNode,null),t.activeNode.focus()):t._activeNodeChanged(null,t.activeNode)},0),"activeNode"==n&&t.ready&&t._activeNodeChanged(t[n],e)}),G(O(o.prototype),"updated",this)&&G(O(o.prototype),"updated",this).call(this,e)}},{key:"connectedCallback",value:function(){var e=this;G(O(o.prototype),"connectedCallback",this).call(this),this._observer=new MutationObserver(function(t){var n=!1;e.__ignoreActive||e.__dragMoving||e.undoStackIgnore||e.__fakeEndCap?e.undoStackIgnore&&t.forEach(function(t){t.addedNodes.length>0&&t.addedNodes.forEach(function(t){e._validElementTest(t)&&setTimeout(function(){e.__applyNodeEditableState(t,e.editMode)},0)})}):t.forEach(function(t){if(t.addedNodes.length>0){var o,i=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=X(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,r=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return r=e.done,e},e:function(e){s=!0,a=e},f:function(){try{r||null==n.return||n.return()}finally{if(s)throw a}}}}(t.addedNodes);try{for(i.s();!(o=i.n()).done;){var a=o.value;if(e._validElementTest(a)){if(!e.__delHit&&"BR"===a.tagName&&a.parentElement&&Z.__validGridTags().includes(a.parentElement.tagName.toLowerCase())&&a===a.parentElement.childNodes[a.parentElement.childNodes.length-1]){var r=a.parentElement;if(a.remove(),r.childNodes.length>0){var s=r.childNodes[r.childNodes.length-1];s.textContent+="​",Z._positionCursorInNode(s,s.length)}continue}if(e.__delHit=!1,"P"===a.tagName&&a.children.length>0&&"P"===a.children[0].tagName){u.unwrap(a);continue}if("P"===a.tagName&&a.parentElement&&"P"===a.parentElement.tagName){u.unwrap(a.parentElement);continue}if(null!=a.getAttribute("slot")&&a.parentElement===e){a.removeAttribute("slot");continue}if("LI"===a.tagName&&a.children.length>0&&"SPAN"===a.children[0].tagName){e.activeNode!==a.children[0]&&e.activeNode!==a||(e.activeNode=a),u.unwrap(a.children[0]);continue}if("LI"===a.tagName&&a.parentElement&&!["UL","OL"].includes(a.parentElement.tagName)){u.unwrap(a);continue}if("P"===a.tagName&&a.children.length>0&&["P","LI"].includes(a.children[0].tagName)){u.unwrap(a.children[0]);continue}if(e.__slot&&(a.setAttribute("slot",e.__slot),e.__slot=null),e.__indentTrap)if("SPAN"===a.tagName)a.parentNode===e?e.haxChangeTagName(a,"p",!0):"LI"===a.parentNode.tagName&&(a.parentNode.innerHTML=a.textContent);else if("BR"===a.tagName){a.remove();continue}if(!e.editMode||"true"!=a.getAttribute("contenteditable")&&!0!==a.getAttribute("contenteditable")&&"contenteditable"!=a.getAttribute("contenteditable")||e.__applyNodeEditableState(a,!e.editMode),e.__applyNodeEditableState(a,e.editMode),Z.isGridPlateElement(a))for(var l=a.querySelectorAll("*"),c=0;c<l.length;c++)e._validElementTest(l[c])&&e.__applyNodeEditableState(l[c],e.editMode);if(["H1","H2","H3","H4","H5","H6"].includes(a.tagName)&&null==a.getAttribute("id")&&a.setAttribute("id",u.generateResourceID("header-")),e.___moveLock||n)e.___moveLock=!1;else if(n=!0,Z.activeNode=a,"BR"===a.tagName){var d=Z.getSelection();Z._tmpSelection=d,Z.haxSelectedText=d.toString();var h=Z.getRange();h.collapsed&&"BR"===e.activeNode.tagName&&e.activeNode.parentNode===h.commonAncestorContainer&&""===e.activeNode.innerText&&(Z.activeNode=e.activeNode.parentNode)}}}}catch(e){i.e(e)}finally{i.f()}e.__indentTrap&&setTimeout(function(){e.__indentTrap=!1},0)}}),e.__ignoreActive&&(e.__ignoreActive=!1),Z.haxTray.updateMap()}),this._observer.observe(this,{childList:!0,subtree:!0}),window.addEventListener("hax-context-item-selected",this._haxContextOperation.bind(this)),window.addEventListener("click",this.clickEvent.bind(this)),window.addEventListener("blur",this.blurEvent.bind(this)),window.addEventListener("keydown",this._onKeyDown.bind(this)),window.addEventListener("keypress",this._onKeyPress.bind(this)),document.body.addEventListener("hax-store-property-updated",this._haxStorePropertyUpdated.bind(this)),window.addEventListener("scroll",this._keepContextVisible.bind(this),{passive:!0}),window.addEventListener("resize",this._keepContextVisible.bind(this),{passive:!0})}},{key:"disconnectedCallback",value:function(){window.removeEventListener("click",this.clickEvent.bind(this)),window.removeEventListener("blur",this.blurEvent.bind(this)),window.removeEventListener("keydown",this._onKeyDown.bind(this)),window.removeEventListener("keypress",this._onKeyPress.bind(this)),document.body.removeEventListener("hax-store-property-updated",this._haxStorePropertyUpdated.bind(this)),window.removeEventListener("scroll",this._keepContextVisible.bind(this)),window.removeEventListener("resize",this._keepContextVisible.bind(this)),window.removeEventListener("hax-context-item-selected",this._haxContextOperation.bind(this)),this._observer.disconnect(),G(O(o.prototype),"disconnectedCallback",this).call(this)}},{key:"_keepContextVisible",value:function(){var e=this;this.editMode&&(clearTimeout(this.__contextVisibleLock),this.__contextVisibleLock=setTimeout(function(){var t=!1;e.contextMenus.text.classList.contains("hax-context-visible")?t=e.contextMenus.text:e.contextMenus.ce.classList.contains("hax-context-visible")&&(t=e.contextMenus.ce),t&&(e._setSticky(t),e.positionContextMenus())},100))}},{key:"_onKeyDown",value:function(e){var t=this;if(this.editMode&&"HAX-TRAY"!==document.activeElement.tagName&&"BODY"!==document.activeElement.tagName&&"SIMPLE-MODAL"!==document.activeElement.tagName&&(this.getAttribute("contenteditable")&&(this.__dropActiveVisible(),this.__manageFakeEndCap(!1),null!=Z.getSelection().anchorNode)))switch(e.key){case"Z":case"z":e.ctrlKey&&(e.shiftKey?this.redo():this.undo(),e.detail.keyboardEvent&&(e.detail.keyboardEvent.preventDefault(),e.detail.keyboardEvent.stopPropagation(),e.detail.keyboardEvent.stopImmediatePropagation()),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation());break;case"Tab":Z.isTextElement(this.activeNode)&&(e.detail.keyboardEvent&&(e.detail.keyboardEvent.preventDefault(),e.detail.keyboardEvent.stopPropagation(),e.detail.keyboardEvent.stopImmediatePropagation()),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),e.shiftKey?this._tabBackKeyPressed():this._tabKeyPressed());break;case"Enter":if(this.activeNode&&(this.__slot=this.activeNode.getAttribute("slot")),this.activeNode&&"P"===this.activeNode.tagName&&["1","#","`",">","-","!"].includes(this.activeNode.textContent[0])){var n=this.activeNode.textContent.replaceAll(/ /g," ");this.keyboardShortCutProcess(n)}break;case"Backspace":case"Delete":this.__delHit=!0;break;case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":setTimeout(function(){var e=Z.getSelection();Z._tmpSelection=e,Z.haxSelectedText=e.toString();var n=Z.getRange();n.commonAncestorContainer&&t.activeNode!==n.commonAncestorContainer&&"function"==typeof n.commonAncestorContainer.focus?"HAX-BODY"!==n.commonAncestorContainer.tagName&&t.__focusLogic(n.commonAncestorContainer,!1):n.commonAncestorContainer&&n.commonAncestorContainer.parentNode&&t.activeNode!==n.commonAncestorContainer.parentNode&&"function"==typeof n.commonAncestorContainer.parentNode.focus&&("HAX-BODY"!==n.commonAncestorContainer.parentNode.tagName?t.__focusLogic(n.commonAncestorContainer.parentNode,!1):t.__focusLogic(n.commonAncestorContainer,!1))},0);break;default:setTimeout(function(){if(t.activeNode&&"P"===t.activeNode.tagName&&["1","#","`",">","-","!"].includes(t.activeNode.textContent[0])){var e=t.activeNode.textContent.replaceAll(/ /g," ");" "===e[e.length-1]&&t.keyboardShortCutProcess(e)}},0)}}},{key:"keyboardShortCutProcess",value:function(e){if(Z.keyboardShortcuts[e.replace(" ","")]){var t=u.haxElementToNode(Z.keyboardShortcuts[e.replace(" ","")]);this.haxReplaceNode(this.activeNode,t),this.__focusLogic(t),"HR"===t.tagName&&this.haxInsert("p","",{})}else if("!"===e[0]){var n=e.replace("!","").replaceAll(/ /g,"");if(Z.elementList[n]){var o,i=Z.haxSchemaFromTag(n);o=i.gizmo.tag&&i.demoSchema&&i.demoSchema[0]?u.haxElementToNode(i.demoSchema[0]):document.createElement(n),this.haxReplaceNode(this.activeNode,o),this.__focusLogic(o)}else Z.toast("".concat(n," is not a valid tag"))}}},{key:"_onKeyPress",value:function(e){var t=this;clearTimeout(this.__keyPress),this.__keyPress=setTimeout(function(){t.editMode&&t.activeNode&&Z.isTextElement(t.activeNode)&&("Enter"===e.key&&(t.activeNode=t.activeNode.nextElementSibling),clearTimeout(t.__positionContextTimer),t.__positionContextTimer=setTimeout(function(){t.__addActiveVisible(),t.positionContextMenus()},2500))},50)}},{key:"elementMidViewport",value:function(){var e=this.activeNode.getBoundingClientRect().y;return e<0&&e>-1*this.activeNode.offsetHeight+140}},{key:"replacePlaceholder",value:function(e){if("text"===e.detail){var t=document.createElement("p");this.haxReplaceNode(this.activeNode,t),this.__focusLogic(t),this.activeNode.parentNode&&this.activeNode.parentNode.setAttribute("contenteditable",!0)}else this.replaceElementWorkflow()}},{key:"canTansformNode",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this.replaceElementWorkflow(e,!0).length>0}},{key:"replaceElementWorkflow",value:function(){var e=A(regeneratorRuntime.mark(function e(){var t,n,o,i,a,r,s,l,c,d,h,p,m=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=m.length>0&&void 0!==m[0]?m[0]:null,n=m.length>1&&void 0!==m[1]&&m[1],null==t&&(t=this.activeNode),e.next=5,u.nodeToHaxElement(t,null);case 5:if(o=e.sent,i="*",a=!1,"place-holder"===o.tag&&"undefined"!==T(o.properties.type)&&(i=o.properties.type,a=!0),r={},"undefined"!==T(Z.elementList[o.tag])&&!1!==Z.elementList[o.tag].gizmo&&"undefined"!==T(Z.elementList[o.tag].gizmo.handles)&&Z.elementList[o.tag].gizmo.handles.length>0)for(s=Z.elementList[o.tag].gizmo,l=0;l<s.handles.length;l++)for(c in s.handles[l])"type"!==c&&"undefined"!==T(o.properties[s.handles[l][c]])&&(r[c]=o.properties[s.handles[l][c]]);return(d=Z.guessGizmo(i,r,a)).length>0?(h=t.tagName.toLowerCase(),p=h.replace("-"," "),"undefined"!==T(Z.elementList[h])&&!1!==Z.elementList[h].gizmo&&(p=Z.elementList[h].gizmo.title),n||(Z.activePlaceHolder=this.activeNode,Z.haxAppPicker.presentOptions(d,"__convert","Change ".concat(p," to..."),"gizmo"))):n||Z.toast("Sorry, this can not be transformed!",5e3),e.abrupt("return",d);case 14:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"_haxStorePropertyUpdated",value:function(e){e.detail&&"undefined"!==T(e.detail.value)&&e.detail.property&&(this[e.detail.property]=e.detail.value)}},{key:"haxClearBody",value:function(){var e=!0;(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&(e=prompt("Are you sure you want to delete all content?")),e&&u.wipeSlot(this)}},{key:"haxInsert",value:function(e,t){var n=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.activeNode,a=document.createElement(e);a.innerHTML=t;var r=a.cloneNode(!0);for(var s in o){var l=u.camelToDash(s);o.hasOwnProperty(s)&&(!0===o[s]?r.setAttribute(l,l):!1===o[s]?r.removeAttribute(l):null!=o[s]&&o[s].constructor===Array?r.properties&&r.properties[s].readOnly||(r.set?r.set(l,o[s]):r[l]=o[s]):null!=o[s]&&o[s].constructor===Object?r.properties&&r.properties[s].readOnly||(r.set?r.set(l,o[s]):r[l]=o[s]):r.setAttribute(l,o[s]))}return null!==Z.activePlaceHolder&&"undefined"!==T(Z.activePlaceHolder.style)?(r.style.width=Z.activePlaceHolder.style.width,r.style.float=Z.activePlaceHolder.style.float,r.style.margin=Z.activePlaceHolder.style.margin,r.style.display=Z.activePlaceHolder.style.display,this.haxReplaceNode(Z.activePlaceHolder,r),Z.activePlaceHolder=null):i&&i.parentNode?"GRID-PLATE"===i.parentNode.tagName?(null!=i.getAttribute("slot")&&r.setAttribute("slot",i.getAttribute("slot")),this.__addAbove?i.parentNode.insertBefore(r,i):i.parentNode.insertBefore(r,i.nextElementSibling)):i.parentNode&&i.parentNode.nextElementSibling?i.parentNode.nextElementSibling.parentNode.insertBefore(r,i.parentNode.nextElementSibling):i.parentNode&&i.nextElementSibling?this.__addAbove?i.parentNode.insertBefore(r,i):i.parentNode.insertBefore(r,i.nextElementSibling):i.parentNode&&i.parentNode.children[i.parentNode.children.length-1]===i?this.__addAbove?i.parentNode.insertBefore(r,i):i.parentNode.appendChild(r):i.parentNode?i.parentNode.insertBefore(r,i):this.appendChild(r):this.appendChild(r),this.contextMenus.text.hasSelectedText=!1,setTimeout(function(){n.__focusLogic(r),n.scrollHere(r)},0),r}},{key:"haxToContent",value:function(){var e=A(regeneratorRuntime.mark(function e(){var t,n,o,i,a,r,s,l,c;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.hideContextMenus(),t=this.activeNode,Z.activeNode=null,n="slot"===this.shadowRoot.querySelector("#body").localName?this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}):[],o="",i=0;case 6:if(!(i<n.length)){e.next=43;break}if(!this._validElementTest(n[i])){e.next=18;break}return n[i].removeAttribute("data-hax-ray"),n[i].classList.remove("hax-hovered"),n[i].contentEditable=!1,e.t0=o,e.next=14,Z.nodeToContent(n[i]);case 14:o=e.t0+=e.sent,"grid-plate"===n[i].tagName.toLowerCase()&&this._applyContentEditable(this.editMode,n[i]),e.next=40;break;case 18:if(8!==n[i].nodeType){e.next=22;break}o+="\x3c!-- "+n[i].textContent+" --\x3e",e.next=40;break;case 22:if(!(n[i].haxUIElement&&n[i].children&&n[i].children[0])){e.next=39;break}return e.next=25,Z.runHook(n[i],"activeElementChanged",[this.activeNode,!1]);case 25:if(!(a=e.sent)||a===n[i]){e.next=33;break}return e.t1=o,e.next=30,Z.nodeToContent(a);case 30:o=e.t1+=e.sent,e.next=37;break;case 33:return e.t2=o,e.next=36,Z.nodeToContent(n[i].children[0]);case 36:o=e.t2+=e.sent;case 37:e.next=40;break;case 39:1!==n[i].nodeType&&"undefined"!==T(n[i].textContent)&&"undefined"!==n[i].textContent&&(o+=n[i].textContent);case 40:i++,e.next=6;break;case 43:if(o=(o=(o=(o=o.replace(/\scontenteditable=\"false\"/g,"")).replace(/\scontenteditable/g,"")).replace(/\sdraggable/g,"")).replace(/\sdata-hax-ray=\".*?\"/g,""),this.parentNode.tagName)for(i in r=this.parentNode.tagName.toLowerCase(),s="style-scope "+r+" x-scope",l=new RegExp(s,"g"),o=o.replace(l,""),s="style-scope "+r,l=new RegExp(s,"g"),o=o.replace(l,""),s="x-scope "+r+"-0",l=new RegExp(s,"g"),o=o.replace(l,""),c=Z.validTagList)s="style-scope "+c[i],l=new RegExp(s,"g"),o=o.replace(l,""),s="x-scope "+c[i]+"-0 ",l=new RegExp(s,"g"),o=o.replace(l,""),s="x-scope "+c[i]+"-0",l=new RegExp(s,"g"),o=o.replace(l,"");return o=(o=o.replace(/\sclass=\"\"/g,"")).replace(/\sclass=\"\s\"/g,""),this._applyContentEditable(this.editMode),Z.activeNode=t,o=u.encapScript(o),e.abrupt("return",o);case 54:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"haxDuplicateNode",value:function(){var e=A(regeneratorRuntime.mark(function e(t){var n,o,i,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.nodeToHaxElement(t,null);case 2:if(n=e.sent,o=Z.elementList[t.tagName.toLowerCase()],!Z.testHook(t,"preProcessInsertContent")){e.next=8;break}return e.next=7,Z.runHook(t,"preProcessInsertContent",[n]);case 7:n=e.sent;case 8:if("undefined"!==T(o)&&"undefined"!==T(o.saveOptions.unsetAttributes))for(i in o.saveOptions.unsetAttributes)n.properties[o.saveOptions.unsetAttributes[i]]&&delete n.properties[o.saveOptions.unsetAttributes[i]];return n.content==n.properties.innerHTML&&delete n.properties.innerHTML,"webview"===(a=u.haxElementToNode({tag:n.tag,content:n.content,properties:n.properties})).tagName.toLowerCase()&&Z._isSandboxed&&"undefined"!==T(a.guestinstance)&&delete a.guestinstance,null!==t?t.parentNode.insertBefore(a,t.nextSibling):t.parentNode.appendChild(a),Z.activeNode=a,e.abrupt("return",!0);case 15:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"hideContextMenus",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];clearTimeout(Ge),clearTimeout(this.__keyPress),clearTimeout(this.__contextVisibleLock),clearTimeout(this.__positionContextTimer),this._hideContextMenu(this.contextMenus.text),this._hideContextMenu(this.contextMenus.ce),this._hideContextMenu(this.contextMenus.add),this.classList.remove("hax-add-content-visible"),this.__activeHover=null,e&&this._hideContextMenu(this.contextMenus.plate)}},{key:"positionContextMenus",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.activeNode;if(t&&t.tagName&&this.ready){var n=t.tagName.toLowerCase();Z.elementList&&Z.elementList[n]&&Z.elementList[n].contentEditable?t.setAttribute("contenteditable",!0):t.removeAttribute("contenteditable"),clearTimeout(this.__positionContextTimer),this.__positionContextTimer=setTimeout(function(){if(!Z._lockContextPosition){var n=176,o=t.tagName.toLowerCase();Z._isSandboxed&&"webview"===o&&(o="iframe");var i=Z.elementList[o];if("undefined"===T(i)||Z.isTextElement(t))e._hideContextMenu(e.contextMenus.ce),e._positionContextMenu(e.contextMenus.text,t,0),n+=e.contextMenus.text.getBoundingClientRect().width;else e._hideContextMenu(e.contextMenus.text),i.element=t,"core"==i.editingElement?e._positionContextMenu(e.contextMenus.ce,t,0,-30):e._hideContextMenu(e.contextMenus.ce),n+=30;if(i&&"core"!=i.editingElement)setTimeout(function(){if(t&&t.parentNode){var n=t.parentNode.getBoundingClientRect();e._positionContextMenu(e.contextMenus.plate,t.parentNode,n.width-e.contextMenus.plate.getBoundingClientRect().width+1,-30)}},250);else{var a=t.getBoundingClientRect();e.activeNode&&("LI"===e.activeNode.tagName||e._HTMLInlineTextDecorationTest(e.activeNode))?e._hideContextMenu(e.contextMenus.plate):Math.round(n)>=Math.round(a.width)?e._positionContextMenu(e.contextMenus.plate,t,0,-56):e._positionContextMenu(e.contextMenus.plate,t,a.width-e.contextMenus.plate.getBoundingClientRect().width+1,-30)}}},50)}}},{key:"__addActiveVisible",value:function(){for(var e in this.contextMenus)("add"!=e||this.__activeHover)&&this.contextMenus[e].classList.add("hax-context-menu-active")}},{key:"__dropActiveVisible",value:function(){for(var e in this.contextMenus)this.contextMenus[e].classList.remove("hax-context-menu-active");this.__activeHover=null,this._hideContextMenu(this.contextMenus.add),this.classList.remove("hax-add-content-visible")}},{key:"haxMoveGridPlate",value:function(e,t){switch(this.___moveLock=!0,e){case"up":null!==t.previousElementSibling&&t.parentNode.insertBefore(t,t.previousElementSibling);break;case"down":null!==t.nextElementSibling&&t.parentNode.insertBefore(t.nextElementSibling,t)}return this.scrollHere(t),this.positionContextMenus(t),!0}},{key:"haxGridPlateOps",value:function(){var e=A(regeneratorRuntime.mark(function e(){var t,n,o,i,a,r,s,l,c,d,u=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=!(u.length>0&&void 0!==u[0])||u[0],n=u.length>1&&void 0!==u[1]?u[1]:"right",o=u.length>2&&void 0!==u[2]?u[2]:this.activeNode,i=!1,"GRID-PLATE"!==o.tagName){e.next=50;break}if(!t){e.next=26;break}e.t0=o.layout,e.next="1"===e.t0?9:"1-1"===e.t0?12:"1-1-1"===e.t0?15:"1-1-1-1"===e.t0?18:"1-1-1-1-1"===e.t0?21:24;break;case 9:return o.layout="1-1",i=!0,e.abrupt("break",24);case 12:return o.layout="1-1-1",i=!0,e.abrupt("break",24);case 15:return o.layout="1-1-1-1",i=!0,e.abrupt("break",24);case 18:return o.layout="1-1-1-1-1",i=!0,e.abrupt("break",24);case 21:return o.layout="1-1-1-1-1-1",i=!0,e.abrupt("break",24);case 24:e.next=47;break;case 26:e.t1=o.layout,e.next="1-1"===e.t1?29:"1-1-1"===e.t1?35:"1-1-1-1"===e.t1?38:"1-1-1-1-1"===e.t1?41:"1-1-1-1-1-1"===e.t1?44:47;break;case 29:return e.next=31,o.childNodes.forEach(function(e){e.tagName&&(a=e.cloneNode(!0),o.getAttribute("slot")?a.setAttribute("slot",o.getAttribute("slot")):a.removeAttribute("slot"),o.parentNode.insertBefore(a,o))});case 31:return Z.activeNode=a,setTimeout(function(){o.remove()},0),i=!0,e.abrupt("break",47);case 35:return o.layout="1-1",i=!0,e.abrupt("break",47);case 38:return o.layout="1-1-1",i=!0,e.abrupt("break",47);case 41:return o.layout="1-1-1-1",i=!0,e.abrupt("break",47);case 44:return o.layout="1-1-1-1-1",i=!0,e.abrupt("break",47);case 47:i&&(r=this.contextMenus.plate.shadowRoot.querySelector("#right"),s=this.contextMenus.plate.shadowRoot.querySelector("#rightremove"),r.disabled=!1,s.disabled=!1,"1-1-1-1-1-1"==o.layout&&(r.disabled=!0),"left"==n&&o.childNodes.forEach(function(e){if(e.tagName){var t=parseInt(e.getAttribute("slot").replace("col-",""),10)+1;e.setAttribute("slot","col-".concat(t))}})),e.next=61;break;case 50:(l=document.createElement("grid-plate")).layout="1-1",l.disableResponsive=!0,o.getAttribute("slot")&&l.setAttribute("slot",o.getAttribute("slot")),c="2","right"==n&&(c="1"),(d=o.cloneNode(!0)).setAttribute("slot","col-"+c),l.appendChild(d),o.parentNode.insertBefore(l,o),setTimeout(function(){o.remove()},0);case 61:return e.next=63,Z.refreshActiveNodeForm();case 63:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"haxReplaceNode",value:function(e,t){try{null==e&&(e=this.__oldActiveNode),!e.replaceWith&&Z._tmpRange&&(e=Z._tmpRange,Z._tmpRange=null),e&&e.getAttribute&&null!=e.getAttribute("slot")&&t.setAttribute("slot",e.getAttribute("slot")),e.replaceWith(t)}catch(e){console.warn(e)}return t}},{key:"haxChangeTagName",value:function(e,t){for(var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=document.createElement(t),i=0,a=e.attributes.length;i<a;++i){var r=e.attributes.item(i).nodeName,s=e.attributes.item(i).value;try{o.setAttribute(r,s)}catch(t){console.warn(e.attributes),console.warn(t)}}n&&(o.innerHTML=e.innerHTML.trim()),"ul"==t||"ol"==t?"<br />"==o.innerHTML?o.innerHTML="<li><br /></li>":"ul"!=e.tagName.toLowerCase()&&"ol"!=e.tagName.toLowerCase()&&(o.innerHTML="<li>"+e.innerHTML.trim().replace(/<br\/>/g,"</li>\n<li>").replace(/<br>/g,"</li>\n<li>")+"</li>"):"ul"!=e.tagName.toLowerCase()&&"ol"!=e.tagName.toLowerCase()||(o.innerHTML=o.innerHTML.replace(/<ul>/g,"").replace(/<\/ul>/g,"").replace(/<li><\/li>/g,"").replace(/<li>/g,"").replace(/<\/li>/g,"<br/>"));try{e.replaceWith(o),n&&setTimeout(function(){var e=o.children;e[0]&&e.tagName?e[0].focus():o.focus()},10)}catch(t){console.warn(t),console.warn(o),console.warn(e)}return o}},{key:"haxDeleteNode",value:function(e){if(e.previousElementSibling)Z.activeNode=e.previousElementSibling;else if(e.nextElementSibling)Z.activeNode=e.nextElementSibling;else{this.haxInsert("p","",{});try{var t=document.createRange(),n=Z.getSelection();t.setStart(this.activeNode,0),t.collapse(!0),n.removeAllRanges(),n.addRange(t),this.activeNode.focus()}catch(e){console.warn(e)}}try{return e.remove()}catch(e){console.warn(e)}}},{key:"importContent",value:function(e){var t=this;(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&u.wipeSlot(this,"*"),setTimeout(function(){e=u.encapScript(e);var n=document.createElement("div");for(n.insertAdjacentHTML("beforeend",e);null!==n.firstChild;)if("undefined"!==T(n.firstChild.tagName))if(Z._isSandboxed&&"iframe"===n.firstChild.tagName.toLowerCase()){for(var o=document.createElement("webview"),i=0,a=n.firstChild.attributes.length;i<a;++i){var r=n.firstChild.attributes.item(i).nodeName,s=n.firstChild.attributes.item(i).value;"height"!==r&&"width"!==r||o.style[r],o.setAttribute(r,s)}t.appendChild(o)}else t.appendChild(n.firstChild);else n.removeChild(n.firstChild)},0)}},{key:"_haxContextOperation",value:function(){var e=A(regeneratorRuntime.mark(function e(n){var o,i,a,r,s,l,c,d=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:o=n.detail,e.t0=o.eventName,e.next="insert-above-active"===e.t0?4:"insert-below-active"===e.t0?6:"hax-source-view-toggle"===e.t0?8:"hax-full-text-editor-toggle"===e.t0?35:"text-tag"===e.t0?51:"text-tag-ul"===e.t0?54:"text-tag-ol"===e.t0?58:"text-align-left"===e.t0?62:"hax-transform-node"===e.t0?64:"hax-plate-create-right"===e.t0?66:"hax-plate-remove-right"===e.t0?68:"hax-plate-duplicate"===e.t0?70:"hax-plate-delete"===e.t0?72:"hax-plate-up"===e.t0?74:"hax-plate-down"===e.t0?76:78;break;case 4:return this.activeNode&&this.activeNode.previousElementSibling?this.haxInsert("p","",{},this.activeNode.previousElementSibling):(i=document.createElement("p"),this.insertBefore(i,this.activeNode)),e.abrupt("break",78);case 6:return this.haxInsert("p","",{}),e.abrupt("break",78);case 8:if(this.activeNode.__haxSourceView){e.next=24;break}this.activeNode.__haxSourceView=!0,Z.activeEditingElement=document.createElement("code-editor"),Z.activeEditingElement.language="html",Z.activeEditingElement.title="",Z.activeEditingElement.theme="vs",Z.activeEditingElement.fontSize=12,Z.activeEditingElement.wordWrap=!0,this.activeNode.getAttribute&&null!=this.activeNode.getAttribute("slot")&&Z.activeEditingElement.setAttribute("slot",this.activeNode.getAttribute("slot")),this.__ignoreActive=!0,this.activeNode.removeAttribute("contenteditable"),this.activeNode.removeAttribute("data-hax-ray"),this.activeNode.classList.remove("hax-active"),u.wrap(this.activeNode,Z.activeEditingElement),e.next=34;break;case 24:return this.activeNode.__haxSourceView=!1,e.next=27,Z.runHook(Z.activeEditingElement,"activeElementChanged",[this.activeNode,!1]);case 27:if(a=e.sent,r=Z.haxSchemaFromTag(this.activeNode.tagName.toLowerCase()),this.activeNode&&this.activeNode.getAttribute&&null!=this.activeNode.getAttribute("slot")&&a.setAttribute("slot",this.activeNode.getAttribute("slot")),r.saveOptions&&r.saveOptions.unsetAttributes&&r.saveOptions.unsetAttributes.length)for(s in r.saveOptions.unsetAttributes)a.removeAttribute(r.saveOptions.unsetAttributes[s]);this.__applyNodeEditableState(a,this.editMode),u.unwrap(Z.activeEditingElement),Z.activeEditingElement=null;case 34:return e.abrupt("break",78);case 35:if(this.activeNode.__haxSourceView){e.next=40;break}this.activeNode.__haxSourceView=!0,Promise.resolve(t).then(function(){Z.activeEditingElement=document.createElement("rich-text-editor"),Z.activeEditingElement.type="rich-text-editor-toolbar-full",d.activeNode.getAttribute&&null!=d.activeNode.getAttribute("slot")&&Z.activeEditingElement.setAttribute("slot",d.activeNode.getAttribute("slot")),d.__ignoreActive=!0,d.activeNode.removeAttribute("contenteditable"),d.activeNode.removeAttribute("data-hax-ray"),d.activeNode.classList.remove("hax-active"),u.wrap(d.activeNode,Z.activeEditingElement)}),e.next=50;break;case 40:return this.activeNode.__haxSourceView=!1,e.next=43,Z.runHook(Z.activeEditingElement,"activeElementChanged",[this.activeNode,!1]);case 43:if(l=e.sent,c=Z.haxSchemaFromTag(this.activeNode.tagName.toLowerCase()),this.activeNode&&this.activeNode.getAttribute&&null!=this.activeNode.getAttribute("slot")&&l.setAttribute("slot",this.activeNode.getAttribute("slot")),c.saveOptions&&c.saveOptions.unsetAttributes&&c.saveOptions.unsetAttributes.length)for(s in c.saveOptions.unsetAttributes)l.removeAttribute(c.saveOptions.unsetAttributes[s]);this.__applyNodeEditableState(l,this.editMode),u.unwrap(Z.activeEditingElement),Z.activeEditingElement=null;case 50:return e.abrupt("break",78);case 51:return Z.activeNode=this.haxChangeTagName(this.activeNode,o.value),this.positionContextMenus(),e.abrupt("break",78);case 54:return this.contextMenus.text.realSelectedValue="ul",Z.activeNode=this.haxChangeTagName(this.activeNode,"ul"),this.positionContextMenus(),e.abrupt("break",78);case 58:return this.contextMenus.text.realSelectedValue="ol",Z.activeNode=this.haxChangeTagName(this.activeNode,"ol"),this.positionContextMenus(),e.abrupt("break",78);case 62:return this.activeNode.style.textAlign=null,e.abrupt("break",78);case 64:return this.replaceElementWorkflow(),e.abrupt("break",78);case 66:return this.haxGridPlateOps(),e.abrupt("break",78);case 68:return this.haxGridPlateOps(!1),e.abrupt("break",78);case 70:return this.haxDuplicateNode(this.activeNode),e.abrupt("break",78);case 72:return null!=this.activeNode&&this.haxDeleteNode(this.activeNode),e.abrupt("break",78);case 74:return this.haxMoveGridPlate("up",this.activeNode),e.abrupt("break",78);case 76:return this.haxMoveGridPlate("down",this.activeNode),e.abrupt("break",78);case 78:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_focusIn",value:function(e){this.__mouseDown||this.__focusLogic(e.target)&&(e.stopPropagation(),e.stopImmediatePropagation())}},{key:"__focusLogic",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=!1;if(this.editMode&&!this.__tabTrap){var i=e;"SPAN"===i.tagName&&Z.isTextElement(i.parentNode)&&""==i.parentNode.getAttribute("slot")&&(i=e.parentNode);var a=null;if(this._validElementTest(i)&&i.parentNode&&i.parentNode.tagName){if("P"===i.parentNode.tagName&&""==i.parentNode.getAttribute("slot"))a=i,o=!0;else{for(;i.parentNode&&i.parentNode.tagName&&"HAX-BODY"!=i.parentNode.tagName;)null===a&&"B"!==i.tagName&&"I"!==i.tagName&&"STRONG"!==i.tagName&&"EM"!==i.tagName&&(a=i),i=i.parentNode;null===a?a=i:Z.isGridPlateElement(i)||(a=i)}this.activeNode&&this.activeNode.parentNode!==i&&!i.classList.contains("ignore-activation")?o=!0:(i.haxUIElement||i.classList.contains("ignore-activation"))&&(o=!0),a.haxUIElement||a.classList.contains("ignore-activation")||(Z.activeNode=a,setTimeout(function(){if(n&&!t.__mouseDown&&Z.isTextElement(a))try{var e=document.createRange(),o=Z.getSelection();e.setStart(t.activeNode,0),e.collapse(!0),o.removeAllRanges(),o.addRange(e),t.activeNode.focus()}catch(e){console.warn(e)}t.positionContextMenus(a)},0),o=!0)}}else this.__tabTrap=!1;return o}},{key:"scrollHere",value:function(e){setTimeout(function(){"function"==typeof e.scrollIntoViewIfNeeded?e.scrollIntoViewIfNeeded(!0):e.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})},0)}},{key:"undo",value:function(){var e=this;G(O(o.prototype),"undo",this).call(this),setTimeout(function(){var t=e.querySelector(".hax-active");t?(e.__focusLogic(t),e.scrollHere(t)):e.hideContextMenus()},0)}},{key:"redo",value:function(){var e=this;G(O(o.prototype),"redo",this).call(this),setTimeout(function(){var t=e.querySelector(".hax-active");t?(e.__focusLogic(t),e.scrollHere(t)):e.hideContextMenus()},0)}},{key:"_editModeChanged",value:function(){var e=A(regeneratorRuntime.mark(function e(t,n){var o,i,a,r,s,l,c=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("undefined"!==T(n)){if(this._applyContentEditable(t),t)if(this.children&&this.children[0]&&this.children[0].focus)this.__focusLogic(this.children[0]);else{this.haxInsert("p","",{});try{o=document.createRange(),i=Z.getSelection(),o.setStart(this.activeNode,0),o.collapse(!0),i.removeAllRanges(),i.addRange(o),this.activeNode.focus()}catch(e){console.warn(e)}}setTimeout(function(){c.undoStack.undoStackLimit=50,c.undoStack.undoStackPosition=-1,c.undoStack.commands=[],c.undoStack.changed(),c.undoStackInitialValue=c.innerHTML,c.undoStackPrevValue=c.undoStackInitialValue},0)}if(0==t)for(u.unwrap(Z.activeEditingElement),Z.activeEditingElement=null,this.removeAttribute("contenteditable"),this.hideContextMenus(),a=this.querySelectorAll("[contenteditable],.hax-active"),r=0;r<a.length;r++)(s=a[r]).removeAttribute("contenteditable"),s.classList.remove("hax-active");0===(l="slot"===this.shadowRoot.querySelector("#body").localName?this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}):[]).length&&(l=this.shadowRoot.querySelector("#body").children),r=0;case 5:if(!(r<l.length)){e.next=11;break}return e.next=8,Z.runHook(l[r],"editModeChanged",[t]);case 8:r++,e.next=5;break;case 11:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()},{key:"_haxResolvePreviousElement",value:function(e){for(e=e.previousElementSibling;null!=e&&"undefined"!==T(e.tagName)&&"HAX-"===e.tagName.substring(0,4);)e=e.previousElementSibling;return e}},{key:"_validElementTest",value:function(e){return!(e.haxUIElement||!e.tagName||["TEMPLATE","HAX-BODY","HAX-APP-SEARCH-RESULT","FAKE-HAX-BODY-END"].includes(e.tagName))&&(!this._HTMLInlineTextDecorationTest(e)||"HAX-BODY"==e.parentNode)}},{key:"_HTMLInlineTextDecorationTest",value:function(e){return["span","b","strong","i","em"].includes(e.tagName.toLowerCase())}},{key:"_HTMLPrimativeTest",value:function(e){return null!=e&&"undefined"!==T(e.tagName)&&-1==e.tagName.indexOf("-")}},{key:"_applyContentEditable",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.shadowRoot.querySelector("#body"),n="slot"===t.localName?t.assignedNodes({flatten:!0}):[];0===n.length&&(n=t.children);for(var o=0;o<n.length;o++)if(this._validElementTest(n[o])&&(!e||!0!==n[o].getAttribute("contenteditable")&&"true"!=n[o].getAttribute("contenteditable")&&"contenteditable"!=n[o].getAttribute("contenteditable"))&&this.__applyNodeEditableState(n[o],e),Z.isGridPlateElement(n[o]))for(var i=n[o].querySelectorAll("*"),a=0;a<i.length;a++)this._validElementTest(i[a])&&this.__applyNodeEditableState(i[a],e)}},{key:"__applyNodeEditableState",value:function(e){var t,n=this,o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e.tagName)return!1;var i=e.tagName.replace("-"," ").toLowerCase(),a=h.toJS(Z.gizmoList).findIndex(function(t){if(t)return t.tag===e.tagName.toLowerCase()});if(-1!==a&&(i=h.toJS(Z.gizmoList)[a].title),"IMG"==e.tagName&&e.setAttribute("draggable",!1),o?(e.setAttribute("data-hax-ray",i),t="addEventListener"):(e.removeAttribute("data-hax-ray"),t="removeEventListener"),e[t]("drop",this.dropEvent.bind(this)),e[t]("dragenter",this.dragEnter.bind(this)),e[t]("dragleave",this.dragLeave.bind(this)),e[t]("dragover",function(e){n.__dragMoving=!0,e.preventDefault()}),this._HTMLPrimativeTest(e)&&(o?e.setAttribute("contenteditable",o):e.removeAttribute("contenteditable"),e.querySelectorAll("a").length>0))for(var r=e.querySelectorAll("a"),s=0,l=r.length;s<l;s++)o?r[s].setAttribute("contenteditable",o):r[s].removeAttribute("contenteditable"),r[s][t]("click",function(e){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()})}},{key:"undoManagerStackLogic",value:function(e){this.__dragMoving||(this.querySelectorAll(".hax-hovered").forEach(function(e){e.classList.remove("hax-hovered")}),G(O(o.prototype),"undoManagerStackLogic",this).call(this,e))}},{key:"dropEvent",value:function(e){if(this.editMode){this.__dragMoving=!1,this.undoManagerStackLogic({}),clearTimeout(Ge),Z._lockContextPosition=!1,Z.haxTray.activeTab="item-1";var t,n=null,o=u.normalizeEventPath(e);n=e.target.closest("grid-plate")&&e.target.parentNode!=e.target.closest("grid-plate")?e.target.closest("grid-plate"):e.target.closest("[contenteditable],img")?e.target.closest("[contenteditable],img"):e.originalTarget?e.originalTarget:e.target,o[0].classList.contains("column")?this.__slot=o[0].getAttribute("id").replace("col","col-"):n.getAttribute("slot")&&(this.__slot=n.getAttribute("slot")),Z.activeNode=n,this.querySelectorAll(".hax-hovered").forEach(function(e){e.classList.remove("hax-hovered")}),this.querySelectorAll(".active").forEach(function(e){e.classList.remove("active")});try{if(e.dataTransfer&&e.dataTransfer.items&&e.dataTransfer.items.length>0&&"file"===e.dataTransfer.items[0].kind){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();var i=document.createElement("p");e.target.closest("grid-plate")&&e.target.parentNode!=e.target.closest("grid-plate")?t=e.target.closest("grid-plate"):e.target.closest("[contenteditable],img")&&(t=e.target.closest("[contenteditable],img")),t&&t.tagName&&!["GRID-PLATE","HAX-BODY"].includes(t.tagName)||"GRID-PLATE"===o[0].tagName?(t.getAttribute("slot")?i.setAttribute("slot",t.getAttribute("slot")):o[0].classList.contains("column")?i.setAttribute("slot",o[0].getAttribute("id").replace("col","col-")):i.removeAttribute("slot"),t.parentNode.insertBefore(i,t)):(o[0].classList.contains("column")?i.setAttribute("slot",o[0].getAttribute("id").replace("col","col-")):t&&"HAX-BODY"===t.tagName&&i.getAttribute("slot")&&i.removeAttribute("slot"),t?t.appendChild(i):this.appendChild(i)),e.placeHolderElement=i,this.dispatchEvent(new CustomEvent("place-holder-file-drop",{bubbles:!0,cancelable:!0,composed:!0,detail:e}))}else{if(n=Z.__dragTarget,t=e.target,e.target.closest("grid-plate")&&e.target.parentNode!=e.target.closest("grid-plate")?t=e.target.closest("grid-plate"):e.target.closest("[contenteditable],img")&&(t=e.target.closest("[contenteditable],img")),t&&n&&this._validElementTest(n)&&n!==t){try{["GRID-PLATE","HAX-BODY"].includes(t.tagName)&&"GRID-PLATE"!==o[0].tagName?(o[0].classList.contains("column")?n.setAttribute("slot",o[0].getAttribute("id").replace("col","col-")):"HAX-BODY"===t.tagName&&n.getAttribute("slot")&&n.removeAttribute("slot"),t.appendChild(n)):(t.getAttribute("slot")?n.setAttribute("slot",t.getAttribute("slot")):o[0].classList.contains("column")?n.setAttribute("slot",o[0].getAttribute("id").replace("col","col-")):n.removeAttribute("slot"),t.parentNode.insertBefore(n,t))}catch(e){console.warn(e)}e.preventDefault(),e.stopPropagation()}n&&this._validElementTest(n)&&"function"==typeof n.focus&&(Z.activeNode=n,this.dispatchEvent(new CustomEvent("hax-drop-focus-event",{bubbles:!0,cancelable:!0,composed:!0,detail:this.activeNode})),this.scrollHere(this.activeNode),this.positionContextMenus())}}catch(e){console.warn(e)}}Z.__dragTarget=null,this.__manageFakeEndCap(!1)}},{key:"dragEnter",value:function(e){this.editMode&&e.target&&Z.__dragTarget&&(this.__dragMoving=!0,e.preventDefault(),e.target&&e.target.classList&&e.target.classList.add("hax-hovered"),this.handleMousemove(e))}},{key:"handleMousemove",value:function(e){var t=e.clientX,n=e.clientY,o=document.documentElement.clientWidth,i=document.documentElement.clientHeight,a=We,r=We,s=i-We,l=o-We,c=t<r,d=t>l,u=n<a,h=n>s;if(c||d||u||h){var p=Math.max(document.body.scrollWidth,document.body.offsetWidth,document.body.clientWidth,document.documentElement.scrollWidth,document.documentElement.offsetWidth,document.documentElement.clientWidth),m=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.body.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight,document.documentElement.clientHeight),v=p-o,x=m-i;!function e(){clearTimeout(Ge),function(){var e=window.pageXOffset,o=window.pageYOffset,i=o>0,p=o<x,m=e>0,g=e<v,b=e,f=o;if(c&&m){var y=(r-t)/We;b-=Fe*y}else if(d&&g){var y=(t-l)/We;b+=Fe*y}if(u&&i){var y=(a-n)/We;f-=Fe*y}else if(h&&p){var y=(n-s)/We;f+=Fe*y}return b=Math.max(0,Math.min(v,b)),f=Math.max(0,Math.min(x,f)),(b!==e||f!==o)&&(window.scrollTo(b,f),!0)}()&&(Ge=setTimeout(e,30))}()}else clearTimeout(Ge)}},{key:"dragLeave",value:function(e){this.editMode&&e.target&&e.target.classList&&(this.__dragMoving=!0,e.target.classList.remove("hax-hovered"))}},{key:"_activeNodeChanged",value:function(){var e=A(regeneratorRuntime.mark(function e(t,n){var o,i,a,r,s,l;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return window.SimplePopoverManager.requestAvailability().opened=!1,e.next=3,this.querySelectorAll(".hax-active").forEach(function(e){e.classList.remove("hax-active")});case 3:if(this.editMode&&"undefined"!==T(t)&&null!==t&&t.parentNode?(o=t.tagName.toLowerCase(),t.classList.add("hax-active"),Z.isTextElement(t)||"HR"===t.tagName||Z.isGridPlateElement(t)?(t.setAttribute("contenteditable",!0),this.setAttribute("contenteditable",!0)):(t.removeAttribute("contenteditable"),this.removeAttribute("contenteditable")),this._keepContextVisible(),this.contextMenus.text.realSelectedValue=o):null===t&&(this.hideContextMenus(),this.__oldActiveNode=n),e.t0=this.editMode,!e.t0){e.next=9;break}return e.next=8,Z.runHook(n,"activeElementChanged",[n,!1]);case 8:e.t0=e.sent;case 9:if(!e.t0){e.next=11;break}this.__ignoreActive=!0;case 11:if(e.t1=this.editMode,!e.t1){e.next=16;break}return e.next=15,Z.runHook(t,"activeElementChanged",[t,!0]);case 15:e.t1=e.sent;case 16:if(!e.t1){e.next=18;break}this.__ignoreActive=!0;case 18:if(!this.editMode||!n){e.next=28;break}if(!("core"!=(i=Z.haxSchemaFromTag(n.tagName.toLowerCase())).editingElement||n.parentNode&&n.parentNode.haxUIElement&&n.parentNode===Z.activeEditingElement)){e.next=28;break}return this.__ignoreActive=!0,e.next=24,Z.runHook(Z.activeEditingElement,"activeElementChanged",[n,!1]);case 24:if((a=e.sent)&&a!==n){if(n&&n.getAttribute&&null!=n.getAttribute("slot")&&a.setAttribute("slot",n.getAttribute("slot")),i.saveOptions&&i.saveOptions.unsetAttributes&&i.saveOptions.unsetAttributes.length)for(r in i.saveOptions.unsetAttributes)a.removeAttribute(i.saveOptions.unsetAttributes[r]);this.__applyNodeEditableState(a,this.editMode)}u.unwrap(Z.activeEditingElement),Z.activeEditingElement=null;case 28:if(!this.editMode||!t){e.next=42;break}if(!(s=Z.haxSchemaFromTag(t.tagName))||!s.editingElement||"core"==s.editingElement){e.next=42;break}if(!s.editingElement.import){e.next=35;break}return l=Z.pathFromUrl(decodeURIComponent("undefined"==typeof document?new(require("url").URL)("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("hax-body.umd.js",document.baseURI).href)),e.next=35,import("".concat(l,"../../").concat(s.editingElement.import));case 35:return Z.activeEditingElement=document.createElement(s.editingElement.tag),t.getAttribute&&null!=t.getAttribute("slot")&&Z.activeEditingElement.setAttribute("slot",t.getAttribute("slot")),s.editingElement.callback&&s.editingElement.callback(Z.activeEditingElement),this.__ignoreActive=!0,u.wrap(t,Z.activeEditingElement),e.next=42,Z.runHook(Z.activeEditingElement,"activeElementChanged",[t,!0]);case 42:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}()},{key:"_getPosition",value:function(e){return{x:e.offsetLeft-e.scrollLeft+e.clientLeft,y:e.offsetTop-e.scrollTop+e.clientTop}}},{key:"_positionContextMenu",value:function(e,t,n,o){if(null!=t){var i=this._getPosition(t);e.style.left=null!=n?i.x+n+"px":i.x+"px",e.style.top=null!=o?i.y+o+"px":i.y+"px"}e.setAttribute("on-screen","on-screen"),e.classList.add("hax-context-visible","hax-context-menu-active")}},{key:"_getContextContainer",value:function(e){var t=e&&e.parentNode?e.parentNode:void 0;return t&&t.nodeType?1==t.nodeType?t:t.host:void 0}},{key:"_setSticky",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e&&this._getContextContainer(e)){var n=this._getContextContainer(e),o=t&&this.activeNode&&this.elementMidViewport();n.menuSticky=o}}},{key:"_hideContextMenu",value:function(e){var t=this._getContextContainer(e);e.removeAttribute("on-screen"),e.visible=!1,e.classList.remove("hax-context-visible","hax-context-menu-active"),this._setSticky(e),t&&(t.menusVisible=!1)}},{key:"_tabKeyPressed",value:function(){if(this.activeNode&&Z.getRange().cloneRange)try{var e=!1,t=this.activeNode.parentNode,n=this.activeNode.parentNode.tagName,o=Z.getRange().cloneRange(),i=o.commonAncestorContainer.tagName;if("undefined"===T(i)&&(i=o.commonAncestorContainer.parentNode.tagName),["UL","OL","LI"].includes(n)||["UL","OL","LI"].includes(i))this.polyfillSafe&&(this.__tabTrap=!0,this.__indentTrap=!0,document.execCommand("indent"));else for(;!e;)null==t.nextSibling?e=!0:"function"===t.nextSibling.focus?(t.nextSibling.focus(),e=!0):t=t.nextSibling}catch(e){console.warn(e)}}},{key:"_tabBackKeyPressed",value:function(){if(this.activeNode&&Z.getRange().cloneRange)try{var e=this.activeNode.parentNode,t=this.activeNode.parentNode.tagName,n=Z.getRange().cloneRange(),o=n.commonAncestorContainer.tagName;if("undefined"===T(o)&&(o=n.commonAncestorContainer.parentNode.tagName),["UL","OL","LI"].includes(t)||["UL","OL","LI"].includes(o))this.polyfillSafe&&(this.__tabTrap=!0,this.__indentTrap=!0,document.execCommand("outdent"));else{if(null!=e)for(;null!=e&&!this._validElementTest(e);)e=e.previousSibling;null!=e&&setTimeout(function(){e.focus()},50)}}catch(e){console.warn(e)}}}],[{key:"properties",get:function(){return z(z({},G(O(o),"properties",this)),{},{haxMover:{type:Boolean,attribute:"hax-mover",reflect:!0},editMode:{type:Boolean,reflect:!0,attribute:"edit-mode"},activeNode:{type:Object}})}}]),o}();window.customElements.define(Xe.tag,Xe),e.HaxBody=Xe,Object.defineProperty(e,"__esModule",{value:!0})});
  