diff --git a/cdn/build/es6/node_modules/@haxtheweb/course-design/lib/learning-component.js b/cdn/build/es6/node_modules/@haxtheweb/course-design/lib/learning-component.js index aee560080..30c36953a 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/course-design/lib/learning-component.js +++ b/cdn/build/es6/node_modules/@haxtheweb/course-design/lib/learning-component.js @@ -159,4 +159,4 @@ import{html as e,css as t}from"../../../lit/index.js";import"../../simple-toolti > `:""} - `}static get haxProperties(){return{type:"grid",canScale:!1,hideDefaultSettings:!0,gizmo:{title:"Learning Component",description:"A card for instructors to communicate pedagogy and instructional strategies.",icon:"icons:bookmark",color:"orange",tags:["Instructional","content","design","presentation","instruction","course","learning","card"],handles:[],meta:{author:"HAXTheWeb core team"}},settings:{configure:[{property:"type",title:"Type",description:"The type of card to be used.",inputMethod:"select",options:{"":"",...learningComponentTypes},required:!1},{property:"subtitle",title:"Sub-Title",description:"The sub-title of the card.",inputMethod:"textfield"},{property:"url",title:"Link",description:"An optional link for the card (Link not available for Learning Objectives).",inputMethod:"url"},{slot:"",title:"Contents"}],advanced:[{property:"title",title:"Title",description:"Set Title, this overrides type based title",inputMethod:"textfield"},{property:"icon",title:"Icon",description:"Set icon, this overrides type based icon",inputMethod:"iconpicker"},{property:"accentColor",title:"Accent color",description:"Set accent color, this overrides type based color",inputMethod:"colorpicker"},{property:"dark",title:"Dark mode",description:"Invert high and low tones",inputMethod:"boolean"}]},saveOptions:{unsetAttributes:["t"]},demoSchema:[{tag:"learning-component",properties:{type:"objectives",subtitle:"Unit 1"},content:"

By the end of this lesson, you should be able to...

"}]}}}customElements.define(LearningComponent.tag,LearningComponent);export{LearningComponent}; \ No newline at end of file + `}static get haxProperties(){return{type:"grid",canScale:!1,hideDefaultSettings:!0,gizmo:{title:"Learning Component",description:"A card for instructors to communicate pedagogy and instructional strategies.",icon:"icons:bookmark",color:"orange",tags:["Instructional","content","design","presentation","instruction","course","learning","card"],handles:[],meta:{author:"HAXTheWeb core team"}},settings:{configure:[{property:"type",title:"Type",description:"The type of card to be used.",inputMethod:"select",options:{"":"",...learningComponentTypes},required:!1},{property:"subtitle",title:"Sub-Title",description:"The sub-title of the card.",inputMethod:"textfield"},{property:"url",title:"Link",description:"An optional link for the card (Link not available for Learning Objectives).",inputMethod:"url"},{property:"title",title:"Title",description:"Set Title, this overrides type based title",inputMethod:"textfield"},{property:"icon",title:"Icon",description:"Set icon, this overrides type based icon",inputMethod:"iconpicker"},{property:"accentColor",title:"Accent color",description:"Set accent color, this overrides type based color",inputMethod:"colorpicker"},{slot:"",title:"Contents"}],advanced:[]},saveOptions:{unsetAttributes:["t"]},demoSchema:[{tag:"learning-component",properties:{subtitle:"Unit 1"},content:"

By the end of this lesson, you should be able to...

"}]}}}customElements.define(LearningComponent.tag,LearningComponent);export{LearningComponent}; \ No newline at end of file diff --git a/cdn/build/es6/node_modules/@haxtheweb/course-model/course-model.js b/cdn/build/es6/node_modules/@haxtheweb/course-model/course-model.js index 36a607091..74464d5b7 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/course-model/course-model.js +++ b/cdn/build/es6/node_modules/@haxtheweb/course-model/course-model.js @@ -2,7 +2,7 @@ * Copyright 2023 * @license , see License.md for full text. */ -import{LitElement as e,html as t,css as i}from"../../lit/index.js";import"../../@google/model-viewer/dist/model-viewer.js";import"./lib/model-option.js";import"./lib/model-info.js";class CourseModel extends e{static get tag(){return"course-model"}static get properties(){return{visible:{type:String,reflect:!0},title:{type:String},src:{type:String},alt:{type:String}}}static get haxProperties(){return!this._sent&&window.HaxStore&&window.HaxStore.instance&&window.HaxStore.instance.ready&&(this._sent=!0,window.HaxStore.instance.setHaxProperties({api:"1",canScale:!0,canEditSource:!0,contentEditable:!1,gizmo:{title:"3d Model",description:"3D Model viewer",icon:"icons:android",color:"purple",tags:["Resource","3D","model","viewer"],handles:[],meta:{author:"Google"}},settings:{configure:[{property:"poster",title:"Poster image",inputMethod:"haxupload",noVoiceRecord:!0},{property:"src",title:"Source",inputMethod:"haxupload",noVoiceRecord:!0,noCamera:!0},{property:"alt",title:"Alternate Text",inputMethod:"alt"}],advanced:[{attribute:"environment-image",title:"Environment Image",inputMethod:"haxupload",noVoiceRecord:!0,noCamera:!0},{property:"ar",title:"Augmented Reality",inputMethod:"boolean"},{attribute:"camera-controls",title:"Camera controls",inputMethod:"boolean"},{attribute:"touch-action",title:"Touch action",inputMethod:"textfield"},{attribute:"shadow-intensity",title:"Shadow intensity",inputMethod:"number"}],developer:[]},demoSchema:[{tag:"model-viewer",content:"",properties:{alt:"Neil Armstrong's Spacesuit from the Smithsonian Digitization Programs Office and National Air and Space Museum",src:"https://modelviewer.dev/shared-assets/models/NeilArmstrong.glb",ar:!0,"environment-image":"https://modelviewer.dev/shared-assets/environments/moon_1k.hdr",poster:"https://modelviewer.dev/shared-assets/models/NeilArmstrong.webp","shadow-intensity":"1","camera-controls":!0,"touch-action":"pan-y",style:"height: 500px;"}}]},"model-viewer")),new URL(`./lib/${this.tag}.haxProperties.json`,import.meta.url).href}constructor(){super(),this.visible="model",this.title="",this.src="",this.addEventListener("model-select",this._srcChanged)}static get styles(){return[i` +import{LitElement as e,html as t,css as i}from"../../lit/index.js";import"../../@google/model-viewer/dist/model-viewer.js";import"./lib/model-option.js";import"./lib/model-info.js";class CourseModel extends e{static get tag(){return"course-model"}static get properties(){return{visible:{type:String,reflect:!0},title:{type:String},src:{type:String},alt:{type:String}}}static get haxProperties(){return!this._sent&&window.HaxStore&&window.HaxStore.instance&&window.HaxStore.instance.ready&&(this._sent=!0,window.HaxStore.instance.setHaxProperties({api:"1",canScale:!0,canEditSource:!0,contentEditable:!1,gizmo:{title:"3d Model",description:"3D Model viewer",icon:"3d-rotation",color:"purple",tags:["Resource","3D","model","viewer"],handles:[],meta:{author:"Google"}},settings:{configure:[{property:"poster",title:"Poster image",inputMethod:"haxupload",noVoiceRecord:!0},{property:"src",title:"Source",inputMethod:"haxupload",noVoiceRecord:!0,noCamera:!0},{property:"alt",title:"Alternate Text",inputMethod:"alt"}],advanced:[{attribute:"environment-image",title:"Environment Image",inputMethod:"haxupload",noVoiceRecord:!0,noCamera:!0},{property:"ar",title:"Augmented Reality",inputMethod:"boolean"},{attribute:"camera-controls",title:"Camera controls",inputMethod:"boolean"},{attribute:"touch-action",title:"Touch action",inputMethod:"textfield"},{attribute:"shadow-intensity",title:"Shadow intensity",inputMethod:"number"}],developer:[]},demoSchema:[{tag:"model-viewer",content:"",properties:{alt:"Neil Armstrong's Spacesuit from the Smithsonian Digitization Programs Office and National Air and Space Museum",src:"https://modelviewer.dev/shared-assets/models/NeilArmstrong.glb",ar:!0,"environment-image":"https://modelviewer.dev/shared-assets/environments/moon_1k.hdr",poster:"https://modelviewer.dev/shared-assets/models/NeilArmstrong.webp","shadow-intensity":"1","camera-controls":!0,"touch-action":"pan-y",style:"height: 500px;"}}]},"model-viewer")),new URL(`./lib/${this.tag}.haxProperties.json`,import.meta.url).href}constructor(){super(),this.visible="model",this.title="",this.src="",this.addEventListener("model-select",this._srcChanged)}static get styles(){return[i` :host { display: block; } diff --git a/cdn/build/es6/node_modules/@haxtheweb/course-model/lib/course-model.haxProperties.json b/cdn/build/es6/node_modules/@haxtheweb/course-model/lib/course-model.haxProperties.json index 8d9622b75..dc1430215 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/course-model/lib/course-model.haxProperties.json +++ b/cdn/build/es6/node_modules/@haxtheweb/course-model/lib/course-model.haxProperties.json @@ -7,7 +7,7 @@ "gizmo": { "title": "course model", "description": "", - "icon": "icons:android", + "icon": "3d-rotation", "color": "purple", "tags": ["Other", "Course", "Model", "Eberly"], "handles": [], diff --git a/cdn/build/es6/node_modules/@haxtheweb/fill-in-the-blanks/lib/fill-in-the-blanks.haxProperties.json b/cdn/build/es6/node_modules/@haxtheweb/fill-in-the-blanks/lib/fill-in-the-blanks.haxProperties.json index 53412bc95..5ca8b99f8 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/fill-in-the-blanks/lib/fill-in-the-blanks.haxProperties.json +++ b/cdn/build/es6/node_modules/@haxtheweb/fill-in-the-blanks/lib/fill-in-the-blanks.haxProperties.json @@ -13,7 +13,7 @@ "gizmo": { "title": "Fill in the blanks", "description": "", - "icon": "icons:android", + "icon": "editor:space-bar", "color": "purple", "tags": ["Instructional", "question"], "handles": [], @@ -55,7 +55,8 @@ "answers", "displayed-answers", "t", - "show-answer" + "show-answer", + "edit" ] }, "documentation": { diff --git a/cdn/build/es6/node_modules/@haxtheweb/hax-body/hax-body.js b/cdn/build/es6/node_modules/@haxtheweb/hax-body/hax-body.js index f2eeef6ef..2a444fba1 100755 --- a/cdn/build/es6/node_modules/@haxtheweb/hax-body/hax-body.js +++ b/cdn/build/es6/node_modules/@haxtheweb/hax-body/hax-body.js @@ -340,4 +340,4 @@ import{html as e,css as t,render as i,unsafeCSS as o}from"../../lit/index.js";im :host([edit-mode]) #bodycontainer ::slotted(*[data-hax-lock])::after { background-image: url("${o(this.__lockIconPath)}"); } - `),e}firstUpdated(e){i(this.HAXBODYStyleSheetContent(),this.shadowRoot.querySelector("#hax-body-style-element")),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"),parent:this.shadowRoot.querySelector("#topcontext")},this.shadowRoot.querySelector("slot").addEventListener("mouseup",(e=>{this.editMode&&setTimeout((()=>{const e=s.getSelection();s._tmpSelection=e,s.haxSelectedText=e.toString();try{const e=s.getRange();e.cloneRange&&(s._tmpRange=e.cloneRange())}catch(e){console.warn(e)}}),10)})),this.editMode=s.editMode,this.__tabTrap=!1,this.ready=!0,super.firstUpdated&&super.firstUpdated(e)}async updated(e){super.updated&&super.updated(e),e.forEach((async(e,t)=>{"editMode"==t&&void 0!==e&&setTimeout((async()=>{this.__ignoreActive=!0,await this._editModeChanged(this[t],e),setTimeout((()=>{this.__ignoreActive=!1}),100)}),0),"_useristyping"==t&&this[t]&&this.hideContextMenus(),"activeNode"==t&&this.ready&&void 0!==e&&await this._activeNodeChanged(this[t],e)}))}_toggleNodeLocking(e){e.detail.lock?(this.contextMenus.plate.disableDuplicate=!0,this.contextMenus.plate.disableOps=!0,this.contextMenus.plate.disableItemOps=!0,this.contextMenus.plate.canMoveElement=!1,e.detail.node.removeAttribute("contenteditable"),this.removeAttribute("contenteditable")):(this.contextMenus.plate.disableDuplicate=!1,this.contextMenus.plate.disableOps=!1,this.contextMenus.plate.disableItemOps=!1,this.contextMenus.plate.canMoveElement=this.canMoveElement,e.detail.node.setAttribute("contenteditable",!0),this.setAttribute("contenteditable",!0)),this.requestUpdate()}_keepContextVisible(e=null){this.editMode&&(clearTimeout(this.__contextVisibleLock),this.__contextVisibleLock=setTimeout((()=>{let e=!1;this.contextMenus.plate.classList.contains("hax-context-visible")&&(e=this.contextMenus.plate),e&&this.positionContextMenus()}),100))}_onKeyUp(e){if(["ArrowUp","ArrowDown"].includes(e.key)&&this.activeNode&&s.isTextElement(this.activeNode)&&!E.opened){let t=e.key;if(this[`timesClicked${t}`]++,this[`timesClicked${t}`]>=2&&this.activeNode===this.prevKeyActiveNode)if("ArrowUp"===t){if(this.activeNode.previousElementSibling&&"PAGE-BREAK"===this.activeNode.previousElementSibling.tagName)this.haxInsert("p","",{},this.activeNode.previousElementSibling);else if(this.activeNode.parentNode!==this&&this.activeNode.parentNode.previousElementSibling&&"PAGE-BREAK"===this.activeNode.parentNode.previousElementSibling.tagName)this.haxInsert("p","",{},this.activeNode.parentNode.previousElementSibling);else if(!this.activeNode.previousElementSibling&&this.activeNode.parentNode===this){let e=document.createElement("p");this.insertBefore(e,this.activeNode)}}else this.activeNode.nextElementSibling||this.children[this.children.length-1]!==this.activeNode?this.activeNode.parentNode&&this.activeNode.parentNode!==this&&!this.activeNode.parentNode.nextElementSibling&&this.children[this.children.length-1]===this.activeNode.parentNode&&this.haxInsert("p","",{},this.activeNode.parentNode):this.haxInsert("p","",{}),this[`timesClicked${t}`]=0,this.prevKeyActiveNode=null;else this.prevKeyActiveNode=this.activeNode;setTimeout((()=>{this[`timesClicked${t}`]=0,this.prevKeyActiveNode=null}),200)}}_onKeyDown(e){if(this.editMode&&"HAX-TRAY"!==document.activeElement.tagName&&"BODY"!==document.activeElement.tagName&&"SIMPLE-MODAL"!==document.activeElement.tagName&&this.getAttribute("contenteditable")){if(this.__dropActiveVisible(),this.__manageFakeEndCap(!1),null!=s.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":this._useristyping=!0,s.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._useristyping=!0,this.activeNode&&(this.__slot=this.activeNode.getAttribute("slot")),this.activeNode&&"P"===this.activeNode.tagName&&["1","#","`",">","-"].includes(this.activeNode.textContent[0])){const e=this.activeNode.textContent.replaceAll(/ /g," ");this.keyboardShortCutProcess(e)}break;case"Backspace":case"Delete":this.activeNode&&""==this.activeNode.textContent&&this.activeNode.previousElementSibling&&this.activeNode.previousElementSibling.tagName&&(["TABLE","EDITABLE-TABLE","IFRAME-LOADER","IFRAME","WEBVIEW"].includes(this.activeNode.previousElementSibling.tagName)||"PAGE-BREAK"===this.activeNode.previousElementSibling.tagName&&2===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}).length&&this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0})[1]===this.activeNode)&&e.preventDefault(),this._useristyping=!0,this.__delHit=!0,this.querySelectorAll("[data-hax-active]").forEach((e=>e.classList.remove)),setTimeout((()=>{const e=s.getSelection();s._tmpSelection=e,s.haxSelectedText=e.toString();const t=s.getRange();t.commonAncestorContainer&&this.activeNode!==t.commonAncestorContainer&&"function"==typeof t.commonAncestorContainer.focus?"HAX-BODY"!==t.commonAncestorContainer.tagName&&this.__focusLogic(t.commonAncestorContainer,!1):t.commonAncestorContainer&&t.commonAncestorContainer.parentNode&&this.activeNode!==t.commonAncestorContainer.parentNode&&"function"==typeof t.commonAncestorContainer.parentNode.focus&&("HAX-BODY"!==t.commonAncestorContainer.parentNode.tagName?this.__focusLogic(t.commonAncestorContainer.parentNode,!1):this.__focusLogic(t.commonAncestorContainer,!1))}),100);break;case"Escape":this._useristyping=!0;break;case"/":const t=s.getRange();this.activeNode&&s.isTextElement(this.activeNode)&&""==t.commonAncestorContainer.textContent.trim()&&(e.preventDefault(),E.mini=!0,E.activeRange=t,E.activeSelection=s.getSelection(),E.activeNode=t.commonAncestorContainer,E.runProgram(t.commonAncestorContainer.textContent.trim(),"*"),E.open());break;case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":this._useristyping=!0,this.querySelectorAll("[data-hax-active]").forEach((e=>e.classList.remove)),setTimeout((()=>{const e=s.getSelection();s._tmpSelection=e,s.haxSelectedText=e.toString();const t=s.getRange();t.commonAncestorContainer&&this.activeNode!==t.commonAncestorContainer&&"function"==typeof t.commonAncestorContainer.focus?"HAX-BODY"!==t.commonAncestorContainer.tagName&&this.__focusLogic(t.commonAncestorContainer,!1):t.commonAncestorContainer&&t.commonAncestorContainer.parentNode&&this.activeNode!==t.commonAncestorContainer.parentNode&&"function"==typeof t.commonAncestorContainer.parentNode.focus&&("HAX-BODY"!==t.commonAncestorContainer.parentNode.tagName?this.__focusLogic(t.commonAncestorContainer.parentNode,!1):this.__focusLogic(t.commonAncestorContainer,!1))}),0);break;default:this._useristyping=!0,setTimeout((()=>{if(this.activeNode&&"P"===this.activeNode.tagName&&["1","#","`",">","-"].includes(this.activeNode.textContent[0])){const e=this.activeNode.textContent.replaceAll(/ /g," ");" "===e[e.length-1]&&this.keyboardShortCutProcess(e)}}),0)}}}keyboardShortCutProcess(e){if(s.keyboardShortcuts[e.replace(" ","")]){let t=m(s.keyboardShortcuts[e.replace(" ","")]);this.haxReplaceNode(this.activeNode,t),this.__focusLogic(t),"HR"===t.tagName&&this.haxInsert("p","",{})}}setActiveNode(e,t=!1){e&&this.editMode&&this.activeNode&&(s.isTextElement(this.activeNode)||t)&&(s.activeNode=e,clearTimeout(this.__positionContextTimer),this.__positionContextTimer=setTimeout((()=>{this.__addActiveVisible(),this.positionContextMenus()}),2e3))}elementMidViewport(){const e=this.activeNode.getBoundingClientRect().y;return e<0&&e>-1*this.activeNode.offsetHeight+140}replacePlaceholder(e){if("text"===e.detail){let e=document.createElement("p");this.haxReplaceNode(this.activeNode,e),this.__focusLogic(e),this.activeNode.parentNode&&this.activeNode.parentNode.setAttribute("contenteditable",!0)}else this.replaceElementWorkflow()}async canTansformNode(e=null){return await this.replaceElementWorkflow(e,!0).length>0}async insertElementWorkflow(e=null,t=!1){}get primitiveTextBlocks(){return["p","div","pre","h1","h2","h3","h4","h5","h6"]}getAllSlotConfig(e){if(!e)return;let t=this.getParentGrid(e);return t&&t.tag?this.getSlotConfig(s.elementList[t.tag],slot):void 0}getParentGrid(e){return((e=e||this.activeNode)?e.slot:void 0)?u(e.parentNode):void 0}getSlotConfig(e="",t={}){let i=t.settings,o=i?Object.keys(i||{}).map((t=>i[t].filter((t=>!(!t.slot||e&&t.slot!==e))))).flat():void 0;return o&&o.length>0?o[0]:void 0}async replaceElementWorkflow(e=null,t=!1){null==e&&(e=this.activeNode);let i=await u(e,null);if(!i)return;let o="*",a=!1,n=(e||{}).slot,r=this.getParentGrid(e);"place-holder"===i.tag&&void 0!==i.properties.type?(o=i.properties.type,a=!0):this.primitiveTextBlocks.includes(i.tag)&&(a=!0);var l=i.content?{innerHTML:i.content}:{};if(void 0!==s.elementList[i.tag]&&!1!==s.elementList[i.tag].gizmo&&void 0!==s.elementList[i.tag].gizmo.handles&&s.elementList[i.tag].gizmo.handles.length>0){let e=s.elementList[i.tag].gizmo;for(var d=0;d!g.includes(e.tag)&&(!p||p.includes(e.tag))))),h.length>0){let i=e.tagName.toLowerCase(),o=i.replace("-"," ");void 0!==s.elementList[i]&&!1!==s.elementList[i].gizmo&&(o=s.elementList[i].gizmo.title),t||(s.activePlaceHolder=this.activeNode,s.haxAppPicker.presentOptions(h,"__convert",`Change ${o} to...`,"gizmo"))}else t||s.toast("Sorry, this can not be transformed!",5e3);return h}haxClearBody(e=!0){let t=!0;e&&(t=prompt("Are you sure you want to delete all content?")),t&&c(this)}haxInsert(e,t,i={},o=this.activeNode,a=!1){var n=document.createElement(e);n.innerHTML=t;const r=n.cloneNode(!0);for(var l in i){let e=g(l);""!=e&&i.hasOwnProperty(l)&&(!0===i[l]?r.setAttribute(e,e):!1===i[l]?r.removeAttribute(e):null!=i[l]&&i[l].constructor===Array||null!=i[l]&&i[l].constructor===Object?r.properties&&r.properties[l].readOnly||(r.set?r.set(e,i[l]):r[e]=i[l]):r.setAttribute(e,i[l]))}return null!==s.activePlaceHolder&&void 0!==s.activePlaceHolder.style?(r.style.width=s.activePlaceHolder.style.width,r.style.float=s.activePlaceHolder.style.float,r.style.margin=s.activePlaceHolder.style.margin,r.style.display=s.activePlaceHolder.style.display,this.haxReplaceNode(s.activePlaceHolder,r),s.activePlaceHolder=null):o&&o.parentNode?this.__isLayout(o.parentNode)?(null!=o.getAttribute("slot")&&r.setAttribute("slot",o.getAttribute("slot")),this.__addAbove?o.parentNode.insertBefore(r,o):o.parentNode.insertBefore(r,o.nextElementSibling)):o.parentNode&&o.parentNode.nextElementSibling?o.parentNode.nextElementSibling.parentNode.insertBefore(r,o.parentNode.nextElementSibling):o.parentNode&&o.nextElementSibling?this.__addAbove?o.parentNode.insertBefore(r,o):o.parentNode.insertBefore(r,o.nextElementSibling):o.parentNode&&o.parentNode.children[o.parentNode.children.length-1]===o?this.__addAbove?o.parentNode.insertBefore(r,o):o.parentNode.appendChild(r):o.parentNode?o.parentNode.insertBefore(r,o):this.appendChild(r):this.appendChild(r),this.contextMenus.text.hasSelectedText=!1,setTimeout((()=>{this.__focusLogic(r),this.scrollHere(r)}),0),r}async haxToContent(){this.hideContextMenus();var e=this.activeNode;s.activeNode=null;let t="slot"===this.shadowRoot.querySelector("#body").localName?this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}):[];for(var i="",o=0;o{if(!s._lockContextPosition){let t=e.tagName.toLowerCase();s._isSandboxed&&"webview"===t&&(t="iframe"),e&&"PAGE-BREAK"!==e.tagName?this._showContextMenu(this.contextMenus.plate):this._hideContextMenu(this.contextMenus.plate);let i=s.elementList[t];void 0===i||s.isTextElement(e)?this._showContextMenu(this.contextMenus.text):(this._hideContextMenu(this.contextMenus.text),i.element=e);(i||{}).gizmo;let o=i&&i.gizmo&&(i.gizmo.handles||[]).filter((e=>"inline"===(e||{}).type)).length>0;i&&"core"!=i.editingElement?setTimeout((()=>{(e&&e.parentNode||!o)&&(this.canMoveElement=!0)}),250):this.activeNode&&("LI"===this.activeNode.tagName||this._HTMLInlineTextDecorationTest(this.activeNode))?this.canMoveElement=!1:this.canMoveElement=!0}this.contextMenus.parent.setPosition()}),50)}}__addActiveVisible(){for(var e in this.contextMenus)("add"!=e||this.__activeHover)&&this.contextMenus[e].classList.add("hax-context-menu-active")}__dropActiveVisible(){for(var e in this.contextMenus)this.contextMenus[e].classList.remove("hax-context-menu-active");this.__activeHover=null}haxMoveGridPlate(e,t=1){this.___moveLock=!0;let i=e?e.parentNode:void 0,o=t>0?e.nextElementSibling:e.previousElementSibling,a=this.__layoutSlots(i)||[],n=e.getAttribute("slot"),r=n?a.indexOf(n):-1,l=a[r+t];!o||n&&o.getAttribute("slot");return!o||n&&n!==o.getAttribute("slot")?l?e.setAttribute("slot",l):e&&i&&i!==this&&(o=t>0?i.nextElementSibling:i,l=i.getAttribute("slot"),o&&(i.parentNode.insertBefore(e,o),l&&e.setAttribute("slot",l))):i.insertBefore(e,t>0?o.nextElementSibling:o),setTimeout((()=>{s.activeNode=e,this.scrollHere(e),this.__focusLogic(e)}),100),!0}async haxGridPlateOps(e=!0,t="right",i=this.activeNode){"GRID-PLATE"!==i.tagName&&"GRID-PLATE"===i.parentNode.tagName&&(i=i.parentNode);let o=!1;if("GRID-PLATE"===i.tagName){if(e)switch(i.layout){case"2-1":case"3-1":i.layout="2-1-1",o=!0;break;case"1-2":i.layout="1-2-1",o=!0;break;case"1-3":i.layout="1-1-2",o=!0;break;case"2-1-1":case"1-2-1":case"1-1-2":case"1-1-1":i.layout="1-1-1-1",o=!0;break;case"1":i.layout="1-1",o=!0;break;case"1-1":i.layout="1-1-1",o=!0}else switch(i.layout){case"2-1":case"1-2":case"1-3":case"3-1":case"1-1":case"1":let e;await i.childNodes.forEach((t=>{t.tagName&&(e=t.cloneNode(!0),i.getAttribute("slot")?e.setAttribute("slot",i.getAttribute("slot")):e.removeAttribute("slot"),i.parentNode.insertBefore(e,i))})),s.activeNode=e,setTimeout((()=>{i.remove()}),0),o=!0;break;case"1-1-1":i.layout="1-1",o=!0;break;case"1-1-1-1":i.layout="1-1-1",o=!0;break;case"2-1-1":i.layout="2-1",o=!0;break;case"1-2-1":case"1-1-2":i.layout="1-2",o=!0}if(o){let e=this.contextMenus.plate.shadowRoot.querySelector("#right"),o=this.contextMenus.plate.shadowRoot.querySelector("#rightremove");e.disabled=!1,o.disabled=!1,"1-1-1-1"==i.layout&&(e.disabled=!0),"left"==t&&i.childNodes.forEach((e=>{if(e.tagName){let t=parseInt(e.getAttribute("slot").replace("col-",""),10)+1;e.setAttribute("slot",`col-${t}`)}}))}}else{let e=document.createElement("grid-plate");e.layout="1-2-1",e.disableResponsive=!0,i.getAttribute("slot")&&e.setAttribute("slot",i.getAttribute("slot"));let t=i.cloneNode(!0);t.setAttribute("slot","col-2"),e.appendChild(t),i.parentNode.insertBefore(e,i),setTimeout((()=>{i.remove()}),0)}await s.refreshActiveNodeForm()}haxReplaceNode(e,t){try{null==e&&(e=this.__oldActiveNode),!e.replaceWith&&s._tmpRange&&(e=s._tmpRange,s._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}haxChangeTagName(e,t,i=!0){for(var o=document.createElement(t),a=0,n=e.attributes.length;a"==o.innerHTML?o.innerHTML="

  • ":"ul"!=e.tagName.toLowerCase()&&"ol"!=e.tagName.toLowerCase()&&(o.innerHTML="
  • "+e.innerHTML.trim().replace(//g,"
  • \n
  • ").replace(/
    /g,"
  • \n
  • ")+"
  • "):"ul"!=e.tagName.toLowerCase()&&"ol"!=e.tagName.toLowerCase()||(o.innerHTML=o.innerHTML.replace(/
      /g,"").replace(/<\/ul>/g,"").replace(/
    • <\/li>/g,"").replace(/
    • /g,"").replace(/<\/li>/g,"
      "));try{e.replaceWith(o),i&&setTimeout((()=>{let 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}haxDeleteNode(e){if(e.previousElementSibling)s.activeNode=e.previousElementSibling;else if(e.nextElementSibling)s.activeNode=e.nextElementSibling;else{this.haxInsert("p","",{});try{var t=document.createRange(),i=s.getSelection();t.setStart(this.activeNode,0),t.collapse(!0),i.removeAllRanges(),i.addRange(t),this.activeNode.focus()}catch(e){console.warn(e)}}try{return e.remove()}catch(e){console.warn(e)}}importContent(e,t=!0){t&&c(this,"*"),setTimeout((()=>{e=d(e);let t=document.createElement("div");for(t.insertAdjacentHTML("beforeend",e);null!==t.firstChild;)if(void 0!==t.firstChild.tagName)if(s._isSandboxed&&"iframe"===t.firstChild.tagName.toLowerCase()){for(var i=document.createElement("webview"),o=0,a=t.firstChild.attributes.length;o`col-${t}`)):s.slotsFromSchema(t).map((e=>e.slot))).reverse().forEach(((t,i)=>{0==i?e.querySelectorAll(`[slot=${t}]`).forEach((t=>e.append(t))):[...e.querySelectorAll(`[slot=${t}]`)].reverse().forEach((t=>e.insertBefore(t,e.firstChild)))}))}async _haxContextOperation(e){let t=e.detail,i=N(e),o=i&&i[0]?i[0].getAttribute("data-slot"):void 0;switch(t.eventName){case"insert-above-active":if(this.activeNode&&this.activeNode.previousElementSibling)this.haxInsert("p","",{},this.activeNode.previousElementSibling);else if(this.activeNode){let e=document.createElement("p");this.activeNode.getAttribute("slot")&&e.setAttribute("slot",this.activeNode.getAttribute("slot")),this.activeNode.parentNode.insertBefore(e,this.activeNode)}else this.appendChild(p);break;case"insert-below-active":this.haxInsert("p","",{});break;case"move-to-slot":o&&this.activeNode&&s.isGridPlateElement(this.activeNode.parentNode)&&(this.activeNode.slot=o,this.sortGridSlots(this.activeNode.parentNode));break;case"insert-into-active":if(o&&this.activeNode&&s.isGridPlateElement(this.activeNode)){let e=document.createElement("p");e.slot=o,this.activeNode.append(e),this.haxInsert("p","",{slot:o},e),e.remove(),this.sortGridSlots()}break;case"hax-select-grid":if(i[0]&&i[0].eventData){let e=i[0].eventData;this.setActiveNode(e,!0),this.positionContextMenus(e)}break;case"hax-select-grid-item":if(i[0]&&i[0].eventData){let e=i[0].eventData,t=e.target,o=e.slot,a=e.index,n=e.grid,s=e.editMode,r=e.invisible?n:[...n.children].filter((e=>o&&""!==o?e.slot===o:!e.slot||""===e.slot))[a]||t;n&&s?this.setSlotEditMode(n,s,r):(this.setActiveNode(node,!0),this.positionContextMenus(node))}break;case"hax-edit-element-toggle":if(i[0]&&i[0].eventData){let e=i[0].eventData;e&&e.target&&e.editMode&&this.toggleElementEditMode(e.target,e.editMode)}break;case"hax-source-view-toggle":if(this.activeNode.__haxSourceView){this.activeNode.__haxSourceView=!1;let e=await s.runHook(s.activeEditingElement,"activeElementChanged",[this.activeNode,!1]),t={};if(this.activeNode&&this.activeNode.tagName?t=s.haxSchemaFromTag(this.activeNode.tagName.toLowerCase()):this.activeNode.parentElement&&this.activeNode.parentElement.tagName&&(t=s.haxSchemaFromTag(this.activeNode.parentElement.tagName.toLowerCase())),this.activeNode&&this.activeNode.getAttribute&&null!=this.activeNode.getAttribute("slot")&&e.setAttribute("slot",this.activeNode.getAttribute("slot")),t.saveOptions&&t.saveOptions.unsetAttributes&&t.saveOptions.unsetAttributes.length)for(var a in t.saveOptions.unsetAttributes)e.removeAttribute(t.saveOptions.unsetAttributes[a]);this.__applyNodeEditableState(e,this.editMode),b(s.activeEditingElement),s.activeEditingElement=null,this.viewSourceToggle=!1}else this.activeNode.__haxSourceView=!0,s.activeEditingElement=document.createElement("code-editor"),s.activeEditingElement.language="html",s.activeEditingElement.title="",s.activeEditingElement.theme="vs",s.activeEditingElement.fontSize=12,s.activeEditingElement.wordWrap=!0,this.viewSourceToggle=!0,import("../code-editor/code-editor.js"),this.activeNode.getAttribute&&null!=this.activeNode.getAttribute("slot")&&s.activeEditingElement.setAttribute("slot",this.activeNode.getAttribute("slot")),this.__ignoreActive=!0,this.activeNode.removeAttribute("contenteditable"),this.__applyDragDropState(this.activeNode,!1),this.activeNode.removeAttribute("data-hax-active"),s.testHook(this.activeNode,"preProcessNodeToContent")&&(s.activeNode=await s.runHook(this.activeNode,"preProcessNodeToContent",[this.activeNode])),v(this.activeNode,s.activeEditingElement),s.activeEditingElement.focus();break;case"hax-full-text-editor-toggle":if(this.activeNode.__haxSourceView){this.activeNode.__haxSourceView=!1;let e=await s.runHook(s.activeEditingElement,"activeElementChanged",[this.activeNode,!1]),t=s.haxSchemaFromTag(this.activeNode.tagName.toLowerCase());if(this.activeNode&&this.activeNode.getAttribute&&null!=this.activeNode.getAttribute("slot")&&e.setAttribute("slot",this.activeNode.getAttribute("slot")),t.saveOptions&&t.saveOptions.unsetAttributes&&t.saveOptions.unsetAttributes.length)for(var a in t.saveOptions.unsetAttributes)e.removeAttribute(t.saveOptions.unsetAttributes[a]);this.__applyNodeEditableState(e,this.editMode),b(s.activeEditingElement),s.activeEditingElement=null,this.viewSourceElement=s.activeEditingElement}else this.activeNode.__haxSourceView=!0,import("../rich-text-editor/rich-text-editor.js").then((()=>{s.activeEditingElement=document.createElement("rich-text-editor"),s.activeEditingElement.type="rich-text-editor-toolbar-full",this.activeNode.getAttribute&&null!=this.activeNode.getAttribute("slot")&&s.activeEditingElement.setAttribute("slot",this.activeNode.getAttribute("slot")),this.__ignoreActive=!0,this.activeNode.removeAttribute("contenteditable"),this.__applyDragDropState(this.activeNode,!1),this.activeNode.removeAttribute("data-hax-active"),v(this.activeNode,s.activeEditingElement),this.viewSourceElement=s.activeEditingElement}));break;case"text-tag":s.activeNode=this.haxChangeTagName(this.activeNode,t.value),this.positionContextMenus();break;case"text-tag-ul":this.contextMenus.text.realSelectedValue="ul",s.activeNode=this.haxChangeTagName(this.activeNode,"ul"),this.positionContextMenus();break;case"text-tag-ol":this.contextMenus.text.realSelectedValue="ol",s.activeNode=this.haxChangeTagName(this.activeNode,"ol"),this.positionContextMenus();break;case"hax-transform-node":this.replaceElementWorkflow();break;case"hax-plate-create-right":this.haxGridPlateOps();break;case"hax-plate-remove-right":this.haxGridPlateOps(!1);break;case"hax-plate-duplicate":this.haxDuplicateNode(this.activeNode);break;case"hax-plate-delete":null!=this.activeNode&&this.haxDeleteNode(this.activeNode);break;case"hax-plate-up":this.activeNode.previousElementSibling&&"PAGE-BREAK"!==this.activeNode.previousElementSibling.tagName&&this.haxMoveGridPlate(this.activeNode,-1);break;case"hax-plate-down":this.activeNode.nextElementSibling&&this.haxMoveGridPlate(this.activeNode);break;case"content-edit":"content-edit"===s.haxTray.trayDetail&&(s.haxTray.collapsed=!1),s.haxTray.trayDetail="content-edit";break;case"super-daemon":const e=s.getRange();E.mini=!0,E.activeRange=e,E.activeSelection=s.getSelection();let n=this.activeNode;e.commonAncestorContainer.tagName?n=e.commonAncestorContainer:e.commonAncestorContainer.parentNode&&e.commonAncestorContainer.parentNode.tagName&&(n=e.commonAncestorContainer.parentNode),E.activeNode=n,E.runProgram(n.textContent.trim(),"*"),E.open();break;case"hide-context-menus":this.hideContextMenus()}}_focusIn(e){this.__mouseDown||this.__focusLogic(e.target)&&(e.stopPropagation(),e.stopImmediatePropagation())}__focusLogic(e,t=!0){let i=!1;if(this.editMode&&!this.__tabTrap){let o=e;("SPAN"===o.tagName&&s.isTextElement(o.parentNode)&&""==o.parentNode.getAttribute("slot")||"LI"===o.tagName&&s.isTextElement(o.parentNode)&&["UL","OL"].includes(o.parentNode.tagName))&&(o=e.parentNode);let a=null;if(this._validElementTest(o)&&o.parentNode&&o.parentNode.tagName){if("P"===o.parentNode.tagName&&""==o.parentNode.getAttribute("slot"))a=o,i=!0;else{for(;o.parentNode&&o.parentNode.tagName&&"HAX-BODY"!=o.parentNode.tagName;)null===a&&"B"!==o.tagName&&"I"!==o.tagName&&"STRONG"!==o.tagName&&"EM"!==o.tagName&&(a=o),o=o.parentNode;null===a?a=o:s.isGridPlateElement(o)}(this.activeNode&&this.activeNode.parentNode!==o&&!o.classList.contains("ignore-activation")||o.haxUIElement||o.classList.contains("ignore-activation"))&&(i=!0),a.haxUIElement||a.classList.contains("ignore-activation")||(s.activeNode=a,setTimeout((()=>{if(t&&!this.__mouseDown&&s.isTextElement(a))try{var e=document.createRange(),i=s.getSelection();e.setStart(this.activeNode,0),e.collapse(!0),i.removeAllRanges(),i.addRange(e),this.activeNode.focus()}catch(e){console.warn(e)}this.positionContextMenus(a)}),0),i=!0)}}else this.__tabTrap=!1;return i}scrollHere(e){setTimeout((()=>{e.scrollIntoView({behavior:"smooth",inline:"nearest",block:"end"})}),100)}undo(){super.undo(),setTimeout((()=>{let e=this.querySelector("[data-hax-active]");e?(this.__focusLogic(e),this.scrollHere(e)):this.hideContextMenus()}),0)}redo(){super.redo(),setTimeout((()=>{let e=this.querySelector("[data-hax-active]");e?(this.__focusLogic(e),this.scrollHere(e)):this.hideContextMenus()}),0)}async _editModeChanged(e,t){if(void 0!==t){if(this._applyContentEditable(e),e){if(this.children&&this.children[0]&&this.children[0].focus&&this.children[0].tagName)"PAGE-BREAK"===this.children[0].tagName&&this.children[1]&&this.children[1].focus?this.__focusLogic(this.children[1]):"PAGE-BREAK"===this.children[0].tagName?this.haxInsert("p","",{}):this.__focusLogic(this.children[0]);else{this.haxInsert("p","",{});try{var i=document.createRange(),o=s.getSelection();i.setStart(this.activeNode,0),i.collapse(!0),o.removeAllRanges(),o.addRange(i),this.activeNode.focus()}catch(e){console.warn(e)}}this._haxContextOperation({detail:{eventName:"content-edit",value:!0}})}else this.activeNode&&(this.unsetSlotEditMode(this.activeNode),this.unsetElementEditMode(this.activeNode));setTimeout((()=>{this.undoStack.undoStackLimit=50,this.undoStack.undoStackPosition=-1,this.undoStack.commands=[],this.undoStack.changed(),this.undoStackInitialValue=this.innerHTML,this.undoStackPrevValue=this.undoStackInitialValue}),0)}if(0==e){b(s.activeEditingElement),s.activeEditingElement=null,this.removeAttribute("contenteditable"),this.hideContextMenus();let e=this.querySelectorAll("[contenteditable],[data-hax-active]");for(var a=0;a{var t=!1;this.__ignoreActive||this.__dragMoving||this.undoStackIgnore||this.__fakeEndCap||!this.ready||!this.editMode||!this.shadowRoot?this.undoStackIgnore&&e.forEach((e=>{e.addedNodes.length>0&&e.addedNodes.forEach((e=>{this._validElementTest(e,!0)&&setTimeout((()=>{this.__applyNodeEditableState(e,this.editMode)}),0)}))})):e.forEach((e=>{if(e.removedNodes.length>0)for(var i of e.removedNodes)e.previousSibling&&this.activeNode;if(e.addedNodes.length>0){for(var i of e.addedNodes)if(this._validElementTest(i)){if(!this.__delHit&&"BR"===i.tagName&&i.parentElement&&s.__validGridTags().includes(i.parentElement.tagName.toLowerCase())&&i===i.parentElement.childNodes[i.parentElement.childNodes.length-1]){let e=i.parentElement;if(i.remove(),e.childNodes.length>0){let t=e.childNodes[e.childNodes.length-1];t.textContent+="​",s._positionCursorInNode(t,t.length)}continue}if(this.__delHit=!1,"P"===i.tagName&&i.children.length>0&&"P"===i.children[0].tagName){b(i);continue}if("P"===i.tagName&&i.parentElement&&"P"===i.parentElement.tagName){b(i.parentElement);continue}if(null!=i.getAttribute("slot")&&i.parentElement===this){i.removeAttribute("slot");continue}if("LI"===i.tagName&&i.children.length>0&&"SPAN"===i.children[0].tagName){this.activeNode!==i.children[0]&&this.activeNode!==i||(s.activeNode=i),b(i.children[0]);continue}if("LI"===i.tagName&&i.parentElement&&!["UL","OL"].includes(i.parentElement.tagName)){b(i);continue}if("P"===i.tagName&&i.children.length>0&&["P","LI"].includes(i.children[0].tagName)){b(i.children[0]);continue}if(this.__slot&&(i.setAttribute("slot",this.__slot),this.__slot=null),this.__indentTrap)if("SPAN"===i.tagName)i.parentNode===this?this.haxChangeTagName(i,"p",!0):"LI"===i.parentNode.tagName&&(i.parentNode.innerHTML=i.textContent);else if("BR"===i.tagName){i.remove();continue}if(!this.editMode||"true"!=i.getAttribute("contenteditable")&&!0!==i.getAttribute("contenteditable")&&"contenteditable"!=i.getAttribute("contenteditable")||this.__applyNodeEditableState(i,!this.editMode),this.__applyNodeEditableState(i,this.editMode),s.isGridPlateElement(i)){let e=i.querySelectorAll("*");for(var o=0;o{this.__indentTrap=!1}),0)}else this.ready&&this.editMode&&s.ready&&0===e.addedNodes.length&&e.removedNodes.length>0&&this.shadowRoot&&(1===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}).length&&"PAGE-BREAK"===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0})[0].tagName||0===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}).length)&&setTimeout((()=>{(1===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}).length&&"PAGE-BREAK"===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0})[0].tagName||0===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}).length)&&this.appendChild(document.createElement("p"))}),100)})),this.__ignoreActive&&(this.__ignoreActive=!1),s.haxTray.updateMap()})),this._observer.observe(this,{childList:!0,subtree:!0})):(this.windowControllers.abort(),this._observer.disconnect())}_haxResolvePreviousElement(e){for(e=e.previousElementSibling;null!=e&&void 0!==e.tagName&&"HAX-"===e.tagName.substring(0,4);)e=e.previousElementSibling;return e}_validElementTest(e,t=!1){return!(e.haxUIElement||!e.tagName||["TEMPLATE","HAX-BODY","FAKE-HAX-BODY-END"].includes(e.tagName))&&!(!t&&this._HTMLInlineTextDecorationTest(e)&&"HAX-BODY"!=e.parentNode)}_HTMLInlineTextDecorationTest(e){return["span","b","strong","i","em","u","strike"].includes(e.tagName.toLowerCase())}_HTMLPrimativeTest(e){return null!=e&&void 0!==e.tagName&&-1==e.tagName.indexOf("-")}_applyContentEditable(e,t=this.shadowRoot.querySelector("#body")){let i="slot"===t.localName?t.assignedNodes({flatten:!0}):[];0===i.length&&(i=t.children);for(var o=0;o{e.classList.remove("active")})),[...t.shadowRoot.querySelectorAll(".active")].forEach((e=>{e.classList.remove("active")}))}__layoutDragEnter(e){e.target.classList.add("active")}__layoutDragLeave(e){e.target.classList.remove("active")}__layoutMonitor(e){var t=N(e);t[0]&&t[0].assignedNodes&&t[0].assignedNodes().length&&t[0].parentNode&&t[0].parentNode.classList?t[0].parentNode.classList.add("has-nodes"):t[0].parentNode&&t[0].parentNode.classList&&t[0].parentNode.classList.remove("has-nodes")}__getLayoutOrder(e,t){if(!t.shadowRoot)return!1;let i=e.getAttribute("slot"),o=t.shadowRoot.querySelector(`[slot=${i}]`);return[...t.shadowRoot.querySelectorAll("[slot]")].map((e=>e.parentNode)).indexOf(o)||-1}__layoutCanMove(e,t,i){if(!t.shadowRoot)return!1;let o=t.shadowRoot.querySelector(`[slot=${slot}]`),a=[...t.shadowRoot.querySelectorAll("[slot]")].map((e=>e.parentNode)),n=(a.indexOf(o)||-1)+(i?-1:1);return n>=a[0]&&n<=a[a.length-1]}__layoutMove(e,t,i){if(!t.shadowRoot)return!1;let o=t.shadowRoot.querySelector(`[slot=${s}]`),a=[...t.shadowRoot.querySelectorAll("[slot]")].map((e=>e.parentNode)),n=a.indexOf(o)||-1,s=a[n+(i?-1:1)];s&&e.setAttribute("slot",s)}async __sortLayoutChildren(e){e.setAttribute("hax-layout-sorting",!0);try{let t=Array.prototype.reduce.call(e.querySelectorAll("[slot]"),(function(e,t){return e}),[]);t=t.sort((function(t,i){return this.__getLayoutOrder(t,e){t.parentNode===this&&e.appendChild(t)}))}catch(e){console.warn(e)}e.removeAttribute("hax-layout-sorting")}__layoutSlotValid(e,t){return this.__layoutSlots(t).includes(e.getAttribute("slot"))}__layoutSlots(e){return e.shadowRoot?[...e.shadowRoot.querySelectorAll("[slot]")].map((e=>e.getAttribute("name"))):[]}__applyDragDropState(e,t){let i={drop:t=>this.__layoutDropEvent.bind(this)(t,e),dragenter:this.__layoutDragEnter.bind(this),dragleave:this.__layoutDragEnter.bind(this),slotchange:this.__layoutMonitor.bind(this)};if(e.setAttribute("data-hax-layout",!0),s.isGridPlateElement(e)&&e.setAttribute("data-hax-grid",!0),t&&e.setAttribute("data-hax-ray",t),t&&e.shadowRoot){e.addEventListener("drop",i.drop);let t=[...e.shadowRoot.querySelectorAll("drag-enabled")],o=[...e.shadowRoot.querySelectorAll("slot")];t.forEach((e=>{e.addEventListener("dragenter",i.dragenter),e.addEventListener("dragleave",i.dragleave)})),o.forEach((e=>e.addEventListener("slotchange",i.slotchange))),e.haxLayoutObserver=new MutationObserver((t=>{e.getAttribute("hax-layout-sorting")||(t.forEach((t=>{t.addedNodes.forEach((t=>{t.tagName&&t!==this&&t.parentElement&&"HAX-BODY"!==t.parentElement.tagName&&!this.__layoutSlotValid(t,e)&&this.__layoutSlots(e).length>0&&t.setAttribute("slot",this.__layoutSlots(e)[0])}))})),this.__sortLayoutChildren(e))})),e.haxLayoutObserver.observe(this,{childList:!0})}else if(e.shadowRoot){e.haxLayoutObserver&&e.haxLayoutObserver.disconnect(),this.removeEventListener("drop",i.drop);let t=[...e.shadowRoot.querySelectorAll("drag-enabled")],o=[...e.shadowRoot.querySelectorAll("slot")];t.forEach((e=>{e.removeEventListener("dragenter",i.dragenter),e.removeEventListener("dragleave",i.dragleave)})),o.forEach((e=>e.removeEventListener("slotchange",i.slotchange))),e.removeAttribute("data-hax-ray")}}__isLayout(e){return e&&s.haxSchemaFromTag(e.tagName)&&"grid"===s.haxSchemaFromTag(e.tagName).type}__applyNodeEditableState(e,t=!0){let i;if(!e.tagName)return!1;let o=e.tagName.replace("-"," ").toLowerCase(),a=l(s.gizmoList).findIndex((t=>{if(t)return t.tag===e.tagName.toLowerCase()}));if(-1!==a&&(o=l(s.gizmoList)[a].title),"PAGE-BREAK"!==e.tagName?("IMG"==e.tagName&&e.setAttribute("draggable",!1),t?(this.__applyDragDropState(e,o),i="addEventListener"):(this.__applyDragDropState(e,!1),i="removeEventListener"),e[i]("drop",this.dropEvent.bind(this)),e[i]("dragenter",this.dragEnter.bind(this)),e[i]("dragleave",this.dragLeave.bind(this)),e[i]("dragover",(e=>{this.__dragMoving=!0,e.preventDefault()}))):t?e.setAttribute("data-hax-ray",""):e.removeAttribute("data-hax-ray"),this._HTMLPrimativeTest(e)&&(t?e.setAttribute("contenteditable",t):e.removeAttribute("contenteditable"),e.querySelectorAll("a").length>0)){let o=e.querySelectorAll("a");for(var n=0,r=o.length;n{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()}))}}undoManagerStackLogic(e){this.__dragMoving||(this.querySelectorAll(".hax-hovered").forEach((e=>{e.classList.remove("hax-hovered")})),super.undoManagerStackLogic(e))}dropEvent(e){if(this.editMode){this.__dragMoving=!1,this.undoManagerStackLogic({}),clearTimeout(A),s._lockContextPosition=!1,s.haxTray.activeTab="item-1";var t,i=null,o=N(e);if(null!==(i=e.target.closest("[data-hax-layout]")&&e.target.parentNode!=e.target.closest("[data-hax-layout]")?e.target.closest("[data-hax-layout]"):e.target.closest("[contenteditable],img")?e.target.closest("[contenteditable],img"):e.originalTarget?e.originalTarget:e.target).getAttribute("data-hax-lock"))return!1;o[0].classList.contains("column")?this.__slot=o[0].getAttribute("id").replace("col","col-"):i.getAttribute("slot")&&(this.__slot=i.getAttribute("slot")),this.querySelectorAll(".hax-hovered").forEach((e=>{e.classList.remove("hax-hovered")})),this.querySelectorAll(".active").forEach((e=>{e.classList.remove("active")})),s.activeNode=i;try{if(null===s.__dragTarget&&e.dataTransfer&&e.dataTransfer.items&&e.dataTransfer.items.length>0&&"file"===e.dataTransfer.items[0].kind){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();let i=document.createElement("p");e.target.closest("[data-hax-layout]")&&e.target.parentNode!=e.target.closest("[data-hax-layout]")?t=e.target.closest("[data-hax-layout]"):e.target.closest("[contenteditable],img")&&(t=e.target.closest("[contenteditable],img")),t&&(t.tagName&&"HAX-BODY"!==t.tagName||!t.getAttribute("data-hax-layout"))||this.__isLayout(o[0])?(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(i=s.__dragTarget,t=e.target,e.target.closest("[data-hax-layout]")&&e.target.parentNode!=e.target.closest("[data-hax-layout]")?t=e.target.closest("[data-hax-layout]"):e.target.closest("[contenteditable],img")&&(t=e.target.closest("[contenteditable],img")),t&&i&&this._validElementTest(i)&&i!==t){try{"HAX-BODY"!==t.tagName&&!this.__isLayout(t)||this.__isLayout(o[0])?(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-")):"HAX-BODY"===t.tagName&&i.getAttribute("slot")&&i.removeAttribute("slot"),t.appendChild(i))}catch(e){console.warn(e)}e.preventDefault(),e.stopPropagation()}i&&this._validElementTest(i)&&"function"==typeof i.focus&&(s.activeNode=i,s.testHook(s.activeNode,"trayDragNDropToNode")&&s.runHook(s.activeNode,"trayDragNDropToNode",[s.activeNode]),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)}}s.__dragTarget=null,this.__manageFakeEndCap(!1)}dragEnter(e){this.editMode&&e.target&&s.__dragTarget&&(this.__dragMoving=!0,e.preventDefault(),e.target&&e.target.classList&&e.target.classList.add("hax-hovered"),this.handleMousemove(e))}handleMousemove(e){var t=e.clientX,i=e.clientY,o=document.documentElement.clientWidth,a=document.documentElement.clientHeight,n=w,s=w,r=a-w,l=o-w,d=t<200,c=t>l,h=i<200,u=i>r;if(d||c||h||u){var m=Math.max(document.body.scrollWidth,document.body.offsetWidth,document.body.clientWidth,document.documentElement.scrollWidth,document.documentElement.offsetWidth,document.documentElement.clientWidth),g=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.body.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight,document.documentElement.clientHeight),p=m-o,v=g-a;!function checkForWindowScroll(){clearTimeout(A),function adjustWindowScroll(){var e=window.pageXOffset,o=window.pageYOffset,a=o>0,m=o0,b=ee[i]=t[i])),e.removeAttribute("data-grid-saved-settings")}}setSlotEditMode(e,t,i){let o=e.getAttribute("data-grid-saved-settings")?JSON.parse(e.getAttribute("data-grid-saved-settings")):{},a=Object.keys(o);Object.keys(t||{}).forEach((i=>{a.includes(i)||(o[i]=e[i]),e[i]=t[i]})),e.setAttribute("data-grid-saved-settings",JSON.stringify(o))}async _activeNodeChanged(e,t){if(window.SimplePopoverManager.requestAvailability().opened=!1,this.contextMenus.plate.disableDuplicate=!1,this.contextMenus.plate.disableOps=!1,this.contextMenus.plate.disableItemOps=!1,this.contextMenus.plate.canMoveElement=this.canMoveElement,setTimeout((()=>{this.prevKeyActiveNode=null}),5),t&&t.removeAttribute("data-hax-active"),e&&e.setAttribute("data-hax-active","data-hax-active"),e&&t&&s.isGridPlateElement(e)&&(this.__ignoreActive=!0),this.editMode&&null!=e&&e.parentNode&&e.tagName){let t=e.tagName.toLowerCase();(s.isTextElement(e)||"HR"===e.tagName||s.isGridPlateElement(e))&&null===e.getAttribute("data-hax-lock")&&null===e.parentNode.getAttribute("data-hax-lock")?(e.setAttribute("contenteditable",!0),this.setAttribute("contenteditable",!0)):(e.removeAttribute("contenteditable"),this.removeAttribute("contenteditable")),this._keepContextVisible(),this.contextMenus.text.realSelectedValue=t}else null===e&&(this.hideContextMenus(),this.__oldActiveNode=t);if(this.editMode&&await s.runHook(t,"activeElementChanged",[t,!1])&&(this.__ignoreActive=!0),this.editMode&&await s.runHook(e,"activeElementChanged",[e,!0])&&(this.__ignoreActive=!0),this.editMode&&t&&t.tagName){let e=s.haxSchemaFromTag(t.tagName.toLowerCase());if("core"!=e.editingElement||t.parentNode&&t.parentNode.haxUIElement&&t.parentNode===s.activeEditingElement){this.__ignoreActive=!0;let o=await s.runHook(t.parentNode,"activeElementChanged",[t,!1]);if(o&&o!==t){if(t&&t.getAttribute&&null!=t.getAttribute("slot")&&o.setAttribute("slot",t.getAttribute("slot")),e.saveOptions&&e.saveOptions.unsetAttributes&&e.saveOptions.unsetAttributes.length)for(var i in e.saveOptions.unsetAttributes)o.removeAttribute(e.saveOptions.unsetAttributes[i]);this.__applyNodeEditableState(o,this.editMode)}b(s.activeEditingElement),s.activeEditingElement=null}}if(this.editMode&&e){let t=s.haxSchemaFromTag(e.tagName);if(t&&t.editingElement&&"core"!=t.editingElement){if(t.editingElement.import){let e=new URL("./hax-body.js",import.meta.url).href+"/../../../";window.WCGlobalBasePath&&(e=window.WCGlobalBasePath),await import(`${e}${t.editingElement.import}`)}s.activeEditingElement=document.createElement(t.editingElement.tag),e.getAttribute&&null!=e.getAttribute("slot")&&s.activeEditingElement.setAttribute("slot",e.getAttribute("slot")),t.editingElement.callback&&t.editingElement.callback(s.activeEditingElement),this.__ignoreActive=!0,v(e,s.activeEditingElement),await s.runHook(s.activeEditingElement,"activeElementChanged",[e,!0])}}!t||!t.parentNode||e&&e.parentNode&&e.parentNode===t.parentNode||this.unsetSlotEditMode(t.parentNode),this.unsetElementEditMode(t)}_getPosition(e){return{x:e.offsetLeft-e.scrollLeft+e.clientLeft,y:e.offsetTop-e.scrollTop+e.clientTop}}_showContextMenu(e){e.setAttribute("on-screen","on-screen"),e.classList.add("hax-context-visible","hax-context-menu-active")}_getContextContainer(e){let t=e&&e.parentNode?e.parentNode:void 0;return t&&t.nodeType?1==t.nodeType?t:t.host:void 0}_hideContextMenu(e){e&&(e.removeAttribute("on-screen"),e.classList.remove("hax-context-visible"),e.classList.remove("hax-context-menu-active"))}_tabKeyPressed(){if(this.activeNode&&s.getRange().cloneRange)try{let t=!1,i=this.activeNode.parentNode;const o=this.activeNode.parentNode.tagName;let a=s.getRange().cloneRange();var e=a.commonAncestorContainer.tagName;if(void 0===e&&(e=a.commonAncestorContainer.parentNode.tagName),["UL","OL","LI"].includes(o)||["UL","OL","LI"].includes(e))this.polyfillSafe&&(this.__tabTrap=!0,this.__indentTrap=!0,document.execCommand("indent"));else for(;!t;)null==i.nextSibling?t=!0:"function"===i.nextSibling.focus?(i.nextSibling.focus(),t=!0):i=i.nextSibling}catch(e){console.warn(e)}}_tabBackKeyPressed(){if(this.activeNode&&s.getRange().cloneRange)try{let t=this.activeNode.parentNode;const i=this.activeNode.parentNode.tagName;let o=s.getRange().cloneRange();var e=o.commonAncestorContainer.tagName;if(void 0===e&&(e=o.commonAncestorContainer.parentNode.tagName),["UL","OL","LI"].includes(i)||["UL","OL","LI"].includes(e))this.polyfillSafe&&(this.__tabTrap=!0,this.__indentTrap=!0,document.execCommand("outdent"));else{if(null!=t)for(;null!=t&&!this._validElementTest(t);)t=t.previousSibling;null!=t&&setTimeout((()=>{t.focus()}),50)}}catch(e){console.warn(e)}}}customElements.define(HaxBody.tag,HaxBody);export{HaxBody}; \ No newline at end of file + `),e}firstUpdated(e){i(this.HAXBODYStyleSheetContent(),this.shadowRoot.querySelector("#hax-body-style-element")),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"),parent:this.shadowRoot.querySelector("#topcontext")},this.shadowRoot.querySelector("slot").addEventListener("mouseup",(e=>{this.editMode&&setTimeout((()=>{const e=s.getSelection();s._tmpSelection=e,s.haxSelectedText=e.toString();try{const e=s.getRange();e.cloneRange&&(s._tmpRange=e.cloneRange())}catch(e){console.warn(e)}}),10)})),this.editMode=s.editMode,this.__tabTrap=!1,this.ready=!0,super.firstUpdated&&super.firstUpdated(e)}async updated(e){super.updated&&super.updated(e),e.forEach((async(e,t)=>{"editMode"==t&&void 0!==e&&setTimeout((async()=>{this.__ignoreActive=!0,await this._editModeChanged(this[t],e),setTimeout((()=>{this.__ignoreActive=!1}),100)}),0),"_useristyping"==t&&this[t]&&this.hideContextMenus(),"activeNode"==t&&this.ready&&void 0!==e&&await this._activeNodeChanged(this[t],e)}))}_toggleNodeLocking(e){e.detail.lock?(this.contextMenus.plate.disableDuplicate=!0,this.contextMenus.plate.disableOps=!0,this.contextMenus.plate.disableItemOps=!0,this.contextMenus.plate.canMoveElement=!1,e.detail.node.removeAttribute("contenteditable"),this.removeAttribute("contenteditable")):(this.contextMenus.plate.disableDuplicate=!1,this.contextMenus.plate.disableOps=!1,this.contextMenus.plate.disableItemOps=!1,this.contextMenus.plate.canMoveElement=this.canMoveElement,e.detail.node.setAttribute("contenteditable",!0),this.setAttribute("contenteditable",!0)),this.requestUpdate()}_keepContextVisible(e=null){this.editMode&&(clearTimeout(this.__contextVisibleLock),this.__contextVisibleLock=setTimeout((()=>{let e=!1;this.contextMenus.plate.classList.contains("hax-context-visible")&&(e=this.contextMenus.plate),e&&this.positionContextMenus()}),100))}_onKeyUp(e){if(["ArrowUp","ArrowDown"].includes(e.key)&&this.activeNode&&s.isTextElement(this.activeNode)&&!E.opened){let t=e.key;if(this[`timesClicked${t}`]++,this[`timesClicked${t}`]>=2&&this.activeNode===this.prevKeyActiveNode)if("ArrowUp"===t){if(this.activeNode.previousElementSibling&&"PAGE-BREAK"===this.activeNode.previousElementSibling.tagName)this.haxInsert("p","",{},this.activeNode.previousElementSibling);else if(this.activeNode.parentNode!==this&&this.activeNode.parentNode.previousElementSibling&&"PAGE-BREAK"===this.activeNode.parentNode.previousElementSibling.tagName)this.haxInsert("p","",{},this.activeNode.parentNode.previousElementSibling);else if(!this.activeNode.previousElementSibling&&this.activeNode.parentNode===this){let e=document.createElement("p");this.insertBefore(e,this.activeNode)}}else this.activeNode.nextElementSibling||this.children[this.children.length-1]!==this.activeNode?this.activeNode.parentNode&&this.activeNode.parentNode!==this&&!this.activeNode.parentNode.nextElementSibling&&this.children[this.children.length-1]===this.activeNode.parentNode&&this.haxInsert("p","",{},this.activeNode.parentNode):this.haxInsert("p","",{}),this[`timesClicked${t}`]=0,this.prevKeyActiveNode=null;else this.prevKeyActiveNode=this.activeNode;setTimeout((()=>{this[`timesClicked${t}`]=0,this.prevKeyActiveNode=null}),200)}}_onKeyDown(e){if(this.editMode&&"HAX-TRAY"!==document.activeElement.tagName&&"BODY"!==document.activeElement.tagName&&"SIMPLE-MODAL"!==document.activeElement.tagName&&this.getAttribute("contenteditable")){if(this.__dropActiveVisible(),this.__manageFakeEndCap(!1),null!=s.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":this._useristyping=!0,s.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._useristyping=!0,this.activeNode&&(this.__slot=this.activeNode.getAttribute("slot")),this.activeNode&&"P"===this.activeNode.tagName&&["1","#","`",">","-"].includes(this.activeNode.textContent[0])){const e=this.activeNode.textContent.replaceAll(/ /g," ");this.keyboardShortCutProcess(e)}break;case"Backspace":case"Delete":this.activeNode&&""==this.activeNode.textContent&&this.activeNode.previousElementSibling&&this.activeNode.previousElementSibling.tagName&&(["TABLE","EDITABLE-TABLE","IFRAME-LOADER","IFRAME","WEBVIEW"].includes(this.activeNode.previousElementSibling.tagName)||"PAGE-BREAK"===this.activeNode.previousElementSibling.tagName&&2===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}).length&&this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0})[1]===this.activeNode)&&e.preventDefault(),this._useristyping=!0,this.__delHit=!0,this.querySelectorAll("[data-hax-active]").forEach((e=>e.classList.remove)),setTimeout((()=>{const e=s.getSelection();s._tmpSelection=e,s.haxSelectedText=e.toString();const t=s.getRange();t.commonAncestorContainer&&this.activeNode!==t.commonAncestorContainer&&"function"==typeof t.commonAncestorContainer.focus?"HAX-BODY"!==t.commonAncestorContainer.tagName&&this.__focusLogic(t.commonAncestorContainer,!1):t.commonAncestorContainer&&t.commonAncestorContainer.parentNode&&this.activeNode!==t.commonAncestorContainer.parentNode&&"function"==typeof t.commonAncestorContainer.parentNode.focus&&("HAX-BODY"!==t.commonAncestorContainer.parentNode.tagName?this.__focusLogic(t.commonAncestorContainer.parentNode,!1):this.__focusLogic(t.commonAncestorContainer,!1))}),100);break;case"Escape":this._useristyping=!0;break;case"/":const t=s.getRange();this.activeNode&&s.isTextElement(this.activeNode)&&""==t.commonAncestorContainer.textContent.trim()&&(e.preventDefault(),E.mini=!0,E.activeRange=t,E.activeSelection=s.getSelection(),E.activeNode=t.commonAncestorContainer,E.runProgram(t.commonAncestorContainer.textContent.trim(),"*"),E.open());break;case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":this._useristyping=!0,this.querySelectorAll("[data-hax-active]").forEach((e=>e.classList.remove)),setTimeout((()=>{const e=s.getSelection();s._tmpSelection=e,s.haxSelectedText=e.toString();const t=s.getRange();t.commonAncestorContainer&&this.activeNode!==t.commonAncestorContainer&&"function"==typeof t.commonAncestorContainer.focus?"HAX-BODY"!==t.commonAncestorContainer.tagName&&this.__focusLogic(t.commonAncestorContainer,!1):t.commonAncestorContainer&&t.commonAncestorContainer.parentNode&&this.activeNode!==t.commonAncestorContainer.parentNode&&"function"==typeof t.commonAncestorContainer.parentNode.focus&&("HAX-BODY"!==t.commonAncestorContainer.parentNode.tagName?this.__focusLogic(t.commonAncestorContainer.parentNode,!1):this.__focusLogic(t.commonAncestorContainer,!1))}),0);break;default:this._useristyping=!0,setTimeout((()=>{if(this.activeNode&&"P"===this.activeNode.tagName&&["1","#","`",">","-"].includes(this.activeNode.textContent[0])){const e=this.activeNode.textContent.replaceAll(/ /g," ");" "===e[e.length-1]&&this.keyboardShortCutProcess(e)}}),0)}}}keyboardShortCutProcess(e){if(s.keyboardShortcuts[e.replace(" ","")]){let t=m(s.keyboardShortcuts[e.replace(" ","")]);this.haxReplaceNode(this.activeNode,t),this.__focusLogic(t),"HR"===t.tagName&&this.haxInsert("p","",{})}}setActiveNode(e,t=!1){e&&this.editMode&&this.activeNode&&(s.isTextElement(this.activeNode)||t)&&(s.activeNode=e,clearTimeout(this.__positionContextTimer),this.__positionContextTimer=setTimeout((()=>{this.__addActiveVisible(),this.positionContextMenus()}),2e3))}elementMidViewport(){const e=this.activeNode.getBoundingClientRect().y;return e<0&&e>-1*this.activeNode.offsetHeight+140}replacePlaceholder(e){if("text"===e.detail){let e=document.createElement("p");this.haxReplaceNode(this.activeNode,e),this.__focusLogic(e),this.activeNode.parentNode&&this.activeNode.parentNode.setAttribute("contenteditable",!0)}else this.replaceElementWorkflow()}async canTansformNode(e=null){return await this.replaceElementWorkflow(e,!0).length>0}async insertElementWorkflow(e=null,t=!1){}get primitiveTextBlocks(){return["p","div","pre","h1","h2","h3","h4","h5","h6"]}getAllSlotConfig(e){if(!e)return;let t=this.getParentGrid(e);return t&&t.tag?this.getSlotConfig(s.elementList[t.tag],slot):void 0}getParentGrid(e){return((e=e||this.activeNode)?e.slot:void 0)?u(e.parentNode):void 0}getSlotConfig(e="",t={}){let i=t.settings,o=i?Object.keys(i||{}).map((t=>i[t].filter((t=>!(!t.slot||e&&t.slot!==e))))).flat():void 0;return o&&o.length>0?o[0]:void 0}async replaceElementWorkflow(e=null,t=!1){null==e&&(e=this.activeNode);let i=await u(e,null);if(!i)return;let o=!1,a=(e||{}).slot,n=this.getParentGrid(e);this.primitiveTextBlocks.includes(i.tag)&&(o=!0);var r=i.content?{innerHTML:i.content}:{};if(void 0!==s.elementList[i.tag]&&!1!==s.elementList[i.tag].gizmo&&void 0!==s.elementList[i.tag].gizmo.handles&&s.elementList[i.tag].gizmo.handles.length>0){let e=s.elementList[i.tag].gizmo;for(var l=0;l!m.includes(e.tag)&&(!g||g.includes(e.tag))))),c.length>0){let i=e.tagName.toLowerCase(),o=i.replace("-"," ");void 0!==s.elementList[i]&&!1!==s.elementList[i].gizmo&&(o=s.elementList[i].gizmo.title),t||(s.activePlaceHolder=this.activeNode,s.haxAppPicker.presentOptions(c,"__convert",`Change ${o} to...`,"gizmo"))}else t||s.toast("Sorry, this can not be transformed!",5e3);return c}haxClearBody(e=!0){let t=!0;e&&(t=prompt("Are you sure you want to delete all content?")),t&&c(this)}haxInsert(e,t,i={},o=this.activeNode,a=!1){var n=document.createElement(e);n.innerHTML=t;const r=n.cloneNode(!0);for(var l in i){let e=g(l);""!=e&&i.hasOwnProperty(l)&&(!0===i[l]?r.setAttribute(e,e):!1===i[l]?r.removeAttribute(e):null!=i[l]&&i[l].constructor===Array||null!=i[l]&&i[l].constructor===Object?r.properties&&r.properties[l].readOnly||(r.set?r.set(e,i[l]):r[e]=i[l]):r.setAttribute(e,i[l]))}return null!==s.activePlaceHolder&&void 0!==s.activePlaceHolder.style?(r.style.width=s.activePlaceHolder.style.width,r.style.float=s.activePlaceHolder.style.float,r.style.margin=s.activePlaceHolder.style.margin,r.style.display=s.activePlaceHolder.style.display,this.haxReplaceNode(s.activePlaceHolder,r),s.activePlaceHolder=null):o&&o.parentNode?this.__isLayout(o.parentNode)?(null!=o.getAttribute("slot")&&r.setAttribute("slot",o.getAttribute("slot")),this.__addAbove?o.parentNode.insertBefore(r,o):o.parentNode.insertBefore(r,o.nextElementSibling)):o.parentNode&&o.parentNode.nextElementSibling?o.parentNode.nextElementSibling.parentNode.insertBefore(r,o.parentNode.nextElementSibling):o.parentNode&&o.nextElementSibling?this.__addAbove?o.parentNode.insertBefore(r,o):o.parentNode.insertBefore(r,o.nextElementSibling):o.parentNode&&o.parentNode.children[o.parentNode.children.length-1]===o?this.__addAbove?o.parentNode.insertBefore(r,o):o.parentNode.appendChild(r):o.parentNode?o.parentNode.insertBefore(r,o):this.appendChild(r):this.appendChild(r),this.contextMenus.text.hasSelectedText=!1,setTimeout((()=>{this.__focusLogic(r),this.scrollHere(r)}),0),r}async haxToContent(){this.hideContextMenus();var e=this.activeNode;s.activeNode=null;let t="slot"===this.shadowRoot.querySelector("#body").localName?this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}):[];for(var i="",o=0;o{if(!s._lockContextPosition){let t=e.tagName.toLowerCase();s._isSandboxed&&"webview"===t&&(t="iframe"),e&&"PAGE-BREAK"!==e.tagName?this._showContextMenu(this.contextMenus.plate):this._hideContextMenu(this.contextMenus.plate);let i=s.elementList[t];void 0===i||s.isTextElement(e)?this._showContextMenu(this.contextMenus.text):(this._hideContextMenu(this.contextMenus.text),i.element=e);(i||{}).gizmo;let o=i&&i.gizmo&&(i.gizmo.handles||[]).filter((e=>"inline"===(e||{}).type)).length>0;i&&"core"!=i.editingElement?setTimeout((()=>{(e&&e.parentNode||!o)&&(this.canMoveElement=!0)}),250):this.activeNode&&("LI"===this.activeNode.tagName||this._HTMLInlineTextDecorationTest(this.activeNode))?this.canMoveElement=!1:this.canMoveElement=!0}this.contextMenus.parent.setPosition()}),50)}}__addActiveVisible(){for(var e in this.contextMenus)("add"!=e||this.__activeHover)&&this.contextMenus[e].classList.add("hax-context-menu-active")}__dropActiveVisible(){for(var e in this.contextMenus)this.contextMenus[e].classList.remove("hax-context-menu-active");this.__activeHover=null}haxMoveGridPlate(e,t=1){this.___moveLock=!0;let i=e?e.parentNode:void 0,o=t>0?e.nextElementSibling:e.previousElementSibling,a=this.__layoutSlots(i)||[],n=e.getAttribute("slot"),r=n?a.indexOf(n):-1,l=a[r+t];!o||n&&o.getAttribute("slot");return!o||n&&n!==o.getAttribute("slot")?l?e.setAttribute("slot",l):e&&i&&i!==this&&(o=t>0?i.nextElementSibling:i,l=i.getAttribute("slot"),o&&(i.parentNode.insertBefore(e,o),l&&e.setAttribute("slot",l))):i.insertBefore(e,t>0?o.nextElementSibling:o),setTimeout((()=>{s.activeNode=e,this.scrollHere(e),this.__focusLogic(e)}),100),!0}async haxGridPlateOps(e=!0,t="right",i=this.activeNode){"GRID-PLATE"!==i.tagName&&"GRID-PLATE"===i.parentNode.tagName&&(i=i.parentNode);let o=!1;if("GRID-PLATE"===i.tagName){if(e)switch(i.layout){case"2-1":case"3-1":i.layout="2-1-1",o=!0;break;case"1-2":i.layout="1-2-1",o=!0;break;case"1-3":i.layout="1-1-2",o=!0;break;case"2-1-1":case"1-2-1":case"1-1-2":case"1-1-1":i.layout="1-1-1-1",o=!0;break;case"1":i.layout="1-1",o=!0;break;case"1-1":i.layout="1-1-1",o=!0}else switch(i.layout){case"2-1":case"1-2":case"1-3":case"3-1":case"1-1":case"1":let e;await i.childNodes.forEach((t=>{t.tagName&&(e=t.cloneNode(!0),i.getAttribute("slot")?e.setAttribute("slot",i.getAttribute("slot")):e.removeAttribute("slot"),i.parentNode.insertBefore(e,i))})),s.activeNode=e,setTimeout((()=>{i.remove()}),0),o=!0;break;case"1-1-1":i.layout="1-1",o=!0;break;case"1-1-1-1":i.layout="1-1-1",o=!0;break;case"2-1-1":i.layout="2-1",o=!0;break;case"1-2-1":case"1-1-2":i.layout="1-2",o=!0}if(o){let e=this.contextMenus.plate.shadowRoot.querySelector("#right"),o=this.contextMenus.plate.shadowRoot.querySelector("#rightremove");e.disabled=!1,o.disabled=!1,"1-1-1-1"==i.layout&&(e.disabled=!0),"left"==t&&i.childNodes.forEach((e=>{if(e.tagName){let t=parseInt(e.getAttribute("slot").replace("col-",""),10)+1;e.setAttribute("slot",`col-${t}`)}}))}}else{let e=document.createElement("grid-plate");e.layout="1-2-1",e.disableResponsive=!0,i.getAttribute("slot")&&e.setAttribute("slot",i.getAttribute("slot"));let t=i.cloneNode(!0);t.setAttribute("slot","col-2"),e.appendChild(t),i.parentNode.insertBefore(e,i),setTimeout((()=>{i.remove()}),0)}await s.refreshActiveNodeForm()}haxReplaceNode(e,t){try{null==e&&(e=this.__oldActiveNode),!e.replaceWith&&s._tmpRange&&(e=s._tmpRange,s._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}haxChangeTagName(e,t,i=!0){for(var o=document.createElement(t),a=0,n=e.attributes.length;a"==o.innerHTML?o.innerHTML="

    • ":"ul"!=e.tagName.toLowerCase()&&"ol"!=e.tagName.toLowerCase()&&(o.innerHTML="
    • "+e.innerHTML.trim().replace(//g,"
    • \n
    • ").replace(/
      /g,"
    • \n
    • ")+"
    • "):"ul"!=e.tagName.toLowerCase()&&"ol"!=e.tagName.toLowerCase()||(o.innerHTML=o.innerHTML.replace(/
        /g,"").replace(/<\/ul>/g,"").replace(/
      • <\/li>/g,"").replace(/
      • /g,"").replace(/<\/li>/g,"
        "));try{e.replaceWith(o),i&&setTimeout((()=>{let 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}haxDeleteNode(e){if(e.previousElementSibling)s.activeNode=e.previousElementSibling;else if(e.nextElementSibling)s.activeNode=e.nextElementSibling;else{this.haxInsert("p","",{});try{var t=document.createRange(),i=s.getSelection();t.setStart(this.activeNode,0),t.collapse(!0),i.removeAllRanges(),i.addRange(t),this.activeNode.focus()}catch(e){console.warn(e)}}try{return e.remove()}catch(e){console.warn(e)}}importContent(e,t=!0){t&&c(this,"*"),setTimeout((()=>{e=d(e);let t=document.createElement("div");for(t.insertAdjacentHTML("beforeend",e);null!==t.firstChild;)if(void 0!==t.firstChild.tagName)if(s._isSandboxed&&"iframe"===t.firstChild.tagName.toLowerCase()){for(var i=document.createElement("webview"),o=0,a=t.firstChild.attributes.length;o`col-${t}`)):s.slotsFromSchema(t).map((e=>e.slot))).reverse().forEach(((t,i)=>{0==i?e.querySelectorAll(`[slot=${t}]`).forEach((t=>e.append(t))):[...e.querySelectorAll(`[slot=${t}]`)].reverse().forEach((t=>e.insertBefore(t,e.firstChild)))}))}async _haxContextOperation(e){let t=e.detail,i=N(e),o=i&&i[0]?i[0].getAttribute("data-slot"):void 0;switch(t.eventName){case"insert-above-active":if(this.activeNode&&this.activeNode.previousElementSibling)this.haxInsert("p","",{},this.activeNode.previousElementSibling);else if(this.activeNode){let e=document.createElement("p");this.activeNode.getAttribute("slot")&&e.setAttribute("slot",this.activeNode.getAttribute("slot")),this.activeNode.parentNode.insertBefore(e,this.activeNode)}else this.appendChild(p);break;case"insert-below-active":this.haxInsert("p","",{});break;case"move-to-slot":o&&this.activeNode&&s.isGridPlateElement(this.activeNode.parentNode)&&(this.activeNode.slot=o,this.sortGridSlots(this.activeNode.parentNode));break;case"insert-into-active":if(o&&this.activeNode&&s.isGridPlateElement(this.activeNode)){let e=document.createElement("p");e.slot=o,this.activeNode.append(e),this.haxInsert("p","",{slot:o},e),e.remove(),this.sortGridSlots()}break;case"hax-select-grid":if(i[0]&&i[0].eventData){let e=i[0].eventData;this.setActiveNode(e,!0),this.positionContextMenus(e)}break;case"hax-select-grid-item":if(i[0]&&i[0].eventData){let e=i[0].eventData,t=e.target,o=e.slot,a=e.index,n=e.grid,s=e.editMode,r=e.invisible?n:[...n.children].filter((e=>o&&""!==o?e.slot===o:!e.slot||""===e.slot))[a]||t;n&&s?this.setSlotEditMode(n,s,r):(this.setActiveNode(node,!0),this.positionContextMenus(node))}break;case"hax-edit-element-toggle":if(i[0]&&i[0].eventData){let e=i[0].eventData;e&&e.target&&e.editMode&&this.toggleElementEditMode(e.target,e.editMode)}break;case"hax-source-view-toggle":if(this.activeNode.__haxSourceView){this.activeNode.__haxSourceView=!1;let e=await s.runHook(s.activeEditingElement,"activeElementChanged",[this.activeNode,!1]),t={};if(this.activeNode&&this.activeNode.tagName?t=s.haxSchemaFromTag(this.activeNode.tagName.toLowerCase()):this.activeNode.parentElement&&this.activeNode.parentElement.tagName&&(t=s.haxSchemaFromTag(this.activeNode.parentElement.tagName.toLowerCase())),this.activeNode&&this.activeNode.getAttribute&&null!=this.activeNode.getAttribute("slot")&&e.setAttribute("slot",this.activeNode.getAttribute("slot")),t.saveOptions&&t.saveOptions.unsetAttributes&&t.saveOptions.unsetAttributes.length)for(var a in t.saveOptions.unsetAttributes)e.removeAttribute(t.saveOptions.unsetAttributes[a]);this.__applyNodeEditableState(e,this.editMode),b(s.activeEditingElement),s.activeEditingElement=null,this.viewSourceToggle=!1}else this.activeNode.__haxSourceView=!0,s.activeEditingElement=document.createElement("code-editor"),s.activeEditingElement.language="html",s.activeEditingElement.title="",s.activeEditingElement.theme="vs",s.activeEditingElement.fontSize=12,s.activeEditingElement.wordWrap=!0,this.viewSourceToggle=!0,import("../code-editor/code-editor.js"),this.activeNode.getAttribute&&null!=this.activeNode.getAttribute("slot")&&s.activeEditingElement.setAttribute("slot",this.activeNode.getAttribute("slot")),this.__ignoreActive=!0,this.activeNode.removeAttribute("contenteditable"),this.__applyDragDropState(this.activeNode,!1),this.activeNode.removeAttribute("data-hax-active"),s.testHook(this.activeNode,"preProcessNodeToContent")&&(s.activeNode=await s.runHook(this.activeNode,"preProcessNodeToContent",[this.activeNode])),v(this.activeNode,s.activeEditingElement),s.activeEditingElement.focus();break;case"hax-full-text-editor-toggle":if(this.activeNode.__haxSourceView){this.activeNode.__haxSourceView=!1;let e=await s.runHook(s.activeEditingElement,"activeElementChanged",[this.activeNode,!1]),t=s.haxSchemaFromTag(this.activeNode.tagName.toLowerCase());if(this.activeNode&&this.activeNode.getAttribute&&null!=this.activeNode.getAttribute("slot")&&e.setAttribute("slot",this.activeNode.getAttribute("slot")),t.saveOptions&&t.saveOptions.unsetAttributes&&t.saveOptions.unsetAttributes.length)for(var a in t.saveOptions.unsetAttributes)e.removeAttribute(t.saveOptions.unsetAttributes[a]);this.__applyNodeEditableState(e,this.editMode),b(s.activeEditingElement),s.activeEditingElement=null,this.viewSourceElement=s.activeEditingElement}else this.activeNode.__haxSourceView=!0,import("../rich-text-editor/rich-text-editor.js").then((()=>{s.activeEditingElement=document.createElement("rich-text-editor"),s.activeEditingElement.type="rich-text-editor-toolbar-full",this.activeNode.getAttribute&&null!=this.activeNode.getAttribute("slot")&&s.activeEditingElement.setAttribute("slot",this.activeNode.getAttribute("slot")),this.__ignoreActive=!0,this.activeNode.removeAttribute("contenteditable"),this.__applyDragDropState(this.activeNode,!1),this.activeNode.removeAttribute("data-hax-active"),v(this.activeNode,s.activeEditingElement),this.viewSourceElement=s.activeEditingElement}));break;case"text-tag":s.activeNode=this.haxChangeTagName(this.activeNode,t.value),this.positionContextMenus();break;case"text-tag-ul":this.contextMenus.text.realSelectedValue="ul",s.activeNode=this.haxChangeTagName(this.activeNode,"ul"),this.positionContextMenus();break;case"text-tag-ol":this.contextMenus.text.realSelectedValue="ol",s.activeNode=this.haxChangeTagName(this.activeNode,"ol"),this.positionContextMenus();break;case"hax-transform-node":this.replaceElementWorkflow();break;case"hax-plate-create-right":this.haxGridPlateOps();break;case"hax-plate-remove-right":this.haxGridPlateOps(!1);break;case"hax-plate-duplicate":this.haxDuplicateNode(this.activeNode);break;case"hax-plate-delete":null!=this.activeNode&&this.haxDeleteNode(this.activeNode);break;case"hax-plate-up":this.activeNode.previousElementSibling&&"PAGE-BREAK"!==this.activeNode.previousElementSibling.tagName&&this.haxMoveGridPlate(this.activeNode,-1);break;case"hax-plate-down":this.activeNode.nextElementSibling&&this.haxMoveGridPlate(this.activeNode);break;case"content-edit":"content-edit"===s.haxTray.trayDetail&&(s.haxTray.collapsed=!1),s.haxTray.trayDetail="content-edit";break;case"super-daemon":const e=s.getRange();E.mini=!0,E.activeRange=e,E.activeSelection=s.getSelection();let n=this.activeNode;e.commonAncestorContainer.tagName?n=e.commonAncestorContainer:e.commonAncestorContainer.parentNode&&e.commonAncestorContainer.parentNode.tagName&&(n=e.commonAncestorContainer.parentNode),E.activeNode=n,E.runProgram(n.textContent.trim(),"*"),E.open();break;case"hide-context-menus":this.hideContextMenus()}}_focusIn(e){this.__mouseDown||this.__focusLogic(e.target)&&(e.stopPropagation(),e.stopImmediatePropagation())}__focusLogic(e,t=!0){let i=!1;if(this.editMode&&!this.__tabTrap){let o=e;("SPAN"===o.tagName&&s.isTextElement(o.parentNode)&&""==o.parentNode.getAttribute("slot")||"LI"===o.tagName&&s.isTextElement(o.parentNode)&&["UL","OL"].includes(o.parentNode.tagName))&&(o=e.parentNode);let a=null;if(this._validElementTest(o)&&o.parentNode&&o.parentNode.tagName){if("P"===o.parentNode.tagName&&""==o.parentNode.getAttribute("slot"))a=o,i=!0;else{for(;o.parentNode&&o.parentNode.tagName&&"HAX-BODY"!=o.parentNode.tagName;)null===a&&"B"!==o.tagName&&"I"!==o.tagName&&"STRONG"!==o.tagName&&"EM"!==o.tagName&&(a=o),o=o.parentNode;null===a?a=o:s.isGridPlateElement(o)}(this.activeNode&&this.activeNode.parentNode!==o&&!o.classList.contains("ignore-activation")||o.haxUIElement||o.classList.contains("ignore-activation"))&&(i=!0),a.haxUIElement||a.classList.contains("ignore-activation")||(s.activeNode=a,setTimeout((()=>{if(t&&!this.__mouseDown&&s.isTextElement(a))try{var e=document.createRange(),i=s.getSelection();e.setStart(this.activeNode,0),e.collapse(!0),i.removeAllRanges(),i.addRange(e),this.activeNode.focus()}catch(e){console.warn(e)}this.positionContextMenus(a)}),0),i=!0)}}else this.__tabTrap=!1;return i}scrollHere(e){setTimeout((()=>{e.scrollIntoView({behavior:"smooth",inline:"nearest",block:"end"})}),100)}undo(){super.undo(),setTimeout((()=>{let e=this.querySelector("[data-hax-active]");e?(this.__focusLogic(e),this.scrollHere(e)):this.hideContextMenus()}),0)}redo(){super.redo(),setTimeout((()=>{let e=this.querySelector("[data-hax-active]");e?(this.__focusLogic(e),this.scrollHere(e)):this.hideContextMenus()}),0)}async _editModeChanged(e,t){if(void 0!==t){if(this._applyContentEditable(e),e){if(this.children&&this.children[0]&&this.children[0].focus&&this.children[0].tagName)"PAGE-BREAK"===this.children[0].tagName&&this.children[1]&&this.children[1].focus?this.__focusLogic(this.children[1]):"PAGE-BREAK"===this.children[0].tagName?this.haxInsert("p","",{}):this.__focusLogic(this.children[0]);else{this.haxInsert("p","",{});try{var i=document.createRange(),o=s.getSelection();i.setStart(this.activeNode,0),i.collapse(!0),o.removeAllRanges(),o.addRange(i),this.activeNode.focus()}catch(e){console.warn(e)}}this._haxContextOperation({detail:{eventName:"content-edit",value:!0}})}else this.activeNode&&(this.unsetSlotEditMode(this.activeNode),this.unsetElementEditMode(this.activeNode));setTimeout((()=>{this.undoStack.undoStackLimit=50,this.undoStack.undoStackPosition=-1,this.undoStack.commands=[],this.undoStack.changed(),this.undoStackInitialValue=this.innerHTML,this.undoStackPrevValue=this.undoStackInitialValue}),0)}if(0==e){b(s.activeEditingElement),s.activeEditingElement=null,this.removeAttribute("contenteditable"),this.hideContextMenus();let e=this.querySelectorAll("[contenteditable],[data-hax-active]");for(var a=0;a{var t=!1;this.__ignoreActive||this.__dragMoving||this.undoStackIgnore||this.__fakeEndCap||!this.ready||!this.editMode||!this.shadowRoot?this.undoStackIgnore&&e.forEach((e=>{e.addedNodes.length>0&&e.addedNodes.forEach((e=>{this._validElementTest(e,!0)&&setTimeout((()=>{this.__applyNodeEditableState(e,this.editMode)}),0)}))})):e.forEach((e=>{if(e.removedNodes.length>0)for(var i of e.removedNodes)e.previousSibling&&this.activeNode;if(e.addedNodes.length>0){for(var i of e.addedNodes)if(this._validElementTest(i)){if(!this.__delHit&&"BR"===i.tagName&&i.parentElement&&s.__validGridTags().includes(i.parentElement.tagName.toLowerCase())&&i===i.parentElement.childNodes[i.parentElement.childNodes.length-1]){let e=i.parentElement;if(i.remove(),e.childNodes.length>0){let t=e.childNodes[e.childNodes.length-1];t.textContent+="​",s._positionCursorInNode(t,t.length)}continue}if(this.__delHit=!1,"P"===i.tagName&&i.children.length>0&&"P"===i.children[0].tagName){b(i);continue}if("P"===i.tagName&&i.parentElement&&"P"===i.parentElement.tagName){b(i.parentElement);continue}if(null!=i.getAttribute("slot")&&i.parentElement===this){i.removeAttribute("slot");continue}if("LI"===i.tagName&&i.children.length>0&&"SPAN"===i.children[0].tagName){this.activeNode!==i.children[0]&&this.activeNode!==i||(s.activeNode=i),b(i.children[0]);continue}if("LI"===i.tagName&&i.parentElement&&!["UL","OL"].includes(i.parentElement.tagName)){b(i);continue}if("P"===i.tagName&&i.children.length>0&&["P","LI"].includes(i.children[0].tagName)){b(i.children[0]);continue}if(this.__slot&&(i.setAttribute("slot",this.__slot),this.__slot=null),this.__indentTrap)if("SPAN"===i.tagName)i.parentNode===this?this.haxChangeTagName(i,"p",!0):"LI"===i.parentNode.tagName&&(i.parentNode.innerHTML=i.textContent);else if("BR"===i.tagName){i.remove();continue}if(!this.editMode||"true"!=i.getAttribute("contenteditable")&&!0!==i.getAttribute("contenteditable")&&"contenteditable"!=i.getAttribute("contenteditable")||this.__applyNodeEditableState(i,!this.editMode),this.__applyNodeEditableState(i,this.editMode),s.isGridPlateElement(i)){let e=i.querySelectorAll("*");for(var o=0;o{this.__indentTrap=!1}),0)}else this.ready&&this.editMode&&s.ready&&0===e.addedNodes.length&&e.removedNodes.length>0&&this.shadowRoot&&(1===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}).length&&"PAGE-BREAK"===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0})[0].tagName||0===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}).length)&&setTimeout((()=>{(1===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}).length&&"PAGE-BREAK"===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0})[0].tagName||0===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}).length)&&this.appendChild(document.createElement("p"))}),100)})),this.__ignoreActive&&(this.__ignoreActive=!1),s.haxTray.updateMap()})),this._observer.observe(this,{childList:!0,subtree:!0})):(this.windowControllers.abort(),this._observer.disconnect())}_haxResolvePreviousElement(e){for(e=e.previousElementSibling;null!=e&&void 0!==e.tagName&&"HAX-"===e.tagName.substring(0,4);)e=e.previousElementSibling;return e}_validElementTest(e,t=!1){return!(e.haxUIElement||!e.tagName||["TEMPLATE","HAX-BODY","FAKE-HAX-BODY-END"].includes(e.tagName))&&!(!t&&this._HTMLInlineTextDecorationTest(e)&&"HAX-BODY"!=e.parentNode)}_HTMLInlineTextDecorationTest(e){return["span","b","strong","i","em","u","strike"].includes(e.tagName.toLowerCase())}_HTMLPrimativeTest(e){return null!=e&&void 0!==e.tagName&&-1==e.tagName.indexOf("-")}_applyContentEditable(e,t=this.shadowRoot.querySelector("#body")){let i="slot"===t.localName?t.assignedNodes({flatten:!0}):[];0===i.length&&(i=t.children);for(var o=0;o{e.classList.remove("active")})),[...t.shadowRoot.querySelectorAll(".active")].forEach((e=>{e.classList.remove("active")}))}__layoutDragEnter(e){e.target.classList.add("active")}__layoutDragLeave(e){e.target.classList.remove("active")}__layoutMonitor(e){var t=N(e);t[0]&&t[0].assignedNodes&&t[0].assignedNodes().length&&t[0].parentNode&&t[0].parentNode.classList?t[0].parentNode.classList.add("has-nodes"):t[0].parentNode&&t[0].parentNode.classList&&t[0].parentNode.classList.remove("has-nodes")}__getLayoutOrder(e,t){if(!t.shadowRoot)return!1;let i=e.getAttribute("slot"),o=t.shadowRoot.querySelector(`[slot=${i}]`);return[...t.shadowRoot.querySelectorAll("[slot]")].map((e=>e.parentNode)).indexOf(o)||-1}__layoutCanMove(e,t,i){if(!t.shadowRoot)return!1;let o=t.shadowRoot.querySelector(`[slot=${slot}]`),a=[...t.shadowRoot.querySelectorAll("[slot]")].map((e=>e.parentNode)),n=(a.indexOf(o)||-1)+(i?-1:1);return n>=a[0]&&n<=a[a.length-1]}__layoutMove(e,t,i){if(!t.shadowRoot)return!1;let o=t.shadowRoot.querySelector(`[slot=${s}]`),a=[...t.shadowRoot.querySelectorAll("[slot]")].map((e=>e.parentNode)),n=a.indexOf(o)||-1,s=a[n+(i?-1:1)];s&&e.setAttribute("slot",s)}async __sortLayoutChildren(e){e.setAttribute("hax-layout-sorting",!0);try{let t=Array.prototype.reduce.call(e.querySelectorAll("[slot]"),(function(e,t){return e}),[]);t=t.sort((function(t,i){return this.__getLayoutOrder(t,e){t.parentNode===this&&e.appendChild(t)}))}catch(e){console.warn(e)}e.removeAttribute("hax-layout-sorting")}__layoutSlotValid(e,t){return this.__layoutSlots(t).includes(e.getAttribute("slot"))}__layoutSlots(e){return e.shadowRoot?[...e.shadowRoot.querySelectorAll("[slot]")].map((e=>e.getAttribute("name"))):[]}__applyDragDropState(e,t){let i={drop:t=>this.__layoutDropEvent.bind(this)(t,e),dragenter:this.__layoutDragEnter.bind(this),dragleave:this.__layoutDragEnter.bind(this),slotchange:this.__layoutMonitor.bind(this)};if(e.setAttribute("data-hax-layout",!0),s.isGridPlateElement(e)&&e.setAttribute("data-hax-grid",!0),t&&e.setAttribute("data-hax-ray",t),t&&e.shadowRoot){e.addEventListener("drop",i.drop);let t=[...e.shadowRoot.querySelectorAll("drag-enabled")],o=[...e.shadowRoot.querySelectorAll("slot")];t.forEach((e=>{e.addEventListener("dragenter",i.dragenter),e.addEventListener("dragleave",i.dragleave)})),o.forEach((e=>e.addEventListener("slotchange",i.slotchange))),e.haxLayoutObserver=new MutationObserver((t=>{e.getAttribute("hax-layout-sorting")||(t.forEach((t=>{t.addedNodes.forEach((t=>{t.tagName&&t!==this&&t.parentElement&&"HAX-BODY"!==t.parentElement.tagName&&!this.__layoutSlotValid(t,e)&&this.__layoutSlots(e).length>0&&t.setAttribute("slot",this.__layoutSlots(e)[0])}))})),this.__sortLayoutChildren(e))})),e.haxLayoutObserver.observe(this,{childList:!0})}else if(e.shadowRoot){e.haxLayoutObserver&&e.haxLayoutObserver.disconnect(),this.removeEventListener("drop",i.drop);let t=[...e.shadowRoot.querySelectorAll("drag-enabled")],o=[...e.shadowRoot.querySelectorAll("slot")];t.forEach((e=>{e.removeEventListener("dragenter",i.dragenter),e.removeEventListener("dragleave",i.dragleave)})),o.forEach((e=>e.removeEventListener("slotchange",i.slotchange))),e.removeAttribute("data-hax-ray")}}__isLayout(e){return e&&s.haxSchemaFromTag(e.tagName)&&"grid"===s.haxSchemaFromTag(e.tagName).type}__applyNodeEditableState(e,t=!0){let i;if(!e.tagName)return!1;let o=e.tagName.replace("-"," ").toLowerCase(),a=l(s.gizmoList).findIndex((t=>{if(t)return t.tag===e.tagName.toLowerCase()}));if(-1!==a&&(o=l(s.gizmoList)[a].title),"PAGE-BREAK"!==e.tagName?("IMG"==e.tagName&&e.setAttribute("draggable",!1),t?(this.__applyDragDropState(e,o),i="addEventListener"):(this.__applyDragDropState(e,!1),i="removeEventListener"),e[i]("drop",this.dropEvent.bind(this)),e[i]("dragenter",this.dragEnter.bind(this)),e[i]("dragleave",this.dragLeave.bind(this)),e[i]("dragover",(e=>{this.__dragMoving=!0,e.preventDefault()}))):t?e.setAttribute("data-hax-ray",""):e.removeAttribute("data-hax-ray"),this._HTMLPrimativeTest(e)&&(t?e.setAttribute("contenteditable",t):e.removeAttribute("contenteditable"),e.querySelectorAll("a").length>0)){let o=e.querySelectorAll("a");for(var n=0,r=o.length;n{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()}))}}undoManagerStackLogic(e){this.__dragMoving||(this.querySelectorAll(".hax-hovered").forEach((e=>{e.classList.remove("hax-hovered")})),super.undoManagerStackLogic(e))}dropEvent(e){if(this.editMode){this.__dragMoving=!1,this.undoManagerStackLogic({}),clearTimeout(A),s._lockContextPosition=!1,s.haxTray.activeTab="item-1";var t,i=null,o=N(e);if(null!==(i=e.target.closest("[data-hax-layout]")&&e.target.parentNode!=e.target.closest("[data-hax-layout]")?e.target.closest("[data-hax-layout]"):e.target.closest("[contenteditable],img")?e.target.closest("[contenteditable],img"):e.originalTarget?e.originalTarget:e.target).getAttribute("data-hax-lock"))return!1;o[0].classList.contains("column")?this.__slot=o[0].getAttribute("id").replace("col","col-"):i.getAttribute("slot")&&(this.__slot=i.getAttribute("slot")),this.querySelectorAll(".hax-hovered").forEach((e=>{e.classList.remove("hax-hovered")})),this.querySelectorAll(".active").forEach((e=>{e.classList.remove("active")})),s.activeNode=i;try{if(null===s.__dragTarget&&e.dataTransfer&&e.dataTransfer.items&&e.dataTransfer.items.length>0&&"file"===e.dataTransfer.items[0].kind){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();let i=document.createElement("p");e.target.closest("[data-hax-layout]")&&e.target.parentNode!=e.target.closest("[data-hax-layout]")?t=e.target.closest("[data-hax-layout]"):e.target.closest("[contenteditable],img")&&(t=e.target.closest("[contenteditable],img")),t&&(t.tagName&&"HAX-BODY"!==t.tagName||!t.getAttribute("data-hax-layout"))||this.__isLayout(o[0])?(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(i=s.__dragTarget,t=e.target,e.target.closest("[data-hax-layout]")&&e.target.parentNode!=e.target.closest("[data-hax-layout]")?t=e.target.closest("[data-hax-layout]"):e.target.closest("[contenteditable],img")&&(t=e.target.closest("[contenteditable],img")),t&&i&&this._validElementTest(i)&&i!==t){try{"HAX-BODY"!==t.tagName&&!this.__isLayout(t)||this.__isLayout(o[0])?(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-")):"HAX-BODY"===t.tagName&&i.getAttribute("slot")&&i.removeAttribute("slot"),t.appendChild(i))}catch(e){console.warn(e)}e.preventDefault(),e.stopPropagation()}i&&this._validElementTest(i)&&"function"==typeof i.focus&&(s.activeNode=i,s.testHook(s.activeNode,"trayDragNDropToNode")&&s.runHook(s.activeNode,"trayDragNDropToNode",[s.activeNode]),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)}}s.__dragTarget=null,this.__manageFakeEndCap(!1)}dragEnter(e){this.editMode&&e.target&&s.__dragTarget&&(this.__dragMoving=!0,e.preventDefault(),e.target&&e.target.classList&&e.target.classList.add("hax-hovered"),this.handleMousemove(e))}handleMousemove(e){var t=e.clientX,i=e.clientY,o=document.documentElement.clientWidth,a=document.documentElement.clientHeight,n=w,s=w,r=a-w,l=o-w,d=t<200,c=t>l,h=i<200,u=i>r;if(d||c||h||u){var m=Math.max(document.body.scrollWidth,document.body.offsetWidth,document.body.clientWidth,document.documentElement.scrollWidth,document.documentElement.offsetWidth,document.documentElement.clientWidth),g=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.body.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight,document.documentElement.clientHeight),p=m-o,v=g-a;!function checkForWindowScroll(){clearTimeout(A),function adjustWindowScroll(){var e=window.pageXOffset,o=window.pageYOffset,a=o>0,m=o0,b=ee[i]=t[i])),e.removeAttribute("data-grid-saved-settings")}}setSlotEditMode(e,t,i){let o=e.getAttribute("data-grid-saved-settings")?JSON.parse(e.getAttribute("data-grid-saved-settings")):{},a=Object.keys(o);Object.keys(t||{}).forEach((i=>{a.includes(i)||(o[i]=e[i]),e[i]=t[i]})),e.setAttribute("data-grid-saved-settings",JSON.stringify(o))}async _activeNodeChanged(e,t){if(window.SimplePopoverManager.requestAvailability().opened=!1,this.contextMenus.plate.disableDuplicate=!1,this.contextMenus.plate.disableOps=!1,this.contextMenus.plate.disableItemOps=!1,this.contextMenus.plate.canMoveElement=this.canMoveElement,setTimeout((()=>{this.prevKeyActiveNode=null}),5),t&&t.removeAttribute("data-hax-active"),e&&e.setAttribute("data-hax-active","data-hax-active"),e&&t&&s.isGridPlateElement(e)&&(this.__ignoreActive=!0),this.editMode&&null!=e&&e.parentNode&&e.tagName){let t=e.tagName.toLowerCase();(s.isTextElement(e)||"HR"===e.tagName||s.isGridPlateElement(e))&&null===e.getAttribute("data-hax-lock")&&null===e.parentNode.getAttribute("data-hax-lock")?(e.setAttribute("contenteditable",!0),this.setAttribute("contenteditable",!0)):(e.removeAttribute("contenteditable"),this.removeAttribute("contenteditable")),this._keepContextVisible(),this.contextMenus.text.realSelectedValue=t}else null===e&&(this.hideContextMenus(),this.__oldActiveNode=t);if(this.editMode&&await s.runHook(t,"activeElementChanged",[t,!1])&&(this.__ignoreActive=!0),this.editMode&&await s.runHook(e,"activeElementChanged",[e,!0])&&(this.__ignoreActive=!0),this.editMode&&t&&t.tagName){let e=s.haxSchemaFromTag(t.tagName.toLowerCase());if("core"!=e.editingElement||t.parentNode&&t.parentNode.haxUIElement&&t.parentNode===s.activeEditingElement){this.__ignoreActive=!0;let o=await s.runHook(t.parentNode,"activeElementChanged",[t,!1]);if(o&&o!==t){if(t&&t.getAttribute&&null!=t.getAttribute("slot")&&o.setAttribute("slot",t.getAttribute("slot")),e.saveOptions&&e.saveOptions.unsetAttributes&&e.saveOptions.unsetAttributes.length)for(var i in e.saveOptions.unsetAttributes)o.removeAttribute(e.saveOptions.unsetAttributes[i]);this.__applyNodeEditableState(o,this.editMode)}b(s.activeEditingElement),s.activeEditingElement=null}}if(this.editMode&&e){let t=s.haxSchemaFromTag(e.tagName);if(t&&t.editingElement&&"core"!=t.editingElement){if(t.editingElement.import){let e=new URL("./hax-body.js",import.meta.url).href+"/../../../";window.WCGlobalBasePath&&(e=window.WCGlobalBasePath),await import(`${e}${t.editingElement.import}`)}s.activeEditingElement=document.createElement(t.editingElement.tag),e.getAttribute&&null!=e.getAttribute("slot")&&s.activeEditingElement.setAttribute("slot",e.getAttribute("slot")),t.editingElement.callback&&t.editingElement.callback(s.activeEditingElement),this.__ignoreActive=!0,v(e,s.activeEditingElement),await s.runHook(s.activeEditingElement,"activeElementChanged",[e,!0])}}!t||!t.parentNode||e&&e.parentNode&&e.parentNode===t.parentNode||this.unsetSlotEditMode(t.parentNode),this.unsetElementEditMode(t)}_getPosition(e){return{x:e.offsetLeft-e.scrollLeft+e.clientLeft,y:e.offsetTop-e.scrollTop+e.clientTop}}_showContextMenu(e){e.setAttribute("on-screen","on-screen"),e.classList.add("hax-context-visible","hax-context-menu-active")}_getContextContainer(e){let t=e&&e.parentNode?e.parentNode:void 0;return t&&t.nodeType?1==t.nodeType?t:t.host:void 0}_hideContextMenu(e){e&&(e.removeAttribute("on-screen"),e.classList.remove("hax-context-visible"),e.classList.remove("hax-context-menu-active"))}_tabKeyPressed(){if(this.activeNode&&s.getRange().cloneRange)try{let t=!1,i=this.activeNode.parentNode;const o=this.activeNode.parentNode.tagName;let a=s.getRange().cloneRange();var e=a.commonAncestorContainer.tagName;if(void 0===e&&(e=a.commonAncestorContainer.parentNode.tagName),["UL","OL","LI"].includes(o)||["UL","OL","LI"].includes(e))this.polyfillSafe&&(this.__tabTrap=!0,this.__indentTrap=!0,document.execCommand("indent"));else for(;!t;)null==i.nextSibling?t=!0:"function"===i.nextSibling.focus?(i.nextSibling.focus(),t=!0):i=i.nextSibling}catch(e){console.warn(e)}}_tabBackKeyPressed(){if(this.activeNode&&s.getRange().cloneRange)try{let t=this.activeNode.parentNode;const i=this.activeNode.parentNode.tagName;let o=s.getRange().cloneRange();var e=o.commonAncestorContainer.tagName;if(void 0===e&&(e=o.commonAncestorContainer.parentNode.tagName),["UL","OL","LI"].includes(i)||["UL","OL","LI"].includes(e))this.polyfillSafe&&(this.__tabTrap=!0,this.__indentTrap=!0,document.execCommand("outdent"));else{if(null!=t)for(;null!=t&&!this._validElementTest(t);)t=t.previousSibling;null!=t&&setTimeout((()=>{t.focus()}),50)}}catch(e){console.warn(e)}}}customElements.define(HaxBody.tag,HaxBody);export{HaxBody}; \ No newline at end of file diff --git a/cdn/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-store.js b/cdn/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-store.js index da6e2e2c2..fac0f7b56 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-store.js +++ b/cdn/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-store.js @@ -1,4 +1,4 @@ -import{LitElement as e,html as t,nothing as i}from"../../../lit/index.js";import{SimpleTourManager as a}from"../../simple-popover/lib/simple-tour.js";import{HaxSchematizer as o,HaxElementizer as r}from"../../hax-body-behaviors/lib/HAXFields.js";import{winEventsElement as n,getRange as s,stripMSWord as l,nodeToHaxElement as d,haxElementToNode as c,validURL as h,camelToDash as p,htmlEntities as m,localStorageGet as g,localStorageSet as u}from"../../utils/utils.js";import{observable as x,makeObservable as f,computed as b,configure as v,autorun as y,toJS as T}from"../../../mobx/dist/mobx.esm.js";v({enforceActions:!1});import{HAXElement as S}from"../../hax-body-behaviors/hax-body-behaviors.js";import{I18NMixin as H,I18NManagerStore as w}from"../../i18n-manager/lib/I18NMixin.js";import{enableServices as E}from"../../micro-frontend-registry/lib/microServices.js";import{SuperDaemonInstance as A}from"../../super-daemon/super-daemon.js";import"../../media-behaviors/media-behaviors.js";import"../../editable-table/editable-table.js";import"../../iframe-loader/iframe-loader.js";import"../../hax-iconset/lib/hax-iconset-manifest.js";import{UserScaffoldInstance as N}from"../../user-scaffold/user-scaffold.js";import"./hax-app.js";function sessionStorageGet(e){try{return sessionStorage.getItem(e)}catch(e){return!1}}function sessionStorageSet(e,t){try{return sessionStorage.setItem(e,t)}catch(e){return!1}}class HaxStore extends(H(n(S(e)))){testHook(e,t){return!!(e&&e.tagName&&this.HTMLPrimativeTest(e)&&this.primativeHooks[e.tagName.toLowerCase()]&&this.primativeHooks[e.tagName.toLowerCase()][t])||e&&"function"==typeof e.haxHooks&&e.haxHooks()[t]}async runHook(e,t,i=[]){return!!this.testHook(e,t)&&(this.HTMLPrimativeTest(e)?await this.primativeHooks[e.tagName.toLowerCase()][t](...i):await e[e.haxHooks()[t]](...i))}getSelection(){if(this.activeHaxBody&&this.activeHaxBody.parentNode){if(this.activeHaxBody.parentNode.getSelection)return this.activeHaxBody.parentNode.getSelection();try{if(s(this.activeHaxBody.parentNode))return s(this.activeHaxBody.parentNode)}catch(e){}}return globalThis.getSelection()}getRange(){let e=this.getSelection();return e&&e.getRangeAt&&e.rangeCount?e.getRangeAt(0):e||!1}guessGizmo(e,t,i=!1,a=!1){var o=[],r=[];if(void 0!==e&&this.validGizmoTypes.includes(e))for(let n in this.gizmoList){let s=T(this.gizmoList[n]),l=t.innerHTML?{innerHTML:t.innerHTML}:{},d=!1;if(s&&s.handles)for(let n=0;n{t&&t.type&&""!=t.type&&(e[t.type.toLowerCase()]=!0)})),s.tags&&s.tags.length>0&&[...s.tags].forEach((t=>{t&&""!=t&&(e[t.toLowerCase()]=!0)})),s.keywords=Object.keys(e),r.includes(s.tag)||(o.push(this.haxElementPrototype(s,l,"")),r.push(s.tag))}}}}return o}insertLogicFromValues(e,t,i=!1,a=!1){let o=this.activePlaceHolderOperationType||this.guessGizmoType(e);if("upload-only"===o)return this.toast("Upload successful!"),!1;"link"===this.activePlaceHolderOperationType&&(a=!0),this.activePlaceHolderOperationType=null;let r=o,n=!0;if("*"==o){if(i)return!1;n=!1,r="link"}let s=this.guessGizmo(o,e,!1,n);return s.length>0?(1===s.length||a?1===s.length&&void 0!==s[0].tag?t.dispatchEvent(new CustomEvent("hax-insert-content",{bubbles:!0,cancelable:!0,composed:!0,detail:s[0]})):a&&t.dispatchEvent(new CustomEvent("hax-insert-content",{bubbles:!0,cancelable:!0,composed:!0,detail:s.find((e=>"a"==e.tag))})):this.haxAppPicker.presentOptions(s,o,"Pick how to present this "+r,"gizmo"),!0):(this.toast("Sorry, HAX doesn't know how to handle that type of link yet."),!1)}write(e,t,i){i&&i.dispatchEvent(new CustomEvent("hax-store-write",{composed:!0,bubbles:!0,cancelable:!1,detail:{property:e,value:t,owner:i}}))}mimeTypeToGizmoType(e){let 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"}}guessGizmoType(e){if(void 0!==e.source){const 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"))return"image";if(-1!=t.indexOf(".gif"))return"gif";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"!=globalThis.MediaBehaviors.Video.getVideoType(t))return"video"}return"*"}render(){return t` `}static get tag(){return"hax-store"}toast(e,t=2e3,i={},a="capsule",o=this.t.close,r=null,n=null){globalThis.dispatchEvent(new CustomEvent(this.toastShowEventName,{bubbles:!0,composed:!0,cancelable:!0,detail:{text:e,duration:t,classStyle:a,closeText:o,eventCallback:r,slot:n,...i}}))}static get properties(){return{...super.properties,skipHAXConfirmation:{type:Boolean,reflect:!0,attribute:"skip-hax-confirmation"},storageData:{type:Object},haxTray:{type:Object},haxCancel:{type:Object},haxAutoloader:{type:Object},haxBodies:{type:Array},activePlaceHolder:{type:Object},activePlaceHolderOperationType:{type:String},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}}}_storageDataChanged(e){e&&this.ready&&this.__storageDataProcessed&&(g("haxConfirm",!1)?u("haxUserData",e):sessionStorageGet("haxConfirm")&&sessionStorageSet("haxUserData",e))}isSingleSlotElement(e){let t=Object.keys(this.slotsSchemaFromNode(e));return 1==t.length&&0===t[0].length}isTextElement(e){let 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","mark","abbr","i","bold","em","strong","blockquote","code","figure"].includes(t))}isInlineElement(e){let t;return null!=e&&e.tagName?t=e.tagName.toLowerCase():null!=e&&e.tag?t=e.tag.toLowerCase():"string"==typeof e&&(t=e),!!(t&&this.validTagList.includes(t)&&(this.haxSchemaFromTag(t)&&this.haxSchemaFromTag(t).meta&&this.haxSchemaFromTag(t).meta.inlineOnly||["a","strike","u","b","sub","sup","span","code","mark","abbr","i","bold","em","strong"].includes(t)))}isGridPlateElement(e){let t;return e&&e.tagName?t=e.tagName.toLowerCase():e&&e.tag&&(t=e.tag.toLowerCase()),!(!t||!this.validGridTagList.includes(t))}isLayoutElement(e){let t=e&&e.tagName&&this.haxSchemaFromTag(e.tagName)||{};return t.type&&"grid"===t.type}isLayoutSlot(e){return!(!e||!e.parentNode)&&this.isLayoutElement(e.parentNode)}isOriginalGridPlate(e){return!!e&&"GRID-PLATE"===e.tagName}activeSchema(){return this.activeNode?this.haxSchemaFromTag(this.activeNode.tagName):void 0}activeParentSchema(){return this.activeNode&&this.activeNode.parentNode?this.haxSchemaFromTag(this.activeNode.parentNode.tagName):void 0}slottedContentByNode(e){let t={...this.slotsSchemaFromNode(e)||{}};return e?([...e.children||[]].forEach((e=>{e.slot&&""!==e.slot&&t[e.slot]?(t[e.slot].items=t[e.slot].items||[],t[e.slot].items.push(e)):e.slot&&""!==e.slot||!t[""]||(t[""].items=t[""].items||[],t[""].items.push(e))})),t):t}slotsSchemaFromNode(e){if(!e||!e.tagName)return{};let t={},i=this.haxSchemaFromTag(e.tagName||{}),a=this.slotsFromSchema(i);if(this.isOriginalGridPlate(e)){(e.layout||"1-1-1-1").split("-").map(((e,t)=>{a.push({slot:`col-${t+1}`,title:`Column ${t+1}`,excludedSlotWrappers:["grid-plate"]})}))}return a.forEach((a=>{a.items=void 0,a.label=a.title||a.slot,a.editMode={...i.editMode,...a.editMode},a.grid=e,(a.slot||""===a.slot)&&(t[a.slot]=a)})),t}schemaBySlotId(e,t){return(this.slotsSchemaFromNode(e)||{})[t]}_appStoreChanged(e,t){e&&t&&(e.url&&!e.apps&&this.shadowRoot?this.loadAppStoreFromRemote():this.__appStoreData=e)}async _loadAppStoreData(e){if(null!=e){var t={};if(void 0!==e.autoloader){e.autoloader=Object.assign({},e.autoloader);for(let i in e.autoloader){let a=i,o=e.autoloader[i];isNaN(a)||(a=e.autoloader[i],o=`@haxtheweb/${a}/${a}.js`),"string"!=typeof o&&(o.haxProperties&&this.setHaxProperties(e.autoloader[i].haxProperties,a),o=e.autoloader[i].import),this.validTagList.push(a),t[a]=o}}if(void 0!==e.apps){var i=e.apps;for(let e=0;e{globalThis.customElements.get(a)&&globalThis.customElements.get(a).haxProperties?this.setHaxProperties(globalThis.customElements.get(a).haxProperties,a):t.appendChild(globalThis.document.createElement(a))})).catch((e=>{console.warn(e),t.appendChild(globalThis.document.createElement(a))}))}}isExternalURLImport(e){let t;try{t=new URL(e)}catch(e){return!1}return new URL(t).origin!==location.origin}_editModeChanged(e){e&&!this.appStoreLoaded&&this.__appStoreData&&this.haxAutoloader&&(clearTimeout(this.__readyToProcessAppStoreData),this._loadAppStoreData(this.__appStoreData))}async _globalPreferencesChanged(e){if(this.__storageDataProcessed&&e&&this.ready){let t=this.storageData;"string"==typeof t&&(t=JSON.parse(t)),t.globalPreferences=e,this.storageData=t,this._storageDataChanged(this.storageData),e.haxLang&&HAXStore.editMode&&(clearTimeout(this._debounceLang),this._debounceLang=setTimeout((async()=>{for(let e in this.elementList){let t=this.elementList[e];t=await this.attemptGizmoTranslation(e,t),this.elementList[e]=t}this.gizmoList.forEach((e=>{this.elementList[e.tag].gizmo.title&&(e.title=this.elementList[e.tag].gizmo.title),this.elementList[e.tag].gizmo.description&&(e.description=this.elementList[e.tag].gizmo.description)}))}),100))}}_haxConsentTap(e){u("haxConfirm",!0),u("haxUserData",JSON.stringify(this.storageData))}updated(e){super.updated&&super.updated(e),e.forEach(((e,t)=>{"appStore"==t&&this[t]&&this._appStoreChanged(this[t],e),["ready","__appStoreData","haxAutoloader"].includes(t)&&this.ready&&this.__appStoreData&&this.haxAutoloader&&(clearTimeout(this.__readyToProcessAppStoreData),this.__readyToProcessAppStoreData=setTimeout((()=>{this._loadAppStoreData(this.__appStoreData)}),0)),["haxAutoloader","haxTray","haxCancel"].includes(t)&&(clearTimeout(this.__storeReady),this.__storeReady=setTimeout((()=>{this._storePiecesAllHere(this.haxAutoloader,this.activeHaxBody,this.haxTray,this.haxCancel)}),0))}))}_calculateActiveGizmo(e){if(null==e||!e.tagName)return null;for(let i in this.gizmoList){var t=this.gizmoList[i];if(t.tag===e.tagName.toLowerCase())return t}}loadAppStoreFromRemote(){const e=new URLSearchParams(this.appStore.params);let t=this.appStore.url;e&&(t+=`?${e}`),fetch(t,{method:this.method}).then((e=>{if(e.ok)return e.json()})).then((e=>{this.__appStoreData=e}))}firstUpdated(e){if(super.firstUpdated&&super.firstUpdated(e),this.skipHAXConfirmation&&(sessionStorageSet("haxConfirm",!0),u("haxConfirm",!0)),sessionStorageGet("haxConfirm")||g("haxConfirm"))if(sessionStorageGet("haxConfirm")&&!g("haxConfirm"))try{let e=sessionStorageGet("haxUserData")?JSON.parse(sessionStorageGet("haxUserData")):{};this.storageData=e,this._storageDataChanged(this.storageData)}catch(e){}else try{let e=g("haxUserData",{});this.storageData=e,this._storageDataChanged(this.storageData)}catch(e){}else{sessionStorageSet("haxConfirm",!0);let e="\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 ";this.toast(e,"-1",{},"fit-bottom","I Accept","hax-consent-tap")}setTimeout((()=>{this.__storageDataProcessed=!0,this.storageData.globalPreferences&&this.write("globalPreferences",this.storageData.globalPreferences,this)}),0)}_storePiecesAllHere(e,t,i,a){if(!this.ready&&t&&e&&i&&a){this.dispatchEvent(new CustomEvent("hax-store-ready",{bubbles:!0,cancelable:!1,composed:!0,detail:!0}));let e=globalThis.RichTextEditorPrompt.requestAvailability();e&&(e.shadowRoot.querySelector("#formfields").schematizer=o,e.shadowRoot.querySelector("#formfields").elementizer=r),i.shadowRoot.querySelector("#haxcancelbutton")&&(a.shadowRoot.querySelector("#dialog").associateEvents(i.shadowRoot.querySelector("#haxcancelbutton")),a.shadowRoot.querySelector("#dialog")&&globalThis.addEventListener("simple-modal-confirmed",this._handleConfirmCancel.bind(this))),this.ready=!0,this._buildPrimitiveDefinitions()}}_handleConfirmCancel(e){e.detail.invokedBy===this.haxTray.shadowRoot.querySelector("#haxcancelbutton")&&(this.editMode=!1,this.dispatchEvent(new CustomEvent("hax-cancel",{bubbles:!0,composed:!0,cancelable:!1,detail:e.detail})))}_positionCursorInNode(e,t=0){this.activeHaxBody.positionContextMenus();var i=globalThis.document.createRange(),a=this.getSelection();return i.setStart(e,t),i.collapse(!0),a.removeAllRanges(),a.addRange(i),i}_onBeforeUnload(e){if(!this.skipExitTrap&&this.editMode)return"Are you sure you want to leave? Your work will not be saved!"}isBase64(e){try{return btoa(atob(e))==e}catch(e){return!1}}retrieveImageFromClipboardAsBlob(e,t){if(0==e.clipboardData&&"function"==typeof t)return t(void 0);var i=e.clipboardData.items;if(null==i&&"function"==typeof t)return t(void 0);for(let e=0;e{for(var i in e)i.startsWith("hax")||(this.activeNode.dataset[i]=e[i]);t&&this.activeNode.setAttribute("slot",t)}),0)}}async _onPaste(e){if(this.editMode&&"HAX-TRAY"!==globalThis.document.activeElement.tagName&&"BODY"!==globalThis.document.activeElement.tagName&&"SIMPLE-MODAL"!==globalThis.document.activeElement.tagName){this.isTextElement(this.activeNode)||(this.activeNode=this.activeHaxBody.haxInsert("p","",{}));let o="",r="";if(e.clipboardData||e.originalEvent.clipboardData?(o=(e.originalEvent||e).clipboardData.getData("text/html"),""==o&&(o=(e.originalEvent||e).clipboardData.getData("text"))):globalThis.clipboardData&&(o=globalThis.clipboardData.getData("Text")),o=o.trim(),o=o.replace(/\s*?<\/span>/g," "),o=o.replace(/(?:style="(\S+:\s*[^;"]+;\s*)*)+"/g,""),o=o.replace(/
        /g,"

        "),r=o,this.isBase64(r))return e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.retrieveImageFromClipboardAsBlob(e,(t=>{if(t){var i=globalThis.URL||globalThis.webkitURL;let a=globalThis.document.createElement("img");a.src=i.createObjectURL(t),this.activeNode.parentNode.insertBefore(a,this.activeNode.nextElementSibling);for(let t in e.clipboardData.items)!e.clipboardData.items[t].name&&e.clipboardData.items[t].type&&(e.clipboardData.items[t].name="image-"+Math.floor(Date.now()/1e3)+e.clipboardData.items[t].type.replace("image/","."));return e.dataTransfer=e.clipboardData,e.placeHolderElement=a,this.dispatchEvent(new CustomEvent("place-holder-file-drop",{bubbles:!0,cancelable:!0,composed:!0,detail:e})),a}return!1}));if(e.clipboardData.files.length>0){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();let t=this.activeHaxBody.haxInsert("p","",{});e.dataTransfer=e.clipboardData;for(let t in e.clipboardData.files)!e.clipboardData.files[t].name&&e.clipboardData.files[t].type&&(e.clipboardData.files[t].name="image-"+Math.floor(Date.now()/1e3)+e.clipboardData.files[t].type.replace("image/","."));e.placeHolderElement=t,this.dispatchEvent(new CustomEvent("place-holder-file-drop",{bubbles:!0,cancelable:!0,composed:!0,detail:e}))}let n=!1,s="",d=globalThis.document.createElement("div");d.innerHTML=o;let p=[];if(d.children&&(o=l(o),o=o.replace(/

        /g,"

        "),o=o.replace(/<\/h1>/g,"

        "),o=o.replace(//g,(function(e,t){return``})),p=await this.htmlToHaxElements(o),1!==p.length||this.__validGridTags().includes(p[0].tag)||(p=await this.htmlToHaxElements(p[0].content))),0===p.length&&h(o)){""!=this.activeNode.innerText.trim()&&(n=!0);let e={source:o,title:o};if(!n&&!this.insertLogicFromValues(e,this,!1,!0))return!1}else if(0===p.length){if(n=!0,r==o)return!1;s=o}else if(1===p.length&&"p"===p[0].tag)s=o,n=!0;else if(1===p.length&&"a"===p[0].tag&&p[0].properties.href)if(""!=this.activeNode.innerText.trim())s=p[0].properties.href,n=!0;else{let e={source:p[0].properties.href,title:p[0].content};if(!this.insertLogicFromValues(e,this))return!1}else{if(!this.isGridPlateElement(p[0]))return!1;for(let e in p){"p"==p[e].tag&&["li","ol","ul"].includes(this.activeNode.tagName.toLowerCase())&&(p[e].tag="li"),delete p[e].properties.style,delete p[e].properties.start,delete p[e].properties.align;let t=c({tag:p[e].tag,content:p[e].content.replace(/ <\/span>/g," ").trim(),properties:p[e].properties});s+=await this.nodeToContent(t)}}e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();try{let e=this.getRange(),r=this.getSelection(),l=globalThis.document.createElement("div");if(l.innerHTML=s,e&&r){for(let e in l.children)l.children[e].tagName&&this.isTextElement(l.children[e])&&""===l.children[e].innerHTML&&l.children[e].remove();if(n){let t;if(h(o))t=globalThis.document.createElement("a"),t.setAttribute("href",o),t.setAttribute("rel","noopener noreferrer"),t.setAttribute("target","_blank"),t.innerText=o;else if(l.children&&l.children.length>0){for(;l.childNodes.length>1;)e.insertNode(Array.from(l.childNodes).pop());t=Array.from(l.childNodes).pop()}else t=globalThis.document.createTextNode(l.innerHTML);e.deleteContents(),e.insertNode(t),setTimeout((()=>{this._positionCursorInNode(t,t.length)}),0)}else{var t,i,a;for(""!=this.activeNode.innerText.trim()&&e.endOffset!=this.activeNode.innerText.length&&(t=!0,globalThis.document.execCommand("insertParagraph")),e.commonAncestorContainer&&e.commonAncestorContainer.parentNode&&(a||this.activeNode==e.commonAncestorContainer||(a=e.commonAncestorContainer.parentNode)||(a=e.commonAncestorContainer));l.firstElementChild;)i=l.firstElementChild,a?(a.getAttribute&&a.getAttribute("slot")&&i.setAttribute("slot",a.getAttribute("slot")),t?(this.activeHaxBody.haxReplaceNode(a.previousElementSibling,i),t=!1):a.parentNode?a.parentNode.insertBefore(i,a.nextElementSibling):a.insertBefore(i,a.nextElementSibling)):this.activeNode?(this.activeNode.getAttribute("slot")&&i.setAttribute("slot",this.activeNode.getAttribute("slot")),""==this.activeNode.innerText.trim()?this.activeHaxBody.haxReplaceNode(this.activeNode,i):this.activeNode.parentNode.insertBefore(i,this.activeNode.nextElementSibling)):this.activeHaxBody.appendChild(i),a=i;setTimeout((()=>{i&&i.childNodes&&i.childNodes[0]&&(this._positionCursorInNode(i.childNodes[0],i.childNodes[0].length),i=null,a=null)}),0)}}}catch(e){console.warn(e)}}}__validGridTags(){return["p","ol","ul","li","div","h1","h2","h3","h4","h5","h6","blockquote","code","section","dl","dd","dt","figure"]}__validTags(){return["p","div","span","mark","abbr","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","figcaption","img","iframe","video","audio","section","dl","dt","dd","template","webview"]}__validGizmoTypes(){return["data","video","audio","text","link","file","pdf","image","csv","doc","document","archive","markdown","html","content","text","gif","inline","*"]}constructor(){super(),E(["core"]),this.toastShowEventName=globalThis.HAXCMS?"haxcms-toast-show":"simple-toast-show",this.t={close:"Close"},void 0!==globalThis.speechSynthesis&&(globalThis.SpeechRecognition||globalThis.webkitSpeechRecognition||globalThis.mozSpeechRecognition||globalThis.msSpeechRecognition||globalThis.oSpeechRecognition)&&(A.voiceSearch=!0),A.icon="hax:wizard-hat",A.allowedCallback=()=>!(!this.ready||!this.editMode),A.defineOption({title:"Insert emoji",icon:"editor:insert-emoticon",tags:["emoji"],value:{name:"Insert emoji",context:"/",program:async(e,t)=>{let i=[],a=globalThis.document.createElement("textarea");return await Object.keys(globalThis.SimplePickerEmojis).forEach((async t=>{await globalThis.SimplePickerEmojis[t].forEach((async o=>{(""==e||o.description.includes(e))&&(a.innerHTML=o.value,i.push({title:o.description,textCharacter:a.value,tags:[t],value:{target:this,method:"_insertTextResult",args:[a.value]},context:["/","/HAX/text/emoji/"+a.value],eventName:"super-daemon-element-method",path:"/HAX/text/emoji/"+a.value}))}))})),i}},context:["HAX","/"],eventName:"super-daemon-run-program",path:"/HAX/text/emoji"}),A.defineOption({title:"Insert symbol",icon:"editor:functions",tags:["symbol"],value:{name:"Insert symbol",context:"/",program:async(e,t)=>{let i=[],a=globalThis.document.createElement("textarea");return await Object.keys(globalThis.SimplePickerSymbols).forEach((async t=>{await globalThis.SimplePickerSymbols[t].forEach((async o=>{(""==e||t.includes(e))&&(a.innerHTML=o.value,i.push({title:`${t}: ${a.value}`,textCharacter:a.value,tags:[t],value:{target:this,method:"_insertTextResult",args:[a.value]},context:["/","/HAX/text/symbol/"+a.value],eventName:"super-daemon-element-method",path:"/HAX/text/symbol/"+a.value}))}))})),i}},context:["HAX","/"],eventName:"super-daemon-run-program",path:"/HAX/text/symbol"}),A.defineOption({title:"Join our Community",icon:"hax:discord",priority:-100,tags:["community","discord","chat","help"],value:{target:this,method:"_openExternalLink",args:["https://bit.ly/hax-discord"]},eventName:"super-daemon-element-method",path:"HAX/community/join",context:["logged-in","CMS","HAX"]}),A.defineOption({title:"User Tutorials",icon:"hax:hax2022",priority:-1e3,tags:["Documentation","community","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/tutorials"]},eventName:"super-daemon-element-method",path:"HAX/community/tutorials",context:["logged-in","CMS","HAX"]}),A.defineOption({title:"User Documentation",icon:"hax:hax2022",tags:["Documentation","community","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/documentation"]},eventName:"super-daemon-element-method",path:"HAX/community/documentation",context:["logged-in","CMS","HAX"]}),A.defineOption({title:"HAX Teaching Excellence",icon:"hax:hax2022",tags:["Ontology","community","pedagogy","documentation","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/ontology"]},eventName:"super-daemon-element-method",path:"HAX/community/pedagogy",context:["logged-in","CMS","HAX"]}),A.defineOption({title:"Bug / issue",icon:"mdi-social:github-circle",tags:["Bug report","github","git","community","issue queue"],value:{target:this,method:"_haxStoreContribute",args:["bug","POP,bug"]},eventName:"super-daemon-element-method",path:"HAX/community/contribute",context:["logged-in","CMS","HAX"]}),A.defineOption({title:"Idea / Feature request",icon:"mdi-social:github-circle",tags:["Feature request","idea","github","git","community","issue queue"],value:{target:this,method:"_haxStoreContribute",args:["feature","POP,enhancement"]},context:["logged-in","CMS","HAX"],eventName:"super-daemon-element-method",path:"HAX/community/contribute"}),this.primativeHooks={},this.__dragTarget=null,this.registerLocalization({context:this,namespace:"hax",basePath:import.meta.url+"/../../",locales:["es"]}),this.appSearch=null,this.method="GET",this.haxSelectedText="",this.__winEvents={"hax-super-daemon-insert-tag":"_superDaemonInsert","hax-register-properties":"_haxStoreRegisterProperties","hax-consent-tap":"_haxConsentTap",onbeforeunload:"_onBeforeUnload",paste:"_onPaste",command:"_onCommand","hax-register-app":"_haxStoreRegisterApp","hax-register-stax":"_haxStoreRegisterStax","hax-register-core-piece":"_haxStorePieceRegistrationManager","hax-register-body":"_haxStoreRegisterBody","hax-insert-content":"_haxStoreInsertContent","hax-insert-content-array":"_haxStoreInsertMultiple","hax-refresh-tray-form":"refreshActiveNodeForm","rich-text-editor-prompt-open":"_richTextEditorPromptOpen","rich-text-editor-prompt-confirm":"_richTextEditorPromptConfirm"},globalThis.onbeforeunload=e=>{if(!this.skipExitTrap&&this.editMode){var t="Are you sure you want to leave? Your work will not be saved!";return e.returnValue=t,t}},a.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 padding: 0;\n margin: 0;\n font-size: 14px;\n line-height: 20px;\n }\n simple-popover-manager h3 {\n margin: 8px 2px;\n }"}),this.skipHAXConfirmation=!1,this.storageData={},this.appStore={url:"",params:{}},this.daemonKeyCombo=`${A.key1} + ${A.key2} + `,this.activeNode=null,this.activeEditingElement=null,this.haxBodies=[],this.activePlaceHolder=null,this.activePlaceHolderOperationType=null,this.sessionObject={},this.editMode=!1,this.skipExitTrap=!1,this.appStoreLoaded=!1,this.elementList={},this.elementAlign=g("hax-tray-elementAlign"),this.elementAlign&&null!=this.elementAlign||(this.elementAlign="left"),this.trayStatus="collapsed",this.trayDetail="content-edit",this.appList=[],this.gizmoList=[],this.recentGizmoList=N.readMemory("recentGizmoList")||[],this.haxAutoloader=null,this.activeHaxBody=null,this.haxTray=null,this.haxCancel=null,this.staxList=[],this.globalPreferences={},this.activeApp={},this.connectionRewrites={},this.daemonCommands={},this.keyboardShortcuts={"#":{tag:"h2",content:""},"##":{tag:"h3",content:""},"###":{tag:"h4",content:""},"####":{tag:"h5",content:""},"#####":{tag:"h6",content:""},"######":{tag:"h6",content:""},"1.":{tag:"ol",content:"
      • "},"-":{tag:"ul",content:"
      • "},"*":{tag:"ul",content:"
      • "},"+":{tag:"ul",content:"
      • "},"---":{tag:"hr"},"***":{tag:"hr"},___:{tag:"hr"},"```":{tag:"code",content:""},">":{tag:"blockquote",content:""}},this.__primsBuilder={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"},dl:{title:"Data list",icon:"editor:format-list-bulleted"},dt:{title:"Data term",icon:"editor:format-list-bulleted"},dd:{title:"Data definition",icon:"editor:format-list-bulleted"},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",tags:["Text","h2","html","text","heading","header"]},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",handles:[{type:"inline",text:"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"},embed:{title:"Embedded object",icon:"icons:fullscreen"}},this.validTagList=this.__validTags(),this.validGridTagList=this.__validGridTags(),this.validGizmoTypes=this.__validGizmoTypes();let e=globalThis.document.createElement("webview");this._isSandboxed="function"==typeof e.reload,globalThis.document.body.style.setProperty("--hax-ui-headings","#d4ff77"),this.revisionHistoryLink=null,f(this,{daemonKeyCombo:x,gizmoList:x,recentGizmoList:x,activeNode:x,globalPreferences:x,activeGizmo:b,activeNodeIndex:b,editMode:x,revisionHistoryLink:x,elementAlign:x,trayStatus:x,trayDetail:x,appList:x,activeApp:x,haxSelectedText:x,activeEditingElement:x,activeHaxBody:x,appStoreLoaded:x}),y((()=>{this._globalPreferencesChanged(T(this.globalPreferences))})),y((()=>{this._editModeChanged(T(this.editMode))})),y((()=>{const e=T(this.recentGizmoList);e.length>0&&N.writeMemory("recentGizmoList",e,"long")}))}async _insertTextResult(e){this.activeNode.focus(),A.activeRange&&(A.activeRange.setStart(this.activeNode,0),A.activeRange.collapse(!0),A.activeSelection.removeAllRanges(),A.activeSelection.addRange(A.activeRange),A.activeSelection.selectAllChildren(this.activeNode),A.activeSelection.collapseToEnd()),setTimeout((()=>{""==this.activeNode.textContent?this.activeNode.textContent=e:globalThis.document.execCommand("insertHTML",!1,e)}),0)}_openExternalLink(e){globalThis.open(e,"_blank")}async _haxStoreContribute(e,t,i=null){let a="";if("merlin"==e){var o=`[${e}] New command request from HAX daemon`;a=`Location: ${globalThis.location.href}\nMerlin command: ${i}\nWhat did you want merlin to do?\n`}else{o=`[${e}] User report from HAX daemon`;if(a=`Location: ${globalThis.location.href}\nBrowser: ${navigator.userAgent}\nOS: ${navigator.userAgentData.platform} - ${navigator.deviceMemory}GB RAM - ${navigator.hardwareConcurrency} cores\nScreen: ${globalThis.screen.width}x${globalThis.screen.height}\nWindow size: ${globalThis.innerWidth}x${globalThis.innerHeight}\n`,navigator.getBattery){a+=`Battery: ${100*(await navigator.getBattery()).level}%\n`}navigator.connection&&navigator.connection.effectiveType&&(a+=`Connection: ${navigator.connection.effectiveType}\n`),a+=("feature"==e?"Your idea:":"Bug you experienced:")+"\n"}globalThis.open(`https://github.com/haxtheweb/issues/issues/new?assignees=&labels=${t}&template=issue-report.md&title=${o}&body=${encodeURIComponent(a)}`,"_blank")}async _richTextEditorPromptOpen(e){if(e.detail.element&&e.detail.element.gizmo.tag){const t=globalThis.document.createElement(e.detail.element.gizmo.tag);HAXStore.testHook(t,"setupActiveElementForm")&&await HAXStore.runHook(t,"setupActiveElementForm",[e.detail.element])}const t=globalThis.getComputedStyle(globalThis.document.body);"hidden"==t.getPropertyValue("overflow")&&(this.__overflowHiddenOnOpen=t.getPropertyValue("overflow"),globalThis.document.body.style.overflow="auto"),setTimeout((()=>{const e=globalThis.document.querySelector("rich-text-editor-prompt").shadowRoot.querySelector(".actions");"function"==typeof e.scrollIntoViewIfNeeded?e.scrollIntoViewIfNeeded(!0):e.scrollIntoView({behavior:"smooth",inline:"center"})}),100)}_richTextEditorPromptConfirm(e){const t=e.detail.value&&e.detail.value.target?e.detail.value.target:null;setTimeout((()=>{"A"===this.activeNode.tagName&&t&&(this.activeNode.setAttribute("target",t),this.refreshActiveNodeForm())}),0),this.__overflowHiddenOnOpen&&(globalThis.document.body.style.overflow=this.__overflowHiddenOnOpen,this.__overflowHiddenOnOpen=null)}_buildPrimitiveDefinitions(){if(this._isSandboxed){let e={type:"element",editingElement:"core",canScale:!0,designSystem:{card:!0,primary:!0},canEditSource:!0,settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this resource.",inputMethod:"textfield",icon:"link",required:!0,validationType:"url"}],advanced:[]}};this.setHaxProperties(e,"webview")}this.setHaxProperties({canScale:!0,type:"element",designSystem:{card:!0,primary:!0},editingElement:"core",canEditSource:!0,gizmo:{title:"Image",description:"A basic img tag",icon:"image:image",color:"blue-grey",tags:["Images","media","img","html"],handles:[{type:"image",source:"src"}],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this image.",inputMethod:"haxupload",noVoiceRecord:!0,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:"loading",title:"Loading method",description:"Whether or not to lazy load this",inputMethod:"select",options:{lazy:"Load when visible",auto:"Automatic"}}]},demoSchema:[{tag:"img",content:"",properties:{src:"https://cdn2.thecatapi.com/images/9j5.jpg",loading:"lazy"}}]},"img");this.setHaxProperties({canScale:!0,type:"grid",canEditSource:!0,gizmo:{title:"Figure",description:"A basic figure tag",icon:"hax:figure",color:"blue-grey",tags:["Images","media","figure","html"],requiresChildren:"figcaption",handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[]},demoSchema:[{tag:"figure",properties:{},content:'image other media here\n

        Image Caption Here

        '}]},"figure");this.setHaxProperties({canScale:!0,type:"grid",editingElement:"core",canEditSource:!0,gizmo:{title:"Figure caption",description:"Used inside of a figure tag",icon:"image:image",color:"blue-grey",tags:["Images","media","caption","figure","html"],handles:[],requiresParent:"figure",meta:{author:"W3C",hidden:!0}},settings:{configure:[{slot:"",title:"Figure Caption",description:"Caption for the figure",inputMethod:"code-editor"}]},demoSchema:[{tag:"figcaption",properties:{},content:"Image Caption Here"}]},"figcaption");this.setHaxProperties({type:"element",editingElement:"core",canScale:!1,designSystem:{primary:!0},canEditSource:!0,contentEditable:!0,gizmo:{title:"Highlight",description:"Highlight text within a block of content",icon:"editor:highlight",color:"yellow",tags:["Content","text","highlight","mark","html"],handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"innerText",title:"Text",description:"Text of the highlight",inputMethod:"textfield",required:!0}],advanced:[],developer:[]},demoSchema:[{tag:"mark",content:"Highlight me",properties:{}}]},"mark");this.setHaxProperties({type:"element",editingElement:"core",canScale:!1,designSystem:{primary:!0},canEditSource:!0,contentEditable:!0,gizmo:{title:"Abbreviation",description:"Simple abbreviation with tooltip of full word",icon:"hax:abbr",color:"yellow",tags:["Content","text","abbr","html"],handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"innerText",title:"Text",description:"Text that is visible, the abbreviation",inputMethod:"textfield",required:!0},{attribute:"title",title:"Word",description:"Word that the abbreviation is representing",inputMethod:"textfield",required:!0}],advanced:[],developer:[]},demoSchema:[{tag:"abbr",content:"Abbr",properties:{title:"Abbreviation"}}]},"abbr");let e={type:"element",editingElement:"core",canScale:!1,designSystem:{accent:!0},canEditSource:!0,contentEditable:!0,gizmo:{title:"Basic link",description:"A basic a tag",icon:"icons:link",color:"blue-grey",tags:["Resource","link","a","url","html","href","address","http"],handles:[],meta:{author:"W3C"}},settings:{configure:[{attribute:"href",title:"Link",description:"The URL for the link",inputMethod:"haxupload",required:!0,validationType:"url"},{attribute:"innerText",title:"Text",description:"Text of the link",inputMethod:"textfield",required:!0},{attribute:"target",title:"Target",description:"Where to open the link.",inputMethod:"select",options:{"":"Same window",_blank:"New window - _blank",_top:"Top window - _top",_parent:"Parent window - _parent"}}],advanced:[],developer:[{attribute:"title",title:"Title text",description:"Useful for screen readers and improved SEO.",inputMethod:"textfield"},{attribute:"rel",title:"rel",description:"Specifies the relationship between this document and the opened globalThis.document. Change as part of security or SEO policy.",inputMethod:"select",options:{noopener:"noopener","noopener noreferrer":"noopener noreferrer","nofollow ":"nofollow","noopener noreferrer nofollow":"noopener noreferrer nofollow",opener:"opener"}}]},demoSchema:[{tag:"p",content:'Link to content',properties:{}}]};this.validGizmoTypes.forEach((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,designSystem:!0,canEditSource:!0,contentEditable:!0,gizmo:{title:"Paragraph",description:"A basic text area",icon:"hax:paragraph",color:"blue-grey",tags:["Text","p","paragraph","text","html"],handles:[{type:"content",title:"innerHTML",alt:"title"}],meta:{author:"W3C",outlineDesigner:!0}},settings:{configure:[],advanced:[]},demoSchema:[{tag:"p",content:"Deep thoughts..",properties:{}}]},"p");let t={type:"element",editingElement:{tag:"editable-table",import:"@haxtheweb/editable-table/editable-table.js",callback:this.setupEditableTable.bind(this)},canScale:!0,canEditSource:!0,gizmo:{title:"Table",description:"A table for displaying data",icon:"image:grid-on",color:"blue-grey",tags:["Instructional","table","data","html","grid","matrix","spreadsheet","csv","excel"],meta:{hidden:!0,author:"W3C"}},settings:{configure:[],advanced:[]}};this.setHaxProperties(t,"table");let i=globalThis.document.createElement("editable-table");this.haxAutoloader.appendChild(i);let a={type:"element",editingElement:{tag:"iframe-loader",import:"@haxtheweb/iframe-loader/iframe-loader.js",callback:this.setupIframeLoader.bind(this)},canScale:!1,designSystem:{card:!0,primary:!0},canEditSource:!1,gizmo:{title:"iFrame",description:"A basic way to frame external web content",icon:"hax:iframe",color:"blue-grey",tags:["Resource","iframe","content","url","link","embed","https","html","address"],handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this resource.",inputMethod:"textfield",icon:"link",required:!0,validationType:"url"}]}};this.setHaxProperties(a,"iframe");let o=globalThis.document.createElement("iframe-loader");this.haxAutoloader.appendChild(o);for(let e in this.__primsBuilder){let t="";["h1","h2","h3","h4","h5","h6"].includes(e)?t="Heading":"ul"!=e&&"ol"!=e||(t="
      • Item
      • Item
      • "),this.setHaxProperties({type:"element",editingElement:"core",canScale:!1,designSystem:["h1","h2","h3","h4","h5","h6"].includes(e)?{text:!0,card:!0,primary:!0,designTreatment:!0}:!!["ol","ul"].includes(e)&&{text:!0,card:!0,accent:!0,primary:!0},canEditSource:!0,contentEditable:!0,gizmo:{title:this.__primsBuilder[e].title,icon:this.__primsBuilder[e].icon,tags:this.__primsBuilder[e].tags||["Text",e,"html","text"],handles:this.__primsBuilder[e].handles||[],meta:{author:"W3C",inlineOnly:!!["em","b","strong","i","strike","u","sub","sup","span"].includes(e),hidden:!["h2","ul"].includes(e),outlineDesigner:!!["h2","ul"].includes(e)}},settings:{configure:[],advanced:[]},demoSchema:[{tag:e,content:t,properties:{}}]},e)}this.setHaxProperties({canScale:!0,type:"element",editingElement:"core",designSystem:{primary:!0},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")}_haxStorePieceRegistrationManager(e){e.detail&&e.detail.piece&&e.detail.object&&(this[e.detail.piece]=e.detail.object)}setupEditableTable(e){this.activeNode=e,setTimeout((()=>{e.editMode=!0,e.focus()}),0)}setupIframeLoader(e){this.activeNode=e,setTimeout((()=>{e.disabled=!0}),0)}async _haxStoreInsertContent(e){if(e.detail){let i=e.detail;if(globalThis.customElements.get(i.tag)){let e=globalThis.document.createElement(i.tag);this.testHook(e,"preProcessInsertContent")&&(i=await this.runHook(e,"preProcessInsertContent",[i,this.activeNode]))}var t={};if(void 0!==i.properties&&(t=i.properties),t.innerHTML&&(""==i.content&&(i.content=t.innerHTML),delete t.innerHTML),t.innerText&&(""==i.content&&(i.content=t.innerText),delete t.innerText),void 0!==i.__type&&"inline"===i.__type){let e=c({tag:i.tag,content:i.content,properties:t});null!==this.activePlaceHolder&&(this.activePlaceHolder.deleteContents(),this.activePlaceHolder.insertNode(e)),this.activePlaceHolder=null}else if(i.replace||i.replacement||i.nextToActive){let e=c({tag:i.tag,content:i.content,properties:t});this.activePlaceHolder?(this.activeHaxBody.haxReplaceNode(this.activePlaceHolder,e),this.activePlaceHolder=null):i.nextToActive&&this.activeNode?this.activeHaxBody.__slot&&this.activeNode.haxLayoutContainer?this.activeNode.appendChild(e):this.activeNode.parentNode.insertBefore(e,this.activeNode):this.activeHaxBody.haxReplaceNode(this.activeNode,e)}else if(this.activeNode&&this.activeNode.parentNode&&"HAX-BODY"!=this.activeNode.parentNode.tagName){let e=c({tag:i.tag,content:i.content,properties:t});this.activeNode.parentNode.haxLayoutContainer?(null!=this.activeNode.getAttribute("slot")&&e.setAttribute("slot",this.activeNode.getAttribute("slot")),this.activeHaxBody.haxInsert(i.tag,i.content,t)):this.activeHaxBody.haxInsert(i.tag,i.content,t)}else this.activeHaxBody.haxInsert(i.tag,i.content,t)}}slotsFromSchema(e,t=!1){let i=e?e.settings:{},a=[];return Object.keys({...i||{}}).map((e=>(i[e]||[]).filter((e=>{let i=!t||!e.required;return!(!e.slot&&""!==e.slot||a.includes(e.slot)||!i)&&(a.push(e.slot),!0)})))).flat()}haxSchemaFromTag(e){return e&&e.toLowerCase&&(e=e.toLowerCase(),this.elementList&&this.elementList[e])?this.elementList[e]:{}}_haxStoreInsertMultiple(e){var t;if(e.detail)for(let i in e.detail)t={},void 0!==e.detail[i].properties&&(t=e.detail[i].properties),this.activeHaxBody.haxInsert(e.detail[i].tag,e.detail[i].content,t)}_haxStoreRegisterBody(e){e.detail&&(this.haxBodies.push(e.detail),this.activeHaxBody=e.detail,this.write("activeHaxBody",this.activeHaxBody,this),this.write("editMode",this.editMode,this),clearTimeout(this.__storeReady),this.__storeReady=setTimeout((()=>{this._storePiecesAllHere(this.haxAutoloader,this.activeHaxBody,this.haxTray,this.haxCancel)}),0))}_superDaemonInsert(e){A.programTarget&&e.detail.properties&&(e.detail.properties.src||e.detail.properties.source||e.detail.properties.href)?A.programTarget.value=e.detail.properties.src||e.detail.properties.source||e.detail.properties.href:this.haxTray._processTrayEvent(e),A.programTarget=null}computePolyfillSafe(){return!(!globalThis.document.head.createShadowRoot&&!globalThis.document.head.attachShadow)||(console.warn("Shadow DOM missing, certain operations hidden"),!1)}_haxStoreRegisterApp(e){if(e.detail){const i=e.detail;i.index=this.appList.length,this.appList=[...this.appList,i],this.write("appList",T(this.appList),this);let a="media";if(i.connection.operations&&i.connection.operations.browse&&i.connection.operations.browse.resultMap&&i.connection.operations.browse.resultMap.defaultGizmoType&&(a=i.connection.operations.browse.resultMap.defaultGizmoType),A.defineOption({title:"Search "+i.details.title,icon:i.details.icon,tags:["Search",...i.details.tags,a],more:i.details.tos&&i.details.tos.length>0?t`
        Terms of service:
        +import{LitElement as e,html as t,nothing as i}from"../../../lit/index.js";import{SimpleTourManager as a}from"../../simple-popover/lib/simple-tour.js";import{HaxSchematizer as o,HaxElementizer as r}from"../../hax-body-behaviors/lib/HAXFields.js";import{winEventsElement as n,getRange as s,stripMSWord as l,nodeToHaxElement as d,haxElementToNode as c,validURL as h,camelToDash as p,htmlEntities as m,localStorageGet as g,localStorageSet as u}from"../../utils/utils.js";import{observable as x,makeObservable as f,computed as b,configure as v,autorun as y,toJS as T}from"../../../mobx/dist/mobx.esm.js";v({enforceActions:!1});import{HAXElement as S}from"../../hax-body-behaviors/hax-body-behaviors.js";import{I18NMixin as H,I18NManagerStore as w}from"../../i18n-manager/lib/I18NMixin.js";import{enableServices as E}from"../../micro-frontend-registry/lib/microServices.js";import{SuperDaemonInstance as A}from"../../super-daemon/super-daemon.js";import"../../media-behaviors/media-behaviors.js";import"../../editable-table/editable-table.js";import"../../iframe-loader/iframe-loader.js";import"../../hax-iconset/lib/hax-iconset-manifest.js";import{UserScaffoldInstance as N}from"../../user-scaffold/user-scaffold.js";import"./hax-app.js";function sessionStorageGet(e){try{return sessionStorage.getItem(e)}catch(e){return!1}}function sessionStorageSet(e,t){try{return sessionStorage.setItem(e,t)}catch(e){return!1}}class HaxStore extends(H(n(S(e)))){testHook(e,t){return!!(e&&e.tagName&&this.HTMLPrimativeTest(e)&&this.primativeHooks[e.tagName.toLowerCase()]&&this.primativeHooks[e.tagName.toLowerCase()][t])||e&&"function"==typeof e.haxHooks&&e.haxHooks()[t]}async runHook(e,t,i=[]){return!!this.testHook(e,t)&&(this.HTMLPrimativeTest(e)?await this.primativeHooks[e.tagName.toLowerCase()][t](...i):await e[e.haxHooks()[t]](...i))}getSelection(){if(this.activeHaxBody&&this.activeHaxBody.parentNode){if(this.activeHaxBody.parentNode.getSelection)return this.activeHaxBody.parentNode.getSelection();try{if(s(this.activeHaxBody.parentNode))return s(this.activeHaxBody.parentNode)}catch(e){}}return globalThis.getSelection()}getRange(){let e=this.getSelection();return e&&e.getRangeAt&&e.rangeCount?e.getRangeAt(0):e||!1}guessGizmo(e,t,i=!1,a=!1){var o=[],r=[];if(void 0!==e&&this.validGizmoTypes.includes(e))for(let n in this.gizmoList){let s=T(this.gizmoList[n]),l=t.innerHTML?{innerHTML:t.innerHTML}:{},d=!1;if(s&&s.handles)for(let n=0;n{t&&t.type&&""!=t.type&&(e[t.type.toLowerCase()]=!0)})),s.tags&&s.tags.length>0&&[...s.tags].forEach((t=>{t&&""!=t&&(e[t.toLowerCase()]=!0)})),s.keywords=Object.keys(e),r.includes(s.tag)||(o.push(this.haxElementPrototype(s,l,"")),r.push(s.tag))}}}}return o}insertLogicFromValues(e,t,i=!1,a=!1){let o=this.activePlaceHolderOperationType||this.guessGizmoType(e);if("upload-only"===o)return this.toast("Upload successful!"),!1;"link"===this.activePlaceHolderOperationType&&(a=!0),this.activePlaceHolderOperationType=null;let r=o,n=!0;if("*"==o){if(i)return!1;n=!1,r="link"}let s=this.guessGizmo(o,e,!1,n);return s.length>0?(1===s.length||a?1===s.length&&void 0!==s[0].tag?t.dispatchEvent(new CustomEvent("hax-insert-content",{bubbles:!0,cancelable:!0,composed:!0,detail:s[0]})):a&&t.dispatchEvent(new CustomEvent("hax-insert-content",{bubbles:!0,cancelable:!0,composed:!0,detail:s.find((e=>"a"==e.tag))})):this.haxAppPicker.presentOptions(s,o,"Pick how to present this "+r,"gizmo"),!0):(this.toast("Sorry, HAX doesn't know how to handle that type of link yet."),!1)}write(e,t,i){i&&i.dispatchEvent(new CustomEvent("hax-store-write",{composed:!0,bubbles:!0,cancelable:!1,detail:{property:e,value:t,owner:i}}))}mimeTypeToGizmoType(e){let 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"}}guessGizmoType(e){if(void 0!==e.source){const 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"))return"image";if(-1!=t.indexOf(".gif"))return"gif";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"!=globalThis.MediaBehaviors.Video.getVideoType(t))return"video"}return"*"}render(){return t` `}static get tag(){return"hax-store"}toast(e,t=2e3,i={},a="capsule",o=this.t.close,r=null,n=null){globalThis.dispatchEvent(new CustomEvent(this.toastShowEventName,{bubbles:!0,composed:!0,cancelable:!0,detail:{text:e,duration:t,classStyle:a,closeText:o,eventCallback:r,slot:n,...i}}))}static get properties(){return{...super.properties,skipHAXConfirmation:{type:Boolean,reflect:!0,attribute:"skip-hax-confirmation"},storageData:{type:Object},haxTray:{type:Object},haxCancel:{type:Object},haxAutoloader:{type:Object},haxBodies:{type:Array},activePlaceHolder:{type:Object},activePlaceHolderOperationType:{type:String},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}}}_storageDataChanged(e){e&&this.ready&&this.__storageDataProcessed&&(g("haxConfirm",!1)?u("haxUserData",e):sessionStorageGet("haxConfirm")&&sessionStorageSet("haxUserData",e))}isSingleSlotElement(e){let t=Object.keys(this.slotsSchemaFromNode(e));return 1==t.length&&0===t[0].length}isTextElement(e){let 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","mark","abbr","i","bold","em","strong","blockquote","code","figure"].includes(t))}isInlineElement(e){let t;return null!=e&&e.tagName?t=e.tagName.toLowerCase():null!=e&&e.tag?t=e.tag.toLowerCase():"string"==typeof e&&(t=e),!!(t&&this.validTagList.includes(t)&&(this.haxSchemaFromTag(t)&&this.haxSchemaFromTag(t).meta&&this.haxSchemaFromTag(t).meta.inlineOnly||["a","strike","u","b","sub","sup","span","code","mark","abbr","i","bold","em","strong"].includes(t)))}isGridPlateElement(e){let t;return e&&e.tagName?t=e.tagName.toLowerCase():e&&e.tag&&(t=e.tag.toLowerCase()),!(!t||!this.validGridTagList.includes(t))}isLayoutElement(e){let t=e&&e.tagName&&this.haxSchemaFromTag(e.tagName)||{};return t.type&&"grid"===t.type}isLayoutSlot(e){return!(!e||!e.parentNode)&&this.isLayoutElement(e.parentNode)}isOriginalGridPlate(e){return!!e&&"GRID-PLATE"===e.tagName}activeSchema(){return this.activeNode?this.haxSchemaFromTag(this.activeNode.tagName):void 0}activeParentSchema(){return this.activeNode&&this.activeNode.parentNode?this.haxSchemaFromTag(this.activeNode.parentNode.tagName):void 0}slottedContentByNode(e){let t={...this.slotsSchemaFromNode(e)||{}};return e?([...e.children||[]].forEach((e=>{e.slot&&""!==e.slot&&t[e.slot]?(t[e.slot].items=t[e.slot].items||[],t[e.slot].items.push(e)):e.slot&&""!==e.slot||!t[""]||(t[""].items=t[""].items||[],t[""].items.push(e))})),t):t}slotsSchemaFromNode(e){if(!e||!e.tagName)return{};let t={},i=this.haxSchemaFromTag(e.tagName||{}),a=this.slotsFromSchema(i);if(this.isOriginalGridPlate(e)){(e.layout||"1-1-1-1").split("-").map(((e,t)=>{a.push({slot:`col-${t+1}`,title:`Column ${t+1}`,excludedSlotWrappers:["grid-plate"]})}))}return a.forEach((a=>{a.items=void 0,a.label=a.title||a.slot,a.editMode={...i.editMode,...a.editMode},a.grid=e,(a.slot||""===a.slot)&&(t[a.slot]=a)})),t}schemaBySlotId(e,t){return(this.slotsSchemaFromNode(e)||{})[t]}_appStoreChanged(e,t){e&&t&&(e.url&&!e.apps&&this.shadowRoot?this.loadAppStoreFromRemote():this.__appStoreData=e)}async _loadAppStoreData(e){if(null!=e){var t={};if(void 0!==e.autoloader){e.autoloader=Object.assign({},e.autoloader);for(let i in e.autoloader){let a=i,o=e.autoloader[i];isNaN(a)||(a=e.autoloader[i],o=`@haxtheweb/${a}/${a}.js`),"string"!=typeof o&&(o.haxProperties&&this.setHaxProperties(e.autoloader[i].haxProperties,a),o=e.autoloader[i].import),this.validTagList.push(a),t[a]=o}}if(void 0!==e.apps){var i=e.apps;for(let e=0;e{globalThis.customElements.get(a)&&globalThis.customElements.get(a).haxProperties?this.setHaxProperties(globalThis.customElements.get(a).haxProperties,a):t.appendChild(globalThis.document.createElement(a))})).catch((e=>{console.warn(e),t.appendChild(globalThis.document.createElement(a))}))}}isExternalURLImport(e){let t;try{t=new URL(e)}catch(e){return!1}return new URL(t).origin!==location.origin}_editModeChanged(e){e&&!this.appStoreLoaded&&this.__appStoreData&&this.haxAutoloader&&(clearTimeout(this.__readyToProcessAppStoreData),this._loadAppStoreData(this.__appStoreData))}async _globalPreferencesChanged(e){if(this.__storageDataProcessed&&e&&this.ready){let t=this.storageData;"string"==typeof t&&(t=JSON.parse(t)),t.globalPreferences=e,this.storageData=t,this._storageDataChanged(this.storageData),e.haxLang&&HAXStore.editMode&&(clearTimeout(this._debounceLang),this._debounceLang=setTimeout((async()=>{for(let e in this.elementList){let t=this.elementList[e];t=await this.attemptGizmoTranslation(e,t),this.elementList[e]=t}this.gizmoList.forEach((e=>{this.elementList[e.tag].gizmo.title&&(e.title=this.elementList[e.tag].gizmo.title),this.elementList[e.tag].gizmo.description&&(e.description=this.elementList[e.tag].gizmo.description)}))}),100))}}_haxConsentTap(e){u("haxConfirm",!0),u("haxUserData",JSON.stringify(this.storageData))}updated(e){super.updated&&super.updated(e),e.forEach(((e,t)=>{"appStore"==t&&this[t]&&this._appStoreChanged(this[t],e),["ready","__appStoreData","haxAutoloader"].includes(t)&&this.ready&&this.__appStoreData&&this.haxAutoloader&&(clearTimeout(this.__readyToProcessAppStoreData),this.__readyToProcessAppStoreData=setTimeout((()=>{this._loadAppStoreData(this.__appStoreData)}),0)),["haxAutoloader","haxTray","haxCancel"].includes(t)&&(clearTimeout(this.__storeReady),this.__storeReady=setTimeout((()=>{this._storePiecesAllHere(this.haxAutoloader,this.activeHaxBody,this.haxTray,this.haxCancel)}),0))}))}_calculateActiveGizmo(e){if(null==e||!e.tagName)return null;for(let i in this.gizmoList){var t=this.gizmoList[i];if(t.tag===e.tagName.toLowerCase())return t}}loadAppStoreFromRemote(){const e=new URLSearchParams(this.appStore.params);let t=this.appStore.url;e&&(t+=`?${e}`),fetch(t,{method:this.method}).then((e=>{if(e.ok)return e.json()})).then((e=>{this.__appStoreData=e}))}firstUpdated(e){if(super.firstUpdated&&super.firstUpdated(e),this.skipHAXConfirmation&&(sessionStorageSet("haxConfirm",!0),u("haxConfirm",!0)),sessionStorageGet("haxConfirm")||g("haxConfirm"))if(sessionStorageGet("haxConfirm")&&!g("haxConfirm"))try{let e=sessionStorageGet("haxUserData")?JSON.parse(sessionStorageGet("haxUserData")):{};this.storageData=e,this._storageDataChanged(this.storageData)}catch(e){}else try{let e=g("haxUserData",{});this.storageData=e,this._storageDataChanged(this.storageData)}catch(e){}else{sessionStorageSet("haxConfirm",!0);let e="\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 ";this.toast(e,"-1",{},"fit-bottom","I Accept","hax-consent-tap")}setTimeout((()=>{this.__storageDataProcessed=!0,this.storageData.globalPreferences&&this.write("globalPreferences",this.storageData.globalPreferences,this)}),0)}_storePiecesAllHere(e,t,i,a){if(!this.ready&&t&&e&&i&&a){this.dispatchEvent(new CustomEvent("hax-store-ready",{bubbles:!0,cancelable:!1,composed:!0,detail:!0}));let e=globalThis.RichTextEditorPrompt.requestAvailability();e&&(e.shadowRoot.querySelector("#formfields").schematizer=o,e.shadowRoot.querySelector("#formfields").elementizer=r),i.shadowRoot.querySelector("#haxcancelbutton")&&(a.shadowRoot.querySelector("#dialog").associateEvents(i.shadowRoot.querySelector("#haxcancelbutton")),a.shadowRoot.querySelector("#dialog")&&globalThis.addEventListener("simple-modal-confirmed",this._handleConfirmCancel.bind(this))),this.ready=!0,this._buildPrimitiveDefinitions()}}_handleConfirmCancel(e){e.detail.invokedBy===this.haxTray.shadowRoot.querySelector("#haxcancelbutton")&&(this.editMode=!1,this.dispatchEvent(new CustomEvent("hax-cancel",{bubbles:!0,composed:!0,cancelable:!1,detail:e.detail})))}_positionCursorInNode(e,t=0){this.activeHaxBody.positionContextMenus();var i=globalThis.document.createRange(),a=this.getSelection();return i.setStart(e,t),i.collapse(!0),a.removeAllRanges(),a.addRange(i),i}_onBeforeUnload(e){if(!this.skipExitTrap&&this.editMode)return"Are you sure you want to leave? Your work will not be saved!"}isBase64(e){try{return btoa(atob(e))==e}catch(e){return!1}}retrieveImageFromClipboardAsBlob(e,t){if(0==e.clipboardData&&"function"==typeof t)return t(void 0);var i=e.clipboardData.items;if(null==i&&"function"==typeof t)return t(void 0);for(let e=0;e{for(var i in e)i.startsWith("hax")||(this.activeNode.dataset[i]=e[i]);t&&this.activeNode.setAttribute("slot",t)}),0)}}async _onPaste(e){if(this.editMode&&"HAX-TRAY"!==globalThis.document.activeElement.tagName&&"BODY"!==globalThis.document.activeElement.tagName&&"SIMPLE-MODAL"!==globalThis.document.activeElement.tagName){this.isTextElement(this.activeNode)||(this.activeNode=this.activeHaxBody.haxInsert("p","",{}));let o="",r="";if(e.clipboardData||e.originalEvent.clipboardData?(o=(e.originalEvent||e).clipboardData.getData("text/html"),""==o&&(o=(e.originalEvent||e).clipboardData.getData("text"))):globalThis.clipboardData&&(o=globalThis.clipboardData.getData("Text")),o=o.trim(),o=o.replace(/\s*?<\/span>/g," "),o=o.replace(/(?:style="(\S+:\s*[^;"]+;\s*)*)+"/g,""),o=o.replace(/
        /g,"

        "),r=o,this.isBase64(r))return e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.retrieveImageFromClipboardAsBlob(e,(t=>{if(t){var i=globalThis.URL||globalThis.webkitURL;let a=globalThis.document.createElement("img");a.src=i.createObjectURL(t),this.activeNode.parentNode.insertBefore(a,this.activeNode.nextElementSibling);for(let t in e.clipboardData.items)!e.clipboardData.items[t].name&&e.clipboardData.items[t].type&&(e.clipboardData.items[t].name="image-"+Math.floor(Date.now()/1e3)+e.clipboardData.items[t].type.replace("image/","."));return e.dataTransfer=e.clipboardData,e.placeHolderElement=a,this.dispatchEvent(new CustomEvent("place-holder-file-drop",{bubbles:!0,cancelable:!0,composed:!0,detail:e})),a}return!1}));if(e.clipboardData.files.length>0){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();let t=this.activeHaxBody.haxInsert("p","",{});e.dataTransfer=e.clipboardData;for(let t in e.clipboardData.files)!e.clipboardData.files[t].name&&e.clipboardData.files[t].type&&(e.clipboardData.files[t].name="image-"+Math.floor(Date.now()/1e3)+e.clipboardData.files[t].type.replace("image/","."));e.placeHolderElement=t,this.dispatchEvent(new CustomEvent("place-holder-file-drop",{bubbles:!0,cancelable:!0,composed:!0,detail:e}))}let n=!1,s="",d=globalThis.document.createElement("div");d.innerHTML=o;let p=[];if(d.children&&(o=l(o),o=o.replace(/

        /g,"

        "),o=o.replace(/<\/h1>/g,"

        "),o=o.replace(//g,(function(e,t){return``})),p=await this.htmlToHaxElements(o),1!==p.length||this.__validGridTags().includes(p[0].tag)||(p=await this.htmlToHaxElements(p[0].content))),0===p.length&&h(o)){""!=this.activeNode.innerText.trim()&&(n=!0);let e={source:o,title:o};if(!n&&!this.insertLogicFromValues(e,this,!1,!0))return!1}else if(0===p.length){if(n=!0,r==o)return!1;s=o}else if(1===p.length&&"p"===p[0].tag)s=o,n=!0;else if(1===p.length&&"a"===p[0].tag&&p[0].properties.href)if(""!=this.activeNode.innerText.trim())s=p[0].properties.href,n=!0;else{let e={source:p[0].properties.href,title:p[0].content};if(!this.insertLogicFromValues(e,this))return!1}else{if(!this.isGridPlateElement(p[0]))return!1;for(let e in p){"p"==p[e].tag&&["li","ol","ul"].includes(this.activeNode.tagName.toLowerCase())&&(p[e].tag="li"),delete p[e].properties.style,delete p[e].properties.start,delete p[e].properties.align;let t=c({tag:p[e].tag,content:p[e].content.replace(/ <\/span>/g," ").trim(),properties:p[e].properties});s+=await this.nodeToContent(t)}}e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();try{let e=this.getRange(),r=this.getSelection(),l=globalThis.document.createElement("div");if(l.innerHTML=s,e&&r){for(let e in l.children)l.children[e].tagName&&this.isTextElement(l.children[e])&&""===l.children[e].innerHTML&&l.children[e].remove();if(n){let t;if(h(o))t=globalThis.document.createElement("a"),t.setAttribute("href",o),t.setAttribute("rel","noopener noreferrer"),t.setAttribute("target","_blank"),t.innerText=o;else if(l.children&&l.children.length>0){for(;l.childNodes.length>1;)e.insertNode(Array.from(l.childNodes).pop());t=Array.from(l.childNodes).pop()}else t=globalThis.document.createTextNode(l.innerHTML);e.deleteContents(),e.insertNode(t),setTimeout((()=>{this._positionCursorInNode(t,t.length)}),0)}else{var t,i,a;for(""!=this.activeNode.innerText.trim()&&e.endOffset!=this.activeNode.innerText.length&&(t=!0,globalThis.document.execCommand("insertParagraph")),e.commonAncestorContainer&&e.commonAncestorContainer.parentNode&&(a||this.activeNode==e.commonAncestorContainer||(a=e.commonAncestorContainer.parentNode)||(a=e.commonAncestorContainer));l.firstElementChild;)i=l.firstElementChild,a?(a.getAttribute&&a.getAttribute("slot")&&i.setAttribute("slot",a.getAttribute("slot")),t?(this.activeHaxBody.haxReplaceNode(a.previousElementSibling,i),t=!1):a.parentNode?a.parentNode.insertBefore(i,a.nextElementSibling):a.insertBefore(i,a.nextElementSibling)):this.activeNode?(this.activeNode.getAttribute("slot")&&i.setAttribute("slot",this.activeNode.getAttribute("slot")),""==this.activeNode.innerText.trim()?this.activeHaxBody.haxReplaceNode(this.activeNode,i):this.activeNode.parentNode.insertBefore(i,this.activeNode.nextElementSibling)):this.activeHaxBody.appendChild(i),a=i;setTimeout((()=>{i&&i.childNodes&&i.childNodes[0]&&(this._positionCursorInNode(i.childNodes[0],i.childNodes[0].length),i=null,a=null)}),0)}}}catch(e){console.warn(e)}}}__validGridTags(){return["p","ol","ul","li","div","h1","h2","h3","h4","h5","h6","blockquote","code","section","dl","dd","dt","figure"]}__validTags(){return["p","div","span","mark","abbr","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","figcaption","img","iframe","video","audio","section","dl","dt","dd","template","webview"]}__validGizmoTypes(){return["data","video","audio","text","link","file","pdf","image","csv","doc","document","archive","markdown","html","content","text","gif","inline","*"]}constructor(){super(),E(["core"]),this.toastShowEventName=globalThis.HAXCMS?"haxcms-toast-show":"simple-toast-show",this.t={close:"Close"},void 0!==globalThis.speechSynthesis&&(globalThis.SpeechRecognition||globalThis.webkitSpeechRecognition||globalThis.mozSpeechRecognition||globalThis.msSpeechRecognition||globalThis.oSpeechRecognition)&&(A.voiceSearch=!0),A.icon="hax:wizard-hat",A.allowedCallback=()=>!(!this.ready||!this.editMode),A.defineOption({title:"Insert emoji",icon:"editor:insert-emoticon",tags:["emoji"],value:{name:"Insert emoji",context:"/",program:async(e,t)=>{let i=[],a=globalThis.document.createElement("textarea");return await Object.keys(globalThis.SimplePickerEmojis).forEach((async t=>{await globalThis.SimplePickerEmojis[t].forEach((async o=>{(""==e||o.description.includes(e))&&(a.innerHTML=o.value,i.push({title:o.description,textCharacter:a.value,tags:[t],value:{target:this,method:"_insertTextResult",args:[a.value]},context:["/","/HAX/text/emoji/"+a.value],eventName:"super-daemon-element-method",path:"/HAX/text/emoji/"+a.value}))}))})),i}},context:["HAX","/"],eventName:"super-daemon-run-program",path:"/HAX/text/emoji"}),A.defineOption({title:"Insert symbol",icon:"editor:functions",tags:["symbol"],value:{name:"Insert symbol",context:"/",program:async(e,t)=>{let i=[],a=globalThis.document.createElement("textarea");return await Object.keys(globalThis.SimplePickerSymbols).forEach((async t=>{await globalThis.SimplePickerSymbols[t].forEach((async o=>{(""==e||t.includes(e))&&(a.innerHTML=o.value,i.push({title:`${t}: ${a.value}`,textCharacter:a.value,tags:[t],value:{target:this,method:"_insertTextResult",args:[a.value]},context:["/","/HAX/text/symbol/"+a.value],eventName:"super-daemon-element-method",path:"/HAX/text/symbol/"+a.value}))}))})),i}},context:["HAX","/"],eventName:"super-daemon-run-program",path:"/HAX/text/symbol"}),A.defineOption({title:"Join our Community",icon:"hax:discord",priority:-100,tags:["community","discord","chat","help"],value:{target:this,method:"_openExternalLink",args:["https://bit.ly/hax-discord"]},eventName:"super-daemon-element-method",path:"HAX/community/join",context:["logged-in","CMS","HAX"]}),A.defineOption({title:"User Tutorials",icon:"hax:hax2022",priority:-1e3,tags:["Documentation","community","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/tutorials"]},eventName:"super-daemon-element-method",path:"HAX/community/tutorials",context:["logged-in","CMS","HAX"]}),A.defineOption({title:"User Documentation",icon:"hax:hax2022",tags:["Documentation","community","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/documentation"]},eventName:"super-daemon-element-method",path:"HAX/community/documentation",context:["logged-in","CMS","HAX"]}),A.defineOption({title:"HAX Teaching Excellence",icon:"hax:hax2022",tags:["Ontology","community","pedagogy","documentation","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/ontology"]},eventName:"super-daemon-element-method",path:"HAX/community/pedagogy",context:["logged-in","CMS","HAX"]}),A.defineOption({title:"Bug / issue",icon:"mdi-social:github-circle",tags:["Bug report","github","git","community","issue queue"],value:{target:this,method:"_haxStoreContribute",args:["bug","POP,bug"]},eventName:"super-daemon-element-method",path:"HAX/community/contribute",context:["logged-in","CMS","HAX"]}),A.defineOption({title:"Idea / Feature request",icon:"mdi-social:github-circle",tags:["Feature request","idea","github","git","community","issue queue"],value:{target:this,method:"_haxStoreContribute",args:["feature","POP,enhancement"]},context:["logged-in","CMS","HAX"],eventName:"super-daemon-element-method",path:"HAX/community/contribute"}),this.primativeHooks={},this.__dragTarget=null,this.registerLocalization({context:this,namespace:"hax",basePath:import.meta.url+"/../../",locales:["es"]}),this.appSearch=null,this.method="GET",this.haxSelectedText="",this.__winEvents={"hax-super-daemon-insert-tag":"_superDaemonInsert","hax-register-properties":"_haxStoreRegisterProperties","hax-consent-tap":"_haxConsentTap",onbeforeunload:"_onBeforeUnload",paste:"_onPaste",command:"_onCommand","hax-register-app":"_haxStoreRegisterApp","hax-register-stax":"_haxStoreRegisterStax","hax-register-core-piece":"_haxStorePieceRegistrationManager","hax-register-body":"_haxStoreRegisterBody","hax-insert-content":"_haxStoreInsertContent","hax-insert-content-array":"_haxStoreInsertMultiple","hax-refresh-tray-form":"refreshActiveNodeForm","rich-text-editor-prompt-open":"_richTextEditorPromptOpen","rich-text-editor-prompt-confirm":"_richTextEditorPromptConfirm"},globalThis.onbeforeunload=e=>{if(!this.skipExitTrap&&this.editMode){var t="Are you sure you want to leave? Your work will not be saved!";return e.returnValue=t,t}},a.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 padding: 0;\n margin: 0;\n font-size: 14px;\n line-height: 20px;\n }\n simple-popover-manager h3 {\n margin: 8px 2px;\n }"}),this.skipHAXConfirmation=!1,this.storageData={},this.appStore={url:"",params:{}},this.daemonKeyCombo=`${A.key1} + ${A.key2} + `,this.activeNode=null,this.activeEditingElement=null,this.haxBodies=[],this.activePlaceHolder=null,this.activePlaceHolderOperationType=null,this.sessionObject={},this.editMode=!1,this.skipExitTrap=!1,this.appStoreLoaded=!1,this.elementList={},this.elementAlign=g("hax-tray-elementAlign"),this.elementAlign&&null!=this.elementAlign||(this.elementAlign="left"),this.trayStatus="collapsed",this.trayDetail="content-edit",this.appList=[],this.gizmoList=[],this.recentGizmoList=N.readMemory("recentGizmoList")||[],this.haxAutoloader=null,this.activeHaxBody=null,this.haxTray=null,this.haxCancel=null,this.staxList=[],this.globalPreferences={},this.activeApp={},this.connectionRewrites={},this.daemonCommands={},this.keyboardShortcuts={"#":{tag:"h2",content:""},"##":{tag:"h3",content:""},"###":{tag:"h4",content:""},"####":{tag:"h5",content:""},"#####":{tag:"h6",content:""},"######":{tag:"h6",content:""},"1.":{tag:"ol",content:"
      • "},"-":{tag:"ul",content:"
      • "},"*":{tag:"ul",content:"
      • "},"+":{tag:"ul",content:"
      • "},"---":{tag:"hr"},"***":{tag:"hr"},___:{tag:"hr"},"```":{tag:"code",content:""},">":{tag:"blockquote",content:""}},this.__primsBuilder={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"},dl:{title:"Data list",icon:"editor:format-list-bulleted"},dt:{title:"Data term",icon:"editor:format-list-bulleted"},dd:{title:"Data definition",icon:"editor:format-list-bulleted"},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",tags:["Text","h2","html","text","heading","header"]},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",handles:[{type:"inline",text:"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"},embed:{title:"Embedded object",icon:"icons:fullscreen"}},this.validTagList=this.__validTags(),this.validGridTagList=this.__validGridTags(),this.validGizmoTypes=this.__validGizmoTypes();let e=globalThis.document.createElement("webview");this._isSandboxed="function"==typeof e.reload,globalThis.document.body.style.setProperty("--hax-ui-headings","#d4ff77"),this.revisionHistoryLink=null,f(this,{daemonKeyCombo:x,gizmoList:x,recentGizmoList:x,activeNode:x,globalPreferences:x,activeGizmo:b,activeNodeIndex:b,editMode:x,revisionHistoryLink:x,elementAlign:x,trayStatus:x,trayDetail:x,appList:x,activeApp:x,haxSelectedText:x,activeEditingElement:x,activeHaxBody:x,appStoreLoaded:x}),y((()=>{this._globalPreferencesChanged(T(this.globalPreferences))})),y((()=>{this._editModeChanged(T(this.editMode))})),y((()=>{const e=T(this.recentGizmoList);e.length>0&&N.writeMemory("recentGizmoList",e,"long")}))}async _insertTextResult(e){this.activeNode.focus(),A.activeRange&&(A.activeRange.setStart(this.activeNode,0),A.activeRange.collapse(!0),A.activeSelection.removeAllRanges(),A.activeSelection.addRange(A.activeRange),A.activeSelection.selectAllChildren(this.activeNode),A.activeSelection.collapseToEnd()),setTimeout((()=>{""==this.activeNode.textContent?this.activeNode.textContent=e:globalThis.document.execCommand("insertHTML",!1,e)}),0)}_openExternalLink(e){globalThis.open(e,"_blank")}async _haxStoreContribute(e,t,i=null){let a="";if("merlin"==e){var o=`[${e}] New command request from HAX daemon`;a=`Location: ${globalThis.location.href}\nMerlin command: ${i}\nWhat did you want merlin to do?\n`}else{o=`[${e}] User report from HAX daemon`;if(a=`Location: ${globalThis.location.href}\nBrowser: ${navigator.userAgent}\nOS: ${navigator.userAgentData.platform} - ${navigator.deviceMemory}GB RAM - ${navigator.hardwareConcurrency} cores\nScreen: ${globalThis.screen.width}x${globalThis.screen.height}\nWindow size: ${globalThis.innerWidth}x${globalThis.innerHeight}\n`,navigator.getBattery){a+=`Battery: ${100*(await navigator.getBattery()).level}%\n`}navigator.connection&&navigator.connection.effectiveType&&(a+=`Connection: ${navigator.connection.effectiveType}\n`),a+=("feature"==e?"Your idea:":"Bug you experienced:")+"\n"}globalThis.open(`https://github.com/haxtheweb/issues/issues/new?assignees=&labels=${t}&template=issue-report.md&title=${o}&body=${encodeURIComponent(a)}`,"_blank")}async _richTextEditorPromptOpen(e){if(e.detail.element&&e.detail.element.gizmo.tag){const t=globalThis.document.createElement(e.detail.element.gizmo.tag);HAXStore.testHook(t,"setupActiveElementForm")&&await HAXStore.runHook(t,"setupActiveElementForm",[e.detail.element])}const t=globalThis.getComputedStyle(globalThis.document.body);"hidden"==t.getPropertyValue("overflow")&&(this.__overflowHiddenOnOpen=t.getPropertyValue("overflow"),globalThis.document.body.style.overflow="auto"),setTimeout((()=>{const e=globalThis.document.querySelector("rich-text-editor-prompt").shadowRoot.querySelector(".actions");"function"==typeof e.scrollIntoViewIfNeeded?e.scrollIntoViewIfNeeded(!0):e.scrollIntoView({behavior:"smooth",inline:"center"})}),100)}_richTextEditorPromptConfirm(e){const t=e.detail.value&&e.detail.value.target?e.detail.value.target:null;setTimeout((()=>{"A"===this.activeNode.tagName&&t&&(this.activeNode.setAttribute("target",t),this.refreshActiveNodeForm())}),0),this.__overflowHiddenOnOpen&&(globalThis.document.body.style.overflow=this.__overflowHiddenOnOpen,this.__overflowHiddenOnOpen=null)}_buildPrimitiveDefinitions(){if(this._isSandboxed){let e={type:"element",editingElement:"core",canScale:!0,designSystem:{card:!0,primary:!0},canEditSource:!0,settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this resource.",inputMethod:"textfield",icon:"link",required:!0,validationType:"url"}],advanced:[]}};this.setHaxProperties(e,"webview")}this.setHaxProperties({canScale:!0,type:"element",designSystem:{card:!0,primary:!0},editingElement:"core",canEditSource:!0,gizmo:{title:"Image",description:"A basic img tag",icon:"image:image",color:"blue-grey",tags:["Images","media","img","html"],handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this image.",inputMethod:"haxupload",noVoiceRecord:!0,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:"loading",title:"Loading method",description:"Whether or not to lazy load this",inputMethod:"select",options:{lazy:"Load when visible",auto:"Automatic"}}]},demoSchema:[{tag:"img",content:"",properties:{src:"https://cdn2.thecatapi.com/images/9j5.jpg",loading:"lazy"}}]},"img");this.setHaxProperties({canScale:!0,type:"grid",canEditSource:!0,gizmo:{title:"Figure",description:"A basic figure tag",icon:"hax:figure",color:"blue-grey",tags:["Images","media","figure","html"],requiresChildren:"figcaption",handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[]},demoSchema:[{tag:"figure",properties:{},content:'image other media here\n

        Image Caption Here

        '}]},"figure");this.setHaxProperties({canScale:!0,type:"grid",editingElement:"core",canEditSource:!0,gizmo:{title:"Figure caption",description:"Used inside of a figure tag",icon:"image:image",color:"blue-grey",tags:["Images","media","caption","figure","html"],handles:[],requiresParent:"figure",meta:{author:"W3C",hidden:!0}},settings:{configure:[{slot:"",title:"Figure Caption",description:"Caption for the figure",inputMethod:"code-editor"}]},demoSchema:[{tag:"figcaption",properties:{},content:"Image Caption Here"}]},"figcaption");this.setHaxProperties({type:"element",editingElement:"core",canScale:!1,designSystem:{primary:!0},canEditSource:!0,contentEditable:!0,gizmo:{title:"Highlight",description:"Highlight text within a block of content",icon:"editor:highlight",color:"yellow",tags:["Content","text","highlight","mark","html"],handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"innerText",title:"Text",description:"Text of the highlight",inputMethod:"textfield",required:!0}],advanced:[],developer:[]},demoSchema:[{tag:"mark",content:"Highlight me",properties:{}}]},"mark");this.setHaxProperties({type:"element",editingElement:"core",canScale:!1,designSystem:{primary:!0},canEditSource:!0,contentEditable:!0,gizmo:{title:"Abbreviation",description:"Simple abbreviation with tooltip of full word",icon:"hax:abbr",color:"yellow",tags:["Content","text","abbr","html"],handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"innerText",title:"Text",description:"Text that is visible, the abbreviation",inputMethod:"textfield",required:!0},{attribute:"title",title:"Word",description:"Word that the abbreviation is representing",inputMethod:"textfield",required:!0}],advanced:[],developer:[]},demoSchema:[{tag:"abbr",content:"Abbr",properties:{title:"Abbreviation"}}]},"abbr");let e={type:"element",editingElement:"core",canScale:!1,designSystem:{accent:!0},canEditSource:!0,contentEditable:!0,gizmo:{title:"Basic link",description:"A basic a tag",icon:"icons:link",color:"blue-grey",tags:["Resource","link","a","url","html","href","address","http"],handles:[],meta:{author:"W3C"}},settings:{configure:[{attribute:"href",title:"Link",description:"The URL for the link",inputMethod:"haxupload",required:!0,validationType:"url"},{attribute:"innerText",title:"Text",description:"Text of the link",inputMethod:"textfield",required:!0},{attribute:"target",title:"Target",description:"Where to open the link.",inputMethod:"select",options:{"":"Same window",_blank:"New window - _blank",_top:"Top window - _top",_parent:"Parent window - _parent"}}],advanced:[],developer:[{attribute:"title",title:"Title text",description:"Useful for screen readers and improved SEO.",inputMethod:"textfield"},{attribute:"rel",title:"rel",description:"Specifies the relationship between this document and the opened globalThis.document. Change as part of security or SEO policy.",inputMethod:"select",options:{noopener:"noopener","noopener noreferrer":"noopener noreferrer","nofollow ":"nofollow","noopener noreferrer nofollow":"noopener noreferrer nofollow",opener:"opener"}}]},demoSchema:[{tag:"p",content:'Link to content',properties:{}}]};this.validGizmoTypes.forEach((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,designSystem:!0,canEditSource:!0,contentEditable:!0,gizmo:{title:"Paragraph",description:"A basic text area",icon:"hax:paragraph",color:"blue-grey",tags:["Text","p","paragraph","text","html"],handles:[{type:"content",title:"innerHTML",alt:"title"}],meta:{author:"W3C",outlineDesigner:!0}},settings:{configure:[],advanced:[]},demoSchema:[{tag:"p",content:"Deep thoughts..",properties:{}}]},"p");let t={type:"element",editingElement:{tag:"editable-table",import:"@haxtheweb/editable-table/editable-table.js",callback:this.setupEditableTable.bind(this)},canScale:!0,canEditSource:!0,gizmo:{title:"Table",description:"A table for displaying data",icon:"image:grid-on",color:"blue-grey",tags:["Instructional","table","data","html","grid","matrix","spreadsheet","csv","excel"],meta:{hidden:!0,author:"W3C"}},settings:{configure:[],advanced:[]}};this.setHaxProperties(t,"table");let i=globalThis.document.createElement("editable-table");this.haxAutoloader.appendChild(i);let a={type:"element",editingElement:{tag:"iframe-loader",import:"@haxtheweb/iframe-loader/iframe-loader.js",callback:this.setupIframeLoader.bind(this)},canScale:!1,designSystem:{card:!0,primary:!0},canEditSource:!1,gizmo:{title:"iFrame",description:"A basic way to frame external web content",icon:"hax:iframe",color:"blue-grey",tags:["Resource","iframe","content","url","link","embed","https","html","address"],handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this resource.",inputMethod:"textfield",icon:"link",required:!0,validationType:"url"}]}};this.setHaxProperties(a,"iframe");let o=globalThis.document.createElement("iframe-loader");this.haxAutoloader.appendChild(o);for(let e in this.__primsBuilder){let t="";["h1","h2","h3","h4","h5","h6"].includes(e)?t="Heading":"ul"!=e&&"ol"!=e||(t="
      • Item
      • Item
      • "),this.setHaxProperties({type:"element",editingElement:"core",canScale:!1,designSystem:["h1","h2","h3","h4","h5","h6"].includes(e)?{text:!0,card:!0,primary:!0,designTreatment:!0}:!!["ol","ul"].includes(e)&&{text:!0,card:!0,accent:!0,primary:!0},canEditSource:!0,contentEditable:!0,gizmo:{title:this.__primsBuilder[e].title,icon:this.__primsBuilder[e].icon,tags:this.__primsBuilder[e].tags||["Text",e,"html","text"],handles:this.__primsBuilder[e].handles||[],meta:{author:"W3C",inlineOnly:!!["em","b","strong","i","strike","u","sub","sup","span"].includes(e),hidden:!["h2","ul"].includes(e),outlineDesigner:!!["h2","ul"].includes(e)}},settings:{configure:[],advanced:[]},demoSchema:[{tag:e,content:t,properties:{}}]},e)}this.setHaxProperties({canScale:!0,type:"element",editingElement:"core",designSystem:{primary:!0},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")}_haxStorePieceRegistrationManager(e){e.detail&&e.detail.piece&&e.detail.object&&(this[e.detail.piece]=e.detail.object)}setupEditableTable(e){this.activeNode=e,setTimeout((()=>{e.editMode=!0,e.focus()}),0)}setupIframeLoader(e){this.activeNode=e,setTimeout((()=>{e.disabled=!0}),0)}async _haxStoreInsertContent(e){if(e.detail){let i=e.detail;if(globalThis.customElements.get(i.tag)){let e=globalThis.document.createElement(i.tag);this.testHook(e,"preProcessInsertContent")&&(i=await this.runHook(e,"preProcessInsertContent",[i,this.activeNode]))}var t={};if(void 0!==i.properties&&(t=i.properties),t.innerHTML&&(""==i.content&&(i.content=t.innerHTML),delete t.innerHTML),t.innerText&&(""==i.content&&(i.content=t.innerText),delete t.innerText),void 0!==i.__type&&"inline"===i.__type){let e=c({tag:i.tag,content:i.content,properties:t});null!==this.activePlaceHolder&&(this.activePlaceHolder.deleteContents(),this.activePlaceHolder.insertNode(e)),this.activePlaceHolder=null}else if(i.replace||i.replacement||i.nextToActive){let e=c({tag:i.tag,content:i.content,properties:t});this.activePlaceHolder?(this.activeHaxBody.haxReplaceNode(this.activePlaceHolder,e),this.activePlaceHolder=null):i.nextToActive&&this.activeNode?this.activeHaxBody.__slot&&this.activeNode.haxLayoutContainer?this.activeNode.appendChild(e):this.activeNode.parentNode.insertBefore(e,this.activeNode):this.activeHaxBody.haxReplaceNode(this.activeNode,e)}else if(this.activeNode&&this.activeNode.parentNode&&"HAX-BODY"!=this.activeNode.parentNode.tagName){let e=c({tag:i.tag,content:i.content,properties:t});this.activeNode.parentNode.haxLayoutContainer?(null!=this.activeNode.getAttribute("slot")&&e.setAttribute("slot",this.activeNode.getAttribute("slot")),this.activeHaxBody.haxInsert(i.tag,i.content,t)):this.activeHaxBody.haxInsert(i.tag,i.content,t)}else this.activeHaxBody.haxInsert(i.tag,i.content,t)}}slotsFromSchema(e,t=!1){let i=e?e.settings:{},a=[];return Object.keys({...i||{}}).map((e=>(i[e]||[]).filter((e=>{let i=!t||!e.required;return!(!e.slot&&""!==e.slot||a.includes(e.slot)||!i)&&(a.push(e.slot),!0)})))).flat()}haxSchemaFromTag(e){return e&&e.toLowerCase&&(e=e.toLowerCase(),this.elementList&&this.elementList[e])?this.elementList[e]:{}}_haxStoreInsertMultiple(e){var t;if(e.detail)for(let i in e.detail)t={},void 0!==e.detail[i].properties&&(t=e.detail[i].properties),this.activeHaxBody.haxInsert(e.detail[i].tag,e.detail[i].content,t)}_haxStoreRegisterBody(e){e.detail&&(this.haxBodies.push(e.detail),this.activeHaxBody=e.detail,this.write("activeHaxBody",this.activeHaxBody,this),this.write("editMode",this.editMode,this),clearTimeout(this.__storeReady),this.__storeReady=setTimeout((()=>{this._storePiecesAllHere(this.haxAutoloader,this.activeHaxBody,this.haxTray,this.haxCancel)}),0))}_superDaemonInsert(e){A.programTarget&&e.detail.properties&&(e.detail.properties.src||e.detail.properties.source||e.detail.properties.href)?A.programTarget.value=e.detail.properties.src||e.detail.properties.source||e.detail.properties.href:this.haxTray._processTrayEvent(e),A.programTarget=null}computePolyfillSafe(){return!(!globalThis.document.head.createShadowRoot&&!globalThis.document.head.attachShadow)||(console.warn("Shadow DOM missing, certain operations hidden"),!1)}_haxStoreRegisterApp(e){if(e.detail){const i=e.detail;i.index=this.appList.length,this.appList=[...this.appList,i],this.write("appList",T(this.appList),this);let a="media";if(i.connection.operations&&i.connection.operations.browse&&i.connection.operations.browse.resultMap&&i.connection.operations.browse.resultMap.defaultGizmoType&&(a=i.connection.operations.browse.resultMap.defaultGizmoType),A.defineOption({title:"Search "+i.details.title,icon:i.details.icon,tags:["Search",...i.details.tags,a],more:i.details.tos&&i.details.tos.length>0?t`
        Terms of service:
          ${i.details.tos.map((e=>t`
        • diff --git a/cdn/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-tray.js b/cdn/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-tray.js index 10b9f9bd2..4964520fc 100755 --- a/cdn/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-tray.js +++ b/cdn/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-tray.js @@ -79,7 +79,6 @@ import{html as t,css as e}from"../../../lit/index.js";import{winEventsElement as } :host([tray-detail="view-source"]) .detail { width: 50vw; - height: 50vh; min-height: 300px; min-width: calc(var(--hax-tray-width) - 100px); resize: both; diff --git a/cdn/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-view-source.js b/cdn/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-view-source.js index 1aacebef2..57feb285f 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-view-source.js +++ b/cdn/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-view-source.js @@ -1,5 +1,8 @@ import{LitElement as t,html as o,css as e}from"../../../lit/index.js";import{MtzFileDownloadBehaviors as a}from"../../dl-behavior/dl-behavior.js";import{stripMSWord as i,formatHTML as l,b64toBlob as n}from"../../utils/utils.js";import{HAXStore as s}from"./hax-store.js";import"./hax-toolbar.js";import{HaxComponentStyles as r}from"./hax-ui-styles.js";import{autorun as d,toJS as c}from"../../../mobx/dist/mobx.esm.js";import{I18NMixin as h}from"../../i18n-manager/lib/I18NMixin.js";import"../../simple-toolbar/lib/simple-toolbar-menu.js";import"../../simple-toolbar/lib/simple-toolbar-menu-item.js";import"./hax-tray-button.js";import{MicroFrontendRegistry as m}from"../../micro-frontend-registry/micro-frontend-registry.js";class HaxViewSource extends(h(a(t))){static get styles(){return[...r,e` - :host, + :host { + display: block; + height: calc(100vh - 120px); + } #wrapper { margin: 0; padding: 0; @@ -19,6 +22,7 @@ import{LitElement as t,html as o,css as e}from"../../../lit/index.js";import{Mtz bottom: 0; margin: 0; padding: 0; + height: calc(100vh - 200px); } .updatecontent { background-color: var(--simple-colors-default-theme-green-1); diff --git a/cdn/build/es6/node_modules/@haxtheweb/hax-iconset/lib/hax-iconset-manifest.js b/cdn/build/es6/node_modules/@haxtheweb/hax-iconset/lib/hax-iconset-manifest.js index 48fa89aee..53baf2ce0 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/hax-iconset/lib/hax-iconset-manifest.js +++ b/cdn/build/es6/node_modules/@haxtheweb/hax-iconset/lib/hax-iconset-manifest.js @@ -1 +1 @@ -import{SimpleIconsetStore as e}from"../../simple-icon/lib/simple-iconset.js";export const HaxIconsetManifest=[{name:"courseicons",icons:["astro1","astro11","astro120","astro130","astro140","astro2","bio1","biol11","biol110","biol120n","biol133","biol141","biol155","biol177","bisci001","bisci002","bisci003","bisci004","bmmb551","bmmb852","chem-connection","chem005","chem1","chem101","chem110","chem2","frnsc100","frnsc200","frnsc210","knowledge","learning-objectives","listen","math021","math022","math034","math036","math110","math140","math220","math436","phys010","phys1","phys2","phys3","strategy"]},{name:"drawing",icons:["draw-ellip","draw-poly","draw-rect","move","select"]},{name:"editable-table",icons:["col-striped","column-headers","filter-off","filter","footer","numbers","row-condensed","row-headers","row-striped","sortable"]},{name:"hax",icons:["12","3-3-3-3","4-4-4","4-8","6-6","8-4","abbr","accessibility","add-brick","add-child-page","add-item","add-page","add","anchor","apps","arrow-all","arrow-expand-left","arrow-expand-right","arrow-left","arrow-right","assess","bricks","bulletin-board","calendar","camera","case-sensitive-alt","clipboard-pulse","code-json","collaborate","computer","computer2","console-line","consult","container","delete-restore","discord","disqus","documents","duplicate","email","engage","engage2","examity","expand-more","figure","file-ai","file-blank","file-css","file-csv","file-doc","file-docx","file-eps","file-gif","file-html","file-jpg","file-js","file-link-outline","file-pdf","file-png","file-ppt","file-rtf","file-svg","file-xls","flikr","format-textblock","gears","git","globe","graph","h1","h2","h3","h4","h5","h6","hax2022","home-edit","hr","html-code","idea","iframe","image","keyboard-arrow-down","keyboard-arrow-up","lesson","loading","map","map-legend","math","meme","menu-open","messages-1","messages-2","messages-3","messages-4","messages-5","messages-6","messages-7","messages-8","messages-9-plus","messages-9","module","monitor","motivate","multimedia","multiple-choice","newspaper","ngdle","no-assignment","oer","oerschema","outline-designer-indent","outline-designer-outdent","page-details","page-edit","paragraph","phone","pi","placeholder-image","placeholder","podcast","qr-code","quick","remix","remote","reportcard","reuse","scroll","search-clear","select-element","settings","shovel","site-map","site-settings","slash","spotify","table-column-plus-after","table-column-remove","table-multiple","task","templates","ticket","time","timeline","twitter","unit","video","view-gallery","vimeo","vocab","vr","wand","wizard-hat","wordpress"]},{name:"lrn",icons:["about","accessibility","add","apps","arrow-left","arrow-right","assessment","assignment","assignments","beaker","blog","blogs","book","bookmark-outline","bookmark","calendar","canban","cancel","chevron-down","chevron-left","chevron-right","choice1","choice2","choice3","cis","cle","close","collab","columns","comment","compass","comply","content-outline","content","courses","cpr","data_usage","dino","discuss","done","dotgrid","download","ecd","edit","editorial","elmsmedia","explore","file-download","gear","grades","help","hidden","icor","inbox","info","innovate","input","instructor","interact","lab","labs","lecture","letter","media","mooc","more-vert","network","notifications","online","outline","page","palette","pdf","people","play","plus","quiz","replay","resources","save","settings","share","speechballoons","studio-assignment-list","studio","support","syllabus","teacher","tour","user","view-off","view","visible","write"]},{name:"mdextra",icons:["cursor-text","hexagon-multiple","hexagon-outline","hexagon","subscript","superscript","unlink","vector-polyline-plus"]},{name:"mdi-social",icons:["blogger","disqus","dribble","facebook-box","facebook","github-box","github-circle","google-plus-box","google-plus",null,"instagram","instapaper","linkedin","pinterest","pocket","readability","rss-box","tumblr","twitch","twitter-box","twitter","whatsapp","youtube"]},{name:"paper-audio-icons",icons:["error-outline","pause","play-arrow","replay"]}];e.registerManifest(HaxIconsetManifest); \ No newline at end of file +import{SimpleIconsetStore as e}from"../../simple-icon/lib/simple-iconset.js";export const HaxIconsetManifest=[{name:"courseicons",icons:["astro1","astro11","astro120","astro130","astro140","astro2","bio1","biol11","biol110","biol120n","biol133","biol141","biol155","biol177","bisci001","bisci002","bisci003","bisci004","bmmb551","bmmb852","chem-connection","chem005","chem1","chem101","chem110","chem2","frnsc100","frnsc200","frnsc210","knowledge","learning-objectives","listen","math021","math022","math034","math036","math110","math140","math220","math436","phys010","phys1","phys2","phys3","strategy"]},{name:"drawing",icons:["draw-ellip","draw-poly","draw-rect","move","select"]},{name:"editable-table",icons:["col-striped","column-headers","filter-off","filter","footer","numbers","row-condensed","row-headers","row-striped","sortable"]},{name:"hax",icons:["12","3-3-3-3","4-4-4","4-8","6-6","8-4","abbr","accessibility","add-brick","add-child-page","add-item","add-page","add","anchor","apps","arrow-all","arrow-expand-left","arrow-expand-right","arrow-left","arrow-right","assess","bricks","bulletin-board","calendar","camera","case-sensitive-alt","clipboard-pulse","code-json","collaborate","computer","computer2","console-line","consult","container","delete-restore","discord","disqus","documents","duplicate","email","engage","engage2","examity","expand-more","figure","file-ai","file-blank","file-css","file-csv","file-doc","file-docx","file-eps","file-gif","file-html","file-jpg","file-js","file-link-outline","file-pdf","file-png","file-ppt","file-rtf","file-svg","file-xls","flikr","format-textblock","gears","git","globe","graph","h1","h2","h3","h4","h5","h6","hax2022","head-question","home-edit","hr","html-code","idea","iframe","image","keyboard-arrow-down","keyboard-arrow-up","lesson","loading","map","map-legend","math","meme","menu-open","messages-1","messages-2","messages-3","messages-4","messages-5","messages-6","messages-7","messages-8","messages-9-plus","messages-9","module","monitor","motivate","multimedia","multiple-choice","newspaper","ngdle","no-assignment","oer","oerschema","outline-designer-indent","outline-designer-outdent","page-details","page-edit","paragraph","phone","pi","placeholder-image","placeholder","podcast","qr-code","quick","remix","remote","reportcard","reuse","scroll","search-clear","select-element","settings","shovel","site-map","site-settings","slash","spotify","table-column-plus-after","table-column-remove","table-multiple","task","templates","ticket","time","timeline","twitter","unit","video","view-gallery","vimeo","vocab","vr","wand","wizard-hat","wordpress"]},{name:"lrn",icons:["about","accessibility","add","apps","arrow-left","arrow-right","assessment","assignment","assignments","beaker","blog","blogs","book","bookmark-outline","bookmark","calendar","canban","cancel","chevron-down","chevron-left","chevron-right","choice1","choice2","choice3","cis","cle","close","collab","columns","comment","compass","comply","content-outline","content","courses","cpr","data_usage","dino","discuss","done","dotgrid","download","ecd","edit","editorial","elmsmedia","explore","file-download","gear","grades","help","hidden","icor","inbox","info","innovate","input","instructor","interact","lab","labs","lecture","letter","media","mooc","more-vert","network","notifications","online","outline","page","palette","pdf","people","play","plus","quiz","replay","resources","save","settings","share","speechballoons","studio-assignment-list","studio","support","syllabus","teacher","tour","user","view-off","view","visible","write"]},{name:"mdextra",icons:["cursor-text","hexagon-multiple","hexagon-outline","hexagon","subscript","superscript","unlink","vector-polyline-plus"]},{name:"mdi-social",icons:["blogger","disqus","dribble","facebook-box","facebook","github-box","github-circle","google-plus-box","google-plus",null,"instagram","instapaper","linkedin","pinterest","pocket","readability","rss-box","tumblr","twitch","twitter-box","twitter","whatsapp","youtube"]},{name:"paper-audio-icons",icons:["error-outline","pause","play-arrow","replay"]}];e.registerManifest(HaxIconsetManifest); \ No newline at end of file diff --git a/cdn/build/es6/node_modules/@haxtheweb/mark-the-words/lib/mark-the-words.haxProperties.json b/cdn/build/es6/node_modules/@haxtheweb/mark-the-words/lib/mark-the-words.haxProperties.json index 9b50357dd..0b7ad8d2d 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/mark-the-words/lib/mark-the-words.haxProperties.json +++ b/cdn/build/es6/node_modules/@haxtheweb/mark-the-words/lib/mark-the-words.haxProperties.json @@ -88,7 +88,7 @@ ] }, "saveOptions": { - "unsetAttributes": ["word-list", "number-correct", "number-guessed", "attempts", "answers", "displayed-answers", "t", "show-answer"] + "unsetAttributes": ["edit", "word-list", "number-correct", "number-guessed", "attempts", "answers", "displayed-answers", "t", "show-answer"] }, "documentation": { "howTo": null, diff --git a/cdn/build/es6/node_modules/@haxtheweb/mark-the-words/mark-the-words.js b/cdn/build/es6/node_modules/@haxtheweb/mark-the-words/mark-the-words.js index 13ad142ac..2d89fd8da 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/mark-the-words/mark-the-words.js +++ b/cdn/build/es6/node_modules/@haxtheweb/mark-the-words/mark-the-words.js @@ -46,6 +46,13 @@ import{html as e,css as t,nothing as s}from"../../lit/index.js";import"../simple line-height: 2.2; } + @media (max-width: 600px) { + .text { + margin: var(--ddd-spacing-1); + padding: var(--ddd-spacing-1); + } + } + .tag-option { font-size: var(--ddd-font-size-s); height: auto; diff --git a/cdn/build/es6/node_modules/@haxtheweb/matching-question/lib/matching-question.haxProperties.json b/cdn/build/es6/node_modules/@haxtheweb/matching-question/lib/matching-question.haxProperties.json index 02bf31260..bcd152f6a 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/matching-question/lib/matching-question.haxProperties.json +++ b/cdn/build/es6/node_modules/@haxtheweb/matching-question/lib/matching-question.haxProperties.json @@ -71,7 +71,8 @@ "answers", "displayed-answers", "t", - "show-answer" + "show-answer", + "edit" ] }, "documentation": { diff --git a/cdn/build/es6/node_modules/@haxtheweb/multiple-choice/lib/QuestionElement.js b/cdn/build/es6/node_modules/@haxtheweb/multiple-choice/lib/QuestionElement.js index e20def410..b4deaadc9 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/multiple-choice/lib/QuestionElement.js +++ b/cdn/build/es6/node_modules/@haxtheweb/multiple-choice/lib/QuestionElement.js @@ -2,7 +2,7 @@ import{LitElement as e,html as t,css as s,nothing as i}from"../../../lit/index.j :host { display: block; min-width: 160px; - padding: var(--ddd-spacing-8); + padding: var(--ddd-spacing-4); border: var(--ddd-border-md); border-radius: var(--ddd-radius-sm); box-shadow: var(--ddd-boxShadow-sm); @@ -34,6 +34,10 @@ import{LitElement as e,html as t,css as s,nothing as i}from"../../../lit/index.j ); --simple-fields-border-bottom-size: 0px; --simple-fields-border-bottom-focus-size: 0px; + + --simple-fields-margin-small: 42px; + --grid-plate-item-margin: 0 8px; + --grid-plate-item-padding: 0 8px; } :host(:focus), @@ -86,6 +90,9 @@ import{LitElement as e,html as t,css as s,nothing as i}from"../../../lit/index.j details[open] .container h4 { margin-top: 0; } + #legend { + margin: 0 -26px; + } ul { list-style: none; padding: 0; @@ -93,7 +100,7 @@ import{LitElement as e,html as t,css as s,nothing as i}from"../../../lit/index.j } h3 { padding: 0; - margin: 0 0 var(--ddd-spacing-8) 0; + margin: 0 0 var(--ddd-spacing-4) 0; font-family: var(--ddd-font-navigation); } ul li { @@ -273,16 +280,52 @@ import{LitElement as e,html as t,css as s,nothing as i}from"../../../lit/index.j font-size: 12px; content: "Add content"; } + @media (max-width: 600px) { + :host { + padding: 4px; + margin: 0; + --grid-plate-item-margin: 0; + --grid-plate-item-padding: 0; + font-size: var(--ddd-font-size-4xs); + } + h3 { + margin: 4px; + } + :host .column ::slotted(*) { + padding: 0; + margin: 0; + + } + } `]}playSound(e){globalThis.dispatchEvent(new CustomEvent("playaudio",{detail:{sound:e}}))}async haxpreProcessNodeToContent(e){if(e.answers){let s=Array.from(this.querySelectorAll("input:not([slot])"));for(var t in s)s[t].remove();for(var t in e.answers)if(e.answers[t]){let s=document.createElement("input");s.setAttribute("type","checkbox"),s.value=e.answers[t].label,e.answers[t].correct&&s.setAttribute("correct","correct"),e.answers[t].image&&s.setAttribute("data-image",e.answers[t].image),e.answers[t].alt&&s.setAttribute("data-image-alt",e.answers[t].alt),e.answers[t].selectedFeedback&&s.setAttribute("data-selected",e.answers[t].selectedFeedback),e.answers[t].unselectedFeedback&&s.setAttribute("data-unselected",e.answers[t].unselectedFeedback),e.appendChild(s)}}return e}haxpreProcessInsertContent(e,t){return e.properties.answers&&e.properties.answers.length>0&&e.properties.answers.map&&(e.properties.answers=e.properties.answers.map((function(e){return e.userGuess&&delete e.userGuess,e}))),e}firstUpdated(e){super.firstUpdated&&super.firstUpdated(e),this.setAttribute("typeof","oer:Assessment"),this.loadLightDomData()}render(){return t`
          -

          ${this.question}

          - ${this.renderInteraction()} - ${this.hideButtons?i:this.renderButtons()} +
          + Question +
          +

          ${this.question}

          + ${this.renderInteraction()} + ${this.hideButtons?i:this.renderButtons()} +
          +
          +
          + Feedback +
          +
          + Legend +
          ${this.renderLegend()}
          +
          + ${this.renderFeedback()} +
          +
          ${this.querySelector('[slot="content"]')&&!this.edit?t` `:i}
          Directions -
          ${this.renderDirections()}
          -
          -
          - Legend -
          ${this.renderLegend()}
          -
          -
          - Feedback -
          ${this.renderFeedback()}
          +
          + ${this.renderDirections()}
          @@ -343,7 +375,7 @@ import{LitElement as e,html as t,css as s,nothing as i}from"../../../lit/index.j
        `}renderDirections(){return t`

        - Select the answer you feel satsisfy the question. When you are done, + Select the answer you feel answers the question. When you are done, press ${this.t.checkAnswer}. You will get feedback indicating correctness of your answer and how to proceed.

        `}renderLegend(){return t` diff --git a/cdn/build/es6/node_modules/@haxtheweb/multiple-choice/lib/multiple-choice.haxProperties.json b/cdn/build/es6/node_modules/@haxtheweb/multiple-choice/lib/multiple-choice.haxProperties.json index dfeda29cf..391c6168a 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/multiple-choice/lib/multiple-choice.haxProperties.json +++ b/cdn/build/es6/node_modules/@haxtheweb/multiple-choice/lib/multiple-choice.haxProperties.json @@ -88,7 +88,8 @@ "saveOptions": { "unsetAttributes": ["__utils", "displayed-answers", "colors", "answers", "show-answer", "t", - "attempts"] + "attempts", + "edit"] }, "demoSchema": [ { diff --git a/cdn/build/es6/node_modules/@haxtheweb/multiple-choice/lib/short-answer-question.haxProperties.json b/cdn/build/es6/node_modules/@haxtheweb/multiple-choice/lib/short-answer-question.haxProperties.json index ddee78784..bf3f5470b 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/multiple-choice/lib/short-answer-question.haxProperties.json +++ b/cdn/build/es6/node_modules/@haxtheweb/multiple-choice/lib/short-answer-question.haxProperties.json @@ -65,7 +65,8 @@ "shortanswer", "show-answer", "t", - "attempts" + "attempts", + "edit" ] }, "demoSchema": [ diff --git a/cdn/build/es6/node_modules/@haxtheweb/multiple-choice/lib/short-answer-question.js b/cdn/build/es6/node_modules/@haxtheweb/multiple-choice/lib/short-answer-question.js index 5566d0a07..5df615e75 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/multiple-choice/lib/short-answer-question.js +++ b/cdn/build/es6/node_modules/@haxtheweb/multiple-choice/lib/short-answer-question.js @@ -1,5 +1,5 @@ import{QuestionElement as e}from"./QuestionElement.js";import{html as s}from"../../../lit/index.js";class ShortAnswerQuestion extends e{static get tag(){return"short-answer-question"}constructor(){super(),this.guessDataValue="shortanswer",this.shortanswer=null,this.singleOption=!0}static get haxProperties(){return new URL(`./${this.tag}.haxProperties.json`,import.meta.url).href}static get properties(){return{...super.properties,shortanswer:{type:String}}}inactiveCase(){return this.shortanswer}renderDirections(){return s`

        - Type the answer you feel satsisfies the question. When you are done, + Type the answer you feel answers the question. When you are done, select ${this.t.checkAnswer}. You will get feedback indicating correctness of your answer.

        `}renderInteraction(){return s` diff --git a/cdn/build/es6/node_modules/@haxtheweb/multiple-choice/lib/true-false-question.haxProperties.json b/cdn/build/es6/node_modules/@haxtheweb/multiple-choice/lib/true-false-question.haxProperties.json index 005027acc..25f671302 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/multiple-choice/lib/true-false-question.haxProperties.json +++ b/cdn/build/es6/node_modules/@haxtheweb/multiple-choice/lib/true-false-question.haxProperties.json @@ -63,7 +63,8 @@ "_tfanswer", "show-answer", "t", - "attempts" + "attempts", + "edit" ] }, "demoSchema": [ diff --git a/cdn/build/es6/node_modules/@haxtheweb/page-break/lib/page-anchor.js b/cdn/build/es6/node_modules/@haxtheweb/page-break/lib/page-anchor.js index 0de6e9e6a..376e4f38b 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/page-break/lib/page-anchor.js +++ b/cdn/build/es6/node_modules/@haxtheweb/page-break/lib/page-anchor.js @@ -8,7 +8,7 @@ import{html as t,css as e}from"../../../lit/index.js";import{DDD as i}from"../.. --simple-icon-height: var(--ddd-icon-xxs); --simple-icon-width: var(--ddd-icon-xxs); } - `]}clickHandler(t){if(this._haxState&&"click"===t.type)return t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),!1;let e;e=this._haxState?globalThis.document.querySelector(".haxcms-theme-element "+this.target):a.activeHaxBody.querySelector(this.target),e?(e.scrollIntoView(),setTimeout((()=>{switch(e.tagName.toLowerCase()){case"video-player":case"audio-player":this.value?e.seek(parseInt(this.value)):e.play();break;case"play-list":e.slide=parseInt(this.value)}}),100)):this.target=null}getMatchFromFields(t,e,i="accentColor"){const s=o(r.entityData);if(s[t]&&s[t][i])return"accentColor"==i?`--simple-colors-default-theme-${s[t][i]}-3`:s[t][i];let l;if(l=this._haxState?globalThis.document.querySelector(".haxcms-theme-element "+e):a.activeHaxBody.querySelector(e),l&&e&&"accentColor"==i){let t=a.haxSchemaFromTag(l.tagName);if(t&&t.gizmo&&t.gizmo.color)return`--simple-colors-default-theme-${t.gizmo.color}-3`}return null}render(){let e,i;try{e=this.getMatchFromFields(this.entityId,this.target,"accentColor"),i=this.getMatchFromFields(this.entityId,this.target,"icon")}catch(t){}return t`{switch(e.tagName.toLowerCase()){case"video-player":case"audio-player":this.value?e.seek(parseInt(this.value)):e.play();break;case"play-list":e.slide=parseInt(this.value)}}),100)):this.target=null}getMatchFromFields(t,e,i="accentColor"){const s=o(r.entityData);if(s[t]&&s[t][i])return"accentColor"==i?`--simple-colors-default-theme-${s[t][i]}-3`:s[t][i];let l;if(l=this._haxState?a.activeHaxBody.querySelector(e):globalThis.document.querySelector(".haxcms-theme-element "+e),l&&e&&"accentColor"==i){let t=a.haxSchemaFromTag(l.tagName);if(t&&t.gizmo&&t.gizmo.color)return`--simple-colors-default-theme-${t.gizmo.color}-3`}return null}render(){let e,i;try{e=this.getMatchFromFields(this.entityId,this.target,"accentColor"),i=this.getMatchFromFields(this.entityId,this.target,"icon")}catch(t){}return t` diff --git a/cdn/build/es6/node_modules/@haxtheweb/place-holder/place-holder.js b/cdn/build/es6/node_modules/@haxtheweb/place-holder/place-holder.js index 4c3b16da4..81f9f6e53 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/place-holder/place-holder.js +++ b/cdn/build/es6/node_modules/@haxtheweb/place-holder/place-holder.js @@ -1,4 +1,4 @@ -import{SimpleColors as e}from"../simple-colors/simple-colors.js";import{html as t,css as i}from"../../lit/index.js";import"../simple-icon/simple-icon.js";import"../simple-icon/lib/simple-icons.js";class PlaceHolder extends e{static get styles(){return[super.styles,i` +import{SimpleColors as e}from"../simple-colors/simple-colors.js";import{html as t,css as r}from"../../lit/index.js";import"../simple-icon/simple-icon.js";import"../simple-icon/lib/simple-icons.js";class PlaceHolder extends e{static get styles(){return[super.styles,r` :host { display: block; border: none; @@ -41,4 +41,4 @@ import{SimpleColors as e}from"../simple-colors/simple-colors.js";import{html as
        ${this.calcText}
        ${this.directions}
        - `}static get tag(){return"place-holder"}static get properties(){return{...super.properties,iconFromType:{type:String},text:{type:String},directions:{type:String},calcText:{type:String},type:{type:String},dragOver:{type:Boolean,reflect:!0,attribute:"drag-over"}}}updated(e){super.updated&&super.updated(e),e.forEach(((e,t)=>{["type"].includes(t)&&(this.accentColor=this._getColorFromType(this.type)),["type","dragOver"].includes(t)&&(this.iconFromType=this._getIconFromType(this.type,this.dragOver)),["text","type","dragOver"].includes(t)&&(this.calcText=this._getCalcText(this.text,this.type,this.dragOver))}))}fireReplaceEvent(e){this.dispatchEvent(new CustomEvent("place-holder-replace",{bubbles:!0,cancelable:!0,composed:!0,detail:this.type}))}_getCalcText(e,t,i){return i?"Drop file to upload":""===e?"Placeholder for "+t:e}_getColorFromType(e){switch(e){case"document":return"green";case"audio":return"purple";case"video":return"red";case"image":return"orange";case"math":return"light-blue"}return"indigo"}_getIconFromType(e,t){if(t)return"icons:file-upload";switch(e){case"document":return"editor:insert-drive-file";case"audio":return"av:music-video";case"video":return"notification:ondemand-video";case"image":return"image:crop-original";case"math":return"editor:functions";default:return"editor:format-align-left"}}constructor(){super(),this.text="",this.iconFromType="editor:format-align-left",this.type="text",this.dragOver=!1,this.directions="Double click or drag and drop file to replace",this.addEventListener("dragover",(function(e){this.dragOver=!0,e.preventDefault(),e.stopPropagation(),this.classList.add("dragover")})),this.addEventListener("dragleave",(function(e){this.dragOver=!1,e.preventDefault(),e.stopPropagation(),this.classList.remove("dragover")})),this.addEventListener("drop",(function(e){this.dragOver=!1,e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.classList.remove("dragover");try{"file"===e.dataTransfer.items[0].kind&&(e.placeHolderElement=this,this.dispatchEvent(new CustomEvent("place-holder-file-drop",{bubbles:!0,cancelable:!0,composed:!0,detail:e})))}catch(e){}})),this.addEventListener("dblclick",this.fireReplaceEvent.bind(this))}static get haxProperties(){return{canScale:!0,canEditSource:!1,gizmo:{title:"Placeholder",description:"A place holder that can be converted into the media type that's been selected",icon:"hax:placeholder-image",color:"grey",tags:["Authoring","development","authoring","media","image","video","audio","document","math","text"],handles:[],meta:{author:"HAXTheWeb core team"}},settings:{configure:[{property:"type",title:"Type",description:"Type of gizmo that this accepts for replacement.",inputMethod:"select",options:{text:"Text / content",document:"Document / file",audio:"Audio",video:"Video",image:"Image",math:"Math"}},{property:"text",title:"Text",description:"Identify the place holder desired in greater detail",inputMethod:"textfield"}],advanced:[]},saveOptions:{unsetAttributes:["icon-from-type","calc-text","colors"],wipeSlot:!0},demoSchema:[{tag:"place-holder",properties:{type:"image"},content:""}]}}}customElements.define(PlaceHolder.tag,PlaceHolder);export{PlaceHolder}; \ No newline at end of file + `}static get tag(){return"place-holder"}static get properties(){return{...super.properties,iconFromType:{type:String},text:{type:String},directions:{type:String},calcText:{type:String},type:{type:String},dragOver:{type:Boolean,reflect:!0,attribute:"drag-over"}}}updated(e){super.updated&&super.updated(e),e.forEach(((e,t)=>{["type"].includes(t)&&(this.accentColor=this._getColorFromType(this.type)),["type","dragOver"].includes(t)&&(this.iconFromType=this._getIconFromType(this.type,this.dragOver)),["text","type","dragOver"].includes(t)&&(this.calcText=this._getCalcText(this.text,this.type,this.dragOver))}))}fireReplaceEvent(e){this.dispatchEvent(new CustomEvent("place-holder-replace",{bubbles:!0,cancelable:!0,composed:!0,detail:this.type}))}_getCalcText(e,t,r){return r?"Drop file to upload":""===e?"Placeholder for "+t:e}_getColorFromType(e){switch(e){case"document":return"green";case"audio":return"purple";case"video":return"red";case"image":return"orange";case"math":return"light-blue"}return"indigo"}_getIconFromType(e,t){if(t)return"icons:file-upload";switch(e){case"document":return"editor:insert-drive-file";case"audio":return"av:music-video";case"video":return"notification:ondemand-video";case"image":return"image:crop-original";case"math":return"editor:functions";default:return"editor:format-align-left"}}constructor(){super(),this.text="",this.iconFromType="editor:format-align-left",this.type="text",this.dragOver=!1,this.directions="Drag and drop file to replace",this.addEventListener("dragover",(function(e){this.dragOver=!0,e.preventDefault(),e.stopPropagation(),this.classList.add("dragover")})),this.addEventListener("dragleave",(function(e){this.dragOver=!1,e.preventDefault(),e.stopPropagation(),this.classList.remove("dragover")})),this.addEventListener("drop",(function(e){this.dragOver=!1,e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.classList.remove("dragover");try{"file"===e.dataTransfer.items[0].kind&&(e.placeHolderElement=this,this.dispatchEvent(new CustomEvent("place-holder-file-drop",{bubbles:!0,cancelable:!0,composed:!0,detail:e})))}catch(e){}}))}static get haxProperties(){return{canScale:!1,canEditSource:!1,gizmo:{title:"Placeholder",description:"A place holder that can be converted into the media type that's been selected",icon:"hax:placeholder-image",color:"grey",tags:["Authoring","development","authoring","media","image","video","audio","document","math","text"],handles:[],meta:{author:"HAXTheWeb core team"}},settings:{configure:[{property:"type",title:"Type",description:"Type of gizmo that this accepts for replacement.",inputMethod:"select",options:{text:"Text / content",document:"Document / file",audio:"Audio",video:"Video",image:"Image",math:"Math"}},{property:"text",title:"Text",description:"Identify the place holder desired in greater detail",inputMethod:"textfield"}],advanced:[]},saveOptions:{unsetAttributes:["icon-from-type","calc-text","colors"],wipeSlot:!0},demoSchema:[{tag:"place-holder",properties:{type:"image"},content:""}]}}}customElements.define(PlaceHolder.tag,PlaceHolder);export{PlaceHolder}; \ No newline at end of file diff --git a/cdn/build/es6/node_modules/@haxtheweb/retro-card/retro-card.js b/cdn/build/es6/node_modules/@haxtheweb/retro-card/retro-card.js index fc224b61f..4f08c7720 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/retro-card/retro-card.js +++ b/cdn/build/es6/node_modules/@haxtheweb/retro-card/retro-card.js @@ -167,4 +167,4 @@ import{html as e,css as t}from"../../lit/index.js";import{SimpleColors as r}from >`))} `:""} - `}`}static get haxProperties(){return{canScale:!1,canEditSource:!0,gizmo:{title:"Retro card",description:"Simple card in a cool retro design",icon:"icons:android",color:"purple",tags:["Layout","card","layout"],handles:[],meta:{author:"HAXTheWeb core team",owner:"The Pennsylvania State University"}},settings:{configure:[{property:"title",title:"Title",description:"Main title of card",inputMethod:"textfield",required:!1,icon:"icons:android"},{property:"url",description:"Link to go to when clicking the card",inputMethod:"textfield",required:!1,icon:"icons:android",validationType:"url"},{property:"subtitle",title:"Sub-title",description:"Sub heading",inputMethod:"textfield",required:!1,icon:"icons:android"},{property:"tags",title:"Tags",description:"Comma separated tags",inputMethod:"textfield",required:!1,icon:"icons:android"},{property:"mediaSource",title:"Media source",description:"Primary media source",inputMethod:"haxupload",noVoiceRecord:!0,required:!0,icon:"icons:link",validationType:"url"},{property:"hoverSource",description:"When user hovers / activates the card",title:"Source on hover",inputMethod:"haxupload",noVoiceRecord:!0,required:!1,validationType:"url",icon:"icons:android"},{property:"accentColor",description:"An accent to apply evenly to the card",title:"Accent Color",inputMethod:"colorpicker",required:!1,icon:"icons:android"},{property:"dark",title:"Dark",description:"Sets base color to be dark mode",inputMethod:"boolean",required:!1}],advanced:[]},saveOptions:{unsetAttributes:["colors"]},demoSchema:[{tag:"video-player",properties:{title:"HAX Camp",subtitle:"btopro dreaming reality",tags:"dreams, hax, camp",accentColor:"pink",url:"https://btopro.com","media-source":"https://btopro.com/files/IMG_20190716_102855.jpg"},content:""}]}}static get properties(){return{...super.properties,title:{type:String},subtitle:{type:String},tags:{type:String},mediaSource:{type:String,attribute:"media-source"},url:{type:String},hoverSource:{type:String,attribute:"hover-source"},hoverState:{type:Boolean,attribute:"hover-state",reflect:!0},__cardTags:{type:Array},nosource:{type:Boolean},__source:{type:String}}}static get tag(){return"retro-card"}constructor(){super(),this.__cardTags=[],this.hoverState=!1,this.nosource=!1}_keyPress(e){if("Enter"===e.key)this.shadowRoot.querySelector("a").click()}_hoverStateOff(e){this.hoverState=!1}_hoverStateOn(e){this.hoverState=!0}firstUpdated(e){super.firstUpdated&&super.firstUpdated(e),this.addEventListener("mouseover",this._hoverStateOn.bind(this)),this.addEventListener("mouseout",this._hoverStateOff.bind(this)),this.nosource||(this.setAttribute("tabindex",0),this.addEventListener("keypress",this._keyPress.bind(this)),this.addEventListener("focusin",this._hoverStateOn.bind(this)),this.addEventListener("focusout",this._hoverStateOff.bind(this))),this.hoverSource||(this.hoverSource=this.mediaSource)}haxHooks(){return{editModeChanged:"haxeditModeChanged",activeElementChanged:"haxactiveElementChanged"}}haxactiveElementChanged(e,t){t&&(this._haxstate=t)}haxeditModeChanged(e){this._haxstate=e}_clickCard(e){this._haxstate&&!this.nosource&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())}updated(e){super.updated&&super.updated(e),e.forEach(((e,t)=>{"tags"==t&&this._tagsChanged(this[t]),"source"==t&&(this.__source=this.mediaSource),"hoverState"==t&&(this.__source=this[t]?this.hoverSource:this.mediaSource)}))}_tagsChanged(e){let t=e.split(",");this.__cardTags=[...t]}}customElements.define(RetroCard.tag,RetroCard);export{RetroCard}; \ No newline at end of file + `}`}static get haxProperties(){return{canScale:!1,canEditSource:!0,gizmo:{title:"Retro card",description:"Simple card in a cool retro design",icon:"icons:credit-card",color:"purple",tags:["Layout","card","layout"],handles:[],meta:{author:"HAXTheWeb core team",owner:"The Pennsylvania State University"}},settings:{configure:[{property:"title",title:"Title",description:"Main title of card",inputMethod:"textfield",required:!1},{property:"url",description:"Link to go to when clicking the card",inputMethod:"textfield",required:!1,validationType:"url"},{property:"subtitle",title:"Sub-title",description:"Sub heading",inputMethod:"textfield",required:!1},{property:"tags",title:"Tags",description:"Comma separated tags",inputMethod:"textfield",required:!1},{property:"mediaSource",title:"Media source",description:"Primary media source",inputMethod:"haxupload",noVoiceRecord:!0,required:!0,validationType:"url"},{property:"hoverSource",description:"When user hovers / activates the card",title:"Source on hover",inputMethod:"haxupload",noVoiceRecord:!0,required:!1,validationType:"url"},{property:"accentColor",description:"An accent to apply evenly to the card",title:"Accent Color",inputMethod:"colorpicker",required:!1},{property:"dark",title:"Dark",description:"Sets base color to be dark mode",inputMethod:"boolean",required:!1}],advanced:[]},saveOptions:{unsetAttributes:["colors"]},demoSchema:[{tag:"video-player",properties:{title:"HAX Camp",subtitle:"btopro dreaming reality",tags:"dreams, hax, camp",accentColor:"pink",url:"https://btopro.com","media-source":"https://btopro.com/files/IMG_20190716_102855.jpg"},content:""}]}}static get properties(){return{...super.properties,title:{type:String},subtitle:{type:String},tags:{type:String},mediaSource:{type:String,attribute:"media-source"},url:{type:String},hoverSource:{type:String,attribute:"hover-source"},hoverState:{type:Boolean,attribute:"hover-state",reflect:!0},__cardTags:{type:Array},nosource:{type:Boolean},__source:{type:String}}}static get tag(){return"retro-card"}constructor(){super(),this.__cardTags=[],this.hoverState=!1,this.nosource=!1}_keyPress(e){if("Enter"===e.key)this.shadowRoot.querySelector("a").click()}_hoverStateOff(e){this.hoverState=!1}_hoverStateOn(e){this.hoverState=!0}firstUpdated(e){super.firstUpdated&&super.firstUpdated(e),this.addEventListener("mouseover",this._hoverStateOn.bind(this)),this.addEventListener("mouseout",this._hoverStateOff.bind(this)),this.nosource||(this.setAttribute("tabindex",0),this.addEventListener("keypress",this._keyPress.bind(this)),this.addEventListener("focusin",this._hoverStateOn.bind(this)),this.addEventListener("focusout",this._hoverStateOff.bind(this))),this.hoverSource||(this.hoverSource=this.mediaSource)}haxHooks(){return{editModeChanged:"haxeditModeChanged",activeElementChanged:"haxactiveElementChanged"}}haxactiveElementChanged(e,t){t&&(this._haxstate=t)}haxeditModeChanged(e){this._haxstate=e}_clickCard(e){this._haxstate&&!this.nosource&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())}updated(e){super.updated&&super.updated(e),e.forEach(((e,t)=>{"tags"==t&&this._tagsChanged(this[t]),"source"==t&&(this.__source=this.mediaSource),"hoverState"==t&&(this.__source=this[t]?this.hoverSource:this.mediaSource)}))}_tagsChanged(e){let t=e.split(",");this.__cardTags=[...t]}}customElements.define(RetroCard.tag,RetroCard);export{RetroCard}; \ No newline at end of file diff --git a/cdn/build/es6/node_modules/@haxtheweb/stop-note/lib/stop-note.haxProperties.json b/cdn/build/es6/node_modules/@haxtheweb/stop-note/lib/stop-note.haxProperties.json index 41f088720..54a1055dc 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/stop-note/lib/stop-note.haxProperties.json +++ b/cdn/build/es6/node_modules/@haxtheweb/stop-note/lib/stop-note.haxProperties.json @@ -21,7 +21,7 @@ "handles": [ { "type": "text", - "title": "label" + "title": "title" } ], "meta": { diff --git a/cdn/build/es6/node_modules/@haxtheweb/tagging-question/lib/tagging-question.haxProperties.json b/cdn/build/es6/node_modules/@haxtheweb/tagging-question/lib/tagging-question.haxProperties.json index 95e94049c..0924a5086 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/tagging-question/lib/tagging-question.haxProperties.json +++ b/cdn/build/es6/node_modules/@haxtheweb/tagging-question/lib/tagging-question.haxProperties.json @@ -72,7 +72,8 @@ "answers", "displayed-answers", "t", - "show-answer" + "show-answer", + "edit" ] }, "documentation": { diff --git a/cdn/build/es6/node_modules/@haxtheweb/type-writer/type-writer.js b/cdn/build/es6/node_modules/@haxtheweb/type-writer/type-writer.js index 0245a8958..5f0961da4 100644 --- a/cdn/build/es6/node_modules/@haxtheweb/type-writer/type-writer.js +++ b/cdn/build/es6/node_modules/@haxtheweb/type-writer/type-writer.js @@ -2,7 +2,7 @@ * Copyright 2020 The Pennsylvania State University * @license Apache-2.0, see License.md for full text. */ -import{LitElement as t,html as e,css as i}from"../../lit/index.js";import{IntersectionObserverMixin as r}from"../intersection-element/lib/IntersectionObserverMixin.js";class TypeWriter extends(r(t)){static get styles(){return[i` +import{LitElement as e,html as t,css as i}from"../../lit/index.js";import{IntersectionObserverMixin as r}from"../intersection-element/lib/IntersectionObserverMixin.js";class TypeWriter extends(r(e)){static get styles(){return[i` :host { display: inline-block; margin: 0px 0.1em; @@ -73,4 +73,4 @@ import{LitElement as t,html as e,css as i}from"../../lit/index.js";import{Inters -o-animation: flickerAnimation 1s infinite; animation: flickerAnimation 1s infinite; } - `]}render(){return e` |`}static get haxProperties(){return{canScale:!0,canEditSource:!0,gizmo:{title:"Type writer",description:"typewritter effect",icon:"icons:android",color:"green",tags:["Other","interactive","fancy","Writer","type"],handles:[],meta:{author:"HAXTheWeb",owner:"The Pennsylvania State University"}},settings:{configure:[{property:"delay",description:"",inputMethod:"textfield",required:!1,icon:"icons:android"},{property:"cursorDuration",description:"",inputMethod:"textfield",required:!1,icon:"icons:android"},{property:"text",description:"",inputMethod:"textfield",required:!1,icon:"icons:android"},{property:"speed",description:"",inputMethod:"textfield",required:!1,icon:"icons:android"},{property:"typing",description:"",inputMethod:"boolean",required:!1,icon:"icons:android"}],advanced:[]},saveOptions:{unsetAttributes:["element-visible"]}}}static get properties(){return{...super.properties,delay:{type:Number},cursorDuration:{type:Number,attribute:"cursor-duration"},text:{type:String},speed:{type:Number},elementVisible:{type:Boolean},eraseSpeed:{type:Number,attribute:"erase-speed"},typing:{type:Boolean,reflect:!0},_length:{type:Number},_oldText:{type:String}}}static get tag(){return"type-writer"}constructor(){super(),this.delay=100,this.cursorDuration=0,this.speed=150,this.eraseSpeed=80,this.typing=!1}_observeText(t,e,i){if(t&&void 0!==e&&i){if(this.shadowRoot.querySelector("#text").textContent)return this._oldText=this.shadowRoot.querySelector("#text").textContent,this.typing&&this._cancel&&(clearTimeout(this._cancel),this._cancel=null),this.erase();this._length=0,setTimeout((()=>{this.type()}),this.delay)}}type(){this.typing=!0,this.shadowRoot.querySelector("#text").textContent=this.text.substr(0,this._length++),this._length{this.type()}),this.speed+(Math.random()-.5)*this.speed/2):setTimeout((()=>{this.typing=!1,this.dispatchEvent(new CustomEvent("type-writer-end",{detail:this.text,bubbles:!0,composed:!0}))}),this.cursorDuration)}erase(){this.typing=!0,this.shadowRoot.querySelector("#text").textContent=this._oldText.substr(0,this._length--),this._length>=0?this._cancel=setTimeout((()=>{this.erase()}),this.eraseSpeed||this.speed):this.type()}updated(t){t.forEach(((t,e)=>{["text","delay","elementVisible"].includes(e)&&this._observeText(this.text,this.delay,this.elementVisible)}))}}customElements.define(TypeWriter.tag,TypeWriter);export{TypeWriter}; \ No newline at end of file + `]}render(){return t` |`}static get haxProperties(){return{canScale:!0,canEditSource:!0,gizmo:{title:"Type writer",description:"typewritter effect",icon:"hardware:keyboard",color:"green",tags:["Other","interactive","fancy","Writer","type"],handles:[],meta:{author:"HAXTheWeb",owner:"The Pennsylvania State University"}},settings:{configure:[{property:"delay",description:"",inputMethod:"textfield",required:!1},{property:"cursorDuration",description:"",inputMethod:"textfield",required:!1},{property:"text",description:"",inputMethod:"textfield",required:!1},{property:"speed",description:"",inputMethod:"textfield",required:!1},{property:"typing",description:"",inputMethod:"boolean",required:!1}],advanced:[]},saveOptions:{unsetAttributes:["element-visible"]}}}static get properties(){return{...super.properties,delay:{type:Number},cursorDuration:{type:Number,attribute:"cursor-duration"},text:{type:String},speed:{type:Number},elementVisible:{type:Boolean},eraseSpeed:{type:Number,attribute:"erase-speed"},typing:{type:Boolean,reflect:!0},_length:{type:Number},_oldText:{type:String}}}static get tag(){return"type-writer"}constructor(){super(),this.delay=100,this.cursorDuration=0,this.speed=150,this.eraseSpeed=80,this.typing=!1}_observeText(e,t,i){if(e&&void 0!==t&&i){if(this.shadowRoot.querySelector("#text").textContent)return this._oldText=this.shadowRoot.querySelector("#text").textContent,this.typing&&this._cancel&&(clearTimeout(this._cancel),this._cancel=null),this.erase();this._length=0,setTimeout((()=>{this.type()}),this.delay)}}type(){this.typing=!0,this.shadowRoot.querySelector("#text").textContent=this.text.substr(0,this._length++),this._length{this.type()}),this.speed+(Math.random()-.5)*this.speed/2):setTimeout((()=>{this.typing=!1,this.dispatchEvent(new CustomEvent("type-writer-end",{detail:this.text,bubbles:!0,composed:!0}))}),this.cursorDuration)}erase(){this.typing=!0,this.shadowRoot.querySelector("#text").textContent=this._oldText.substr(0,this._length--),this._length>=0?this._cancel=setTimeout((()=>{this.erase()}),this.eraseSpeed||this.speed):this.type()}updated(e){e.forEach(((e,t)=>{["text","delay","elementVisible"].includes(t)&&this._observeText(this.text,this.delay,this.elementVisible)}))}}customElements.define(TypeWriter.tag,TypeWriter);export{TypeWriter}; \ No newline at end of file diff --git a/haxcms/build/es6/node_modules/@haxtheweb/course-design/lib/learning-component.js b/haxcms/build/es6/node_modules/@haxtheweb/course-design/lib/learning-component.js index aee560080..30c36953a 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/course-design/lib/learning-component.js +++ b/haxcms/build/es6/node_modules/@haxtheweb/course-design/lib/learning-component.js @@ -159,4 +159,4 @@ import{html as e,css as t}from"../../../lit/index.js";import"../../simple-toolti > `:""} - `}static get haxProperties(){return{type:"grid",canScale:!1,hideDefaultSettings:!0,gizmo:{title:"Learning Component",description:"A card for instructors to communicate pedagogy and instructional strategies.",icon:"icons:bookmark",color:"orange",tags:["Instructional","content","design","presentation","instruction","course","learning","card"],handles:[],meta:{author:"HAXTheWeb core team"}},settings:{configure:[{property:"type",title:"Type",description:"The type of card to be used.",inputMethod:"select",options:{"":"",...learningComponentTypes},required:!1},{property:"subtitle",title:"Sub-Title",description:"The sub-title of the card.",inputMethod:"textfield"},{property:"url",title:"Link",description:"An optional link for the card (Link not available for Learning Objectives).",inputMethod:"url"},{slot:"",title:"Contents"}],advanced:[{property:"title",title:"Title",description:"Set Title, this overrides type based title",inputMethod:"textfield"},{property:"icon",title:"Icon",description:"Set icon, this overrides type based icon",inputMethod:"iconpicker"},{property:"accentColor",title:"Accent color",description:"Set accent color, this overrides type based color",inputMethod:"colorpicker"},{property:"dark",title:"Dark mode",description:"Invert high and low tones",inputMethod:"boolean"}]},saveOptions:{unsetAttributes:["t"]},demoSchema:[{tag:"learning-component",properties:{type:"objectives",subtitle:"Unit 1"},content:"

        By the end of this lesson, you should be able to...

        "}]}}}customElements.define(LearningComponent.tag,LearningComponent);export{LearningComponent}; \ No newline at end of file + `}static get haxProperties(){return{type:"grid",canScale:!1,hideDefaultSettings:!0,gizmo:{title:"Learning Component",description:"A card for instructors to communicate pedagogy and instructional strategies.",icon:"icons:bookmark",color:"orange",tags:["Instructional","content","design","presentation","instruction","course","learning","card"],handles:[],meta:{author:"HAXTheWeb core team"}},settings:{configure:[{property:"type",title:"Type",description:"The type of card to be used.",inputMethod:"select",options:{"":"",...learningComponentTypes},required:!1},{property:"subtitle",title:"Sub-Title",description:"The sub-title of the card.",inputMethod:"textfield"},{property:"url",title:"Link",description:"An optional link for the card (Link not available for Learning Objectives).",inputMethod:"url"},{property:"title",title:"Title",description:"Set Title, this overrides type based title",inputMethod:"textfield"},{property:"icon",title:"Icon",description:"Set icon, this overrides type based icon",inputMethod:"iconpicker"},{property:"accentColor",title:"Accent color",description:"Set accent color, this overrides type based color",inputMethod:"colorpicker"},{slot:"",title:"Contents"}],advanced:[]},saveOptions:{unsetAttributes:["t"]},demoSchema:[{tag:"learning-component",properties:{subtitle:"Unit 1"},content:"

        By the end of this lesson, you should be able to...

        "}]}}}customElements.define(LearningComponent.tag,LearningComponent);export{LearningComponent}; \ No newline at end of file diff --git a/haxcms/build/es6/node_modules/@haxtheweb/course-model/course-model.js b/haxcms/build/es6/node_modules/@haxtheweb/course-model/course-model.js index 36a607091..74464d5b7 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/course-model/course-model.js +++ b/haxcms/build/es6/node_modules/@haxtheweb/course-model/course-model.js @@ -2,7 +2,7 @@ * Copyright 2023 * @license , see License.md for full text. */ -import{LitElement as e,html as t,css as i}from"../../lit/index.js";import"../../@google/model-viewer/dist/model-viewer.js";import"./lib/model-option.js";import"./lib/model-info.js";class CourseModel extends e{static get tag(){return"course-model"}static get properties(){return{visible:{type:String,reflect:!0},title:{type:String},src:{type:String},alt:{type:String}}}static get haxProperties(){return!this._sent&&window.HaxStore&&window.HaxStore.instance&&window.HaxStore.instance.ready&&(this._sent=!0,window.HaxStore.instance.setHaxProperties({api:"1",canScale:!0,canEditSource:!0,contentEditable:!1,gizmo:{title:"3d Model",description:"3D Model viewer",icon:"icons:android",color:"purple",tags:["Resource","3D","model","viewer"],handles:[],meta:{author:"Google"}},settings:{configure:[{property:"poster",title:"Poster image",inputMethod:"haxupload",noVoiceRecord:!0},{property:"src",title:"Source",inputMethod:"haxupload",noVoiceRecord:!0,noCamera:!0},{property:"alt",title:"Alternate Text",inputMethod:"alt"}],advanced:[{attribute:"environment-image",title:"Environment Image",inputMethod:"haxupload",noVoiceRecord:!0,noCamera:!0},{property:"ar",title:"Augmented Reality",inputMethod:"boolean"},{attribute:"camera-controls",title:"Camera controls",inputMethod:"boolean"},{attribute:"touch-action",title:"Touch action",inputMethod:"textfield"},{attribute:"shadow-intensity",title:"Shadow intensity",inputMethod:"number"}],developer:[]},demoSchema:[{tag:"model-viewer",content:"",properties:{alt:"Neil Armstrong's Spacesuit from the Smithsonian Digitization Programs Office and National Air and Space Museum",src:"https://modelviewer.dev/shared-assets/models/NeilArmstrong.glb",ar:!0,"environment-image":"https://modelviewer.dev/shared-assets/environments/moon_1k.hdr",poster:"https://modelviewer.dev/shared-assets/models/NeilArmstrong.webp","shadow-intensity":"1","camera-controls":!0,"touch-action":"pan-y",style:"height: 500px;"}}]},"model-viewer")),new URL(`./lib/${this.tag}.haxProperties.json`,import.meta.url).href}constructor(){super(),this.visible="model",this.title="",this.src="",this.addEventListener("model-select",this._srcChanged)}static get styles(){return[i` +import{LitElement as e,html as t,css as i}from"../../lit/index.js";import"../../@google/model-viewer/dist/model-viewer.js";import"./lib/model-option.js";import"./lib/model-info.js";class CourseModel extends e{static get tag(){return"course-model"}static get properties(){return{visible:{type:String,reflect:!0},title:{type:String},src:{type:String},alt:{type:String}}}static get haxProperties(){return!this._sent&&window.HaxStore&&window.HaxStore.instance&&window.HaxStore.instance.ready&&(this._sent=!0,window.HaxStore.instance.setHaxProperties({api:"1",canScale:!0,canEditSource:!0,contentEditable:!1,gizmo:{title:"3d Model",description:"3D Model viewer",icon:"3d-rotation",color:"purple",tags:["Resource","3D","model","viewer"],handles:[],meta:{author:"Google"}},settings:{configure:[{property:"poster",title:"Poster image",inputMethod:"haxupload",noVoiceRecord:!0},{property:"src",title:"Source",inputMethod:"haxupload",noVoiceRecord:!0,noCamera:!0},{property:"alt",title:"Alternate Text",inputMethod:"alt"}],advanced:[{attribute:"environment-image",title:"Environment Image",inputMethod:"haxupload",noVoiceRecord:!0,noCamera:!0},{property:"ar",title:"Augmented Reality",inputMethod:"boolean"},{attribute:"camera-controls",title:"Camera controls",inputMethod:"boolean"},{attribute:"touch-action",title:"Touch action",inputMethod:"textfield"},{attribute:"shadow-intensity",title:"Shadow intensity",inputMethod:"number"}],developer:[]},demoSchema:[{tag:"model-viewer",content:"",properties:{alt:"Neil Armstrong's Spacesuit from the Smithsonian Digitization Programs Office and National Air and Space Museum",src:"https://modelviewer.dev/shared-assets/models/NeilArmstrong.glb",ar:!0,"environment-image":"https://modelviewer.dev/shared-assets/environments/moon_1k.hdr",poster:"https://modelviewer.dev/shared-assets/models/NeilArmstrong.webp","shadow-intensity":"1","camera-controls":!0,"touch-action":"pan-y",style:"height: 500px;"}}]},"model-viewer")),new URL(`./lib/${this.tag}.haxProperties.json`,import.meta.url).href}constructor(){super(),this.visible="model",this.title="",this.src="",this.addEventListener("model-select",this._srcChanged)}static get styles(){return[i` :host { display: block; } diff --git a/haxcms/build/es6/node_modules/@haxtheweb/course-model/lib/course-model.haxProperties.json b/haxcms/build/es6/node_modules/@haxtheweb/course-model/lib/course-model.haxProperties.json index 8d9622b75..dc1430215 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/course-model/lib/course-model.haxProperties.json +++ b/haxcms/build/es6/node_modules/@haxtheweb/course-model/lib/course-model.haxProperties.json @@ -7,7 +7,7 @@ "gizmo": { "title": "course model", "description": "", - "icon": "icons:android", + "icon": "3d-rotation", "color": "purple", "tags": ["Other", "Course", "Model", "Eberly"], "handles": [], diff --git a/haxcms/build/es6/node_modules/@haxtheweb/fill-in-the-blanks/lib/fill-in-the-blanks.haxProperties.json b/haxcms/build/es6/node_modules/@haxtheweb/fill-in-the-blanks/lib/fill-in-the-blanks.haxProperties.json index 53412bc95..5ca8b99f8 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/fill-in-the-blanks/lib/fill-in-the-blanks.haxProperties.json +++ b/haxcms/build/es6/node_modules/@haxtheweb/fill-in-the-blanks/lib/fill-in-the-blanks.haxProperties.json @@ -13,7 +13,7 @@ "gizmo": { "title": "Fill in the blanks", "description": "", - "icon": "icons:android", + "icon": "editor:space-bar", "color": "purple", "tags": ["Instructional", "question"], "handles": [], @@ -55,7 +55,8 @@ "answers", "displayed-answers", "t", - "show-answer" + "show-answer", + "edit" ] }, "documentation": { diff --git a/haxcms/build/es6/node_modules/@haxtheweb/hax-body/hax-body.js b/haxcms/build/es6/node_modules/@haxtheweb/hax-body/hax-body.js index f2eeef6ef..2a444fba1 100755 --- a/haxcms/build/es6/node_modules/@haxtheweb/hax-body/hax-body.js +++ b/haxcms/build/es6/node_modules/@haxtheweb/hax-body/hax-body.js @@ -340,4 +340,4 @@ import{html as e,css as t,render as i,unsafeCSS as o}from"../../lit/index.js";im :host([edit-mode]) #bodycontainer ::slotted(*[data-hax-lock])::after { background-image: url("${o(this.__lockIconPath)}"); } - `),e}firstUpdated(e){i(this.HAXBODYStyleSheetContent(),this.shadowRoot.querySelector("#hax-body-style-element")),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"),parent:this.shadowRoot.querySelector("#topcontext")},this.shadowRoot.querySelector("slot").addEventListener("mouseup",(e=>{this.editMode&&setTimeout((()=>{const e=s.getSelection();s._tmpSelection=e,s.haxSelectedText=e.toString();try{const e=s.getRange();e.cloneRange&&(s._tmpRange=e.cloneRange())}catch(e){console.warn(e)}}),10)})),this.editMode=s.editMode,this.__tabTrap=!1,this.ready=!0,super.firstUpdated&&super.firstUpdated(e)}async updated(e){super.updated&&super.updated(e),e.forEach((async(e,t)=>{"editMode"==t&&void 0!==e&&setTimeout((async()=>{this.__ignoreActive=!0,await this._editModeChanged(this[t],e),setTimeout((()=>{this.__ignoreActive=!1}),100)}),0),"_useristyping"==t&&this[t]&&this.hideContextMenus(),"activeNode"==t&&this.ready&&void 0!==e&&await this._activeNodeChanged(this[t],e)}))}_toggleNodeLocking(e){e.detail.lock?(this.contextMenus.plate.disableDuplicate=!0,this.contextMenus.plate.disableOps=!0,this.contextMenus.plate.disableItemOps=!0,this.contextMenus.plate.canMoveElement=!1,e.detail.node.removeAttribute("contenteditable"),this.removeAttribute("contenteditable")):(this.contextMenus.plate.disableDuplicate=!1,this.contextMenus.plate.disableOps=!1,this.contextMenus.plate.disableItemOps=!1,this.contextMenus.plate.canMoveElement=this.canMoveElement,e.detail.node.setAttribute("contenteditable",!0),this.setAttribute("contenteditable",!0)),this.requestUpdate()}_keepContextVisible(e=null){this.editMode&&(clearTimeout(this.__contextVisibleLock),this.__contextVisibleLock=setTimeout((()=>{let e=!1;this.contextMenus.plate.classList.contains("hax-context-visible")&&(e=this.contextMenus.plate),e&&this.positionContextMenus()}),100))}_onKeyUp(e){if(["ArrowUp","ArrowDown"].includes(e.key)&&this.activeNode&&s.isTextElement(this.activeNode)&&!E.opened){let t=e.key;if(this[`timesClicked${t}`]++,this[`timesClicked${t}`]>=2&&this.activeNode===this.prevKeyActiveNode)if("ArrowUp"===t){if(this.activeNode.previousElementSibling&&"PAGE-BREAK"===this.activeNode.previousElementSibling.tagName)this.haxInsert("p","",{},this.activeNode.previousElementSibling);else if(this.activeNode.parentNode!==this&&this.activeNode.parentNode.previousElementSibling&&"PAGE-BREAK"===this.activeNode.parentNode.previousElementSibling.tagName)this.haxInsert("p","",{},this.activeNode.parentNode.previousElementSibling);else if(!this.activeNode.previousElementSibling&&this.activeNode.parentNode===this){let e=document.createElement("p");this.insertBefore(e,this.activeNode)}}else this.activeNode.nextElementSibling||this.children[this.children.length-1]!==this.activeNode?this.activeNode.parentNode&&this.activeNode.parentNode!==this&&!this.activeNode.parentNode.nextElementSibling&&this.children[this.children.length-1]===this.activeNode.parentNode&&this.haxInsert("p","",{},this.activeNode.parentNode):this.haxInsert("p","",{}),this[`timesClicked${t}`]=0,this.prevKeyActiveNode=null;else this.prevKeyActiveNode=this.activeNode;setTimeout((()=>{this[`timesClicked${t}`]=0,this.prevKeyActiveNode=null}),200)}}_onKeyDown(e){if(this.editMode&&"HAX-TRAY"!==document.activeElement.tagName&&"BODY"!==document.activeElement.tagName&&"SIMPLE-MODAL"!==document.activeElement.tagName&&this.getAttribute("contenteditable")){if(this.__dropActiveVisible(),this.__manageFakeEndCap(!1),null!=s.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":this._useristyping=!0,s.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._useristyping=!0,this.activeNode&&(this.__slot=this.activeNode.getAttribute("slot")),this.activeNode&&"P"===this.activeNode.tagName&&["1","#","`",">","-"].includes(this.activeNode.textContent[0])){const e=this.activeNode.textContent.replaceAll(/ /g," ");this.keyboardShortCutProcess(e)}break;case"Backspace":case"Delete":this.activeNode&&""==this.activeNode.textContent&&this.activeNode.previousElementSibling&&this.activeNode.previousElementSibling.tagName&&(["TABLE","EDITABLE-TABLE","IFRAME-LOADER","IFRAME","WEBVIEW"].includes(this.activeNode.previousElementSibling.tagName)||"PAGE-BREAK"===this.activeNode.previousElementSibling.tagName&&2===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}).length&&this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0})[1]===this.activeNode)&&e.preventDefault(),this._useristyping=!0,this.__delHit=!0,this.querySelectorAll("[data-hax-active]").forEach((e=>e.classList.remove)),setTimeout((()=>{const e=s.getSelection();s._tmpSelection=e,s.haxSelectedText=e.toString();const t=s.getRange();t.commonAncestorContainer&&this.activeNode!==t.commonAncestorContainer&&"function"==typeof t.commonAncestorContainer.focus?"HAX-BODY"!==t.commonAncestorContainer.tagName&&this.__focusLogic(t.commonAncestorContainer,!1):t.commonAncestorContainer&&t.commonAncestorContainer.parentNode&&this.activeNode!==t.commonAncestorContainer.parentNode&&"function"==typeof t.commonAncestorContainer.parentNode.focus&&("HAX-BODY"!==t.commonAncestorContainer.parentNode.tagName?this.__focusLogic(t.commonAncestorContainer.parentNode,!1):this.__focusLogic(t.commonAncestorContainer,!1))}),100);break;case"Escape":this._useristyping=!0;break;case"/":const t=s.getRange();this.activeNode&&s.isTextElement(this.activeNode)&&""==t.commonAncestorContainer.textContent.trim()&&(e.preventDefault(),E.mini=!0,E.activeRange=t,E.activeSelection=s.getSelection(),E.activeNode=t.commonAncestorContainer,E.runProgram(t.commonAncestorContainer.textContent.trim(),"*"),E.open());break;case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":this._useristyping=!0,this.querySelectorAll("[data-hax-active]").forEach((e=>e.classList.remove)),setTimeout((()=>{const e=s.getSelection();s._tmpSelection=e,s.haxSelectedText=e.toString();const t=s.getRange();t.commonAncestorContainer&&this.activeNode!==t.commonAncestorContainer&&"function"==typeof t.commonAncestorContainer.focus?"HAX-BODY"!==t.commonAncestorContainer.tagName&&this.__focusLogic(t.commonAncestorContainer,!1):t.commonAncestorContainer&&t.commonAncestorContainer.parentNode&&this.activeNode!==t.commonAncestorContainer.parentNode&&"function"==typeof t.commonAncestorContainer.parentNode.focus&&("HAX-BODY"!==t.commonAncestorContainer.parentNode.tagName?this.__focusLogic(t.commonAncestorContainer.parentNode,!1):this.__focusLogic(t.commonAncestorContainer,!1))}),0);break;default:this._useristyping=!0,setTimeout((()=>{if(this.activeNode&&"P"===this.activeNode.tagName&&["1","#","`",">","-"].includes(this.activeNode.textContent[0])){const e=this.activeNode.textContent.replaceAll(/ /g," ");" "===e[e.length-1]&&this.keyboardShortCutProcess(e)}}),0)}}}keyboardShortCutProcess(e){if(s.keyboardShortcuts[e.replace(" ","")]){let t=m(s.keyboardShortcuts[e.replace(" ","")]);this.haxReplaceNode(this.activeNode,t),this.__focusLogic(t),"HR"===t.tagName&&this.haxInsert("p","",{})}}setActiveNode(e,t=!1){e&&this.editMode&&this.activeNode&&(s.isTextElement(this.activeNode)||t)&&(s.activeNode=e,clearTimeout(this.__positionContextTimer),this.__positionContextTimer=setTimeout((()=>{this.__addActiveVisible(),this.positionContextMenus()}),2e3))}elementMidViewport(){const e=this.activeNode.getBoundingClientRect().y;return e<0&&e>-1*this.activeNode.offsetHeight+140}replacePlaceholder(e){if("text"===e.detail){let e=document.createElement("p");this.haxReplaceNode(this.activeNode,e),this.__focusLogic(e),this.activeNode.parentNode&&this.activeNode.parentNode.setAttribute("contenteditable",!0)}else this.replaceElementWorkflow()}async canTansformNode(e=null){return await this.replaceElementWorkflow(e,!0).length>0}async insertElementWorkflow(e=null,t=!1){}get primitiveTextBlocks(){return["p","div","pre","h1","h2","h3","h4","h5","h6"]}getAllSlotConfig(e){if(!e)return;let t=this.getParentGrid(e);return t&&t.tag?this.getSlotConfig(s.elementList[t.tag],slot):void 0}getParentGrid(e){return((e=e||this.activeNode)?e.slot:void 0)?u(e.parentNode):void 0}getSlotConfig(e="",t={}){let i=t.settings,o=i?Object.keys(i||{}).map((t=>i[t].filter((t=>!(!t.slot||e&&t.slot!==e))))).flat():void 0;return o&&o.length>0?o[0]:void 0}async replaceElementWorkflow(e=null,t=!1){null==e&&(e=this.activeNode);let i=await u(e,null);if(!i)return;let o="*",a=!1,n=(e||{}).slot,r=this.getParentGrid(e);"place-holder"===i.tag&&void 0!==i.properties.type?(o=i.properties.type,a=!0):this.primitiveTextBlocks.includes(i.tag)&&(a=!0);var l=i.content?{innerHTML:i.content}:{};if(void 0!==s.elementList[i.tag]&&!1!==s.elementList[i.tag].gizmo&&void 0!==s.elementList[i.tag].gizmo.handles&&s.elementList[i.tag].gizmo.handles.length>0){let e=s.elementList[i.tag].gizmo;for(var d=0;d!g.includes(e.tag)&&(!p||p.includes(e.tag))))),h.length>0){let i=e.tagName.toLowerCase(),o=i.replace("-"," ");void 0!==s.elementList[i]&&!1!==s.elementList[i].gizmo&&(o=s.elementList[i].gizmo.title),t||(s.activePlaceHolder=this.activeNode,s.haxAppPicker.presentOptions(h,"__convert",`Change ${o} to...`,"gizmo"))}else t||s.toast("Sorry, this can not be transformed!",5e3);return h}haxClearBody(e=!0){let t=!0;e&&(t=prompt("Are you sure you want to delete all content?")),t&&c(this)}haxInsert(e,t,i={},o=this.activeNode,a=!1){var n=document.createElement(e);n.innerHTML=t;const r=n.cloneNode(!0);for(var l in i){let e=g(l);""!=e&&i.hasOwnProperty(l)&&(!0===i[l]?r.setAttribute(e,e):!1===i[l]?r.removeAttribute(e):null!=i[l]&&i[l].constructor===Array||null!=i[l]&&i[l].constructor===Object?r.properties&&r.properties[l].readOnly||(r.set?r.set(e,i[l]):r[e]=i[l]):r.setAttribute(e,i[l]))}return null!==s.activePlaceHolder&&void 0!==s.activePlaceHolder.style?(r.style.width=s.activePlaceHolder.style.width,r.style.float=s.activePlaceHolder.style.float,r.style.margin=s.activePlaceHolder.style.margin,r.style.display=s.activePlaceHolder.style.display,this.haxReplaceNode(s.activePlaceHolder,r),s.activePlaceHolder=null):o&&o.parentNode?this.__isLayout(o.parentNode)?(null!=o.getAttribute("slot")&&r.setAttribute("slot",o.getAttribute("slot")),this.__addAbove?o.parentNode.insertBefore(r,o):o.parentNode.insertBefore(r,o.nextElementSibling)):o.parentNode&&o.parentNode.nextElementSibling?o.parentNode.nextElementSibling.parentNode.insertBefore(r,o.parentNode.nextElementSibling):o.parentNode&&o.nextElementSibling?this.__addAbove?o.parentNode.insertBefore(r,o):o.parentNode.insertBefore(r,o.nextElementSibling):o.parentNode&&o.parentNode.children[o.parentNode.children.length-1]===o?this.__addAbove?o.parentNode.insertBefore(r,o):o.parentNode.appendChild(r):o.parentNode?o.parentNode.insertBefore(r,o):this.appendChild(r):this.appendChild(r),this.contextMenus.text.hasSelectedText=!1,setTimeout((()=>{this.__focusLogic(r),this.scrollHere(r)}),0),r}async haxToContent(){this.hideContextMenus();var e=this.activeNode;s.activeNode=null;let t="slot"===this.shadowRoot.querySelector("#body").localName?this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}):[];for(var i="",o=0;o{if(!s._lockContextPosition){let t=e.tagName.toLowerCase();s._isSandboxed&&"webview"===t&&(t="iframe"),e&&"PAGE-BREAK"!==e.tagName?this._showContextMenu(this.contextMenus.plate):this._hideContextMenu(this.contextMenus.plate);let i=s.elementList[t];void 0===i||s.isTextElement(e)?this._showContextMenu(this.contextMenus.text):(this._hideContextMenu(this.contextMenus.text),i.element=e);(i||{}).gizmo;let o=i&&i.gizmo&&(i.gizmo.handles||[]).filter((e=>"inline"===(e||{}).type)).length>0;i&&"core"!=i.editingElement?setTimeout((()=>{(e&&e.parentNode||!o)&&(this.canMoveElement=!0)}),250):this.activeNode&&("LI"===this.activeNode.tagName||this._HTMLInlineTextDecorationTest(this.activeNode))?this.canMoveElement=!1:this.canMoveElement=!0}this.contextMenus.parent.setPosition()}),50)}}__addActiveVisible(){for(var e in this.contextMenus)("add"!=e||this.__activeHover)&&this.contextMenus[e].classList.add("hax-context-menu-active")}__dropActiveVisible(){for(var e in this.contextMenus)this.contextMenus[e].classList.remove("hax-context-menu-active");this.__activeHover=null}haxMoveGridPlate(e,t=1){this.___moveLock=!0;let i=e?e.parentNode:void 0,o=t>0?e.nextElementSibling:e.previousElementSibling,a=this.__layoutSlots(i)||[],n=e.getAttribute("slot"),r=n?a.indexOf(n):-1,l=a[r+t];!o||n&&o.getAttribute("slot");return!o||n&&n!==o.getAttribute("slot")?l?e.setAttribute("slot",l):e&&i&&i!==this&&(o=t>0?i.nextElementSibling:i,l=i.getAttribute("slot"),o&&(i.parentNode.insertBefore(e,o),l&&e.setAttribute("slot",l))):i.insertBefore(e,t>0?o.nextElementSibling:o),setTimeout((()=>{s.activeNode=e,this.scrollHere(e),this.__focusLogic(e)}),100),!0}async haxGridPlateOps(e=!0,t="right",i=this.activeNode){"GRID-PLATE"!==i.tagName&&"GRID-PLATE"===i.parentNode.tagName&&(i=i.parentNode);let o=!1;if("GRID-PLATE"===i.tagName){if(e)switch(i.layout){case"2-1":case"3-1":i.layout="2-1-1",o=!0;break;case"1-2":i.layout="1-2-1",o=!0;break;case"1-3":i.layout="1-1-2",o=!0;break;case"2-1-1":case"1-2-1":case"1-1-2":case"1-1-1":i.layout="1-1-1-1",o=!0;break;case"1":i.layout="1-1",o=!0;break;case"1-1":i.layout="1-1-1",o=!0}else switch(i.layout){case"2-1":case"1-2":case"1-3":case"3-1":case"1-1":case"1":let e;await i.childNodes.forEach((t=>{t.tagName&&(e=t.cloneNode(!0),i.getAttribute("slot")?e.setAttribute("slot",i.getAttribute("slot")):e.removeAttribute("slot"),i.parentNode.insertBefore(e,i))})),s.activeNode=e,setTimeout((()=>{i.remove()}),0),o=!0;break;case"1-1-1":i.layout="1-1",o=!0;break;case"1-1-1-1":i.layout="1-1-1",o=!0;break;case"2-1-1":i.layout="2-1",o=!0;break;case"1-2-1":case"1-1-2":i.layout="1-2",o=!0}if(o){let e=this.contextMenus.plate.shadowRoot.querySelector("#right"),o=this.contextMenus.plate.shadowRoot.querySelector("#rightremove");e.disabled=!1,o.disabled=!1,"1-1-1-1"==i.layout&&(e.disabled=!0),"left"==t&&i.childNodes.forEach((e=>{if(e.tagName){let t=parseInt(e.getAttribute("slot").replace("col-",""),10)+1;e.setAttribute("slot",`col-${t}`)}}))}}else{let e=document.createElement("grid-plate");e.layout="1-2-1",e.disableResponsive=!0,i.getAttribute("slot")&&e.setAttribute("slot",i.getAttribute("slot"));let t=i.cloneNode(!0);t.setAttribute("slot","col-2"),e.appendChild(t),i.parentNode.insertBefore(e,i),setTimeout((()=>{i.remove()}),0)}await s.refreshActiveNodeForm()}haxReplaceNode(e,t){try{null==e&&(e=this.__oldActiveNode),!e.replaceWith&&s._tmpRange&&(e=s._tmpRange,s._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}haxChangeTagName(e,t,i=!0){for(var o=document.createElement(t),a=0,n=e.attributes.length;a"==o.innerHTML?o.innerHTML="

      • ":"ul"!=e.tagName.toLowerCase()&&"ol"!=e.tagName.toLowerCase()&&(o.innerHTML="
      • "+e.innerHTML.trim().replace(//g,"
      • \n
      • ").replace(/
        /g,"
      • \n
      • ")+"
      • "):"ul"!=e.tagName.toLowerCase()&&"ol"!=e.tagName.toLowerCase()||(o.innerHTML=o.innerHTML.replace(/
          /g,"").replace(/<\/ul>/g,"").replace(/
        • <\/li>/g,"").replace(/
        • /g,"").replace(/<\/li>/g,"
          "));try{e.replaceWith(o),i&&setTimeout((()=>{let 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}haxDeleteNode(e){if(e.previousElementSibling)s.activeNode=e.previousElementSibling;else if(e.nextElementSibling)s.activeNode=e.nextElementSibling;else{this.haxInsert("p","",{});try{var t=document.createRange(),i=s.getSelection();t.setStart(this.activeNode,0),t.collapse(!0),i.removeAllRanges(),i.addRange(t),this.activeNode.focus()}catch(e){console.warn(e)}}try{return e.remove()}catch(e){console.warn(e)}}importContent(e,t=!0){t&&c(this,"*"),setTimeout((()=>{e=d(e);let t=document.createElement("div");for(t.insertAdjacentHTML("beforeend",e);null!==t.firstChild;)if(void 0!==t.firstChild.tagName)if(s._isSandboxed&&"iframe"===t.firstChild.tagName.toLowerCase()){for(var i=document.createElement("webview"),o=0,a=t.firstChild.attributes.length;o`col-${t}`)):s.slotsFromSchema(t).map((e=>e.slot))).reverse().forEach(((t,i)=>{0==i?e.querySelectorAll(`[slot=${t}]`).forEach((t=>e.append(t))):[...e.querySelectorAll(`[slot=${t}]`)].reverse().forEach((t=>e.insertBefore(t,e.firstChild)))}))}async _haxContextOperation(e){let t=e.detail,i=N(e),o=i&&i[0]?i[0].getAttribute("data-slot"):void 0;switch(t.eventName){case"insert-above-active":if(this.activeNode&&this.activeNode.previousElementSibling)this.haxInsert("p","",{},this.activeNode.previousElementSibling);else if(this.activeNode){let e=document.createElement("p");this.activeNode.getAttribute("slot")&&e.setAttribute("slot",this.activeNode.getAttribute("slot")),this.activeNode.parentNode.insertBefore(e,this.activeNode)}else this.appendChild(p);break;case"insert-below-active":this.haxInsert("p","",{});break;case"move-to-slot":o&&this.activeNode&&s.isGridPlateElement(this.activeNode.parentNode)&&(this.activeNode.slot=o,this.sortGridSlots(this.activeNode.parentNode));break;case"insert-into-active":if(o&&this.activeNode&&s.isGridPlateElement(this.activeNode)){let e=document.createElement("p");e.slot=o,this.activeNode.append(e),this.haxInsert("p","",{slot:o},e),e.remove(),this.sortGridSlots()}break;case"hax-select-grid":if(i[0]&&i[0].eventData){let e=i[0].eventData;this.setActiveNode(e,!0),this.positionContextMenus(e)}break;case"hax-select-grid-item":if(i[0]&&i[0].eventData){let e=i[0].eventData,t=e.target,o=e.slot,a=e.index,n=e.grid,s=e.editMode,r=e.invisible?n:[...n.children].filter((e=>o&&""!==o?e.slot===o:!e.slot||""===e.slot))[a]||t;n&&s?this.setSlotEditMode(n,s,r):(this.setActiveNode(node,!0),this.positionContextMenus(node))}break;case"hax-edit-element-toggle":if(i[0]&&i[0].eventData){let e=i[0].eventData;e&&e.target&&e.editMode&&this.toggleElementEditMode(e.target,e.editMode)}break;case"hax-source-view-toggle":if(this.activeNode.__haxSourceView){this.activeNode.__haxSourceView=!1;let e=await s.runHook(s.activeEditingElement,"activeElementChanged",[this.activeNode,!1]),t={};if(this.activeNode&&this.activeNode.tagName?t=s.haxSchemaFromTag(this.activeNode.tagName.toLowerCase()):this.activeNode.parentElement&&this.activeNode.parentElement.tagName&&(t=s.haxSchemaFromTag(this.activeNode.parentElement.tagName.toLowerCase())),this.activeNode&&this.activeNode.getAttribute&&null!=this.activeNode.getAttribute("slot")&&e.setAttribute("slot",this.activeNode.getAttribute("slot")),t.saveOptions&&t.saveOptions.unsetAttributes&&t.saveOptions.unsetAttributes.length)for(var a in t.saveOptions.unsetAttributes)e.removeAttribute(t.saveOptions.unsetAttributes[a]);this.__applyNodeEditableState(e,this.editMode),b(s.activeEditingElement),s.activeEditingElement=null,this.viewSourceToggle=!1}else this.activeNode.__haxSourceView=!0,s.activeEditingElement=document.createElement("code-editor"),s.activeEditingElement.language="html",s.activeEditingElement.title="",s.activeEditingElement.theme="vs",s.activeEditingElement.fontSize=12,s.activeEditingElement.wordWrap=!0,this.viewSourceToggle=!0,import("../code-editor/code-editor.js"),this.activeNode.getAttribute&&null!=this.activeNode.getAttribute("slot")&&s.activeEditingElement.setAttribute("slot",this.activeNode.getAttribute("slot")),this.__ignoreActive=!0,this.activeNode.removeAttribute("contenteditable"),this.__applyDragDropState(this.activeNode,!1),this.activeNode.removeAttribute("data-hax-active"),s.testHook(this.activeNode,"preProcessNodeToContent")&&(s.activeNode=await s.runHook(this.activeNode,"preProcessNodeToContent",[this.activeNode])),v(this.activeNode,s.activeEditingElement),s.activeEditingElement.focus();break;case"hax-full-text-editor-toggle":if(this.activeNode.__haxSourceView){this.activeNode.__haxSourceView=!1;let e=await s.runHook(s.activeEditingElement,"activeElementChanged",[this.activeNode,!1]),t=s.haxSchemaFromTag(this.activeNode.tagName.toLowerCase());if(this.activeNode&&this.activeNode.getAttribute&&null!=this.activeNode.getAttribute("slot")&&e.setAttribute("slot",this.activeNode.getAttribute("slot")),t.saveOptions&&t.saveOptions.unsetAttributes&&t.saveOptions.unsetAttributes.length)for(var a in t.saveOptions.unsetAttributes)e.removeAttribute(t.saveOptions.unsetAttributes[a]);this.__applyNodeEditableState(e,this.editMode),b(s.activeEditingElement),s.activeEditingElement=null,this.viewSourceElement=s.activeEditingElement}else this.activeNode.__haxSourceView=!0,import("../rich-text-editor/rich-text-editor.js").then((()=>{s.activeEditingElement=document.createElement("rich-text-editor"),s.activeEditingElement.type="rich-text-editor-toolbar-full",this.activeNode.getAttribute&&null!=this.activeNode.getAttribute("slot")&&s.activeEditingElement.setAttribute("slot",this.activeNode.getAttribute("slot")),this.__ignoreActive=!0,this.activeNode.removeAttribute("contenteditable"),this.__applyDragDropState(this.activeNode,!1),this.activeNode.removeAttribute("data-hax-active"),v(this.activeNode,s.activeEditingElement),this.viewSourceElement=s.activeEditingElement}));break;case"text-tag":s.activeNode=this.haxChangeTagName(this.activeNode,t.value),this.positionContextMenus();break;case"text-tag-ul":this.contextMenus.text.realSelectedValue="ul",s.activeNode=this.haxChangeTagName(this.activeNode,"ul"),this.positionContextMenus();break;case"text-tag-ol":this.contextMenus.text.realSelectedValue="ol",s.activeNode=this.haxChangeTagName(this.activeNode,"ol"),this.positionContextMenus();break;case"hax-transform-node":this.replaceElementWorkflow();break;case"hax-plate-create-right":this.haxGridPlateOps();break;case"hax-plate-remove-right":this.haxGridPlateOps(!1);break;case"hax-plate-duplicate":this.haxDuplicateNode(this.activeNode);break;case"hax-plate-delete":null!=this.activeNode&&this.haxDeleteNode(this.activeNode);break;case"hax-plate-up":this.activeNode.previousElementSibling&&"PAGE-BREAK"!==this.activeNode.previousElementSibling.tagName&&this.haxMoveGridPlate(this.activeNode,-1);break;case"hax-plate-down":this.activeNode.nextElementSibling&&this.haxMoveGridPlate(this.activeNode);break;case"content-edit":"content-edit"===s.haxTray.trayDetail&&(s.haxTray.collapsed=!1),s.haxTray.trayDetail="content-edit";break;case"super-daemon":const e=s.getRange();E.mini=!0,E.activeRange=e,E.activeSelection=s.getSelection();let n=this.activeNode;e.commonAncestorContainer.tagName?n=e.commonAncestorContainer:e.commonAncestorContainer.parentNode&&e.commonAncestorContainer.parentNode.tagName&&(n=e.commonAncestorContainer.parentNode),E.activeNode=n,E.runProgram(n.textContent.trim(),"*"),E.open();break;case"hide-context-menus":this.hideContextMenus()}}_focusIn(e){this.__mouseDown||this.__focusLogic(e.target)&&(e.stopPropagation(),e.stopImmediatePropagation())}__focusLogic(e,t=!0){let i=!1;if(this.editMode&&!this.__tabTrap){let o=e;("SPAN"===o.tagName&&s.isTextElement(o.parentNode)&&""==o.parentNode.getAttribute("slot")||"LI"===o.tagName&&s.isTextElement(o.parentNode)&&["UL","OL"].includes(o.parentNode.tagName))&&(o=e.parentNode);let a=null;if(this._validElementTest(o)&&o.parentNode&&o.parentNode.tagName){if("P"===o.parentNode.tagName&&""==o.parentNode.getAttribute("slot"))a=o,i=!0;else{for(;o.parentNode&&o.parentNode.tagName&&"HAX-BODY"!=o.parentNode.tagName;)null===a&&"B"!==o.tagName&&"I"!==o.tagName&&"STRONG"!==o.tagName&&"EM"!==o.tagName&&(a=o),o=o.parentNode;null===a?a=o:s.isGridPlateElement(o)}(this.activeNode&&this.activeNode.parentNode!==o&&!o.classList.contains("ignore-activation")||o.haxUIElement||o.classList.contains("ignore-activation"))&&(i=!0),a.haxUIElement||a.classList.contains("ignore-activation")||(s.activeNode=a,setTimeout((()=>{if(t&&!this.__mouseDown&&s.isTextElement(a))try{var e=document.createRange(),i=s.getSelection();e.setStart(this.activeNode,0),e.collapse(!0),i.removeAllRanges(),i.addRange(e),this.activeNode.focus()}catch(e){console.warn(e)}this.positionContextMenus(a)}),0),i=!0)}}else this.__tabTrap=!1;return i}scrollHere(e){setTimeout((()=>{e.scrollIntoView({behavior:"smooth",inline:"nearest",block:"end"})}),100)}undo(){super.undo(),setTimeout((()=>{let e=this.querySelector("[data-hax-active]");e?(this.__focusLogic(e),this.scrollHere(e)):this.hideContextMenus()}),0)}redo(){super.redo(),setTimeout((()=>{let e=this.querySelector("[data-hax-active]");e?(this.__focusLogic(e),this.scrollHere(e)):this.hideContextMenus()}),0)}async _editModeChanged(e,t){if(void 0!==t){if(this._applyContentEditable(e),e){if(this.children&&this.children[0]&&this.children[0].focus&&this.children[0].tagName)"PAGE-BREAK"===this.children[0].tagName&&this.children[1]&&this.children[1].focus?this.__focusLogic(this.children[1]):"PAGE-BREAK"===this.children[0].tagName?this.haxInsert("p","",{}):this.__focusLogic(this.children[0]);else{this.haxInsert("p","",{});try{var i=document.createRange(),o=s.getSelection();i.setStart(this.activeNode,0),i.collapse(!0),o.removeAllRanges(),o.addRange(i),this.activeNode.focus()}catch(e){console.warn(e)}}this._haxContextOperation({detail:{eventName:"content-edit",value:!0}})}else this.activeNode&&(this.unsetSlotEditMode(this.activeNode),this.unsetElementEditMode(this.activeNode));setTimeout((()=>{this.undoStack.undoStackLimit=50,this.undoStack.undoStackPosition=-1,this.undoStack.commands=[],this.undoStack.changed(),this.undoStackInitialValue=this.innerHTML,this.undoStackPrevValue=this.undoStackInitialValue}),0)}if(0==e){b(s.activeEditingElement),s.activeEditingElement=null,this.removeAttribute("contenteditable"),this.hideContextMenus();let e=this.querySelectorAll("[contenteditable],[data-hax-active]");for(var a=0;a{var t=!1;this.__ignoreActive||this.__dragMoving||this.undoStackIgnore||this.__fakeEndCap||!this.ready||!this.editMode||!this.shadowRoot?this.undoStackIgnore&&e.forEach((e=>{e.addedNodes.length>0&&e.addedNodes.forEach((e=>{this._validElementTest(e,!0)&&setTimeout((()=>{this.__applyNodeEditableState(e,this.editMode)}),0)}))})):e.forEach((e=>{if(e.removedNodes.length>0)for(var i of e.removedNodes)e.previousSibling&&this.activeNode;if(e.addedNodes.length>0){for(var i of e.addedNodes)if(this._validElementTest(i)){if(!this.__delHit&&"BR"===i.tagName&&i.parentElement&&s.__validGridTags().includes(i.parentElement.tagName.toLowerCase())&&i===i.parentElement.childNodes[i.parentElement.childNodes.length-1]){let e=i.parentElement;if(i.remove(),e.childNodes.length>0){let t=e.childNodes[e.childNodes.length-1];t.textContent+="​",s._positionCursorInNode(t,t.length)}continue}if(this.__delHit=!1,"P"===i.tagName&&i.children.length>0&&"P"===i.children[0].tagName){b(i);continue}if("P"===i.tagName&&i.parentElement&&"P"===i.parentElement.tagName){b(i.parentElement);continue}if(null!=i.getAttribute("slot")&&i.parentElement===this){i.removeAttribute("slot");continue}if("LI"===i.tagName&&i.children.length>0&&"SPAN"===i.children[0].tagName){this.activeNode!==i.children[0]&&this.activeNode!==i||(s.activeNode=i),b(i.children[0]);continue}if("LI"===i.tagName&&i.parentElement&&!["UL","OL"].includes(i.parentElement.tagName)){b(i);continue}if("P"===i.tagName&&i.children.length>0&&["P","LI"].includes(i.children[0].tagName)){b(i.children[0]);continue}if(this.__slot&&(i.setAttribute("slot",this.__slot),this.__slot=null),this.__indentTrap)if("SPAN"===i.tagName)i.parentNode===this?this.haxChangeTagName(i,"p",!0):"LI"===i.parentNode.tagName&&(i.parentNode.innerHTML=i.textContent);else if("BR"===i.tagName){i.remove();continue}if(!this.editMode||"true"!=i.getAttribute("contenteditable")&&!0!==i.getAttribute("contenteditable")&&"contenteditable"!=i.getAttribute("contenteditable")||this.__applyNodeEditableState(i,!this.editMode),this.__applyNodeEditableState(i,this.editMode),s.isGridPlateElement(i)){let e=i.querySelectorAll("*");for(var o=0;o{this.__indentTrap=!1}),0)}else this.ready&&this.editMode&&s.ready&&0===e.addedNodes.length&&e.removedNodes.length>0&&this.shadowRoot&&(1===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}).length&&"PAGE-BREAK"===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0})[0].tagName||0===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}).length)&&setTimeout((()=>{(1===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}).length&&"PAGE-BREAK"===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0})[0].tagName||0===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}).length)&&this.appendChild(document.createElement("p"))}),100)})),this.__ignoreActive&&(this.__ignoreActive=!1),s.haxTray.updateMap()})),this._observer.observe(this,{childList:!0,subtree:!0})):(this.windowControllers.abort(),this._observer.disconnect())}_haxResolvePreviousElement(e){for(e=e.previousElementSibling;null!=e&&void 0!==e.tagName&&"HAX-"===e.tagName.substring(0,4);)e=e.previousElementSibling;return e}_validElementTest(e,t=!1){return!(e.haxUIElement||!e.tagName||["TEMPLATE","HAX-BODY","FAKE-HAX-BODY-END"].includes(e.tagName))&&!(!t&&this._HTMLInlineTextDecorationTest(e)&&"HAX-BODY"!=e.parentNode)}_HTMLInlineTextDecorationTest(e){return["span","b","strong","i","em","u","strike"].includes(e.tagName.toLowerCase())}_HTMLPrimativeTest(e){return null!=e&&void 0!==e.tagName&&-1==e.tagName.indexOf("-")}_applyContentEditable(e,t=this.shadowRoot.querySelector("#body")){let i="slot"===t.localName?t.assignedNodes({flatten:!0}):[];0===i.length&&(i=t.children);for(var o=0;o{e.classList.remove("active")})),[...t.shadowRoot.querySelectorAll(".active")].forEach((e=>{e.classList.remove("active")}))}__layoutDragEnter(e){e.target.classList.add("active")}__layoutDragLeave(e){e.target.classList.remove("active")}__layoutMonitor(e){var t=N(e);t[0]&&t[0].assignedNodes&&t[0].assignedNodes().length&&t[0].parentNode&&t[0].parentNode.classList?t[0].parentNode.classList.add("has-nodes"):t[0].parentNode&&t[0].parentNode.classList&&t[0].parentNode.classList.remove("has-nodes")}__getLayoutOrder(e,t){if(!t.shadowRoot)return!1;let i=e.getAttribute("slot"),o=t.shadowRoot.querySelector(`[slot=${i}]`);return[...t.shadowRoot.querySelectorAll("[slot]")].map((e=>e.parentNode)).indexOf(o)||-1}__layoutCanMove(e,t,i){if(!t.shadowRoot)return!1;let o=t.shadowRoot.querySelector(`[slot=${slot}]`),a=[...t.shadowRoot.querySelectorAll("[slot]")].map((e=>e.parentNode)),n=(a.indexOf(o)||-1)+(i?-1:1);return n>=a[0]&&n<=a[a.length-1]}__layoutMove(e,t,i){if(!t.shadowRoot)return!1;let o=t.shadowRoot.querySelector(`[slot=${s}]`),a=[...t.shadowRoot.querySelectorAll("[slot]")].map((e=>e.parentNode)),n=a.indexOf(o)||-1,s=a[n+(i?-1:1)];s&&e.setAttribute("slot",s)}async __sortLayoutChildren(e){e.setAttribute("hax-layout-sorting",!0);try{let t=Array.prototype.reduce.call(e.querySelectorAll("[slot]"),(function(e,t){return e}),[]);t=t.sort((function(t,i){return this.__getLayoutOrder(t,e){t.parentNode===this&&e.appendChild(t)}))}catch(e){console.warn(e)}e.removeAttribute("hax-layout-sorting")}__layoutSlotValid(e,t){return this.__layoutSlots(t).includes(e.getAttribute("slot"))}__layoutSlots(e){return e.shadowRoot?[...e.shadowRoot.querySelectorAll("[slot]")].map((e=>e.getAttribute("name"))):[]}__applyDragDropState(e,t){let i={drop:t=>this.__layoutDropEvent.bind(this)(t,e),dragenter:this.__layoutDragEnter.bind(this),dragleave:this.__layoutDragEnter.bind(this),slotchange:this.__layoutMonitor.bind(this)};if(e.setAttribute("data-hax-layout",!0),s.isGridPlateElement(e)&&e.setAttribute("data-hax-grid",!0),t&&e.setAttribute("data-hax-ray",t),t&&e.shadowRoot){e.addEventListener("drop",i.drop);let t=[...e.shadowRoot.querySelectorAll("drag-enabled")],o=[...e.shadowRoot.querySelectorAll("slot")];t.forEach((e=>{e.addEventListener("dragenter",i.dragenter),e.addEventListener("dragleave",i.dragleave)})),o.forEach((e=>e.addEventListener("slotchange",i.slotchange))),e.haxLayoutObserver=new MutationObserver((t=>{e.getAttribute("hax-layout-sorting")||(t.forEach((t=>{t.addedNodes.forEach((t=>{t.tagName&&t!==this&&t.parentElement&&"HAX-BODY"!==t.parentElement.tagName&&!this.__layoutSlotValid(t,e)&&this.__layoutSlots(e).length>0&&t.setAttribute("slot",this.__layoutSlots(e)[0])}))})),this.__sortLayoutChildren(e))})),e.haxLayoutObserver.observe(this,{childList:!0})}else if(e.shadowRoot){e.haxLayoutObserver&&e.haxLayoutObserver.disconnect(),this.removeEventListener("drop",i.drop);let t=[...e.shadowRoot.querySelectorAll("drag-enabled")],o=[...e.shadowRoot.querySelectorAll("slot")];t.forEach((e=>{e.removeEventListener("dragenter",i.dragenter),e.removeEventListener("dragleave",i.dragleave)})),o.forEach((e=>e.removeEventListener("slotchange",i.slotchange))),e.removeAttribute("data-hax-ray")}}__isLayout(e){return e&&s.haxSchemaFromTag(e.tagName)&&"grid"===s.haxSchemaFromTag(e.tagName).type}__applyNodeEditableState(e,t=!0){let i;if(!e.tagName)return!1;let o=e.tagName.replace("-"," ").toLowerCase(),a=l(s.gizmoList).findIndex((t=>{if(t)return t.tag===e.tagName.toLowerCase()}));if(-1!==a&&(o=l(s.gizmoList)[a].title),"PAGE-BREAK"!==e.tagName?("IMG"==e.tagName&&e.setAttribute("draggable",!1),t?(this.__applyDragDropState(e,o),i="addEventListener"):(this.__applyDragDropState(e,!1),i="removeEventListener"),e[i]("drop",this.dropEvent.bind(this)),e[i]("dragenter",this.dragEnter.bind(this)),e[i]("dragleave",this.dragLeave.bind(this)),e[i]("dragover",(e=>{this.__dragMoving=!0,e.preventDefault()}))):t?e.setAttribute("data-hax-ray",""):e.removeAttribute("data-hax-ray"),this._HTMLPrimativeTest(e)&&(t?e.setAttribute("contenteditable",t):e.removeAttribute("contenteditable"),e.querySelectorAll("a").length>0)){let o=e.querySelectorAll("a");for(var n=0,r=o.length;n{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()}))}}undoManagerStackLogic(e){this.__dragMoving||(this.querySelectorAll(".hax-hovered").forEach((e=>{e.classList.remove("hax-hovered")})),super.undoManagerStackLogic(e))}dropEvent(e){if(this.editMode){this.__dragMoving=!1,this.undoManagerStackLogic({}),clearTimeout(A),s._lockContextPosition=!1,s.haxTray.activeTab="item-1";var t,i=null,o=N(e);if(null!==(i=e.target.closest("[data-hax-layout]")&&e.target.parentNode!=e.target.closest("[data-hax-layout]")?e.target.closest("[data-hax-layout]"):e.target.closest("[contenteditable],img")?e.target.closest("[contenteditable],img"):e.originalTarget?e.originalTarget:e.target).getAttribute("data-hax-lock"))return!1;o[0].classList.contains("column")?this.__slot=o[0].getAttribute("id").replace("col","col-"):i.getAttribute("slot")&&(this.__slot=i.getAttribute("slot")),this.querySelectorAll(".hax-hovered").forEach((e=>{e.classList.remove("hax-hovered")})),this.querySelectorAll(".active").forEach((e=>{e.classList.remove("active")})),s.activeNode=i;try{if(null===s.__dragTarget&&e.dataTransfer&&e.dataTransfer.items&&e.dataTransfer.items.length>0&&"file"===e.dataTransfer.items[0].kind){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();let i=document.createElement("p");e.target.closest("[data-hax-layout]")&&e.target.parentNode!=e.target.closest("[data-hax-layout]")?t=e.target.closest("[data-hax-layout]"):e.target.closest("[contenteditable],img")&&(t=e.target.closest("[contenteditable],img")),t&&(t.tagName&&"HAX-BODY"!==t.tagName||!t.getAttribute("data-hax-layout"))||this.__isLayout(o[0])?(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(i=s.__dragTarget,t=e.target,e.target.closest("[data-hax-layout]")&&e.target.parentNode!=e.target.closest("[data-hax-layout]")?t=e.target.closest("[data-hax-layout]"):e.target.closest("[contenteditable],img")&&(t=e.target.closest("[contenteditable],img")),t&&i&&this._validElementTest(i)&&i!==t){try{"HAX-BODY"!==t.tagName&&!this.__isLayout(t)||this.__isLayout(o[0])?(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-")):"HAX-BODY"===t.tagName&&i.getAttribute("slot")&&i.removeAttribute("slot"),t.appendChild(i))}catch(e){console.warn(e)}e.preventDefault(),e.stopPropagation()}i&&this._validElementTest(i)&&"function"==typeof i.focus&&(s.activeNode=i,s.testHook(s.activeNode,"trayDragNDropToNode")&&s.runHook(s.activeNode,"trayDragNDropToNode",[s.activeNode]),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)}}s.__dragTarget=null,this.__manageFakeEndCap(!1)}dragEnter(e){this.editMode&&e.target&&s.__dragTarget&&(this.__dragMoving=!0,e.preventDefault(),e.target&&e.target.classList&&e.target.classList.add("hax-hovered"),this.handleMousemove(e))}handleMousemove(e){var t=e.clientX,i=e.clientY,o=document.documentElement.clientWidth,a=document.documentElement.clientHeight,n=w,s=w,r=a-w,l=o-w,d=t<200,c=t>l,h=i<200,u=i>r;if(d||c||h||u){var m=Math.max(document.body.scrollWidth,document.body.offsetWidth,document.body.clientWidth,document.documentElement.scrollWidth,document.documentElement.offsetWidth,document.documentElement.clientWidth),g=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.body.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight,document.documentElement.clientHeight),p=m-o,v=g-a;!function checkForWindowScroll(){clearTimeout(A),function adjustWindowScroll(){var e=window.pageXOffset,o=window.pageYOffset,a=o>0,m=o0,b=ee[i]=t[i])),e.removeAttribute("data-grid-saved-settings")}}setSlotEditMode(e,t,i){let o=e.getAttribute("data-grid-saved-settings")?JSON.parse(e.getAttribute("data-grid-saved-settings")):{},a=Object.keys(o);Object.keys(t||{}).forEach((i=>{a.includes(i)||(o[i]=e[i]),e[i]=t[i]})),e.setAttribute("data-grid-saved-settings",JSON.stringify(o))}async _activeNodeChanged(e,t){if(window.SimplePopoverManager.requestAvailability().opened=!1,this.contextMenus.plate.disableDuplicate=!1,this.contextMenus.plate.disableOps=!1,this.contextMenus.plate.disableItemOps=!1,this.contextMenus.plate.canMoveElement=this.canMoveElement,setTimeout((()=>{this.prevKeyActiveNode=null}),5),t&&t.removeAttribute("data-hax-active"),e&&e.setAttribute("data-hax-active","data-hax-active"),e&&t&&s.isGridPlateElement(e)&&(this.__ignoreActive=!0),this.editMode&&null!=e&&e.parentNode&&e.tagName){let t=e.tagName.toLowerCase();(s.isTextElement(e)||"HR"===e.tagName||s.isGridPlateElement(e))&&null===e.getAttribute("data-hax-lock")&&null===e.parentNode.getAttribute("data-hax-lock")?(e.setAttribute("contenteditable",!0),this.setAttribute("contenteditable",!0)):(e.removeAttribute("contenteditable"),this.removeAttribute("contenteditable")),this._keepContextVisible(),this.contextMenus.text.realSelectedValue=t}else null===e&&(this.hideContextMenus(),this.__oldActiveNode=t);if(this.editMode&&await s.runHook(t,"activeElementChanged",[t,!1])&&(this.__ignoreActive=!0),this.editMode&&await s.runHook(e,"activeElementChanged",[e,!0])&&(this.__ignoreActive=!0),this.editMode&&t&&t.tagName){let e=s.haxSchemaFromTag(t.tagName.toLowerCase());if("core"!=e.editingElement||t.parentNode&&t.parentNode.haxUIElement&&t.parentNode===s.activeEditingElement){this.__ignoreActive=!0;let o=await s.runHook(t.parentNode,"activeElementChanged",[t,!1]);if(o&&o!==t){if(t&&t.getAttribute&&null!=t.getAttribute("slot")&&o.setAttribute("slot",t.getAttribute("slot")),e.saveOptions&&e.saveOptions.unsetAttributes&&e.saveOptions.unsetAttributes.length)for(var i in e.saveOptions.unsetAttributes)o.removeAttribute(e.saveOptions.unsetAttributes[i]);this.__applyNodeEditableState(o,this.editMode)}b(s.activeEditingElement),s.activeEditingElement=null}}if(this.editMode&&e){let t=s.haxSchemaFromTag(e.tagName);if(t&&t.editingElement&&"core"!=t.editingElement){if(t.editingElement.import){let e=new URL("./hax-body.js",import.meta.url).href+"/../../../";window.WCGlobalBasePath&&(e=window.WCGlobalBasePath),await import(`${e}${t.editingElement.import}`)}s.activeEditingElement=document.createElement(t.editingElement.tag),e.getAttribute&&null!=e.getAttribute("slot")&&s.activeEditingElement.setAttribute("slot",e.getAttribute("slot")),t.editingElement.callback&&t.editingElement.callback(s.activeEditingElement),this.__ignoreActive=!0,v(e,s.activeEditingElement),await s.runHook(s.activeEditingElement,"activeElementChanged",[e,!0])}}!t||!t.parentNode||e&&e.parentNode&&e.parentNode===t.parentNode||this.unsetSlotEditMode(t.parentNode),this.unsetElementEditMode(t)}_getPosition(e){return{x:e.offsetLeft-e.scrollLeft+e.clientLeft,y:e.offsetTop-e.scrollTop+e.clientTop}}_showContextMenu(e){e.setAttribute("on-screen","on-screen"),e.classList.add("hax-context-visible","hax-context-menu-active")}_getContextContainer(e){let t=e&&e.parentNode?e.parentNode:void 0;return t&&t.nodeType?1==t.nodeType?t:t.host:void 0}_hideContextMenu(e){e&&(e.removeAttribute("on-screen"),e.classList.remove("hax-context-visible"),e.classList.remove("hax-context-menu-active"))}_tabKeyPressed(){if(this.activeNode&&s.getRange().cloneRange)try{let t=!1,i=this.activeNode.parentNode;const o=this.activeNode.parentNode.tagName;let a=s.getRange().cloneRange();var e=a.commonAncestorContainer.tagName;if(void 0===e&&(e=a.commonAncestorContainer.parentNode.tagName),["UL","OL","LI"].includes(o)||["UL","OL","LI"].includes(e))this.polyfillSafe&&(this.__tabTrap=!0,this.__indentTrap=!0,document.execCommand("indent"));else for(;!t;)null==i.nextSibling?t=!0:"function"===i.nextSibling.focus?(i.nextSibling.focus(),t=!0):i=i.nextSibling}catch(e){console.warn(e)}}_tabBackKeyPressed(){if(this.activeNode&&s.getRange().cloneRange)try{let t=this.activeNode.parentNode;const i=this.activeNode.parentNode.tagName;let o=s.getRange().cloneRange();var e=o.commonAncestorContainer.tagName;if(void 0===e&&(e=o.commonAncestorContainer.parentNode.tagName),["UL","OL","LI"].includes(i)||["UL","OL","LI"].includes(e))this.polyfillSafe&&(this.__tabTrap=!0,this.__indentTrap=!0,document.execCommand("outdent"));else{if(null!=t)for(;null!=t&&!this._validElementTest(t);)t=t.previousSibling;null!=t&&setTimeout((()=>{t.focus()}),50)}}catch(e){console.warn(e)}}}customElements.define(HaxBody.tag,HaxBody);export{HaxBody}; \ No newline at end of file + `),e}firstUpdated(e){i(this.HAXBODYStyleSheetContent(),this.shadowRoot.querySelector("#hax-body-style-element")),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"),parent:this.shadowRoot.querySelector("#topcontext")},this.shadowRoot.querySelector("slot").addEventListener("mouseup",(e=>{this.editMode&&setTimeout((()=>{const e=s.getSelection();s._tmpSelection=e,s.haxSelectedText=e.toString();try{const e=s.getRange();e.cloneRange&&(s._tmpRange=e.cloneRange())}catch(e){console.warn(e)}}),10)})),this.editMode=s.editMode,this.__tabTrap=!1,this.ready=!0,super.firstUpdated&&super.firstUpdated(e)}async updated(e){super.updated&&super.updated(e),e.forEach((async(e,t)=>{"editMode"==t&&void 0!==e&&setTimeout((async()=>{this.__ignoreActive=!0,await this._editModeChanged(this[t],e),setTimeout((()=>{this.__ignoreActive=!1}),100)}),0),"_useristyping"==t&&this[t]&&this.hideContextMenus(),"activeNode"==t&&this.ready&&void 0!==e&&await this._activeNodeChanged(this[t],e)}))}_toggleNodeLocking(e){e.detail.lock?(this.contextMenus.plate.disableDuplicate=!0,this.contextMenus.plate.disableOps=!0,this.contextMenus.plate.disableItemOps=!0,this.contextMenus.plate.canMoveElement=!1,e.detail.node.removeAttribute("contenteditable"),this.removeAttribute("contenteditable")):(this.contextMenus.plate.disableDuplicate=!1,this.contextMenus.plate.disableOps=!1,this.contextMenus.plate.disableItemOps=!1,this.contextMenus.plate.canMoveElement=this.canMoveElement,e.detail.node.setAttribute("contenteditable",!0),this.setAttribute("contenteditable",!0)),this.requestUpdate()}_keepContextVisible(e=null){this.editMode&&(clearTimeout(this.__contextVisibleLock),this.__contextVisibleLock=setTimeout((()=>{let e=!1;this.contextMenus.plate.classList.contains("hax-context-visible")&&(e=this.contextMenus.plate),e&&this.positionContextMenus()}),100))}_onKeyUp(e){if(["ArrowUp","ArrowDown"].includes(e.key)&&this.activeNode&&s.isTextElement(this.activeNode)&&!E.opened){let t=e.key;if(this[`timesClicked${t}`]++,this[`timesClicked${t}`]>=2&&this.activeNode===this.prevKeyActiveNode)if("ArrowUp"===t){if(this.activeNode.previousElementSibling&&"PAGE-BREAK"===this.activeNode.previousElementSibling.tagName)this.haxInsert("p","",{},this.activeNode.previousElementSibling);else if(this.activeNode.parentNode!==this&&this.activeNode.parentNode.previousElementSibling&&"PAGE-BREAK"===this.activeNode.parentNode.previousElementSibling.tagName)this.haxInsert("p","",{},this.activeNode.parentNode.previousElementSibling);else if(!this.activeNode.previousElementSibling&&this.activeNode.parentNode===this){let e=document.createElement("p");this.insertBefore(e,this.activeNode)}}else this.activeNode.nextElementSibling||this.children[this.children.length-1]!==this.activeNode?this.activeNode.parentNode&&this.activeNode.parentNode!==this&&!this.activeNode.parentNode.nextElementSibling&&this.children[this.children.length-1]===this.activeNode.parentNode&&this.haxInsert("p","",{},this.activeNode.parentNode):this.haxInsert("p","",{}),this[`timesClicked${t}`]=0,this.prevKeyActiveNode=null;else this.prevKeyActiveNode=this.activeNode;setTimeout((()=>{this[`timesClicked${t}`]=0,this.prevKeyActiveNode=null}),200)}}_onKeyDown(e){if(this.editMode&&"HAX-TRAY"!==document.activeElement.tagName&&"BODY"!==document.activeElement.tagName&&"SIMPLE-MODAL"!==document.activeElement.tagName&&this.getAttribute("contenteditable")){if(this.__dropActiveVisible(),this.__manageFakeEndCap(!1),null!=s.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":this._useristyping=!0,s.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._useristyping=!0,this.activeNode&&(this.__slot=this.activeNode.getAttribute("slot")),this.activeNode&&"P"===this.activeNode.tagName&&["1","#","`",">","-"].includes(this.activeNode.textContent[0])){const e=this.activeNode.textContent.replaceAll(/ /g," ");this.keyboardShortCutProcess(e)}break;case"Backspace":case"Delete":this.activeNode&&""==this.activeNode.textContent&&this.activeNode.previousElementSibling&&this.activeNode.previousElementSibling.tagName&&(["TABLE","EDITABLE-TABLE","IFRAME-LOADER","IFRAME","WEBVIEW"].includes(this.activeNode.previousElementSibling.tagName)||"PAGE-BREAK"===this.activeNode.previousElementSibling.tagName&&2===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}).length&&this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0})[1]===this.activeNode)&&e.preventDefault(),this._useristyping=!0,this.__delHit=!0,this.querySelectorAll("[data-hax-active]").forEach((e=>e.classList.remove)),setTimeout((()=>{const e=s.getSelection();s._tmpSelection=e,s.haxSelectedText=e.toString();const t=s.getRange();t.commonAncestorContainer&&this.activeNode!==t.commonAncestorContainer&&"function"==typeof t.commonAncestorContainer.focus?"HAX-BODY"!==t.commonAncestorContainer.tagName&&this.__focusLogic(t.commonAncestorContainer,!1):t.commonAncestorContainer&&t.commonAncestorContainer.parentNode&&this.activeNode!==t.commonAncestorContainer.parentNode&&"function"==typeof t.commonAncestorContainer.parentNode.focus&&("HAX-BODY"!==t.commonAncestorContainer.parentNode.tagName?this.__focusLogic(t.commonAncestorContainer.parentNode,!1):this.__focusLogic(t.commonAncestorContainer,!1))}),100);break;case"Escape":this._useristyping=!0;break;case"/":const t=s.getRange();this.activeNode&&s.isTextElement(this.activeNode)&&""==t.commonAncestorContainer.textContent.trim()&&(e.preventDefault(),E.mini=!0,E.activeRange=t,E.activeSelection=s.getSelection(),E.activeNode=t.commonAncestorContainer,E.runProgram(t.commonAncestorContainer.textContent.trim(),"*"),E.open());break;case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":this._useristyping=!0,this.querySelectorAll("[data-hax-active]").forEach((e=>e.classList.remove)),setTimeout((()=>{const e=s.getSelection();s._tmpSelection=e,s.haxSelectedText=e.toString();const t=s.getRange();t.commonAncestorContainer&&this.activeNode!==t.commonAncestorContainer&&"function"==typeof t.commonAncestorContainer.focus?"HAX-BODY"!==t.commonAncestorContainer.tagName&&this.__focusLogic(t.commonAncestorContainer,!1):t.commonAncestorContainer&&t.commonAncestorContainer.parentNode&&this.activeNode!==t.commonAncestorContainer.parentNode&&"function"==typeof t.commonAncestorContainer.parentNode.focus&&("HAX-BODY"!==t.commonAncestorContainer.parentNode.tagName?this.__focusLogic(t.commonAncestorContainer.parentNode,!1):this.__focusLogic(t.commonAncestorContainer,!1))}),0);break;default:this._useristyping=!0,setTimeout((()=>{if(this.activeNode&&"P"===this.activeNode.tagName&&["1","#","`",">","-"].includes(this.activeNode.textContent[0])){const e=this.activeNode.textContent.replaceAll(/ /g," ");" "===e[e.length-1]&&this.keyboardShortCutProcess(e)}}),0)}}}keyboardShortCutProcess(e){if(s.keyboardShortcuts[e.replace(" ","")]){let t=m(s.keyboardShortcuts[e.replace(" ","")]);this.haxReplaceNode(this.activeNode,t),this.__focusLogic(t),"HR"===t.tagName&&this.haxInsert("p","",{})}}setActiveNode(e,t=!1){e&&this.editMode&&this.activeNode&&(s.isTextElement(this.activeNode)||t)&&(s.activeNode=e,clearTimeout(this.__positionContextTimer),this.__positionContextTimer=setTimeout((()=>{this.__addActiveVisible(),this.positionContextMenus()}),2e3))}elementMidViewport(){const e=this.activeNode.getBoundingClientRect().y;return e<0&&e>-1*this.activeNode.offsetHeight+140}replacePlaceholder(e){if("text"===e.detail){let e=document.createElement("p");this.haxReplaceNode(this.activeNode,e),this.__focusLogic(e),this.activeNode.parentNode&&this.activeNode.parentNode.setAttribute("contenteditable",!0)}else this.replaceElementWorkflow()}async canTansformNode(e=null){return await this.replaceElementWorkflow(e,!0).length>0}async insertElementWorkflow(e=null,t=!1){}get primitiveTextBlocks(){return["p","div","pre","h1","h2","h3","h4","h5","h6"]}getAllSlotConfig(e){if(!e)return;let t=this.getParentGrid(e);return t&&t.tag?this.getSlotConfig(s.elementList[t.tag],slot):void 0}getParentGrid(e){return((e=e||this.activeNode)?e.slot:void 0)?u(e.parentNode):void 0}getSlotConfig(e="",t={}){let i=t.settings,o=i?Object.keys(i||{}).map((t=>i[t].filter((t=>!(!t.slot||e&&t.slot!==e))))).flat():void 0;return o&&o.length>0?o[0]:void 0}async replaceElementWorkflow(e=null,t=!1){null==e&&(e=this.activeNode);let i=await u(e,null);if(!i)return;let o=!1,a=(e||{}).slot,n=this.getParentGrid(e);this.primitiveTextBlocks.includes(i.tag)&&(o=!0);var r=i.content?{innerHTML:i.content}:{};if(void 0!==s.elementList[i.tag]&&!1!==s.elementList[i.tag].gizmo&&void 0!==s.elementList[i.tag].gizmo.handles&&s.elementList[i.tag].gizmo.handles.length>0){let e=s.elementList[i.tag].gizmo;for(var l=0;l!m.includes(e.tag)&&(!g||g.includes(e.tag))))),c.length>0){let i=e.tagName.toLowerCase(),o=i.replace("-"," ");void 0!==s.elementList[i]&&!1!==s.elementList[i].gizmo&&(o=s.elementList[i].gizmo.title),t||(s.activePlaceHolder=this.activeNode,s.haxAppPicker.presentOptions(c,"__convert",`Change ${o} to...`,"gizmo"))}else t||s.toast("Sorry, this can not be transformed!",5e3);return c}haxClearBody(e=!0){let t=!0;e&&(t=prompt("Are you sure you want to delete all content?")),t&&c(this)}haxInsert(e,t,i={},o=this.activeNode,a=!1){var n=document.createElement(e);n.innerHTML=t;const r=n.cloneNode(!0);for(var l in i){let e=g(l);""!=e&&i.hasOwnProperty(l)&&(!0===i[l]?r.setAttribute(e,e):!1===i[l]?r.removeAttribute(e):null!=i[l]&&i[l].constructor===Array||null!=i[l]&&i[l].constructor===Object?r.properties&&r.properties[l].readOnly||(r.set?r.set(e,i[l]):r[e]=i[l]):r.setAttribute(e,i[l]))}return null!==s.activePlaceHolder&&void 0!==s.activePlaceHolder.style?(r.style.width=s.activePlaceHolder.style.width,r.style.float=s.activePlaceHolder.style.float,r.style.margin=s.activePlaceHolder.style.margin,r.style.display=s.activePlaceHolder.style.display,this.haxReplaceNode(s.activePlaceHolder,r),s.activePlaceHolder=null):o&&o.parentNode?this.__isLayout(o.parentNode)?(null!=o.getAttribute("slot")&&r.setAttribute("slot",o.getAttribute("slot")),this.__addAbove?o.parentNode.insertBefore(r,o):o.parentNode.insertBefore(r,o.nextElementSibling)):o.parentNode&&o.parentNode.nextElementSibling?o.parentNode.nextElementSibling.parentNode.insertBefore(r,o.parentNode.nextElementSibling):o.parentNode&&o.nextElementSibling?this.__addAbove?o.parentNode.insertBefore(r,o):o.parentNode.insertBefore(r,o.nextElementSibling):o.parentNode&&o.parentNode.children[o.parentNode.children.length-1]===o?this.__addAbove?o.parentNode.insertBefore(r,o):o.parentNode.appendChild(r):o.parentNode?o.parentNode.insertBefore(r,o):this.appendChild(r):this.appendChild(r),this.contextMenus.text.hasSelectedText=!1,setTimeout((()=>{this.__focusLogic(r),this.scrollHere(r)}),0),r}async haxToContent(){this.hideContextMenus();var e=this.activeNode;s.activeNode=null;let t="slot"===this.shadowRoot.querySelector("#body").localName?this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}):[];for(var i="",o=0;o{if(!s._lockContextPosition){let t=e.tagName.toLowerCase();s._isSandboxed&&"webview"===t&&(t="iframe"),e&&"PAGE-BREAK"!==e.tagName?this._showContextMenu(this.contextMenus.plate):this._hideContextMenu(this.contextMenus.plate);let i=s.elementList[t];void 0===i||s.isTextElement(e)?this._showContextMenu(this.contextMenus.text):(this._hideContextMenu(this.contextMenus.text),i.element=e);(i||{}).gizmo;let o=i&&i.gizmo&&(i.gizmo.handles||[]).filter((e=>"inline"===(e||{}).type)).length>0;i&&"core"!=i.editingElement?setTimeout((()=>{(e&&e.parentNode||!o)&&(this.canMoveElement=!0)}),250):this.activeNode&&("LI"===this.activeNode.tagName||this._HTMLInlineTextDecorationTest(this.activeNode))?this.canMoveElement=!1:this.canMoveElement=!0}this.contextMenus.parent.setPosition()}),50)}}__addActiveVisible(){for(var e in this.contextMenus)("add"!=e||this.__activeHover)&&this.contextMenus[e].classList.add("hax-context-menu-active")}__dropActiveVisible(){for(var e in this.contextMenus)this.contextMenus[e].classList.remove("hax-context-menu-active");this.__activeHover=null}haxMoveGridPlate(e,t=1){this.___moveLock=!0;let i=e?e.parentNode:void 0,o=t>0?e.nextElementSibling:e.previousElementSibling,a=this.__layoutSlots(i)||[],n=e.getAttribute("slot"),r=n?a.indexOf(n):-1,l=a[r+t];!o||n&&o.getAttribute("slot");return!o||n&&n!==o.getAttribute("slot")?l?e.setAttribute("slot",l):e&&i&&i!==this&&(o=t>0?i.nextElementSibling:i,l=i.getAttribute("slot"),o&&(i.parentNode.insertBefore(e,o),l&&e.setAttribute("slot",l))):i.insertBefore(e,t>0?o.nextElementSibling:o),setTimeout((()=>{s.activeNode=e,this.scrollHere(e),this.__focusLogic(e)}),100),!0}async haxGridPlateOps(e=!0,t="right",i=this.activeNode){"GRID-PLATE"!==i.tagName&&"GRID-PLATE"===i.parentNode.tagName&&(i=i.parentNode);let o=!1;if("GRID-PLATE"===i.tagName){if(e)switch(i.layout){case"2-1":case"3-1":i.layout="2-1-1",o=!0;break;case"1-2":i.layout="1-2-1",o=!0;break;case"1-3":i.layout="1-1-2",o=!0;break;case"2-1-1":case"1-2-1":case"1-1-2":case"1-1-1":i.layout="1-1-1-1",o=!0;break;case"1":i.layout="1-1",o=!0;break;case"1-1":i.layout="1-1-1",o=!0}else switch(i.layout){case"2-1":case"1-2":case"1-3":case"3-1":case"1-1":case"1":let e;await i.childNodes.forEach((t=>{t.tagName&&(e=t.cloneNode(!0),i.getAttribute("slot")?e.setAttribute("slot",i.getAttribute("slot")):e.removeAttribute("slot"),i.parentNode.insertBefore(e,i))})),s.activeNode=e,setTimeout((()=>{i.remove()}),0),o=!0;break;case"1-1-1":i.layout="1-1",o=!0;break;case"1-1-1-1":i.layout="1-1-1",o=!0;break;case"2-1-1":i.layout="2-1",o=!0;break;case"1-2-1":case"1-1-2":i.layout="1-2",o=!0}if(o){let e=this.contextMenus.plate.shadowRoot.querySelector("#right"),o=this.contextMenus.plate.shadowRoot.querySelector("#rightremove");e.disabled=!1,o.disabled=!1,"1-1-1-1"==i.layout&&(e.disabled=!0),"left"==t&&i.childNodes.forEach((e=>{if(e.tagName){let t=parseInt(e.getAttribute("slot").replace("col-",""),10)+1;e.setAttribute("slot",`col-${t}`)}}))}}else{let e=document.createElement("grid-plate");e.layout="1-2-1",e.disableResponsive=!0,i.getAttribute("slot")&&e.setAttribute("slot",i.getAttribute("slot"));let t=i.cloneNode(!0);t.setAttribute("slot","col-2"),e.appendChild(t),i.parentNode.insertBefore(e,i),setTimeout((()=>{i.remove()}),0)}await s.refreshActiveNodeForm()}haxReplaceNode(e,t){try{null==e&&(e=this.__oldActiveNode),!e.replaceWith&&s._tmpRange&&(e=s._tmpRange,s._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}haxChangeTagName(e,t,i=!0){for(var o=document.createElement(t),a=0,n=e.attributes.length;a"==o.innerHTML?o.innerHTML="

        • ":"ul"!=e.tagName.toLowerCase()&&"ol"!=e.tagName.toLowerCase()&&(o.innerHTML="
        • "+e.innerHTML.trim().replace(//g,"
        • \n
        • ").replace(/
          /g,"
        • \n
        • ")+"
        • "):"ul"!=e.tagName.toLowerCase()&&"ol"!=e.tagName.toLowerCase()||(o.innerHTML=o.innerHTML.replace(/
            /g,"").replace(/<\/ul>/g,"").replace(/
          • <\/li>/g,"").replace(/
          • /g,"").replace(/<\/li>/g,"
            "));try{e.replaceWith(o),i&&setTimeout((()=>{let 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}haxDeleteNode(e){if(e.previousElementSibling)s.activeNode=e.previousElementSibling;else if(e.nextElementSibling)s.activeNode=e.nextElementSibling;else{this.haxInsert("p","",{});try{var t=document.createRange(),i=s.getSelection();t.setStart(this.activeNode,0),t.collapse(!0),i.removeAllRanges(),i.addRange(t),this.activeNode.focus()}catch(e){console.warn(e)}}try{return e.remove()}catch(e){console.warn(e)}}importContent(e,t=!0){t&&c(this,"*"),setTimeout((()=>{e=d(e);let t=document.createElement("div");for(t.insertAdjacentHTML("beforeend",e);null!==t.firstChild;)if(void 0!==t.firstChild.tagName)if(s._isSandboxed&&"iframe"===t.firstChild.tagName.toLowerCase()){for(var i=document.createElement("webview"),o=0,a=t.firstChild.attributes.length;o`col-${t}`)):s.slotsFromSchema(t).map((e=>e.slot))).reverse().forEach(((t,i)=>{0==i?e.querySelectorAll(`[slot=${t}]`).forEach((t=>e.append(t))):[...e.querySelectorAll(`[slot=${t}]`)].reverse().forEach((t=>e.insertBefore(t,e.firstChild)))}))}async _haxContextOperation(e){let t=e.detail,i=N(e),o=i&&i[0]?i[0].getAttribute("data-slot"):void 0;switch(t.eventName){case"insert-above-active":if(this.activeNode&&this.activeNode.previousElementSibling)this.haxInsert("p","",{},this.activeNode.previousElementSibling);else if(this.activeNode){let e=document.createElement("p");this.activeNode.getAttribute("slot")&&e.setAttribute("slot",this.activeNode.getAttribute("slot")),this.activeNode.parentNode.insertBefore(e,this.activeNode)}else this.appendChild(p);break;case"insert-below-active":this.haxInsert("p","",{});break;case"move-to-slot":o&&this.activeNode&&s.isGridPlateElement(this.activeNode.parentNode)&&(this.activeNode.slot=o,this.sortGridSlots(this.activeNode.parentNode));break;case"insert-into-active":if(o&&this.activeNode&&s.isGridPlateElement(this.activeNode)){let e=document.createElement("p");e.slot=o,this.activeNode.append(e),this.haxInsert("p","",{slot:o},e),e.remove(),this.sortGridSlots()}break;case"hax-select-grid":if(i[0]&&i[0].eventData){let e=i[0].eventData;this.setActiveNode(e,!0),this.positionContextMenus(e)}break;case"hax-select-grid-item":if(i[0]&&i[0].eventData){let e=i[0].eventData,t=e.target,o=e.slot,a=e.index,n=e.grid,s=e.editMode,r=e.invisible?n:[...n.children].filter((e=>o&&""!==o?e.slot===o:!e.slot||""===e.slot))[a]||t;n&&s?this.setSlotEditMode(n,s,r):(this.setActiveNode(node,!0),this.positionContextMenus(node))}break;case"hax-edit-element-toggle":if(i[0]&&i[0].eventData){let e=i[0].eventData;e&&e.target&&e.editMode&&this.toggleElementEditMode(e.target,e.editMode)}break;case"hax-source-view-toggle":if(this.activeNode.__haxSourceView){this.activeNode.__haxSourceView=!1;let e=await s.runHook(s.activeEditingElement,"activeElementChanged",[this.activeNode,!1]),t={};if(this.activeNode&&this.activeNode.tagName?t=s.haxSchemaFromTag(this.activeNode.tagName.toLowerCase()):this.activeNode.parentElement&&this.activeNode.parentElement.tagName&&(t=s.haxSchemaFromTag(this.activeNode.parentElement.tagName.toLowerCase())),this.activeNode&&this.activeNode.getAttribute&&null!=this.activeNode.getAttribute("slot")&&e.setAttribute("slot",this.activeNode.getAttribute("slot")),t.saveOptions&&t.saveOptions.unsetAttributes&&t.saveOptions.unsetAttributes.length)for(var a in t.saveOptions.unsetAttributes)e.removeAttribute(t.saveOptions.unsetAttributes[a]);this.__applyNodeEditableState(e,this.editMode),b(s.activeEditingElement),s.activeEditingElement=null,this.viewSourceToggle=!1}else this.activeNode.__haxSourceView=!0,s.activeEditingElement=document.createElement("code-editor"),s.activeEditingElement.language="html",s.activeEditingElement.title="",s.activeEditingElement.theme="vs",s.activeEditingElement.fontSize=12,s.activeEditingElement.wordWrap=!0,this.viewSourceToggle=!0,import("../code-editor/code-editor.js"),this.activeNode.getAttribute&&null!=this.activeNode.getAttribute("slot")&&s.activeEditingElement.setAttribute("slot",this.activeNode.getAttribute("slot")),this.__ignoreActive=!0,this.activeNode.removeAttribute("contenteditable"),this.__applyDragDropState(this.activeNode,!1),this.activeNode.removeAttribute("data-hax-active"),s.testHook(this.activeNode,"preProcessNodeToContent")&&(s.activeNode=await s.runHook(this.activeNode,"preProcessNodeToContent",[this.activeNode])),v(this.activeNode,s.activeEditingElement),s.activeEditingElement.focus();break;case"hax-full-text-editor-toggle":if(this.activeNode.__haxSourceView){this.activeNode.__haxSourceView=!1;let e=await s.runHook(s.activeEditingElement,"activeElementChanged",[this.activeNode,!1]),t=s.haxSchemaFromTag(this.activeNode.tagName.toLowerCase());if(this.activeNode&&this.activeNode.getAttribute&&null!=this.activeNode.getAttribute("slot")&&e.setAttribute("slot",this.activeNode.getAttribute("slot")),t.saveOptions&&t.saveOptions.unsetAttributes&&t.saveOptions.unsetAttributes.length)for(var a in t.saveOptions.unsetAttributes)e.removeAttribute(t.saveOptions.unsetAttributes[a]);this.__applyNodeEditableState(e,this.editMode),b(s.activeEditingElement),s.activeEditingElement=null,this.viewSourceElement=s.activeEditingElement}else this.activeNode.__haxSourceView=!0,import("../rich-text-editor/rich-text-editor.js").then((()=>{s.activeEditingElement=document.createElement("rich-text-editor"),s.activeEditingElement.type="rich-text-editor-toolbar-full",this.activeNode.getAttribute&&null!=this.activeNode.getAttribute("slot")&&s.activeEditingElement.setAttribute("slot",this.activeNode.getAttribute("slot")),this.__ignoreActive=!0,this.activeNode.removeAttribute("contenteditable"),this.__applyDragDropState(this.activeNode,!1),this.activeNode.removeAttribute("data-hax-active"),v(this.activeNode,s.activeEditingElement),this.viewSourceElement=s.activeEditingElement}));break;case"text-tag":s.activeNode=this.haxChangeTagName(this.activeNode,t.value),this.positionContextMenus();break;case"text-tag-ul":this.contextMenus.text.realSelectedValue="ul",s.activeNode=this.haxChangeTagName(this.activeNode,"ul"),this.positionContextMenus();break;case"text-tag-ol":this.contextMenus.text.realSelectedValue="ol",s.activeNode=this.haxChangeTagName(this.activeNode,"ol"),this.positionContextMenus();break;case"hax-transform-node":this.replaceElementWorkflow();break;case"hax-plate-create-right":this.haxGridPlateOps();break;case"hax-plate-remove-right":this.haxGridPlateOps(!1);break;case"hax-plate-duplicate":this.haxDuplicateNode(this.activeNode);break;case"hax-plate-delete":null!=this.activeNode&&this.haxDeleteNode(this.activeNode);break;case"hax-plate-up":this.activeNode.previousElementSibling&&"PAGE-BREAK"!==this.activeNode.previousElementSibling.tagName&&this.haxMoveGridPlate(this.activeNode,-1);break;case"hax-plate-down":this.activeNode.nextElementSibling&&this.haxMoveGridPlate(this.activeNode);break;case"content-edit":"content-edit"===s.haxTray.trayDetail&&(s.haxTray.collapsed=!1),s.haxTray.trayDetail="content-edit";break;case"super-daemon":const e=s.getRange();E.mini=!0,E.activeRange=e,E.activeSelection=s.getSelection();let n=this.activeNode;e.commonAncestorContainer.tagName?n=e.commonAncestorContainer:e.commonAncestorContainer.parentNode&&e.commonAncestorContainer.parentNode.tagName&&(n=e.commonAncestorContainer.parentNode),E.activeNode=n,E.runProgram(n.textContent.trim(),"*"),E.open();break;case"hide-context-menus":this.hideContextMenus()}}_focusIn(e){this.__mouseDown||this.__focusLogic(e.target)&&(e.stopPropagation(),e.stopImmediatePropagation())}__focusLogic(e,t=!0){let i=!1;if(this.editMode&&!this.__tabTrap){let o=e;("SPAN"===o.tagName&&s.isTextElement(o.parentNode)&&""==o.parentNode.getAttribute("slot")||"LI"===o.tagName&&s.isTextElement(o.parentNode)&&["UL","OL"].includes(o.parentNode.tagName))&&(o=e.parentNode);let a=null;if(this._validElementTest(o)&&o.parentNode&&o.parentNode.tagName){if("P"===o.parentNode.tagName&&""==o.parentNode.getAttribute("slot"))a=o,i=!0;else{for(;o.parentNode&&o.parentNode.tagName&&"HAX-BODY"!=o.parentNode.tagName;)null===a&&"B"!==o.tagName&&"I"!==o.tagName&&"STRONG"!==o.tagName&&"EM"!==o.tagName&&(a=o),o=o.parentNode;null===a?a=o:s.isGridPlateElement(o)}(this.activeNode&&this.activeNode.parentNode!==o&&!o.classList.contains("ignore-activation")||o.haxUIElement||o.classList.contains("ignore-activation"))&&(i=!0),a.haxUIElement||a.classList.contains("ignore-activation")||(s.activeNode=a,setTimeout((()=>{if(t&&!this.__mouseDown&&s.isTextElement(a))try{var e=document.createRange(),i=s.getSelection();e.setStart(this.activeNode,0),e.collapse(!0),i.removeAllRanges(),i.addRange(e),this.activeNode.focus()}catch(e){console.warn(e)}this.positionContextMenus(a)}),0),i=!0)}}else this.__tabTrap=!1;return i}scrollHere(e){setTimeout((()=>{e.scrollIntoView({behavior:"smooth",inline:"nearest",block:"end"})}),100)}undo(){super.undo(),setTimeout((()=>{let e=this.querySelector("[data-hax-active]");e?(this.__focusLogic(e),this.scrollHere(e)):this.hideContextMenus()}),0)}redo(){super.redo(),setTimeout((()=>{let e=this.querySelector("[data-hax-active]");e?(this.__focusLogic(e),this.scrollHere(e)):this.hideContextMenus()}),0)}async _editModeChanged(e,t){if(void 0!==t){if(this._applyContentEditable(e),e){if(this.children&&this.children[0]&&this.children[0].focus&&this.children[0].tagName)"PAGE-BREAK"===this.children[0].tagName&&this.children[1]&&this.children[1].focus?this.__focusLogic(this.children[1]):"PAGE-BREAK"===this.children[0].tagName?this.haxInsert("p","",{}):this.__focusLogic(this.children[0]);else{this.haxInsert("p","",{});try{var i=document.createRange(),o=s.getSelection();i.setStart(this.activeNode,0),i.collapse(!0),o.removeAllRanges(),o.addRange(i),this.activeNode.focus()}catch(e){console.warn(e)}}this._haxContextOperation({detail:{eventName:"content-edit",value:!0}})}else this.activeNode&&(this.unsetSlotEditMode(this.activeNode),this.unsetElementEditMode(this.activeNode));setTimeout((()=>{this.undoStack.undoStackLimit=50,this.undoStack.undoStackPosition=-1,this.undoStack.commands=[],this.undoStack.changed(),this.undoStackInitialValue=this.innerHTML,this.undoStackPrevValue=this.undoStackInitialValue}),0)}if(0==e){b(s.activeEditingElement),s.activeEditingElement=null,this.removeAttribute("contenteditable"),this.hideContextMenus();let e=this.querySelectorAll("[contenteditable],[data-hax-active]");for(var a=0;a{var t=!1;this.__ignoreActive||this.__dragMoving||this.undoStackIgnore||this.__fakeEndCap||!this.ready||!this.editMode||!this.shadowRoot?this.undoStackIgnore&&e.forEach((e=>{e.addedNodes.length>0&&e.addedNodes.forEach((e=>{this._validElementTest(e,!0)&&setTimeout((()=>{this.__applyNodeEditableState(e,this.editMode)}),0)}))})):e.forEach((e=>{if(e.removedNodes.length>0)for(var i of e.removedNodes)e.previousSibling&&this.activeNode;if(e.addedNodes.length>0){for(var i of e.addedNodes)if(this._validElementTest(i)){if(!this.__delHit&&"BR"===i.tagName&&i.parentElement&&s.__validGridTags().includes(i.parentElement.tagName.toLowerCase())&&i===i.parentElement.childNodes[i.parentElement.childNodes.length-1]){let e=i.parentElement;if(i.remove(),e.childNodes.length>0){let t=e.childNodes[e.childNodes.length-1];t.textContent+="​",s._positionCursorInNode(t,t.length)}continue}if(this.__delHit=!1,"P"===i.tagName&&i.children.length>0&&"P"===i.children[0].tagName){b(i);continue}if("P"===i.tagName&&i.parentElement&&"P"===i.parentElement.tagName){b(i.parentElement);continue}if(null!=i.getAttribute("slot")&&i.parentElement===this){i.removeAttribute("slot");continue}if("LI"===i.tagName&&i.children.length>0&&"SPAN"===i.children[0].tagName){this.activeNode!==i.children[0]&&this.activeNode!==i||(s.activeNode=i),b(i.children[0]);continue}if("LI"===i.tagName&&i.parentElement&&!["UL","OL"].includes(i.parentElement.tagName)){b(i);continue}if("P"===i.tagName&&i.children.length>0&&["P","LI"].includes(i.children[0].tagName)){b(i.children[0]);continue}if(this.__slot&&(i.setAttribute("slot",this.__slot),this.__slot=null),this.__indentTrap)if("SPAN"===i.tagName)i.parentNode===this?this.haxChangeTagName(i,"p",!0):"LI"===i.parentNode.tagName&&(i.parentNode.innerHTML=i.textContent);else if("BR"===i.tagName){i.remove();continue}if(!this.editMode||"true"!=i.getAttribute("contenteditable")&&!0!==i.getAttribute("contenteditable")&&"contenteditable"!=i.getAttribute("contenteditable")||this.__applyNodeEditableState(i,!this.editMode),this.__applyNodeEditableState(i,this.editMode),s.isGridPlateElement(i)){let e=i.querySelectorAll("*");for(var o=0;o{this.__indentTrap=!1}),0)}else this.ready&&this.editMode&&s.ready&&0===e.addedNodes.length&&e.removedNodes.length>0&&this.shadowRoot&&(1===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}).length&&"PAGE-BREAK"===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0})[0].tagName||0===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}).length)&&setTimeout((()=>{(1===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}).length&&"PAGE-BREAK"===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0})[0].tagName||0===this.shadowRoot.querySelector("#body").assignedNodes({flatten:!0}).length)&&this.appendChild(document.createElement("p"))}),100)})),this.__ignoreActive&&(this.__ignoreActive=!1),s.haxTray.updateMap()})),this._observer.observe(this,{childList:!0,subtree:!0})):(this.windowControllers.abort(),this._observer.disconnect())}_haxResolvePreviousElement(e){for(e=e.previousElementSibling;null!=e&&void 0!==e.tagName&&"HAX-"===e.tagName.substring(0,4);)e=e.previousElementSibling;return e}_validElementTest(e,t=!1){return!(e.haxUIElement||!e.tagName||["TEMPLATE","HAX-BODY","FAKE-HAX-BODY-END"].includes(e.tagName))&&!(!t&&this._HTMLInlineTextDecorationTest(e)&&"HAX-BODY"!=e.parentNode)}_HTMLInlineTextDecorationTest(e){return["span","b","strong","i","em","u","strike"].includes(e.tagName.toLowerCase())}_HTMLPrimativeTest(e){return null!=e&&void 0!==e.tagName&&-1==e.tagName.indexOf("-")}_applyContentEditable(e,t=this.shadowRoot.querySelector("#body")){let i="slot"===t.localName?t.assignedNodes({flatten:!0}):[];0===i.length&&(i=t.children);for(var o=0;o{e.classList.remove("active")})),[...t.shadowRoot.querySelectorAll(".active")].forEach((e=>{e.classList.remove("active")}))}__layoutDragEnter(e){e.target.classList.add("active")}__layoutDragLeave(e){e.target.classList.remove("active")}__layoutMonitor(e){var t=N(e);t[0]&&t[0].assignedNodes&&t[0].assignedNodes().length&&t[0].parentNode&&t[0].parentNode.classList?t[0].parentNode.classList.add("has-nodes"):t[0].parentNode&&t[0].parentNode.classList&&t[0].parentNode.classList.remove("has-nodes")}__getLayoutOrder(e,t){if(!t.shadowRoot)return!1;let i=e.getAttribute("slot"),o=t.shadowRoot.querySelector(`[slot=${i}]`);return[...t.shadowRoot.querySelectorAll("[slot]")].map((e=>e.parentNode)).indexOf(o)||-1}__layoutCanMove(e,t,i){if(!t.shadowRoot)return!1;let o=t.shadowRoot.querySelector(`[slot=${slot}]`),a=[...t.shadowRoot.querySelectorAll("[slot]")].map((e=>e.parentNode)),n=(a.indexOf(o)||-1)+(i?-1:1);return n>=a[0]&&n<=a[a.length-1]}__layoutMove(e,t,i){if(!t.shadowRoot)return!1;let o=t.shadowRoot.querySelector(`[slot=${s}]`),a=[...t.shadowRoot.querySelectorAll("[slot]")].map((e=>e.parentNode)),n=a.indexOf(o)||-1,s=a[n+(i?-1:1)];s&&e.setAttribute("slot",s)}async __sortLayoutChildren(e){e.setAttribute("hax-layout-sorting",!0);try{let t=Array.prototype.reduce.call(e.querySelectorAll("[slot]"),(function(e,t){return e}),[]);t=t.sort((function(t,i){return this.__getLayoutOrder(t,e){t.parentNode===this&&e.appendChild(t)}))}catch(e){console.warn(e)}e.removeAttribute("hax-layout-sorting")}__layoutSlotValid(e,t){return this.__layoutSlots(t).includes(e.getAttribute("slot"))}__layoutSlots(e){return e.shadowRoot?[...e.shadowRoot.querySelectorAll("[slot]")].map((e=>e.getAttribute("name"))):[]}__applyDragDropState(e,t){let i={drop:t=>this.__layoutDropEvent.bind(this)(t,e),dragenter:this.__layoutDragEnter.bind(this),dragleave:this.__layoutDragEnter.bind(this),slotchange:this.__layoutMonitor.bind(this)};if(e.setAttribute("data-hax-layout",!0),s.isGridPlateElement(e)&&e.setAttribute("data-hax-grid",!0),t&&e.setAttribute("data-hax-ray",t),t&&e.shadowRoot){e.addEventListener("drop",i.drop);let t=[...e.shadowRoot.querySelectorAll("drag-enabled")],o=[...e.shadowRoot.querySelectorAll("slot")];t.forEach((e=>{e.addEventListener("dragenter",i.dragenter),e.addEventListener("dragleave",i.dragleave)})),o.forEach((e=>e.addEventListener("slotchange",i.slotchange))),e.haxLayoutObserver=new MutationObserver((t=>{e.getAttribute("hax-layout-sorting")||(t.forEach((t=>{t.addedNodes.forEach((t=>{t.tagName&&t!==this&&t.parentElement&&"HAX-BODY"!==t.parentElement.tagName&&!this.__layoutSlotValid(t,e)&&this.__layoutSlots(e).length>0&&t.setAttribute("slot",this.__layoutSlots(e)[0])}))})),this.__sortLayoutChildren(e))})),e.haxLayoutObserver.observe(this,{childList:!0})}else if(e.shadowRoot){e.haxLayoutObserver&&e.haxLayoutObserver.disconnect(),this.removeEventListener("drop",i.drop);let t=[...e.shadowRoot.querySelectorAll("drag-enabled")],o=[...e.shadowRoot.querySelectorAll("slot")];t.forEach((e=>{e.removeEventListener("dragenter",i.dragenter),e.removeEventListener("dragleave",i.dragleave)})),o.forEach((e=>e.removeEventListener("slotchange",i.slotchange))),e.removeAttribute("data-hax-ray")}}__isLayout(e){return e&&s.haxSchemaFromTag(e.tagName)&&"grid"===s.haxSchemaFromTag(e.tagName).type}__applyNodeEditableState(e,t=!0){let i;if(!e.tagName)return!1;let o=e.tagName.replace("-"," ").toLowerCase(),a=l(s.gizmoList).findIndex((t=>{if(t)return t.tag===e.tagName.toLowerCase()}));if(-1!==a&&(o=l(s.gizmoList)[a].title),"PAGE-BREAK"!==e.tagName?("IMG"==e.tagName&&e.setAttribute("draggable",!1),t?(this.__applyDragDropState(e,o),i="addEventListener"):(this.__applyDragDropState(e,!1),i="removeEventListener"),e[i]("drop",this.dropEvent.bind(this)),e[i]("dragenter",this.dragEnter.bind(this)),e[i]("dragleave",this.dragLeave.bind(this)),e[i]("dragover",(e=>{this.__dragMoving=!0,e.preventDefault()}))):t?e.setAttribute("data-hax-ray",""):e.removeAttribute("data-hax-ray"),this._HTMLPrimativeTest(e)&&(t?e.setAttribute("contenteditable",t):e.removeAttribute("contenteditable"),e.querySelectorAll("a").length>0)){let o=e.querySelectorAll("a");for(var n=0,r=o.length;n{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()}))}}undoManagerStackLogic(e){this.__dragMoving||(this.querySelectorAll(".hax-hovered").forEach((e=>{e.classList.remove("hax-hovered")})),super.undoManagerStackLogic(e))}dropEvent(e){if(this.editMode){this.__dragMoving=!1,this.undoManagerStackLogic({}),clearTimeout(A),s._lockContextPosition=!1,s.haxTray.activeTab="item-1";var t,i=null,o=N(e);if(null!==(i=e.target.closest("[data-hax-layout]")&&e.target.parentNode!=e.target.closest("[data-hax-layout]")?e.target.closest("[data-hax-layout]"):e.target.closest("[contenteditable],img")?e.target.closest("[contenteditable],img"):e.originalTarget?e.originalTarget:e.target).getAttribute("data-hax-lock"))return!1;o[0].classList.contains("column")?this.__slot=o[0].getAttribute("id").replace("col","col-"):i.getAttribute("slot")&&(this.__slot=i.getAttribute("slot")),this.querySelectorAll(".hax-hovered").forEach((e=>{e.classList.remove("hax-hovered")})),this.querySelectorAll(".active").forEach((e=>{e.classList.remove("active")})),s.activeNode=i;try{if(null===s.__dragTarget&&e.dataTransfer&&e.dataTransfer.items&&e.dataTransfer.items.length>0&&"file"===e.dataTransfer.items[0].kind){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();let i=document.createElement("p");e.target.closest("[data-hax-layout]")&&e.target.parentNode!=e.target.closest("[data-hax-layout]")?t=e.target.closest("[data-hax-layout]"):e.target.closest("[contenteditable],img")&&(t=e.target.closest("[contenteditable],img")),t&&(t.tagName&&"HAX-BODY"!==t.tagName||!t.getAttribute("data-hax-layout"))||this.__isLayout(o[0])?(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(i=s.__dragTarget,t=e.target,e.target.closest("[data-hax-layout]")&&e.target.parentNode!=e.target.closest("[data-hax-layout]")?t=e.target.closest("[data-hax-layout]"):e.target.closest("[contenteditable],img")&&(t=e.target.closest("[contenteditable],img")),t&&i&&this._validElementTest(i)&&i!==t){try{"HAX-BODY"!==t.tagName&&!this.__isLayout(t)||this.__isLayout(o[0])?(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-")):"HAX-BODY"===t.tagName&&i.getAttribute("slot")&&i.removeAttribute("slot"),t.appendChild(i))}catch(e){console.warn(e)}e.preventDefault(),e.stopPropagation()}i&&this._validElementTest(i)&&"function"==typeof i.focus&&(s.activeNode=i,s.testHook(s.activeNode,"trayDragNDropToNode")&&s.runHook(s.activeNode,"trayDragNDropToNode",[s.activeNode]),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)}}s.__dragTarget=null,this.__manageFakeEndCap(!1)}dragEnter(e){this.editMode&&e.target&&s.__dragTarget&&(this.__dragMoving=!0,e.preventDefault(),e.target&&e.target.classList&&e.target.classList.add("hax-hovered"),this.handleMousemove(e))}handleMousemove(e){var t=e.clientX,i=e.clientY,o=document.documentElement.clientWidth,a=document.documentElement.clientHeight,n=w,s=w,r=a-w,l=o-w,d=t<200,c=t>l,h=i<200,u=i>r;if(d||c||h||u){var m=Math.max(document.body.scrollWidth,document.body.offsetWidth,document.body.clientWidth,document.documentElement.scrollWidth,document.documentElement.offsetWidth,document.documentElement.clientWidth),g=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.body.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight,document.documentElement.clientHeight),p=m-o,v=g-a;!function checkForWindowScroll(){clearTimeout(A),function adjustWindowScroll(){var e=window.pageXOffset,o=window.pageYOffset,a=o>0,m=o0,b=ee[i]=t[i])),e.removeAttribute("data-grid-saved-settings")}}setSlotEditMode(e,t,i){let o=e.getAttribute("data-grid-saved-settings")?JSON.parse(e.getAttribute("data-grid-saved-settings")):{},a=Object.keys(o);Object.keys(t||{}).forEach((i=>{a.includes(i)||(o[i]=e[i]),e[i]=t[i]})),e.setAttribute("data-grid-saved-settings",JSON.stringify(o))}async _activeNodeChanged(e,t){if(window.SimplePopoverManager.requestAvailability().opened=!1,this.contextMenus.plate.disableDuplicate=!1,this.contextMenus.plate.disableOps=!1,this.contextMenus.plate.disableItemOps=!1,this.contextMenus.plate.canMoveElement=this.canMoveElement,setTimeout((()=>{this.prevKeyActiveNode=null}),5),t&&t.removeAttribute("data-hax-active"),e&&e.setAttribute("data-hax-active","data-hax-active"),e&&t&&s.isGridPlateElement(e)&&(this.__ignoreActive=!0),this.editMode&&null!=e&&e.parentNode&&e.tagName){let t=e.tagName.toLowerCase();(s.isTextElement(e)||"HR"===e.tagName||s.isGridPlateElement(e))&&null===e.getAttribute("data-hax-lock")&&null===e.parentNode.getAttribute("data-hax-lock")?(e.setAttribute("contenteditable",!0),this.setAttribute("contenteditable",!0)):(e.removeAttribute("contenteditable"),this.removeAttribute("contenteditable")),this._keepContextVisible(),this.contextMenus.text.realSelectedValue=t}else null===e&&(this.hideContextMenus(),this.__oldActiveNode=t);if(this.editMode&&await s.runHook(t,"activeElementChanged",[t,!1])&&(this.__ignoreActive=!0),this.editMode&&await s.runHook(e,"activeElementChanged",[e,!0])&&(this.__ignoreActive=!0),this.editMode&&t&&t.tagName){let e=s.haxSchemaFromTag(t.tagName.toLowerCase());if("core"!=e.editingElement||t.parentNode&&t.parentNode.haxUIElement&&t.parentNode===s.activeEditingElement){this.__ignoreActive=!0;let o=await s.runHook(t.parentNode,"activeElementChanged",[t,!1]);if(o&&o!==t){if(t&&t.getAttribute&&null!=t.getAttribute("slot")&&o.setAttribute("slot",t.getAttribute("slot")),e.saveOptions&&e.saveOptions.unsetAttributes&&e.saveOptions.unsetAttributes.length)for(var i in e.saveOptions.unsetAttributes)o.removeAttribute(e.saveOptions.unsetAttributes[i]);this.__applyNodeEditableState(o,this.editMode)}b(s.activeEditingElement),s.activeEditingElement=null}}if(this.editMode&&e){let t=s.haxSchemaFromTag(e.tagName);if(t&&t.editingElement&&"core"!=t.editingElement){if(t.editingElement.import){let e=new URL("./hax-body.js",import.meta.url).href+"/../../../";window.WCGlobalBasePath&&(e=window.WCGlobalBasePath),await import(`${e}${t.editingElement.import}`)}s.activeEditingElement=document.createElement(t.editingElement.tag),e.getAttribute&&null!=e.getAttribute("slot")&&s.activeEditingElement.setAttribute("slot",e.getAttribute("slot")),t.editingElement.callback&&t.editingElement.callback(s.activeEditingElement),this.__ignoreActive=!0,v(e,s.activeEditingElement),await s.runHook(s.activeEditingElement,"activeElementChanged",[e,!0])}}!t||!t.parentNode||e&&e.parentNode&&e.parentNode===t.parentNode||this.unsetSlotEditMode(t.parentNode),this.unsetElementEditMode(t)}_getPosition(e){return{x:e.offsetLeft-e.scrollLeft+e.clientLeft,y:e.offsetTop-e.scrollTop+e.clientTop}}_showContextMenu(e){e.setAttribute("on-screen","on-screen"),e.classList.add("hax-context-visible","hax-context-menu-active")}_getContextContainer(e){let t=e&&e.parentNode?e.parentNode:void 0;return t&&t.nodeType?1==t.nodeType?t:t.host:void 0}_hideContextMenu(e){e&&(e.removeAttribute("on-screen"),e.classList.remove("hax-context-visible"),e.classList.remove("hax-context-menu-active"))}_tabKeyPressed(){if(this.activeNode&&s.getRange().cloneRange)try{let t=!1,i=this.activeNode.parentNode;const o=this.activeNode.parentNode.tagName;let a=s.getRange().cloneRange();var e=a.commonAncestorContainer.tagName;if(void 0===e&&(e=a.commonAncestorContainer.parentNode.tagName),["UL","OL","LI"].includes(o)||["UL","OL","LI"].includes(e))this.polyfillSafe&&(this.__tabTrap=!0,this.__indentTrap=!0,document.execCommand("indent"));else for(;!t;)null==i.nextSibling?t=!0:"function"===i.nextSibling.focus?(i.nextSibling.focus(),t=!0):i=i.nextSibling}catch(e){console.warn(e)}}_tabBackKeyPressed(){if(this.activeNode&&s.getRange().cloneRange)try{let t=this.activeNode.parentNode;const i=this.activeNode.parentNode.tagName;let o=s.getRange().cloneRange();var e=o.commonAncestorContainer.tagName;if(void 0===e&&(e=o.commonAncestorContainer.parentNode.tagName),["UL","OL","LI"].includes(i)||["UL","OL","LI"].includes(e))this.polyfillSafe&&(this.__tabTrap=!0,this.__indentTrap=!0,document.execCommand("outdent"));else{if(null!=t)for(;null!=t&&!this._validElementTest(t);)t=t.previousSibling;null!=t&&setTimeout((()=>{t.focus()}),50)}}catch(e){console.warn(e)}}}customElements.define(HaxBody.tag,HaxBody);export{HaxBody}; \ No newline at end of file diff --git a/haxcms/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-store.js b/haxcms/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-store.js index da6e2e2c2..fac0f7b56 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-store.js +++ b/haxcms/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-store.js @@ -1,4 +1,4 @@ -import{LitElement as e,html as t,nothing as i}from"../../../lit/index.js";import{SimpleTourManager as a}from"../../simple-popover/lib/simple-tour.js";import{HaxSchematizer as o,HaxElementizer as r}from"../../hax-body-behaviors/lib/HAXFields.js";import{winEventsElement as n,getRange as s,stripMSWord as l,nodeToHaxElement as d,haxElementToNode as c,validURL as h,camelToDash as p,htmlEntities as m,localStorageGet as g,localStorageSet as u}from"../../utils/utils.js";import{observable as x,makeObservable as f,computed as b,configure as v,autorun as y,toJS as T}from"../../../mobx/dist/mobx.esm.js";v({enforceActions:!1});import{HAXElement as S}from"../../hax-body-behaviors/hax-body-behaviors.js";import{I18NMixin as H,I18NManagerStore as w}from"../../i18n-manager/lib/I18NMixin.js";import{enableServices as E}from"../../micro-frontend-registry/lib/microServices.js";import{SuperDaemonInstance as A}from"../../super-daemon/super-daemon.js";import"../../media-behaviors/media-behaviors.js";import"../../editable-table/editable-table.js";import"../../iframe-loader/iframe-loader.js";import"../../hax-iconset/lib/hax-iconset-manifest.js";import{UserScaffoldInstance as N}from"../../user-scaffold/user-scaffold.js";import"./hax-app.js";function sessionStorageGet(e){try{return sessionStorage.getItem(e)}catch(e){return!1}}function sessionStorageSet(e,t){try{return sessionStorage.setItem(e,t)}catch(e){return!1}}class HaxStore extends(H(n(S(e)))){testHook(e,t){return!!(e&&e.tagName&&this.HTMLPrimativeTest(e)&&this.primativeHooks[e.tagName.toLowerCase()]&&this.primativeHooks[e.tagName.toLowerCase()][t])||e&&"function"==typeof e.haxHooks&&e.haxHooks()[t]}async runHook(e,t,i=[]){return!!this.testHook(e,t)&&(this.HTMLPrimativeTest(e)?await this.primativeHooks[e.tagName.toLowerCase()][t](...i):await e[e.haxHooks()[t]](...i))}getSelection(){if(this.activeHaxBody&&this.activeHaxBody.parentNode){if(this.activeHaxBody.parentNode.getSelection)return this.activeHaxBody.parentNode.getSelection();try{if(s(this.activeHaxBody.parentNode))return s(this.activeHaxBody.parentNode)}catch(e){}}return globalThis.getSelection()}getRange(){let e=this.getSelection();return e&&e.getRangeAt&&e.rangeCount?e.getRangeAt(0):e||!1}guessGizmo(e,t,i=!1,a=!1){var o=[],r=[];if(void 0!==e&&this.validGizmoTypes.includes(e))for(let n in this.gizmoList){let s=T(this.gizmoList[n]),l=t.innerHTML?{innerHTML:t.innerHTML}:{},d=!1;if(s&&s.handles)for(let n=0;n{t&&t.type&&""!=t.type&&(e[t.type.toLowerCase()]=!0)})),s.tags&&s.tags.length>0&&[...s.tags].forEach((t=>{t&&""!=t&&(e[t.toLowerCase()]=!0)})),s.keywords=Object.keys(e),r.includes(s.tag)||(o.push(this.haxElementPrototype(s,l,"")),r.push(s.tag))}}}}return o}insertLogicFromValues(e,t,i=!1,a=!1){let o=this.activePlaceHolderOperationType||this.guessGizmoType(e);if("upload-only"===o)return this.toast("Upload successful!"),!1;"link"===this.activePlaceHolderOperationType&&(a=!0),this.activePlaceHolderOperationType=null;let r=o,n=!0;if("*"==o){if(i)return!1;n=!1,r="link"}let s=this.guessGizmo(o,e,!1,n);return s.length>0?(1===s.length||a?1===s.length&&void 0!==s[0].tag?t.dispatchEvent(new CustomEvent("hax-insert-content",{bubbles:!0,cancelable:!0,composed:!0,detail:s[0]})):a&&t.dispatchEvent(new CustomEvent("hax-insert-content",{bubbles:!0,cancelable:!0,composed:!0,detail:s.find((e=>"a"==e.tag))})):this.haxAppPicker.presentOptions(s,o,"Pick how to present this "+r,"gizmo"),!0):(this.toast("Sorry, HAX doesn't know how to handle that type of link yet."),!1)}write(e,t,i){i&&i.dispatchEvent(new CustomEvent("hax-store-write",{composed:!0,bubbles:!0,cancelable:!1,detail:{property:e,value:t,owner:i}}))}mimeTypeToGizmoType(e){let 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"}}guessGizmoType(e){if(void 0!==e.source){const 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"))return"image";if(-1!=t.indexOf(".gif"))return"gif";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"!=globalThis.MediaBehaviors.Video.getVideoType(t))return"video"}return"*"}render(){return t` `}static get tag(){return"hax-store"}toast(e,t=2e3,i={},a="capsule",o=this.t.close,r=null,n=null){globalThis.dispatchEvent(new CustomEvent(this.toastShowEventName,{bubbles:!0,composed:!0,cancelable:!0,detail:{text:e,duration:t,classStyle:a,closeText:o,eventCallback:r,slot:n,...i}}))}static get properties(){return{...super.properties,skipHAXConfirmation:{type:Boolean,reflect:!0,attribute:"skip-hax-confirmation"},storageData:{type:Object},haxTray:{type:Object},haxCancel:{type:Object},haxAutoloader:{type:Object},haxBodies:{type:Array},activePlaceHolder:{type:Object},activePlaceHolderOperationType:{type:String},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}}}_storageDataChanged(e){e&&this.ready&&this.__storageDataProcessed&&(g("haxConfirm",!1)?u("haxUserData",e):sessionStorageGet("haxConfirm")&&sessionStorageSet("haxUserData",e))}isSingleSlotElement(e){let t=Object.keys(this.slotsSchemaFromNode(e));return 1==t.length&&0===t[0].length}isTextElement(e){let 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","mark","abbr","i","bold","em","strong","blockquote","code","figure"].includes(t))}isInlineElement(e){let t;return null!=e&&e.tagName?t=e.tagName.toLowerCase():null!=e&&e.tag?t=e.tag.toLowerCase():"string"==typeof e&&(t=e),!!(t&&this.validTagList.includes(t)&&(this.haxSchemaFromTag(t)&&this.haxSchemaFromTag(t).meta&&this.haxSchemaFromTag(t).meta.inlineOnly||["a","strike","u","b","sub","sup","span","code","mark","abbr","i","bold","em","strong"].includes(t)))}isGridPlateElement(e){let t;return e&&e.tagName?t=e.tagName.toLowerCase():e&&e.tag&&(t=e.tag.toLowerCase()),!(!t||!this.validGridTagList.includes(t))}isLayoutElement(e){let t=e&&e.tagName&&this.haxSchemaFromTag(e.tagName)||{};return t.type&&"grid"===t.type}isLayoutSlot(e){return!(!e||!e.parentNode)&&this.isLayoutElement(e.parentNode)}isOriginalGridPlate(e){return!!e&&"GRID-PLATE"===e.tagName}activeSchema(){return this.activeNode?this.haxSchemaFromTag(this.activeNode.tagName):void 0}activeParentSchema(){return this.activeNode&&this.activeNode.parentNode?this.haxSchemaFromTag(this.activeNode.parentNode.tagName):void 0}slottedContentByNode(e){let t={...this.slotsSchemaFromNode(e)||{}};return e?([...e.children||[]].forEach((e=>{e.slot&&""!==e.slot&&t[e.slot]?(t[e.slot].items=t[e.slot].items||[],t[e.slot].items.push(e)):e.slot&&""!==e.slot||!t[""]||(t[""].items=t[""].items||[],t[""].items.push(e))})),t):t}slotsSchemaFromNode(e){if(!e||!e.tagName)return{};let t={},i=this.haxSchemaFromTag(e.tagName||{}),a=this.slotsFromSchema(i);if(this.isOriginalGridPlate(e)){(e.layout||"1-1-1-1").split("-").map(((e,t)=>{a.push({slot:`col-${t+1}`,title:`Column ${t+1}`,excludedSlotWrappers:["grid-plate"]})}))}return a.forEach((a=>{a.items=void 0,a.label=a.title||a.slot,a.editMode={...i.editMode,...a.editMode},a.grid=e,(a.slot||""===a.slot)&&(t[a.slot]=a)})),t}schemaBySlotId(e,t){return(this.slotsSchemaFromNode(e)||{})[t]}_appStoreChanged(e,t){e&&t&&(e.url&&!e.apps&&this.shadowRoot?this.loadAppStoreFromRemote():this.__appStoreData=e)}async _loadAppStoreData(e){if(null!=e){var t={};if(void 0!==e.autoloader){e.autoloader=Object.assign({},e.autoloader);for(let i in e.autoloader){let a=i,o=e.autoloader[i];isNaN(a)||(a=e.autoloader[i],o=`@haxtheweb/${a}/${a}.js`),"string"!=typeof o&&(o.haxProperties&&this.setHaxProperties(e.autoloader[i].haxProperties,a),o=e.autoloader[i].import),this.validTagList.push(a),t[a]=o}}if(void 0!==e.apps){var i=e.apps;for(let e=0;e{globalThis.customElements.get(a)&&globalThis.customElements.get(a).haxProperties?this.setHaxProperties(globalThis.customElements.get(a).haxProperties,a):t.appendChild(globalThis.document.createElement(a))})).catch((e=>{console.warn(e),t.appendChild(globalThis.document.createElement(a))}))}}isExternalURLImport(e){let t;try{t=new URL(e)}catch(e){return!1}return new URL(t).origin!==location.origin}_editModeChanged(e){e&&!this.appStoreLoaded&&this.__appStoreData&&this.haxAutoloader&&(clearTimeout(this.__readyToProcessAppStoreData),this._loadAppStoreData(this.__appStoreData))}async _globalPreferencesChanged(e){if(this.__storageDataProcessed&&e&&this.ready){let t=this.storageData;"string"==typeof t&&(t=JSON.parse(t)),t.globalPreferences=e,this.storageData=t,this._storageDataChanged(this.storageData),e.haxLang&&HAXStore.editMode&&(clearTimeout(this._debounceLang),this._debounceLang=setTimeout((async()=>{for(let e in this.elementList){let t=this.elementList[e];t=await this.attemptGizmoTranslation(e,t),this.elementList[e]=t}this.gizmoList.forEach((e=>{this.elementList[e.tag].gizmo.title&&(e.title=this.elementList[e.tag].gizmo.title),this.elementList[e.tag].gizmo.description&&(e.description=this.elementList[e.tag].gizmo.description)}))}),100))}}_haxConsentTap(e){u("haxConfirm",!0),u("haxUserData",JSON.stringify(this.storageData))}updated(e){super.updated&&super.updated(e),e.forEach(((e,t)=>{"appStore"==t&&this[t]&&this._appStoreChanged(this[t],e),["ready","__appStoreData","haxAutoloader"].includes(t)&&this.ready&&this.__appStoreData&&this.haxAutoloader&&(clearTimeout(this.__readyToProcessAppStoreData),this.__readyToProcessAppStoreData=setTimeout((()=>{this._loadAppStoreData(this.__appStoreData)}),0)),["haxAutoloader","haxTray","haxCancel"].includes(t)&&(clearTimeout(this.__storeReady),this.__storeReady=setTimeout((()=>{this._storePiecesAllHere(this.haxAutoloader,this.activeHaxBody,this.haxTray,this.haxCancel)}),0))}))}_calculateActiveGizmo(e){if(null==e||!e.tagName)return null;for(let i in this.gizmoList){var t=this.gizmoList[i];if(t.tag===e.tagName.toLowerCase())return t}}loadAppStoreFromRemote(){const e=new URLSearchParams(this.appStore.params);let t=this.appStore.url;e&&(t+=`?${e}`),fetch(t,{method:this.method}).then((e=>{if(e.ok)return e.json()})).then((e=>{this.__appStoreData=e}))}firstUpdated(e){if(super.firstUpdated&&super.firstUpdated(e),this.skipHAXConfirmation&&(sessionStorageSet("haxConfirm",!0),u("haxConfirm",!0)),sessionStorageGet("haxConfirm")||g("haxConfirm"))if(sessionStorageGet("haxConfirm")&&!g("haxConfirm"))try{let e=sessionStorageGet("haxUserData")?JSON.parse(sessionStorageGet("haxUserData")):{};this.storageData=e,this._storageDataChanged(this.storageData)}catch(e){}else try{let e=g("haxUserData",{});this.storageData=e,this._storageDataChanged(this.storageData)}catch(e){}else{sessionStorageSet("haxConfirm",!0);let e="\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 ";this.toast(e,"-1",{},"fit-bottom","I Accept","hax-consent-tap")}setTimeout((()=>{this.__storageDataProcessed=!0,this.storageData.globalPreferences&&this.write("globalPreferences",this.storageData.globalPreferences,this)}),0)}_storePiecesAllHere(e,t,i,a){if(!this.ready&&t&&e&&i&&a){this.dispatchEvent(new CustomEvent("hax-store-ready",{bubbles:!0,cancelable:!1,composed:!0,detail:!0}));let e=globalThis.RichTextEditorPrompt.requestAvailability();e&&(e.shadowRoot.querySelector("#formfields").schematizer=o,e.shadowRoot.querySelector("#formfields").elementizer=r),i.shadowRoot.querySelector("#haxcancelbutton")&&(a.shadowRoot.querySelector("#dialog").associateEvents(i.shadowRoot.querySelector("#haxcancelbutton")),a.shadowRoot.querySelector("#dialog")&&globalThis.addEventListener("simple-modal-confirmed",this._handleConfirmCancel.bind(this))),this.ready=!0,this._buildPrimitiveDefinitions()}}_handleConfirmCancel(e){e.detail.invokedBy===this.haxTray.shadowRoot.querySelector("#haxcancelbutton")&&(this.editMode=!1,this.dispatchEvent(new CustomEvent("hax-cancel",{bubbles:!0,composed:!0,cancelable:!1,detail:e.detail})))}_positionCursorInNode(e,t=0){this.activeHaxBody.positionContextMenus();var i=globalThis.document.createRange(),a=this.getSelection();return i.setStart(e,t),i.collapse(!0),a.removeAllRanges(),a.addRange(i),i}_onBeforeUnload(e){if(!this.skipExitTrap&&this.editMode)return"Are you sure you want to leave? Your work will not be saved!"}isBase64(e){try{return btoa(atob(e))==e}catch(e){return!1}}retrieveImageFromClipboardAsBlob(e,t){if(0==e.clipboardData&&"function"==typeof t)return t(void 0);var i=e.clipboardData.items;if(null==i&&"function"==typeof t)return t(void 0);for(let e=0;e{for(var i in e)i.startsWith("hax")||(this.activeNode.dataset[i]=e[i]);t&&this.activeNode.setAttribute("slot",t)}),0)}}async _onPaste(e){if(this.editMode&&"HAX-TRAY"!==globalThis.document.activeElement.tagName&&"BODY"!==globalThis.document.activeElement.tagName&&"SIMPLE-MODAL"!==globalThis.document.activeElement.tagName){this.isTextElement(this.activeNode)||(this.activeNode=this.activeHaxBody.haxInsert("p","",{}));let o="",r="";if(e.clipboardData||e.originalEvent.clipboardData?(o=(e.originalEvent||e).clipboardData.getData("text/html"),""==o&&(o=(e.originalEvent||e).clipboardData.getData("text"))):globalThis.clipboardData&&(o=globalThis.clipboardData.getData("Text")),o=o.trim(),o=o.replace(/\s*?<\/span>/g," "),o=o.replace(/(?:style="(\S+:\s*[^;"]+;\s*)*)+"/g,""),o=o.replace(/
            /g,"

            "),r=o,this.isBase64(r))return e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.retrieveImageFromClipboardAsBlob(e,(t=>{if(t){var i=globalThis.URL||globalThis.webkitURL;let a=globalThis.document.createElement("img");a.src=i.createObjectURL(t),this.activeNode.parentNode.insertBefore(a,this.activeNode.nextElementSibling);for(let t in e.clipboardData.items)!e.clipboardData.items[t].name&&e.clipboardData.items[t].type&&(e.clipboardData.items[t].name="image-"+Math.floor(Date.now()/1e3)+e.clipboardData.items[t].type.replace("image/","."));return e.dataTransfer=e.clipboardData,e.placeHolderElement=a,this.dispatchEvent(new CustomEvent("place-holder-file-drop",{bubbles:!0,cancelable:!0,composed:!0,detail:e})),a}return!1}));if(e.clipboardData.files.length>0){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();let t=this.activeHaxBody.haxInsert("p","",{});e.dataTransfer=e.clipboardData;for(let t in e.clipboardData.files)!e.clipboardData.files[t].name&&e.clipboardData.files[t].type&&(e.clipboardData.files[t].name="image-"+Math.floor(Date.now()/1e3)+e.clipboardData.files[t].type.replace("image/","."));e.placeHolderElement=t,this.dispatchEvent(new CustomEvent("place-holder-file-drop",{bubbles:!0,cancelable:!0,composed:!0,detail:e}))}let n=!1,s="",d=globalThis.document.createElement("div");d.innerHTML=o;let p=[];if(d.children&&(o=l(o),o=o.replace(/

            /g,"

            "),o=o.replace(/<\/h1>/g,"

            "),o=o.replace(//g,(function(e,t){return``})),p=await this.htmlToHaxElements(o),1!==p.length||this.__validGridTags().includes(p[0].tag)||(p=await this.htmlToHaxElements(p[0].content))),0===p.length&&h(o)){""!=this.activeNode.innerText.trim()&&(n=!0);let e={source:o,title:o};if(!n&&!this.insertLogicFromValues(e,this,!1,!0))return!1}else if(0===p.length){if(n=!0,r==o)return!1;s=o}else if(1===p.length&&"p"===p[0].tag)s=o,n=!0;else if(1===p.length&&"a"===p[0].tag&&p[0].properties.href)if(""!=this.activeNode.innerText.trim())s=p[0].properties.href,n=!0;else{let e={source:p[0].properties.href,title:p[0].content};if(!this.insertLogicFromValues(e,this))return!1}else{if(!this.isGridPlateElement(p[0]))return!1;for(let e in p){"p"==p[e].tag&&["li","ol","ul"].includes(this.activeNode.tagName.toLowerCase())&&(p[e].tag="li"),delete p[e].properties.style,delete p[e].properties.start,delete p[e].properties.align;let t=c({tag:p[e].tag,content:p[e].content.replace(/ <\/span>/g," ").trim(),properties:p[e].properties});s+=await this.nodeToContent(t)}}e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();try{let e=this.getRange(),r=this.getSelection(),l=globalThis.document.createElement("div");if(l.innerHTML=s,e&&r){for(let e in l.children)l.children[e].tagName&&this.isTextElement(l.children[e])&&""===l.children[e].innerHTML&&l.children[e].remove();if(n){let t;if(h(o))t=globalThis.document.createElement("a"),t.setAttribute("href",o),t.setAttribute("rel","noopener noreferrer"),t.setAttribute("target","_blank"),t.innerText=o;else if(l.children&&l.children.length>0){for(;l.childNodes.length>1;)e.insertNode(Array.from(l.childNodes).pop());t=Array.from(l.childNodes).pop()}else t=globalThis.document.createTextNode(l.innerHTML);e.deleteContents(),e.insertNode(t),setTimeout((()=>{this._positionCursorInNode(t,t.length)}),0)}else{var t,i,a;for(""!=this.activeNode.innerText.trim()&&e.endOffset!=this.activeNode.innerText.length&&(t=!0,globalThis.document.execCommand("insertParagraph")),e.commonAncestorContainer&&e.commonAncestorContainer.parentNode&&(a||this.activeNode==e.commonAncestorContainer||(a=e.commonAncestorContainer.parentNode)||(a=e.commonAncestorContainer));l.firstElementChild;)i=l.firstElementChild,a?(a.getAttribute&&a.getAttribute("slot")&&i.setAttribute("slot",a.getAttribute("slot")),t?(this.activeHaxBody.haxReplaceNode(a.previousElementSibling,i),t=!1):a.parentNode?a.parentNode.insertBefore(i,a.nextElementSibling):a.insertBefore(i,a.nextElementSibling)):this.activeNode?(this.activeNode.getAttribute("slot")&&i.setAttribute("slot",this.activeNode.getAttribute("slot")),""==this.activeNode.innerText.trim()?this.activeHaxBody.haxReplaceNode(this.activeNode,i):this.activeNode.parentNode.insertBefore(i,this.activeNode.nextElementSibling)):this.activeHaxBody.appendChild(i),a=i;setTimeout((()=>{i&&i.childNodes&&i.childNodes[0]&&(this._positionCursorInNode(i.childNodes[0],i.childNodes[0].length),i=null,a=null)}),0)}}}catch(e){console.warn(e)}}}__validGridTags(){return["p","ol","ul","li","div","h1","h2","h3","h4","h5","h6","blockquote","code","section","dl","dd","dt","figure"]}__validTags(){return["p","div","span","mark","abbr","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","figcaption","img","iframe","video","audio","section","dl","dt","dd","template","webview"]}__validGizmoTypes(){return["data","video","audio","text","link","file","pdf","image","csv","doc","document","archive","markdown","html","content","text","gif","inline","*"]}constructor(){super(),E(["core"]),this.toastShowEventName=globalThis.HAXCMS?"haxcms-toast-show":"simple-toast-show",this.t={close:"Close"},void 0!==globalThis.speechSynthesis&&(globalThis.SpeechRecognition||globalThis.webkitSpeechRecognition||globalThis.mozSpeechRecognition||globalThis.msSpeechRecognition||globalThis.oSpeechRecognition)&&(A.voiceSearch=!0),A.icon="hax:wizard-hat",A.allowedCallback=()=>!(!this.ready||!this.editMode),A.defineOption({title:"Insert emoji",icon:"editor:insert-emoticon",tags:["emoji"],value:{name:"Insert emoji",context:"/",program:async(e,t)=>{let i=[],a=globalThis.document.createElement("textarea");return await Object.keys(globalThis.SimplePickerEmojis).forEach((async t=>{await globalThis.SimplePickerEmojis[t].forEach((async o=>{(""==e||o.description.includes(e))&&(a.innerHTML=o.value,i.push({title:o.description,textCharacter:a.value,tags:[t],value:{target:this,method:"_insertTextResult",args:[a.value]},context:["/","/HAX/text/emoji/"+a.value],eventName:"super-daemon-element-method",path:"/HAX/text/emoji/"+a.value}))}))})),i}},context:["HAX","/"],eventName:"super-daemon-run-program",path:"/HAX/text/emoji"}),A.defineOption({title:"Insert symbol",icon:"editor:functions",tags:["symbol"],value:{name:"Insert symbol",context:"/",program:async(e,t)=>{let i=[],a=globalThis.document.createElement("textarea");return await Object.keys(globalThis.SimplePickerSymbols).forEach((async t=>{await globalThis.SimplePickerSymbols[t].forEach((async o=>{(""==e||t.includes(e))&&(a.innerHTML=o.value,i.push({title:`${t}: ${a.value}`,textCharacter:a.value,tags:[t],value:{target:this,method:"_insertTextResult",args:[a.value]},context:["/","/HAX/text/symbol/"+a.value],eventName:"super-daemon-element-method",path:"/HAX/text/symbol/"+a.value}))}))})),i}},context:["HAX","/"],eventName:"super-daemon-run-program",path:"/HAX/text/symbol"}),A.defineOption({title:"Join our Community",icon:"hax:discord",priority:-100,tags:["community","discord","chat","help"],value:{target:this,method:"_openExternalLink",args:["https://bit.ly/hax-discord"]},eventName:"super-daemon-element-method",path:"HAX/community/join",context:["logged-in","CMS","HAX"]}),A.defineOption({title:"User Tutorials",icon:"hax:hax2022",priority:-1e3,tags:["Documentation","community","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/tutorials"]},eventName:"super-daemon-element-method",path:"HAX/community/tutorials",context:["logged-in","CMS","HAX"]}),A.defineOption({title:"User Documentation",icon:"hax:hax2022",tags:["Documentation","community","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/documentation"]},eventName:"super-daemon-element-method",path:"HAX/community/documentation",context:["logged-in","CMS","HAX"]}),A.defineOption({title:"HAX Teaching Excellence",icon:"hax:hax2022",tags:["Ontology","community","pedagogy","documentation","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/ontology"]},eventName:"super-daemon-element-method",path:"HAX/community/pedagogy",context:["logged-in","CMS","HAX"]}),A.defineOption({title:"Bug / issue",icon:"mdi-social:github-circle",tags:["Bug report","github","git","community","issue queue"],value:{target:this,method:"_haxStoreContribute",args:["bug","POP,bug"]},eventName:"super-daemon-element-method",path:"HAX/community/contribute",context:["logged-in","CMS","HAX"]}),A.defineOption({title:"Idea / Feature request",icon:"mdi-social:github-circle",tags:["Feature request","idea","github","git","community","issue queue"],value:{target:this,method:"_haxStoreContribute",args:["feature","POP,enhancement"]},context:["logged-in","CMS","HAX"],eventName:"super-daemon-element-method",path:"HAX/community/contribute"}),this.primativeHooks={},this.__dragTarget=null,this.registerLocalization({context:this,namespace:"hax",basePath:import.meta.url+"/../../",locales:["es"]}),this.appSearch=null,this.method="GET",this.haxSelectedText="",this.__winEvents={"hax-super-daemon-insert-tag":"_superDaemonInsert","hax-register-properties":"_haxStoreRegisterProperties","hax-consent-tap":"_haxConsentTap",onbeforeunload:"_onBeforeUnload",paste:"_onPaste",command:"_onCommand","hax-register-app":"_haxStoreRegisterApp","hax-register-stax":"_haxStoreRegisterStax","hax-register-core-piece":"_haxStorePieceRegistrationManager","hax-register-body":"_haxStoreRegisterBody","hax-insert-content":"_haxStoreInsertContent","hax-insert-content-array":"_haxStoreInsertMultiple","hax-refresh-tray-form":"refreshActiveNodeForm","rich-text-editor-prompt-open":"_richTextEditorPromptOpen","rich-text-editor-prompt-confirm":"_richTextEditorPromptConfirm"},globalThis.onbeforeunload=e=>{if(!this.skipExitTrap&&this.editMode){var t="Are you sure you want to leave? Your work will not be saved!";return e.returnValue=t,t}},a.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 padding: 0;\n margin: 0;\n font-size: 14px;\n line-height: 20px;\n }\n simple-popover-manager h3 {\n margin: 8px 2px;\n }"}),this.skipHAXConfirmation=!1,this.storageData={},this.appStore={url:"",params:{}},this.daemonKeyCombo=`${A.key1} + ${A.key2} + `,this.activeNode=null,this.activeEditingElement=null,this.haxBodies=[],this.activePlaceHolder=null,this.activePlaceHolderOperationType=null,this.sessionObject={},this.editMode=!1,this.skipExitTrap=!1,this.appStoreLoaded=!1,this.elementList={},this.elementAlign=g("hax-tray-elementAlign"),this.elementAlign&&null!=this.elementAlign||(this.elementAlign="left"),this.trayStatus="collapsed",this.trayDetail="content-edit",this.appList=[],this.gizmoList=[],this.recentGizmoList=N.readMemory("recentGizmoList")||[],this.haxAutoloader=null,this.activeHaxBody=null,this.haxTray=null,this.haxCancel=null,this.staxList=[],this.globalPreferences={},this.activeApp={},this.connectionRewrites={},this.daemonCommands={},this.keyboardShortcuts={"#":{tag:"h2",content:""},"##":{tag:"h3",content:""},"###":{tag:"h4",content:""},"####":{tag:"h5",content:""},"#####":{tag:"h6",content:""},"######":{tag:"h6",content:""},"1.":{tag:"ol",content:"
          • "},"-":{tag:"ul",content:"
          • "},"*":{tag:"ul",content:"
          • "},"+":{tag:"ul",content:"
          • "},"---":{tag:"hr"},"***":{tag:"hr"},___:{tag:"hr"},"```":{tag:"code",content:""},">":{tag:"blockquote",content:""}},this.__primsBuilder={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"},dl:{title:"Data list",icon:"editor:format-list-bulleted"},dt:{title:"Data term",icon:"editor:format-list-bulleted"},dd:{title:"Data definition",icon:"editor:format-list-bulleted"},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",tags:["Text","h2","html","text","heading","header"]},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",handles:[{type:"inline",text:"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"},embed:{title:"Embedded object",icon:"icons:fullscreen"}},this.validTagList=this.__validTags(),this.validGridTagList=this.__validGridTags(),this.validGizmoTypes=this.__validGizmoTypes();let e=globalThis.document.createElement("webview");this._isSandboxed="function"==typeof e.reload,globalThis.document.body.style.setProperty("--hax-ui-headings","#d4ff77"),this.revisionHistoryLink=null,f(this,{daemonKeyCombo:x,gizmoList:x,recentGizmoList:x,activeNode:x,globalPreferences:x,activeGizmo:b,activeNodeIndex:b,editMode:x,revisionHistoryLink:x,elementAlign:x,trayStatus:x,trayDetail:x,appList:x,activeApp:x,haxSelectedText:x,activeEditingElement:x,activeHaxBody:x,appStoreLoaded:x}),y((()=>{this._globalPreferencesChanged(T(this.globalPreferences))})),y((()=>{this._editModeChanged(T(this.editMode))})),y((()=>{const e=T(this.recentGizmoList);e.length>0&&N.writeMemory("recentGizmoList",e,"long")}))}async _insertTextResult(e){this.activeNode.focus(),A.activeRange&&(A.activeRange.setStart(this.activeNode,0),A.activeRange.collapse(!0),A.activeSelection.removeAllRanges(),A.activeSelection.addRange(A.activeRange),A.activeSelection.selectAllChildren(this.activeNode),A.activeSelection.collapseToEnd()),setTimeout((()=>{""==this.activeNode.textContent?this.activeNode.textContent=e:globalThis.document.execCommand("insertHTML",!1,e)}),0)}_openExternalLink(e){globalThis.open(e,"_blank")}async _haxStoreContribute(e,t,i=null){let a="";if("merlin"==e){var o=`[${e}] New command request from HAX daemon`;a=`Location: ${globalThis.location.href}\nMerlin command: ${i}\nWhat did you want merlin to do?\n`}else{o=`[${e}] User report from HAX daemon`;if(a=`Location: ${globalThis.location.href}\nBrowser: ${navigator.userAgent}\nOS: ${navigator.userAgentData.platform} - ${navigator.deviceMemory}GB RAM - ${navigator.hardwareConcurrency} cores\nScreen: ${globalThis.screen.width}x${globalThis.screen.height}\nWindow size: ${globalThis.innerWidth}x${globalThis.innerHeight}\n`,navigator.getBattery){a+=`Battery: ${100*(await navigator.getBattery()).level}%\n`}navigator.connection&&navigator.connection.effectiveType&&(a+=`Connection: ${navigator.connection.effectiveType}\n`),a+=("feature"==e?"Your idea:":"Bug you experienced:")+"\n"}globalThis.open(`https://github.com/haxtheweb/issues/issues/new?assignees=&labels=${t}&template=issue-report.md&title=${o}&body=${encodeURIComponent(a)}`,"_blank")}async _richTextEditorPromptOpen(e){if(e.detail.element&&e.detail.element.gizmo.tag){const t=globalThis.document.createElement(e.detail.element.gizmo.tag);HAXStore.testHook(t,"setupActiveElementForm")&&await HAXStore.runHook(t,"setupActiveElementForm",[e.detail.element])}const t=globalThis.getComputedStyle(globalThis.document.body);"hidden"==t.getPropertyValue("overflow")&&(this.__overflowHiddenOnOpen=t.getPropertyValue("overflow"),globalThis.document.body.style.overflow="auto"),setTimeout((()=>{const e=globalThis.document.querySelector("rich-text-editor-prompt").shadowRoot.querySelector(".actions");"function"==typeof e.scrollIntoViewIfNeeded?e.scrollIntoViewIfNeeded(!0):e.scrollIntoView({behavior:"smooth",inline:"center"})}),100)}_richTextEditorPromptConfirm(e){const t=e.detail.value&&e.detail.value.target?e.detail.value.target:null;setTimeout((()=>{"A"===this.activeNode.tagName&&t&&(this.activeNode.setAttribute("target",t),this.refreshActiveNodeForm())}),0),this.__overflowHiddenOnOpen&&(globalThis.document.body.style.overflow=this.__overflowHiddenOnOpen,this.__overflowHiddenOnOpen=null)}_buildPrimitiveDefinitions(){if(this._isSandboxed){let e={type:"element",editingElement:"core",canScale:!0,designSystem:{card:!0,primary:!0},canEditSource:!0,settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this resource.",inputMethod:"textfield",icon:"link",required:!0,validationType:"url"}],advanced:[]}};this.setHaxProperties(e,"webview")}this.setHaxProperties({canScale:!0,type:"element",designSystem:{card:!0,primary:!0},editingElement:"core",canEditSource:!0,gizmo:{title:"Image",description:"A basic img tag",icon:"image:image",color:"blue-grey",tags:["Images","media","img","html"],handles:[{type:"image",source:"src"}],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this image.",inputMethod:"haxupload",noVoiceRecord:!0,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:"loading",title:"Loading method",description:"Whether or not to lazy load this",inputMethod:"select",options:{lazy:"Load when visible",auto:"Automatic"}}]},demoSchema:[{tag:"img",content:"",properties:{src:"https://cdn2.thecatapi.com/images/9j5.jpg",loading:"lazy"}}]},"img");this.setHaxProperties({canScale:!0,type:"grid",canEditSource:!0,gizmo:{title:"Figure",description:"A basic figure tag",icon:"hax:figure",color:"blue-grey",tags:["Images","media","figure","html"],requiresChildren:"figcaption",handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[]},demoSchema:[{tag:"figure",properties:{},content:'image other media here\n

            Image Caption Here

            '}]},"figure");this.setHaxProperties({canScale:!0,type:"grid",editingElement:"core",canEditSource:!0,gizmo:{title:"Figure caption",description:"Used inside of a figure tag",icon:"image:image",color:"blue-grey",tags:["Images","media","caption","figure","html"],handles:[],requiresParent:"figure",meta:{author:"W3C",hidden:!0}},settings:{configure:[{slot:"",title:"Figure Caption",description:"Caption for the figure",inputMethod:"code-editor"}]},demoSchema:[{tag:"figcaption",properties:{},content:"Image Caption Here"}]},"figcaption");this.setHaxProperties({type:"element",editingElement:"core",canScale:!1,designSystem:{primary:!0},canEditSource:!0,contentEditable:!0,gizmo:{title:"Highlight",description:"Highlight text within a block of content",icon:"editor:highlight",color:"yellow",tags:["Content","text","highlight","mark","html"],handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"innerText",title:"Text",description:"Text of the highlight",inputMethod:"textfield",required:!0}],advanced:[],developer:[]},demoSchema:[{tag:"mark",content:"Highlight me",properties:{}}]},"mark");this.setHaxProperties({type:"element",editingElement:"core",canScale:!1,designSystem:{primary:!0},canEditSource:!0,contentEditable:!0,gizmo:{title:"Abbreviation",description:"Simple abbreviation with tooltip of full word",icon:"hax:abbr",color:"yellow",tags:["Content","text","abbr","html"],handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"innerText",title:"Text",description:"Text that is visible, the abbreviation",inputMethod:"textfield",required:!0},{attribute:"title",title:"Word",description:"Word that the abbreviation is representing",inputMethod:"textfield",required:!0}],advanced:[],developer:[]},demoSchema:[{tag:"abbr",content:"Abbr",properties:{title:"Abbreviation"}}]},"abbr");let e={type:"element",editingElement:"core",canScale:!1,designSystem:{accent:!0},canEditSource:!0,contentEditable:!0,gizmo:{title:"Basic link",description:"A basic a tag",icon:"icons:link",color:"blue-grey",tags:["Resource","link","a","url","html","href","address","http"],handles:[],meta:{author:"W3C"}},settings:{configure:[{attribute:"href",title:"Link",description:"The URL for the link",inputMethod:"haxupload",required:!0,validationType:"url"},{attribute:"innerText",title:"Text",description:"Text of the link",inputMethod:"textfield",required:!0},{attribute:"target",title:"Target",description:"Where to open the link.",inputMethod:"select",options:{"":"Same window",_blank:"New window - _blank",_top:"Top window - _top",_parent:"Parent window - _parent"}}],advanced:[],developer:[{attribute:"title",title:"Title text",description:"Useful for screen readers and improved SEO.",inputMethod:"textfield"},{attribute:"rel",title:"rel",description:"Specifies the relationship between this document and the opened globalThis.document. Change as part of security or SEO policy.",inputMethod:"select",options:{noopener:"noopener","noopener noreferrer":"noopener noreferrer","nofollow ":"nofollow","noopener noreferrer nofollow":"noopener noreferrer nofollow",opener:"opener"}}]},demoSchema:[{tag:"p",content:'Link to content',properties:{}}]};this.validGizmoTypes.forEach((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,designSystem:!0,canEditSource:!0,contentEditable:!0,gizmo:{title:"Paragraph",description:"A basic text area",icon:"hax:paragraph",color:"blue-grey",tags:["Text","p","paragraph","text","html"],handles:[{type:"content",title:"innerHTML",alt:"title"}],meta:{author:"W3C",outlineDesigner:!0}},settings:{configure:[],advanced:[]},demoSchema:[{tag:"p",content:"Deep thoughts..",properties:{}}]},"p");let t={type:"element",editingElement:{tag:"editable-table",import:"@haxtheweb/editable-table/editable-table.js",callback:this.setupEditableTable.bind(this)},canScale:!0,canEditSource:!0,gizmo:{title:"Table",description:"A table for displaying data",icon:"image:grid-on",color:"blue-grey",tags:["Instructional","table","data","html","grid","matrix","spreadsheet","csv","excel"],meta:{hidden:!0,author:"W3C"}},settings:{configure:[],advanced:[]}};this.setHaxProperties(t,"table");let i=globalThis.document.createElement("editable-table");this.haxAutoloader.appendChild(i);let a={type:"element",editingElement:{tag:"iframe-loader",import:"@haxtheweb/iframe-loader/iframe-loader.js",callback:this.setupIframeLoader.bind(this)},canScale:!1,designSystem:{card:!0,primary:!0},canEditSource:!1,gizmo:{title:"iFrame",description:"A basic way to frame external web content",icon:"hax:iframe",color:"blue-grey",tags:["Resource","iframe","content","url","link","embed","https","html","address"],handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this resource.",inputMethod:"textfield",icon:"link",required:!0,validationType:"url"}]}};this.setHaxProperties(a,"iframe");let o=globalThis.document.createElement("iframe-loader");this.haxAutoloader.appendChild(o);for(let e in this.__primsBuilder){let t="";["h1","h2","h3","h4","h5","h6"].includes(e)?t="Heading":"ul"!=e&&"ol"!=e||(t="
          • Item
          • Item
          • "),this.setHaxProperties({type:"element",editingElement:"core",canScale:!1,designSystem:["h1","h2","h3","h4","h5","h6"].includes(e)?{text:!0,card:!0,primary:!0,designTreatment:!0}:!!["ol","ul"].includes(e)&&{text:!0,card:!0,accent:!0,primary:!0},canEditSource:!0,contentEditable:!0,gizmo:{title:this.__primsBuilder[e].title,icon:this.__primsBuilder[e].icon,tags:this.__primsBuilder[e].tags||["Text",e,"html","text"],handles:this.__primsBuilder[e].handles||[],meta:{author:"W3C",inlineOnly:!!["em","b","strong","i","strike","u","sub","sup","span"].includes(e),hidden:!["h2","ul"].includes(e),outlineDesigner:!!["h2","ul"].includes(e)}},settings:{configure:[],advanced:[]},demoSchema:[{tag:e,content:t,properties:{}}]},e)}this.setHaxProperties({canScale:!0,type:"element",editingElement:"core",designSystem:{primary:!0},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")}_haxStorePieceRegistrationManager(e){e.detail&&e.detail.piece&&e.detail.object&&(this[e.detail.piece]=e.detail.object)}setupEditableTable(e){this.activeNode=e,setTimeout((()=>{e.editMode=!0,e.focus()}),0)}setupIframeLoader(e){this.activeNode=e,setTimeout((()=>{e.disabled=!0}),0)}async _haxStoreInsertContent(e){if(e.detail){let i=e.detail;if(globalThis.customElements.get(i.tag)){let e=globalThis.document.createElement(i.tag);this.testHook(e,"preProcessInsertContent")&&(i=await this.runHook(e,"preProcessInsertContent",[i,this.activeNode]))}var t={};if(void 0!==i.properties&&(t=i.properties),t.innerHTML&&(""==i.content&&(i.content=t.innerHTML),delete t.innerHTML),t.innerText&&(""==i.content&&(i.content=t.innerText),delete t.innerText),void 0!==i.__type&&"inline"===i.__type){let e=c({tag:i.tag,content:i.content,properties:t});null!==this.activePlaceHolder&&(this.activePlaceHolder.deleteContents(),this.activePlaceHolder.insertNode(e)),this.activePlaceHolder=null}else if(i.replace||i.replacement||i.nextToActive){let e=c({tag:i.tag,content:i.content,properties:t});this.activePlaceHolder?(this.activeHaxBody.haxReplaceNode(this.activePlaceHolder,e),this.activePlaceHolder=null):i.nextToActive&&this.activeNode?this.activeHaxBody.__slot&&this.activeNode.haxLayoutContainer?this.activeNode.appendChild(e):this.activeNode.parentNode.insertBefore(e,this.activeNode):this.activeHaxBody.haxReplaceNode(this.activeNode,e)}else if(this.activeNode&&this.activeNode.parentNode&&"HAX-BODY"!=this.activeNode.parentNode.tagName){let e=c({tag:i.tag,content:i.content,properties:t});this.activeNode.parentNode.haxLayoutContainer?(null!=this.activeNode.getAttribute("slot")&&e.setAttribute("slot",this.activeNode.getAttribute("slot")),this.activeHaxBody.haxInsert(i.tag,i.content,t)):this.activeHaxBody.haxInsert(i.tag,i.content,t)}else this.activeHaxBody.haxInsert(i.tag,i.content,t)}}slotsFromSchema(e,t=!1){let i=e?e.settings:{},a=[];return Object.keys({...i||{}}).map((e=>(i[e]||[]).filter((e=>{let i=!t||!e.required;return!(!e.slot&&""!==e.slot||a.includes(e.slot)||!i)&&(a.push(e.slot),!0)})))).flat()}haxSchemaFromTag(e){return e&&e.toLowerCase&&(e=e.toLowerCase(),this.elementList&&this.elementList[e])?this.elementList[e]:{}}_haxStoreInsertMultiple(e){var t;if(e.detail)for(let i in e.detail)t={},void 0!==e.detail[i].properties&&(t=e.detail[i].properties),this.activeHaxBody.haxInsert(e.detail[i].tag,e.detail[i].content,t)}_haxStoreRegisterBody(e){e.detail&&(this.haxBodies.push(e.detail),this.activeHaxBody=e.detail,this.write("activeHaxBody",this.activeHaxBody,this),this.write("editMode",this.editMode,this),clearTimeout(this.__storeReady),this.__storeReady=setTimeout((()=>{this._storePiecesAllHere(this.haxAutoloader,this.activeHaxBody,this.haxTray,this.haxCancel)}),0))}_superDaemonInsert(e){A.programTarget&&e.detail.properties&&(e.detail.properties.src||e.detail.properties.source||e.detail.properties.href)?A.programTarget.value=e.detail.properties.src||e.detail.properties.source||e.detail.properties.href:this.haxTray._processTrayEvent(e),A.programTarget=null}computePolyfillSafe(){return!(!globalThis.document.head.createShadowRoot&&!globalThis.document.head.attachShadow)||(console.warn("Shadow DOM missing, certain operations hidden"),!1)}_haxStoreRegisterApp(e){if(e.detail){const i=e.detail;i.index=this.appList.length,this.appList=[...this.appList,i],this.write("appList",T(this.appList),this);let a="media";if(i.connection.operations&&i.connection.operations.browse&&i.connection.operations.browse.resultMap&&i.connection.operations.browse.resultMap.defaultGizmoType&&(a=i.connection.operations.browse.resultMap.defaultGizmoType),A.defineOption({title:"Search "+i.details.title,icon:i.details.icon,tags:["Search",...i.details.tags,a],more:i.details.tos&&i.details.tos.length>0?t`
            Terms of service:
            +import{LitElement as e,html as t,nothing as i}from"../../../lit/index.js";import{SimpleTourManager as a}from"../../simple-popover/lib/simple-tour.js";import{HaxSchematizer as o,HaxElementizer as r}from"../../hax-body-behaviors/lib/HAXFields.js";import{winEventsElement as n,getRange as s,stripMSWord as l,nodeToHaxElement as d,haxElementToNode as c,validURL as h,camelToDash as p,htmlEntities as m,localStorageGet as g,localStorageSet as u}from"../../utils/utils.js";import{observable as x,makeObservable as f,computed as b,configure as v,autorun as y,toJS as T}from"../../../mobx/dist/mobx.esm.js";v({enforceActions:!1});import{HAXElement as S}from"../../hax-body-behaviors/hax-body-behaviors.js";import{I18NMixin as H,I18NManagerStore as w}from"../../i18n-manager/lib/I18NMixin.js";import{enableServices as E}from"../../micro-frontend-registry/lib/microServices.js";import{SuperDaemonInstance as A}from"../../super-daemon/super-daemon.js";import"../../media-behaviors/media-behaviors.js";import"../../editable-table/editable-table.js";import"../../iframe-loader/iframe-loader.js";import"../../hax-iconset/lib/hax-iconset-manifest.js";import{UserScaffoldInstance as N}from"../../user-scaffold/user-scaffold.js";import"./hax-app.js";function sessionStorageGet(e){try{return sessionStorage.getItem(e)}catch(e){return!1}}function sessionStorageSet(e,t){try{return sessionStorage.setItem(e,t)}catch(e){return!1}}class HaxStore extends(H(n(S(e)))){testHook(e,t){return!!(e&&e.tagName&&this.HTMLPrimativeTest(e)&&this.primativeHooks[e.tagName.toLowerCase()]&&this.primativeHooks[e.tagName.toLowerCase()][t])||e&&"function"==typeof e.haxHooks&&e.haxHooks()[t]}async runHook(e,t,i=[]){return!!this.testHook(e,t)&&(this.HTMLPrimativeTest(e)?await this.primativeHooks[e.tagName.toLowerCase()][t](...i):await e[e.haxHooks()[t]](...i))}getSelection(){if(this.activeHaxBody&&this.activeHaxBody.parentNode){if(this.activeHaxBody.parentNode.getSelection)return this.activeHaxBody.parentNode.getSelection();try{if(s(this.activeHaxBody.parentNode))return s(this.activeHaxBody.parentNode)}catch(e){}}return globalThis.getSelection()}getRange(){let e=this.getSelection();return e&&e.getRangeAt&&e.rangeCount?e.getRangeAt(0):e||!1}guessGizmo(e,t,i=!1,a=!1){var o=[],r=[];if(void 0!==e&&this.validGizmoTypes.includes(e))for(let n in this.gizmoList){let s=T(this.gizmoList[n]),l=t.innerHTML?{innerHTML:t.innerHTML}:{},d=!1;if(s&&s.handles)for(let n=0;n{t&&t.type&&""!=t.type&&(e[t.type.toLowerCase()]=!0)})),s.tags&&s.tags.length>0&&[...s.tags].forEach((t=>{t&&""!=t&&(e[t.toLowerCase()]=!0)})),s.keywords=Object.keys(e),r.includes(s.tag)||(o.push(this.haxElementPrototype(s,l,"")),r.push(s.tag))}}}}return o}insertLogicFromValues(e,t,i=!1,a=!1){let o=this.activePlaceHolderOperationType||this.guessGizmoType(e);if("upload-only"===o)return this.toast("Upload successful!"),!1;"link"===this.activePlaceHolderOperationType&&(a=!0),this.activePlaceHolderOperationType=null;let r=o,n=!0;if("*"==o){if(i)return!1;n=!1,r="link"}let s=this.guessGizmo(o,e,!1,n);return s.length>0?(1===s.length||a?1===s.length&&void 0!==s[0].tag?t.dispatchEvent(new CustomEvent("hax-insert-content",{bubbles:!0,cancelable:!0,composed:!0,detail:s[0]})):a&&t.dispatchEvent(new CustomEvent("hax-insert-content",{bubbles:!0,cancelable:!0,composed:!0,detail:s.find((e=>"a"==e.tag))})):this.haxAppPicker.presentOptions(s,o,"Pick how to present this "+r,"gizmo"),!0):(this.toast("Sorry, HAX doesn't know how to handle that type of link yet."),!1)}write(e,t,i){i&&i.dispatchEvent(new CustomEvent("hax-store-write",{composed:!0,bubbles:!0,cancelable:!1,detail:{property:e,value:t,owner:i}}))}mimeTypeToGizmoType(e){let 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"}}guessGizmoType(e){if(void 0!==e.source){const 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"))return"image";if(-1!=t.indexOf(".gif"))return"gif";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"!=globalThis.MediaBehaviors.Video.getVideoType(t))return"video"}return"*"}render(){return t` `}static get tag(){return"hax-store"}toast(e,t=2e3,i={},a="capsule",o=this.t.close,r=null,n=null){globalThis.dispatchEvent(new CustomEvent(this.toastShowEventName,{bubbles:!0,composed:!0,cancelable:!0,detail:{text:e,duration:t,classStyle:a,closeText:o,eventCallback:r,slot:n,...i}}))}static get properties(){return{...super.properties,skipHAXConfirmation:{type:Boolean,reflect:!0,attribute:"skip-hax-confirmation"},storageData:{type:Object},haxTray:{type:Object},haxCancel:{type:Object},haxAutoloader:{type:Object},haxBodies:{type:Array},activePlaceHolder:{type:Object},activePlaceHolderOperationType:{type:String},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}}}_storageDataChanged(e){e&&this.ready&&this.__storageDataProcessed&&(g("haxConfirm",!1)?u("haxUserData",e):sessionStorageGet("haxConfirm")&&sessionStorageSet("haxUserData",e))}isSingleSlotElement(e){let t=Object.keys(this.slotsSchemaFromNode(e));return 1==t.length&&0===t[0].length}isTextElement(e){let 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","mark","abbr","i","bold","em","strong","blockquote","code","figure"].includes(t))}isInlineElement(e){let t;return null!=e&&e.tagName?t=e.tagName.toLowerCase():null!=e&&e.tag?t=e.tag.toLowerCase():"string"==typeof e&&(t=e),!!(t&&this.validTagList.includes(t)&&(this.haxSchemaFromTag(t)&&this.haxSchemaFromTag(t).meta&&this.haxSchemaFromTag(t).meta.inlineOnly||["a","strike","u","b","sub","sup","span","code","mark","abbr","i","bold","em","strong"].includes(t)))}isGridPlateElement(e){let t;return e&&e.tagName?t=e.tagName.toLowerCase():e&&e.tag&&(t=e.tag.toLowerCase()),!(!t||!this.validGridTagList.includes(t))}isLayoutElement(e){let t=e&&e.tagName&&this.haxSchemaFromTag(e.tagName)||{};return t.type&&"grid"===t.type}isLayoutSlot(e){return!(!e||!e.parentNode)&&this.isLayoutElement(e.parentNode)}isOriginalGridPlate(e){return!!e&&"GRID-PLATE"===e.tagName}activeSchema(){return this.activeNode?this.haxSchemaFromTag(this.activeNode.tagName):void 0}activeParentSchema(){return this.activeNode&&this.activeNode.parentNode?this.haxSchemaFromTag(this.activeNode.parentNode.tagName):void 0}slottedContentByNode(e){let t={...this.slotsSchemaFromNode(e)||{}};return e?([...e.children||[]].forEach((e=>{e.slot&&""!==e.slot&&t[e.slot]?(t[e.slot].items=t[e.slot].items||[],t[e.slot].items.push(e)):e.slot&&""!==e.slot||!t[""]||(t[""].items=t[""].items||[],t[""].items.push(e))})),t):t}slotsSchemaFromNode(e){if(!e||!e.tagName)return{};let t={},i=this.haxSchemaFromTag(e.tagName||{}),a=this.slotsFromSchema(i);if(this.isOriginalGridPlate(e)){(e.layout||"1-1-1-1").split("-").map(((e,t)=>{a.push({slot:`col-${t+1}`,title:`Column ${t+1}`,excludedSlotWrappers:["grid-plate"]})}))}return a.forEach((a=>{a.items=void 0,a.label=a.title||a.slot,a.editMode={...i.editMode,...a.editMode},a.grid=e,(a.slot||""===a.slot)&&(t[a.slot]=a)})),t}schemaBySlotId(e,t){return(this.slotsSchemaFromNode(e)||{})[t]}_appStoreChanged(e,t){e&&t&&(e.url&&!e.apps&&this.shadowRoot?this.loadAppStoreFromRemote():this.__appStoreData=e)}async _loadAppStoreData(e){if(null!=e){var t={};if(void 0!==e.autoloader){e.autoloader=Object.assign({},e.autoloader);for(let i in e.autoloader){let a=i,o=e.autoloader[i];isNaN(a)||(a=e.autoloader[i],o=`@haxtheweb/${a}/${a}.js`),"string"!=typeof o&&(o.haxProperties&&this.setHaxProperties(e.autoloader[i].haxProperties,a),o=e.autoloader[i].import),this.validTagList.push(a),t[a]=o}}if(void 0!==e.apps){var i=e.apps;for(let e=0;e{globalThis.customElements.get(a)&&globalThis.customElements.get(a).haxProperties?this.setHaxProperties(globalThis.customElements.get(a).haxProperties,a):t.appendChild(globalThis.document.createElement(a))})).catch((e=>{console.warn(e),t.appendChild(globalThis.document.createElement(a))}))}}isExternalURLImport(e){let t;try{t=new URL(e)}catch(e){return!1}return new URL(t).origin!==location.origin}_editModeChanged(e){e&&!this.appStoreLoaded&&this.__appStoreData&&this.haxAutoloader&&(clearTimeout(this.__readyToProcessAppStoreData),this._loadAppStoreData(this.__appStoreData))}async _globalPreferencesChanged(e){if(this.__storageDataProcessed&&e&&this.ready){let t=this.storageData;"string"==typeof t&&(t=JSON.parse(t)),t.globalPreferences=e,this.storageData=t,this._storageDataChanged(this.storageData),e.haxLang&&HAXStore.editMode&&(clearTimeout(this._debounceLang),this._debounceLang=setTimeout((async()=>{for(let e in this.elementList){let t=this.elementList[e];t=await this.attemptGizmoTranslation(e,t),this.elementList[e]=t}this.gizmoList.forEach((e=>{this.elementList[e.tag].gizmo.title&&(e.title=this.elementList[e.tag].gizmo.title),this.elementList[e.tag].gizmo.description&&(e.description=this.elementList[e.tag].gizmo.description)}))}),100))}}_haxConsentTap(e){u("haxConfirm",!0),u("haxUserData",JSON.stringify(this.storageData))}updated(e){super.updated&&super.updated(e),e.forEach(((e,t)=>{"appStore"==t&&this[t]&&this._appStoreChanged(this[t],e),["ready","__appStoreData","haxAutoloader"].includes(t)&&this.ready&&this.__appStoreData&&this.haxAutoloader&&(clearTimeout(this.__readyToProcessAppStoreData),this.__readyToProcessAppStoreData=setTimeout((()=>{this._loadAppStoreData(this.__appStoreData)}),0)),["haxAutoloader","haxTray","haxCancel"].includes(t)&&(clearTimeout(this.__storeReady),this.__storeReady=setTimeout((()=>{this._storePiecesAllHere(this.haxAutoloader,this.activeHaxBody,this.haxTray,this.haxCancel)}),0))}))}_calculateActiveGizmo(e){if(null==e||!e.tagName)return null;for(let i in this.gizmoList){var t=this.gizmoList[i];if(t.tag===e.tagName.toLowerCase())return t}}loadAppStoreFromRemote(){const e=new URLSearchParams(this.appStore.params);let t=this.appStore.url;e&&(t+=`?${e}`),fetch(t,{method:this.method}).then((e=>{if(e.ok)return e.json()})).then((e=>{this.__appStoreData=e}))}firstUpdated(e){if(super.firstUpdated&&super.firstUpdated(e),this.skipHAXConfirmation&&(sessionStorageSet("haxConfirm",!0),u("haxConfirm",!0)),sessionStorageGet("haxConfirm")||g("haxConfirm"))if(sessionStorageGet("haxConfirm")&&!g("haxConfirm"))try{let e=sessionStorageGet("haxUserData")?JSON.parse(sessionStorageGet("haxUserData")):{};this.storageData=e,this._storageDataChanged(this.storageData)}catch(e){}else try{let e=g("haxUserData",{});this.storageData=e,this._storageDataChanged(this.storageData)}catch(e){}else{sessionStorageSet("haxConfirm",!0);let e="\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 ";this.toast(e,"-1",{},"fit-bottom","I Accept","hax-consent-tap")}setTimeout((()=>{this.__storageDataProcessed=!0,this.storageData.globalPreferences&&this.write("globalPreferences",this.storageData.globalPreferences,this)}),0)}_storePiecesAllHere(e,t,i,a){if(!this.ready&&t&&e&&i&&a){this.dispatchEvent(new CustomEvent("hax-store-ready",{bubbles:!0,cancelable:!1,composed:!0,detail:!0}));let e=globalThis.RichTextEditorPrompt.requestAvailability();e&&(e.shadowRoot.querySelector("#formfields").schematizer=o,e.shadowRoot.querySelector("#formfields").elementizer=r),i.shadowRoot.querySelector("#haxcancelbutton")&&(a.shadowRoot.querySelector("#dialog").associateEvents(i.shadowRoot.querySelector("#haxcancelbutton")),a.shadowRoot.querySelector("#dialog")&&globalThis.addEventListener("simple-modal-confirmed",this._handleConfirmCancel.bind(this))),this.ready=!0,this._buildPrimitiveDefinitions()}}_handleConfirmCancel(e){e.detail.invokedBy===this.haxTray.shadowRoot.querySelector("#haxcancelbutton")&&(this.editMode=!1,this.dispatchEvent(new CustomEvent("hax-cancel",{bubbles:!0,composed:!0,cancelable:!1,detail:e.detail})))}_positionCursorInNode(e,t=0){this.activeHaxBody.positionContextMenus();var i=globalThis.document.createRange(),a=this.getSelection();return i.setStart(e,t),i.collapse(!0),a.removeAllRanges(),a.addRange(i),i}_onBeforeUnload(e){if(!this.skipExitTrap&&this.editMode)return"Are you sure you want to leave? Your work will not be saved!"}isBase64(e){try{return btoa(atob(e))==e}catch(e){return!1}}retrieveImageFromClipboardAsBlob(e,t){if(0==e.clipboardData&&"function"==typeof t)return t(void 0);var i=e.clipboardData.items;if(null==i&&"function"==typeof t)return t(void 0);for(let e=0;e{for(var i in e)i.startsWith("hax")||(this.activeNode.dataset[i]=e[i]);t&&this.activeNode.setAttribute("slot",t)}),0)}}async _onPaste(e){if(this.editMode&&"HAX-TRAY"!==globalThis.document.activeElement.tagName&&"BODY"!==globalThis.document.activeElement.tagName&&"SIMPLE-MODAL"!==globalThis.document.activeElement.tagName){this.isTextElement(this.activeNode)||(this.activeNode=this.activeHaxBody.haxInsert("p","",{}));let o="",r="";if(e.clipboardData||e.originalEvent.clipboardData?(o=(e.originalEvent||e).clipboardData.getData("text/html"),""==o&&(o=(e.originalEvent||e).clipboardData.getData("text"))):globalThis.clipboardData&&(o=globalThis.clipboardData.getData("Text")),o=o.trim(),o=o.replace(/\s*?<\/span>/g," "),o=o.replace(/(?:style="(\S+:\s*[^;"]+;\s*)*)+"/g,""),o=o.replace(/
            /g,"

            "),r=o,this.isBase64(r))return e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.retrieveImageFromClipboardAsBlob(e,(t=>{if(t){var i=globalThis.URL||globalThis.webkitURL;let a=globalThis.document.createElement("img");a.src=i.createObjectURL(t),this.activeNode.parentNode.insertBefore(a,this.activeNode.nextElementSibling);for(let t in e.clipboardData.items)!e.clipboardData.items[t].name&&e.clipboardData.items[t].type&&(e.clipboardData.items[t].name="image-"+Math.floor(Date.now()/1e3)+e.clipboardData.items[t].type.replace("image/","."));return e.dataTransfer=e.clipboardData,e.placeHolderElement=a,this.dispatchEvent(new CustomEvent("place-holder-file-drop",{bubbles:!0,cancelable:!0,composed:!0,detail:e})),a}return!1}));if(e.clipboardData.files.length>0){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();let t=this.activeHaxBody.haxInsert("p","",{});e.dataTransfer=e.clipboardData;for(let t in e.clipboardData.files)!e.clipboardData.files[t].name&&e.clipboardData.files[t].type&&(e.clipboardData.files[t].name="image-"+Math.floor(Date.now()/1e3)+e.clipboardData.files[t].type.replace("image/","."));e.placeHolderElement=t,this.dispatchEvent(new CustomEvent("place-holder-file-drop",{bubbles:!0,cancelable:!0,composed:!0,detail:e}))}let n=!1,s="",d=globalThis.document.createElement("div");d.innerHTML=o;let p=[];if(d.children&&(o=l(o),o=o.replace(/

            /g,"

            "),o=o.replace(/<\/h1>/g,"

            "),o=o.replace(//g,(function(e,t){return``})),p=await this.htmlToHaxElements(o),1!==p.length||this.__validGridTags().includes(p[0].tag)||(p=await this.htmlToHaxElements(p[0].content))),0===p.length&&h(o)){""!=this.activeNode.innerText.trim()&&(n=!0);let e={source:o,title:o};if(!n&&!this.insertLogicFromValues(e,this,!1,!0))return!1}else if(0===p.length){if(n=!0,r==o)return!1;s=o}else if(1===p.length&&"p"===p[0].tag)s=o,n=!0;else if(1===p.length&&"a"===p[0].tag&&p[0].properties.href)if(""!=this.activeNode.innerText.trim())s=p[0].properties.href,n=!0;else{let e={source:p[0].properties.href,title:p[0].content};if(!this.insertLogicFromValues(e,this))return!1}else{if(!this.isGridPlateElement(p[0]))return!1;for(let e in p){"p"==p[e].tag&&["li","ol","ul"].includes(this.activeNode.tagName.toLowerCase())&&(p[e].tag="li"),delete p[e].properties.style,delete p[e].properties.start,delete p[e].properties.align;let t=c({tag:p[e].tag,content:p[e].content.replace(/ <\/span>/g," ").trim(),properties:p[e].properties});s+=await this.nodeToContent(t)}}e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();try{let e=this.getRange(),r=this.getSelection(),l=globalThis.document.createElement("div");if(l.innerHTML=s,e&&r){for(let e in l.children)l.children[e].tagName&&this.isTextElement(l.children[e])&&""===l.children[e].innerHTML&&l.children[e].remove();if(n){let t;if(h(o))t=globalThis.document.createElement("a"),t.setAttribute("href",o),t.setAttribute("rel","noopener noreferrer"),t.setAttribute("target","_blank"),t.innerText=o;else if(l.children&&l.children.length>0){for(;l.childNodes.length>1;)e.insertNode(Array.from(l.childNodes).pop());t=Array.from(l.childNodes).pop()}else t=globalThis.document.createTextNode(l.innerHTML);e.deleteContents(),e.insertNode(t),setTimeout((()=>{this._positionCursorInNode(t,t.length)}),0)}else{var t,i,a;for(""!=this.activeNode.innerText.trim()&&e.endOffset!=this.activeNode.innerText.length&&(t=!0,globalThis.document.execCommand("insertParagraph")),e.commonAncestorContainer&&e.commonAncestorContainer.parentNode&&(a||this.activeNode==e.commonAncestorContainer||(a=e.commonAncestorContainer.parentNode)||(a=e.commonAncestorContainer));l.firstElementChild;)i=l.firstElementChild,a?(a.getAttribute&&a.getAttribute("slot")&&i.setAttribute("slot",a.getAttribute("slot")),t?(this.activeHaxBody.haxReplaceNode(a.previousElementSibling,i),t=!1):a.parentNode?a.parentNode.insertBefore(i,a.nextElementSibling):a.insertBefore(i,a.nextElementSibling)):this.activeNode?(this.activeNode.getAttribute("slot")&&i.setAttribute("slot",this.activeNode.getAttribute("slot")),""==this.activeNode.innerText.trim()?this.activeHaxBody.haxReplaceNode(this.activeNode,i):this.activeNode.parentNode.insertBefore(i,this.activeNode.nextElementSibling)):this.activeHaxBody.appendChild(i),a=i;setTimeout((()=>{i&&i.childNodes&&i.childNodes[0]&&(this._positionCursorInNode(i.childNodes[0],i.childNodes[0].length),i=null,a=null)}),0)}}}catch(e){console.warn(e)}}}__validGridTags(){return["p","ol","ul","li","div","h1","h2","h3","h4","h5","h6","blockquote","code","section","dl","dd","dt","figure"]}__validTags(){return["p","div","span","mark","abbr","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","figcaption","img","iframe","video","audio","section","dl","dt","dd","template","webview"]}__validGizmoTypes(){return["data","video","audio","text","link","file","pdf","image","csv","doc","document","archive","markdown","html","content","text","gif","inline","*"]}constructor(){super(),E(["core"]),this.toastShowEventName=globalThis.HAXCMS?"haxcms-toast-show":"simple-toast-show",this.t={close:"Close"},void 0!==globalThis.speechSynthesis&&(globalThis.SpeechRecognition||globalThis.webkitSpeechRecognition||globalThis.mozSpeechRecognition||globalThis.msSpeechRecognition||globalThis.oSpeechRecognition)&&(A.voiceSearch=!0),A.icon="hax:wizard-hat",A.allowedCallback=()=>!(!this.ready||!this.editMode),A.defineOption({title:"Insert emoji",icon:"editor:insert-emoticon",tags:["emoji"],value:{name:"Insert emoji",context:"/",program:async(e,t)=>{let i=[],a=globalThis.document.createElement("textarea");return await Object.keys(globalThis.SimplePickerEmojis).forEach((async t=>{await globalThis.SimplePickerEmojis[t].forEach((async o=>{(""==e||o.description.includes(e))&&(a.innerHTML=o.value,i.push({title:o.description,textCharacter:a.value,tags:[t],value:{target:this,method:"_insertTextResult",args:[a.value]},context:["/","/HAX/text/emoji/"+a.value],eventName:"super-daemon-element-method",path:"/HAX/text/emoji/"+a.value}))}))})),i}},context:["HAX","/"],eventName:"super-daemon-run-program",path:"/HAX/text/emoji"}),A.defineOption({title:"Insert symbol",icon:"editor:functions",tags:["symbol"],value:{name:"Insert symbol",context:"/",program:async(e,t)=>{let i=[],a=globalThis.document.createElement("textarea");return await Object.keys(globalThis.SimplePickerSymbols).forEach((async t=>{await globalThis.SimplePickerSymbols[t].forEach((async o=>{(""==e||t.includes(e))&&(a.innerHTML=o.value,i.push({title:`${t}: ${a.value}`,textCharacter:a.value,tags:[t],value:{target:this,method:"_insertTextResult",args:[a.value]},context:["/","/HAX/text/symbol/"+a.value],eventName:"super-daemon-element-method",path:"/HAX/text/symbol/"+a.value}))}))})),i}},context:["HAX","/"],eventName:"super-daemon-run-program",path:"/HAX/text/symbol"}),A.defineOption({title:"Join our Community",icon:"hax:discord",priority:-100,tags:["community","discord","chat","help"],value:{target:this,method:"_openExternalLink",args:["https://bit.ly/hax-discord"]},eventName:"super-daemon-element-method",path:"HAX/community/join",context:["logged-in","CMS","HAX"]}),A.defineOption({title:"User Tutorials",icon:"hax:hax2022",priority:-1e3,tags:["Documentation","community","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/tutorials"]},eventName:"super-daemon-element-method",path:"HAX/community/tutorials",context:["logged-in","CMS","HAX"]}),A.defineOption({title:"User Documentation",icon:"hax:hax2022",tags:["Documentation","community","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/documentation"]},eventName:"super-daemon-element-method",path:"HAX/community/documentation",context:["logged-in","CMS","HAX"]}),A.defineOption({title:"HAX Teaching Excellence",icon:"hax:hax2022",tags:["Ontology","community","pedagogy","documentation","help"],value:{target:this,method:"_openExternalLink",args:["https://oer.hax.psu.edu/bto108/sites/haxcellence/ontology"]},eventName:"super-daemon-element-method",path:"HAX/community/pedagogy",context:["logged-in","CMS","HAX"]}),A.defineOption({title:"Bug / issue",icon:"mdi-social:github-circle",tags:["Bug report","github","git","community","issue queue"],value:{target:this,method:"_haxStoreContribute",args:["bug","POP,bug"]},eventName:"super-daemon-element-method",path:"HAX/community/contribute",context:["logged-in","CMS","HAX"]}),A.defineOption({title:"Idea / Feature request",icon:"mdi-social:github-circle",tags:["Feature request","idea","github","git","community","issue queue"],value:{target:this,method:"_haxStoreContribute",args:["feature","POP,enhancement"]},context:["logged-in","CMS","HAX"],eventName:"super-daemon-element-method",path:"HAX/community/contribute"}),this.primativeHooks={},this.__dragTarget=null,this.registerLocalization({context:this,namespace:"hax",basePath:import.meta.url+"/../../",locales:["es"]}),this.appSearch=null,this.method="GET",this.haxSelectedText="",this.__winEvents={"hax-super-daemon-insert-tag":"_superDaemonInsert","hax-register-properties":"_haxStoreRegisterProperties","hax-consent-tap":"_haxConsentTap",onbeforeunload:"_onBeforeUnload",paste:"_onPaste",command:"_onCommand","hax-register-app":"_haxStoreRegisterApp","hax-register-stax":"_haxStoreRegisterStax","hax-register-core-piece":"_haxStorePieceRegistrationManager","hax-register-body":"_haxStoreRegisterBody","hax-insert-content":"_haxStoreInsertContent","hax-insert-content-array":"_haxStoreInsertMultiple","hax-refresh-tray-form":"refreshActiveNodeForm","rich-text-editor-prompt-open":"_richTextEditorPromptOpen","rich-text-editor-prompt-confirm":"_richTextEditorPromptConfirm"},globalThis.onbeforeunload=e=>{if(!this.skipExitTrap&&this.editMode){var t="Are you sure you want to leave? Your work will not be saved!";return e.returnValue=t,t}},a.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 padding: 0;\n margin: 0;\n font-size: 14px;\n line-height: 20px;\n }\n simple-popover-manager h3 {\n margin: 8px 2px;\n }"}),this.skipHAXConfirmation=!1,this.storageData={},this.appStore={url:"",params:{}},this.daemonKeyCombo=`${A.key1} + ${A.key2} + `,this.activeNode=null,this.activeEditingElement=null,this.haxBodies=[],this.activePlaceHolder=null,this.activePlaceHolderOperationType=null,this.sessionObject={},this.editMode=!1,this.skipExitTrap=!1,this.appStoreLoaded=!1,this.elementList={},this.elementAlign=g("hax-tray-elementAlign"),this.elementAlign&&null!=this.elementAlign||(this.elementAlign="left"),this.trayStatus="collapsed",this.trayDetail="content-edit",this.appList=[],this.gizmoList=[],this.recentGizmoList=N.readMemory("recentGizmoList")||[],this.haxAutoloader=null,this.activeHaxBody=null,this.haxTray=null,this.haxCancel=null,this.staxList=[],this.globalPreferences={},this.activeApp={},this.connectionRewrites={},this.daemonCommands={},this.keyboardShortcuts={"#":{tag:"h2",content:""},"##":{tag:"h3",content:""},"###":{tag:"h4",content:""},"####":{tag:"h5",content:""},"#####":{tag:"h6",content:""},"######":{tag:"h6",content:""},"1.":{tag:"ol",content:"
          • "},"-":{tag:"ul",content:"
          • "},"*":{tag:"ul",content:"
          • "},"+":{tag:"ul",content:"
          • "},"---":{tag:"hr"},"***":{tag:"hr"},___:{tag:"hr"},"```":{tag:"code",content:""},">":{tag:"blockquote",content:""}},this.__primsBuilder={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"},dl:{title:"Data list",icon:"editor:format-list-bulleted"},dt:{title:"Data term",icon:"editor:format-list-bulleted"},dd:{title:"Data definition",icon:"editor:format-list-bulleted"},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",tags:["Text","h2","html","text","heading","header"]},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",handles:[{type:"inline",text:"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"},embed:{title:"Embedded object",icon:"icons:fullscreen"}},this.validTagList=this.__validTags(),this.validGridTagList=this.__validGridTags(),this.validGizmoTypes=this.__validGizmoTypes();let e=globalThis.document.createElement("webview");this._isSandboxed="function"==typeof e.reload,globalThis.document.body.style.setProperty("--hax-ui-headings","#d4ff77"),this.revisionHistoryLink=null,f(this,{daemonKeyCombo:x,gizmoList:x,recentGizmoList:x,activeNode:x,globalPreferences:x,activeGizmo:b,activeNodeIndex:b,editMode:x,revisionHistoryLink:x,elementAlign:x,trayStatus:x,trayDetail:x,appList:x,activeApp:x,haxSelectedText:x,activeEditingElement:x,activeHaxBody:x,appStoreLoaded:x}),y((()=>{this._globalPreferencesChanged(T(this.globalPreferences))})),y((()=>{this._editModeChanged(T(this.editMode))})),y((()=>{const e=T(this.recentGizmoList);e.length>0&&N.writeMemory("recentGizmoList",e,"long")}))}async _insertTextResult(e){this.activeNode.focus(),A.activeRange&&(A.activeRange.setStart(this.activeNode,0),A.activeRange.collapse(!0),A.activeSelection.removeAllRanges(),A.activeSelection.addRange(A.activeRange),A.activeSelection.selectAllChildren(this.activeNode),A.activeSelection.collapseToEnd()),setTimeout((()=>{""==this.activeNode.textContent?this.activeNode.textContent=e:globalThis.document.execCommand("insertHTML",!1,e)}),0)}_openExternalLink(e){globalThis.open(e,"_blank")}async _haxStoreContribute(e,t,i=null){let a="";if("merlin"==e){var o=`[${e}] New command request from HAX daemon`;a=`Location: ${globalThis.location.href}\nMerlin command: ${i}\nWhat did you want merlin to do?\n`}else{o=`[${e}] User report from HAX daemon`;if(a=`Location: ${globalThis.location.href}\nBrowser: ${navigator.userAgent}\nOS: ${navigator.userAgentData.platform} - ${navigator.deviceMemory}GB RAM - ${navigator.hardwareConcurrency} cores\nScreen: ${globalThis.screen.width}x${globalThis.screen.height}\nWindow size: ${globalThis.innerWidth}x${globalThis.innerHeight}\n`,navigator.getBattery){a+=`Battery: ${100*(await navigator.getBattery()).level}%\n`}navigator.connection&&navigator.connection.effectiveType&&(a+=`Connection: ${navigator.connection.effectiveType}\n`),a+=("feature"==e?"Your idea:":"Bug you experienced:")+"\n"}globalThis.open(`https://github.com/haxtheweb/issues/issues/new?assignees=&labels=${t}&template=issue-report.md&title=${o}&body=${encodeURIComponent(a)}`,"_blank")}async _richTextEditorPromptOpen(e){if(e.detail.element&&e.detail.element.gizmo.tag){const t=globalThis.document.createElement(e.detail.element.gizmo.tag);HAXStore.testHook(t,"setupActiveElementForm")&&await HAXStore.runHook(t,"setupActiveElementForm",[e.detail.element])}const t=globalThis.getComputedStyle(globalThis.document.body);"hidden"==t.getPropertyValue("overflow")&&(this.__overflowHiddenOnOpen=t.getPropertyValue("overflow"),globalThis.document.body.style.overflow="auto"),setTimeout((()=>{const e=globalThis.document.querySelector("rich-text-editor-prompt").shadowRoot.querySelector(".actions");"function"==typeof e.scrollIntoViewIfNeeded?e.scrollIntoViewIfNeeded(!0):e.scrollIntoView({behavior:"smooth",inline:"center"})}),100)}_richTextEditorPromptConfirm(e){const t=e.detail.value&&e.detail.value.target?e.detail.value.target:null;setTimeout((()=>{"A"===this.activeNode.tagName&&t&&(this.activeNode.setAttribute("target",t),this.refreshActiveNodeForm())}),0),this.__overflowHiddenOnOpen&&(globalThis.document.body.style.overflow=this.__overflowHiddenOnOpen,this.__overflowHiddenOnOpen=null)}_buildPrimitiveDefinitions(){if(this._isSandboxed){let e={type:"element",editingElement:"core",canScale:!0,designSystem:{card:!0,primary:!0},canEditSource:!0,settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this resource.",inputMethod:"textfield",icon:"link",required:!0,validationType:"url"}],advanced:[]}};this.setHaxProperties(e,"webview")}this.setHaxProperties({canScale:!0,type:"element",designSystem:{card:!0,primary:!0},editingElement:"core",canEditSource:!0,gizmo:{title:"Image",description:"A basic img tag",icon:"image:image",color:"blue-grey",tags:["Images","media","img","html"],handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this image.",inputMethod:"haxupload",noVoiceRecord:!0,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:"loading",title:"Loading method",description:"Whether or not to lazy load this",inputMethod:"select",options:{lazy:"Load when visible",auto:"Automatic"}}]},demoSchema:[{tag:"img",content:"",properties:{src:"https://cdn2.thecatapi.com/images/9j5.jpg",loading:"lazy"}}]},"img");this.setHaxProperties({canScale:!0,type:"grid",canEditSource:!0,gizmo:{title:"Figure",description:"A basic figure tag",icon:"hax:figure",color:"blue-grey",tags:["Images","media","figure","html"],requiresChildren:"figcaption",handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[]},demoSchema:[{tag:"figure",properties:{},content:'image other media here\n

            Image Caption Here

            '}]},"figure");this.setHaxProperties({canScale:!0,type:"grid",editingElement:"core",canEditSource:!0,gizmo:{title:"Figure caption",description:"Used inside of a figure tag",icon:"image:image",color:"blue-grey",tags:["Images","media","caption","figure","html"],handles:[],requiresParent:"figure",meta:{author:"W3C",hidden:!0}},settings:{configure:[{slot:"",title:"Figure Caption",description:"Caption for the figure",inputMethod:"code-editor"}]},demoSchema:[{tag:"figcaption",properties:{},content:"Image Caption Here"}]},"figcaption");this.setHaxProperties({type:"element",editingElement:"core",canScale:!1,designSystem:{primary:!0},canEditSource:!0,contentEditable:!0,gizmo:{title:"Highlight",description:"Highlight text within a block of content",icon:"editor:highlight",color:"yellow",tags:["Content","text","highlight","mark","html"],handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"innerText",title:"Text",description:"Text of the highlight",inputMethod:"textfield",required:!0}],advanced:[],developer:[]},demoSchema:[{tag:"mark",content:"Highlight me",properties:{}}]},"mark");this.setHaxProperties({type:"element",editingElement:"core",canScale:!1,designSystem:{primary:!0},canEditSource:!0,contentEditable:!0,gizmo:{title:"Abbreviation",description:"Simple abbreviation with tooltip of full word",icon:"hax:abbr",color:"yellow",tags:["Content","text","abbr","html"],handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"innerText",title:"Text",description:"Text that is visible, the abbreviation",inputMethod:"textfield",required:!0},{attribute:"title",title:"Word",description:"Word that the abbreviation is representing",inputMethod:"textfield",required:!0}],advanced:[],developer:[]},demoSchema:[{tag:"abbr",content:"Abbr",properties:{title:"Abbreviation"}}]},"abbr");let e={type:"element",editingElement:"core",canScale:!1,designSystem:{accent:!0},canEditSource:!0,contentEditable:!0,gizmo:{title:"Basic link",description:"A basic a tag",icon:"icons:link",color:"blue-grey",tags:["Resource","link","a","url","html","href","address","http"],handles:[],meta:{author:"W3C"}},settings:{configure:[{attribute:"href",title:"Link",description:"The URL for the link",inputMethod:"haxupload",required:!0,validationType:"url"},{attribute:"innerText",title:"Text",description:"Text of the link",inputMethod:"textfield",required:!0},{attribute:"target",title:"Target",description:"Where to open the link.",inputMethod:"select",options:{"":"Same window",_blank:"New window - _blank",_top:"Top window - _top",_parent:"Parent window - _parent"}}],advanced:[],developer:[{attribute:"title",title:"Title text",description:"Useful for screen readers and improved SEO.",inputMethod:"textfield"},{attribute:"rel",title:"rel",description:"Specifies the relationship between this document and the opened globalThis.document. Change as part of security or SEO policy.",inputMethod:"select",options:{noopener:"noopener","noopener noreferrer":"noopener noreferrer","nofollow ":"nofollow","noopener noreferrer nofollow":"noopener noreferrer nofollow",opener:"opener"}}]},demoSchema:[{tag:"p",content:'Link to content',properties:{}}]};this.validGizmoTypes.forEach((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,designSystem:!0,canEditSource:!0,contentEditable:!0,gizmo:{title:"Paragraph",description:"A basic text area",icon:"hax:paragraph",color:"blue-grey",tags:["Text","p","paragraph","text","html"],handles:[{type:"content",title:"innerHTML",alt:"title"}],meta:{author:"W3C",outlineDesigner:!0}},settings:{configure:[],advanced:[]},demoSchema:[{tag:"p",content:"Deep thoughts..",properties:{}}]},"p");let t={type:"element",editingElement:{tag:"editable-table",import:"@haxtheweb/editable-table/editable-table.js",callback:this.setupEditableTable.bind(this)},canScale:!0,canEditSource:!0,gizmo:{title:"Table",description:"A table for displaying data",icon:"image:grid-on",color:"blue-grey",tags:["Instructional","table","data","html","grid","matrix","spreadsheet","csv","excel"],meta:{hidden:!0,author:"W3C"}},settings:{configure:[],advanced:[]}};this.setHaxProperties(t,"table");let i=globalThis.document.createElement("editable-table");this.haxAutoloader.appendChild(i);let a={type:"element",editingElement:{tag:"iframe-loader",import:"@haxtheweb/iframe-loader/iframe-loader.js",callback:this.setupIframeLoader.bind(this)},canScale:!1,designSystem:{card:!0,primary:!0},canEditSource:!1,gizmo:{title:"iFrame",description:"A basic way to frame external web content",icon:"hax:iframe",color:"blue-grey",tags:["Resource","iframe","content","url","link","embed","https","html","address"],handles:[],meta:{author:"W3C",hidden:!0}},settings:{configure:[{attribute:"src",title:"Source",description:"The URL for this resource.",inputMethod:"textfield",icon:"link",required:!0,validationType:"url"}]}};this.setHaxProperties(a,"iframe");let o=globalThis.document.createElement("iframe-loader");this.haxAutoloader.appendChild(o);for(let e in this.__primsBuilder){let t="";["h1","h2","h3","h4","h5","h6"].includes(e)?t="Heading":"ul"!=e&&"ol"!=e||(t="
          • Item
          • Item
          • "),this.setHaxProperties({type:"element",editingElement:"core",canScale:!1,designSystem:["h1","h2","h3","h4","h5","h6"].includes(e)?{text:!0,card:!0,primary:!0,designTreatment:!0}:!!["ol","ul"].includes(e)&&{text:!0,card:!0,accent:!0,primary:!0},canEditSource:!0,contentEditable:!0,gizmo:{title:this.__primsBuilder[e].title,icon:this.__primsBuilder[e].icon,tags:this.__primsBuilder[e].tags||["Text",e,"html","text"],handles:this.__primsBuilder[e].handles||[],meta:{author:"W3C",inlineOnly:!!["em","b","strong","i","strike","u","sub","sup","span"].includes(e),hidden:!["h2","ul"].includes(e),outlineDesigner:!!["h2","ul"].includes(e)}},settings:{configure:[],advanced:[]},demoSchema:[{tag:e,content:t,properties:{}}]},e)}this.setHaxProperties({canScale:!0,type:"element",editingElement:"core",designSystem:{primary:!0},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")}_haxStorePieceRegistrationManager(e){e.detail&&e.detail.piece&&e.detail.object&&(this[e.detail.piece]=e.detail.object)}setupEditableTable(e){this.activeNode=e,setTimeout((()=>{e.editMode=!0,e.focus()}),0)}setupIframeLoader(e){this.activeNode=e,setTimeout((()=>{e.disabled=!0}),0)}async _haxStoreInsertContent(e){if(e.detail){let i=e.detail;if(globalThis.customElements.get(i.tag)){let e=globalThis.document.createElement(i.tag);this.testHook(e,"preProcessInsertContent")&&(i=await this.runHook(e,"preProcessInsertContent",[i,this.activeNode]))}var t={};if(void 0!==i.properties&&(t=i.properties),t.innerHTML&&(""==i.content&&(i.content=t.innerHTML),delete t.innerHTML),t.innerText&&(""==i.content&&(i.content=t.innerText),delete t.innerText),void 0!==i.__type&&"inline"===i.__type){let e=c({tag:i.tag,content:i.content,properties:t});null!==this.activePlaceHolder&&(this.activePlaceHolder.deleteContents(),this.activePlaceHolder.insertNode(e)),this.activePlaceHolder=null}else if(i.replace||i.replacement||i.nextToActive){let e=c({tag:i.tag,content:i.content,properties:t});this.activePlaceHolder?(this.activeHaxBody.haxReplaceNode(this.activePlaceHolder,e),this.activePlaceHolder=null):i.nextToActive&&this.activeNode?this.activeHaxBody.__slot&&this.activeNode.haxLayoutContainer?this.activeNode.appendChild(e):this.activeNode.parentNode.insertBefore(e,this.activeNode):this.activeHaxBody.haxReplaceNode(this.activeNode,e)}else if(this.activeNode&&this.activeNode.parentNode&&"HAX-BODY"!=this.activeNode.parentNode.tagName){let e=c({tag:i.tag,content:i.content,properties:t});this.activeNode.parentNode.haxLayoutContainer?(null!=this.activeNode.getAttribute("slot")&&e.setAttribute("slot",this.activeNode.getAttribute("slot")),this.activeHaxBody.haxInsert(i.tag,i.content,t)):this.activeHaxBody.haxInsert(i.tag,i.content,t)}else this.activeHaxBody.haxInsert(i.tag,i.content,t)}}slotsFromSchema(e,t=!1){let i=e?e.settings:{},a=[];return Object.keys({...i||{}}).map((e=>(i[e]||[]).filter((e=>{let i=!t||!e.required;return!(!e.slot&&""!==e.slot||a.includes(e.slot)||!i)&&(a.push(e.slot),!0)})))).flat()}haxSchemaFromTag(e){return e&&e.toLowerCase&&(e=e.toLowerCase(),this.elementList&&this.elementList[e])?this.elementList[e]:{}}_haxStoreInsertMultiple(e){var t;if(e.detail)for(let i in e.detail)t={},void 0!==e.detail[i].properties&&(t=e.detail[i].properties),this.activeHaxBody.haxInsert(e.detail[i].tag,e.detail[i].content,t)}_haxStoreRegisterBody(e){e.detail&&(this.haxBodies.push(e.detail),this.activeHaxBody=e.detail,this.write("activeHaxBody",this.activeHaxBody,this),this.write("editMode",this.editMode,this),clearTimeout(this.__storeReady),this.__storeReady=setTimeout((()=>{this._storePiecesAllHere(this.haxAutoloader,this.activeHaxBody,this.haxTray,this.haxCancel)}),0))}_superDaemonInsert(e){A.programTarget&&e.detail.properties&&(e.detail.properties.src||e.detail.properties.source||e.detail.properties.href)?A.programTarget.value=e.detail.properties.src||e.detail.properties.source||e.detail.properties.href:this.haxTray._processTrayEvent(e),A.programTarget=null}computePolyfillSafe(){return!(!globalThis.document.head.createShadowRoot&&!globalThis.document.head.attachShadow)||(console.warn("Shadow DOM missing, certain operations hidden"),!1)}_haxStoreRegisterApp(e){if(e.detail){const i=e.detail;i.index=this.appList.length,this.appList=[...this.appList,i],this.write("appList",T(this.appList),this);let a="media";if(i.connection.operations&&i.connection.operations.browse&&i.connection.operations.browse.resultMap&&i.connection.operations.browse.resultMap.defaultGizmoType&&(a=i.connection.operations.browse.resultMap.defaultGizmoType),A.defineOption({title:"Search "+i.details.title,icon:i.details.icon,tags:["Search",...i.details.tags,a],more:i.details.tos&&i.details.tos.length>0?t`
            Terms of service:
              ${i.details.tos.map((e=>t`
            • diff --git a/haxcms/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-tray.js b/haxcms/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-tray.js index 10b9f9bd2..4964520fc 100755 --- a/haxcms/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-tray.js +++ b/haxcms/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-tray.js @@ -79,7 +79,6 @@ import{html as t,css as e}from"../../../lit/index.js";import{winEventsElement as } :host([tray-detail="view-source"]) .detail { width: 50vw; - height: 50vh; min-height: 300px; min-width: calc(var(--hax-tray-width) - 100px); resize: both; diff --git a/haxcms/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-view-source.js b/haxcms/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-view-source.js index 1aacebef2..57feb285f 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-view-source.js +++ b/haxcms/build/es6/node_modules/@haxtheweb/hax-body/lib/hax-view-source.js @@ -1,5 +1,8 @@ import{LitElement as t,html as o,css as e}from"../../../lit/index.js";import{MtzFileDownloadBehaviors as a}from"../../dl-behavior/dl-behavior.js";import{stripMSWord as i,formatHTML as l,b64toBlob as n}from"../../utils/utils.js";import{HAXStore as s}from"./hax-store.js";import"./hax-toolbar.js";import{HaxComponentStyles as r}from"./hax-ui-styles.js";import{autorun as d,toJS as c}from"../../../mobx/dist/mobx.esm.js";import{I18NMixin as h}from"../../i18n-manager/lib/I18NMixin.js";import"../../simple-toolbar/lib/simple-toolbar-menu.js";import"../../simple-toolbar/lib/simple-toolbar-menu-item.js";import"./hax-tray-button.js";import{MicroFrontendRegistry as m}from"../../micro-frontend-registry/micro-frontend-registry.js";class HaxViewSource extends(h(a(t))){static get styles(){return[...r,e` - :host, + :host { + display: block; + height: calc(100vh - 120px); + } #wrapper { margin: 0; padding: 0; @@ -19,6 +22,7 @@ import{LitElement as t,html as o,css as e}from"../../../lit/index.js";import{Mtz bottom: 0; margin: 0; padding: 0; + height: calc(100vh - 200px); } .updatecontent { background-color: var(--simple-colors-default-theme-green-1); diff --git a/haxcms/build/es6/node_modules/@haxtheweb/hax-iconset/lib/hax-iconset-manifest.js b/haxcms/build/es6/node_modules/@haxtheweb/hax-iconset/lib/hax-iconset-manifest.js index 48fa89aee..53baf2ce0 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/hax-iconset/lib/hax-iconset-manifest.js +++ b/haxcms/build/es6/node_modules/@haxtheweb/hax-iconset/lib/hax-iconset-manifest.js @@ -1 +1 @@ -import{SimpleIconsetStore as e}from"../../simple-icon/lib/simple-iconset.js";export const HaxIconsetManifest=[{name:"courseicons",icons:["astro1","astro11","astro120","astro130","astro140","astro2","bio1","biol11","biol110","biol120n","biol133","biol141","biol155","biol177","bisci001","bisci002","bisci003","bisci004","bmmb551","bmmb852","chem-connection","chem005","chem1","chem101","chem110","chem2","frnsc100","frnsc200","frnsc210","knowledge","learning-objectives","listen","math021","math022","math034","math036","math110","math140","math220","math436","phys010","phys1","phys2","phys3","strategy"]},{name:"drawing",icons:["draw-ellip","draw-poly","draw-rect","move","select"]},{name:"editable-table",icons:["col-striped","column-headers","filter-off","filter","footer","numbers","row-condensed","row-headers","row-striped","sortable"]},{name:"hax",icons:["12","3-3-3-3","4-4-4","4-8","6-6","8-4","abbr","accessibility","add-brick","add-child-page","add-item","add-page","add","anchor","apps","arrow-all","arrow-expand-left","arrow-expand-right","arrow-left","arrow-right","assess","bricks","bulletin-board","calendar","camera","case-sensitive-alt","clipboard-pulse","code-json","collaborate","computer","computer2","console-line","consult","container","delete-restore","discord","disqus","documents","duplicate","email","engage","engage2","examity","expand-more","figure","file-ai","file-blank","file-css","file-csv","file-doc","file-docx","file-eps","file-gif","file-html","file-jpg","file-js","file-link-outline","file-pdf","file-png","file-ppt","file-rtf","file-svg","file-xls","flikr","format-textblock","gears","git","globe","graph","h1","h2","h3","h4","h5","h6","hax2022","home-edit","hr","html-code","idea","iframe","image","keyboard-arrow-down","keyboard-arrow-up","lesson","loading","map","map-legend","math","meme","menu-open","messages-1","messages-2","messages-3","messages-4","messages-5","messages-6","messages-7","messages-8","messages-9-plus","messages-9","module","monitor","motivate","multimedia","multiple-choice","newspaper","ngdle","no-assignment","oer","oerschema","outline-designer-indent","outline-designer-outdent","page-details","page-edit","paragraph","phone","pi","placeholder-image","placeholder","podcast","qr-code","quick","remix","remote","reportcard","reuse","scroll","search-clear","select-element","settings","shovel","site-map","site-settings","slash","spotify","table-column-plus-after","table-column-remove","table-multiple","task","templates","ticket","time","timeline","twitter","unit","video","view-gallery","vimeo","vocab","vr","wand","wizard-hat","wordpress"]},{name:"lrn",icons:["about","accessibility","add","apps","arrow-left","arrow-right","assessment","assignment","assignments","beaker","blog","blogs","book","bookmark-outline","bookmark","calendar","canban","cancel","chevron-down","chevron-left","chevron-right","choice1","choice2","choice3","cis","cle","close","collab","columns","comment","compass","comply","content-outline","content","courses","cpr","data_usage","dino","discuss","done","dotgrid","download","ecd","edit","editorial","elmsmedia","explore","file-download","gear","grades","help","hidden","icor","inbox","info","innovate","input","instructor","interact","lab","labs","lecture","letter","media","mooc","more-vert","network","notifications","online","outline","page","palette","pdf","people","play","plus","quiz","replay","resources","save","settings","share","speechballoons","studio-assignment-list","studio","support","syllabus","teacher","tour","user","view-off","view","visible","write"]},{name:"mdextra",icons:["cursor-text","hexagon-multiple","hexagon-outline","hexagon","subscript","superscript","unlink","vector-polyline-plus"]},{name:"mdi-social",icons:["blogger","disqus","dribble","facebook-box","facebook","github-box","github-circle","google-plus-box","google-plus",null,"instagram","instapaper","linkedin","pinterest","pocket","readability","rss-box","tumblr","twitch","twitter-box","twitter","whatsapp","youtube"]},{name:"paper-audio-icons",icons:["error-outline","pause","play-arrow","replay"]}];e.registerManifest(HaxIconsetManifest); \ No newline at end of file +import{SimpleIconsetStore as e}from"../../simple-icon/lib/simple-iconset.js";export const HaxIconsetManifest=[{name:"courseicons",icons:["astro1","astro11","astro120","astro130","astro140","astro2","bio1","biol11","biol110","biol120n","biol133","biol141","biol155","biol177","bisci001","bisci002","bisci003","bisci004","bmmb551","bmmb852","chem-connection","chem005","chem1","chem101","chem110","chem2","frnsc100","frnsc200","frnsc210","knowledge","learning-objectives","listen","math021","math022","math034","math036","math110","math140","math220","math436","phys010","phys1","phys2","phys3","strategy"]},{name:"drawing",icons:["draw-ellip","draw-poly","draw-rect","move","select"]},{name:"editable-table",icons:["col-striped","column-headers","filter-off","filter","footer","numbers","row-condensed","row-headers","row-striped","sortable"]},{name:"hax",icons:["12","3-3-3-3","4-4-4","4-8","6-6","8-4","abbr","accessibility","add-brick","add-child-page","add-item","add-page","add","anchor","apps","arrow-all","arrow-expand-left","arrow-expand-right","arrow-left","arrow-right","assess","bricks","bulletin-board","calendar","camera","case-sensitive-alt","clipboard-pulse","code-json","collaborate","computer","computer2","console-line","consult","container","delete-restore","discord","disqus","documents","duplicate","email","engage","engage2","examity","expand-more","figure","file-ai","file-blank","file-css","file-csv","file-doc","file-docx","file-eps","file-gif","file-html","file-jpg","file-js","file-link-outline","file-pdf","file-png","file-ppt","file-rtf","file-svg","file-xls","flikr","format-textblock","gears","git","globe","graph","h1","h2","h3","h4","h5","h6","hax2022","head-question","home-edit","hr","html-code","idea","iframe","image","keyboard-arrow-down","keyboard-arrow-up","lesson","loading","map","map-legend","math","meme","menu-open","messages-1","messages-2","messages-3","messages-4","messages-5","messages-6","messages-7","messages-8","messages-9-plus","messages-9","module","monitor","motivate","multimedia","multiple-choice","newspaper","ngdle","no-assignment","oer","oerschema","outline-designer-indent","outline-designer-outdent","page-details","page-edit","paragraph","phone","pi","placeholder-image","placeholder","podcast","qr-code","quick","remix","remote","reportcard","reuse","scroll","search-clear","select-element","settings","shovel","site-map","site-settings","slash","spotify","table-column-plus-after","table-column-remove","table-multiple","task","templates","ticket","time","timeline","twitter","unit","video","view-gallery","vimeo","vocab","vr","wand","wizard-hat","wordpress"]},{name:"lrn",icons:["about","accessibility","add","apps","arrow-left","arrow-right","assessment","assignment","assignments","beaker","blog","blogs","book","bookmark-outline","bookmark","calendar","canban","cancel","chevron-down","chevron-left","chevron-right","choice1","choice2","choice3","cis","cle","close","collab","columns","comment","compass","comply","content-outline","content","courses","cpr","data_usage","dino","discuss","done","dotgrid","download","ecd","edit","editorial","elmsmedia","explore","file-download","gear","grades","help","hidden","icor","inbox","info","innovate","input","instructor","interact","lab","labs","lecture","letter","media","mooc","more-vert","network","notifications","online","outline","page","palette","pdf","people","play","plus","quiz","replay","resources","save","settings","share","speechballoons","studio-assignment-list","studio","support","syllabus","teacher","tour","user","view-off","view","visible","write"]},{name:"mdextra",icons:["cursor-text","hexagon-multiple","hexagon-outline","hexagon","subscript","superscript","unlink","vector-polyline-plus"]},{name:"mdi-social",icons:["blogger","disqus","dribble","facebook-box","facebook","github-box","github-circle","google-plus-box","google-plus",null,"instagram","instapaper","linkedin","pinterest","pocket","readability","rss-box","tumblr","twitch","twitter-box","twitter","whatsapp","youtube"]},{name:"paper-audio-icons",icons:["error-outline","pause","play-arrow","replay"]}];e.registerManifest(HaxIconsetManifest); \ No newline at end of file diff --git a/haxcms/build/es6/node_modules/@haxtheweb/mark-the-words/lib/mark-the-words.haxProperties.json b/haxcms/build/es6/node_modules/@haxtheweb/mark-the-words/lib/mark-the-words.haxProperties.json index 9b50357dd..0b7ad8d2d 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/mark-the-words/lib/mark-the-words.haxProperties.json +++ b/haxcms/build/es6/node_modules/@haxtheweb/mark-the-words/lib/mark-the-words.haxProperties.json @@ -88,7 +88,7 @@ ] }, "saveOptions": { - "unsetAttributes": ["word-list", "number-correct", "number-guessed", "attempts", "answers", "displayed-answers", "t", "show-answer"] + "unsetAttributes": ["edit", "word-list", "number-correct", "number-guessed", "attempts", "answers", "displayed-answers", "t", "show-answer"] }, "documentation": { "howTo": null, diff --git a/haxcms/build/es6/node_modules/@haxtheweb/mark-the-words/mark-the-words.js b/haxcms/build/es6/node_modules/@haxtheweb/mark-the-words/mark-the-words.js index 13ad142ac..2d89fd8da 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/mark-the-words/mark-the-words.js +++ b/haxcms/build/es6/node_modules/@haxtheweb/mark-the-words/mark-the-words.js @@ -46,6 +46,13 @@ import{html as e,css as t,nothing as s}from"../../lit/index.js";import"../simple line-height: 2.2; } + @media (max-width: 600px) { + .text { + margin: var(--ddd-spacing-1); + padding: var(--ddd-spacing-1); + } + } + .tag-option { font-size: var(--ddd-font-size-s); height: auto; diff --git a/haxcms/build/es6/node_modules/@haxtheweb/matching-question/lib/matching-question.haxProperties.json b/haxcms/build/es6/node_modules/@haxtheweb/matching-question/lib/matching-question.haxProperties.json index 02bf31260..bcd152f6a 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/matching-question/lib/matching-question.haxProperties.json +++ b/haxcms/build/es6/node_modules/@haxtheweb/matching-question/lib/matching-question.haxProperties.json @@ -71,7 +71,8 @@ "answers", "displayed-answers", "t", - "show-answer" + "show-answer", + "edit" ] }, "documentation": { diff --git a/haxcms/build/es6/node_modules/@haxtheweb/multiple-choice/lib/QuestionElement.js b/haxcms/build/es6/node_modules/@haxtheweb/multiple-choice/lib/QuestionElement.js index e20def410..b4deaadc9 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/multiple-choice/lib/QuestionElement.js +++ b/haxcms/build/es6/node_modules/@haxtheweb/multiple-choice/lib/QuestionElement.js @@ -2,7 +2,7 @@ import{LitElement as e,html as t,css as s,nothing as i}from"../../../lit/index.j :host { display: block; min-width: 160px; - padding: var(--ddd-spacing-8); + padding: var(--ddd-spacing-4); border: var(--ddd-border-md); border-radius: var(--ddd-radius-sm); box-shadow: var(--ddd-boxShadow-sm); @@ -34,6 +34,10 @@ import{LitElement as e,html as t,css as s,nothing as i}from"../../../lit/index.j ); --simple-fields-border-bottom-size: 0px; --simple-fields-border-bottom-focus-size: 0px; + + --simple-fields-margin-small: 42px; + --grid-plate-item-margin: 0 8px; + --grid-plate-item-padding: 0 8px; } :host(:focus), @@ -86,6 +90,9 @@ import{LitElement as e,html as t,css as s,nothing as i}from"../../../lit/index.j details[open] .container h4 { margin-top: 0; } + #legend { + margin: 0 -26px; + } ul { list-style: none; padding: 0; @@ -93,7 +100,7 @@ import{LitElement as e,html as t,css as s,nothing as i}from"../../../lit/index.j } h3 { padding: 0; - margin: 0 0 var(--ddd-spacing-8) 0; + margin: 0 0 var(--ddd-spacing-4) 0; font-family: var(--ddd-font-navigation); } ul li { @@ -273,16 +280,52 @@ import{LitElement as e,html as t,css as s,nothing as i}from"../../../lit/index.j font-size: 12px; content: "Add content"; } + @media (max-width: 600px) { + :host { + padding: 4px; + margin: 0; + --grid-plate-item-margin: 0; + --grid-plate-item-padding: 0; + font-size: var(--ddd-font-size-4xs); + } + h3 { + margin: 4px; + } + :host .column ::slotted(*) { + padding: 0; + margin: 0; + + } + } `]}playSound(e){globalThis.dispatchEvent(new CustomEvent("playaudio",{detail:{sound:e}}))}async haxpreProcessNodeToContent(e){if(e.answers){let s=Array.from(this.querySelectorAll("input:not([slot])"));for(var t in s)s[t].remove();for(var t in e.answers)if(e.answers[t]){let s=document.createElement("input");s.setAttribute("type","checkbox"),s.value=e.answers[t].label,e.answers[t].correct&&s.setAttribute("correct","correct"),e.answers[t].image&&s.setAttribute("data-image",e.answers[t].image),e.answers[t].alt&&s.setAttribute("data-image-alt",e.answers[t].alt),e.answers[t].selectedFeedback&&s.setAttribute("data-selected",e.answers[t].selectedFeedback),e.answers[t].unselectedFeedback&&s.setAttribute("data-unselected",e.answers[t].unselectedFeedback),e.appendChild(s)}}return e}haxpreProcessInsertContent(e,t){return e.properties.answers&&e.properties.answers.length>0&&e.properties.answers.map&&(e.properties.answers=e.properties.answers.map((function(e){return e.userGuess&&delete e.userGuess,e}))),e}firstUpdated(e){super.firstUpdated&&super.firstUpdated(e),this.setAttribute("typeof","oer:Assessment"),this.loadLightDomData()}render(){return t`
              -

              ${this.question}

              - ${this.renderInteraction()} - ${this.hideButtons?i:this.renderButtons()} +
              + Question +
              +

              ${this.question}

              + ${this.renderInteraction()} + ${this.hideButtons?i:this.renderButtons()} +
              +
              +
              + Feedback +
              +
              + Legend +
              ${this.renderLegend()}
              +
              + ${this.renderFeedback()} +
              +
              ${this.querySelector('[slot="content"]')&&!this.edit?t` `:i}
              Directions -
              ${this.renderDirections()}
              -
              -
              - Legend -
              ${this.renderLegend()}
              -
              -
              - Feedback -
              ${this.renderFeedback()}
              +
              + ${this.renderDirections()}
              @@ -343,7 +375,7 @@ import{LitElement as e,html as t,css as s,nothing as i}from"../../../lit/index.j
            `}renderDirections(){return t`

            - Select the answer you feel satsisfy the question. When you are done, + Select the answer you feel answers the question. When you are done, press ${this.t.checkAnswer}. You will get feedback indicating correctness of your answer and how to proceed.

            `}renderLegend(){return t` diff --git a/haxcms/build/es6/node_modules/@haxtheweb/multiple-choice/lib/multiple-choice.haxProperties.json b/haxcms/build/es6/node_modules/@haxtheweb/multiple-choice/lib/multiple-choice.haxProperties.json index dfeda29cf..391c6168a 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/multiple-choice/lib/multiple-choice.haxProperties.json +++ b/haxcms/build/es6/node_modules/@haxtheweb/multiple-choice/lib/multiple-choice.haxProperties.json @@ -88,7 +88,8 @@ "saveOptions": { "unsetAttributes": ["__utils", "displayed-answers", "colors", "answers", "show-answer", "t", - "attempts"] + "attempts", + "edit"] }, "demoSchema": [ { diff --git a/haxcms/build/es6/node_modules/@haxtheweb/multiple-choice/lib/short-answer-question.haxProperties.json b/haxcms/build/es6/node_modules/@haxtheweb/multiple-choice/lib/short-answer-question.haxProperties.json index ddee78784..bf3f5470b 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/multiple-choice/lib/short-answer-question.haxProperties.json +++ b/haxcms/build/es6/node_modules/@haxtheweb/multiple-choice/lib/short-answer-question.haxProperties.json @@ -65,7 +65,8 @@ "shortanswer", "show-answer", "t", - "attempts" + "attempts", + "edit" ] }, "demoSchema": [ diff --git a/haxcms/build/es6/node_modules/@haxtheweb/multiple-choice/lib/short-answer-question.js b/haxcms/build/es6/node_modules/@haxtheweb/multiple-choice/lib/short-answer-question.js index 5566d0a07..5df615e75 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/multiple-choice/lib/short-answer-question.js +++ b/haxcms/build/es6/node_modules/@haxtheweb/multiple-choice/lib/short-answer-question.js @@ -1,5 +1,5 @@ import{QuestionElement as e}from"./QuestionElement.js";import{html as s}from"../../../lit/index.js";class ShortAnswerQuestion extends e{static get tag(){return"short-answer-question"}constructor(){super(),this.guessDataValue="shortanswer",this.shortanswer=null,this.singleOption=!0}static get haxProperties(){return new URL(`./${this.tag}.haxProperties.json`,import.meta.url).href}static get properties(){return{...super.properties,shortanswer:{type:String}}}inactiveCase(){return this.shortanswer}renderDirections(){return s`

            - Type the answer you feel satsisfies the question. When you are done, + Type the answer you feel answers the question. When you are done, select ${this.t.checkAnswer}. You will get feedback indicating correctness of your answer.

            `}renderInteraction(){return s` diff --git a/haxcms/build/es6/node_modules/@haxtheweb/multiple-choice/lib/true-false-question.haxProperties.json b/haxcms/build/es6/node_modules/@haxtheweb/multiple-choice/lib/true-false-question.haxProperties.json index 005027acc..25f671302 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/multiple-choice/lib/true-false-question.haxProperties.json +++ b/haxcms/build/es6/node_modules/@haxtheweb/multiple-choice/lib/true-false-question.haxProperties.json @@ -63,7 +63,8 @@ "_tfanswer", "show-answer", "t", - "attempts" + "attempts", + "edit" ] }, "demoSchema": [ diff --git a/haxcms/build/es6/node_modules/@haxtheweb/page-break/lib/page-anchor.js b/haxcms/build/es6/node_modules/@haxtheweb/page-break/lib/page-anchor.js index 0de6e9e6a..376e4f38b 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/page-break/lib/page-anchor.js +++ b/haxcms/build/es6/node_modules/@haxtheweb/page-break/lib/page-anchor.js @@ -8,7 +8,7 @@ import{html as t,css as e}from"../../../lit/index.js";import{DDD as i}from"../.. --simple-icon-height: var(--ddd-icon-xxs); --simple-icon-width: var(--ddd-icon-xxs); } - `]}clickHandler(t){if(this._haxState&&"click"===t.type)return t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),!1;let e;e=this._haxState?globalThis.document.querySelector(".haxcms-theme-element "+this.target):a.activeHaxBody.querySelector(this.target),e?(e.scrollIntoView(),setTimeout((()=>{switch(e.tagName.toLowerCase()){case"video-player":case"audio-player":this.value?e.seek(parseInt(this.value)):e.play();break;case"play-list":e.slide=parseInt(this.value)}}),100)):this.target=null}getMatchFromFields(t,e,i="accentColor"){const s=o(r.entityData);if(s[t]&&s[t][i])return"accentColor"==i?`--simple-colors-default-theme-${s[t][i]}-3`:s[t][i];let l;if(l=this._haxState?globalThis.document.querySelector(".haxcms-theme-element "+e):a.activeHaxBody.querySelector(e),l&&e&&"accentColor"==i){let t=a.haxSchemaFromTag(l.tagName);if(t&&t.gizmo&&t.gizmo.color)return`--simple-colors-default-theme-${t.gizmo.color}-3`}return null}render(){let e,i;try{e=this.getMatchFromFields(this.entityId,this.target,"accentColor"),i=this.getMatchFromFields(this.entityId,this.target,"icon")}catch(t){}return t`{switch(e.tagName.toLowerCase()){case"video-player":case"audio-player":this.value?e.seek(parseInt(this.value)):e.play();break;case"play-list":e.slide=parseInt(this.value)}}),100)):this.target=null}getMatchFromFields(t,e,i="accentColor"){const s=o(r.entityData);if(s[t]&&s[t][i])return"accentColor"==i?`--simple-colors-default-theme-${s[t][i]}-3`:s[t][i];let l;if(l=this._haxState?a.activeHaxBody.querySelector(e):globalThis.document.querySelector(".haxcms-theme-element "+e),l&&e&&"accentColor"==i){let t=a.haxSchemaFromTag(l.tagName);if(t&&t.gizmo&&t.gizmo.color)return`--simple-colors-default-theme-${t.gizmo.color}-3`}return null}render(){let e,i;try{e=this.getMatchFromFields(this.entityId,this.target,"accentColor"),i=this.getMatchFromFields(this.entityId,this.target,"icon")}catch(t){}return t` diff --git a/haxcms/build/es6/node_modules/@haxtheweb/place-holder/place-holder.js b/haxcms/build/es6/node_modules/@haxtheweb/place-holder/place-holder.js index 4c3b16da4..81f9f6e53 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/place-holder/place-holder.js +++ b/haxcms/build/es6/node_modules/@haxtheweb/place-holder/place-holder.js @@ -1,4 +1,4 @@ -import{SimpleColors as e}from"../simple-colors/simple-colors.js";import{html as t,css as i}from"../../lit/index.js";import"../simple-icon/simple-icon.js";import"../simple-icon/lib/simple-icons.js";class PlaceHolder extends e{static get styles(){return[super.styles,i` +import{SimpleColors as e}from"../simple-colors/simple-colors.js";import{html as t,css as r}from"../../lit/index.js";import"../simple-icon/simple-icon.js";import"../simple-icon/lib/simple-icons.js";class PlaceHolder extends e{static get styles(){return[super.styles,r` :host { display: block; border: none; @@ -41,4 +41,4 @@ import{SimpleColors as e}from"../simple-colors/simple-colors.js";import{html as
            ${this.calcText}
            ${this.directions}
            - `}static get tag(){return"place-holder"}static get properties(){return{...super.properties,iconFromType:{type:String},text:{type:String},directions:{type:String},calcText:{type:String},type:{type:String},dragOver:{type:Boolean,reflect:!0,attribute:"drag-over"}}}updated(e){super.updated&&super.updated(e),e.forEach(((e,t)=>{["type"].includes(t)&&(this.accentColor=this._getColorFromType(this.type)),["type","dragOver"].includes(t)&&(this.iconFromType=this._getIconFromType(this.type,this.dragOver)),["text","type","dragOver"].includes(t)&&(this.calcText=this._getCalcText(this.text,this.type,this.dragOver))}))}fireReplaceEvent(e){this.dispatchEvent(new CustomEvent("place-holder-replace",{bubbles:!0,cancelable:!0,composed:!0,detail:this.type}))}_getCalcText(e,t,i){return i?"Drop file to upload":""===e?"Placeholder for "+t:e}_getColorFromType(e){switch(e){case"document":return"green";case"audio":return"purple";case"video":return"red";case"image":return"orange";case"math":return"light-blue"}return"indigo"}_getIconFromType(e,t){if(t)return"icons:file-upload";switch(e){case"document":return"editor:insert-drive-file";case"audio":return"av:music-video";case"video":return"notification:ondemand-video";case"image":return"image:crop-original";case"math":return"editor:functions";default:return"editor:format-align-left"}}constructor(){super(),this.text="",this.iconFromType="editor:format-align-left",this.type="text",this.dragOver=!1,this.directions="Double click or drag and drop file to replace",this.addEventListener("dragover",(function(e){this.dragOver=!0,e.preventDefault(),e.stopPropagation(),this.classList.add("dragover")})),this.addEventListener("dragleave",(function(e){this.dragOver=!1,e.preventDefault(),e.stopPropagation(),this.classList.remove("dragover")})),this.addEventListener("drop",(function(e){this.dragOver=!1,e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.classList.remove("dragover");try{"file"===e.dataTransfer.items[0].kind&&(e.placeHolderElement=this,this.dispatchEvent(new CustomEvent("place-holder-file-drop",{bubbles:!0,cancelable:!0,composed:!0,detail:e})))}catch(e){}})),this.addEventListener("dblclick",this.fireReplaceEvent.bind(this))}static get haxProperties(){return{canScale:!0,canEditSource:!1,gizmo:{title:"Placeholder",description:"A place holder that can be converted into the media type that's been selected",icon:"hax:placeholder-image",color:"grey",tags:["Authoring","development","authoring","media","image","video","audio","document","math","text"],handles:[],meta:{author:"HAXTheWeb core team"}},settings:{configure:[{property:"type",title:"Type",description:"Type of gizmo that this accepts for replacement.",inputMethod:"select",options:{text:"Text / content",document:"Document / file",audio:"Audio",video:"Video",image:"Image",math:"Math"}},{property:"text",title:"Text",description:"Identify the place holder desired in greater detail",inputMethod:"textfield"}],advanced:[]},saveOptions:{unsetAttributes:["icon-from-type","calc-text","colors"],wipeSlot:!0},demoSchema:[{tag:"place-holder",properties:{type:"image"},content:""}]}}}customElements.define(PlaceHolder.tag,PlaceHolder);export{PlaceHolder}; \ No newline at end of file + `}static get tag(){return"place-holder"}static get properties(){return{...super.properties,iconFromType:{type:String},text:{type:String},directions:{type:String},calcText:{type:String},type:{type:String},dragOver:{type:Boolean,reflect:!0,attribute:"drag-over"}}}updated(e){super.updated&&super.updated(e),e.forEach(((e,t)=>{["type"].includes(t)&&(this.accentColor=this._getColorFromType(this.type)),["type","dragOver"].includes(t)&&(this.iconFromType=this._getIconFromType(this.type,this.dragOver)),["text","type","dragOver"].includes(t)&&(this.calcText=this._getCalcText(this.text,this.type,this.dragOver))}))}fireReplaceEvent(e){this.dispatchEvent(new CustomEvent("place-holder-replace",{bubbles:!0,cancelable:!0,composed:!0,detail:this.type}))}_getCalcText(e,t,r){return r?"Drop file to upload":""===e?"Placeholder for "+t:e}_getColorFromType(e){switch(e){case"document":return"green";case"audio":return"purple";case"video":return"red";case"image":return"orange";case"math":return"light-blue"}return"indigo"}_getIconFromType(e,t){if(t)return"icons:file-upload";switch(e){case"document":return"editor:insert-drive-file";case"audio":return"av:music-video";case"video":return"notification:ondemand-video";case"image":return"image:crop-original";case"math":return"editor:functions";default:return"editor:format-align-left"}}constructor(){super(),this.text="",this.iconFromType="editor:format-align-left",this.type="text",this.dragOver=!1,this.directions="Drag and drop file to replace",this.addEventListener("dragover",(function(e){this.dragOver=!0,e.preventDefault(),e.stopPropagation(),this.classList.add("dragover")})),this.addEventListener("dragleave",(function(e){this.dragOver=!1,e.preventDefault(),e.stopPropagation(),this.classList.remove("dragover")})),this.addEventListener("drop",(function(e){this.dragOver=!1,e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.classList.remove("dragover");try{"file"===e.dataTransfer.items[0].kind&&(e.placeHolderElement=this,this.dispatchEvent(new CustomEvent("place-holder-file-drop",{bubbles:!0,cancelable:!0,composed:!0,detail:e})))}catch(e){}}))}static get haxProperties(){return{canScale:!1,canEditSource:!1,gizmo:{title:"Placeholder",description:"A place holder that can be converted into the media type that's been selected",icon:"hax:placeholder-image",color:"grey",tags:["Authoring","development","authoring","media","image","video","audio","document","math","text"],handles:[],meta:{author:"HAXTheWeb core team"}},settings:{configure:[{property:"type",title:"Type",description:"Type of gizmo that this accepts for replacement.",inputMethod:"select",options:{text:"Text / content",document:"Document / file",audio:"Audio",video:"Video",image:"Image",math:"Math"}},{property:"text",title:"Text",description:"Identify the place holder desired in greater detail",inputMethod:"textfield"}],advanced:[]},saveOptions:{unsetAttributes:["icon-from-type","calc-text","colors"],wipeSlot:!0},demoSchema:[{tag:"place-holder",properties:{type:"image"},content:""}]}}}customElements.define(PlaceHolder.tag,PlaceHolder);export{PlaceHolder}; \ No newline at end of file diff --git a/haxcms/build/es6/node_modules/@haxtheweb/retro-card/retro-card.js b/haxcms/build/es6/node_modules/@haxtheweb/retro-card/retro-card.js index fc224b61f..4f08c7720 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/retro-card/retro-card.js +++ b/haxcms/build/es6/node_modules/@haxtheweb/retro-card/retro-card.js @@ -167,4 +167,4 @@ import{html as e,css as t}from"../../lit/index.js";import{SimpleColors as r}from >`))} `:""} - `}`}static get haxProperties(){return{canScale:!1,canEditSource:!0,gizmo:{title:"Retro card",description:"Simple card in a cool retro design",icon:"icons:android",color:"purple",tags:["Layout","card","layout"],handles:[],meta:{author:"HAXTheWeb core team",owner:"The Pennsylvania State University"}},settings:{configure:[{property:"title",title:"Title",description:"Main title of card",inputMethod:"textfield",required:!1,icon:"icons:android"},{property:"url",description:"Link to go to when clicking the card",inputMethod:"textfield",required:!1,icon:"icons:android",validationType:"url"},{property:"subtitle",title:"Sub-title",description:"Sub heading",inputMethod:"textfield",required:!1,icon:"icons:android"},{property:"tags",title:"Tags",description:"Comma separated tags",inputMethod:"textfield",required:!1,icon:"icons:android"},{property:"mediaSource",title:"Media source",description:"Primary media source",inputMethod:"haxupload",noVoiceRecord:!0,required:!0,icon:"icons:link",validationType:"url"},{property:"hoverSource",description:"When user hovers / activates the card",title:"Source on hover",inputMethod:"haxupload",noVoiceRecord:!0,required:!1,validationType:"url",icon:"icons:android"},{property:"accentColor",description:"An accent to apply evenly to the card",title:"Accent Color",inputMethod:"colorpicker",required:!1,icon:"icons:android"},{property:"dark",title:"Dark",description:"Sets base color to be dark mode",inputMethod:"boolean",required:!1}],advanced:[]},saveOptions:{unsetAttributes:["colors"]},demoSchema:[{tag:"video-player",properties:{title:"HAX Camp",subtitle:"btopro dreaming reality",tags:"dreams, hax, camp",accentColor:"pink",url:"https://btopro.com","media-source":"https://btopro.com/files/IMG_20190716_102855.jpg"},content:""}]}}static get properties(){return{...super.properties,title:{type:String},subtitle:{type:String},tags:{type:String},mediaSource:{type:String,attribute:"media-source"},url:{type:String},hoverSource:{type:String,attribute:"hover-source"},hoverState:{type:Boolean,attribute:"hover-state",reflect:!0},__cardTags:{type:Array},nosource:{type:Boolean},__source:{type:String}}}static get tag(){return"retro-card"}constructor(){super(),this.__cardTags=[],this.hoverState=!1,this.nosource=!1}_keyPress(e){if("Enter"===e.key)this.shadowRoot.querySelector("a").click()}_hoverStateOff(e){this.hoverState=!1}_hoverStateOn(e){this.hoverState=!0}firstUpdated(e){super.firstUpdated&&super.firstUpdated(e),this.addEventListener("mouseover",this._hoverStateOn.bind(this)),this.addEventListener("mouseout",this._hoverStateOff.bind(this)),this.nosource||(this.setAttribute("tabindex",0),this.addEventListener("keypress",this._keyPress.bind(this)),this.addEventListener("focusin",this._hoverStateOn.bind(this)),this.addEventListener("focusout",this._hoverStateOff.bind(this))),this.hoverSource||(this.hoverSource=this.mediaSource)}haxHooks(){return{editModeChanged:"haxeditModeChanged",activeElementChanged:"haxactiveElementChanged"}}haxactiveElementChanged(e,t){t&&(this._haxstate=t)}haxeditModeChanged(e){this._haxstate=e}_clickCard(e){this._haxstate&&!this.nosource&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())}updated(e){super.updated&&super.updated(e),e.forEach(((e,t)=>{"tags"==t&&this._tagsChanged(this[t]),"source"==t&&(this.__source=this.mediaSource),"hoverState"==t&&(this.__source=this[t]?this.hoverSource:this.mediaSource)}))}_tagsChanged(e){let t=e.split(",");this.__cardTags=[...t]}}customElements.define(RetroCard.tag,RetroCard);export{RetroCard}; \ No newline at end of file + `}`}static get haxProperties(){return{canScale:!1,canEditSource:!0,gizmo:{title:"Retro card",description:"Simple card in a cool retro design",icon:"icons:credit-card",color:"purple",tags:["Layout","card","layout"],handles:[],meta:{author:"HAXTheWeb core team",owner:"The Pennsylvania State University"}},settings:{configure:[{property:"title",title:"Title",description:"Main title of card",inputMethod:"textfield",required:!1},{property:"url",description:"Link to go to when clicking the card",inputMethod:"textfield",required:!1,validationType:"url"},{property:"subtitle",title:"Sub-title",description:"Sub heading",inputMethod:"textfield",required:!1},{property:"tags",title:"Tags",description:"Comma separated tags",inputMethod:"textfield",required:!1},{property:"mediaSource",title:"Media source",description:"Primary media source",inputMethod:"haxupload",noVoiceRecord:!0,required:!0,validationType:"url"},{property:"hoverSource",description:"When user hovers / activates the card",title:"Source on hover",inputMethod:"haxupload",noVoiceRecord:!0,required:!1,validationType:"url"},{property:"accentColor",description:"An accent to apply evenly to the card",title:"Accent Color",inputMethod:"colorpicker",required:!1},{property:"dark",title:"Dark",description:"Sets base color to be dark mode",inputMethod:"boolean",required:!1}],advanced:[]},saveOptions:{unsetAttributes:["colors"]},demoSchema:[{tag:"video-player",properties:{title:"HAX Camp",subtitle:"btopro dreaming reality",tags:"dreams, hax, camp",accentColor:"pink",url:"https://btopro.com","media-source":"https://btopro.com/files/IMG_20190716_102855.jpg"},content:""}]}}static get properties(){return{...super.properties,title:{type:String},subtitle:{type:String},tags:{type:String},mediaSource:{type:String,attribute:"media-source"},url:{type:String},hoverSource:{type:String,attribute:"hover-source"},hoverState:{type:Boolean,attribute:"hover-state",reflect:!0},__cardTags:{type:Array},nosource:{type:Boolean},__source:{type:String}}}static get tag(){return"retro-card"}constructor(){super(),this.__cardTags=[],this.hoverState=!1,this.nosource=!1}_keyPress(e){if("Enter"===e.key)this.shadowRoot.querySelector("a").click()}_hoverStateOff(e){this.hoverState=!1}_hoverStateOn(e){this.hoverState=!0}firstUpdated(e){super.firstUpdated&&super.firstUpdated(e),this.addEventListener("mouseover",this._hoverStateOn.bind(this)),this.addEventListener("mouseout",this._hoverStateOff.bind(this)),this.nosource||(this.setAttribute("tabindex",0),this.addEventListener("keypress",this._keyPress.bind(this)),this.addEventListener("focusin",this._hoverStateOn.bind(this)),this.addEventListener("focusout",this._hoverStateOff.bind(this))),this.hoverSource||(this.hoverSource=this.mediaSource)}haxHooks(){return{editModeChanged:"haxeditModeChanged",activeElementChanged:"haxactiveElementChanged"}}haxactiveElementChanged(e,t){t&&(this._haxstate=t)}haxeditModeChanged(e){this._haxstate=e}_clickCard(e){this._haxstate&&!this.nosource&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())}updated(e){super.updated&&super.updated(e),e.forEach(((e,t)=>{"tags"==t&&this._tagsChanged(this[t]),"source"==t&&(this.__source=this.mediaSource),"hoverState"==t&&(this.__source=this[t]?this.hoverSource:this.mediaSource)}))}_tagsChanged(e){let t=e.split(",");this.__cardTags=[...t]}}customElements.define(RetroCard.tag,RetroCard);export{RetroCard}; \ No newline at end of file diff --git a/haxcms/build/es6/node_modules/@haxtheweb/stop-note/lib/stop-note.haxProperties.json b/haxcms/build/es6/node_modules/@haxtheweb/stop-note/lib/stop-note.haxProperties.json index 41f088720..54a1055dc 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/stop-note/lib/stop-note.haxProperties.json +++ b/haxcms/build/es6/node_modules/@haxtheweb/stop-note/lib/stop-note.haxProperties.json @@ -21,7 +21,7 @@ "handles": [ { "type": "text", - "title": "label" + "title": "title" } ], "meta": { diff --git a/haxcms/build/es6/node_modules/@haxtheweb/tagging-question/lib/tagging-question.haxProperties.json b/haxcms/build/es6/node_modules/@haxtheweb/tagging-question/lib/tagging-question.haxProperties.json index 95e94049c..0924a5086 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/tagging-question/lib/tagging-question.haxProperties.json +++ b/haxcms/build/es6/node_modules/@haxtheweb/tagging-question/lib/tagging-question.haxProperties.json @@ -72,7 +72,8 @@ "answers", "displayed-answers", "t", - "show-answer" + "show-answer", + "edit" ] }, "documentation": { diff --git a/haxcms/build/es6/node_modules/@haxtheweb/type-writer/type-writer.js b/haxcms/build/es6/node_modules/@haxtheweb/type-writer/type-writer.js index 0245a8958..5f0961da4 100644 --- a/haxcms/build/es6/node_modules/@haxtheweb/type-writer/type-writer.js +++ b/haxcms/build/es6/node_modules/@haxtheweb/type-writer/type-writer.js @@ -2,7 +2,7 @@ * Copyright 2020 The Pennsylvania State University * @license Apache-2.0, see License.md for full text. */ -import{LitElement as t,html as e,css as i}from"../../lit/index.js";import{IntersectionObserverMixin as r}from"../intersection-element/lib/IntersectionObserverMixin.js";class TypeWriter extends(r(t)){static get styles(){return[i` +import{LitElement as e,html as t,css as i}from"../../lit/index.js";import{IntersectionObserverMixin as r}from"../intersection-element/lib/IntersectionObserverMixin.js";class TypeWriter extends(r(e)){static get styles(){return[i` :host { display: inline-block; margin: 0px 0.1em; @@ -73,4 +73,4 @@ import{LitElement as t,html as e,css as i}from"../../lit/index.js";import{Inters -o-animation: flickerAnimation 1s infinite; animation: flickerAnimation 1s infinite; } - `]}render(){return e` |`}static get haxProperties(){return{canScale:!0,canEditSource:!0,gizmo:{title:"Type writer",description:"typewritter effect",icon:"icons:android",color:"green",tags:["Other","interactive","fancy","Writer","type"],handles:[],meta:{author:"HAXTheWeb",owner:"The Pennsylvania State University"}},settings:{configure:[{property:"delay",description:"",inputMethod:"textfield",required:!1,icon:"icons:android"},{property:"cursorDuration",description:"",inputMethod:"textfield",required:!1,icon:"icons:android"},{property:"text",description:"",inputMethod:"textfield",required:!1,icon:"icons:android"},{property:"speed",description:"",inputMethod:"textfield",required:!1,icon:"icons:android"},{property:"typing",description:"",inputMethod:"boolean",required:!1,icon:"icons:android"}],advanced:[]},saveOptions:{unsetAttributes:["element-visible"]}}}static get properties(){return{...super.properties,delay:{type:Number},cursorDuration:{type:Number,attribute:"cursor-duration"},text:{type:String},speed:{type:Number},elementVisible:{type:Boolean},eraseSpeed:{type:Number,attribute:"erase-speed"},typing:{type:Boolean,reflect:!0},_length:{type:Number},_oldText:{type:String}}}static get tag(){return"type-writer"}constructor(){super(),this.delay=100,this.cursorDuration=0,this.speed=150,this.eraseSpeed=80,this.typing=!1}_observeText(t,e,i){if(t&&void 0!==e&&i){if(this.shadowRoot.querySelector("#text").textContent)return this._oldText=this.shadowRoot.querySelector("#text").textContent,this.typing&&this._cancel&&(clearTimeout(this._cancel),this._cancel=null),this.erase();this._length=0,setTimeout((()=>{this.type()}),this.delay)}}type(){this.typing=!0,this.shadowRoot.querySelector("#text").textContent=this.text.substr(0,this._length++),this._length{this.type()}),this.speed+(Math.random()-.5)*this.speed/2):setTimeout((()=>{this.typing=!1,this.dispatchEvent(new CustomEvent("type-writer-end",{detail:this.text,bubbles:!0,composed:!0}))}),this.cursorDuration)}erase(){this.typing=!0,this.shadowRoot.querySelector("#text").textContent=this._oldText.substr(0,this._length--),this._length>=0?this._cancel=setTimeout((()=>{this.erase()}),this.eraseSpeed||this.speed):this.type()}updated(t){t.forEach(((t,e)=>{["text","delay","elementVisible"].includes(e)&&this._observeText(this.text,this.delay,this.elementVisible)}))}}customElements.define(TypeWriter.tag,TypeWriter);export{TypeWriter}; \ No newline at end of file + `]}render(){return t` |`}static get haxProperties(){return{canScale:!0,canEditSource:!0,gizmo:{title:"Type writer",description:"typewritter effect",icon:"hardware:keyboard",color:"green",tags:["Other","interactive","fancy","Writer","type"],handles:[],meta:{author:"HAXTheWeb",owner:"The Pennsylvania State University"}},settings:{configure:[{property:"delay",description:"",inputMethod:"textfield",required:!1},{property:"cursorDuration",description:"",inputMethod:"textfield",required:!1},{property:"text",description:"",inputMethod:"textfield",required:!1},{property:"speed",description:"",inputMethod:"textfield",required:!1},{property:"typing",description:"",inputMethod:"boolean",required:!1}],advanced:[]},saveOptions:{unsetAttributes:["element-visible"]}}}static get properties(){return{...super.properties,delay:{type:Number},cursorDuration:{type:Number,attribute:"cursor-duration"},text:{type:String},speed:{type:Number},elementVisible:{type:Boolean},eraseSpeed:{type:Number,attribute:"erase-speed"},typing:{type:Boolean,reflect:!0},_length:{type:Number},_oldText:{type:String}}}static get tag(){return"type-writer"}constructor(){super(),this.delay=100,this.cursorDuration=0,this.speed=150,this.eraseSpeed=80,this.typing=!1}_observeText(e,t,i){if(e&&void 0!==t&&i){if(this.shadowRoot.querySelector("#text").textContent)return this._oldText=this.shadowRoot.querySelector("#text").textContent,this.typing&&this._cancel&&(clearTimeout(this._cancel),this._cancel=null),this.erase();this._length=0,setTimeout((()=>{this.type()}),this.delay)}}type(){this.typing=!0,this.shadowRoot.querySelector("#text").textContent=this.text.substr(0,this._length++),this._length{this.type()}),this.speed+(Math.random()-.5)*this.speed/2):setTimeout((()=>{this.typing=!1,this.dispatchEvent(new CustomEvent("type-writer-end",{detail:this.text,bubbles:!0,composed:!0}))}),this.cursorDuration)}erase(){this.typing=!0,this.shadowRoot.querySelector("#text").textContent=this._oldText.substr(0,this._length--),this._length>=0?this._cancel=setTimeout((()=>{this.erase()}),this.eraseSpeed||this.speed):this.type()}updated(e){e.forEach(((e,t)=>{["text","delay","elementVisible"].includes(t)&&this._observeText(this.text,this.delay,this.elementVisible)}))}}customElements.define(TypeWriter.tag,TypeWriter);export{TypeWriter}; \ No newline at end of file diff --git a/storybook/3aca21c8.js b/storybook/0328e1b4.js similarity index 97% rename from storybook/3aca21c8.js rename to storybook/0328e1b4.js index 575152918..11edce4ab 100644 --- a/storybook/3aca21c8.js +++ b/storybook/0328e1b4.js @@ -1 +1 @@ -System.register(["./bfad1b78.js"],(function(e){"use strict";var t,o,a,i,n,s,r,l,u;return{setters:[function(e){t=e._,o=e.a,a=e.p,i=e.N,n=e.m,s=e.c,r=e.d,l=e.aK,u=e.o}],execute:function(){var c=e("HAXCMSSiteRouter",function(e){function n(){var e;s(this,n),(e=r(this,n)).windowControllers=new AbortController,globalThis.HAXCMS.requestAvailability().storePieces.siteRouter=e;var t={};return e.baseURI&&(t.baseUrl=e.baseURI),e.router=new l(e,t),e.__disposer=e.__disposer?e.__disposer:[],u((function(t){e._updateRouter(i.routerManifest),e.__disposer.push(t)})),globalThis.addEventListener("vaadin-router-location-changed",e._routerLocationChanged.bind(e),{signal:e.windowControllers.signal}),globalThis.addEventListener("haxcms-site-router-add",e.addRoutesEvent.bind(e),{signal:e.windowControllers.signal}),e}return t(n,e),o(n,[{key:"baseURI",get:function(){return this.getAttribute("base-uri")},set:function(e){this.setAttribute("base-uri",e)}},{key:"disconnectedCallback",value:function(){for(var e in this.__disposer)this.__disposer[e].dispose();this.windowControllers.abort()}},{key:"addRoutesEvent",value:function(e){this.addRoutes(e.detail)}},{key:"addRoutes",value:function(e){this.router.addRoutes(e)}},{key:"_updateRouter",value:function(e){if(e&&void 0!==e.items){var t=e.items.map((function(e){return{path:e.slug,name:e.id,component:"fake-".concat(e.id,"-e")}}));this.router.setRoutes([].concat(a(t),[{path:"/",component:"fake-home-e",name:"home"},{path:"/(.*)",component:"fake-404-e",name:"404"}]))}}},{key:"lookupRoute",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return!!(e&&i.routerManifest&&i.routerManifest.items&&i.routerManifest.items.filter((function(t){return t.slug===e})).length>0)&&i.routerManifest.items.filter((function(t){return t.slug===e}))}},{key:"_routerLocationChanged",value:function(e){if(globalThis.dispatchEvent(new CustomEvent("simple-modal-hide",{bubbles:!0,cancelable:!0,detail:{}})),globalThis.dispatchEvent(new CustomEvent("haxcms-toast-hide",{bubbles:!0,cancelable:!0,detail:{}})),globalThis.dispatchEvent(new CustomEvent("super-daemon-close",{bubbles:!0,cancelable:!0,detail:{}})),i.currentRouterLocation=e.detail.location,"404"===e.detail.location.route.name&&(e.detail.location.params[0].startsWith("files/")||e.detail.location.params[0].startsWith("assets/")))globalThis.location=e.detail.location.pathname;else if("home"===e.detail.location.route.name&&e.detail.location.search.startsWith("?p=/")&&this.lookupRoute(e.detail.location.search.replace("?p=/","").split("&")[0])){var t=this.lookupRoute(e.detail.location.search.replace("?p=/","").split("&")[0])[0];i.activeId=t.id,globalThis.history.replaceState({},null,e.detail.location.search.replace("?p=/","").split("&")[0])}else i.location=e.detail.location}}],[{key:"tag",get:function(){return"haxcms-site-router"}}])}(n(HTMLElement)));customElements.define(c.tag,c)}}})); +System.register(["./9b1def34.js"],(function(e){"use strict";var t,o,a,i,n,s,r,l,u;return{setters:[function(e){t=e._,o=e.a,a=e.p,i=e.N,n=e.m,s=e.c,r=e.d,l=e.aK,u=e.o}],execute:function(){var c=e("HAXCMSSiteRouter",function(e){function n(){var e;s(this,n),(e=r(this,n)).windowControllers=new AbortController,globalThis.HAXCMS.requestAvailability().storePieces.siteRouter=e;var t={};return e.baseURI&&(t.baseUrl=e.baseURI),e.router=new l(e,t),e.__disposer=e.__disposer?e.__disposer:[],u((function(t){e._updateRouter(i.routerManifest),e.__disposer.push(t)})),globalThis.addEventListener("vaadin-router-location-changed",e._routerLocationChanged.bind(e),{signal:e.windowControllers.signal}),globalThis.addEventListener("haxcms-site-router-add",e.addRoutesEvent.bind(e),{signal:e.windowControllers.signal}),e}return t(n,e),o(n,[{key:"baseURI",get:function(){return this.getAttribute("base-uri")},set:function(e){this.setAttribute("base-uri",e)}},{key:"disconnectedCallback",value:function(){for(var e in this.__disposer)this.__disposer[e].dispose();this.windowControllers.abort()}},{key:"addRoutesEvent",value:function(e){this.addRoutes(e.detail)}},{key:"addRoutes",value:function(e){this.router.addRoutes(e)}},{key:"_updateRouter",value:function(e){if(e&&void 0!==e.items){var t=e.items.map((function(e){return{path:e.slug,name:e.id,component:"fake-".concat(e.id,"-e")}}));this.router.setRoutes([].concat(a(t),[{path:"/",component:"fake-home-e",name:"home"},{path:"/(.*)",component:"fake-404-e",name:"404"}]))}}},{key:"lookupRoute",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return!!(e&&i.routerManifest&&i.routerManifest.items&&i.routerManifest.items.filter((function(t){return t.slug===e})).length>0)&&i.routerManifest.items.filter((function(t){return t.slug===e}))}},{key:"_routerLocationChanged",value:function(e){if(globalThis.dispatchEvent(new CustomEvent("simple-modal-hide",{bubbles:!0,cancelable:!0,detail:{}})),globalThis.dispatchEvent(new CustomEvent("haxcms-toast-hide",{bubbles:!0,cancelable:!0,detail:{}})),globalThis.dispatchEvent(new CustomEvent("super-daemon-close",{bubbles:!0,cancelable:!0,detail:{}})),i.currentRouterLocation=e.detail.location,"404"===e.detail.location.route.name&&(e.detail.location.params[0].startsWith("files/")||e.detail.location.params[0].startsWith("assets/")))globalThis.location=e.detail.location.pathname;else if("home"===e.detail.location.route.name&&e.detail.location.search.startsWith("?p=/")&&this.lookupRoute(e.detail.location.search.replace("?p=/","").split("&")[0])){var t=this.lookupRoute(e.detail.location.search.replace("?p=/","").split("&")[0])[0];i.activeId=t.id,globalThis.history.replaceState({},null,e.detail.location.search.replace("?p=/","").split("&")[0])}else i.location=e.detail.location}}],[{key:"tag",get:function(){return"haxcms-site-router"}}])}(n(HTMLElement)));customElements.define(c.tag,c)}}})); diff --git a/storybook/5736c0a5.js b/storybook/0f76f809.js similarity index 68% rename from storybook/5736c0a5.js rename to storybook/0f76f809.js index 3098a7256..012aead7c 100644 --- a/storybook/5736c0a5.js +++ b/storybook/0f76f809.js @@ -1 +1 @@ -System.register(["./bfad1b78.js","./c2d44fd1.js"],(function(t){"use strict";var s,i,e,a,n,o,l,c,r,h;return{setters:[function(t){s=t._,i=t.a,e=t.f,a=t.g,n=t.c,o=t.d,l=t.o,c=t.t,r=t.N},function(t){h=t.R}],execute:function(){var d=t("HAXCMSToast",function(t){function h(){var t;return n(this,h),(t=o(this,h)).windowControllers=new AbortController,l((function(){t.userName=c(r.userData.userName)})),l((function(){t.darkMode=c(r.darkMode)})),t}return s(h,t),i(h,[{key:"connectedCallback",value:function(){e(a(h.prototype),"connectedCallback",this).call(this),globalThis.addEventListener("haxcms-toast-hide",this.hideSimpleToast.bind(this),{signal:this.windowControllers.signal}),globalThis.addEventListener("haxcms-toast-show",this.showSimpleToast.bind(this),{signal:this.windowControllers.signal})}},{key:"hideSimpleToast",value:function(t){var s=this;this.alwaysvisible||(this.style.animation="forcedfadeout 0.6s .3s",this.awaitingMerlinInput=!1,setTimeout((function(){s.hide()}),0))}},{key:"disconnectedCallback",value:function(){this.windowControllers.abort(),e(a(h.prototype),"disconnectedCallback",this).call(this)}}],[{key:"tag",get:function(){return"haxcms-toast"}}])}(h));customElements.define(d.tag,d),globalThis.HAXCMSToast=globalThis.HAXCMSToast||{},globalThis.HAXCMSToast.requestAvailability=function(){return globalThis.HAXCMSToast.instance||(globalThis.HAXCMSToast.instance=globalThis.document.createElement(d.tag),globalThis.document.body.appendChild(globalThis.HAXCMSToast.instance)),globalThis.HAXCMSToast.instance};t("HAXCMSToastInstance",globalThis.HAXCMSToast.requestAvailability())}}})); +System.register(["./9b1def34.js","./8986fcf1.js"],(function(t){"use strict";var s,e,i,a,n,o,l,c,r,h;return{setters:[function(t){s=t._,e=t.a,i=t.f,a=t.g,n=t.c,o=t.d,l=t.o,c=t.t,r=t.N},function(t){h=t.R}],execute:function(){var u=t("HAXCMSToast",function(t){function h(){var t;return n(this,h),(t=o(this,h)).windowControllers=new AbortController,l((function(){t.userName=c(r.userData.userName)})),l((function(){t.darkMode=c(r.darkMode)})),t}return s(h,t),e(h,[{key:"connectedCallback",value:function(){i(a(h.prototype),"connectedCallback",this).call(this),globalThis.addEventListener("haxcms-toast-hide",this.hideSimpleToast.bind(this),{signal:this.windowControllers.signal}),globalThis.addEventListener("haxcms-toast-show",this.showSimpleToast.bind(this),{signal:this.windowControllers.signal})}},{key:"hideSimpleToast",value:function(t){var s=this;this.alwaysvisible||(this.style.animation="forcedfadeout 0.6s .3s",this.awaitingMerlinInput=!1,setTimeout((function(){s.hide()}),0))}},{key:"disconnectedCallback",value:function(){this.windowControllers.abort(),i(a(h.prototype),"disconnectedCallback",this).call(this)}}],[{key:"tag",get:function(){return"haxcms-toast"}}])}(h));customElements.define(u.tag,u),globalThis.HAXCMSToast=globalThis.HAXCMSToast||{},globalThis.HAXCMSToast.requestAvailability=function(){return globalThis.HAXCMSToast.instance||(globalThis.HAXCMSToast.instance=globalThis.document.createElement(u.tag),globalThis.document.body.appendChild(globalThis.HAXCMSToast.instance)),globalThis.HAXCMSToast.instance};t("HAXCMSToastInstance",globalThis.HAXCMSToast.requestAvailability())}}})); diff --git a/storybook/65ec6500.js b/storybook/10c7629d.js similarity index 96% rename from storybook/65ec6500.js rename to storybook/10c7629d.js index ceb141c67..772d541ca 100644 --- a/storybook/65ec6500.js +++ b/storybook/10c7629d.js @@ -1 +1 @@ -System.register(["./bfad1b78.js"],(function(t,e){"use strict";var i,n,s,o,a,c,r,l,d,u;return{setters:[function(t){i=t._,n=t.a,s=t.f,o=t.g,a=t.N,c=t.m,r=t.c,l=t.d,d=t.j,u=t.k}],execute:function(){var h={url:new URL("./elements/haxcms-elements/lib/core/haxcms-editor-builder.js",document.baseURI).href},m=t("HAXCMSEditorBuilder",function(t){function c(){var t;return r(this,c),(t=l(this,c)).windowControllers=new AbortController,globalThis.HAXCMS.requestAvailability().storePieces.editorBuilder=t,t.applyContext(),globalThis.addEventListener("haxcms-site-editor-loaded",t.editorLoaded.bind(t),{signal:t.windowControllers.signal}),t}return i(c,t),n(c,[{key:"connectedCallback",value:function(){s(o(c.prototype),"connectedCallback",this)&&s(o(c.prototype),"connectedCallback",this).call(this),this.dispatchEvent(new CustomEvent("haxcms-editor-builder-ready",{bubbles:!0,composed:!0,cancelable:!1,detail:this}))}},{key:"disconnectedCallback",value:function(){this.windowControllers.abort(),s(o(c.prototype),"disconnectedCallback",this)&&s(o(c.prototype),"disconnectedCallback",this).call(this)}},{key:"editorLoaded",value:function(t){var i=this;a.cmsSiteEditor.haxCmsSiteEditorUIElement||e.import("./94200907.js").then((function(){for(var t in a.cmsSiteEditor.haxCmsSiteEditorUIElement=globalThis.document.createElement("haxcms-site-editor-ui"),a.setupSlots)switch(t){case"haxcms-site-editor-ui-prefix-avatar":case"haxcms-site-editor-ui-prefix-buttons":case"haxcms-site-editor-ui-suffix-buttons":case"haxcms-site-editor-ui-main-menu":case"haxcms-site-editor-ui-topbar-character-button":for(var e in a.setupSlots[t])a.cmsSiteEditor.haxCmsSiteEditorUIElement.appendChild(a.setupSlots[t][e])}i.parentNode?i.parentNode.insertBefore(a.cmsSiteEditor.haxCmsSiteEditorUIElement,i):globalThis.document.body.appendChild(a.cmsSiteEditor.haxCmsSiteEditorUIElement),setTimeout((function(){a.cmsSiteEditor.haxCmsSiteEditorUIElement.painting=!1}),600)}))}},{key:"applyContext",value:(m=d(u().mark((function t(){var i,n,s,o=this,c=arguments;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=c.length>0&&void 0!==c[0]?c[0]:null,this.__appliedContext){t.next=11;break}if(this.__appliedContext=!0,null==i&&(i=globalThis.HAXCMS.requestAvailability().getApplicationContext()),!["php","nodejs","desktop"].includes(i)){t.next=9;break}return n=globalThis.document.createElement("script"),globalThis.appSettings&&globalThis.appSettings.connectionSettings?n.src=globalThis.appSettings.connectionSettings:n.src="../../system/api/connectionSettings",t.next=9,fetch(n.src).then((function(t){t.ok&&(o.__hasConnectionSettings=!0,globalThis.document.documentElement.appendChild(n))}));case 9:"demo"==i&&(this.__hasConnectionSettings=!0),!["published","11ty"].includes(i)&&this.__hasConnectionSettings&&(s=new URL("./haxcms-editor-builder.js",h.url).href+"/../",a.cmsSiteEditorBackend.tag="haxcms-backend-".concat(i),e.import("".concat(s,"backends/").concat(a.cmsSiteEditorBackend.tag,".js")).then((function(t){a.cmsSiteEditorBackend.instance||(a.cmsSiteEditorBackend.instance=globalThis.document.createElement(a.cmsSiteEditorBackend.tag),globalThis.document.body.appendChild(a.cmsSiteEditorBackend.instance))})));case 11:case"end":return t.stop()}}),t,this)}))),function(){return m.apply(this,arguments)})}],[{key:"tag",get:function(){return"haxcms-editor-builder"}}]);var m}(c(HTMLElement)));customElements.define(m.tag,m)}}})); +System.register(["./9b1def34.js"],(function(t,e){"use strict";var i,n,s,o,a,c,r,l,d,u;return{setters:[function(t){i=t._,n=t.a,s=t.f,o=t.g,a=t.N,c=t.m,r=t.c,l=t.d,d=t.j,u=t.k}],execute:function(){var h={url:new URL("./elements/haxcms-elements/lib/core/haxcms-editor-builder.js",document.baseURI).href},m=t("HAXCMSEditorBuilder",function(t){function c(){var t;return r(this,c),(t=l(this,c)).windowControllers=new AbortController,globalThis.HAXCMS.requestAvailability().storePieces.editorBuilder=t,t.applyContext(),globalThis.addEventListener("haxcms-site-editor-loaded",t.editorLoaded.bind(t),{signal:t.windowControllers.signal}),t}return i(c,t),n(c,[{key:"connectedCallback",value:function(){s(o(c.prototype),"connectedCallback",this)&&s(o(c.prototype),"connectedCallback",this).call(this),this.dispatchEvent(new CustomEvent("haxcms-editor-builder-ready",{bubbles:!0,composed:!0,cancelable:!1,detail:this}))}},{key:"disconnectedCallback",value:function(){this.windowControllers.abort(),s(o(c.prototype),"disconnectedCallback",this)&&s(o(c.prototype),"disconnectedCallback",this).call(this)}},{key:"editorLoaded",value:function(t){var i=this;a.cmsSiteEditor.haxCmsSiteEditorUIElement||e.import("./787971fb.js").then((function(){for(var t in a.cmsSiteEditor.haxCmsSiteEditorUIElement=globalThis.document.createElement("haxcms-site-editor-ui"),a.setupSlots)switch(t){case"haxcms-site-editor-ui-prefix-avatar":case"haxcms-site-editor-ui-prefix-buttons":case"haxcms-site-editor-ui-suffix-buttons":case"haxcms-site-editor-ui-main-menu":case"haxcms-site-editor-ui-topbar-character-button":for(var e in a.setupSlots[t])a.cmsSiteEditor.haxCmsSiteEditorUIElement.appendChild(a.setupSlots[t][e])}i.parentNode?i.parentNode.insertBefore(a.cmsSiteEditor.haxCmsSiteEditorUIElement,i):globalThis.document.body.appendChild(a.cmsSiteEditor.haxCmsSiteEditorUIElement),setTimeout((function(){a.cmsSiteEditor.haxCmsSiteEditorUIElement.painting=!1}),600)}))}},{key:"applyContext",value:(m=d(u().mark((function t(){var i,n,s,o=this,c=arguments;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=c.length>0&&void 0!==c[0]?c[0]:null,this.__appliedContext){t.next=11;break}if(this.__appliedContext=!0,null==i&&(i=globalThis.HAXCMS.requestAvailability().getApplicationContext()),!["php","nodejs","desktop"].includes(i)){t.next=9;break}return n=globalThis.document.createElement("script"),globalThis.appSettings&&globalThis.appSettings.connectionSettings?n.src=globalThis.appSettings.connectionSettings:n.src="../../system/api/connectionSettings",t.next=9,fetch(n.src).then((function(t){t.ok&&(o.__hasConnectionSettings=!0,globalThis.document.documentElement.appendChild(n))}));case 9:"demo"==i&&(this.__hasConnectionSettings=!0),!["published","11ty"].includes(i)&&this.__hasConnectionSettings&&(s=new URL("./haxcms-editor-builder.js",h.url).href+"/../",a.cmsSiteEditorBackend.tag="haxcms-backend-".concat(i),e.import("".concat(s,"backends/").concat(a.cmsSiteEditorBackend.tag,".js")).then((function(t){a.cmsSiteEditorBackend.instance||(a.cmsSiteEditorBackend.instance=globalThis.document.createElement(a.cmsSiteEditorBackend.tag),globalThis.document.body.appendChild(a.cmsSiteEditorBackend.instance))})));case 11:case"end":return t.stop()}}),t,this)}))),function(){return m.apply(this,arguments)})}],[{key:"tag",get:function(){return"haxcms-editor-builder"}}]);var m}(c(HTMLElement)));customElements.define(m.tag,m)}}})); diff --git a/storybook/e146cb46.js b/storybook/1b43ab3c.js similarity index 99% rename from storybook/e146cb46.js rename to storybook/1b43ab3c.js index e7f1c15c3..555a6060e 100644 --- a/storybook/e146cb46.js +++ b/storybook/1b43ab3c.js @@ -1 +1 @@ -System.register(["./bfad1b78.js"],(function(i){"use strict";var t,e,s,h,a,n,r,o,l;return{setters:[function(i){t=i.a,e=i.c,s=i.l,h=i._,a=i.f,n=i.g,r=i.d,o=i.K,l=i.p}],execute:function(){var _=function(){return t((function i(t){e(this,i),this._map=new Map,this._roundAverageSize=!1,this.totalSize=0,!0===(null==t?void 0:t.roundAverageSize)&&(this._roundAverageSize=!0)}),[{key:"set",value:function(i,t){var e=this._map.get(i)||0;this._map.set(i,t),this.totalSize+=t-e}},{key:"averageSize",get:function(){if(this._map.size>0){var i=this.totalSize/this._map.size;return this._roundAverageSize?Math.round(i):i}return 0}},{key:"getSize",value:function(i){return this._map.get(i)}},{key:"clear",value:function(){this._map.clear(),this.totalSize=0}}])}();function c(i){return"horizontal"===i?"width":"height"}var u=function(){return t((function i(t,s){var h=this;e(this,i),this._latestCoords={left:0,top:0},this._direction=null,this._viewportSize={width:0,height:0},this.totalScrollSize={width:0,height:0},this.offsetWithinScroller={left:0,top:0},this._pendingReflow=!1,this._pendingLayoutUpdate=!1,this._pin=null,this._firstVisible=0,this._lastVisible=0,this._physicalMin=0,this._physicalMax=0,this._first=-1,this._last=-1,this._sizeDim="height",this._secondarySizeDim="width",this._positionDim="top",this._secondaryPositionDim="left",this._scrollPosition=0,this._scrollError=0,this._items=[],this._scrollSize=1,this._overhang=1e3,this._hostSink=t,Promise.resolve().then((function(){return h.config=s||h._getDefaultConfig()}))}),[{key:"_getDefaultConfig",value:function(){return{direction:"vertical"}}},{key:"config",get:function(){return{direction:this.direction}},set:function(i){Object.assign(this,Object.assign({},this._getDefaultConfig(),i))}},{key:"items",get:function(){return this._items},set:function(i){this._setItems(i)}},{key:"_setItems",value:function(i){i!==this._items&&(this._items=i,this._scheduleReflow())}},{key:"direction",get:function(){return this._direction},set:function(i){(i="horizontal"===i?i:"vertical")!==this._direction&&(this._direction=i,this._sizeDim="horizontal"===i?"width":"height",this._secondarySizeDim="horizontal"===i?"height":"width",this._positionDim="horizontal"===i?"left":"top",this._secondaryPositionDim="horizontal"===i?"top":"left",this._triggerReflow())}},{key:"viewportSize",get:function(){return this._viewportSize},set:function(i){var t=this._viewDim1,e=this._viewDim2;Object.assign(this._viewportSize,i),e!==this._viewDim2?this._scheduleLayoutUpdate():t!==this._viewDim1&&this._checkThresholds()}},{key:"viewportScroll",get:function(){return this._latestCoords},set:function(i){Object.assign(this._latestCoords,i);var t=this._scrollPosition;this._scrollPosition=this._latestCoords[this._positionDim],Math.abs(t-this._scrollPosition)>=1&&this._checkThresholds()}},{key:"reflowIfNeeded",value:function(){(arguments.length>0&&void 0!==arguments[0]&&arguments[0]||this._pendingReflow)&&(this._pendingReflow=!1,this._reflow())}},{key:"pin",get:function(){if(null!==this._pin){var i=this._pin,t=i.index,e=i.block;return{index:Math.max(0,Math.min(t,this.items.length-1)),block:e}}return null},set:function(i){this._pin=i,this._triggerReflow()}},{key:"_clampScrollPosition",value:function(i){return Math.max(-this.offsetWithinScroller[this._positionDim],Math.min(i,this.totalScrollSize[c(this.direction)]-this._viewDim1))}},{key:"unpin",value:function(){null!==this._pin&&(this._sendUnpinnedMessage(),this._pin=null)}},{key:"_updateLayout",value:function(){}},{key:"_viewDim1",get:function(){return this._viewportSize[this._sizeDim]}},{key:"_viewDim2",get:function(){return this._viewportSize[this._secondarySizeDim]}},{key:"_scheduleReflow",value:function(){this._pendingReflow=!0}},{key:"_scheduleLayoutUpdate",value:function(){this._pendingLayoutUpdate=!0,this._scheduleReflow()}},{key:"_triggerReflow",value:function(){var i=this;this._scheduleLayoutUpdate(),Promise.resolve().then((function(){return i.reflowIfNeeded()}))}},{key:"_reflow",value:function(){this._pendingLayoutUpdate&&(this._updateLayout(),this._pendingLayoutUpdate=!1),this._updateScrollSize(),this._setPositionFromPin(),this._getActiveItems(),this._updateVisibleIndices(),this._sendStateChangedMessage()}},{key:"_setPositionFromPin",value:function(){if(null!==this.pin){var i=this._scrollPosition,t=this.pin,e=t.index,s=t.block;this._scrollPosition=this._calculateScrollIntoViewPosition({index:e,block:s||"start"})-this.offsetWithinScroller[this._positionDim],this._scrollError=i-this._scrollPosition}}},{key:"_calculateScrollIntoViewPosition",value:function(i){var t=i.block,e=Math.min(this.items.length,Math.max(0,i.index)),s=this._getItemPosition(e)[this._positionDim],h=s;if("start"!==t){var a=this._getItemSize(e)[this._sizeDim];if("center"===t)h=s-.5*this._viewDim1+.5*a;else{var n=s-this._viewDim1+a;if("end"===t)h=n;else{var r=this._scrollPosition;h=Math.abs(r-s)0||null!==this._pin)this._scheduleReflow();else{var i=Math.max(0,this._scrollPosition-this._overhang),t=Math.min(this._scrollSize,this._scrollPosition+this._viewDim1+this._overhang);this._physicalMin>i||this._physicalMaxthis._first&&Math.round(this._getItemPosition(e)[this._positionDim])>=Math.round(this._scrollPosition+this._viewDim1);)e--;t===this._firstVisible&&e===this._lastVisible||(this._firstVisible=t,this._lastVisible=e,i&&i.emit&&this._sendVisibilityChangedMessage())}}}])}();i("flow",(function(i){return Object.assign({type:d},i)}));function g(i){return"horizontal"===i?"marginLeft":"marginTop"}function f(i){return"horizontal"===i?"marginRight":"marginBottom"}function v(i,t){var e=[i,t].sort();return e[1]<=0?Math.min.apply(Math,l(e)):e[0]>=0?Math.max.apply(Math,l(e)):e[0]+e[1]}var m=function(){return t((function i(){e(this,i),this._childSizeCache=new _,this._marginSizeCache=new _,this._metricsCache=new Map}),[{key:"update",value:function(i,t){var e=this,s=new Set;Object.keys(i).forEach((function(h){var a=Number(h);e._metricsCache.set(a,i[a]),e._childSizeCache.set(a,i[a][c(t)]),s.add(a),s.add(a+1)}));var h,a=o(s);try{for(a.s();!(h=a.n()).done;){var n,r,l=h.value,_=(null===(n=this._metricsCache.get(l))||void 0===n?void 0:n[g(t)])||0,u=(null===(r=this._metricsCache.get(l-1))||void 0===r?void 0:r[f(t)])||0;this._marginSizeCache.set(l,v(_,u))}}catch(i){a.e(i)}finally{a.f()}}},{key:"averageChildSize",get:function(){return this._childSizeCache.averageSize}},{key:"totalChildSize",get:function(){return this._childSizeCache.totalSize}},{key:"averageMarginSize",get:function(){return this._marginSizeCache.averageSize}},{key:"totalMarginSize",get:function(){return this._marginSizeCache.totalSize}},{key:"getLeadingMarginValue",value:function(i,t){var e;return(null===(e=this._metricsCache.get(i))||void 0===e?void 0:e[g(t)])||0}},{key:"getChildSize",value:function(i){return this._childSizeCache.getSize(i)}},{key:"getMarginSize",value:function(i){return this._marginSizeCache.getSize(i)}},{key:"clear",value:function(){this._childSizeCache.clear(),this._marginSizeCache.clear(),this._metricsCache.clear()}}])}(),d=i("FlowLayout",function(i){function o(){var i;return e(this,o),(i=r(this,o,arguments))._itemSize={width:100,height:100},i._physicalItems=new Map,i._newPhysicalItems=new Map,i._metricsCache=new m,i._anchorIdx=null,i._anchorPos=null,i._stable=!0,i._measureChildren=!0,i._estimate=!0,i}return h(o,i),t(o,[{key:"measureChildren",get:function(){return this._measureChildren}},{key:"updateItemSizes",value:function(i){this._metricsCache.update(i,this.direction),this._scheduleReflow()}},{key:"_getPhysicalItem",value:function(i){var t;return null!==(t=this._newPhysicalItems.get(i))&&void 0!==t?t:this._physicalItems.get(i)}},{key:"_getSize",value:function(i){return this._getPhysicalItem(i)&&this._metricsCache.getChildSize(i)}},{key:"_getAverageSize",value:function(){return this._metricsCache.averageChildSize||this._itemSize[this._sizeDim]}},{key:"_estimatePosition",value:function(i){var t=this._metricsCache;if(-1===this._first||-1===this._last)return t.averageMarginSize+i*(t.averageMarginSize+this._getAverageSize());if(ithis._scrollSize-this._viewDim1?this.items.length-1:Math.max(0,Math.min(this.items.length-1,Math.floor((i+t)/2/this._delta)))}},{key:"_getAnchor",value:function(i,t){if(0===this._physicalItems.size)return this._calculateAnchor(i,t);if(this._first<0)return this._calculateAnchor(i,t);if(this._last<0)return this._calculateAnchor(i,t);var e=this._getPhysicalItem(this._first),s=this._getPhysicalItem(this._last),h=e.pos;if(s.pos+this._metricsCache.getChildSize(this._last)t)return this._calculateAnchor(i,t);for(var a=this._firstVisible-1,n=-1/0;nthis._scrollSize)this._clearItems();else{null!==this._anchorIdx&&null!==this._anchorPos||(this._anchorIdx=this._getAnchor(e,s),this._anchorPos=this._getPosition(this._anchorIdx));var n=this._getSize(this._anchorIdx);void 0===n&&(this._stable=!1,n=this._getAverageSize());var r=null!==(i=this._metricsCache.getMarginSize(this._anchorIdx))&&void 0!==i?i:this._metricsCache.averageMarginSize,o=null!==(t=this._metricsCache.getMarginSize(this._anchorIdx+1))&&void 0!==t?t:this._metricsCache.averageMarginSize;0===this._anchorIdx&&(this._anchorPos=r),this._anchorIdx===this.items.length-1&&(this._anchorPos=this._scrollSize-o-n);var l=0;for(this._anchorPos+n+os&&(l=s-(this._anchorPos-r)),l&&(this._scrollPosition-=l,e-=l,s-=l,this._scrollError+=l),h.set(this._anchorIdx,{pos:this._anchorPos,size:n}),this._first=this._last=this._anchorIdx,this._physicalMin=this._anchorPos-r,this._physicalMax=this._anchorPos+n+o;this._physicalMin>e&&this._first>0;){var _=this._getSize(--this._first);void 0===_&&(this._stable=!1,_=this._getAverageSize());var c=this._metricsCache.getMarginSize(this._first);void 0===c&&(this._stable=!1,c=this._metricsCache.averageMarginSize),this._physicalMin-=_;var u=this._physicalMin;if(h.set(this._first,{pos:u,size:_}),this._physicalMin-=c,!1===this._stable&&!1===this._estimate)break}for(;this._physicalMax=this._scrollSize?this._physicalMax-this._scrollSize+(this.items.length-1-this._last)*this._delta:0}},{key:"_reflow",value:function(){var i=this._first,t=this._last;a(n(o.prototype),"_reflow",this).call(this),(-1===this._first&&-1==this._last||this._first===i&&this._last===t)&&this._resetReflowState()}},{key:"_resetReflowState",value:function(){this._anchorIdx=null,this._anchorPos=null,this._stable=!0}},{key:"_updateScrollSize",value:function(){var i=this._metricsCache.averageMarginSize;this._scrollSize=Math.max(1,this.items.length*(i+this._getAverageSize())+i)}},{key:"_delta",get:function(){var i=this._metricsCache.averageMarginSize;return this._getAverageSize()+i}},{key:"_getItemPosition",value:function(i){var t;return s(s(s({},this._positionDim,this._getPosition(i)),this._secondaryPositionDim,0),"horizontal"===this.direction?"xOffset":"yOffset",-(null!==(t=this._metricsCache.getLeadingMarginValue(i,this.direction))&&void 0!==t?t:this._metricsCache.averageMarginSize))}},{key:"_getItemSize",value:function(i){return s(s({},this._sizeDim,this._getSize(i)||this._getAverageSize()),this._secondarySizeDim,this._itemSize[this._secondarySizeDim])}},{key:"_viewDim2Changed",value:function(){this._metricsCache.clear(),this._scheduleReflow()}}])}(u))}}})); +System.register(["./9b1def34.js"],(function(i){"use strict";var t,e,s,h,a,n,r,o,l;return{setters:[function(i){t=i.a,e=i.c,s=i.l,h=i._,a=i.f,n=i.g,r=i.d,o=i.K,l=i.p}],execute:function(){var _=function(){return t((function i(t){e(this,i),this._map=new Map,this._roundAverageSize=!1,this.totalSize=0,!0===(null==t?void 0:t.roundAverageSize)&&(this._roundAverageSize=!0)}),[{key:"set",value:function(i,t){var e=this._map.get(i)||0;this._map.set(i,t),this.totalSize+=t-e}},{key:"averageSize",get:function(){if(this._map.size>0){var i=this.totalSize/this._map.size;return this._roundAverageSize?Math.round(i):i}return 0}},{key:"getSize",value:function(i){return this._map.get(i)}},{key:"clear",value:function(){this._map.clear(),this.totalSize=0}}])}();function c(i){return"horizontal"===i?"width":"height"}var u=function(){return t((function i(t,s){var h=this;e(this,i),this._latestCoords={left:0,top:0},this._direction=null,this._viewportSize={width:0,height:0},this.totalScrollSize={width:0,height:0},this.offsetWithinScroller={left:0,top:0},this._pendingReflow=!1,this._pendingLayoutUpdate=!1,this._pin=null,this._firstVisible=0,this._lastVisible=0,this._physicalMin=0,this._physicalMax=0,this._first=-1,this._last=-1,this._sizeDim="height",this._secondarySizeDim="width",this._positionDim="top",this._secondaryPositionDim="left",this._scrollPosition=0,this._scrollError=0,this._items=[],this._scrollSize=1,this._overhang=1e3,this._hostSink=t,Promise.resolve().then((function(){return h.config=s||h._getDefaultConfig()}))}),[{key:"_getDefaultConfig",value:function(){return{direction:"vertical"}}},{key:"config",get:function(){return{direction:this.direction}},set:function(i){Object.assign(this,Object.assign({},this._getDefaultConfig(),i))}},{key:"items",get:function(){return this._items},set:function(i){this._setItems(i)}},{key:"_setItems",value:function(i){i!==this._items&&(this._items=i,this._scheduleReflow())}},{key:"direction",get:function(){return this._direction},set:function(i){(i="horizontal"===i?i:"vertical")!==this._direction&&(this._direction=i,this._sizeDim="horizontal"===i?"width":"height",this._secondarySizeDim="horizontal"===i?"height":"width",this._positionDim="horizontal"===i?"left":"top",this._secondaryPositionDim="horizontal"===i?"top":"left",this._triggerReflow())}},{key:"viewportSize",get:function(){return this._viewportSize},set:function(i){var t=this._viewDim1,e=this._viewDim2;Object.assign(this._viewportSize,i),e!==this._viewDim2?this._scheduleLayoutUpdate():t!==this._viewDim1&&this._checkThresholds()}},{key:"viewportScroll",get:function(){return this._latestCoords},set:function(i){Object.assign(this._latestCoords,i);var t=this._scrollPosition;this._scrollPosition=this._latestCoords[this._positionDim],Math.abs(t-this._scrollPosition)>=1&&this._checkThresholds()}},{key:"reflowIfNeeded",value:function(){(arguments.length>0&&void 0!==arguments[0]&&arguments[0]||this._pendingReflow)&&(this._pendingReflow=!1,this._reflow())}},{key:"pin",get:function(){if(null!==this._pin){var i=this._pin,t=i.index,e=i.block;return{index:Math.max(0,Math.min(t,this.items.length-1)),block:e}}return null},set:function(i){this._pin=i,this._triggerReflow()}},{key:"_clampScrollPosition",value:function(i){return Math.max(-this.offsetWithinScroller[this._positionDim],Math.min(i,this.totalScrollSize[c(this.direction)]-this._viewDim1))}},{key:"unpin",value:function(){null!==this._pin&&(this._sendUnpinnedMessage(),this._pin=null)}},{key:"_updateLayout",value:function(){}},{key:"_viewDim1",get:function(){return this._viewportSize[this._sizeDim]}},{key:"_viewDim2",get:function(){return this._viewportSize[this._secondarySizeDim]}},{key:"_scheduleReflow",value:function(){this._pendingReflow=!0}},{key:"_scheduleLayoutUpdate",value:function(){this._pendingLayoutUpdate=!0,this._scheduleReflow()}},{key:"_triggerReflow",value:function(){var i=this;this._scheduleLayoutUpdate(),Promise.resolve().then((function(){return i.reflowIfNeeded()}))}},{key:"_reflow",value:function(){this._pendingLayoutUpdate&&(this._updateLayout(),this._pendingLayoutUpdate=!1),this._updateScrollSize(),this._setPositionFromPin(),this._getActiveItems(),this._updateVisibleIndices(),this._sendStateChangedMessage()}},{key:"_setPositionFromPin",value:function(){if(null!==this.pin){var i=this._scrollPosition,t=this.pin,e=t.index,s=t.block;this._scrollPosition=this._calculateScrollIntoViewPosition({index:e,block:s||"start"})-this.offsetWithinScroller[this._positionDim],this._scrollError=i-this._scrollPosition}}},{key:"_calculateScrollIntoViewPosition",value:function(i){var t=i.block,e=Math.min(this.items.length,Math.max(0,i.index)),s=this._getItemPosition(e)[this._positionDim],h=s;if("start"!==t){var a=this._getItemSize(e)[this._sizeDim];if("center"===t)h=s-.5*this._viewDim1+.5*a;else{var n=s-this._viewDim1+a;if("end"===t)h=n;else{var r=this._scrollPosition;h=Math.abs(r-s)0||null!==this._pin)this._scheduleReflow();else{var i=Math.max(0,this._scrollPosition-this._overhang),t=Math.min(this._scrollSize,this._scrollPosition+this._viewDim1+this._overhang);this._physicalMin>i||this._physicalMaxthis._first&&Math.round(this._getItemPosition(e)[this._positionDim])>=Math.round(this._scrollPosition+this._viewDim1);)e--;t===this._firstVisible&&e===this._lastVisible||(this._firstVisible=t,this._lastVisible=e,i&&i.emit&&this._sendVisibilityChangedMessage())}}}])}();i("flow",(function(i){return Object.assign({type:d},i)}));function g(i){return"horizontal"===i?"marginLeft":"marginTop"}function f(i){return"horizontal"===i?"marginRight":"marginBottom"}function v(i,t){var e=[i,t].sort();return e[1]<=0?Math.min.apply(Math,l(e)):e[0]>=0?Math.max.apply(Math,l(e)):e[0]+e[1]}var m=function(){return t((function i(){e(this,i),this._childSizeCache=new _,this._marginSizeCache=new _,this._metricsCache=new Map}),[{key:"update",value:function(i,t){var e=this,s=new Set;Object.keys(i).forEach((function(h){var a=Number(h);e._metricsCache.set(a,i[a]),e._childSizeCache.set(a,i[a][c(t)]),s.add(a),s.add(a+1)}));var h,a=o(s);try{for(a.s();!(h=a.n()).done;){var n,r,l=h.value,_=(null===(n=this._metricsCache.get(l))||void 0===n?void 0:n[g(t)])||0,u=(null===(r=this._metricsCache.get(l-1))||void 0===r?void 0:r[f(t)])||0;this._marginSizeCache.set(l,v(_,u))}}catch(i){a.e(i)}finally{a.f()}}},{key:"averageChildSize",get:function(){return this._childSizeCache.averageSize}},{key:"totalChildSize",get:function(){return this._childSizeCache.totalSize}},{key:"averageMarginSize",get:function(){return this._marginSizeCache.averageSize}},{key:"totalMarginSize",get:function(){return this._marginSizeCache.totalSize}},{key:"getLeadingMarginValue",value:function(i,t){var e;return(null===(e=this._metricsCache.get(i))||void 0===e?void 0:e[g(t)])||0}},{key:"getChildSize",value:function(i){return this._childSizeCache.getSize(i)}},{key:"getMarginSize",value:function(i){return this._marginSizeCache.getSize(i)}},{key:"clear",value:function(){this._childSizeCache.clear(),this._marginSizeCache.clear(),this._metricsCache.clear()}}])}(),d=i("FlowLayout",function(i){function o(){var i;return e(this,o),(i=r(this,o,arguments))._itemSize={width:100,height:100},i._physicalItems=new Map,i._newPhysicalItems=new Map,i._metricsCache=new m,i._anchorIdx=null,i._anchorPos=null,i._stable=!0,i._measureChildren=!0,i._estimate=!0,i}return h(o,i),t(o,[{key:"measureChildren",get:function(){return this._measureChildren}},{key:"updateItemSizes",value:function(i){this._metricsCache.update(i,this.direction),this._scheduleReflow()}},{key:"_getPhysicalItem",value:function(i){var t;return null!==(t=this._newPhysicalItems.get(i))&&void 0!==t?t:this._physicalItems.get(i)}},{key:"_getSize",value:function(i){return this._getPhysicalItem(i)&&this._metricsCache.getChildSize(i)}},{key:"_getAverageSize",value:function(){return this._metricsCache.averageChildSize||this._itemSize[this._sizeDim]}},{key:"_estimatePosition",value:function(i){var t=this._metricsCache;if(-1===this._first||-1===this._last)return t.averageMarginSize+i*(t.averageMarginSize+this._getAverageSize());if(ithis._scrollSize-this._viewDim1?this.items.length-1:Math.max(0,Math.min(this.items.length-1,Math.floor((i+t)/2/this._delta)))}},{key:"_getAnchor",value:function(i,t){if(0===this._physicalItems.size)return this._calculateAnchor(i,t);if(this._first<0)return this._calculateAnchor(i,t);if(this._last<0)return this._calculateAnchor(i,t);var e=this._getPhysicalItem(this._first),s=this._getPhysicalItem(this._last),h=e.pos;if(s.pos+this._metricsCache.getChildSize(this._last)t)return this._calculateAnchor(i,t);for(var a=this._firstVisible-1,n=-1/0;nthis._scrollSize)this._clearItems();else{null!==this._anchorIdx&&null!==this._anchorPos||(this._anchorIdx=this._getAnchor(e,s),this._anchorPos=this._getPosition(this._anchorIdx));var n=this._getSize(this._anchorIdx);void 0===n&&(this._stable=!1,n=this._getAverageSize());var r=null!==(i=this._metricsCache.getMarginSize(this._anchorIdx))&&void 0!==i?i:this._metricsCache.averageMarginSize,o=null!==(t=this._metricsCache.getMarginSize(this._anchorIdx+1))&&void 0!==t?t:this._metricsCache.averageMarginSize;0===this._anchorIdx&&(this._anchorPos=r),this._anchorIdx===this.items.length-1&&(this._anchorPos=this._scrollSize-o-n);var l=0;for(this._anchorPos+n+os&&(l=s-(this._anchorPos-r)),l&&(this._scrollPosition-=l,e-=l,s-=l,this._scrollError+=l),h.set(this._anchorIdx,{pos:this._anchorPos,size:n}),this._first=this._last=this._anchorIdx,this._physicalMin=this._anchorPos-r,this._physicalMax=this._anchorPos+n+o;this._physicalMin>e&&this._first>0;){var _=this._getSize(--this._first);void 0===_&&(this._stable=!1,_=this._getAverageSize());var c=this._metricsCache.getMarginSize(this._first);void 0===c&&(this._stable=!1,c=this._metricsCache.averageMarginSize),this._physicalMin-=_;var u=this._physicalMin;if(h.set(this._first,{pos:u,size:_}),this._physicalMin-=c,!1===this._stable&&!1===this._estimate)break}for(;this._physicalMax=this._scrollSize?this._physicalMax-this._scrollSize+(this.items.length-1-this._last)*this._delta:0}},{key:"_reflow",value:function(){var i=this._first,t=this._last;a(n(o.prototype),"_reflow",this).call(this),(-1===this._first&&-1==this._last||this._first===i&&this._last===t)&&this._resetReflowState()}},{key:"_resetReflowState",value:function(){this._anchorIdx=null,this._anchorPos=null,this._stable=!0}},{key:"_updateScrollSize",value:function(){var i=this._metricsCache.averageMarginSize;this._scrollSize=Math.max(1,this.items.length*(i+this._getAverageSize())+i)}},{key:"_delta",get:function(){var i=this._metricsCache.averageMarginSize;return this._getAverageSize()+i}},{key:"_getItemPosition",value:function(i){var t;return s(s(s({},this._positionDim,this._getPosition(i)),this._secondaryPositionDim,0),"horizontal"===this.direction?"xOffset":"yOffset",-(null!==(t=this._metricsCache.getLeadingMarginValue(i,this.direction))&&void 0!==t?t:this._metricsCache.averageMarginSize))}},{key:"_getItemSize",value:function(i){return s(s({},this._sizeDim,this._getSize(i)||this._getAverageSize()),this._secondarySizeDim,this._itemSize[this._secondarySizeDim])}},{key:"_viewDim2Changed",value:function(){this._metricsCache.clear(),this._scheduleReflow()}}])}(u))}}})); diff --git a/storybook/e274078c.js b/storybook/1c35b766.js similarity index 98% rename from storybook/e274078c.js rename to storybook/1c35b766.js index 6592208c2..120512de4 100644 --- a/storybook/e274078c.js +++ b/storybook/1c35b766.js @@ -1 +1 @@ -System.register(["./bfad1b78.js"],(function(n){"use strict";var t,e,o,i,r,s,a,c,l,m;return{setters:[function(n){t=n._,e=n.a,o=n.i,i=n.b,r=n.x,s=n.f,a=n.g,c=n.s,l=n.c,m=n.d}],execute:function(){var u,p,g=n("ImageInspector",function(n){function c(){var n;return l(this,c),(n=m(this,c)).noLeft=!1,n.degrees=0,n.src="",n}return t(c,n),e(c,[{key:"render",value:function(){return r(u||(u=i(['\n
            \n \n \n \n \n \n \n \n \n
            \n \n \n '])),this.zoomIn,this.zoomOut,this.rotateRight,this.mirrorImage,this.src,this.src)}},{key:"firstUpdated",value:function(n){s(a(c.prototype),"firstUpdated",this)&&s(a(c.prototype),"firstUpdated",this).call(this,n),this.__img=this.shadowRoot.querySelector("#img")}},{key:"rotateRight",value:function(){this.degrees+=90,this.__img.style.transform="rotate("+this.degrees+"deg)",this.__img.classList.contains("top-rotated")?this.__img.classList.remove("top-rotated"):this.__img.classList.add("top-rotated")}},{key:"mirrorImage",value:function(){"scaleX(1)"===this.__img.style.transform?this.__img.style.transform="scaleX(-1)":this.__img.style.transform="scaleX(1)"}},{key:"zoomIn",value:function(){this.__img.zoomIn()}},{key:"zoomOut",value:function(){this.__img.zoomOut()}}],[{key:"styles",get:function(){return[o(p||(p=i(["\n :host {\n display: block;\n overflow: hidden;\n background-color: var(--image-inspector-background-color, #fdfdfd);\n }\n\n simple-icon-button {\n display: inline-flex;\n --simple-icon-width: 36px;\n --simple-icon-height: 36px;\n margin: 0 8px;\n background-color: var(--image-inspector-background-color, #fdfdfd);\n transition: 0.3s all ease-in-out;\n }\n simple-icon-button:hover,\n simple-icon-button:focus,\n simple-icon-button:active {\n background-color: var(\n --image-inspector-background-color-active,\n #eeeeee\n );\n }\n\n img-pan-zoom.top-rotated {\n top: 150px;\n pointer-events: none; /** disable pointer events when rotated bc of HTML canvas issue */\n height: var(--image-inspector-height-rotated, 600px);\n }\n img-pan-zoom {\n --img-pan-zoom-height: var(--image-inspector-height, 600px);\n }\n .wrap {\n border-bottom: 1px solid black;\n justify-content: center;\n display: flex;\n }\n "])))]}},{key:"tag",get:function(){return"image-inspector"}},{key:"properties",get:function(){return{noLeft:{type:Boolean,attribute:"no-left"},degrees:{type:Number,reflect:!0},src:{type:String},hoverClass:{type:String,attribute:"hover-class"}}}}])}(c));customElements.define(g.tag,g)}}})); +System.register(["./9b1def34.js"],(function(n){"use strict";var t,e,o,i,r,s,a,c,l,m;return{setters:[function(n){t=n._,e=n.a,o=n.i,i=n.b,r=n.x,s=n.f,a=n.g,c=n.s,l=n.c,m=n.d}],execute:function(){var u,p,g=n("ImageInspector",function(n){function c(){var n;return l(this,c),(n=m(this,c)).noLeft=!1,n.degrees=0,n.src="",n}return t(c,n),e(c,[{key:"render",value:function(){return r(u||(u=i(['\n
            \n \n \n \n \n \n \n \n \n
            \n \n \n '])),this.zoomIn,this.zoomOut,this.rotateRight,this.mirrorImage,this.src,this.src)}},{key:"firstUpdated",value:function(n){s(a(c.prototype),"firstUpdated",this)&&s(a(c.prototype),"firstUpdated",this).call(this,n),this.__img=this.shadowRoot.querySelector("#img")}},{key:"rotateRight",value:function(){this.degrees+=90,this.__img.style.transform="rotate("+this.degrees+"deg)",this.__img.classList.contains("top-rotated")?this.__img.classList.remove("top-rotated"):this.__img.classList.add("top-rotated")}},{key:"mirrorImage",value:function(){"scaleX(1)"===this.__img.style.transform?this.__img.style.transform="scaleX(-1)":this.__img.style.transform="scaleX(1)"}},{key:"zoomIn",value:function(){this.__img.zoomIn()}},{key:"zoomOut",value:function(){this.__img.zoomOut()}}],[{key:"styles",get:function(){return[o(p||(p=i(["\n :host {\n display: block;\n overflow: hidden;\n background-color: var(--image-inspector-background-color, #fdfdfd);\n }\n\n simple-icon-button {\n display: inline-flex;\n --simple-icon-width: 36px;\n --simple-icon-height: 36px;\n margin: 0 8px;\n background-color: var(--image-inspector-background-color, #fdfdfd);\n transition: 0.3s all ease-in-out;\n }\n simple-icon-button:hover,\n simple-icon-button:focus,\n simple-icon-button:active {\n background-color: var(\n --image-inspector-background-color-active,\n #eeeeee\n );\n }\n\n img-pan-zoom.top-rotated {\n top: 150px;\n pointer-events: none; /** disable pointer events when rotated bc of HTML canvas issue */\n height: var(--image-inspector-height-rotated, 600px);\n }\n img-pan-zoom {\n --img-pan-zoom-height: var(--image-inspector-height, 600px);\n }\n .wrap {\n border-bottom: 1px solid black;\n justify-content: center;\n display: flex;\n }\n "])))]}},{key:"tag",get:function(){return"image-inspector"}},{key:"properties",get:function(){return{noLeft:{type:Boolean,attribute:"no-left"},degrees:{type:Number,reflect:!0},src:{type:String},hoverClass:{type:String,attribute:"hover-class"}}}}])}(c));customElements.define(g.tag,g)}}})); diff --git a/storybook/6cd4bc62.js b/storybook/1edf074a.js similarity index 99% rename from storybook/6cd4bc62.js rename to storybook/1edf074a.js index 62b770a34..b389dc195 100644 --- a/storybook/6cd4bc62.js +++ b/storybook/1edf074a.js @@ -1 +1 @@ -System.register(["./bfad1b78.js","./171d7390.js"],(function(e){"use strict";var t,n,i,o,a,s,r,d,l,c,p,h,u,m,g,f,v,b,k,y,x,w,A;return{setters:[function(e){t=e._,n=e.a,i=e.i,o=e.b,a=e.N,s=e.x,r=e.as,d=e.a7,l=e.a4,c=e.b2,p=e.f,h=e.g,u=e.b3,m=e.V,g=e.s,f=e.c,v=e.d,b=e.o,k=e.t,y=e.j,x=e.k,w=e.p},function(e){A=e.H}],execute:function(){var I,T,C,L,D,_,P,E,O,M,N,S,U,H={url:new URL("./elements/outline-designer/outline-designer.js",document.baseURI).href},R=e("OutlineDesigner",function(e){function m(){var e;return f(this,m),(e=v(this,m))._blurBlock=!1,e.fidelity="medium",e.haxGizmos=[],e.hideDelete=!1,e.activeItemForActions=null,e.storeTools=!1,e.hideContentOps=!1,e.items=[],e.appReady=!1,e.eventData={},e.activeId=null,e.activePreview=null,e.activePreviewIndex=-1,e.t={selectTarget:"Select target",importContentUnderThisPage:"Import content under this page",importThisContent:"Import this content",thisPage:"this page",newPage:"New page",copyOf:"Copy of"},e.registerLocalization({context:e,basePath:H.url,locales:["es"]}),b((function(){e.activeId=k(a.activeId)})),b((function(){e.appReady=k(a.appReady)})),b((function(){e.haxGizmos=k(A.gizmoList).filter((function(e){return!!(e&&e.meta&&e.meta.outlineDesigner)}))})),e.addEventListener("click",e.resetPopOver.bind(e)),e}return t(m,e),n(m,[{key:"resetPopOver",value:function(){this.activePreview&&(this.shadowRoot.querySelector("simple-popover").setAttribute("hidden","hidden"),this.activePreview=null,this.activePreviewIndex=-1)}},{key:"getSiteItems",value:function(){var e=[{text:this.t.selectTarget,value:null}];if(this.appReady&&this.items.length>0){var t=a.getManifestItems(!0);t.forEach((function(n){for(var i=n,o="- ";i&&null!=i.parent;)i=t.find((function(e){return e.id==i.parent})),i&&(o="--"+o);e.push({text:o+n.title,value:n.id})}))}return e}},{key:"render",value:function(){var e=this;return s(I||(I=o(['
            \n ','\n Add page\n Collapse all\n Expand all\n ','\n
            \n
              \n ','\n
            \n "])),this.storeTools?s(T||(T=o(['\n \n \n ',':\n \n
            \n
            \n ',"\n
            \n \n ","\n "])),this._dragEnter,this._dragLeave,this.setActiveItemForActions,e.indent<20?e.indent:20,e.modified?"modified":"",this.getItemParentsCollapsed(e),e.id,this.setActiveItemForActions,this.getItemParents(e),this.hasChildren(e.id),e.delete,this.hideDelete&&e.delete,this.isLocked(t),this.isCollapsed(e.id)?"hardware:keyboard-arrow-right":"hardware:keyboard-arrow-down",this.collapseExpand,this.isLocked(t),this._dragStart,this._dragEnd,!this.isLocked(t),this.isLocked(t),this.hideContentOps||""===e.contents||!e.contents,this.toggleContent,e.new?s(_||(_=o([''])),this.isLocked(t),this.t.newPage):"",this.isLocked(t),this.editTitle,e.title,this.blurTitle,this.monitorTitle,this.monitorEsc,this.activeItemForActions===e.id?s(P||(P=o(['\n \n \n \n \n \n \n \n \n \n '])),this.isLocked(t)?"icons:lock":"icons:lock-open",(function(e){return n.itemOp(t,"lock")}),(function(e){return n.itemOp(t,"out")}),this.isLocked(t),(function(e){return n.itemOp(t,"up")}),this.isLocked(t),(function(e){return n.itemOp(t,"down")}),this.isLocked(t),(function(e){return n.itemOp(t,"in")}),this.isLocked(t),(function(e){return n.itemOp(t,"add")}),this.isLocked(t),(function(e){return n.itemOp(t,"duplicate")}),this.isLocked(t),e.delete?"hax:delete-restore":"delete",(function(e){return n.itemOp(t,"delete")}),e.delete?"Restore":"Delete",this.isLocked(t),(function(e){return n.itemOp(t,"goto")})):"",!this.hideContentOps&&e.showContent?this.renderItemContents(e):"")}},{key:"hasContents",value:function(e){return!(!e.contents||""==e.contents)}},{key:"renderItemContents",value:function(e){var t=this,n=[this.itemContentsOperations(e)];if(e.contents){var i=document.createElement("div");i.innerHTML=e.contents;var o=1,a=0;i.childNodes.forEach((function(i,s){a=0,["h1","h2","h3","h4","h5","h6"].includes(i.tagName.toLowerCase())&&(o=parseInt(i.tagName.toLowerCase().replace("h","")),a=-1),n.push(t.renderNodeAsItem(i,s,e,parseInt(e.indent)+o+a))}))}return n}},{key:"itemContentsOperations",value:function(e){var t=this;return s(E||(E=o([' \n ',"\n "])),e.indent<20?e.indent:20,e.id,!e.showContent,e.delete,this.hideDelete&&e.delete,this.haxGizmos.map((function(e){return s(O||(O=o(['\n Add ',"\n "])),e.icon,e.tag,t.prependNodeToContent,e.title)})))}},{key:"prependNodeToContent",value:function(e){var t=this,n=e.target.closest("[data-item-for-content-id]").getAttribute("data-item-for-content-id");this.items.map((function(i,o){if(i.id===n&&e.target.value){var a,s=A.haxSchemaFromTag(e.target.value);a=s.gizmo&&s.gizmo.tag&&s.demoSchema&&s.demoSchema[0]?l(s.demoSchema[0]):document.createElement(tag),t.items[o].contents=a.outerHTML+i.contents,t.resetPopOver(),t.__syncUIAndDataModel()}}))}},{key:"renderNodeAsItem",value:function(e,t,n,i){var a=this,r=e.tagName.toLowerCase(),d="hax:bricks",l=r,c="non-heading",p=A.haxSchemaFromTag(r);if(p&&p.gizmo)switch(d=p.gizmo.icon,l=p.gizmo.title,r){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":l=e.innerText,c="heading"}return s(M||(M=o([' \n \n ','\n
            \n \n \n \n \n \n \n
            \n '])),c,i<20?i:20,t,n.id,!n.showContent,n.delete,this.hideDelete&&n.delete,d,this.setActivePreview,"heading"===c?s(N||(N=o(['\n ','\n \n '])),n.metadata.locked,this.editTitle,l,this.monitorHeading,this.monitorEsc):s(S||(S=o(['',""])),l),(function(e){return a.modifyContentAction(e,n,"in")}),"h1"===r||n.metadata.locked,"heading"!==c,(function(e){return a.modifyContentAction(e,n,"up")}),n.metadata.locked,(function(e){return a.modifyContentAction(e,n,"down")}),n.metadata.locked,(function(e){return a.modifyContentAction(e,n,"out")}),"h6"===r||n.metadata.locked,"heading"!==c,(function(e){return a.pageBreakHere(e,n)}),n.metadata.locked,"heading"!==c,(function(e){return a.modifyContentAction(e,n,"delete")}),n.metadata.locked)}},{key:"setActivePreview",value:function(e){var t=e.target.closest("[data-content-parent-id]"),n=parseInt(t.getAttribute("data-node-index"));this.activePreview=t,this.shadowRoot.querySelector("simple-popover").removeAttribute("hidden"),this.shadowRoot.querySelector("simple-popover").target=t,this.activePreviewIndex=n,e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()}},{key:"modifyContentAction",value:function(e,t,n){if(!t.metadata.locked){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();var i=e.target.closest("[data-content-parent-id]"),o=i.getAttribute("data-content-parent-id"),a=parseInt(i.getAttribute("data-node-index")),s=this.items.find((function(e){return e.id===o}));if(s.contents){var r=document.createElement("div");r.innerHTML=s.contents;var d="";switch(n){case"up":0!==a&&r.childNodes[a].previousElementSibling.insertAdjacentElement("beforebegin",r.childNodes[a]);break;case"down":a!==r.childNodes.length-1&&r.childNodes[a].nextElementSibling.insertAdjacentElement("afterend",r.childNodes[a])}for(var l=0;l1?(h=document.createElement("h".concat(p-1))).innerText=c.innerText:"out"===n&&p<6?(h=document.createElement("h".concat(p+1))).innerText=c.innerText:h=c,d+=h.outerHTML}else d+=c.outerHTML}s.contents=d,this.resetPopOver(),this.__syncUIAndDataModel()}}}},{key:"pageBreakHere",value:function(e,t){if(!t.metadata.locked){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();var n,i=e.target.closest("[data-content-parent-id]"),o=i.getAttribute("data-content-parent-id"),a=parseInt(i.getAttribute("data-node-index")),s=this.items.find((function(e){return e.id===o}));if(this.items.map((function(e,t){return e.id===o?n=t:null})),s.contents){var r=document.createElement("div");r.innerHTML=s.contents;for(var d="",l="",p=this.t.newPage,h=0;h1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=1;"top"===e&&(e=0,o=-1);var a={indent:0,parent:null,order:0};this.items&&this.items.length>0&&this.items[e]&&(a=this.items[e]);var s=new c;if(s.order=a.order+o,s.parent=a.parent,s.indent=a.indent,s.metadata.locked=!1,s.new=!0,n?(s.title="".concat(this.t.copyOf," ").concat(a.title),s.contents=a.contents,s.duplicate=a.id):s.contents="

            ",i.push(s),this.items&&this.items.length>0&&this.items[e]&&this.hasChildren(this.items[e].id)&&n){var r={};r[this.items[e].id]=s.id,i=this.recurseCopyChildren(this.items[e].id,r,i)}this.items&&this.items.length>0?i.forEach((function(n,i){return t.items.splice(e+i+1,0,n)})):i.forEach((function(e){return t.items.push(e)}))}},{key:"recurseCopyChildren",value:function(e,t,n){for(var i=this.items.filter((function(t){return t.parent==e})),o=0;o2&&void 0!==arguments[2])||arguments[2],o=this.items.filter((function(t){return t.parent==e})),a=function(e){n.items.map((function(a,s){if(a.id===o[e].id)switch(t){case"delete":n.items[s].delete=i;break;case"lock":n.items[s].metadata.locked=i}})),n.hasChildren(o[e].id)&&n.recurseAction(o[e].id,t,i)},s=0;st.order?1:0}));var d=null;if(r.map((function(e,n){"up"===t&&n>0&&e.id===s.id?d=r[n-1]:"down"===t&&n0&&void 0!==arguments[0]?arguments[0]:{id:null},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.items.map((function(i,o){i.parent==t.id&&(e.items[o].indent=n,e._recurseUpdateIndent(e.items[o],n+1))}))}},{key:"_schemaOrderUpdate",value:function(){var e=new u,t=e.itemsToNodes(this.items),n=e.nodesToItems(t),i=[];for(var o in n){var a=this.items.find((function(e){return e.id===n[o].id}));a&&(delete a.children,i.push(a))}this.items=i}}],[{key:"styles",get:function(){return[i(U||(U=o(['\n :host {\n display: block;\n font-family: var(--ddd-font-navigation);\n }\n simple-icon-button[hidden] {\n visibility: hidden !important;\n opacity: 0;\n pointer-events: none;\n padding: 0;\n margin: 0;\n height: 0;\n border: 0;\n }\n .controls {\n position: sticky;\n top: -32px;\n background-color: white;\n z-index: 1;\n padding: 16px 0 8px 0;\n }\n .controls .control {\n border: 1px solid black;\n border-radius: 0;\n padding: 4px;\n }\n simple-popover {\n --simple-popover-max-height: 300px;\n }\n simple-popover *:not(.close-btn) {\n max-width: 40vw;\n }\n simple-popover::part(simple-popover-content) {\n overflow: auto;\n }\n .close-btn {\n z-index: 1000;\n background-color: white;\n border: 0px;\n border-radius: 50%;\n position: absolute;\n top: 24px;\n right: 0;\n }\n .container {\n text-align: left;\n }\n ul {\n list-style: none;\n padding: 0;\n margin: 0;\n }\n ul li {\n margin: 0;\n padding: 0;\n }\n .operation {\n display: inline-flex;\n --simple-icon-width: 24px;\n --simple-icon-height: 24px;\n margin: 0 4px;\n }\n .content-adding-operations .operation {\n display: inline-flex;\n --simple-icon-width: 24px;\n --simple-icon-height: 24px;\n margin: 0 4px;\n border: 1px solid black;\n border-radius: 0;\n padding: 4px;\n }\n .lock {\n margin-right: 16px !important;\n visibility: var(--outline-designer-lock-visibility);\n }\n .del {\n margin-left: 32px !important;\n }\n .goto {\n margin-left: 32px !important;\n }\n .add {\n margin-left: 16px !important;\n }\n li .operations {\n justify-content: space-evenly;\n display: flex;\n }\n .content-operation {\n display: inline-flex;\n opacity: 0;\n visibility: hidden;\n --simple-icon-width: 24px;\n --simple-icon-height: 24px;\n margin: 0 4px;\n }\n .content-operations {\n justify-content: space-evenly;\n display: flex;\n }\n li.content-child:hover .content-operation {\n visibility: visible;\n opacity: 1;\n }\n li[class*="collapsed-by-"] {\n opacity: 0;\n height: 0px !important;\n visibility: hidden;\n padding: 0px !important;\n margin: 0px !important;\n width: 0px !important;\n padding: 0px !important;\n margin: 0px !important;\n border: 0px !important;\n pointer-events: none;\n z-index: -1;\n }\n /* content not rendered if hidden but in case we change that */\n li[data-contents-collapsed] {\n opacity: 0;\n height: 0px !important;\n visibility: hidden;\n padding: 0px !important;\n margin: 0px !important;\n width: 0px !important;\n padding: 0px !important;\n margin: 0px !important;\n border: 0px !important;\n pointer-events: none;\n z-index: -1;\n }\n li simple-icon-button:hover {\n background-color: #f5f5f5;\n }\n .active-preview-item {\n outline: 1px solid grey;\n outline-offset: -1px;\n }\n .label,\n .label-edit {\n display: none;\n }\n span[disabled].label {\n pointer-events: none;\n opacity: 0.6;\n }\n .shown {\n display: inline-block;\n }\n .outline-designer-hovered {\n outline: 2px solid black;\n outline-offset: -1px;\n background-color: #e5e5e5;\n }\n .make-child-btn {\n transition: 0.3s all ease-in-out;\n visibility: hidden;\n opacity: 0;\n }\n .outline-designer-hovered .make-child-btn {\n visibility: visible;\n opacity: 0.6;\n }\n .outline-designer-hovered .make-child-btn:hover {\n opacity: 1;\n }\n .modified .label::after {\n content: "*";\n color: red;\n font-size: 20px;\n line-height: 20px;\n }\n .new {\n --simple-icon-width: 16px;\n --simple-icon-height: 16px;\n background-color: black;\n display: block;\n margin: -14px 0 0 4px;\n }\n :host([stop-animation]) .item {\n transition: none !important;\n }\n .item {\n display: -webkit-box;\n border: 1px solid;\n border-color: grey;\n margin: 0;\n padding: 4px;\n cursor: pointer;\n opacity: 1;\n visibility: visible;\n height: 42px;\n transition:\n 0.3s padding ease-in-out,\n 0.3s border ease-in-out,\n 0.3s margin ease-in-out;\n overflow: hidden;\n align-items: center;\n justify-content: left;\n display: flex;\n }\n .collapse-btn {\n visibility: hidden;\n }\n .item[data-has-children] .collapse-btn {\n visibility: visible;\n }\n .item[data-about-to-delete] {\n background-color: #ffa5a5;\n opacity: 0.5;\n border-color: red;\n }\n .item[data-about-to-delete][hidden] {\n visibility: hidden !important;\n opacity: 0 !important;\n padding: 0;\n margin: 0;\n height: 0;\n border: 0;\n }\n .item:hover,\n .item:focus {\n background-color: #f5f5f5;\n }\n ul {\n list-style: none;\n }\n .item .label-edit,\n .item .label {\n cursor: text;\n font-size: 14px;\n font-weight: bold;\n min-width: 200px;\n margin-right: 8px;\n max-width: 40%;\n line-height: 1.2;\n padding: 0 4px;\n }\n\n .content-child {\n margin-left: 46px;\n padding: 8px;\n height: 24px;\n border-top: none;\n border-bottom: none;\n }\n .content-heading,\n .content-non-heading {\n margin-left: 32px;\n }\n .indent-0 {\n padding-left: 0;\n }\n .indent-1 {\n padding-left: 16px;\n }\n .indent-2 {\n padding-left: calc(16px * 2);\n }\n .indent-3 {\n padding-left: calc(16px * 3);\n }\n .indent-4 {\n padding-left: calc(16px * 4);\n }\n .indent-5 {\n padding-left: calc(16px * 5);\n }\n .indent-6 {\n padding-left: calc(16px * 6);\n }\n .indent-7 {\n padding-left: calc(16px * 7);\n }\n .indent-8 {\n padding-left: calc(16px * 8);\n }\n .indent-9 {\n padding-left: calc(16px * 9);\n }\n .indent-10 {\n padding-left: calc(16px * 10);\n }\n .indent-11 {\n padding-left: calc(16px * 11);\n }\n .indent-12 {\n padding-left: calc(16px * 12);\n }\n .indent-13 {\n padding-left: calc(16px * 13);\n }\n .indent-14 {\n padding-left: calc(16px * 14);\n }\n .indent-15 {\n padding-left: calc(16px * 15);\n }\n .indent-16 {\n padding-left: calc(16px * 16);\n }\n .indent-17 {\n padding-left: calc(16px * 17);\n }\n .indent-18 {\n padding-left: calc(16px * 18);\n }\n .indent-19 {\n padding-left: calc(16px * 19);\n }\n .indent-20 {\n padding-left: calc(16px * 20);\n }\n '])))]}},{key:"properties",get:function(){return{haxGizmos:{type:Array},hideDelete:{type:Boolean},activeItemForActions:{type:String},storeTools:{type:Boolean},eventData:{type:Object},items:{type:Array},appReady:{type:Boolean},activePreview:{type:Object},activePreviewIndex:{type:Number},hideContentOps:{type:Boolean,reflect:!0,attribute:"hide-content-ops"},fidelity:{type:String}}}},{key:"tag",get:function(){return"outline-designer"}}]);var g}(m(g)));customElements.define(R.tag,R)}}})); +System.register(["./9b1def34.js","./bb87ce08.js"],(function(e){"use strict";var t,n,i,o,a,s,r,d,l,c,p,h,u,m,g,f,v,b,k,y,x,w,A;return{setters:[function(e){t=e._,n=e.a,i=e.i,o=e.b,a=e.N,s=e.x,r=e.as,d=e.a7,l=e.a4,c=e.b2,p=e.f,h=e.g,u=e.b3,m=e.V,g=e.s,f=e.c,v=e.d,b=e.o,k=e.t,y=e.j,x=e.k,w=e.p},function(e){A=e.H}],execute:function(){var I,T,C,L,D,_,P,E,O,M,N,S,U,H={url:new URL("./elements/outline-designer/outline-designer.js",document.baseURI).href},R=e("OutlineDesigner",function(e){function m(){var e;return f(this,m),(e=v(this,m))._blurBlock=!1,e.fidelity="medium",e.haxGizmos=[],e.hideDelete=!1,e.activeItemForActions=null,e.storeTools=!1,e.hideContentOps=!1,e.items=[],e.appReady=!1,e.eventData={},e.activeId=null,e.activePreview=null,e.activePreviewIndex=-1,e.t={selectTarget:"Select target",importContentUnderThisPage:"Import content under this page",importThisContent:"Import this content",thisPage:"this page",newPage:"New page",copyOf:"Copy of"},e.registerLocalization({context:e,basePath:H.url,locales:["es"]}),b((function(){e.activeId=k(a.activeId)})),b((function(){e.appReady=k(a.appReady)})),b((function(){e.haxGizmos=k(A.gizmoList).filter((function(e){return!!(e&&e.meta&&e.meta.outlineDesigner)}))})),e.addEventListener("click",e.resetPopOver.bind(e)),e}return t(m,e),n(m,[{key:"resetPopOver",value:function(){this.activePreview&&(this.shadowRoot.querySelector("simple-popover").setAttribute("hidden","hidden"),this.activePreview=null,this.activePreviewIndex=-1)}},{key:"getSiteItems",value:function(){var e=[{text:this.t.selectTarget,value:null}];if(this.appReady&&this.items.length>0){var t=a.getManifestItems(!0);t.forEach((function(n){for(var i=n,o="- ";i&&null!=i.parent;)i=t.find((function(e){return e.id==i.parent})),i&&(o="--"+o);e.push({text:o+n.title,value:n.id})}))}return e}},{key:"render",value:function(){var e=this;return s(I||(I=o(['
            \n ','\n Add page\n Collapse all\n Expand all\n ','\n
            \n
              \n ','\n
            \n "])),this.storeTools?s(T||(T=o(['\n \n \n ',':\n \n