@innovastudio/contentbuilder 1.5.182 → 1.5.183
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts
CHANGED
|
@@ -228,6 +228,12 @@ interface ContentBuilderOptions {
|
|
|
228
228
|
imageModel?: string;
|
|
229
229
|
imageSize?: string;
|
|
230
230
|
imageGenerationModels?: any[];
|
|
231
|
+
imageModels?: any[];
|
|
232
|
+
codeModels?: any[];
|
|
233
|
+
chatModels?: any[];
|
|
234
|
+
systemModel: string;
|
|
235
|
+
clearChatSettings?: boolean;
|
|
236
|
+
defaultChatSettings?: Record<string, any>;
|
|
231
237
|
|
|
232
238
|
//-- Asset Manager
|
|
233
239
|
listFilesUrl?: string;
|
package/package.json
CHANGED
|
@@ -17325,19 +17325,18 @@ class Draggable$2 {
|
|
|
17325
17325
|
});
|
|
17326
17326
|
}
|
|
17327
17327
|
dragStart(e) {
|
|
17328
|
-
|
|
17329
|
-
|
|
17328
|
+
// Find the draggable element (could be target or a parent)
|
|
17329
|
+
const draggableElement = e.target.closest('[draggable]');
|
|
17330
|
+
if (!draggableElement) return;
|
|
17330
17331
|
if (e.type === 'touchstart' && e.touches.length !== 1) {
|
|
17331
|
-
return;
|
|
17332
|
+
return;
|
|
17332
17333
|
}
|
|
17333
|
-
|
|
17334
17334
|
if (e.type === 'mousedown' && e.button !== 0) {
|
|
17335
|
-
return;
|
|
17335
|
+
return;
|
|
17336
17336
|
}
|
|
17337
|
-
|
|
17338
|
-
e.target.parentNode.style.transition = 'none';
|
|
17337
|
+
draggableElement.parentNode.style.transition = 'none';
|
|
17339
17338
|
this.dragActive = true;
|
|
17340
|
-
this.activeDraggableBox =
|
|
17339
|
+
this.activeDraggableBox = draggableElement.parentElement;
|
|
17341
17340
|
let xOffset;
|
|
17342
17341
|
let yOffset;
|
|
17343
17342
|
if (!this.activeDraggableBox.getAttribute('data-xOffset')) {
|
|
@@ -17366,10 +17365,10 @@ class Draggable$2 {
|
|
|
17366
17365
|
document.addEventListener('mousemove', this.drag, false);
|
|
17367
17366
|
}
|
|
17368
17367
|
dragEnd(e) {
|
|
17369
|
-
|
|
17370
|
-
|
|
17368
|
+
const draggableElement = e.target.closest('[draggable]');
|
|
17369
|
+
if (!draggableElement) return;
|
|
17371
17370
|
if (!this.activeDraggableBox) return;
|
|
17372
|
-
|
|
17371
|
+
draggableElement.parentNode.style.transition = '';
|
|
17373
17372
|
|
|
17374
17373
|
//Update
|
|
17375
17374
|
let currentX = this.activeDraggableBox.getAttribute('data-currentX');
|
|
@@ -16,7 +16,7 @@ var ContentBuilder=function(){"use strict";class t{constructor(t){this.builder=t
|
|
|
16
16
|
License: MIT
|
|
17
17
|
Copyright (c) 2020 Paweł Kuna
|
|
18
18
|
https://github.com/tabler/tabler-icons
|
|
19
|
-
*/class Ro{constructor(t){this.builder=t;const e=this.builder.util,i=this.builder.builderStuff;this.util=e,this.builderStuff=i;const n=this.builder.dom;this.dom=n,this.rowTool=new Oo(t)}moveColumnPrevious(){const t=this.util.cellSelected();t&&t.previousElementSibling&&(this.builder.uo.saveForUndo(),this.builder.hideTools(),t.parentElement.insertBefore(t,t.previousElementSibling),this.builder.opts.onChange(!0),this.builder.win.builderRuntime&&this.builder.win.builderRuntime.reinitialize(t))}moveColumnNext(){let t=this.util;const e=t.cellSelected();if(!e)return;const i=t.cellNext(e);i&&(this.builder.uo.saveForUndo(),this.builder.hideTools(),e.parentElement.insertBefore(i,e),this.builder.opts.onChange(!0),this.builder.win.builderRuntime&&this.builder.win.builderRuntime.reinitialize(e))}moveColumnUp(){let t=this.builder,e=this.util;const i=e.cellSelected();if(!i)return;let n=i.parentNode,o=3;if(n.querySelector(".is-row-overlay")&&(o=4),n.childElementCount-o==1){if(!n.previousElementSibling)return;{let e=4;if(this.builder.maxColumns&&(e=this.builder.maxColumns),n.previousElementSibling.childElementCount>=e+o||n.previousElementSibling.hasAttribute("data-protected"))return this.builder.uo.saveForUndo(),this.builder.hideTools(),n.parentNode.insertBefore(n,n.previousElementSibling),this.builder.opts.onChange(!0),void(this.builder.win.builderRuntime&&this.builder.win.builderRuntime.reinitialize(n));{this.builder.uo.saveForUndo(),this.builder.hideTools();let e=n.previousElementSibling.querySelector(".is-row-tool");n.previousElementSibling.removeChild(e),e=n.previousElementSibling.querySelector(".is-rowadd-tool"),n.previousElementSibling.removeChild(e),e=n.previousElementSibling.querySelector(".is-col-tool"),n.previousElementSibling.removeChild(e),n.previousElementSibling.appendChild(i),n.parentNode.removeChild(n);let o=this.builder.doc.querySelector(".builder-active");t.applyBehaviorOn(o),setTimeout((()=>{i.click()}),30),this.builder.opts.onChange(!0)}}}else{this.builder.uo.saveForUndo(),this.builder.hideTools();var s=n.cloneNode(!0);s.innerHTML="",s.appendChild(i),n.parentNode.insertBefore(s,n);let e=this.builder.doc.querySelector(".builder-active");t.applyBehaviorOn(e),setTimeout((()=>{i.click()}),30),this.builder.opts.onChange(!0)}n=i.parentNode,e.fixLayout(n),n.nextElementSibling&&e.fixLayout(n.nextElementSibling),this.builder.win.builderRuntime&&this.builder.win.builderRuntime.reinitialize(n)}moveColumnDown(){let t=this.builder,e=this.util,i=this.dom;const n=e.cellSelected();if(!n)return;let o=n.parentNode,s=3;if(o.querySelector(".is-row-overlay")&&(s=4),o.childElementCount-s==1){if(!o.nextElementSibling)return;{let e=4;if(this.builder.maxColumns&&(e=this.builder.maxColumns),o.nextElementSibling.childElementCount>=e+s||o.nextElementSibling.hasAttribute("data-protected"))return this.builder.uo.saveForUndo(),this.builder.hideTools(),o.parentNode.insertBefore(o.nextElementSibling,o),this.builder.opts.onChange(!0),void(this.builder.win.builderRuntime&&this.builder.win.builderRuntime.reinitialize(o));{this.builder.uo.saveForUndo(),this.builder.hideTools();let e=o.nextElementSibling.querySelector(".is-row-tool");o.nextElementSibling.removeChild(e),e=o.nextElementSibling.querySelector(".is-rowadd-tool"),o.nextElementSibling.removeChild(e),e=o.nextElementSibling.querySelector(".is-col-tool"),o.nextElementSibling.removeChild(e),o.nextElementSibling.appendChild(n),o.parentNode.removeChild(o);let i=this.builder.doc.querySelector(".builder-active");t.applyBehaviorOn(i),setTimeout((()=>{n.click()}),30),this.builder.opts.onChange(!0)}}}else{this.builder.uo.saveForUndo(),this.builder.hideTools();var l=o.cloneNode(!0);l.innerHTML="",l.appendChild(n),i.moveAfter(l,o);let e=this.builder.doc.querySelector(".builder-active");t.applyBehaviorOn(e),setTimeout((()=>{n.click()}),30),this.builder.opts.onChange(!0)}o=n.parentNode,e.fixLayout(o),o.previousElementSibling&&e.fixLayout(o.previousElementSibling),this.builder.win.builderRuntime&&this.builder.win.builderRuntime.reinitialize(o)}duplicateColumn(){let t=this.builder,e=this.util,i=this.dom;const n=e.cellSelected();if(!n)return;this.builder.uo.saveForUndo();var o=n.cloneNode(!0);i.removeClass(o,"cell-active"),o.removeAttribute("data-click"),this.builder.opts.enableDragResize&&(n.style.width="",n.style.flex="");let s=n.parentNode,l=3;s.querySelector(".is-row-overlay")&&(l=4);let a=4;if(this.builder.maxColumns&&(a=this.builder.maxColumns),s.childElementCount>=a+l)return alert(e.out("You have reached the maximum number of columns")),!1;s.insertBefore(o,n),e.fixLayout(s);let r=this.builder.doc.querySelector(".builder-active");t.applyBehaviorOn(r),setTimeout((()=>{n.click()}),30),this.builder.opts.onChange(),this.builder.win.builderRuntime&&this.builder.win.builderRuntime.reinitialize(o),this.builder.makeSortable(o)}removeColumn(){let t=this.util;const e=t.cellSelected();if(!e)return;let i=e.parentNode,n=3;i.querySelector(".is-row-overlay")&&(n=4),t.confirm(t.out("Are you sure you want to delete this block?"),(o=>{o&&(this.builder.uo.saveForUndo(),i.childElementCount-n==1?(i.parentNode.removeChild(i),t.checkEmpty()):(i.removeChild(e),t.fixLayout(i)),t.clearActiveCell(),this.builder.opts.onChange())}))}removeColClasses(t){t.classList.remove("full"),t.classList.remove("two-third"),t.classList.remove("two-fourth"),t.classList.remove("two-fifth"),t.classList.remove("two-sixth"),t.classList.remove("half"),t.classList.remove("third"),t.classList.remove("fourth"),t.classList.remove("fifth"),t.classList.remove("sixth"),t.classList.remove("seventh"),t.classList.remove("eighth"),t.classList.remove("ninth"),t.classList.remove("tenth"),t.classList.remove("eleventh"),t.classList.remove("twelfth")}getAllColumns(t){let e=[],i=this.dom;i.elementChildren(t.parentNode).forEach((n=>{i.hasClass(n,"is-row-tool")||i.hasClass(n,"is-col-tool")||i.hasClass(n,"is-rowadd-tool")||i.hasClass(n,"is-row-overlay")||t!==n&&e.push(n)}));return[t].concat(e)}getCellWidth(t){return t.classList.contains("two-third")?66.666:t.classList.contains("two-fourth")?75:t.classList.contains("two-fifth")?80:t.classList.contains("two-sixth")?83.333:t.classList.contains("half")?50:t.classList.contains("third")?33.333:t.classList.contains("fourth")?25:t.classList.contains("fifth")?20:t.classList.contains("sixth")?16.666:t.classList.contains("seventh")?14.2857:t.classList.contains("eighth")?12.5:t.classList.contains("ninth")?11.111:t.classList.contains("tenth")?10:t.classList.contains("eleventh")?9.09:!!t.classList.contains("twelfth")&&8.333}resizeColumn(t,e,i){let n=this.getCellWidth(t);if(!n){n=parseFloat(window.getComputedStyle(t).getPropertyValue("width"))/parseFloat(window.getComputedStyle(t.parentNode).getPropertyValue("width"))*100}if(e){if(3===i){if(n>=28&&n<=30)return"33.333%";if(n>30&&n<38)return"40%";if(n>=68&&n<=90)return"75%"}if(4===i&&n>=48&&n<=90)return"60%";if(5===i&&n>=38&&n<=90)return"50%";if(6===i){if(n>=10&&n<13)return"16.666%";if(n>=28&&n<=90)return"40%"}if(7===i&&n>=23&&n<=90)return"30%";if(8===i&&n>=13&&n<=90)return"20%";if(n>=78&&n<=90)return"90%";if(n>=73&&n<78)return"80%";if(n>=68&&n<73)return"75%";if(n>=58&&n<68)return"70%";if(n>=48&&n<58)return"60%";if(n>=38&&n<48)return"50%";if(n>=28&&n<38)return"40%";if(n>=23&&n<28)return"30%";if(n>=18&&n<23)return"25%";if(n>=13&&n<18)return"20%";if(n>=10&&n<13)return"15%"}else{if(3===i){if(n>35&&n<=43)return"33.333%";if(n>33&&n<=35)return"30%"}if(6===i&&n>18&&n<=23)return"16.666%";if(n>93&&n<=100)return"90%";if(n>83&&n<=93)return"80%";if(n>78&&n<=83)return"75%";if(n>73&&n<=78)return"70%";if(n>63&&n<=73)return"60%";if(n>53&&n<=63)return"50%";if(n>43&&n<=53)return"40%";if(n>33&&n<=43)return"30%";if(n>28&&n<=33)return"25%";if(n>23&&n<=28)return"20%";if(n>18&&n<=23)return"15%";if(n>=10&&n<=18)return"10%"}return!1}increaseColumn(){let t,e,i=this.builder,n=this.util,o=this.dom,s=n.cellSelected();if(!s)return;if(this.builder.useDefaultGrid){let t=this.getAllColumns(s);if(t.length>1&&t.length<9){this.builder.uo.saveForUndo();let e=this.resizeColumn(s,!0,t.length);if(e){s.style.width=e,s.style.flex="0 0 auto",this.removeColClasses(s);for(let i=1;i<t.length;i++){let n=t[i];n!==s&&(n.getAttribute("data-html")?2===t.length&&(n.style.width=100-parseFloat(e)+"%",n.style.flex="0 0 auto"):(n.style.width="",n.style.flex=""),this.removeColClasses(n))}}this.builder.opts.onChange()}return}let l=this.getAllColumns(s);l[1]&&(t=l[1]),l[2]&&(e=l[2]);const a=i.opts.row;let r=i.opts.cols;const c=i.opts.colsizes;if(""!==a&&r.length>0&&c.length>0){if(e)for(let i=0;i<c.length;i++){let n=c[i];for(let i=0;i<n.length;i++)if(3===n[i].length&&o.hasClass(s,n[i][0])&&o.hasClass(t,n[i][1])&&o.hasClass(e,n[i][2])&&i+1!==n.length)return this.builder.uo.saveForUndo(),o.removeClass(s,n[i][0]),o.removeClass(t,n[i][1]),o.removeClass(e,n[i][2]),o.addClass(s,n[i+1][0]),o.addClass(t,n[i+1][1]),o.addClass(e,n[i+1][2]),void this.builder.opts.onChange()}for(let e=0;e<c.length;e++){let i=c[e];for(let e=0;e<i.length;e++)if(2===i[e].length&&o.hasClass(s,i[e][0])&&o.hasClass(t,i[e][1])&&e+1!==i.length)return this.builder.uo.saveForUndo(),o.removeClass(s,i[e][0]),o.removeClass(t,i[e][1]),o.addClass(s,i[e+1][0]),o.addClass(t,i[e+1][1]),void this.builder.opts.onChange()}}else if(""!==a&&r.length>0&&(-1!==s.className.indexOf("col-md-")||(-1!==s.className.indexOf("col-sm-")?r=["col-sm-1","col-sm-2","col-sm-3","col-sm-4","col-sm-5","col-sm-6","col-sm-7","col-sm-8","col-sm-9","col-sm-10","col-sm-11","col-sm-12"]:-1!==s.className.indexOf("col-xs-")?r=["col-xs-1","col-xs-2","col-xs-3","col-xs-4","col-xs-5","col-xs-6","col-xs-7","col-xs-8","col-xs-9","col-xs-10","col-xs-11","col-xs-12"]:-1!==s.className.indexOf("col-lg-")?r=["col-lg-1","col-lg-2","col-lg-3","col-lg-4","col-lg-5","col-lg-6","col-lg-7","col-lg-8","col-lg-9","col-lg-10","col-lg-11","col-lg-12"]:-1!==s.className.indexOf("col-xl-")?r=["col-xl-1","col-xl-2","col-xl-3","col-xl-4","col-xl-5","col-xl-6","col-xl-7","col-xl-8","col-xl-9","col-xl-10","col-xl-11","col-xl-12"]:-1!==s.className.indexOf("col-xxl-")&&(r=["col-xxl-1","col-xxl-2","col-xxl-3","col-xxl-4","col-xxl-5","col-xxl-6","col-xxl-7","col-xxl-8","col-xxl-9","col-xxl-10","col-xxl-11","col-xxl-12"])),!o.hasClass(s,r[11]))){if(o.hasClass(s,r[11]))return;if(o.hasClass(t,r[0]))return;this.builder.uo.saveForUndo(),o.hasClass(s,r[10])?(o.removeClass(s,r[10]),o.addClass(s,r[11])):o.hasClass(s,r[9])?(o.removeClass(s,r[9]),o.addClass(s,r[10])):o.hasClass(s,r[8])?(o.removeClass(s,r[8]),o.addClass(s,r[9])):o.hasClass(s,r[7])?(o.removeClass(s,r[7]),o.addClass(s,r[8])):o.hasClass(s,r[6])?(o.removeClass(s,r[6]),o.addClass(s,r[7])):o.hasClass(s,r[5])?(o.removeClass(s,r[5]),o.addClass(s,r[6])):o.hasClass(s,r[4])?(o.removeClass(s,r[4]),o.addClass(s,r[5])):o.hasClass(s,r[3])?(o.removeClass(s,r[3]),o.addClass(s,r[4])):o.hasClass(s,r[2])?(o.removeClass(s,r[2]),o.addClass(s,r[3])):o.hasClass(s,r[1])?(o.removeClass(s,r[1]),o.addClass(s,r[2])):o.hasClass(s,r[0])&&(o.removeClass(s,r[0]),o.addClass(s,r[1])),o.hasClass(t,r[1])?(o.removeClass(t,r[1]),o.addClass(t,r[0])):o.hasClass(t,r[2])?(o.removeClass(t,r[2]),o.addClass(t,r[1])):o.hasClass(t,r[3])?(o.removeClass(t,r[3]),o.addClass(t,r[2])):o.hasClass(t,r[4])?(o.removeClass(t,r[4]),o.addClass(t,r[3])):o.hasClass(t,r[5])?(o.removeClass(t,r[5]),o.addClass(t,r[4])):o.hasClass(t,r[6])?(o.removeClass(t,r[6]),o.addClass(t,r[5])):o.hasClass(t,r[7])?(o.removeClass(t,r[7]),o.addClass(t,r[6])):o.hasClass(t,r[8])?(o.removeClass(t,r[8]),o.addClass(t,r[7])):o.hasClass(t,r[9])?(o.removeClass(t,r[9]),o.addClass(t,r[8])):o.hasClass(t,r[10])?(o.removeClass(t,r[10]),o.addClass(t,r[9])):o.hasClass(t,r[11])&&(o.removeClass(t,r[11]),o.addClass(t,r[10])),this.builder.opts.onChange()}}decreaseColumn(){let t=this.builder,e=this.util,i=this.dom;const n=e.cellSelected();if(!n)return;if(this.builder.useDefaultGrid){let t=this.getAllColumns(n);if(t.length>1&&t.length<9){this.builder.uo.saveForUndo();let e=this.resizeColumn(n,!1,t.length);if(e){n.style.width=e,n.style.flex="0 0 auto",this.removeColClasses(n);for(let i=1;i<t.length;i++){let o=t[i];o!==n&&(o.getAttribute("data-html")?2===t.length&&(o.style.width=100-parseFloat(e)+"%",o.style.flex="0 0 auto"):(o.style.width="",o.style.flex=""),this.removeColClasses(o))}}this.builder.opts.onChange()}return}let o,s,l=this.getAllColumns(n);l[1]&&(o=l[1]),l[2]&&(s=l[2]);const a=t.opts.row;let r=t.opts.cols;const c=t.opts.colsizes;if(""!==a&&r.length>0&&c.length>0){if(s)for(let t=0;t<c.length;t++){let e=c[t];for(let t=0;t<e.length;t++)if(3===e[t].length&&i.hasClass(n,e[t][0])&&i.hasClass(o,e[t][1])&&i.hasClass(s,e[t][2])&&0!==t)return this.builder.uo.saveForUndo(),i.removeClass(n,e[t][0]),i.removeClass(o,e[t][1]),i.removeClass(s,e[t][2]),i.addClass(n,e[t-1][0]),i.addClass(o,e[t-1][1]),i.addClass(s,e[t-1][2]),void this.builder.opts.onChange()}for(let t=0;t<c.length;t++){let e=c[t];for(let t=0;t<e.length;t++)if(2===e[t].length&&i.hasClass(n,e[t][0])&&i.hasClass(o,e[t][1])&&0!==t)return this.builder.uo.saveForUndo(),i.removeClass(n,e[t][0]),i.removeClass(o,e[t][1]),i.addClass(n,e[t-1][0]),i.addClass(o,e[t-1][1]),void this.builder.opts.onChange()}}else if(""!==a&&r.length>0&&(-1!==n.className.indexOf("col-md-")||(-1!==n.className.indexOf("col-sm-")?r=["col-sm-1","col-sm-2","col-sm-3","col-sm-4","col-sm-5","col-sm-6","col-sm-7","col-sm-8","col-sm-9","col-sm-10","col-sm-11","col-sm-12"]:-1!==n.className.indexOf("col-xs-")?r=["col-xs-1","col-xs-2","col-xs-3","col-xs-4","col-xs-5","col-xs-6","col-xs-7","col-xs-8","col-xs-9","col-xs-10","col-xs-11","col-xs-12"]:-1!==n.className.indexOf("col-lg-")?r=["col-lg-1","col-lg-2","col-lg-3","col-lg-4","col-lg-5","col-lg-6","col-lg-7","col-lg-8","col-lg-9","col-lg-10","col-lg-11","col-lg-12"]:-1!==n.className.indexOf("col-xl-")?r=["col-xl-1","col-xl-2","col-xl-3","col-xl-4","col-xl-5","col-xl-6","col-xl-7","col-xl-8","col-xl-9","col-xl-10","col-xl-11","col-xl-12"]:-1!==n.className.indexOf("col-xxl-")&&(r=["col-xxl-1","col-xxl-2","col-xxl-3","col-xxl-4","col-xxl-5","col-xxl-6","col-xxl-7","col-xxl-8","col-xxl-9","col-xxl-10","col-xxl-11","col-xxl-12"])),!i.hasClass(n,r[11]))){if(i.hasClass(n,r[0]))return;if(i.hasClass(o,r[11]))return;this.builder.uo.saveForUndo(),i.hasClass(n,r[11])?(i.removeClass(n,r[11]),i.addClass(n,r[10])):i.hasClass(n,r[10])?(i.removeClass(n,r[10]),i.addClass(n,r[9])):i.hasClass(n,r[9])?(i.removeClass(n,r[9]),i.addClass(n,r[8])):i.hasClass(n,r[8])?(i.removeClass(n,r[8]),i.addClass(n,r[7])):i.hasClass(n,r[7])?(i.removeClass(n,r[7]),i.addClass(n,r[6])):i.hasClass(n,r[6])?(i.removeClass(n,r[6]),i.addClass(n,r[5])):i.hasClass(n,r[5])?(i.removeClass(n,r[5]),i.addClass(n,r[4])):i.hasClass(n,r[4])?(i.removeClass(n,r[4]),i.addClass(n,r[3])):i.hasClass(n,r[3])?(i.removeClass(n,r[3]),i.addClass(n,r[2])):i.hasClass(n,r[2])?(i.removeClass(n,r[2]),i.addClass(n,r[1])):i.hasClass(n,r[1])&&(i.removeClass(n,r[1]),i.addClass(n,r[0])),i.hasClass(o,r[0])?(i.removeClass(o,r[0]),i.addClass(o,r[1])):i.hasClass(o,r[1])?(i.removeClass(o,r[1]),i.addClass(o,r[2])):i.hasClass(o,r[2])?(i.removeClass(o,r[2]),i.addClass(o,r[3])):i.hasClass(o,r[3])?(i.removeClass(o,r[3]),i.addClass(o,r[4])):i.hasClass(o,r[4])?(i.removeClass(o,r[4]),i.addClass(o,r[5])):i.hasClass(o,r[5])?(i.removeClass(o,r[5]),i.addClass(o,r[6])):i.hasClass(o,r[6])?(i.removeClass(o,r[6]),i.addClass(o,r[7])):i.hasClass(o,r[7])?(i.removeClass(o,r[7]),i.addClass(o,r[8])):i.hasClass(o,r[8])?(i.removeClass(o,r[8]),i.addClass(o,r[9])):i.hasClass(o,r[9])?(i.removeClass(o,r[9]),i.addClass(o,r[10])):i.hasClass(o,r[10])&&(i.removeClass(o,r[10]),i.addClass(o,r[11])),this.builder.opts.onChange()}}removeRow(){let t,e=this.util,i=this.dom,n=e.cellSelected();t=n?n.parentNode:e.rowSelected(),t&&(i.removeClass(t,"row-outline"),e.confirm(e.out("Are you sure you want to delete this block?"),(t=>{let i,n=e.cellSelected();i=n?n.parentNode:e.rowSelected(),i&&t&&(this.builder.uo.saveForUndo(),i.parentNode.removeChild(i),e.checkEmpty(),e.clearActiveCell(),this.builder.opts.onChange())})))}moveRowUp(){let t,e=this.util,i=this.dom,n=e.cellSelected();if(t=n?n.parentNode:e.rowSelected(),t)if(i.removeClass(t,"row-outline"),t.previousElementSibling)this.builder.uo.saveForUndo(),t.parentNode.insertBefore(t,t.previousElementSibling),this.rowTool.position(t),this.builder.opts.onChange(),this.builder.win.builderRuntime&&this.builder.win.builderRuntime.reinitialize(t);else{let n=t.parentNode,o=null;const s=document.querySelectorAll(this.builder.opts.container);Array.prototype.forEach.call(s,(s=>{if(s.innerHTML===n.innerHTML&&o)return i.moveAfter(t,o.lastChild),this.rowTool.position(t),e.checkEmpty(),this.builder.opts.onChange(),!1;o=s}))}}moveRowDown(){let t,e=this.util,i=this.dom,n=e.cellSelected();if(t=n?n.parentNode:e.rowSelected(),t)if(i.removeClass(t,"row-outline"),t.nextElementSibling)this.builder.uo.saveForUndo(),t.parentNode.insertBefore(t.nextElementSibling,t),this.rowTool.position(t),this.builder.opts.onChange(),this.builder.win.builderRuntime&&this.builder.win.builderRuntime.reinitialize(t);else{let i=t.parentNode,n=!1;const o=document.querySelectorAll(this.builder.opts.container);Array.prototype.forEach.call(o,(o=>{if(n)return o.insertBefore(t,o.firstChild),this.rowTool.position(t),e.checkEmpty(),this.builder.opts.onChange(),!1;o.innerHTML===i.innerHTML&&(n=!0)}))}}duplicateRow(){let t,e=this.builder,i=this.util,n=this.dom,o=i.cellSelected();if(t=o?o.parentNode:i.rowSelected(),!t)return;n.removeClass(t,"row-outline"),this.builder.uo.saveForUndo();const s=t.cloneNode(!0);s.removeChild(s.querySelector(".is-row-tool")),s.removeChild(s.querySelector(".is-col-tool"));let l=n.elementChildren(s);l.forEach((t=>{t.removeAttribute("data-click"),t.classList.contains("cell-active")&&(e.activeCol=t)})),n.moveAfter(s,t),n.removeClass(t,"row-active"),n.removeClass(t,"row-outline"),l=n.elementChildren(t),l.forEach((t=>{n.removeClass(t,"cell-active")}));let a=this.builder.doc.querySelector(".builder-active");e.applyBehaviorOn(a),this.rowTool.position(s),this.builder.opts.onChange(),this.builder.win.builderRuntime&&this.builder.win.builderRuntime.reinitialize(s),this.builder.makeSortable(s)}}class Oo{constructor(t){this.builder=t;const e=this.builder.dom;this.dom=e}position(t){let e=this.dom;const i=this.builder.builderStuff;let n=t.querySelector(".is-row-tool"),o=i.querySelector(".rowmore");if(!o)return;e.addClass(o,"transition1");const s=n.querySelector(".row-more"),l=this.builder.util.getElementPosition(s);let a=l.top+window.pageYOffset,r=l.left+window.pageXOffset;o.style.top=a-8+"px",e.removeClass(o,"arrow-bottom"),e.removeClass(o,"arrow-left"),e.removeClass(o,"arrow-right"),e.removeClass(o,"center"),e.removeClass(o,"right"),e.removeClass(o,"left"),"right"===this.builder.opts.rowTool?(o.style.left=r-o.offsetWidth-10+"px",e.addClass(o,"arrow-right"),e.addClass(o,"left")):(o.style.left=r+35+"px",e.addClass(o,"arrow-left"),e.addClass(o,"left")),setTimeout((()=>{e.removeClass(o,"transition1")}),300)}}class zo{constructor(t={}){this.opts=t,this.dragStart=this.dragStart.bind(this),this.dragEnd=this.dragEnd.bind(this),this.drag=this.drag.bind(this);const e=document.querySelectorAll(this.opts.selector);Array.prototype.forEach.call(e,(t=>{t.setAttribute("draggable",""),t.addEventListener("mousedown",this.dragStart,!1),t.addEventListener("touchstart",this.dragStart,{passive:!0}),t.addEventListener("mouseup",this.dragEnd,!1),t.addEventListener("touchend",this.dragEnd,!1)}))}dragStart(t){if(!t.target.hasAttribute("draggable"))return;if("touchstart"===t.type&&1!==t.touches.length)return;if("mousedown"===t.type&&0!==t.button)return;let e,i,n,o;t.target.parentNode.style.transition="none",this.dragActive=!0,this.activeDraggableBox=t.target.parentElement,this.activeDraggableBox.getAttribute("data-xOffset")?e=this.activeDraggableBox.getAttribute("data-xOffset"):(this.activeDraggableBox.setAttribute("data-xOffset",0),e=0),this.activeDraggableBox.getAttribute("data-yOffset")?i=this.activeDraggableBox.getAttribute("data-yOffset"):(this.activeDraggableBox.setAttribute("data-yOffset",0),i=0),"touchstart"===t.type?(n=t.touches[0].clientX-e,o=t.touches[0].clientY-i):(n=t.clientX-e,o=t.clientY-i),this.activeDraggableBox.setAttribute("data-initialX",n),this.activeDraggableBox.setAttribute("data-initialY",o),document.addEventListener("touchmove",this.drag,!1),document.addEventListener("mousemove",this.drag,!1)}dragEnd(t){if(!t.target.hasAttribute("draggable"))return;if(!this.activeDraggableBox)return;t.target.parentNode.style.transition="";let e=this.activeDraggableBox.getAttribute("data-currentX"),i=this.activeDraggableBox.getAttribute("data-currentY");this.activeDraggableBox.setAttribute("data-initialX",e),this.activeDraggableBox.setAttribute("data-initialY",i),this.dragActive=!1,document.removeEventListener("touchmove",this.drag),document.removeEventListener("mousemove",this.drag)}drag(t){if(this.dragActive){t.preventDefault();let e,i,n=this.activeDraggableBox.getAttribute("data-initialX"),o=this.activeDraggableBox.getAttribute("data-initialY");"touchmove"===t.type?(e=t.touches[0].clientX-n,i=t.touches[0].clientY-o):(e=t.clientX-n,i=t.clientY-o),this.activeDraggableBox.style.transform="translate3d("+e+"px, "+i+"px, 0)",this.activeDraggableBox.setAttribute("data-currentX",e),this.activeDraggableBox.setAttribute("data-currentY",i);let s=e,l=i;this.activeDraggableBox.setAttribute("data-xOffset",s),this.activeDraggableBox.setAttribute("data-yOffset",l)}}}class Bo{constructor(t,e={}){this.select=document.querySelector(t);""===this.select.innerHTML.trim()&&(this.select.innerHTML='\n <div class="select-styled" tabindex="0">\n <span></span>\n <span><svg><use xlink:href="#icon-chevron-down"></use></svg></span>\n </div>\n <input type="text">\n <ul class="select-options" aria-haspopup="listbox">\n </ul>\n '),this.select.setAttribute("role","combobox"),this.select.classList.add("custom-select"),this.selectStyled=this.select.querySelector(".select-styled"),this.selectOptions=this.select.querySelector(".select-options"),this.selectSearch=this.select.querySelector("input"),this.selectSearch.setAttribute("id",`__${this.uniqueId()}`);this.config={search:!0,...e},this.config.search&&this.select.classList.add("has-search"),this.config.data&&(this.selectOptions.innerHTML="",this.config.data.forEach((t=>{const e=document.createElement("li");e.setAttribute("data-value",t.value),e.innerHTML=t.label,this.selectOptions.appendChild(e)}))),this.selectStyled.addEventListener("keydown",this.handleKeydown.bind(this)),this.selectStyled.addEventListener("click",this.toggleOptions.bind(this)),this.selectOptions.addEventListener("click",this.handleOptionClick.bind(this)),this.selectSearch.addEventListener("input",this.handleFilterInput.bind(this))}handleKeydown(t){if(!this.selectOptions.classList.contains("active"))switch(t.key){case"Enter":case" ":this.openOptions(),t.preventDefault()}}toggleOptions(){this.selectOptions.classList.contains("active")?this.closeOptions():this.openOptions()}openOptions(){this.clearFilter(),this.selectOptions.classList.add("active"),this.selectStyled.setAttribute("aria-expanded","true"),setTimeout((()=>{document.addEventListener("keydown",this.AA=t=>{this.handleGlobalKeydown(t)}),document.addEventListener("click",this.BB=t=>{this.handleGlobalClick(t)}),this.config.search&&this.selectSearch.focus()}),100),this.config.search&&(this.selectSearch.style.display="block");const t=this.select.getAttribute("data-value");this.selectOptions.querySelectorAll("li").forEach((e=>{t===e.getAttribute("data-value")?(e.classList.add("selected"),e.scrollIntoView()):e.classList.remove("selected")}))}closeOptions(){this.selectOptions.classList.remove("active"),this.selectStyled.setAttribute("aria-expanded","false"),document.removeEventListener("keydown",this.AA),document.removeEventListener("click",this.BB),this.selectSearch.style.display="none"}handleGlobalClick(t){const e=t.target;this.select.contains(e)||(this.closeOptions(),this.selectStyled.blur())}handleGlobalKeydown(t){if(this.selectOptions.classList.contains("active")){const e=this.selectOptions.querySelectorAll("li"),i=Array.from(e).findIndex((t=>t.classList.contains("selected")));let n;switch(t.key){case"ArrowUp":n=this.findPreviousVisibleIndex(e,i),this.highlightOption(e,n),t.preventDefault();break;case"ArrowDown":n=this.findNextVisibleIndex(e,i),this.highlightOption(e,n);break;case"Enter":-1!==i&&(this.selectOption(e[i]),this.selectStyled.focus());break;case"Escape":case"Tab":this.closeOptions(),this.selectStyled.focus()}}}highlightOption(t,e){t.forEach((t=>t.classList.remove("selected"))),e<0?e=t.length-1:e>=t.length&&(e=0),t[e].classList.add("selected"),t[e].scrollIntoView({block:"nearest",inline:"start"})}handleOptionClick(t){this.selectOptions.querySelectorAll("li").forEach((t=>t.classList.remove("selected")));const e=t.target.closest("li");e&&(this.selectOption(e),this.selectStyled.focus(),e.classList.add("selected"))}selectOption(t){const e=t.getAttribute("data-value");this.select.setAttribute("data-value",e);this.selectOptions.querySelectorAll("li").forEach((t=>{if(e===t.getAttribute("data-value")){this.selectStyled.querySelector("span").innerHTML=t.innerHTML}})),this.closeOptions(),this.config.onChange&&this.config.onChange(e)}setValue(t){this.select.setAttribute("data-value",t);this.selectOptions.querySelectorAll("li").forEach((e=>{if(t===e.getAttribute("data-value")){e.classList.add("selected");this.selectStyled.querySelector("span").innerHTML=e.innerHTML}else e.classList.remove("selected")}))}getValue(){return this.select.getAttribute("data-value")}clearFilter(){this.selectSearch.value="";this.selectOptions.querySelectorAll("li").forEach((t=>{t.style.display="flex"}))}handleFilterInput(){if(this.selectOptions.classList.contains("active")){const t=this.selectSearch.value.toLowerCase(),e=this.selectOptions.querySelectorAll("li");e.forEach((t=>t.classList.remove("selected")));let i=[];e.forEach((e=>{e.getAttribute("data-value").includes(t)?(e.style.display="flex",i.push(e)):e.style.display="none"})),i.length>0?this.highlightOption(i,0):this.clearFilter()}}findNextVisibleIndex(t,e){let i=e+1;for(;i<t.length;){if("none"!==t[i].style.display)return i;i++}return e}findPreviousVisibleIndex(t,e){let i=e-1;for(;i>=0;){if("none"!==t[i].style.display)return i;i--}return e}uniqueId(){let t="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(let i=0;i<2;i++)t+=e.charAt(Math.floor(Math.random()*e.length));let i="",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let t=0;t<5;t++)i+=n.charAt(Math.floor(Math.random()*n.length));return t+i}}const Io=(t,e)=>{const i=t.util,n=t.builderStuff,o=t.dom;let s="",l=t.opts.sidePanel;if("#divSnippetList"===t.opts.snippetList){const e=`<div id="divSnippetList" class="is-side ${"right"===l?"":" fromleft"} snippetlist scroll-darker" tabindex="-1" role="dialog" aria-modal="true" title="${i.out("Snippets")}">\n </div>`;o.appendHtml(n,e),t.opts.snippetHandle||(s="display:none;")}else s="display:none;",l="left";let a="";a=t.opts.emailMode?t.opts.defaultEmailSnippetCategory:t.opts.defaultSnippetCategory;let r='\n <div style="position:absolute;top:0;right:0;padding: 0;width:100%;z-index:2;">\n <div class="inp-snippets">\n </div>\n </div>\n\n '+("right"===l?'<div id="divSnippetScrollUp" role="button" tabindex="-1" style="top:calc(50% - 27px);right:25px;">▲</div><div id="divSnippetScrollDown" role="button" tabindex="-1" style="top:calc(50% + 27px);right:25px;">▼</div><div id="divSnippetHandle" role="button" tabindex="-1" title="'+i.out("Snippets")+'" data-title="'+i.out("Snippets")+'" style="'+s+'"><svg class="is-icon-flex"><use xlink:href="#ion-ios-arrow-left"></use></svg></div>':'<div id="divSnippetScrollUp" role="button" tabindex="-1" style="top:calc(50% - 27px);left:10px;">▲</div><div id="divSnippetScrollDown" role="button" tabindex="-1" style="top:calc(50% + 27px);left:10px;">▼</div><div id="divSnippetHandle" role="button" tabindex="-1" title="'+i.out("Snippets")+'" data-title="'+i.out("Snippets")+'" style="'+s+'"><svg class="is-icon-flex"><use xlink:href="#ion-ios-arrow-right"></use></svg></div>')+'<div class="is-design-list" tabindex="0"></div>';if(t.opts.snippetModal){t.opts.snippetList="#divSnippetWindow";let e=`\n <div class="is-modal active is-modal-content snippetwindow scroll-darker" tabindex="-1" role="dialog" aria-modal="true">\n <div class="is-modal-bar is-draggable">\n <button class="is-modal-close" tabindex="-1" title="${i.out("Close")}">✕</button>\n </div>\n <div id="divSnippetWindow">\n </div> \n </div>\n `,n=t.builderStuff.querySelector(".is-modal.snippetwindow");n||(o.appendHtml(t.builderStuff,e),n=t.builderStuff.querySelector(".is-modal.snippetwindow")),t.draggable(".snippetwindow .is-draggable");n.querySelector(".is-modal-close").addEventListener("click",(()=>{t.doc.activeElement.blur(),n.setAttribute("aria-hidden",!0),n.classList.remove("active")})),t.snippetModalLeft&&n.classList.add("left")}let c=document.querySelector(t.opts.snippetList);c.innerHTML="",o.appendHtml(c,r);const u=[];t.opts.snippetCategories.forEach((t=>{const e={};e.value=t[0],e.label=i.out(t[1]),u.push(e)}));const d=new Bo(".inp-snippets",{data:u,search:!1,onChange:e=>{let n=e,s=b.querySelectorAll(".snippet-item"),l=!1;Array.prototype.forEach.call(s,(t=>{t.getAttribute("data-cat")===n&&(l=!0)})),l||t.opts.snippetJSON.snippets.forEach((t=>{t.category===n&&o.appendHtml(b,'<div class="snippet-item" data-id="'+t.id+'" data-cat="'+t.category+'"><img alt="'+i.out("Snippet")+'" alt="" src="'+h+t.thumbnail+'"><span class="is-overlay"></span></div>')})),n&&(Array.prototype.forEach.call(s,(t=>{o.addClass(t,"hide")})),Array.prototype.forEach.call(s,(t=>{t.getAttribute("data-cat")===n&&(t.className=t.className.replace(/hide/g,""))})))}});d.setValue(a+""),d.closeOptions(),"#divSnippetList"===t.opts.snippetList&&(c.querySelector(".is-design-list").style.display="none",t.doc.addEventListener("click",t.doHideSnippetHandler=e=>{var i=(e=e||window.event).target||e.srcElement;if("auto"===t.opts.snippetsSidebarDisplay&&o.hasClass(c,"active")){o.parentsHasClass(i,"is-builder")&&function(t){const e=t.dom;let i=document.querySelector("#divSnippetList");const n=i.querySelector("#divSnippetHandle");e.removeClass(i,"active"),"right"===t.opts.sidePanel?n.innerHTML='<svg class="is-icon-flex" style="width:17px;height:17px;"><use xlink:href="#ion-ios-arrow-left"></use></svg>':n.innerHTML='<svg class="is-icon-flex" style="width:17px;height:17px;"><use xlink:href="#ion-ios-arrow-right"></use></svg>';setTimeout((()=>{i.querySelector(".is-design-list").style.display="none"}),300)}
|
|
19
|
+
*/class Ro{constructor(t){this.builder=t;const e=this.builder.util,i=this.builder.builderStuff;this.util=e,this.builderStuff=i;const n=this.builder.dom;this.dom=n,this.rowTool=new Oo(t)}moveColumnPrevious(){const t=this.util.cellSelected();t&&t.previousElementSibling&&(this.builder.uo.saveForUndo(),this.builder.hideTools(),t.parentElement.insertBefore(t,t.previousElementSibling),this.builder.opts.onChange(!0),this.builder.win.builderRuntime&&this.builder.win.builderRuntime.reinitialize(t))}moveColumnNext(){let t=this.util;const e=t.cellSelected();if(!e)return;const i=t.cellNext(e);i&&(this.builder.uo.saveForUndo(),this.builder.hideTools(),e.parentElement.insertBefore(i,e),this.builder.opts.onChange(!0),this.builder.win.builderRuntime&&this.builder.win.builderRuntime.reinitialize(e))}moveColumnUp(){let t=this.builder,e=this.util;const i=e.cellSelected();if(!i)return;let n=i.parentNode,o=3;if(n.querySelector(".is-row-overlay")&&(o=4),n.childElementCount-o==1){if(!n.previousElementSibling)return;{let e=4;if(this.builder.maxColumns&&(e=this.builder.maxColumns),n.previousElementSibling.childElementCount>=e+o||n.previousElementSibling.hasAttribute("data-protected"))return this.builder.uo.saveForUndo(),this.builder.hideTools(),n.parentNode.insertBefore(n,n.previousElementSibling),this.builder.opts.onChange(!0),void(this.builder.win.builderRuntime&&this.builder.win.builderRuntime.reinitialize(n));{this.builder.uo.saveForUndo(),this.builder.hideTools();let e=n.previousElementSibling.querySelector(".is-row-tool");n.previousElementSibling.removeChild(e),e=n.previousElementSibling.querySelector(".is-rowadd-tool"),n.previousElementSibling.removeChild(e),e=n.previousElementSibling.querySelector(".is-col-tool"),n.previousElementSibling.removeChild(e),n.previousElementSibling.appendChild(i),n.parentNode.removeChild(n);let o=this.builder.doc.querySelector(".builder-active");t.applyBehaviorOn(o),setTimeout((()=>{i.click()}),30),this.builder.opts.onChange(!0)}}}else{this.builder.uo.saveForUndo(),this.builder.hideTools();var s=n.cloneNode(!0);s.innerHTML="",s.appendChild(i),n.parentNode.insertBefore(s,n);let e=this.builder.doc.querySelector(".builder-active");t.applyBehaviorOn(e),setTimeout((()=>{i.click()}),30),this.builder.opts.onChange(!0)}n=i.parentNode,e.fixLayout(n),n.nextElementSibling&&e.fixLayout(n.nextElementSibling),this.builder.win.builderRuntime&&this.builder.win.builderRuntime.reinitialize(n)}moveColumnDown(){let t=this.builder,e=this.util,i=this.dom;const n=e.cellSelected();if(!n)return;let o=n.parentNode,s=3;if(o.querySelector(".is-row-overlay")&&(s=4),o.childElementCount-s==1){if(!o.nextElementSibling)return;{let e=4;if(this.builder.maxColumns&&(e=this.builder.maxColumns),o.nextElementSibling.childElementCount>=e+s||o.nextElementSibling.hasAttribute("data-protected"))return this.builder.uo.saveForUndo(),this.builder.hideTools(),o.parentNode.insertBefore(o.nextElementSibling,o),this.builder.opts.onChange(!0),void(this.builder.win.builderRuntime&&this.builder.win.builderRuntime.reinitialize(o));{this.builder.uo.saveForUndo(),this.builder.hideTools();let e=o.nextElementSibling.querySelector(".is-row-tool");o.nextElementSibling.removeChild(e),e=o.nextElementSibling.querySelector(".is-rowadd-tool"),o.nextElementSibling.removeChild(e),e=o.nextElementSibling.querySelector(".is-col-tool"),o.nextElementSibling.removeChild(e),o.nextElementSibling.appendChild(n),o.parentNode.removeChild(o);let i=this.builder.doc.querySelector(".builder-active");t.applyBehaviorOn(i),setTimeout((()=>{n.click()}),30),this.builder.opts.onChange(!0)}}}else{this.builder.uo.saveForUndo(),this.builder.hideTools();var l=o.cloneNode(!0);l.innerHTML="",l.appendChild(n),i.moveAfter(l,o);let e=this.builder.doc.querySelector(".builder-active");t.applyBehaviorOn(e),setTimeout((()=>{n.click()}),30),this.builder.opts.onChange(!0)}o=n.parentNode,e.fixLayout(o),o.previousElementSibling&&e.fixLayout(o.previousElementSibling),this.builder.win.builderRuntime&&this.builder.win.builderRuntime.reinitialize(o)}duplicateColumn(){let t=this.builder,e=this.util,i=this.dom;const n=e.cellSelected();if(!n)return;this.builder.uo.saveForUndo();var o=n.cloneNode(!0);i.removeClass(o,"cell-active"),o.removeAttribute("data-click"),this.builder.opts.enableDragResize&&(n.style.width="",n.style.flex="");let s=n.parentNode,l=3;s.querySelector(".is-row-overlay")&&(l=4);let a=4;if(this.builder.maxColumns&&(a=this.builder.maxColumns),s.childElementCount>=a+l)return alert(e.out("You have reached the maximum number of columns")),!1;s.insertBefore(o,n),e.fixLayout(s);let r=this.builder.doc.querySelector(".builder-active");t.applyBehaviorOn(r),setTimeout((()=>{n.click()}),30),this.builder.opts.onChange(),this.builder.win.builderRuntime&&this.builder.win.builderRuntime.reinitialize(o),this.builder.makeSortable(o)}removeColumn(){let t=this.util;const e=t.cellSelected();if(!e)return;let i=e.parentNode,n=3;i.querySelector(".is-row-overlay")&&(n=4),t.confirm(t.out("Are you sure you want to delete this block?"),(o=>{o&&(this.builder.uo.saveForUndo(),i.childElementCount-n==1?(i.parentNode.removeChild(i),t.checkEmpty()):(i.removeChild(e),t.fixLayout(i)),t.clearActiveCell(),this.builder.opts.onChange())}))}removeColClasses(t){t.classList.remove("full"),t.classList.remove("two-third"),t.classList.remove("two-fourth"),t.classList.remove("two-fifth"),t.classList.remove("two-sixth"),t.classList.remove("half"),t.classList.remove("third"),t.classList.remove("fourth"),t.classList.remove("fifth"),t.classList.remove("sixth"),t.classList.remove("seventh"),t.classList.remove("eighth"),t.classList.remove("ninth"),t.classList.remove("tenth"),t.classList.remove("eleventh"),t.classList.remove("twelfth")}getAllColumns(t){let e=[],i=this.dom;i.elementChildren(t.parentNode).forEach((n=>{i.hasClass(n,"is-row-tool")||i.hasClass(n,"is-col-tool")||i.hasClass(n,"is-rowadd-tool")||i.hasClass(n,"is-row-overlay")||t!==n&&e.push(n)}));return[t].concat(e)}getCellWidth(t){return t.classList.contains("two-third")?66.666:t.classList.contains("two-fourth")?75:t.classList.contains("two-fifth")?80:t.classList.contains("two-sixth")?83.333:t.classList.contains("half")?50:t.classList.contains("third")?33.333:t.classList.contains("fourth")?25:t.classList.contains("fifth")?20:t.classList.contains("sixth")?16.666:t.classList.contains("seventh")?14.2857:t.classList.contains("eighth")?12.5:t.classList.contains("ninth")?11.111:t.classList.contains("tenth")?10:t.classList.contains("eleventh")?9.09:!!t.classList.contains("twelfth")&&8.333}resizeColumn(t,e,i){let n=this.getCellWidth(t);if(!n){n=parseFloat(window.getComputedStyle(t).getPropertyValue("width"))/parseFloat(window.getComputedStyle(t.parentNode).getPropertyValue("width"))*100}if(e){if(3===i){if(n>=28&&n<=30)return"33.333%";if(n>30&&n<38)return"40%";if(n>=68&&n<=90)return"75%"}if(4===i&&n>=48&&n<=90)return"60%";if(5===i&&n>=38&&n<=90)return"50%";if(6===i){if(n>=10&&n<13)return"16.666%";if(n>=28&&n<=90)return"40%"}if(7===i&&n>=23&&n<=90)return"30%";if(8===i&&n>=13&&n<=90)return"20%";if(n>=78&&n<=90)return"90%";if(n>=73&&n<78)return"80%";if(n>=68&&n<73)return"75%";if(n>=58&&n<68)return"70%";if(n>=48&&n<58)return"60%";if(n>=38&&n<48)return"50%";if(n>=28&&n<38)return"40%";if(n>=23&&n<28)return"30%";if(n>=18&&n<23)return"25%";if(n>=13&&n<18)return"20%";if(n>=10&&n<13)return"15%"}else{if(3===i){if(n>35&&n<=43)return"33.333%";if(n>33&&n<=35)return"30%"}if(6===i&&n>18&&n<=23)return"16.666%";if(n>93&&n<=100)return"90%";if(n>83&&n<=93)return"80%";if(n>78&&n<=83)return"75%";if(n>73&&n<=78)return"70%";if(n>63&&n<=73)return"60%";if(n>53&&n<=63)return"50%";if(n>43&&n<=53)return"40%";if(n>33&&n<=43)return"30%";if(n>28&&n<=33)return"25%";if(n>23&&n<=28)return"20%";if(n>18&&n<=23)return"15%";if(n>=10&&n<=18)return"10%"}return!1}increaseColumn(){let t,e,i=this.builder,n=this.util,o=this.dom,s=n.cellSelected();if(!s)return;if(this.builder.useDefaultGrid){let t=this.getAllColumns(s);if(t.length>1&&t.length<9){this.builder.uo.saveForUndo();let e=this.resizeColumn(s,!0,t.length);if(e){s.style.width=e,s.style.flex="0 0 auto",this.removeColClasses(s);for(let i=1;i<t.length;i++){let n=t[i];n!==s&&(n.getAttribute("data-html")?2===t.length&&(n.style.width=100-parseFloat(e)+"%",n.style.flex="0 0 auto"):(n.style.width="",n.style.flex=""),this.removeColClasses(n))}}this.builder.opts.onChange()}return}let l=this.getAllColumns(s);l[1]&&(t=l[1]),l[2]&&(e=l[2]);const a=i.opts.row;let r=i.opts.cols;const c=i.opts.colsizes;if(""!==a&&r.length>0&&c.length>0){if(e)for(let i=0;i<c.length;i++){let n=c[i];for(let i=0;i<n.length;i++)if(3===n[i].length&&o.hasClass(s,n[i][0])&&o.hasClass(t,n[i][1])&&o.hasClass(e,n[i][2])&&i+1!==n.length)return this.builder.uo.saveForUndo(),o.removeClass(s,n[i][0]),o.removeClass(t,n[i][1]),o.removeClass(e,n[i][2]),o.addClass(s,n[i+1][0]),o.addClass(t,n[i+1][1]),o.addClass(e,n[i+1][2]),void this.builder.opts.onChange()}for(let e=0;e<c.length;e++){let i=c[e];for(let e=0;e<i.length;e++)if(2===i[e].length&&o.hasClass(s,i[e][0])&&o.hasClass(t,i[e][1])&&e+1!==i.length)return this.builder.uo.saveForUndo(),o.removeClass(s,i[e][0]),o.removeClass(t,i[e][1]),o.addClass(s,i[e+1][0]),o.addClass(t,i[e+1][1]),void this.builder.opts.onChange()}}else if(""!==a&&r.length>0&&(-1!==s.className.indexOf("col-md-")||(-1!==s.className.indexOf("col-sm-")?r=["col-sm-1","col-sm-2","col-sm-3","col-sm-4","col-sm-5","col-sm-6","col-sm-7","col-sm-8","col-sm-9","col-sm-10","col-sm-11","col-sm-12"]:-1!==s.className.indexOf("col-xs-")?r=["col-xs-1","col-xs-2","col-xs-3","col-xs-4","col-xs-5","col-xs-6","col-xs-7","col-xs-8","col-xs-9","col-xs-10","col-xs-11","col-xs-12"]:-1!==s.className.indexOf("col-lg-")?r=["col-lg-1","col-lg-2","col-lg-3","col-lg-4","col-lg-5","col-lg-6","col-lg-7","col-lg-8","col-lg-9","col-lg-10","col-lg-11","col-lg-12"]:-1!==s.className.indexOf("col-xl-")?r=["col-xl-1","col-xl-2","col-xl-3","col-xl-4","col-xl-5","col-xl-6","col-xl-7","col-xl-8","col-xl-9","col-xl-10","col-xl-11","col-xl-12"]:-1!==s.className.indexOf("col-xxl-")&&(r=["col-xxl-1","col-xxl-2","col-xxl-3","col-xxl-4","col-xxl-5","col-xxl-6","col-xxl-7","col-xxl-8","col-xxl-9","col-xxl-10","col-xxl-11","col-xxl-12"])),!o.hasClass(s,r[11]))){if(o.hasClass(s,r[11]))return;if(o.hasClass(t,r[0]))return;this.builder.uo.saveForUndo(),o.hasClass(s,r[10])?(o.removeClass(s,r[10]),o.addClass(s,r[11])):o.hasClass(s,r[9])?(o.removeClass(s,r[9]),o.addClass(s,r[10])):o.hasClass(s,r[8])?(o.removeClass(s,r[8]),o.addClass(s,r[9])):o.hasClass(s,r[7])?(o.removeClass(s,r[7]),o.addClass(s,r[8])):o.hasClass(s,r[6])?(o.removeClass(s,r[6]),o.addClass(s,r[7])):o.hasClass(s,r[5])?(o.removeClass(s,r[5]),o.addClass(s,r[6])):o.hasClass(s,r[4])?(o.removeClass(s,r[4]),o.addClass(s,r[5])):o.hasClass(s,r[3])?(o.removeClass(s,r[3]),o.addClass(s,r[4])):o.hasClass(s,r[2])?(o.removeClass(s,r[2]),o.addClass(s,r[3])):o.hasClass(s,r[1])?(o.removeClass(s,r[1]),o.addClass(s,r[2])):o.hasClass(s,r[0])&&(o.removeClass(s,r[0]),o.addClass(s,r[1])),o.hasClass(t,r[1])?(o.removeClass(t,r[1]),o.addClass(t,r[0])):o.hasClass(t,r[2])?(o.removeClass(t,r[2]),o.addClass(t,r[1])):o.hasClass(t,r[3])?(o.removeClass(t,r[3]),o.addClass(t,r[2])):o.hasClass(t,r[4])?(o.removeClass(t,r[4]),o.addClass(t,r[3])):o.hasClass(t,r[5])?(o.removeClass(t,r[5]),o.addClass(t,r[4])):o.hasClass(t,r[6])?(o.removeClass(t,r[6]),o.addClass(t,r[5])):o.hasClass(t,r[7])?(o.removeClass(t,r[7]),o.addClass(t,r[6])):o.hasClass(t,r[8])?(o.removeClass(t,r[8]),o.addClass(t,r[7])):o.hasClass(t,r[9])?(o.removeClass(t,r[9]),o.addClass(t,r[8])):o.hasClass(t,r[10])?(o.removeClass(t,r[10]),o.addClass(t,r[9])):o.hasClass(t,r[11])&&(o.removeClass(t,r[11]),o.addClass(t,r[10])),this.builder.opts.onChange()}}decreaseColumn(){let t=this.builder,e=this.util,i=this.dom;const n=e.cellSelected();if(!n)return;if(this.builder.useDefaultGrid){let t=this.getAllColumns(n);if(t.length>1&&t.length<9){this.builder.uo.saveForUndo();let e=this.resizeColumn(n,!1,t.length);if(e){n.style.width=e,n.style.flex="0 0 auto",this.removeColClasses(n);for(let i=1;i<t.length;i++){let o=t[i];o!==n&&(o.getAttribute("data-html")?2===t.length&&(o.style.width=100-parseFloat(e)+"%",o.style.flex="0 0 auto"):(o.style.width="",o.style.flex=""),this.removeColClasses(o))}}this.builder.opts.onChange()}return}let o,s,l=this.getAllColumns(n);l[1]&&(o=l[1]),l[2]&&(s=l[2]);const a=t.opts.row;let r=t.opts.cols;const c=t.opts.colsizes;if(""!==a&&r.length>0&&c.length>0){if(s)for(let t=0;t<c.length;t++){let e=c[t];for(let t=0;t<e.length;t++)if(3===e[t].length&&i.hasClass(n,e[t][0])&&i.hasClass(o,e[t][1])&&i.hasClass(s,e[t][2])&&0!==t)return this.builder.uo.saveForUndo(),i.removeClass(n,e[t][0]),i.removeClass(o,e[t][1]),i.removeClass(s,e[t][2]),i.addClass(n,e[t-1][0]),i.addClass(o,e[t-1][1]),i.addClass(s,e[t-1][2]),void this.builder.opts.onChange()}for(let t=0;t<c.length;t++){let e=c[t];for(let t=0;t<e.length;t++)if(2===e[t].length&&i.hasClass(n,e[t][0])&&i.hasClass(o,e[t][1])&&0!==t)return this.builder.uo.saveForUndo(),i.removeClass(n,e[t][0]),i.removeClass(o,e[t][1]),i.addClass(n,e[t-1][0]),i.addClass(o,e[t-1][1]),void this.builder.opts.onChange()}}else if(""!==a&&r.length>0&&(-1!==n.className.indexOf("col-md-")||(-1!==n.className.indexOf("col-sm-")?r=["col-sm-1","col-sm-2","col-sm-3","col-sm-4","col-sm-5","col-sm-6","col-sm-7","col-sm-8","col-sm-9","col-sm-10","col-sm-11","col-sm-12"]:-1!==n.className.indexOf("col-xs-")?r=["col-xs-1","col-xs-2","col-xs-3","col-xs-4","col-xs-5","col-xs-6","col-xs-7","col-xs-8","col-xs-9","col-xs-10","col-xs-11","col-xs-12"]:-1!==n.className.indexOf("col-lg-")?r=["col-lg-1","col-lg-2","col-lg-3","col-lg-4","col-lg-5","col-lg-6","col-lg-7","col-lg-8","col-lg-9","col-lg-10","col-lg-11","col-lg-12"]:-1!==n.className.indexOf("col-xl-")?r=["col-xl-1","col-xl-2","col-xl-3","col-xl-4","col-xl-5","col-xl-6","col-xl-7","col-xl-8","col-xl-9","col-xl-10","col-xl-11","col-xl-12"]:-1!==n.className.indexOf("col-xxl-")&&(r=["col-xxl-1","col-xxl-2","col-xxl-3","col-xxl-4","col-xxl-5","col-xxl-6","col-xxl-7","col-xxl-8","col-xxl-9","col-xxl-10","col-xxl-11","col-xxl-12"])),!i.hasClass(n,r[11]))){if(i.hasClass(n,r[0]))return;if(i.hasClass(o,r[11]))return;this.builder.uo.saveForUndo(),i.hasClass(n,r[11])?(i.removeClass(n,r[11]),i.addClass(n,r[10])):i.hasClass(n,r[10])?(i.removeClass(n,r[10]),i.addClass(n,r[9])):i.hasClass(n,r[9])?(i.removeClass(n,r[9]),i.addClass(n,r[8])):i.hasClass(n,r[8])?(i.removeClass(n,r[8]),i.addClass(n,r[7])):i.hasClass(n,r[7])?(i.removeClass(n,r[7]),i.addClass(n,r[6])):i.hasClass(n,r[6])?(i.removeClass(n,r[6]),i.addClass(n,r[5])):i.hasClass(n,r[5])?(i.removeClass(n,r[5]),i.addClass(n,r[4])):i.hasClass(n,r[4])?(i.removeClass(n,r[4]),i.addClass(n,r[3])):i.hasClass(n,r[3])?(i.removeClass(n,r[3]),i.addClass(n,r[2])):i.hasClass(n,r[2])?(i.removeClass(n,r[2]),i.addClass(n,r[1])):i.hasClass(n,r[1])&&(i.removeClass(n,r[1]),i.addClass(n,r[0])),i.hasClass(o,r[0])?(i.removeClass(o,r[0]),i.addClass(o,r[1])):i.hasClass(o,r[1])?(i.removeClass(o,r[1]),i.addClass(o,r[2])):i.hasClass(o,r[2])?(i.removeClass(o,r[2]),i.addClass(o,r[3])):i.hasClass(o,r[3])?(i.removeClass(o,r[3]),i.addClass(o,r[4])):i.hasClass(o,r[4])?(i.removeClass(o,r[4]),i.addClass(o,r[5])):i.hasClass(o,r[5])?(i.removeClass(o,r[5]),i.addClass(o,r[6])):i.hasClass(o,r[6])?(i.removeClass(o,r[6]),i.addClass(o,r[7])):i.hasClass(o,r[7])?(i.removeClass(o,r[7]),i.addClass(o,r[8])):i.hasClass(o,r[8])?(i.removeClass(o,r[8]),i.addClass(o,r[9])):i.hasClass(o,r[9])?(i.removeClass(o,r[9]),i.addClass(o,r[10])):i.hasClass(o,r[10])&&(i.removeClass(o,r[10]),i.addClass(o,r[11])),this.builder.opts.onChange()}}removeRow(){let t,e=this.util,i=this.dom,n=e.cellSelected();t=n?n.parentNode:e.rowSelected(),t&&(i.removeClass(t,"row-outline"),e.confirm(e.out("Are you sure you want to delete this block?"),(t=>{let i,n=e.cellSelected();i=n?n.parentNode:e.rowSelected(),i&&t&&(this.builder.uo.saveForUndo(),i.parentNode.removeChild(i),e.checkEmpty(),e.clearActiveCell(),this.builder.opts.onChange())})))}moveRowUp(){let t,e=this.util,i=this.dom,n=e.cellSelected();if(t=n?n.parentNode:e.rowSelected(),t)if(i.removeClass(t,"row-outline"),t.previousElementSibling)this.builder.uo.saveForUndo(),t.parentNode.insertBefore(t,t.previousElementSibling),this.rowTool.position(t),this.builder.opts.onChange(),this.builder.win.builderRuntime&&this.builder.win.builderRuntime.reinitialize(t);else{let n=t.parentNode,o=null;const s=document.querySelectorAll(this.builder.opts.container);Array.prototype.forEach.call(s,(s=>{if(s.innerHTML===n.innerHTML&&o)return i.moveAfter(t,o.lastChild),this.rowTool.position(t),e.checkEmpty(),this.builder.opts.onChange(),!1;o=s}))}}moveRowDown(){let t,e=this.util,i=this.dom,n=e.cellSelected();if(t=n?n.parentNode:e.rowSelected(),t)if(i.removeClass(t,"row-outline"),t.nextElementSibling)this.builder.uo.saveForUndo(),t.parentNode.insertBefore(t.nextElementSibling,t),this.rowTool.position(t),this.builder.opts.onChange(),this.builder.win.builderRuntime&&this.builder.win.builderRuntime.reinitialize(t);else{let i=t.parentNode,n=!1;const o=document.querySelectorAll(this.builder.opts.container);Array.prototype.forEach.call(o,(o=>{if(n)return o.insertBefore(t,o.firstChild),this.rowTool.position(t),e.checkEmpty(),this.builder.opts.onChange(),!1;o.innerHTML===i.innerHTML&&(n=!0)}))}}duplicateRow(){let t,e=this.builder,i=this.util,n=this.dom,o=i.cellSelected();if(t=o?o.parentNode:i.rowSelected(),!t)return;n.removeClass(t,"row-outline"),this.builder.uo.saveForUndo();const s=t.cloneNode(!0);s.removeChild(s.querySelector(".is-row-tool")),s.removeChild(s.querySelector(".is-col-tool"));let l=n.elementChildren(s);l.forEach((t=>{t.removeAttribute("data-click"),t.classList.contains("cell-active")&&(e.activeCol=t)})),n.moveAfter(s,t),n.removeClass(t,"row-active"),n.removeClass(t,"row-outline"),l=n.elementChildren(t),l.forEach((t=>{n.removeClass(t,"cell-active")}));let a=this.builder.doc.querySelector(".builder-active");e.applyBehaviorOn(a),this.rowTool.position(s),this.builder.opts.onChange(),this.builder.win.builderRuntime&&this.builder.win.builderRuntime.reinitialize(s),this.builder.makeSortable(s)}}class Oo{constructor(t){this.builder=t;const e=this.builder.dom;this.dom=e}position(t){let e=this.dom;const i=this.builder.builderStuff;let n=t.querySelector(".is-row-tool"),o=i.querySelector(".rowmore");if(!o)return;e.addClass(o,"transition1");const s=n.querySelector(".row-more"),l=this.builder.util.getElementPosition(s);let a=l.top+window.pageYOffset,r=l.left+window.pageXOffset;o.style.top=a-8+"px",e.removeClass(o,"arrow-bottom"),e.removeClass(o,"arrow-left"),e.removeClass(o,"arrow-right"),e.removeClass(o,"center"),e.removeClass(o,"right"),e.removeClass(o,"left"),"right"===this.builder.opts.rowTool?(o.style.left=r-o.offsetWidth-10+"px",e.addClass(o,"arrow-right"),e.addClass(o,"left")):(o.style.left=r+35+"px",e.addClass(o,"arrow-left"),e.addClass(o,"left")),setTimeout((()=>{e.removeClass(o,"transition1")}),300)}}class zo{constructor(t={}){this.opts=t,this.dragStart=this.dragStart.bind(this),this.dragEnd=this.dragEnd.bind(this),this.drag=this.drag.bind(this);const e=document.querySelectorAll(this.opts.selector);Array.prototype.forEach.call(e,(t=>{t.setAttribute("draggable",""),t.addEventListener("mousedown",this.dragStart,!1),t.addEventListener("touchstart",this.dragStart,{passive:!0}),t.addEventListener("mouseup",this.dragEnd,!1),t.addEventListener("touchend",this.dragEnd,!1)}))}dragStart(t){const e=t.target.closest("[draggable]");if(!e)return;if("touchstart"===t.type&&1!==t.touches.length)return;if("mousedown"===t.type&&0!==t.button)return;let i,n,o,s;e.parentNode.style.transition="none",this.dragActive=!0,this.activeDraggableBox=e.parentElement,this.activeDraggableBox.getAttribute("data-xOffset")?i=this.activeDraggableBox.getAttribute("data-xOffset"):(this.activeDraggableBox.setAttribute("data-xOffset",0),i=0),this.activeDraggableBox.getAttribute("data-yOffset")?n=this.activeDraggableBox.getAttribute("data-yOffset"):(this.activeDraggableBox.setAttribute("data-yOffset",0),n=0),"touchstart"===t.type?(o=t.touches[0].clientX-i,s=t.touches[0].clientY-n):(o=t.clientX-i,s=t.clientY-n),this.activeDraggableBox.setAttribute("data-initialX",o),this.activeDraggableBox.setAttribute("data-initialY",s),document.addEventListener("touchmove",this.drag,!1),document.addEventListener("mousemove",this.drag,!1)}dragEnd(t){const e=t.target.closest("[draggable]");if(!e)return;if(!this.activeDraggableBox)return;e.parentNode.style.transition="";let i=this.activeDraggableBox.getAttribute("data-currentX"),n=this.activeDraggableBox.getAttribute("data-currentY");this.activeDraggableBox.setAttribute("data-initialX",i),this.activeDraggableBox.setAttribute("data-initialY",n),this.dragActive=!1,document.removeEventListener("touchmove",this.drag),document.removeEventListener("mousemove",this.drag)}drag(t){if(this.dragActive){t.preventDefault();let e,i,n=this.activeDraggableBox.getAttribute("data-initialX"),o=this.activeDraggableBox.getAttribute("data-initialY");"touchmove"===t.type?(e=t.touches[0].clientX-n,i=t.touches[0].clientY-o):(e=t.clientX-n,i=t.clientY-o),this.activeDraggableBox.style.transform="translate3d("+e+"px, "+i+"px, 0)",this.activeDraggableBox.setAttribute("data-currentX",e),this.activeDraggableBox.setAttribute("data-currentY",i);let s=e,l=i;this.activeDraggableBox.setAttribute("data-xOffset",s),this.activeDraggableBox.setAttribute("data-yOffset",l)}}}class Bo{constructor(t,e={}){this.select=document.querySelector(t);""===this.select.innerHTML.trim()&&(this.select.innerHTML='\n <div class="select-styled" tabindex="0">\n <span></span>\n <span><svg><use xlink:href="#icon-chevron-down"></use></svg></span>\n </div>\n <input type="text">\n <ul class="select-options" aria-haspopup="listbox">\n </ul>\n '),this.select.setAttribute("role","combobox"),this.select.classList.add("custom-select"),this.selectStyled=this.select.querySelector(".select-styled"),this.selectOptions=this.select.querySelector(".select-options"),this.selectSearch=this.select.querySelector("input"),this.selectSearch.setAttribute("id",`__${this.uniqueId()}`);this.config={search:!0,...e},this.config.search&&this.select.classList.add("has-search"),this.config.data&&(this.selectOptions.innerHTML="",this.config.data.forEach((t=>{const e=document.createElement("li");e.setAttribute("data-value",t.value),e.innerHTML=t.label,this.selectOptions.appendChild(e)}))),this.selectStyled.addEventListener("keydown",this.handleKeydown.bind(this)),this.selectStyled.addEventListener("click",this.toggleOptions.bind(this)),this.selectOptions.addEventListener("click",this.handleOptionClick.bind(this)),this.selectSearch.addEventListener("input",this.handleFilterInput.bind(this))}handleKeydown(t){if(!this.selectOptions.classList.contains("active"))switch(t.key){case"Enter":case" ":this.openOptions(),t.preventDefault()}}toggleOptions(){this.selectOptions.classList.contains("active")?this.closeOptions():this.openOptions()}openOptions(){this.clearFilter(),this.selectOptions.classList.add("active"),this.selectStyled.setAttribute("aria-expanded","true"),setTimeout((()=>{document.addEventListener("keydown",this.AA=t=>{this.handleGlobalKeydown(t)}),document.addEventListener("click",this.BB=t=>{this.handleGlobalClick(t)}),this.config.search&&this.selectSearch.focus()}),100),this.config.search&&(this.selectSearch.style.display="block");const t=this.select.getAttribute("data-value");this.selectOptions.querySelectorAll("li").forEach((e=>{t===e.getAttribute("data-value")?(e.classList.add("selected"),e.scrollIntoView()):e.classList.remove("selected")}))}closeOptions(){this.selectOptions.classList.remove("active"),this.selectStyled.setAttribute("aria-expanded","false"),document.removeEventListener("keydown",this.AA),document.removeEventListener("click",this.BB),this.selectSearch.style.display="none"}handleGlobalClick(t){const e=t.target;this.select.contains(e)||(this.closeOptions(),this.selectStyled.blur())}handleGlobalKeydown(t){if(this.selectOptions.classList.contains("active")){const e=this.selectOptions.querySelectorAll("li"),i=Array.from(e).findIndex((t=>t.classList.contains("selected")));let n;switch(t.key){case"ArrowUp":n=this.findPreviousVisibleIndex(e,i),this.highlightOption(e,n),t.preventDefault();break;case"ArrowDown":n=this.findNextVisibleIndex(e,i),this.highlightOption(e,n);break;case"Enter":-1!==i&&(this.selectOption(e[i]),this.selectStyled.focus());break;case"Escape":case"Tab":this.closeOptions(),this.selectStyled.focus()}}}highlightOption(t,e){t.forEach((t=>t.classList.remove("selected"))),e<0?e=t.length-1:e>=t.length&&(e=0),t[e].classList.add("selected"),t[e].scrollIntoView({block:"nearest",inline:"start"})}handleOptionClick(t){this.selectOptions.querySelectorAll("li").forEach((t=>t.classList.remove("selected")));const e=t.target.closest("li");e&&(this.selectOption(e),this.selectStyled.focus(),e.classList.add("selected"))}selectOption(t){const e=t.getAttribute("data-value");this.select.setAttribute("data-value",e);this.selectOptions.querySelectorAll("li").forEach((t=>{if(e===t.getAttribute("data-value")){this.selectStyled.querySelector("span").innerHTML=t.innerHTML}})),this.closeOptions(),this.config.onChange&&this.config.onChange(e)}setValue(t){this.select.setAttribute("data-value",t);this.selectOptions.querySelectorAll("li").forEach((e=>{if(t===e.getAttribute("data-value")){e.classList.add("selected");this.selectStyled.querySelector("span").innerHTML=e.innerHTML}else e.classList.remove("selected")}))}getValue(){return this.select.getAttribute("data-value")}clearFilter(){this.selectSearch.value="";this.selectOptions.querySelectorAll("li").forEach((t=>{t.style.display="flex"}))}handleFilterInput(){if(this.selectOptions.classList.contains("active")){const t=this.selectSearch.value.toLowerCase(),e=this.selectOptions.querySelectorAll("li");e.forEach((t=>t.classList.remove("selected")));let i=[];e.forEach((e=>{e.getAttribute("data-value").includes(t)?(e.style.display="flex",i.push(e)):e.style.display="none"})),i.length>0?this.highlightOption(i,0):this.clearFilter()}}findNextVisibleIndex(t,e){let i=e+1;for(;i<t.length;){if("none"!==t[i].style.display)return i;i++}return e}findPreviousVisibleIndex(t,e){let i=e-1;for(;i>=0;){if("none"!==t[i].style.display)return i;i--}return e}uniqueId(){let t="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(let i=0;i<2;i++)t+=e.charAt(Math.floor(Math.random()*e.length));let i="",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let t=0;t<5;t++)i+=n.charAt(Math.floor(Math.random()*n.length));return t+i}}const Io=(t,e)=>{const i=t.util,n=t.builderStuff,o=t.dom;let s="",l=t.opts.sidePanel;if("#divSnippetList"===t.opts.snippetList){const e=`<div id="divSnippetList" class="is-side ${"right"===l?"":" fromleft"} snippetlist scroll-darker" tabindex="-1" role="dialog" aria-modal="true" title="${i.out("Snippets")}">\n </div>`;o.appendHtml(n,e),t.opts.snippetHandle||(s="display:none;")}else s="display:none;",l="left";let a="";a=t.opts.emailMode?t.opts.defaultEmailSnippetCategory:t.opts.defaultSnippetCategory;let r='\n <div style="position:absolute;top:0;right:0;padding: 0;width:100%;z-index:2;">\n <div class="inp-snippets">\n </div>\n </div>\n\n '+("right"===l?'<div id="divSnippetScrollUp" role="button" tabindex="-1" style="top:calc(50% - 27px);right:25px;">▲</div><div id="divSnippetScrollDown" role="button" tabindex="-1" style="top:calc(50% + 27px);right:25px;">▼</div><div id="divSnippetHandle" role="button" tabindex="-1" title="'+i.out("Snippets")+'" data-title="'+i.out("Snippets")+'" style="'+s+'"><svg class="is-icon-flex"><use xlink:href="#ion-ios-arrow-left"></use></svg></div>':'<div id="divSnippetScrollUp" role="button" tabindex="-1" style="top:calc(50% - 27px);left:10px;">▲</div><div id="divSnippetScrollDown" role="button" tabindex="-1" style="top:calc(50% + 27px);left:10px;">▼</div><div id="divSnippetHandle" role="button" tabindex="-1" title="'+i.out("Snippets")+'" data-title="'+i.out("Snippets")+'" style="'+s+'"><svg class="is-icon-flex"><use xlink:href="#ion-ios-arrow-right"></use></svg></div>')+'<div class="is-design-list" tabindex="0"></div>';if(t.opts.snippetModal){t.opts.snippetList="#divSnippetWindow";let e=`\n <div class="is-modal active is-modal-content snippetwindow scroll-darker" tabindex="-1" role="dialog" aria-modal="true">\n <div class="is-modal-bar is-draggable">\n <button class="is-modal-close" tabindex="-1" title="${i.out("Close")}">✕</button>\n </div>\n <div id="divSnippetWindow">\n </div> \n </div>\n `,n=t.builderStuff.querySelector(".is-modal.snippetwindow");n||(o.appendHtml(t.builderStuff,e),n=t.builderStuff.querySelector(".is-modal.snippetwindow")),t.draggable(".snippetwindow .is-draggable");n.querySelector(".is-modal-close").addEventListener("click",(()=>{t.doc.activeElement.blur(),n.setAttribute("aria-hidden",!0),n.classList.remove("active")})),t.snippetModalLeft&&n.classList.add("left")}let c=document.querySelector(t.opts.snippetList);c.innerHTML="",o.appendHtml(c,r);const u=[];t.opts.snippetCategories.forEach((t=>{const e={};e.value=t[0],e.label=i.out(t[1]),u.push(e)}));const d=new Bo(".inp-snippets",{data:u,search:!1,onChange:e=>{let n=e,s=b.querySelectorAll(".snippet-item"),l=!1;Array.prototype.forEach.call(s,(t=>{t.getAttribute("data-cat")===n&&(l=!0)})),l||t.opts.snippetJSON.snippets.forEach((t=>{t.category===n&&o.appendHtml(b,'<div class="snippet-item" data-id="'+t.id+'" data-cat="'+t.category+'"><img alt="'+i.out("Snippet")+'" alt="" src="'+h+t.thumbnail+'"><span class="is-overlay"></span></div>')})),n&&(Array.prototype.forEach.call(s,(t=>{o.addClass(t,"hide")})),Array.prototype.forEach.call(s,(t=>{t.getAttribute("data-cat")===n&&(t.className=t.className.replace(/hide/g,""))})))}});d.setValue(a+""),d.closeOptions(),"#divSnippetList"===t.opts.snippetList&&(c.querySelector(".is-design-list").style.display="none",t.doc.addEventListener("click",t.doHideSnippetHandler=e=>{var i=(e=e||window.event).target||e.srcElement;if("auto"===t.opts.snippetsSidebarDisplay&&o.hasClass(c,"active")){o.parentsHasClass(i,"is-builder")&&function(t){const e=t.dom;let i=document.querySelector("#divSnippetList");const n=i.querySelector("#divSnippetHandle");e.removeClass(i,"active"),"right"===t.opts.sidePanel?n.innerHTML='<svg class="is-icon-flex" style="width:17px;height:17px;"><use xlink:href="#ion-ios-arrow-left"></use></svg>':n.innerHTML='<svg class="is-icon-flex" style="width:17px;height:17px;"><use xlink:href="#ion-ios-arrow-right"></use></svg>';setTimeout((()=>{i.querySelector(".is-design-list").style.display="none"}),300)}
|
|
20
20
|
/*!
|
|
21
21
|
* Cropper.js v1.5.12
|
|
22
22
|
* https://fengyuanchen.github.io/cropperjs
|