@innovastudio/contentbuilder 1.5.76 → 1.5.77

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ var ContentBuilder=function(){"use strict";class t{constructor(t){this.builder=t
4
4
  * @author RubaXa <trash@rubaxa.org>
5
5
  * @author owenm <owen23355@gmail.com>
6
6
  * @license MIT
7
- */function i(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function n(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?i(Object(n),!0).forEach((function(e){s(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function s(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function l(){return l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},l.apply(this,arguments)}function a(t,e){if(null==t)return{};var i,n,o=function(t,e){if(null==t)return{};var i,n,o={},s=Object.keys(t);for(n=0;n<s.length;n++)i=s[n],e.indexOf(i)>=0||(o[i]=t[i]);return o}(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(n=0;n<s.length;n++)i=s[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(o[i]=t[i])}return o}function r(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var c=r(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),u=r(/Edge/i),d=r(/firefox/i),b=r(/safari/i)&&!r(/chrome/i)&&!r(/android/i),h=r(/iP(ad|od|hone)/i),p=r(/chrome/i)&&r(/android/i),g={capture:!1,passive:!1};function m(t,e,i){t.addEventListener(e,i,!c&&g)}function f(t,e,i){t.removeEventListener(e,i,!c&&g)}function v(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function y(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function x(t,e,i,n){if(t){i=i||document;do{if(null!=e&&(">"===e[0]?t.parentNode===i&&v(t,e):v(t,e))||n&&t===i)return t;if(t===i)break}while(t=y(t))}return null}var w,S=/\s+/g;function k(t,e,i){if(t&&e)if(t.classList)t.classList[i?"add":"remove"](e);else{var n=(" "+t.className+" ").replace(S," ").replace(" "+e+" "," ");t.className=(n+(i?" "+e:"")).replace(S," ")}}function _(t,e,i){var n=t&&t.style;if(n){if(void 0===i)return document.defaultView&&document.defaultView.getComputedStyle?i=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(i=t.currentStyle),void 0===e?i:i[e];e in n||-1!==e.indexOf("webkit")||(e="-webkit-"+e),n[e]=i+("string"==typeof i?"":"px")}}function C(t,e){var i="";if("string"==typeof t)i=t;else do{var n=_(t,"transform");n&&"none"!==n&&(i=n+" "+i)}while(!e&&(t=t.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(i)}function E(t,e,i){if(t){var n=t.getElementsByTagName(e),o=0,s=n.length;if(i)for(;o<s;o++)i(n[o],o);return n}return[]}function L(){var t=document.scrollingElement;return t||document.documentElement}function A(t,e,i,n,o){if(t.getBoundingClientRect||t===window){var s,l,a,r,u,d,b;if(t!==window&&t.parentNode&&t!==L()?(l=(s=t.getBoundingClientRect()).top,a=s.left,r=s.bottom,u=s.right,d=s.height,b=s.width):(l=0,a=0,r=window.innerHeight,u=window.innerWidth,d=window.innerHeight,b=window.innerWidth),(e||i)&&t!==window&&(o=o||t.parentNode,!c))do{if(o&&o.getBoundingClientRect&&("none"!==_(o,"transform")||i&&"static"!==_(o,"position"))){var h=o.getBoundingClientRect();l-=h.top+parseInt(_(o,"border-top-width")),a-=h.left+parseInt(_(o,"border-left-width")),r=l+s.height,u=a+s.width;break}}while(o=o.parentNode);if(n&&t!==window){var p=C(o||t),g=p&&p.a,m=p&&p.d;p&&(r=(l/=m)+(d/=m),u=(a/=g)+(b/=g))}return{top:l,left:a,bottom:r,right:u,width:b,height:d}}}function q(t,e,i){for(var n=I(t,!0),o=A(t)[e];n;){var s=A(n)[i];if(!("top"===i||"left"===i?o>=s:o<=s))return n;if(n===L())break;n=I(n,!1)}return!1}function T(t,e,i,n){for(var o=0,s=0,l=t.children;s<l.length;){if("none"!==l[s].style.display&&l[s]!==Dt.ghost&&(n||l[s]!==Dt.dragged)&&x(l[s],i.draggable,t,!1)){if(o===e)return l[s];o++}s++}return null}function M(t,e){for(var i=t.lastElementChild;i&&(i===Dt.ghost||"none"===_(i,"display")||e&&!v(i,e));)i=i.previousElementSibling;return i||null}function O(t,e){var i=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||t===Dt.clone||e&&!v(t,e)||i++;return i}function R(t){var e=0,i=0,n=L();if(t)do{var o=C(t),s=o.a,l=o.d;e+=t.scrollLeft*s,i+=t.scrollTop*l}while(t!==n&&(t=t.parentNode));return[e,i]}function I(t,e){if(!t||!t.getBoundingClientRect)return L();var i=t,n=!1;do{if(i.clientWidth<i.scrollWidth||i.clientHeight<i.scrollHeight){var o=_(i);if(i.clientWidth<i.scrollWidth&&("auto"==o.overflowX||"scroll"==o.overflowX)||i.clientHeight<i.scrollHeight&&("auto"==o.overflowY||"scroll"==o.overflowY)){if(!i.getBoundingClientRect||i===document.body)return L();if(n||e)return i;n=!0}}}while(i=i.parentNode);return L()}function z(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}function B(t,e){return function(){if(!w){var i=arguments;1===i.length?t.call(this,i[0]):t.apply(this,i),w=setTimeout((function(){w=void 0}),e)}}}function N(t,e,i){t.scrollLeft+=e,t.scrollTop+=i}function D(t){var e=window.Polymer,i=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):i?i(t).clone(!0)[0]:t.cloneNode(!0)}function P(t,e,i){var n={};return Array.from(t.children).forEach((function(o){var s,l,a,r;if(x(o,e.draggable,t,!1)&&!o.animated&&o!==i){var c=A(o);n.left=Math.min(null!==(s=n.left)&&void 0!==s?s:1/0,c.left),n.top=Math.min(null!==(l=n.top)&&void 0!==l?l:1/0,c.top),n.right=Math.max(null!==(a=n.right)&&void 0!==a?a:-1/0,c.right),n.bottom=Math.max(null!==(r=n.bottom)&&void 0!==r?r:-1/0,c.bottom)}})),n.width=n.right-n.left,n.height=n.bottom-n.top,n.x=n.left,n.y=n.top,n}var $="Sortable"+(new Date).getTime();function H(){var t,e=[];return{captureAnimationState:function(){(e=[],this.options.animation)&&[].slice.call(this.el.children).forEach((function(t){if("none"!==_(t,"display")&&t!==Dt.ghost){e.push({target:t,rect:A(t)});var i=n({},e[e.length-1].rect);if(t.thisAnimationDuration){var o=C(t,!0);o&&(i.top-=o.f,i.left-=o.e)}t.fromRect=i}}))},addAnimationState:function(t){e.push(t)},removeAnimationState:function(t){e.splice(function(t,e){for(var i in t)if(t.hasOwnProperty(i))for(var n in e)if(e.hasOwnProperty(n)&&e[n]===t[i][n])return Number(i);return-1}(e,{target:t}),1)},animateAll:function(i){var n=this;if(!this.options.animation)return clearTimeout(t),void("function"==typeof i&&i());var o=!1,s=0;e.forEach((function(t){var e=0,i=t.target,l=i.fromRect,a=A(i),r=i.prevFromRect,c=i.prevToRect,u=t.rect,d=C(i,!0);d&&(a.top-=d.f,a.left-=d.e),i.toRect=a,i.thisAnimationDuration&&z(r,a)&&!z(l,a)&&(u.top-a.top)/(u.left-a.left)==(l.top-a.top)/(l.left-a.left)&&(e=function(t,e,i,n){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-i.top,2)+Math.pow(e.left-i.left,2))*n.animation}(u,r,c,n.options)),z(a,l)||(i.prevFromRect=l,i.prevToRect=a,e||(e=n.options.animation),n.animate(i,u,a,e)),e&&(o=!0,s=Math.max(s,e),clearTimeout(i.animationResetTimer),i.animationResetTimer=setTimeout((function(){i.animationTime=0,i.prevFromRect=null,i.fromRect=null,i.prevToRect=null,i.thisAnimationDuration=null}),e),i.thisAnimationDuration=e)})),clearTimeout(t),o?t=setTimeout((function(){"function"==typeof i&&i()}),s):"function"==typeof i&&i(),e=[]},animate:function(t,e,i,n){if(n){_(t,"transition",""),_(t,"transform","");var o=C(this.el),s=o&&o.a,l=o&&o.d,a=(e.left-i.left)/(s||1),r=(e.top-i.top)/(l||1);t.animatingX=!!a,t.animatingY=!!r,_(t,"transform","translate3d("+a+"px,"+r+"px,0)"),this.forRepaintDummy=function(t){return t.offsetWidth}(t),_(t,"transition","transform "+n+"ms"+(this.options.easing?" "+this.options.easing:"")),_(t,"transform","translate3d(0,0,0)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){_(t,"transition",""),_(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1}),n)}}}}var F=[],j={initializeByDefault:!0},U={mount:function(t){for(var e in j)j.hasOwnProperty(e)&&!(e in t)&&(t[e]=j[e]);F.forEach((function(e){if(e.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")})),F.push(t)},pluginEvent:function(t,e,i){var o=this;this.eventCanceled=!1,i.cancel=function(){o.eventCanceled=!0};var s=t+"Global";F.forEach((function(o){e[o.pluginName]&&(e[o.pluginName][s]&&e[o.pluginName][s](n({sortable:e},i)),e.options[o.pluginName]&&e[o.pluginName][t]&&e[o.pluginName][t](n({sortable:e},i)))}))},initializePlugins:function(t,e,i,n){for(var o in F.forEach((function(n){var o=n.pluginName;if(t.options[o]||n.initializeByDefault){var s=new n(t,e,t.options);s.sortable=t,s.options=t.options,t[o]=s,l(i,s.defaults)}})),t.options)if(t.options.hasOwnProperty(o)){var s=this.modifyOption(t,o,t.options[o]);void 0!==s&&(t.options[o]=s)}},getEventProperties:function(t,e){var i={};return F.forEach((function(n){"function"==typeof n.eventProperties&&l(i,n.eventProperties.call(e[n.pluginName],t))})),i},modifyOption:function(t,e,i){var n;return F.forEach((function(o){t[o.pluginName]&&o.optionListeners&&"function"==typeof o.optionListeners[e]&&(n=o.optionListeners[e].call(t[o.pluginName],i))})),n}};var W=["evt"],G=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.evt,s=a(i,W);U.pluginEvent.bind(Dt)(t,e,n({dragEl:Y,parentEl:X,ghostEl:Z,rootEl:K,nextEl:Q,lastDownEl:J,cloneEl:tt,cloneHidden:et,dragStarted:pt,putSortable:at,activeSortable:Dt.active,originalEvent:o,oldIndex:it,oldDraggableIndex:ot,newIndex:nt,newDraggableIndex:st,hideGhostForTarget:It,unhideGhostForTarget:zt,cloneNowHidden:function(){et=!0},cloneNowShown:function(){et=!1},dispatchSortableEvent:function(t){V({sortable:e,name:t,originalEvent:o})}},s))};function V(t){!function(t){var e=t.sortable,i=t.rootEl,o=t.name,s=t.targetEl,l=t.cloneEl,a=t.toEl,r=t.fromEl,d=t.oldIndex,b=t.newIndex,h=t.oldDraggableIndex,p=t.newDraggableIndex,g=t.originalEvent,m=t.putSortable,f=t.extraEventProperties;if(e=e||i&&i[$]){var v,y=e.options,x="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||c||u?(v=document.createEvent("Event")).initEvent(o,!0,!0):v=new CustomEvent(o,{bubbles:!0,cancelable:!0}),v.to=a||i,v.from=r||i,v.item=s||i,v.clone=l,v.oldIndex=d,v.newIndex=b,v.oldDraggableIndex=h,v.newDraggableIndex=p,v.originalEvent=g,v.pullMode=m?m.lastPutMode:void 0;var w=n(n({},f),U.getEventProperties(o,e));for(var S in w)v[S]=w[S];i&&i.dispatchEvent(v),y[x]&&y[x].call(e,v)}}(n({putSortable:at,cloneEl:tt,targetEl:Y,rootEl:K,oldIndex:it,oldDraggableIndex:ot,newIndex:nt,newDraggableIndex:st},t))}var Y,X,Z,K,Q,J,tt,et,it,nt,ot,st,lt,at,rt,ct,ut,dt,bt,ht,pt,gt,mt,ft,vt,yt=!1,xt=!1,wt=[],St=!1,kt=!1,_t=[],Ct=!1,Et=[],Lt="undefined"!=typeof document,At=h,qt=u||c?"cssFloat":"float",Tt=Lt&&!p&&!h&&"draggable"in document.createElement("div"),Mt=function(){if(Lt){if(c)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),Ot=function(t,e){var i=_(t),n=parseInt(i.width)-parseInt(i.paddingLeft)-parseInt(i.paddingRight)-parseInt(i.borderLeftWidth)-parseInt(i.borderRightWidth),o=T(t,0,e),s=T(t,1,e),l=o&&_(o),a=s&&_(s),r=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+A(o).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+A(s).width;if("flex"===i.display)return"column"===i.flexDirection||"column-reverse"===i.flexDirection?"vertical":"horizontal";if("grid"===i.display)return i.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&l.float&&"none"!==l.float){var u="left"===l.float?"left":"right";return!s||"both"!==a.clear&&a.clear!==u?"horizontal":"vertical"}return o&&("block"===l.display||"flex"===l.display||"table"===l.display||"grid"===l.display||r>=n&&"none"===i[qt]||s&&"none"===i[qt]&&r+c>n)?"vertical":"horizontal"},Rt=function(t){function e(t,i){return function(n,o,s,l){var a=n.options.group.name&&o.options.group.name&&n.options.group.name===o.options.group.name;if(null==t&&(i||a))return!0;if(null==t||!1===t)return!1;if(i&&"clone"===t)return t;if("function"==typeof t)return e(t(n,o,s,l),i)(n,o,s,l);var r=(i?n:o).options.group.name;return!0===t||"string"==typeof t&&t===r||t.join&&t.indexOf(r)>-1}}var i={},n=t.group;n&&"object"==o(n)||(n={name:n}),i.name=n.name,i.checkPull=e(n.pull,!0),i.checkPut=e(n.put),i.revertClone=n.revertClone,t.group=i},It=function(){!Mt&&Z&&_(Z,"display","none")},zt=function(){!Mt&&Z&&_(Z,"display","")};Lt&&!p&&document.addEventListener("click",(function(t){if(xt)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),xt=!1,!1}),!0);var Bt=function(t){if(Y){t=t.touches?t.touches[0]:t;var e=(o=t.clientX,s=t.clientY,wt.some((function(t){var e=t[$].options.emptyInsertThreshold;if(e&&!M(t)){var i=A(t),n=o>=i.left-e&&o<=i.right+e,a=s>=i.top-e&&s<=i.bottom+e;return n&&a?l=t:void 0}})),l);if(e){var i={};for(var n in t)t.hasOwnProperty(n)&&(i[n]=t[n]);i.target=i.rootEl=e,i.preventDefault=void 0,i.stopPropagation=void 0,e[$]._onDragOver(i)}}var o,s,l},Nt=function(t){Y&&Y.parentNode[$]._isOutsideThisEl(t.target)};function Dt(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=l({},e),t[$]=this;var i={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Ot(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Dt.supportPointer&&"PointerEvent"in window&&!b,emptyInsertThreshold:5};for(var n in U.initializePlugins(this,t,i),i)!(n in e)&&(e[n]=i[n]);for(var o in Rt(e),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!e.forceFallback&&Tt,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?m(t,"pointerdown",this._onTapStart):(m(t,"mousedown",this._onTapStart),m(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(m(t,"dragover",this),m(t,"dragenter",this)),wt.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),l(this,H())}function Pt(t,e,i,n,o,s,l,a){var r,d,b=t[$],h=b.options.onMove;return!window.CustomEvent||c||u?(r=document.createEvent("Event")).initEvent("move",!0,!0):r=new CustomEvent("move",{bubbles:!0,cancelable:!0}),r.to=e,r.from=t,r.dragged=i,r.draggedRect=n,r.related=o||e,r.relatedRect=s||A(e),r.willInsertAfter=a,r.originalEvent=l,t.dispatchEvent(r),h&&(d=h.call(b,r,l)),d}function $t(t){t.draggable=!1}function Ht(){Ct=!1}function Ft(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,i=e.length,n=0;i--;)n+=e.charCodeAt(i);return n.toString(36)}function jt(t){return setTimeout(t,0)}function Ut(t){return clearTimeout(t)}Dt.prototype={constructor:Dt,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(gt=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,Y):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,i=this.el,n=this.options,o=n.preventOnFilter,s=t.type,l=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,a=(l||t).target,r=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,c=n.filter;if(function(t){Et.length=0;var e=t.getElementsByTagName("input"),i=e.length;for(;i--;){var n=e[i];n.checked&&Et.push(n)}}(i),!Y&&!(/mousedown|pointerdown/.test(s)&&0!==t.button||n.disabled)&&!r.isContentEditable&&(this.nativeDraggable||!b||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=x(a,n.draggable,i,!1))&&a.animated||J===a)){if(it=O(a),ot=O(a,n.draggable),"function"==typeof c){if(c.call(this,t,a,this))return V({sortable:e,rootEl:r,name:"filter",targetEl:a,toEl:i,fromEl:i}),G("filter",e,{evt:t}),void(o&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(n){if(n=x(r,n.trim(),i,!1))return V({sortable:e,rootEl:n,name:"filter",targetEl:a,fromEl:i,toEl:i}),G("filter",e,{evt:t}),!0}))))return void(o&&t.cancelable&&t.preventDefault());n.handle&&!x(r,n.handle,i,!1)||this._prepareDragStart(t,l,a)}}},_prepareDragStart:function(t,e,i){var n,o=this,s=o.el,l=o.options,a=s.ownerDocument;if(i&&!Y&&i.parentNode===s){var r=A(i);if(K=s,X=(Y=i).parentNode,Q=Y.nextSibling,J=i,lt=l.group,Dt.dragged=Y,rt={target:Y,clientX:(e||t).clientX,clientY:(e||t).clientY},bt=rt.clientX-r.left,ht=rt.clientY-r.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,Y.style["will-change"]="all",n=function(){G("delayEnded",o,{evt:t}),Dt.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!d&&o.nativeDraggable&&(Y.draggable=!0),o._triggerDragStart(t,e),V({sortable:o,name:"choose",originalEvent:t}),k(Y,l.chosenClass,!0))},l.ignore.split(",").forEach((function(t){E(Y,t.trim(),$t)})),m(a,"dragover",Bt),m(a,"mousemove",Bt),m(a,"touchmove",Bt),m(a,"mouseup",o._onDrop),m(a,"touchend",o._onDrop),m(a,"touchcancel",o._onDrop),d&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Y.draggable=!0),G("delayStart",this,{evt:t}),!l.delay||l.delayOnTouchOnly&&!e||this.nativeDraggable&&(u||c))n();else{if(Dt.eventCanceled)return void this._onDrop();m(a,"mouseup",o._disableDelayedDrag),m(a,"touchend",o._disableDelayedDrag),m(a,"touchcancel",o._disableDelayedDrag),m(a,"mousemove",o._delayedDragTouchMoveHandler),m(a,"touchmove",o._delayedDragTouchMoveHandler),l.supportPointer&&m(a,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(n,l.delay)}}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Y&&$t(Y),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;f(t,"mouseup",this._disableDelayedDrag),f(t,"touchend",this._disableDelayedDrag),f(t,"touchcancel",this._disableDelayedDrag),f(t,"mousemove",this._delayedDragTouchMoveHandler),f(t,"touchmove",this._delayedDragTouchMoveHandler),f(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?m(document,"pointermove",this._onTouchMove):m(document,e?"touchmove":"mousemove",this._onTouchMove):(m(Y,"dragend",this),m(K,"dragstart",this._onDragStart));try{document.selection?jt((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){if(yt=!1,K&&Y){G("dragStarted",this,{evt:e}),this.nativeDraggable&&m(document,"dragover",Nt);var i=this.options;!t&&k(Y,i.dragClass,!1),k(Y,i.ghostClass,!0),Dt.active=this,t&&this._appendGhost(),V({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(ct){this._lastX=ct.clientX,this._lastY=ct.clientY,It();for(var t=document.elementFromPoint(ct.clientX,ct.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(ct.clientX,ct.clientY))!==e;)e=t;if(Y.parentNode[$]._isOutsideThisEl(t),e)do{if(e[$]){if(e[$]._onDragOver({clientX:ct.clientX,clientY:ct.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);zt()}},_onTouchMove:function(t){if(rt){var e=this.options,i=e.fallbackTolerance,n=e.fallbackOffset,o=t.touches?t.touches[0]:t,s=Z&&C(Z,!0),l=Z&&s&&s.a,a=Z&&s&&s.d,r=At&&vt&&R(vt),c=(o.clientX-rt.clientX+n.x)/(l||1)+(r?r[0]-_t[0]:0)/(l||1),u=(o.clientY-rt.clientY+n.y)/(a||1)+(r?r[1]-_t[1]:0)/(a||1);if(!Dt.active&&!yt){if(i&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))<i)return;this._onDragStart(t,!0)}if(Z){s?(s.e+=c-(ut||0),s.f+=u-(dt||0)):s={a:1,b:0,c:0,d:1,e:c,f:u};var d="matrix(".concat(s.a,",").concat(s.b,",").concat(s.c,",").concat(s.d,",").concat(s.e,",").concat(s.f,")");_(Z,"webkitTransform",d),_(Z,"mozTransform",d),_(Z,"msTransform",d),_(Z,"transform",d),ut=c,dt=u,ct=o}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!Z){var t=this.options.fallbackOnBody?document.body:K,e=A(Y,!0,At,!0,t),i=this.options;if(At){for(vt=t;"static"===_(vt,"position")&&"none"===_(vt,"transform")&&vt!==document;)vt=vt.parentNode;vt!==document.body&&vt!==document.documentElement?(vt===document&&(vt=L()),e.top+=vt.scrollTop,e.left+=vt.scrollLeft):vt=L(),_t=R(vt)}k(Z=Y.cloneNode(!0),i.ghostClass,!1),k(Z,i.fallbackClass,!0),k(Z,i.dragClass,!0),_(Z,"transition",""),_(Z,"transform",""),_(Z,"box-sizing","border-box"),_(Z,"margin",0),_(Z,"top",e.top),_(Z,"left",e.left),_(Z,"width",e.width),_(Z,"height",e.height),_(Z,"opacity","0.8"),_(Z,"position",At?"absolute":"fixed"),_(Z,"zIndex","100000"),_(Z,"pointerEvents","none"),Dt.ghost=Z,t.appendChild(Z),_(Z,"transform-origin",bt/parseInt(Z.style.width)*100+"% "+ht/parseInt(Z.style.height)*100+"%")}},_onDragStart:function(t,e){var i=this,n=t.dataTransfer,o=i.options;G("dragStart",this,{evt:t}),Dt.eventCanceled?this._onDrop():(G("setupClone",this),Dt.eventCanceled||((tt=D(Y)).removeAttribute("id"),tt.draggable=!1,tt.style["will-change"]="",this._hideClone(),k(tt,this.options.chosenClass,!1),Dt.clone=tt),i.cloneId=jt((function(){G("clone",i),Dt.eventCanceled||(i.options.removeCloneOnHide||K.insertBefore(tt,Y),i._hideClone(),V({sortable:i,name:"clone"}))})),!e&&k(Y,o.dragClass,!0),e?(xt=!0,i._loopId=setInterval(i._emulateDragOver,50)):(f(document,"mouseup",i._onDrop),f(document,"touchend",i._onDrop),f(document,"touchcancel",i._onDrop),n&&(n.effectAllowed="move",o.setData&&o.setData.call(i,n,Y)),m(document,"drop",i),_(Y,"transform","translateZ(0)")),yt=!0,i._dragStartId=jt(i._dragStarted.bind(i,e,t)),m(document,"selectstart",i),pt=!0,b&&_(document.body,"user-select","none"))},_onDragOver:function(t){var e,i,o,s,l=this.el,a=t.target,r=this.options,c=r.group,u=Dt.active,d=lt===c,b=r.sort,h=at||u,p=this,g=!1;if(!Ct){if(void 0!==t.preventDefault&&t.cancelable&&t.preventDefault(),a=x(a,r.draggable,l,!0),H("dragOver"),Dt.eventCanceled)return g;if(Y.contains(t.target)||a.animated&&a.animatingX&&a.animatingY||p._ignoreWhileAnimating===a)return j(!1);if(xt=!1,u&&!r.disabled&&(d?b||(o=X!==K):at===this||(this.lastPutMode=lt.checkPull(this,u,Y,t))&&c.checkPut(this,u,Y,t))){if(s="vertical"===this._getDirection(t,a),e=A(Y),H("dragOverValid"),Dt.eventCanceled)return g;if(o)return X=K,F(),this._hideClone(),H("revert"),Dt.eventCanceled||(Q?K.insertBefore(Y,Q):K.appendChild(Y)),j(!0);var m=M(l,r.draggable);if(!m||function(t,e,i){var n=A(M(i.el,i.options.draggable)),o=P(i.el,i.options,Z),s=10;return e?t.clientX>o.right+s||t.clientY>n.bottom&&t.clientX>n.left:t.clientY>o.bottom+s||t.clientX>n.right&&t.clientY>n.top}(t,s,this)&&!m.animated){if(m===Y)return j(!1);if(m&&l===t.target&&(a=m),a&&(i=A(a)),!1!==Pt(K,l,Y,e,a,i,t,!!a))return F(),m&&m.nextSibling?l.insertBefore(Y,m.nextSibling):l.appendChild(Y),X=l,U(),j(!0)}else if(m&&function(t,e,i){var n=A(T(i.el,0,i.options,!0)),o=P(i.el,i.options,Z),s=10;return e?t.clientX<o.left-s||t.clientY<n.top&&t.clientX<n.right:t.clientY<o.top-s||t.clientY<n.bottom&&t.clientX<n.left}(t,s,this)){var f=T(l,0,r,!0);if(f===Y)return j(!1);if(i=A(a=f),!1!==Pt(K,l,Y,e,a,i,t,!1))return F(),l.insertBefore(Y,f),X=l,U(),j(!0)}else if(a.parentNode===l){i=A(a);var v,y,w,S=Y.parentNode!==l,C=!function(t,e,i){var n=i?t.left:t.top,o=i?t.right:t.bottom,s=i?t.width:t.height,l=i?e.left:e.top,a=i?e.right:e.bottom,r=i?e.width:e.height;return n===l||o===a||n+s/2===l+r/2}(Y.animated&&Y.toRect||e,a.animated&&a.toRect||i,s),E=s?"top":"left",L=q(a,"top","top")||q(Y,"top","top"),R=L?L.scrollTop:void 0;if(gt!==a&&(y=i[E],St=!1,kt=!C&&r.invertSwap||S),v=function(t,e,i,n,o,s,l,a){var r=n?t.clientY:t.clientX,c=n?i.height:i.width,u=n?i.top:i.left,d=n?i.bottom:i.right,b=!1;if(!l)if(a&&ft<c*o){if(!St&&(1===mt?r>u+c*s/2:r<d-c*s/2)&&(St=!0),St)b=!0;else if(1===mt?r<u+ft:r>d-ft)return-mt}else if(r>u+c*(1-o)/2&&r<d-c*(1-o)/2)return function(t){return O(Y)<O(t)?1:-1}(e);if(b=b||l,b&&(r<u+c*s/2||r>d-c*s/2))return r>u+c/2?1:-1;return 0}(t,a,i,s,C?1:r.swapThreshold,null==r.invertedSwapThreshold?r.swapThreshold:r.invertedSwapThreshold,kt,gt===a),0!==v){var I=O(Y);do{I-=v,w=X.children[I]}while(w&&("none"===_(w,"display")||w===Z))}if(0===v||w===a)return j(!1);gt=a,mt=v;var z=a.nextElementSibling,B=!1,D=Pt(K,l,Y,e,a,i,t,B=1===v);if(!1!==D)return 1!==D&&-1!==D||(B=1===D),Ct=!0,setTimeout(Ht,30),F(),B&&!z?l.appendChild(Y):a.parentNode.insertBefore(Y,B?z:a),L&&N(L,0,R-L.scrollTop),X=Y.parentNode,void 0===y||kt||(ft=Math.abs(y-A(a)[E])),U(),j(!0)}if(l.contains(Y))return j(!1)}return!1}function H(r,c){G(r,p,n({evt:t,isOwner:d,axis:s?"vertical":"horizontal",revert:o,dragRect:e,targetRect:i,canSort:b,fromSortable:h,target:a,completed:j,onMove:function(i,n){return Pt(K,l,Y,e,i,A(i),t,n)},changed:U},c))}function F(){H("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function j(e){return H("dragOverCompleted",{insertion:e}),e&&(d?u._hideClone():u._showClone(p),p!==h&&(k(Y,at?at.options.ghostClass:u.options.ghostClass,!1),k(Y,r.ghostClass,!0)),at!==p&&p!==Dt.active?at=p:p===Dt.active&&at&&(at=null),h===p&&(p._ignoreWhileAnimating=a),p.animateAll((function(){H("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(a===Y&&!Y.animated||a===l&&!a.animated)&&(gt=null),r.dragoverBubble||t.rootEl||a===document||(Y.parentNode[$]._isOutsideThisEl(t.target),!e&&Bt(t)),!r.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),g=!0}function U(){nt=O(Y),st=O(Y,r.draggable),V({sortable:p,name:"change",toEl:l,newIndex:nt,newDraggableIndex:st,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){f(document,"mousemove",this._onTouchMove),f(document,"touchmove",this._onTouchMove),f(document,"pointermove",this._onTouchMove),f(document,"dragover",Bt),f(document,"mousemove",Bt),f(document,"touchmove",Bt)},_offUpEvents:function(){var t=this.el.ownerDocument;f(t,"mouseup",this._onDrop),f(t,"touchend",this._onDrop),f(t,"pointerup",this._onDrop),f(t,"touchcancel",this._onDrop),f(document,"selectstart",this)},_onDrop:function(t){var e=this.el,i=this.options;nt=O(Y),st=O(Y,i.draggable),G("drop",this,{evt:t}),X=Y&&Y.parentNode,nt=O(Y),st=O(Y,i.draggable),Dt.eventCanceled||(yt=!1,kt=!1,St=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Ut(this.cloneId),Ut(this._dragStartId),this.nativeDraggable&&(f(document,"drop",this),f(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),b&&_(document.body,"user-select",""),_(Y,"transform",""),t&&(pt&&(t.cancelable&&t.preventDefault(),!i.dropBubble&&t.stopPropagation()),Z&&Z.parentNode&&Z.parentNode.removeChild(Z),(K===X||at&&"clone"!==at.lastPutMode)&&tt&&tt.parentNode&&tt.parentNode.removeChild(tt),Y&&(this.nativeDraggable&&f(Y,"dragend",this),$t(Y),Y.style["will-change"]="",pt&&!yt&&k(Y,at?at.options.ghostClass:this.options.ghostClass,!1),k(Y,this.options.chosenClass,!1),V({sortable:this,name:"unchoose",toEl:X,newIndex:null,newDraggableIndex:null,originalEvent:t}),K!==X?(nt>=0&&(V({rootEl:X,name:"add",toEl:X,fromEl:K,originalEvent:t}),V({sortable:this,name:"remove",toEl:X,originalEvent:t}),V({rootEl:X,name:"sort",toEl:X,fromEl:K,originalEvent:t}),V({sortable:this,name:"sort",toEl:X,originalEvent:t})),at&&at.save()):nt!==it&&nt>=0&&(V({sortable:this,name:"update",toEl:X,originalEvent:t}),V({sortable:this,name:"sort",toEl:X,originalEvent:t})),Dt.active&&(null!=nt&&-1!==nt||(nt=it,st=ot),V({sortable:this,name:"end",toEl:X,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){G("nulling",this),K=Y=X=Z=Q=tt=J=et=rt=ct=pt=nt=st=it=ot=gt=mt=at=lt=Dt.dragged=Dt.ghost=Dt.clone=Dt.active=null,Et.forEach((function(t){t.checked=!0})),Et.length=ut=dt=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":Y&&(this._onDragOver(t),function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move");t.cancelable&&t.preventDefault()}(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t,e=[],i=this.el.children,n=0,o=i.length,s=this.options;n<o;n++)x(t=i[n],s.draggable,this.el,!1)&&e.push(t.getAttribute(s.dataIdAttr)||Ft(t));return e},sort:function(t,e){var i={},n=this.el;this.toArray().forEach((function(t,e){var o=n.children[e];x(o,this.options.draggable,n,!1)&&(i[t]=o)}),this),e&&this.captureAnimationState(),t.forEach((function(t){i[t]&&(n.removeChild(i[t]),n.appendChild(i[t]))})),e&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return x(t,e||this.options.draggable,this.el,!1)},option:function(t,e){var i=this.options;if(void 0===e)return i[t];var n=U.modifyOption(this,t,e);i[t]=void 0!==n?n:e,"group"===t&&Rt(i)},destroy:function(){G("destroy",this);var t=this.el;t[$]=null,f(t,"mousedown",this._onTapStart),f(t,"touchstart",this._onTapStart),f(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(f(t,"dragover",this),f(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),(function(t){t.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),wt.splice(wt.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!et){if(G("hideClone",this),Dt.eventCanceled)return;_(tt,"display","none"),this.options.removeCloneOnHide&&tt.parentNode&&tt.parentNode.removeChild(tt),et=!0}},_showClone:function(t){if("clone"===t.lastPutMode){if(et){if(G("showClone",this),Dt.eventCanceled)return;Y.parentNode!=K||this.options.group.revertClone?Q?K.insertBefore(tt,Q):K.appendChild(tt):K.insertBefore(tt,Y),this.options.group.revertClone&&this.animate(Y,tt),_(tt,"display",""),et=!1}}else this._hideClone()}},Lt&&m(document,"touchmove",(function(t){(Dt.active||yt)&&t.cancelable&&t.preventDefault()})),Dt.utils={on:m,off:f,css:_,find:E,is:function(t,e){return!!x(t,e,t,!1)},extend:function(t,e){if(t&&e)for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t},throttle:B,closest:x,toggleClass:k,clone:D,index:O,nextTick:jt,cancelNextTick:Ut,detectDirection:Ot,getChild:T},Dt.get=function(t){return t[$]},Dt.mount=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];e[0].constructor===Array&&(e=e[0]),e.forEach((function(t){if(!t.prototype||!t.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(t));t.utils&&(Dt.utils=n(n({},Dt.utils),t.utils)),U.mount(t)}))},Dt.create=function(t,e){return new Dt(t,e)},Dt.version="1.15.2";var Wt,Gt,Vt,Yt,Xt,Zt,Kt=[],Qt=!1;function Jt(){Kt.forEach((function(t){clearInterval(t.pid)})),Kt=[]}function te(){clearInterval(Zt)}var ee=B((function(t,e,i,n){if(e.scroll){var o,s=(t.touches?t.touches[0]:t).clientX,l=(t.touches?t.touches[0]:t).clientY,a=e.scrollSensitivity,r=e.scrollSpeed,c=L(),u=!1;Gt!==i&&(Gt=i,Jt(),Wt=e.scroll,o=e.scrollFn,!0===Wt&&(Wt=I(i,!0)));var d=0,b=Wt;do{var h=b,p=A(h),g=p.top,m=p.bottom,f=p.left,v=p.right,y=p.width,x=p.height,w=void 0,S=void 0,k=h.scrollWidth,C=h.scrollHeight,E=_(h),q=h.scrollLeft,T=h.scrollTop;h===c?(w=y<k&&("auto"===E.overflowX||"scroll"===E.overflowX||"visible"===E.overflowX),S=x<C&&("auto"===E.overflowY||"scroll"===E.overflowY||"visible"===E.overflowY)):(w=y<k&&("auto"===E.overflowX||"scroll"===E.overflowX),S=x<C&&("auto"===E.overflowY||"scroll"===E.overflowY));var M=w&&(Math.abs(v-s)<=a&&q+y<k)-(Math.abs(f-s)<=a&&!!q),O=S&&(Math.abs(m-l)<=a&&T+x<C)-(Math.abs(g-l)<=a&&!!T);if(!Kt[d])for(var R=0;R<=d;R++)Kt[R]||(Kt[R]={});Kt[d].vx==M&&Kt[d].vy==O&&Kt[d].el===h||(Kt[d].el=h,Kt[d].vx=M,Kt[d].vy=O,clearInterval(Kt[d].pid),0==M&&0==O||(u=!0,Kt[d].pid=setInterval(function(){n&&0===this.layer&&Dt.active._onTouchMove(Xt);var e=Kt[this.layer].vy?Kt[this.layer].vy*r:0,i=Kt[this.layer].vx?Kt[this.layer].vx*r:0;"function"==typeof o&&"continue"!==o.call(Dt.dragged.parentNode[$],i,e,t,Xt,Kt[this.layer].el)||N(Kt[this.layer].el,i,e)}.bind({layer:d}),24))),d++}while(e.bubbleScroll&&b!==c&&(b=I(b,!1)));Qt=u}}),30),ie=function(t){var e=t.originalEvent,i=t.putSortable,n=t.dragEl,o=t.activeSortable,s=t.dispatchSortableEvent,l=t.hideGhostForTarget,a=t.unhideGhostForTarget;if(e){var r=i||o;l();var c=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,u=document.elementFromPoint(c.clientX,c.clientY);a(),r&&!r.el.contains(u)&&(s("spill"),this.onSpill({dragEl:n,putSortable:i}))}};function ne(){}function oe(){}ne.prototype={startIndex:null,dragStart:function(t){var e=t.oldDraggableIndex;this.startIndex=e},onSpill:function(t){var e=t.dragEl,i=t.putSortable;this.sortable.captureAnimationState(),i&&i.captureAnimationState();var n=T(this.sortable.el,this.startIndex,this.options);n?this.sortable.el.insertBefore(e,n):this.sortable.el.appendChild(e),this.sortable.animateAll(),i&&i.animateAll()},drop:ie},l(ne,{pluginName:"revertOnSpill"}),oe.prototype={onSpill:function(t){var e=t.dragEl,i=t.putSortable||this.sortable;i.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),i.animateAll()},drop:ie},l(oe,{pluginName:"removeOnSpill"}),Dt.mount(new function(){function t(){for(var t in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===t.charAt(0)&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}return t.prototype={dragStarted:function(t){var e=t.originalEvent;this.sortable.nativeDraggable?m(document,"dragover",this._handleAutoScroll):this.options.supportPointer?m(document,"pointermove",this._handleFallbackAutoScroll):e.touches?m(document,"touchmove",this._handleFallbackAutoScroll):m(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var e=t.originalEvent;this.options.dragOverBubble||e.rootEl||this._handleAutoScroll(e)},drop:function(){this.sortable.nativeDraggable?f(document,"dragover",this._handleAutoScroll):(f(document,"pointermove",this._handleFallbackAutoScroll),f(document,"touchmove",this._handleFallbackAutoScroll),f(document,"mousemove",this._handleFallbackAutoScroll)),te(),Jt(),clearTimeout(w),w=void 0},nulling:function(){Xt=Gt=Wt=Qt=Zt=Vt=Yt=null,Kt.length=0},_handleFallbackAutoScroll:function(t){this._handleAutoScroll(t,!0)},_handleAutoScroll:function(t,e){var i=this,n=(t.touches?t.touches[0]:t).clientX,o=(t.touches?t.touches[0]:t).clientY,s=document.elementFromPoint(n,o);if(Xt=t,e||this.options.forceAutoScrollFallback||u||c||b){ee(t,this.options,s,e);var l=I(s,!0);!Qt||Zt&&n===Vt&&o===Yt||(Zt&&te(),Zt=setInterval((function(){var s=I(document.elementFromPoint(n,o),!0);s!==l&&(l=s,Jt()),ee(t,i.options,s,e)}),10),Vt=n,Yt=o)}else{if(!this.options.bubbleScroll||I(s,!0)===L())return void Jt();ee(t,this.options,I(s,!1),!1)}}},l(t,{pluginName:"scroll",initializeByDefault:!0})}),Dt.mount(oe,ne);class se{constructor(t){this.builder=t,this.dom=this.builder.dom}cellSelected(){return this.builder.doc.querySelector(".cell-active")}rowSelected(){return this.builder.doc.querySelector(".row-active")}builderStuff(){return document.querySelector("#_cbhtml")}cellNext(t){const e=this.dom;let i=t.nextElementSibling;return i?e.hasClass(i,"is-row-tool")||e.hasClass(i,"is-col-tool")||e.hasClass(i,"is-rowadd-tool")||e.hasClass(i,"is-row-overlay")?null:i:null}out(t){if(this.builder){let e=this.builder.opts.lang[t];return e||(this.builder.checkLang&&console.log(t),t)}return t}loadLightboxFromCdn(t){const e="https://cdnjs.cloudflare.com/ajax/libs/glightbox/3.2.0/js/glightbox.min.js";if(this.isJsOnContentIncluded(e))this.builder.doc.querySelector("#_skin")||this.builder.doc.body.insertAdjacentHTML("beforeend",`<style>${this.getLightboxCss()}</style>`),t&&t();else{const i=this.builder.doc.createElement("script");i.src=e,i.async=!0,i.onload=()=>{this.loadCssOnContent("https://cdnjs.cloudflare.com/ajax/libs/glightbox/3.2.0/css/glightbox.min.css"),this.builder.doc.body.insertAdjacentHTML("beforeend",`<style id="_skin">${this.getLightboxCss()}</style>`),t&&t()},this.builder.doc.body.appendChild(i)}}loadLightboxScript(t){const e=this.builder.assetPath+"scripts/glightbox/glightbox.min.js";if(this.isJsOnContentIncluded(e))t&&t();else{const i=this.builder.doc.createElement("script");i.src=e,i.async=!0,i.onload=()=>{this.builder.GLightbox?(this.loadCssOnContent(this.builder.assetPath+"scripts/glightbox/glightbox.min.css"),this.loadCssOnContent(this.builder.assetPath+"scripts/glightbox/skin.css"),t&&t()):this.loadLightboxFromCdn(t)},this.builder.doc.body.appendChild(i),i.onerror=()=>{this.loadLightboxFromCdn(t)}}}refreshLightbox(t,e){this.builder.glightbox&&this.builder.GLightbox?(this.builder.glightbox.destroy(),this.builder.glightbox=this.builder.GLightbox(t),e&&e()):this.loadLightboxScript((()=>{this.builder.GLightbox=this.builder.win.GLightbox,this.builder.glightbox=this.builder.win.GLightbox(t),e&&e()}))}openLightbox(t,e){const i=this.builder.openMediaElm;if(this.builder.glightbox){if(this.builder.doc.body.classList.contains("glightbox-open")){this.builder.glightbox.close();let i=this.builder.doc.querySelector(".goverlay");return i&&i.click(),void setTimeout((()=>{this.openLightbox(t,e)}),400)}let n=[],o=0;if(i){const e=i.closest("[data-gallery]");let s=[];if(e)s=e.querySelectorAll(".is-lightbox"),s.forEach(((e,i)=>{let s=e.getAttribute("href");n.push({href:s}),t===s&&(o=i)}));else{this.builder.doc.querySelectorAll(".is-lightbox,.block-click").forEach((t=>{t.closest("[data-gallery]")||t.classList.contains("lightbox-all")||s.push(t)})),s.forEach(((e,i)=>{let s=e.getAttribute("href");s||(s=e.getAttribute("data-modal-url")),n.push({href:s}),t===s&&(o=i)}))}}n.length>0?(this.builder.glightbox.setElements(n),this.builder.glightbox.openAt(o)):(this.builder.glightbox.setElements([{href:t}]),this.builder.glightbox.open()),this.builder.glightbox.on("close",(()=>{this.builder.glightbox.setElements([]),this.refreshLightbox(e)}))}this.builder.openMediaElm=null}isJsOnContentIncluded(t){const e=this.builder.doc.getElementsByTagName("script");for(let i=0;i<e.length;i++)if(e[i].getAttribute("src")===t)return!0;return!1}loadCssOnContent(t){const e=this.builder.doc.createElement("link");e.href=t,e.rel="stylesheet",this.builder.doc.head.appendChild(e)}showMessage(t,e,i){const n=this.dom;let o="";o=`<div class="is-modal modalmessage" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">\n <div class="is-modal-content" style="padding-top: 15px;padding-bottom: 20px;max-width: 450px;">\n <div style="margin: 20px 0 30px;font-size: 17px;">${t}</div>\n <button title="${this.out("Ok")}" class="input-ok classic">${this.out("Ok")}</button>\n </div>\n </div>`;const s=this.builder.builderStuff;let l=s.querySelector(".modalmessage");l||(n.appendHtml(s,o),l=s.querySelector(".modalmessage")),this.showModal(l,!1,(()=>{l.parentNode.removeChild(l),i&&i()}));let a=l.querySelector(".modalmessage .input-ok");n.addEventListener(a,"click",(()=>{this.hideModal(l),l.parentNode&&l.parentNode.removeChild(l),i&&i()})),a.focus(),e&&a.classList.add("focus-outline")}showChoice(t,e,i){const n=this.dom;let o="";o=`<div class="is-modal modalmessage" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">\n <div class="is-modal-content" style="padding-top: 15px;padding-bottom: 20px;max-width: 450px;">\n <div style="margin: 20px 0 30px;font-size: 17px;">${t}</div>\n\n <div style="display:flex;">\n <button title="${this.out("Cancel")}" class="input-cancel classic-secondary" style="width:100%;margin-right:4px;">${this.out("Cancel")}</button>\n <button title="${e}" class="input-ok classic-primary" style="width:100%">${e}</button>\n </div>\n </div>\n </div>`;const s=this.builder.builderStuff;let l=s.querySelector(".modalmessage");l||(n.appendHtml(s,o),l=s.querySelector(".modalmessage")),this.showModal(l,!1,(()=>{l.parentNode.removeChild(l),i(!1)}));let a=l.querySelector(".modalmessage .input-cancel");n.addEventListener(a,"click",(()=>{this.hideModal(l),l.parentNode.removeChild(l),i(!1)})),a.focus();let r=l.querySelector(".modalmessage .input-ok");n.addEventListener(r,"click",(()=>{this.hideModal(l),l.parentNode.removeChild(l),i(!0)}))}confirm(t,e,i,n,o){if(!this.builder.deleteConfirm&&!o)return void e(!0);const s=this.dom;let l="";l=`<div class="is-modal is-confirm" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">\n <div class="is-modal-content" style="padding-bottom:20px;">\n <div style="margin: 20px 0 30px;font-size: 14px;">${t}</div>\n <button title="${this.out("Delete")}" class="input-ok classic focus-warning">${this.out("Delete")}</button>\n </div>\n </div>`,i&&(l=`<div class="is-modal is-confirm" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">\n <div class="is-modal-content" style="padding-bottom:20px;">\n <div style="margin: 20px 0 30px;font-size: 14px;">${t}</div>\n <button title="${this.out("Cancel")}" class="input-cancel classic-secondary">${this.out("Cancel")}</button>\n <button title="${n}" class="input-ok classic-primary">${n}</button>\n </div>\n </div>`);const a=this.builder.builderStuff;let r=a.querySelector(".is-confirm");r||(s.appendHtml(a,l),r=a.querySelector(".is-confirm")),this.showModal(r,!1,(()=>{r.parentNode.removeChild(r),e(!1)}),!0);let c=r.querySelector(".is-confirm .input-ok");s.addEventListener(c,"click",(()=>{this.hideModal(r),r.parentNode.removeChild(r),e(!0)}));let u=r.querySelector(".is-confirm .input-cancel");s.addEventListener(u,"click",(t=>{this.hideModal(r),r.parentNode.removeChild(r),e(!1),t.preventDefault(),t.stopImmediatePropagation()})),c&&c.focus()}showRtePop(t,e,i){const n=this.dom;t.style.display="flex",e&&e(),n.removeClass(t,"deactive"),n.addClass(t,"active");const o=e=>{t.contains(e.target)||i.contains(e.target)||e.target.closest(".pickcolormore")||(this.hideRtePop(t),t.removeEventListener("keydown",s),document.removeEventListener("mousedown",o),document.removeEventListener("touchstart",o),this.builder.iframeDocument&&(this.builder.doc.removeEventListener("mousedown",o),this.builder.doc.removeEventListener("touchstart",o)))},s=e=>{27===e.keyCode&&(this.hideRtePop(t),t.removeEventListener("keydown",s),document.removeEventListener("mousedown",o),document.removeEventListener("touchstart",o),this.builder.iframeDocument&&(this.builder.doc.removeEventListener("mousedown",o),this.builder.doc.removeEventListener("touchstart",o)))};t.addEventListener("keydown",s),document.addEventListener("mousedown",o),document.addEventListener("touchstart",o,{passive:!1}),this.builder.iframeDocument&&(this.builder.doc.addEventListener("mousedown",o),this.builder.doc.addEventListener("touchstart",o,{passive:!1}))}hideRtePop(t){const e=this.dom;t.style.display="",e.removeClass(t,"active"),e.addClass(t,"deactive")}showPopOverlay(t,e,i){const n=this.builder.builderStuff;let o=n.querySelectorAll(".is-pop-overlay");const s=this.makeId(),l=`<div class="is-pop-overlay ${s}" style="display:flex;z-index:10004"></div>`;n.insertAdjacentHTML("beforeend",l);const a=n.querySelector(`.is-pop-overlay.${s}`);0===o.length&&(t.classList.add("pop1"),a.classList.add("pop1")),1===o.length&&(t.classList.add("pop2"),a.classList.add("pop2")),2===o.length&&(t.classList.add("pop3"),a.classList.add("pop3")),4===o.length&&(t.classList.add("pop4"),a.classList.add("pop4"));const r=()=>{a.remove(),t.style.display="",t.classList.remove("active"),t.setAttribute("aria-hidden",!0),a.classList.remove("pop1"),a.classList.remove("pop2"),a.classList.remove("pop3"),a.classList.remove("pop4"),t.classList.remove("pop1"),t.classList.remove("pop2"),t.classList.remove("pop3"),t.classList.remove("pop4"),t.removeEventListener("keydown",c),e&&e(),i&&i.focus()};this.hidePopOverlay=r;const c=t=>{27===t.keyCode&&r()};a.addEventListener("click",(t=>{r(),t.preventDefault(),t.stopImmediatePropagation()})),t.style.display="flex",t.classList.add("active"),t.setAttribute("aria-hidden",!1),this.setupTabKeys(t),t.focus({preventScroll:!0}),t.addEventListener("keydown",c)}showPop(t,e,i,n){const o=this.dom;document.querySelectorAll(".is-pop.active").forEach((e=>{let n=!0;e.contains(i)&&(n=!1),e!==t&&n&&(e.style.display="",o.removeClass(e,"active"),e.setAttribute("aria-hidden",!0))})),n?this.showPopOverlay(t,e,i):(this.clearAllEventListener(t),t.style.display="flex",o.addClass(t,"active"),t.setAttribute("aria-hidden",!1),this.setupTabKeys(t),t.focus({preventScroll:!0}),this.handlePopClickOut=n=>{t.contains(n.target)||i.contains(n.target)||(this.hidePop(t),e&&e(),i&&i.focus())},this.handlePopKeyDown=n=>{27===n.keyCode&&(this.hidePop(t),e&&e(),i&&i.focus())},t.addEventListener("keydown",this.handlePopKeyDown),document.addEventListener("mousedown",this.handlePopClickOut),document.addEventListener("touchstart",this.handlePopClickOut,{passive:!1}),this.builder.iframeDocument&&(this.builder.doc.addEventListener("mousedown",this.handlePopClickOut),this.builder.doc.addEventListener("touchstart",this.handlePopClickOut,{passive:!1})))}hidePop(t){const e=this.dom;t.style.display="",e.removeClass(t,"active"),t.setAttribute("aria-hidden",!0),this.clearAllEventListener(t)}clearAllEventListener(t){for(let e=0;e<10;e++)t.removeEventListener("keydown",this.handlePopKeyDown),document.removeEventListener("mousedown",this.handlePopClickOut),document.removeEventListener("touchstart",this.handlePopClickOut,{passive:!1}),this.builder.iframeDocument&&(this.builder.doc.removeEventListener("mousedown",this.handlePopClickOut),this.builder.doc.removeEventListener("touchstart",this.handlePopClickOut,{passive:!1}))}setupTabKeys(t){let e=t.querySelectorAll('a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]):not([tabindex="-1"]), iframe, object, embed, *[tabindex]:not([tabindex="-1"])');if(0===e.length)return;let i=e[0],n=e[e.length-1];n.addEventListener("keydown",(n=>{9!==n.which||n.shiftKey||(n.preventDefault(),e=t.querySelectorAll('a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]):not([tabindex="-1"]), iframe, object, embed, *[tabindex]:not([tabindex="-1"])'),i=e[0],i.focus())})),i.addEventListener("keydown",(t=>{9===t.which&&t.shiftKey&&(t.preventDefault(),n.focus())}));t.querySelectorAll("iframe").forEach((t=>{t.addEventListener("focus",(()=>{const e=t.contentWindow.document.querySelectorAll('a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]):not([tabindex="-1"]), iframe, object, embed, *[tabindex]:not([tabindex="-1"])');if(0===e.length)return;let i=e[0];i&&i.focus()}))}))}showModal(t,e,i,n,o){const s=this.dom;s.addClass(t,"active"),t.setAttribute("aria-hidden",!1),o&&(document.body.style.overflow="hidden");const l=e=>{if(27===e.keyCode){o&&(document.body.style.overflow=""),s.hasClass(t,"active")&&this.hideModal(t),t.removeEventListener("keydown",l);const e=t.querySelector(".is-modal-close");e&&e.removeEventListener("click",u),i&&i()}};t.addEventListener("keydown",l);let a=t.querySelector(".is-tab-content.active");a?(a.focus(),this.builder.tabs.setupTabKey(a)):(this.setupTabKeys(t),t.focus());let r=!1;if(this.builder?this.builder.opts.animateModal&&(r=!0,n||(r=!1)):n&&(r=!0),r&&this.builder){const t=this.builder.doc.querySelectorAll(this.builder.opts.container);Array.prototype.forEach.call(t,(t=>{t.style.transform=`scale(${this.builder.opts.zoom-.02})`,t.style.WebkitTransform=`scale(${this.builder.opts.zoom-.02})`,t.style.MozTransform=`scale(${this.builder.opts.zoom-.02})`,t.setAttribute("scaled-down","1")}))}const c=t.querySelector(".is-modal-overlay");if(c&&c.parentNode.removeChild(c),!t.querySelector(".is-modal-overlay")){let n;if(n=e?'<div class="is-modal-overlay overlay-stay"></div>':'<div class="is-modal-overlay"></div>',t.insertAdjacentHTML("afterbegin",n),!e){let e=t.querySelector(".is-modal-overlay");s.addEventListener(e,"click",(()=>{o&&(document.body.style.overflow=""),this.hideModal(t),t.removeEventListener("keydown",l);const e=t.querySelector(".is-modal-close");e&&e.removeEventListener("click",u),i&&i()}))}}const u=()=>{o&&(document.body.style.overflow=""),s.hasClass(t,"active")&&this.hideModal(t),t.removeEventListener("keydown",l);const e=t.querySelector(".is-modal-close");e&&e.removeEventListener("click",u),i&&i()},d=t.querySelector(".is-modal-close");d&&s.addEventListener(d,"click",u)}_hideModal(t){let e=t.querySelector(".is-modal-overlay");e?e.classList.contains("overlay-stay")?(this.hideModal(t),t.dispatchEvent(new KeyboardEvent("keydown",{key:"e",keyCode:27,code:"KeyE",which:27,shiftKey:!1,ctrlKey:!1,metaKey:!1}))):e.click():(this.hideModal(t),t.dispatchEvent(new KeyboardEvent("keydown",{key:"e",keyCode:27,code:"KeyE",which:27,shiftKey:!1,ctrlKey:!1,metaKey:!1})))}hideModal(t){if(t.setAttribute("aria-hidden",!0),this.builder){const t=this.builder.doc.querySelectorAll(this.builder.opts.container);Array.prototype.forEach.call(t,(t=>{t.getAttribute("scaled-down")&&(t.style.transform=`scale(${this.builder.opts.zoom})`,t.style.WebkitTransform=`scale(${this.builder.opts.zoom})`,t.style.MozTransform=`scale(${this.builder.opts.zoom})`,t.removeAttribute("scaled-down"))}))}this.dom.removeClass(t,"active"),t.style.display=""}refreshModuleLayout(t){let e;t.style.height?e=t.style.height:t.style.height=`${t.offsetHeight}px`,t.style.opacity=0;let i=decodeURIComponent(t.getAttribute("data-html"));i=i.replace(/{id}/g,this.builder.util.makeId()),t.innerHTML="";let n=document.createRange();n.setStart(t,0),t.appendChild(n.createContextualFragment(i));let o=t.querySelectorAll("[data-subblock]");var s=1;Array.prototype.forEach.call(o,(e=>{t.getAttribute("data-html-"+s)&&(e.innerHTML=decodeURIComponent(t.getAttribute("data-html-"+s)),e.contentEditable=!0),s++})),setTimeout((()=>{t.style.height=e||"",t.style.opacity=""}),100)}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=[];const i=this.dom;return i.elementChildren(t).forEach((t=>{i.hasClass(t,"is-row-tool")||i.hasClass(t,"is-col-tool")||i.hasClass(t,"is-rowadd-tool")||i.hasClass(t,"is-row-overlay")||e.push(t)})),e}fixLayout(t){const e=this.dom;let i=!1,n=!1;if(Array.from(t.children).map((e=>{e.classList.contains("is-row-tool")||e.classList.contains("is-col-tool")||e.classList.contains("is-rowadd-tool")||(e.getAttribute("data-html")?(e.style.width||(e.style.width="50%",e.style.flex="0 0 auto"),1===this.getAllColumns(t).length&&(e.style.width="",e.style.flex="")):(e.style.width="",e.style.flex=""),e.classList.contains("sm-hidden")&&(i=!0),e.classList.contains("md-hidden")&&(n=!0))})),i?t.classList.add("sm-autofit"):t.classList.remove("sm-autofit"),n?t.classList.add("md-autofit"):t.classList.remove("md-autofit"),this.builder.useDefaultGrid){return e.elementChildren(t).forEach((t=>{e.hasClass(t,"is-row-tool")||e.hasClass(t,"is-col-tool")||e.hasClass(t,"is-rowadd-tool")||e.hasClass(t,"is-row-overlay")||this.removeColClasses(t)})),void Array.from(t.children).map((t=>{t.classList.contains("is-row-tool")||t.classList.contains("is-rowadd-tool")||t.classList.contains("is-col-tool")||t.getAttribute("data-module")&&this.refreshModuleLayout(t)}))}let o=3;t.querySelector(".is-row-overlay")&&(o=4);const s=t.childElementCount-o,l=this.builder.opts.row;let a=this.builder.opts.cols;const r=this.builder.opts.colequal;if(r.length>0){return e.elementChildren(t).forEach((t=>{if(!(e.hasClass(t,"is-row-tool")||e.hasClass(t,"is-col-tool")||e.hasClass(t,"is-rowadd-tool")||e.hasClass(t,"is-row-overlay"))){for(let i=0;i<=a.length-1;i++)e.removeClass(t,a[i]);for(let i=0;i<=r.length-1;i++)if(r[i].length===s){e.addClass(t,r[i][0]);break}1===s&&e.addClass(t,a[a.length-1])}})),void Array.from(t.children).map((t=>{t.classList.contains("is-row-tool")||t.classList.contains("is-rowadd-tool")||t.classList.contains("is-col-tool")||t.getAttribute("data-module")&&this.refreshModuleLayout(t)}))}if(""!==l&&a.length>0){let i=0;e.elementChildren(t).forEach((t=>{if(!(e.hasClass(t,"is-row-tool")||e.hasClass(t,"is-col-tool")||e.hasClass(t,"is-rowadd-tool")||e.hasClass(t,"is-row-overlay"))){-1!==t.className.indexOf("col-md-")||(-1!==t.className.indexOf("col-sm-")?a=["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!==t.className.indexOf("col-xs-")?a=["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!==t.className.indexOf("col-lg-")?a=["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!==t.className.indexOf("col-xl-")?a=["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!==t.className.indexOf("col-xxl-")&&(a=["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++;for(var n=0;n<=a.length-1;n++)e.removeClass(t,a[n]);1===s&&e.addClass(t,a[11]),2===s&&e.addClass(t,a[5]),3===s&&e.addClass(t,a[3]),4===s&&e.addClass(t,a[2]),5===s&&(5===i?e.addClass(t,a[3]):e.addClass(t,a[1])),6===s&&e.addClass(t,a[1]),7===s&&(i>=6?e.addClass(t,a[0]):e.addClass(t,a[1])),8===s&&(i>=5?e.addClass(t,a[0]):e.addClass(t,a[1])),9===s&&(i>=4?e.addClass(t,a[0]):e.addClass(t,a[1])),10===s&&(i>=3?e.addClass(t,a[0]):e.addClass(t,a[1])),11===s&&(i>=2?e.addClass(t,a[0]):e.addClass(t,a[1])),12===s&&e.addClass(t,a[0])}}))}Array.from(t.children).map((t=>{t.classList.contains("is-row-tool")||t.classList.contains("is-rowadd-tool")||t.classList.contains("is-col-tool")||t.getAttribute("data-module")&&this.refreshModuleLayout(t)}))}addContent(t,e,i){const n=this.dom;this.builder.opts.onAdd&&(t=this.builder.opts.onAdd(t));const o=this.cellSelected();let s;if(o)s=o.parentNode;else{let t=this.builder.activeElement;if(t&&t.closest(".is-block"));else{if(s=this.builder.doc.querySelector(".row-active"),!s)return;e="row"}}if("cell"===e||"cell-left"===e||"cell-right"===e){let l=4;this.builder.maxColumns&&(l=this.builder.maxColumns);let a,r=3;if(s.querySelector(".is-row-overlay")&&(r=4),s.childElementCount>=l+r)return alert(this.out("You have reached the maximum number of columns")),!1;if(this.builder.uo.saveForUndo(),""===this.builder.opts.row){let e=this.builder.opts.cellFormat,i=e.indexOf("</");t=e.substring(0,i)+t+e.substring(i),a=this.createElementFromHTML(t)}else{a=o.cloneNode(!0),a.removeAttribute("data-noedit"),a.removeAttribute("data-protected"),a.removeAttribute("data-module"),a.removeAttribute("data-module-desc"),a.removeAttribute("data-dialog-width"),a.removeAttribute("data-html"),a.removeAttribute("data-settings");for(let t=1;t<=20;t++)a.removeAttribute("data-html-"+t);a.removeAttribute("data-noedit"),n.removeClass(a,"cell-active"),n.removeClass(a,"is-light-text"),n.removeClass(a,"is-dark-text"),n.removeClass(a,"padding-0"),n.removeClass(a,"p-0"),a.removeAttribute("data-click"),a.removeAttribute("style"),i&&a.setAttribute(i,""),a.innerHTML=t}s.insertBefore(a,o),"cell"!==e&&"cell-right"!==e||n.moveAfter(a,o);let c=this.builder.doc.querySelector(".builder-active");c&&this.builder.applyBehaviorOn(c),this.fixLayout(s),a.click()}if("row"===e){let e,o;if(this.builder.uo.saveForUndo(),""===this.builder.opts.row){e=this.htmlToElement(this.builder.opts.rowFormat);let s=this.builder.opts.cellFormat,l=s.indexOf("</");t=s.substring(0,l)+t+s.substring(l);let a=n.elementChildren(e);for(;a.length>0&&(a=a[0],n.elementChildren(a).length>0);)a=n.elementChildren(a);a.innerHTML=t,o=a.firstChild,i&&o.setAttribute(i,"")}else o=n.createElement("div"),n.addClass(o,this.builder.opts.cols[this.builder.opts.cols.length-1]),o.innerHTML=t,i&&o.setAttribute(i,""),e=n.createElement("div"),n.addClass(e,this.builder.opts.row),n.appendChild(e,o);s.parentNode.insertBefore(e,s),n.moveAfter(e,s);let l=this.builder.doc.querySelector(".builder-active");l&&this.builder.applyBehaviorOn(l),o.click()}if("elm"===e){let e=this.builder.activeElement;if(!e)return;this.builder.uo.saveForUndo();let i,o=e;if(o.nextElementSibling||o.closest("[data-subblock]"))o.insertAdjacentHTML("afterend",t),i=o.nextElementSibling;else{let e,s=this.builder.activeCol;n.elementChildren(s).forEach((t=>{t.contains(o)&&(e=t)})),e&&(e.insertAdjacentHTML("afterend",t),i=e.nextElementSibling)}let s=this.builder.doc.querySelector(".builder-active");if(s&&this.builder.applyBehaviorOn(s),"img"===i.tagName.toLowerCase()){let t=setInterval((()=>{i.complete&&(i.click(),clearInterval(t))}),30)}else i.click();let l=this.builder.builderStuff.querySelector(".quickadd");this.hidePop(l)}if(this.builder.useCssClasses){let t=this.builder.doc.querySelector(".builder-active");t&&n.contentReformat(t,this.builder.cssClasses)}this.builder.opts.onChange(),this.builder.opts.onRender()}htmlToElement(t){var e=document.createElement("template");return t=t.trim(),e.innerHTML=t,e.content.firstChild}addSnippet(t,e,i){this.builder.uo.saveForUndo();const n=this.dom;let o,s,l,a=!1;let r,c=this.builder.builderStuff.querySelector(".quickadd");if(r=c?c.getAttribute("data-mode"):"row",!e||"cell"!==r&&"cell-left"!==r&&"cell-right"!==r){if(e&&"row"===r){let e;if(l=document.createElement("div"),l.className=this.builder.opts.cols[this.builder.opts.cols.length-1],l.innerHTML=t,i&&l.setAttribute("data-noedit",""),o=document.createElement("div"),o.className=this.builder.opts.row,o.appendChild(l),s=this.builder.cellSelected(),s?e=s.parentNode:(e=this.builder.doc.querySelector(".row-active"),e||(a=!0)),a){const t=this.builder.doc.querySelectorAll(".is-builder"),i=t[t.length-1],o=n.elementChildren(i);e=o[o.length-1]}e.parentNode.insertBefore(o,e),n.moveAfter(o,e);let r=this.builder.doc.querySelector(".builder-active");r||(r=this.builder.doc.querySelector(".is-builder")),this.builder.applyBehaviorOn(r),l.click(),o.className=o.className.replace("row-outline",""),this.builder.util.hideColumnTool()}else{if(e)return void(i?this.addContent(t,r,"data-noedit"):this.addContent(t,r));{var u=document.createElement("div");u.innerHTML=t;var d=u.querySelectorAll("[data-html]");if(Array.prototype.forEach.call(d,(e=>{t=(t=(t=decodeURIComponent(e.getAttribute("data-html"))).replace(/{id}/g,this.makeId())).replace(/<script>/g,""+(this.builder.nonce?`<script nonce="${this.builder.nonce}">`:"<script>"));for(var i=1;i<=20;i++)t=t.replace("[%HTML"+i+"%]",void 0===e.getAttribute("data-html-"+i)?"":decodeURIComponent(e.getAttribute("data-html-"+i)));e.innerHTML=t,e.classList.add("dummy-module")})),1===u.childNodes.length&&1===u.childNodes[0].childNodes.length&&("cell"===r||"cell-left"===r||"cell-right"===r)){const t=this.cellSelected();let e=t.parentNode,i=4;if(this.builder.maxColumns&&(i=this.builder.maxColumns),e.querySelector(".is-row-overlay")){if(e.childElementCount>=i+4)return alert(this.out("You have reached the maximum number of columns")),!1}else if(e.childElementCount>=i+3)return alert(this.out("You have reached the maximum number of columns")),!1;this.builder.uo.saveForUndo();let n=u.childNodes[0].childNodes[0];var b=document.createRange();t.parentNode.insertBefore(b.createContextualFragment(n.outerHTML),t),"cell"!==r&&"cell-right"!==r||(t.parentNode.insertBefore(t.previousElementSibling,t),t.parentNode.insertBefore(t,t.previousElementSibling));let o=this.builder.doc.querySelector(".builder-active");return o||(o=this.builder.doc.querySelector(".is-builder")),this.builder.applyBehaviorOn(o),this.fixLayout(e),"cell"===r||"cell-right"===r?t.nextElementSibling.click():t.previousElementSibling.click(),this.builder.opts.onChange(),void this.builder.opts.onRender()}let e;if(s=this.builder.activeCol,s?e=s.parentNode:(e=this.builder.doc.querySelector(".row-active"),e||(a=!0)),a){const t=this.builder.doc.querySelectorAll(".is-builder"),i=t[t.length-1],o=n.elementChildren(i);e=o[o.length-1]}b=document.createRange(),e.parentNode.insertBefore(b.createContextualFragment(u.innerHTML),e.nextSibling),o=u.childNodes[0],o=e.nextElementSibling;let i=this.builder.doc.querySelector(".builder-active");i||(i=this.builder.doc.querySelector(".is-builder")),this.builder.applyBehaviorOn(i),l=o.querySelector("div"),l&&l.click();this.builder.doc.querySelectorAll(".dummy-module").forEach((t=>{t.querySelectorAll(".grid-sortable").forEach((t=>{new Dt(t,{animation:600,dragClass:"hide-drag-class",onStart:()=>{this.builder.uo.saveForUndo(!0)},onSort:()=>{if(t.closest("[data-html]")){const e=t.closest("[data-html]"),i=encodeURIComponent(e.innerHTML);e.setAttribute("data-html",i),this.builder.opts.onChange()}}})}))})),this.builder.doc.querySelectorAll(".dummy-module").forEach((t=>{t.classList.remove("dummy-module")})),o.className=o.className.replace("row-outline",""),this.builder.util.hideColumnTool()}}if(this.builder.useCssClasses){let t=this.builder.doc.querySelector(".builder-active");t&&n.contentReformat(t,this.builder.cssClasses)}this.builder.opts.onChange(),this.builder.opts.onRender()}else i?this.addContent(t,r,"data-noedit"):this.addContent(t,r)}clearActiveCell(){if(!this.builder.builderStuff)return;let t=this.builder.doc.getElementsByClassName("cell-active");for(;t.length;)t[0].classList.remove("cell-active");for(t=this.builder.doc.getElementsByClassName("row-outline");t.length;)t[0].classList.remove("row-outline");for(t=this.builder.doc.getElementsByClassName("row-active");t.length;)t[0].classList.remove("row-active");for(t=this.builder.doc.getElementsByClassName("builder-active");t.length;)t[0].classList.remove("builder-active");this.builder.activeCol=null,this.builder.dom.removeClass(this.builder.doc.body,"content-edit")}clearAfterUndoRedo(){const t=this.dom,e=this.builder.builderStuff;let i=e.querySelectorAll(".is-tool");Array.prototype.forEach.call(i,(e=>{e.style.display="",t.removeClass(e,"active")})),this.builder.iframe&&(i=this.builder.contentStuff.querySelectorAll(".is-tool"),Array.prototype.forEach.call(i,(e=>{e.style.display="",t.removeClass(e,"active")}))),this.builder.moveable&&this.builder.moveable.updateRect();const n=document.querySelector(".moveable-control-box");if(n&&(n.style.display="none"),this.builder.activeSpacer=null,this.builder.activeCodeBlock=null,this.builder.activeLink=null,this.builder.activeLinkButton=null,this.builder.activeButton=null,this.builder.activeIframe=null,this.builder.activeTd=null,this.builder.activeTable=null,this.builder.activeModule=null,this.builder.doc.querySelectorAll(".icon-active").forEach((t=>t.classList.remove("icon-active"))),this.builder.activeIcon=null,!this.builder.controlPanel){let i=e.querySelector(".is-rte-tool").querySelectorAll("button");Array.prototype.forEach.call(i,(e=>{t.removeClass(e,"on")})),i=e.querySelector(".is-elementrte-tool").querySelectorAll("button"),Array.prototype.forEach.call(i,(e=>{t.removeClass(e,"on")}))}let o=e.querySelectorAll(".is-pop");Array.prototype.forEach.call(o,(t=>{t.style.display=""}))}hidePops(){const t=this.dom,e=this.builder.builderStuff;let i=e.querySelectorAll(".is-tool");Array.prototype.forEach.call(i,(e=>{e.style.display="",t.removeClass(e,"active")}));let n=e.querySelectorAll(".is-pop.active");Array.prototype.forEach.call(n,(e=>{e.style.transition="all 200ms ease",setTimeout((()=>{e.style.opacity="0"}),10),setTimeout((()=>{e.style.display="",t.removeClass(e,"active"),e.style.opacity="",e.style.transition=""}),200)}));const o=document.querySelector(".moveable-control-box"),s=document.querySelector("#divImageResizer");o&&s&&!s.getAttribute("data-resizing")&&(o.style.display="none")}hideControls(){const t=this.dom;let e=this.builder.builderStuff.querySelectorAll(".is-tool");Array.prototype.forEach.call(e,(e=>{e.style.display="",t.removeClass(e,"active")})),this.builder.iframe&&(e=this.builder.contentStuff.querySelectorAll(".is-tool"),Array.prototype.forEach.call(e,(e=>{e.style.display="",t.removeClass(e,"active")}))),this.builder.moveable&&this.builder.moveable.updateRect();const i=document.querySelector(".moveable-control-box");i&&(i.style.display="none")}clearActiveElement(t){const e=this.dom,i=this.builder.builderStuff;this.builder.doc.querySelectorAll(".icon-active").forEach((t=>t.classList.remove("icon-active"))),this.builder.activeIcon=null;let n=this.builder.doc.querySelectorAll(".elm-inspected");Array.prototype.forEach.call(n,(t=>{e.removeClass(t,"elm-inspected")})),this.builder.inspectedElement=null,n=this.builder.doc.querySelectorAll(".elm-active"),Array.prototype.forEach.call(n,(t=>{e.removeClass(t,"elm-active")})),this.builder.activeElement=null,this.builder.doc.querySelector(".is-element-tool").style.display="";let o=this.builder.doc.querySelector("#divLinkTool");if(o&&(o.style.display=""),t&&!this.builder.controlPanel){let t=i.querySelector(".is-rte-tool");t&&(t.style.display="none");let e=i.querySelector(".is-elementrte-tool");e&&(e.style.display="flex");let n=i.querySelector(".rte-more-options");n&&(n.style.display="");let o=i.querySelector(".elementrte-more-options");o&&(o.style.display="");let s=e.querySelectorAll("button[data-align]");Array.prototype.forEach.call(s,(t=>{t.style.display="none"})),this.builder.rte.positionToolbar()}}clearPops(){const t=this.dom,e=this.builder.builderStuff;if(!e)return;let i=e.querySelectorAll(".is-tool");Array.prototype.forEach.call(i,(e=>{e.style.display="",t.removeClass(e,"active")})),this.builder.iframe&&(i=this.builder.contentStuff.querySelectorAll(".is-tool"),Array.prototype.forEach.call(i,(e=>{e.style.display="",t.removeClass(e,"active")}))),this.builder.moveable&&this.builder.moveable.updateRect();const n=document.querySelector(".moveable-control-box");n&&(n.style.display="none");let o=this.builder.doc.querySelectorAll(".ovl");Array.prototype.forEach.call(o,(t=>{t.style.display="block"}));let s=e.querySelectorAll(".is-pop");Array.prototype.forEach.call(s,(e=>{e.style.display="",t.removeClass(e,"active"),e.setAttribute("aria-hidden",!0)})),this.builder.colTool.lockIndicator.style.display="",this.builder.resize&&this.builder.resize.destroy()}clearControls(){const t=this.dom,e=this.builder.builderStuff;if(!e)return;let i=e.querySelectorAll(".is-tool");Array.prototype.forEach.call(i,(e=>{e.style.display="",t.removeClass(e,"active")})),this.builder.iframe&&(i=this.builder.contentStuff.querySelectorAll(".is-tool"),Array.prototype.forEach.call(i,(e=>{e.style.display="",t.removeClass(e,"active")}))),this.builder.moveable&&this.builder.moveable.updateRect();const n=document.querySelector(".moveable-control-box");n&&(n.style.display="none"),this.builder.activeSpacer=null,this.builder.activeCodeBlock=null,this.builder.activeLink=null,this.builder.activeLinkButton=null,this.builder.activeButton=null,this.builder.activeIframe=null,this.builder.activeTd=null,this.builder.activeTable=null,this.builder.activeModule=null,this.builder.activeImage=null,this.builder.doc.querySelectorAll(".icon-active").forEach((t=>t.classList.remove("icon-active"))),this.builder.activeIcon=null;let o=this.builder.doc.querySelectorAll(".ovl");Array.prototype.forEach.call(o,(t=>{t.style.display="block"}));var s=e.querySelectorAll(".is-side.elementstyles");Array.prototype.forEach.call(s,(e=>{t.removeClass(e,"active")}));let l=this.builder.doc.querySelectorAll("[data-saveforundo]");if(Array.prototype.forEach.call(l,(t=>{t.removeAttribute("data-saveforundo")})),l=this.builder.doc.querySelectorAll(".elm-inspected"),Array.prototype.forEach.call(l,(e=>{t.removeClass(e,"elm-inspected")})),!this.builder.controlPanel&&"auto"===this.builder.toolbarDisplay){let t=e.querySelector(".is-rte-tool");t&&(t.style.display="none");let i=e.querySelector(".is-elementrte-tool");i&&(i.style.display="none");let n=e.querySelector(".rte-more-options");n&&(n.style.display="");let o=e.querySelector(".elementrte-more-options");o&&(o.style.display="")}if(l=this.builder.doc.querySelectorAll(".elm-active"),Array.prototype.forEach.call(l,(e=>{t.removeClass(e,"elm-active")})),!this.builder.controlPanel){let i=e.querySelectorAll(".is-rte-pop");Array.prototype.forEach.call(i,(e=>{e.style.display="",t.removeClass(e,"active"),t.removeClass(e,"deactive")}))}let a=e.querySelectorAll(".is-pop");Array.prototype.forEach.call(a,(e=>{e.style.display="",t.removeClass(e,"active"),e.setAttribute("aria-hidden",!0)})),this.builder.colTool.lockIndicator.style.display="",this.builder.resize&&this.builder.resize.destroy()}makeId(){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}getSelection(){if(this.builder.dom.getSelectedBlocks().length>0)this.builder.selectionMulti=!0;else{this.builder.selectionMulti=!1;const t=this.builder.win.getSelection(),e=this.builder.dom.getElm();if(!e)return;if(e&&e.innerText===t.toString().trim()||""===t.toString().trim()){this.builder.selectionElm=e;let t=e.closest("a");this.builder.activeLink=t||null}else this.builder.selectionText=t,this.builder.activeLink=null}}saveSelection(){if(this.builder.win.getSelection){let t=this.builder.win.getSelection();if(t.getRangeAt&&t.rangeCount){let e=[];for(let i=0,n=t.rangeCount;i<n;++i)e.push(t.getRangeAt(i));return this.builder.selection=e,e}}else if(this.builder.doc.selection&&this.builder.doc.selection.createRange)return this.builder.selection=this.builder.doc.selection.createRange(),this.builder.doc.selection.createRange();return this.builder.selection=null,null}restoreSelection(){let t=this.builder.selection;if(t)if(this.builder.win.getSelection){let o=this.builder.win.getSelection();if(this.builder.doc.body.createTextRange){var e=this.builder.doc.body.createTextRange();e.collapse(),e.select()}else this.builder.win.getSelection?this.builder.win.getSelection().empty?this.builder.win.getSelection().empty():this.builder.win.getSelection().removeAllRanges&&this.builder.win.getSelection().removeAllRanges():this.builder.doc.selection&&this.builder.doc.selection.empty();for(var i=0,n=t.length;i<n;++i)o.addRange(t[i])}else this.builder.doc.selection&&t.select&&t.select()}cleanHTML(t,e){let i,n=t.replace(/(\n|\r| class=(")?Mso[a-zA-Z]+(")?)/g," "),o=new RegExp("\x3c!--(.*?)--\x3e","g");n=n.replace(o,""),i=e?new RegExp("<(/)*(meta|link|span|\\?xml:|st1:|o:|font)(.*?)>","gi"):new RegExp("<(/)*(meta|link|\\?xml:|st1:|o:|font)(.*?)>","gi"),n=n.replace(i,"");let s,l=["style","script","applet","embed","noframes","noscript"];for(let t=0;t<l.length;t++)i=new RegExp("<"+l[t]+".*?"+l[t]+"(.*?)>","gi"),n=n.replace(i,"");s=e?["style","start"]:["start"];for(let t=0;t<s.length;t++){let e=new RegExp(" "+s[t]+'="(.*?)"',"gi");n=n.replace(e,"")}return n=n.replace(/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s/>]))[^>]*>/gi,""),n=n.replace(/<(\/?)s>/gi,"<$1strike>"),n=n.replace(/&nbsp;/gi," "),n=n.replace(/background-color: rgba\(200, 200, 201, 0.11\);/gi,""),n=n.replace(/background-color: rgba\(200, 200, 201, 0.11\)/gi,""),n}checkEmpty(){const t=this.builder.doc.querySelectorAll(this.builder.opts.container);Array.prototype.forEach.call(t,(t=>{this.checkEmptyOn(t)}))}checkEmptyOn(t){const i=this.dom,n=i.elementChildren(t);let o=!0;if(n.forEach((t=>{i.hasClass(t,"row-add-initial")||i.hasClass(t,"dummy-space")||"link"!==t.tagName.toLowerCase()&&(o=!1)})),o){let n=t.querySelector(".row-add-initial");n||(t.innerHTML=`<button type="button" class="row-add-initial">${this.out("Empty")}<br><span class="block">${this.out("+ Click to add content")}</span></div>`,n=t.querySelector(".row-add-initial")),n.addEventListener("click",(()=>{this.clearActiveCell();const o=this.builder.doc.querySelectorAll(this.builder.opts.container);Array.prototype.forEach.call(o,(t=>{i.removeClass(t,"builder-active")})),i.addClass(t,"builder-active"),i.addClass(n,"row-active");const s=e(this.builder);s.querySelector(".is-pop-tabs").style.display="none";const l=window.innerHeight,a=this.getElementPosition(n);let r=a.top,c=a.left,u=a.scaleX,d=a.scaleY;c+=n.offsetWidth*(u*this.builder.opts.zoom)/2-11,r-=n.offsetHeight-n.offsetHeight*d,s.style.display="flex",this.showPop(s,!1,n);const b=s.offsetWidth,h=s.offsetHeight;l-r>h?(r=r+n.offsetHeight*this.builder.opts.zoom-19,s.style.top=r+window.pageYOffset+27+"px",s.style.left=c-b/2+7+"px",i.removeClass(s,"arrow-bottom"),i.removeClass(s,"arrow-right"),i.removeClass(s,"arrow-left"),i.removeClass(s,"center"),i.addClass(s,"arrow-top"),i.addClass(s,"center")):(s.style.top=r+window.pageYOffset-h-8+"px",s.style.left=c-b/2+7+"px",i.removeClass(s,"arrow-top"),i.removeClass(s,"arrow-right"),i.removeClass(s,"arrow-left"),i.removeClass(s,"center"),i.addClass(s,"arrow-bottom"),i.addClass(s,"center")),s.setAttribute("data-mode","row")}))}else{let e=t.querySelector(".row-add-initial");e&&e.parentNode.removeChild(e)}}clearPreferences(){localStorage.removeItem("_theme"),localStorage.removeItem("_zoom"),localStorage.removeItem("_buildermode"),localStorage.removeItem("_editingtoolbar"),localStorage.removeItem("_editingtoolbardisplay"),localStorage.removeItem("_hidecelltool"),localStorage.removeItem("_rowtool"),localStorage.removeItem("_hideelementtool"),localStorage.removeItem("_hidesnippetaddtool"),localStorage.removeItem("_outlinemode"),localStorage.removeItem("_hiderowcoloutline"),localStorage.removeItem("_outlinestyle"),localStorage.removeItem("_hideelementhighlight"),localStorage.removeItem("_opensnippets"),localStorage.removeItem("_toolstyle"),localStorage.removeItem("_snippetssidebardisplay"),localStorage.removeItem("_htmlview"),localStorage.removeItem("_pasteresult"),localStorage.removeItem("_livepreview"),localStorage.removeItem("_dictation"),localStorage.removeItem("_mic"),localStorage.removeItem("_autosendcommand"),localStorage.removeItem("_disclaimershown"),localStorage.removeItem("_temp"),localStorage.removeItem("_top_p"),localStorage.removeItem("_autosend_delay"),localStorage.removeItem("_auto_editblock"),localStorage.removeItem("_command_lang"),localStorage.removeItem("_ai_panel_open"),localStorage.removeItem("_pagesize"),localStorage.removeItem("_scrollableeditor"),localStorage.removeItem("_animatedsorting"),localStorage.removeItem("_addbuttonplace"),localStorage.removeItem("_hiderowtool"),localStorage.removeItem("_dragwithouthandle"),localStorage.removeItem("_advancedhtmleditor"),localStorage.removeItem("_hidecolhtmleditor"),localStorage.removeItem("_hiderowhtmleditor"),localStorage.removeItem("_sampleshown")}pasteHtmlAtCaret(t,e){var i,n;if(this.restoreSelection(),this.builder.dom.getElm().closest(".is-container"))if(this.builder.win.getSelection){if(!this.builder.activeCol)return;if((i=this.builder.win.getSelection()).getRangeAt&&i.rangeCount){(n=i.getRangeAt(0)).deleteContents();var o=this.builder.doc.createElement("div");o.innerHTML=t;for(var s,l,a=this.builder.doc.createDocumentFragment();s=o.firstChild;)l=a.appendChild(s);var r=a.firstChild;n.insertNode(a),l&&((n=n.cloneRange()).setStartAfter(l),e?n.setStartBefore(r):n.collapse(!0),i.removeAllRanges(),this.builder.isTouchSupport||i.addRange(n))}}else if((i=this.builder.doc.selection)&&"Control"!==i.type){if(!this.builder.activeCol)return;var c=i.createRange();c.collapse(!0),i.createRange().pasteHTML(t),e&&((n=i.createRange()).setEndPoint("StartToStart",c),this.builder.isTouchSupport||n.select())}}refreshModule(){let t=this.builder.activeModule;if(!t)return;let e=1,i=t.querySelectorAll("[data-subblock]");Array.prototype.forEach.call(i,(i=>{let n=i.innerHTML;t.setAttribute("data-html-"+e,encodeURIComponent(n)),e++}));let n=decodeURIComponent(t.getAttribute("data-html"));n=n.replace(/{id}/g,this.makeId()),t.innerHTML="";var o=document.createRange();o.setStart(t,0),t.appendChild(o.createContextualFragment(n)),i=t.querySelectorAll("[data-subblock]");var s=1;Array.prototype.forEach.call(i,(e=>{t.getAttribute("data-html-"+s)&&(e.innerHTML=decodeURIComponent(t.getAttribute("data-html-"+s))),s++})),this.repositionColumnTool(!0),this.builder.onRefreshTool&&this.builder.onRefreshTool()}repositionColumnTool(){let t=this.builder.activeCol;if(!t)return;let e=t.parentNode;if(t.parentNode||(e=this.rowSelected()),this.colTool=e.querySelector(".is-col-tool"),!this.colTool)return;t.parentNode||(this.colTool.style.display="none"),this.colTool.style.left=t.offsetLeft+"px";const i=this.builder.builderStuff.querySelector(".columnmore.active");if(i){const t=this.colTool.querySelector(".cell-more");i.classList.add("transition1"),setTimeout((()=>{const e=this.getElementPosition(t);let n=e.top,o=e.left;i.style.top=n+35+"px",i.style.left=o-7+"px",setTimeout((()=>{i.classList.remove("transition1")}),300)}),30)}}hideColumnTool(){this.builder.doc.querySelectorAll(".is-col-tool").forEach((t=>{t.style.display="none"}))}isTouchSupport(){return!!window.matchMedia("(pointer: coarse)").matches}detectIE(){return!!document.documentMode}LightenDarkenColor(t,e){var i=!1;"#"===t[0]&&(t=t.slice(1),i=!0);var n=parseInt(t,16),o=(n>>16)+e;o>255?o=255:o<0&&(o=0);var s=(n>>8&255)+e;s>255?s=255:s<0&&(s=0);var l=(255&n)+e;return l>255?l=255:l<0&&(l=0),(i?"#":"")+String("000000"+(l|s<<8|o<<16).toString(16)).slice(-6)}getUIStyles(){this.dom.appendHtml(this.builder.builderStuff,'\n <input type="text" class="style-helper-input" id="__style_helper_input" style="display:none;">\n <button class="style-helper-button-classic classic" style="display:none;"><svg><use xlink:href="#ion-code-working"></use></svg></button>\n <select class="style-helper-select" id="__style_helper_select" style="display:none;"><option value=""></option></select>\n\n <div class="style-helper modal-color"></div>\n <div class="style-helper modal-background"></div>\n <div class="style-helper button-pickcolor-border"></div>\n <div class="style-helper button-pickcolor-background"></div>\n\n <button class="style-helper base"><svg><use xlink:href="#ion-code-working"></use></svg></button>\n <div class="style-helper base on"></div>\n <div class="style-helper base hover"></div>\n\n <div class="style-helper snippet-color"></div>\n <div class="style-helper snippet-background"></div>\n <div class="style-helper snippet-tabs-background"></div>\n <div class="style-helper snippet-tab-item-background"></div>\n <div class="style-helper snippet-tab-item-background-active"></div>\n <div class="style-helper snippet-tab-item-background-hover"></div>\n <div class="style-helper snippet-tab-item-color"></div>\n\n <div class="style-helper snippet-more-item-background"></div>\n <div class="style-helper snippet-more-item-background-active"></div>\n <div class="style-helper snippet-more-item-background-hover"></div>\n <div class="style-helper snippet-more-item-color"></div>\n\n <div class="style-helper tabs-background"></div>\n <div class="style-helper tab-item-active-border-bottom"></div>\n <div class="style-helper tab-item-color"></div>\n <div class="style-helper tabs-more-background"></div>\n <div class="style-helper tabs-more-border"></div>\n <div class="style-helper tabs-more-item-color"></div>\n <div class="style-helper tabs-more-item-background-hover"></div>\n <div class="style-helper separator-color"></div>\n <div class="style-helper outline-color"></div>\n ');const t=(t,e)=>{const i=this.builder.builderStuff.querySelector(".style-helper"+t);return window.getComputedStyle(i,null).getPropertyValue(e)},e=this.builder.builderStuff.querySelector(".style-helper-input"),i=this.builder.builderStuff.querySelector(".style-helper-select"),n=this.builder.builderStuff.querySelector(".style-helper-button-classic");this.builder.styleModalColor=t(".modal-color","background-color"),this.builder.styleModalBackground=t(".modal-background","background-color"),this.builder.styleButtonPickColorBorder=t(".button-pickcolor-border","border"),this.builder.styleButtonPickColorBackground=t(".button-pickcolor-background","background-color"),this.builder.styleToolBackground=t(".base","background-color"),this.builder.styleButtonColor=t(".base","color"),this.builder.styleButtonSvgFill=(()=>{const t=this.builder.builderStuff.querySelector(".style-helper.base");return window.getComputedStyle(t.querySelector("svg"),null).getPropertyValue("fill")})(),this.builder.styleButtonBackgroundHover=t(".base.hover","background-color"),this.builder.styleSnippetColor=t(".snippet-color","background-color"),this.builder.styleSnippetBackground=t(".snippet-background","background-color"),this.builder.styleSnippetTabsBackground=t(".snippet-tabs-background","background-color"),this.builder.styleSnippetTabItemBackground=t(".snippet-tab-item-background","background-color"),this.builder.styleSnippetTabItemBackgroundActive=t(".snippet-tab-item-background-active","background-color"),this.builder.styleSnippetTabItemBackgroundHover=t(".snippet-tab-item-background-hover","background-color"),this.builder.styleSnippetTabItemColor=t(".snippet-tab-item-color","background-color"),this.builder.styleSnippetMoreItemBackground=t(".snippet-more-item-background","background-color"),this.builder.styleSnippetMoreItemBackgroundActive=t(".snippet-more-item-background-active","background-color"),this.builder.styleSnippetMoreItemBackgroundHover=t(".snippet-more-item-background-hover","background-color"),this.builder.styleSnippetMoreItemColor=t(".snippet-more-item-color","background-color"),this.builder.styleTabsBackground=t(".tabs-background","background-color"),this.builder.styleTabItemBorderBottomActive=t(".tab-item-active-border-bottom","border"),this.builder.styleTabItemColor=t(".tab-item-color","background-color"),this.builder.styleTabsMoreBackground=t(".tabs-more-background","background-color"),this.builder.styleTabsMoreBorder=t(".tabs-more-border","border"),this.builder.styleTabsMoreItemColor=t(".tabs-more-item-color","background-color"),this.builder.styleTabsMoreBackgroundHover=t(".tabs-more-item-background-hover","background-color"),this.builder.styleSeparatorColor=t(".separator-color","background-color"),this.builder.styleOutlineColor=t(".outline-color","background-color"),this.builder.styleSelectBackground=window.getComputedStyle(i,null).getPropertyValue("background-color"),this.builder.styleSelectColor=window.getComputedStyle(i,null).getPropertyValue("color"),this.builder.styleSelectOptionBackground=window.getComputedStyle(i.querySelector("option"),null).getPropertyValue("background-color"),this.builder.styleInputBackground=window.getComputedStyle(e,null).getPropertyValue("background-color"),this.builder.styleInputBorderBottom=window.getComputedStyle(e,null).getPropertyValue("border-bottom"),this.builder.styleInputColor=window.getComputedStyle(e,null).getPropertyValue("color"),this.builder.styleButtonClassicBackground=window.getComputedStyle(n,null).getPropertyValue("background-color"),this.builder.styleButtonClassicColor=window.getComputedStyle(n,null).getPropertyValue("color"),this.builder.styleButtonClassicBackgroundHover=this.getUIStyleValue(n,"hover","background-color"),this.builder.styleDark=!1,this.builder.styleColored=!1,this.builder.styleColoredDark=!1,this.builder.styleLight=!1,document.body.getAttribute("class")&&(-1!==document.body.getAttribute("class").indexOf("colored-dark")?this.builder.styleColoredDark=!0:-1!==document.body.getAttribute("class").indexOf("dark")?this.builder.styleDark=!0:-1!==document.body.getAttribute("class").indexOf("colored")?this.builder.styleColored=!0:-1!==document.body.getAttribute("class").indexOf("light")&&(this.builder.styleLight=!0))}getUIStyleValue(t,e,i){const n=this.dom;n.addClass(t,e);let o=window.getComputedStyle(t,null).getPropertyValue(i);return n.removeClass(t,e),o}getPageTemplate(t){let e="";return e=""===t?'\n <!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charset="utf-8">\n <title>Page</title>\n <meta name="viewport" content="width=device-width, initial-scale=1">\n <meta name="description" content="">\n <link rel="shortcut icon" href="#">\n \n <link href="[%PATH%]/assets/minimalist-blocks/content.css" rel="stylesheet">\n \n <link href="[%PATH%]/assets/scripts/glide/css/glide.core.css" rel="stylesheet">\n <link href="[%PATH%]/assets/scripts/glide/css/glide.theme.css" rel="stylesheet">\n <script src="[%PATH%]/assets/scripts/glide/glide.js"><\/script>\n \n <style>\n .container {\n margin: 150px auto 0;\n max-width: 800px;\n width: 100%;\n padding: 0 20px;\n box-sizing: border-box;\n }\n </style>\n </head>\n <body>\n \n <div class="container">\n [%CONTENT%]\n </div>\n \n </body>\n </html>\n ':"tailwind"===t?'\n <!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charset="utf-8">\n <title>Page</title>\n <meta name="viewport" content="width=device-width, initial-scale=1">\n <meta name="description" content="">\n <link rel="shortcut icon" href="#">\n \n <link href="[%PATH%]/assets/minimalist-blocks/content-tailwind.css" rel="stylesheet">\n \n <link href="[%PATH%]/assets/scripts/glide/css/glide.core.css" rel="stylesheet">\n <link href="[%PATH%]/assets/scripts/glide/css/glide.theme.css" rel="stylesheet">\n <script src="[%PATH%]/assets/scripts/glide/glide.js"><\/script>\n \n <link rel="stylesheet" href="[%PATH%]/assets/frameworks/tailwindcss/styles.css">\n \x3c!-- To build your own, please see: https://tailwindcss.com/docs/installation --\x3e\n \n <style>\n .container {\n margin: 150px auto 0;\n max-width: 800px;\n width: 100%;\n padding: 0 20px;\n box-sizing: border-box;\n }\n </style>\n </head>\n <body>\n \n <div class="container">\n [%CONTENT%]\n </div>\n \n </body>\n </html>\n ':"bootstrap"===t?'\n <!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charset="utf-8">\n <title>Page</title>\n <meta name="viewport" content="width=device-width, initial-scale=1">\n <meta name="description" content="">\n <link rel="shortcut icon" href="#">\n\n <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">\n \n <link href="[%PATH%]/assets/minimalist-blocks/content.css" rel="stylesheet">\n \n <link href="[%PATH%]/assets/scripts/glide/css/glide.core.css" rel="stylesheet">\n <link href="[%PATH%]/assets/scripts/glide/css/glide.theme.css" rel="stylesheet">\n <script src="[%PATH%]/assets/scripts/glide/glide.js"><\/script>\n \n <style>\n .container {margin: 140px auto; max-width: 800px; width:100%; padding:0 35px; box-sizing: border-box;}\n /* Bootstrap css adjustment to enable column drag to resize */\n .row > *,\n .column {\n max-width: unset !important;\n }\n </style>\n </head>\n <body>\n \n <div class="container">\n [%CONTENT%]\n </div>\n \n </body>\n </html>\n ':"foundation"===t?'\n <!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charset="utf-8">\n <title>Page</title>\n <meta name="viewport" content="width=device-width, initial-scale=1">\n <meta name="description" content="">\n <link rel="shortcut icon" href="#">\n\n <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.5.3/css/foundation.min.css">\n <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.5.3/css/foundation-float.min.css">\n \n <link href="[%PATH%]/assets/minimalist-blocks/content.css" rel="stylesheet">\n \n <link href="[%PATH%]/assets/scripts/glide/css/glide.core.css" rel="stylesheet">\n <link href="[%PATH%]/assets/scripts/glide/css/glide.theme.css" rel="stylesheet">\n <script src="[%PATH%]/assets/scripts/glide/glide.js"><\/script>\n \n <style>\n .container {\n margin: 150px auto 0;\n max-width: 800px;\n width: 100%;\n padding: 0 20px;\n box-sizing: border-box;\n }\n </style>\n </head>\n <body>\n \n <div class="container">\n [%CONTENT%]\n </div>\n \n </body>\n </html>\n ':"[%CONTENT%]",e}getElementPosition(t){const e=this.builder.iframe;let i,n,o,s;if(this.builder.iframe){let l=document.querySelector(".is-content-view");l||(l=e.parentNode);const a=window.getComputedStyle(l).transform;if("none"!==a){const t=a.match(/matrix\(([0-9., -]+)\)/)[1].split(",");o=parseFloat(t[0]),s=parseFloat(t[3])}else o=1,s=1;const r=e.getBoundingClientRect();i=t.getBoundingClientRect().top*s+r.top,n=t.getBoundingClientRect().left*o+r.left}else i=t.getBoundingClientRect().top,n=t.getBoundingClientRect().left,o=1,s=1;return{top:i,left:n,scaleX:o,scaleY:s}}getLightboxCss(){return"\n /* Light */\n .glightbox-light .gslide-description {\n background: #fff;\n }\n \n .glightbox-light .gdesc-inner {\n padding: 22px 20px;\n }\n \n .glightbox-light .gslide-title {\n font-size: 1em;\n font-weight: normal;\n font-family: arial;\n color: #000;\n margin-bottom: 19px;\n line-height: 1.4em;\n }\n \n .glightbox-light .gslide-desc {\n font-size: 0.86em;\n margin-bottom: 0;\n font-family: arial;\n line-height: 1.4em;\n }\n \n .glightbox-light .gslide-video {\n background: #000;\n }\n \n .glightbox-light .gprev,\n .glightbox-light .gnext,\n .glightbox-light .gclose {\n background-color: rgb(255 255 255 / 0%);\n border-radius: 4px;\n }\n \n .glightbox-light .gprev path,\n .glightbox-light .gnext path,\n .glightbox-light .gclose path {\n fill: #000;\n }\n \n .glightbox-light .gprev {\n position: absolute;\n top: -100%;\n left: 30px;\n width: 40px;\n height: 50px;\n }\n \n .glightbox-light .gnext {\n position: absolute;\n top: -100%;\n right: 30px;\n width: 40px;\n height: 50px;\n }\n \n .glightbox-light .gclose {\n width: 35px;\n height: 35px;\n top: 15px;\n right: 10px;\n position: absolute;\n }\n \n .glightbox-light .gclose svg {\n width: 18px;\n height: auto;\n }\n \n .glightbox-light .gclose:hover {\n opacity: 1;\n }\n \n /**/\n .glightbox-light .gslide-media {\n -webkit-box-shadow: none !important;\n box-shadow: none !important;\n }\n .glightbox-light .description-left .gdesc-inner,\n .glightbox-light .description-right .gdesc-inner {\n position: absolute;\n height: 100%;\n overflow-y: auto;\n }\n .glightbox-light .gprev,\n .glightbox-light .gnext,\n .glightbox-light .gclose {\n background-color: rgb(255 255 255 / 0%);\n }\n .glightbox-light .gprev:hover,\n .glightbox-light .gnext:hover,\n .glightbox-light .gclose:hover {\n background-color: rgb(255 255 255 / 0%);\n }\n .glightbox-light .gprev {\n top: 45%;\n }\n .glightbox-light .gnext {\n top: 45%;\n }\n \n @media (min-width: 992px) {\n .glightbox-light .gclose {\n opacity: 0.7;\n right: 20px;\n }\n }\n \n /**/\n .glightbox-light .goverlay {\n background: rgb(255 255 255 / 100%) !important;\n }\n @media screen and (max-height: 420px) {\n .goverlay {\n background: rgb(255 255 255 / 100%);\n }\n }\n \n /* override (light) */\n .glightbox-light .gprev,\n .glightbox-light .gnext {\n width: 55px !important;\n height: 70px !important;\n }\n .gclose svg, .gnext svg, .gprev svg {\n width: 50px !important;\n }\n .glightbox-light .gclose {\n width: 55px !important;\n height: 55px !important;\n }\n .glightbox-light .gclose svg {\n width: 30px !important;\n }\n .glightbox-light .gslide-title {\n font-size: 1.2em !important;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif !important;\n }\n .glightbox-light .gslide-desc {\n font-size: 1em !important;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif !important;\n } \n \n /* override (clean) */\n .glightbox-clean .gprev,\n .glightbox-clean .gnext {\n width: 55px !important;\n height: 70px !important;\n }\n .gclose svg, .gnext svg, .gprev svg {\n width: 50px !important;\n }\n .glightbox-clean .gclose {\n width: 55px !important;\n height: 55px !important;\n }\n .glightbox-clean .gclose svg {\n width: 30px !important;\n }\n .glightbox-clean .gslide-title {\n font-size: 1.2em !important;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif !important;\n }\n .glightbox-clean .gslide-desc {\n font-size: 1em !important;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif !important;\n } \n \n /* other override */\n .gclose.disabled, .gnext.disabled, .gprev.disabled {\n opacity: 0;\n } \n "}}class le{constructor(t){this.builder=t}detectMobileOrTablet(){const t=navigator.userAgent.toLowerCase(),e=/ipad|iphone|ipod/.test(t)&&!window.MSStream,i=/android/.test(t),n="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0,o=window.innerWidth<=1600;return!(!e&&!i)||!(!n||!o)}getScale(t){let e=window.getComputedStyle(t).transform;if("none"===e)return 1;let i=e.split("(")[1];i=i.split(")")[0],i=i.split(",");let n=i[0],o=i[1];return Math.sqrt(n*n+o*o)}createElement(t){return document.createElement(t)}appendChild(t,e){t&&t.appendChild(e)}appendHtml(t,e){t&&t.insertAdjacentHTML("beforeend",e)}addEventListener(t,e,i){t&&t.addEventListener(e,i)}addClass(t,e){t&&(this.hasClass(t,e)||(0===t.classList.length?t.className=e:t.className=t.className+" "+e,t.className=t.className.replace(/ +/g," ")))}removeClass(t,e){if(t&&t.classList.length>0){let i,n,o,s,l=e.split(" ");for(i=0,o=l.length;i<o;++i)if(l[i])try{let e=l[i],o="",a=t.className.split(" ");for(n=0,s=a.length;n<s;++n)a[n]&&a[n]!==e&&(o+=a[n]+" ");t.className=o.trim()}catch(t){}""===t.className&&t.removeAttribute("class")}}removeClassesByPrefix(t,e){t.classList&&t.classList.forEach((i=>{0===i.indexOf(e)&&this.removeClass(t,i)}))}hasClass(t,e){return!!t&&(!!t.className&&(" "+t.className+" ").indexOf(" "+e+" ")>-1)}moveAfter(t,e){e.parentNode.insertBefore(t,e),e.parentNode.insertBefore(e,e.previousElementSibling)}elementChildren(t){const e=t.childNodes;let i=[],n=e.length;for(;n--;)1===e[n].nodeType&&i.unshift(e[n]);return i}getElementOffset(t){const e=t.getBoundingClientRect();return{top:e.top+window.pageYOffset,left:e.left+window.pageXOffset,width:e.width,height:e.height}}parentsHasClass(t,e){for(;t;){if(!t.tagName)return!1;if("BODY"===t.tagName||"HTML"===t.tagName)return!1;if(this.hasClass(t,e))return!0;t=t.parentNode}}parentsHasId(t,e){for(;t;){if(!t.tagName)return!1;if("BODY"===t.tagName||"HTML"===t.tagName)return!1;if(t.id===e)return!0;t=t.parentNode}}parentsHasTag(t,e){for(;t;){if(!t.tagName)return!1;if("BODY"===t.tagName||"HTML"===t.tagName)return!1;if(t.tagName.toLowerCase()===e.toLowerCase())return!0;t=t.parentNode}}parentsHasAttribute(t,e){for(;t;){if(!t.tagName)return!1;if("BODY"===t.tagName||"HTML"===t.tagName)return!1;try{if(t.hasAttribute(e))return!0}catch(t){}t=t.parentNode}}getParentByTag(t,e){for(;t;){if(!t.tagName)return!1;if("BODY"===t.tagName||"HTML"===t.tagName)return!1;if(t.tagName.toLowerCase()===e.toLowerCase())return t;t=t.parentNode}}getParentByAttribute(t,e){for(;t;){if(!t.tagName)return!1;if("BODY"===t.tagName||"HTML"===t.tagName)return!1;try{if(t.hasAttribute(e))return t}catch(t){}t=t.parentNode}}parentsHasElement(t,e){for(;t;){if(!t.tagName)return!1;if("BODY"===t.tagName||"HTML"===t.tagName)return!1;if(!(t=t.parentNode))return!1;if(!t.tagName)return!1;if(t.tagName.toLowerCase()===e)return!0}}getParentElement(t,e){for(;t;){if(!t.tagName)return!1;if("BODY"===t.tagName||"HTML"===t.tagName)return!1;if(!(t=t.parentNode))return!1;if(!t.tagName)return!1;if(t.tagName.toLowerCase()===e)return t}}removeClasses(t,e){for(let i=0;i<t.length;i++)t[i].classList.remove(e)}removeAttributes(t,e){for(let i=0;i<t.length;i++)t[i].removeAttribute(e)}removeElements(t){Array.prototype.forEach.call(t,(t=>{t.parentNode.removeChild(t)}))}moveCursorToElement(t){var e,i;window.getSelection&&this.builder.doc.createRange?((i=this.builder.doc.createRange()).selectNodeContents(t),i.collapse(!1),(e=window.getSelection()).removeAllRanges(),e.addRange(i)):this.builder.doc.body.createTextRange&&((i=this.builder.doc.body.createTextRange()).moveToElementText(t),i.collapse(!1),i.select())}selectElementContents(t){var e=this.builder.doc.createRange();e.selectNodeContents(t);var i=this.builder.win.getSelection();i.removeAllRanges(),i.addRange(e)}getSelected(){if(this.builder.win.getSelection)return this.builder.win.getSelection().toString();if(this.builder.doc.getSelection)return this.builder.doc.getSelection().toString();var t=this.builder.doc.selection&&this.builder.doc.selection.createRange();return!!t.text&&t.text}checkEditable(){try{var t,e;return this.builder.win.getSelection?t=3===(e=this.builder.win.getSelection().getRangeAt(0).commonAncestorContainer).nodeType?e.parentNode:e:this.builder.doc.selection&&(e=this.builder.doc.selection.createRange(),t=this.builder.doc.selection.createRange().parentElement()),!!this.parentsHasAttribute(t,"contenteditable")}catch(t){return!1}}textSelection(){const t=this.getSelection().anchorNode;if(!t)return!1;return t.nodeType!==Node.TEXT_NODE&&t.nodeType!==Node.COMMENT_NODE?t:t.parentElement}getStyle(t,e){return window.getComputedStyle?window.getComputedStyle(t,null).getPropertyValue(e):t.style[e.replace(/-([a-z])/g,(function(t){return t[1].toUpperCase()}))]}observeElement(t,e,i,n=0){let o=Object.getPrototypeOf(t);if(Object.prototype.hasOwnProperty.call(o,e)){let s=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,{get:function(){return s.get.apply(this,arguments)},set:function(){let t=this[e];s.set.apply(this,arguments);let o=this[e];"function"==typeof i&&setTimeout(i.bind(this,t,o),n)}})}}baseName(t){if("string"==typeof t){var e=t.split(".");return e.splice(0,e.length-1).join(".")}}doFunction(t,e,i){if(e(t),i){let i=Array.prototype.slice.call(t.getElementsByTagName("*"));for(var n=0;n<i.length;n++)e(i[n])}}execCommand(t,e,i){const n=this.getSelectedBlocks();if(n.length>0)n.forEach((t=>{i(!0,t)}));else{const n=this.builder.win.getSelection(),o=this.getElm();if(!o)return void(i&&i(!1));let s;s=o&&o.innerText===n.toString().trim()||""===n.toString().trim()?this.updateSelection(t,e,o):this.replaceSelection(t,e,n,o),i&&i(!0,s)}}updateSelection(t,e,i){return i.style[t]=this.getStyleValue(i,t,e),this.checkStyleIfSameAsParent(i,t),this.cleanChildren(t,i),this.cleanUnusedSpan(i),i}replaceSelection(t,e,i,n){const o=i.getRangeAt(0),s=o.extractContents(),l=this.createSpan(n,t,e);return l.appendChild(s),this.cleanChildren(t,l),this.cleanUnusedSpan(l),o.insertNode(l),i.selectAllChildren(l),this.checkStyleIfSameAsParent(l,t),l}checkStyleIfSameAsParent(t,e){if(t.parentNode&&(t.parentNode.style[e]===t.style[e]||window.getComputedStyle(t.parentNode,null).getPropertyValue(e)===t.style[e])){t.style[e]="",""!==t.getAttribute("style")&&null!==t.style||t.removeAttribute("style");let i=0===t.attributes.length||1===t.attributes.length&&t.hasAttribute("data-keep");if("span"===t.nodeName.toLowerCase()&&i){const e=document.createTextNode(t.textContent);t.parentElement.replaceChild(e,t)}}}createSpan(t,e,i){const n=document.createElement("span");return n.style[e]=this.getStyleValue(t,e,i),n}findParentStyle(t,e){if("HTML"===t.nodeName.toUpperCase()||"BODY"===t.nodeName.toUpperCase())return null;if(!t.parentNode)return null;if(null!==t.style[e]&&void 0!==t.style[e]&&""!==t.style[e])return t;this.findParentStyle(t.parentNode,e)}getStyleValue(t,e,i){if("font-weight"===e||"font-style"===e||"text-decoration"===e||"text-transform"===e){let n,o=this.findParentStyle(t,e);if(o&&(n=o.style[e]),i===n){t.style[e]="";let o=window.getComputedStyle(t,null).getPropertyValue(e);t.style[e]=n,i=o}}return i}getParentBlock(t){for(;t;){if(!t.tagName)return!1;if("BODY"===t.tagName||"HTML"===t.tagName)return!1;if("inline"!==this.getStyle(t,"display"))return t;t=t.parentNode}}execCommandClass(t,e,i=!0,n){const o=this.getSelectedBlocks();if(o.length>0)o.forEach((i=>{for(let t=0;t<Object.keys(e).length;t++){let n=Object.values(e)[t];this.removeClass(i,n)}""!==t&&this.addClass(i,t),this.cleanChildrenClass(i,e),this.cleanUnusedSpan(i)}));else{const o=this.builder.win.getSelection();let s=this.getElm();if(!s)return;const l=s&&s.innerText===o.toString().trim();(i||l||""===o.toString().trim())&&("block"===n&&"inline"===this.getStyle(s,"display")&&(s=this.getParentBlock(s)),this.updateSelectionClass(t,e,s))}}updateSelectionClass(t,e,i){for(let t=0;t<Object.keys(e).length;t++){let n=Object.values(e)[t];this.removeClass(i,n)}return""!==t&&this.addClass(i,t),this.cleanChildrenClass(i,e),this.cleanUnusedSpan(i),i}cleanChildrenClass(t,e){if(!t.hasChildNodes())return;Array.from(t.children).map((t=>{for(let i=0;i<Object.keys(e).length;i++){let n=Object.values(e)[i];this.removeClass(t,n)}}));const i=Array.from(t.children).map((t=>this.cleanChildrenClass(t,e)));i&&i.length}getSelectedBlocks(){let t=!1,e=this.builder.win.getSelection(),i=[];if(!e.isCollapsed){let t=e.getRangeAt(0),n=t.commonAncestorContainer;const o=e=>{if(e.nodeType===Node.ELEMENT_NODE&&t.intersectsNode(e)&&i.push(e),e.childNodes.length>0)for(let t=0;t<e.childNodes.length;t++)o(e.childNodes[t])};o(n),i.length>0&&i[0]===n&&i.shift()}let n=[];const o=["p","h1","h2","h3","h4","h5","h6","div","pre","td","th","li"];return i.forEach((e=>{const i=e.tagName.toLowerCase();o.includes(i)&&(t=!0,n.push(e))})),2===n.length&&n[0].innerText.trim()===e.toString().trim()&&n.pop(),t?n:[]}execCommandToggle(t,e,i){const n=this.getSelectedBlocks();if(n.length>0)n.forEach((n=>{if("fontWeight"===t){let t=!1;this.hasClass(n,i.fontWeight.defaultBold)&&(t=!0),this.removeClass(n,i.fontWeight.thin),this.removeClass(n,i.fontWeight.extralight),this.removeClass(n,i.fontWeight.light),this.removeClass(n,i.fontWeight.normal),this.removeClass(n,i.fontWeight.medium),this.removeClass(n,i.fontWeight.semibold),this.removeClass(n,i.fontWeight.bold),this.removeClass(n,i.fontWeight.extrabold),this.removeClass(n,i.fontWeight.black),t||this.addClass(n,i.fontWeight.defaultBold)}if("fontStyle"===t){let t=!1;this.hasClass(n,i.fontStyle.italic)&&(t=!0),this.removeClass(n,i.fontStyle.italic),this.removeClass(n,i.fontStyle.normal),t||this.addClass(n,i.fontStyle.italic)}if("textUnderline"===t){let t=!1;this.hasClass(n,i.textDecoration.underline)&&(t=!0),this.removeClass(n,i.textDecoration.linethrough),this.removeClass(n,i.textDecoration.underline),this.removeClass(n,i.textDecoration.normal),t||this.addClass(n,i.textDecoration.underline)}if("textLinethrough"===t){let t=!1;this.hasClass(n,i.textDecoration.linethrough)&&(t=!0),this.removeClass(n,i.textDecoration.underline),this.removeClass(n,i.textDecoration.linethrough),this.removeClass(n,i.textDecoration.normal),t||this.addClass(n,i.textDecoration.linethrough)}if("textTransform"===t){let t="";this.hasClass(n,i.textTransform.uppercase)&&(t="uppercase"),this.removeClass(n,i.textTransform.uppercase),this.removeClass(n,i.textTransform.lowercase),this.removeClass(n,i.textTransform.capitalize),this.removeClass(n,i.textTransform.normal),""===t&&this.addClass(n,i.textTransform.uppercase)}if("clean"===t&&(n.className="",n.style.cssText=""),"extend"===t){let t=!1;this.hasClass(n,i.extend[e])&&(t=!0),t?this.removeClass(n,i.extend[e]):this.addClass(n,i.extend[e])}this.cleanChildrenToggle(t,e,n,i),this.cleanUnusedSpan(n)}));else{const n=this.builder.win.getSelection(),o=this.getElm();if(!o)return;o&&o.innerText===n.toString().trim()||""===n.toString().trim()?this.updateSelectionToggle(t,e,i,o):this.replaceSelectionToggle(t,e,i,n,o)}}getElm(){const t=this.builder.win.getSelection();if(!t)return!1;const e=t.anchorNode;if(!e)return!1;return e.nodeType!==Node.TEXT_NODE&&e.nodeType!==Node.COMMENT_NODE?e:e.parentElement}updateSelectionToggle(t,e,i,n){if("fontWeight"===t){let t=!1;this.hasClass(n,i.fontWeight.defaultBold)&&(t=!0);parseInt(window.getComputedStyle(n,null).getPropertyValue("font-weight"))>=500&&(t=!0),this.removeClass(n,i.fontWeight.thin),this.removeClass(n,i.fontWeight.extralight),this.removeClass(n,i.fontWeight.light),this.removeClass(n,i.fontWeight.normal),this.removeClass(n,i.fontWeight.medium),this.removeClass(n,i.fontWeight.semibold),this.removeClass(n,i.fontWeight.bold),this.removeClass(n,i.fontWeight.extrabold),this.removeClass(n,i.fontWeight.black),t?this.addClass(n,i.fontWeight.defaultNormal):this.addClass(n,i.fontWeight.defaultBold)}if("fontStyle"===t){let t=!1;this.hasClass(n,i.fontStyle.italic)&&(t=!0),this.removeClass(n,i.fontStyle.italic),this.removeClass(n,i.fontStyle.normal),t?this.addClass(n,i.fontStyle.normal):this.addClass(n,i.fontStyle.italic)}if("textUnderline"===t){let t=!1;this.hasClass(n,i.textDecoration.underline)&&(t=!0),this.removeClass(n,i.textDecoration.underline),this.removeClass(n,i.textDecoration.linethrough),this.removeClass(n,i.textDecoration.normal),t?this.addClass(n,i.textDecoration.normal):this.addClass(n,i.textDecoration.underline)}if("textLinethrough"===t){let t=!1;this.hasClass(n,i.textDecoration.linethrough)&&(t=!0),this.removeClass(n,i.textDecoration.underline),this.removeClass(n,i.textDecoration.linethrough),this.removeClass(n,i.textDecoration.normal),t?this.addClass(n,i.textDecoration.normal):this.addClass(n,i.textDecoration.linethrough)}if("textTransform"===t){let t="";this.hasClass(n,i.textTransform.uppercase)&&(t="uppercase"),this.removeClass(n,i.textTransform.uppercase),this.removeClass(n,i.textTransform.lowercase),this.removeClass(n,i.textTransform.capitalize),this.removeClass(n,i.textTransform.normal),""===t&&this.addClass(n,i.textTransform.uppercase)}if("clean"===t&&(n.className="",n.style.cssText=""),"extend"===t){let t=!1;this.hasClass(n,i.extend[e])&&(t=!0),t?this.removeClass(n,i.extend[e]):this.addClass(n,i.extend[e])}return this.cleanChildrenToggle(t,e,n,i),this.cleanUnusedSpan(n),n}replaceSelectionToggle(t,e,i,n,o){const s=n.getRangeAt(0),l=s.extractContents(),a=document.createElement("span");if("fontWeight"===t){let t=!1;o.closest(`.${i.fontWeight.defaultBold}`)&&(t=!0,this.hasClass(o,i.fontWeight.defaultNormal)&&(t=!1));parseInt(window.getComputedStyle(o,null).getPropertyValue("font-weight"))>=500&&(t=!0),t?this.addClass(a,i.fontWeight.defaultNormal):this.addClass(a,i.fontWeight.defaultBold)}if("fontStyle"===t){let t=!1;o.closest(`.${i.fontStyle.italic}`)&&(t=!0,this.hasClass(o,i.fontStyle.normal)&&(t=!1)),t?this.addClass(a,i.fontStyle.normal):this.addClass(a,i.fontStyle.italic)}if("textUnderline"===t){let t=!1;o.closest(`.${i.textDecoration.underline}`)&&(t=!0),t||this.addClass(a,i.textDecoration.underline)}if("textLinethrough"===t){let t=!1;o.closest(`.${i.textDecoration.linethrough}`)&&(t=!0),t||this.addClass(a,i.textDecoration.linethrough)}if("textTransform"===t){let t="";o.closest(`.${i.textTransform.uppercase}`)&&(t="uppercase"),this.removeClass(a,i.textTransform.uppercase),this.removeClass(a,i.textTransform.lowercase),this.removeClass(a,i.textTransform.capitalize),this.removeClass(a,i.textTransform.normal),""===t&&this.addClass(a,i.textTransform.uppercase)}if("extend"===t){let t=!1;o.closest(`.${i.extend[e]}`)&&(t=!0),t||this.addClass(a,i.extend[e])}return a.appendChild(l),this.cleanChildrenToggle(t,e,a,i),this.cleanUnusedSpan(a),s.insertNode(a),n.selectAllChildren(a),a}cleanChildrenToggle(t,e,i,n){if(!i.hasChildNodes())return;"fontWeight"===t&&Array.from(i.children).map((t=>{this.removeClass(t,n.fontWeight.thin),this.removeClass(t,n.fontWeight.extralight),this.removeClass(t,n.fontWeight.light),this.removeClass(t,n.fontWeight.normal),this.removeClass(t,n.fontWeight.medium),this.removeClass(t,n.fontWeight.semibold),this.removeClass(t,n.fontWeight.bold),this.removeClass(t,n.fontWeight.extrabold),this.removeClass(t,n.fontWeight.black)})),"fontStyle"===t&&Array.from(i.children).map((t=>{this.removeClass(t,n.fontStyle.italic),this.removeClass(t,n.fontStyle.normal)})),"textUnderline"===t&&Array.from(i.children).map((t=>{this.removeClass(t,n.textDecoration.underline),this.removeClass(t,n.textDecoration.linethrough),this.removeClass(t,n.textDecoration.normal)})),"textLinethrough"===t&&Array.from(i.children).map((t=>{this.removeClass(t,n.textDecoration.underline),this.removeClass(t,n.textDecoration.linethrough),this.removeClass(t,n.textDecoration.normal)})),"textTransform"===t&&Array.from(i.children).map((t=>{this.removeClass(t,n.textTransform.uppercase),this.removeClass(t,n.textTransform.lowercase),this.removeClass(t,n.textTransform.capitalize),this.removeClass(t,n.textTransform.normal)})),"clean"===t&&Array.from(i.children).map((t=>{t.className="",t.style.cssText=""})),"extend"===t&&Array.from(i.children).map((t=>{this.removeClass(t,n.extend[e])}));const o=Array.from(i.children).map((i=>this.cleanChildrenToggle(t,e,i,n)));o&&o.length}getSelection(){return this.builder.win&&this.builder.win.getSelection?this.builder.win.getSelection():this.builder.doc&&this.builder.doc.getSelection?this.builder.doc.getSelection():this.builder.doc&&this.builder.doc.selection?this.builder.doc.selection.createRange().text:null}cleanChildren(t,e){if(!e.hasChildNodes())return;const i=Array.from(e.children).filter((e=>void 0!==e.style[t]&&""!==e.style[t.style]));i&&i.length>0&&i.forEach((e=>{e.style[t]="",""!==e.getAttribute("style")&&null!==e.style||e.removeAttribute("style")}));const n=Array.from(e.children).map((e=>this.cleanChildren(t,e)));n&&n.length}addCssClass(t,e,i){this.removeCssClasses(t,i),this.addClass(t,e)}removeCssClasses(t,e){for(let i=0;i<Object.keys(e).length;i++){const n=Object.values(e)[i];this.removeClass(t,n)}}removeEmptyStyle(t){if(!t.hasChildNodes())return;const e=Array.from(t.children).filter((t=>t.getAttribute("style")));e&&e.length>0&&e.forEach((t=>{""!==t.getAttribute("style").trim()&&null!==t.style||t.removeAttribute("style")}));const i=Array.from(t.children).map((t=>this.removeEmptyStyle(t)));i&&i.length}cleanClassSize(t,e){if(!t.hasChildNodes())return;const i=Array.from(t.children).filter((t=>this.hasClass(t,e)));i&&i.length>0&&i.forEach((t=>{this.removeClass(t,e)}));const n=Array.from(t.children).map((t=>this.cleanClassSize(t,e)));n&&n.length}removeFormat(){const t=this.getSelection();if(!t)return;const e=t.anchorNode;if(!e)return;const i=e.nodeType!==Node.TEXT_NODE&&e.nodeType!==Node.COMMENT_NODE?e:e.parentElement;i&&i.innerText===t.toString().trim()||""===t.toString().trim()?this.cleanElement(i):this.cleanSelection(t)}cleanElement(t){t.style.fontWeight="",t.style.fontStyle="",t.style.textDecoration="",t.style.textTransform="",t.style.fontFamily="",t.style.fontSize="",t.style.color="",t.style.backgroundColor="",t.classList.forEach((e=>{-1!==e.indexOf("size-")&&this.removeClass(t,e)})),t.querySelectorAll("*").forEach((t=>{t.style.fontWeight="",t.style.fontStyle="",t.style.textDecoration="",t.style.textTransform="",t.style.fontFamily="",t.style.fontSize="",t.style.color="",t.style.backgroundColor="",t.classList.forEach((e=>{-1!==e.indexOf("size-")&&this.removeClass(t,e)}))})),this.cleanUnusedSpan(t)}cleanSelection(t){const e=t.getRangeAt(0),i=e.extractContents(),n=document.createElement("span");n.appendChild(i),e.insertNode(n),t.selectAllChildren(n),this.cleanElement(n)}cleanUnusedSpan(t){let e=t.querySelectorAll("span");const i=Array.prototype.filter;let n=i.call(e,(t=>0===t.attributes.length));n&&n.length>0&&n.forEach((t=>{t.outerHTML=t.innerHTML})),e=t.querySelectorAll("span"),i.call(e,(t=>{""===t.innerHTML&&t.parentNode.removeChild(t)})),e=t.querySelectorAll("span"),n=i.call(e,(t=>0===t.attributes.length)),n&&n.length>0&&this.cleanUnusedSpan(t)}contentReformat(t,e){this.replaceTag(t,"b",e.fontWeight.defaultBold),this.replaceTag(t,"i",e.fontStyle.italic),this.replaceTag(t,"u",e.textDecoration.underline),this.replaceTag(t,"strike",e.textDecoration.linethrough),this.replaceInline(t,"font-weight","normal",e.fontWeight.defaultBold),this.replaceInline(t,"font-weight","bold",e.fontWeight.defaultBold),this.replaceInline(t,"font-weight","600",e.fontWeight.semibold),this.replaceInline(t,"text-align","left",e.textAlign.left),this.replaceInline(t,"text-align","right",e.textAlign.right),this.replaceInline(t,"text-align","center",e.textAlign.center),this.replaceInline(t,"text-align","justify",e.textAlign.justify),this.replaceInline(t,"display","flex",e.display.flex),this.replaceInline(t,"justiify-content","flex-start",e.justifyContent.start),this.replaceInline(t,"justiify-content","flex-end",e.justifyContent.end),this.replaceInline(t,"justiify-content","center",e.justifyContent.center),this.replaceInline(t,"justiify-content","space-between",e.justifyContent.between),this.replaceInline(t,"flex-direction","column",e.flexDirection.column),this.replaceInline(t,"flex-direction","row",e.flexDirection.row),this.replaceInline(t,"align-items","flex-start",e.alignItems.start),this.replaceInline(t,"align-items","flex-end",e.alignItems.end),this.replaceInline(t,"align-items","center",e.alignItems.center),this.replaceInline(t,"text-transform","uppercase",e.textTransform.uppercase),this.replaceInline(t,"text-transform","lowercase",e.textTransform.lowercase),this.replaceInline(t,"text-transform","none",e.textTransform.normal),this.replaceInline(t,"line-height","1",e.leading.leading_10),this.replaceInline(t,"line-height","1.1",e.leading.leading_11),this.replaceInline(t,"line-height","1.2",e.leading.leading_12),this.replaceInline(t,"line-height","1.25",e.leading.leading_125),this.replaceInline(t,"line-height","1.3",e.leading.leading_13),this.replaceInline(t,"line-height","1.375",e.leading.leading_1375),this.replaceInline(t,"line-height","1.4",e.leading.leading_14),this.replaceInline(t,"line-height","1.5",e.leading.leading_15),this.replaceInline(t,"line-height","1.6",e.leading.leading_16),this.replaceInline(t,"line-height","1.625",e.leading.leading_1625),this.replaceInline(t,"line-height","1.7",e.leading.leading_17),this.replaceInline(t,"line-height","1.8",e.leading.leading_18),this.replaceInline(t,"line-height","1.9",e.leading.leading_19),this.replaceInline(t,"line-height","2",e.leading.leading_20),this.replaceInline(t,"line-height","2.1",e.leading.leading_21),this.replaceInline(t,"line-height","2.2",e.leading.leading_22)}replaceTag(t,e,i){let n=t.querySelectorAll(e);let o=Array.prototype.filter.call(n,(t=>0===t.attributes.length));o&&o.length>0&&o.forEach((t=>{const e=document.createElement("span");e.setAttribute("class",i),e.innerHTML=t.innerHTML,t.outerHTML=e.outerHTML}))}replaceInline(t,e,i,n){t.querySelectorAll("*").forEach((t=>{"justiify-content"===e?t.style.justifyContent===`${i}`&&(this.addClass(t,n),t.style.justifyContent=""):t.style[e]===`${i}`&&(this.addClass(t,n),t.style[e]="")}))}countOccurrences(t,e){const i=new RegExp(e,"gi"),n=t.match(i);return n?n.length:0}}var ae="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},re={exports:{}},ce={},ue={exports:{}},de={},be={};function he(t){this.__parent=t,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}function pe(t,e){this.__cache=[""],this.__indent_size=t.indent_size,this.__indent_string=t.indent_char,t.indent_with_tabs||(this.__indent_string=new Array(t.indent_size+1).join(t.indent_char)),e=e||"",t.indent_level>0&&(e=new Array(t.indent_level+1).join(this.__indent_string)),this.__base_string=e,this.__base_string_length=e.length}function ge(t,e){this.__indent_cache=new pe(t,e),this.raw=!1,this._end_with_newline=t.end_with_newline,this.indent_size=t.indent_size,this.wrap_line_length=t.wrap_line_length,this.indent_empty_lines=t.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new he(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}he.prototype.clone_empty=function(){var t=new he(this.__parent);return t.set_indent(this.__indent_count,this.__alignment_count),t},he.prototype.item=function(t){return t<0?this.__items[this.__items.length+t]:this.__items[t]},he.prototype.has_match=function(t){for(var e=this.__items.length-1;e>=0;e--)if(this.__items[e].match(t))return!0;return!1},he.prototype.set_indent=function(t,e){this.is_empty()&&(this.__indent_count=t||0,this.__alignment_count=e||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},he.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},he.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},he.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var t=this.__parent.current_line;return t.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),t.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),t.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count," "===t.__items[0]&&(t.__items.splice(0,1),t.__character_count-=1),!0}return!1},he.prototype.is_empty=function(){return 0===this.__items.length},he.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},he.prototype.push=function(t){this.__items.push(t);var e=t.lastIndexOf("\n");-1!==e?this.__character_count=t.length-e:this.__character_count+=t.length},he.prototype.pop=function(){var t=null;return this.is_empty()||(t=this.__items.pop(),this.__character_count-=t.length),t},he.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},he.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},he.prototype.trim=function(){for(;" "===this.last();)this.__items.pop(),this.__character_count-=1},he.prototype.toString=function(){var t="";return this.is_empty()?this.__parent.indent_empty_lines&&(t=this.__parent.get_indent_string(this.__indent_count)):(t=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),t+=this.__items.join("")),t},pe.prototype.get_indent_size=function(t,e){var i=this.__base_string_length;return e=e||0,t<0&&(i=0),i+=t*this.__indent_size,i+=e},pe.prototype.get_indent_string=function(t,e){var i=this.__base_string;return e=e||0,t<0&&(t=0,i=""),e+=t*this.__indent_size,this.__ensure_cache(e),i+=this.__cache[e]},pe.prototype.__ensure_cache=function(t){for(;t>=this.__cache.length;)this.__add_column()},pe.prototype.__add_column=function(){var t=this.__cache.length,e=0,i="";this.__indent_size&&t>=this.__indent_size&&(t-=(e=Math.floor(t/this.__indent_size))*this.__indent_size,i=new Array(e+1).join(this.__indent_string)),t&&(i+=new Array(t+1).join(" ")),this.__cache.push(i)},ge.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},ge.prototype.get_line_number=function(){return this.__lines.length},ge.prototype.get_indent_string=function(t,e){return this.__indent_cache.get_indent_string(t,e)},ge.prototype.get_indent_size=function(t,e){return this.__indent_cache.get_indent_size(t,e)},ge.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},ge.prototype.add_new_line=function(t){return!(this.is_empty()||!t&&this.just_added_newline())&&(this.raw||this.__add_outputline(),!0)},ge.prototype.get_code=function(t){this.trim(!0);var e=this.current_line.pop();e&&("\n"===e[e.length-1]&&(e=e.replace(/\n+$/g,"")),this.current_line.push(e)),this._end_with_newline&&this.__add_outputline();var i=this.__lines.join("\n");return"\n"!==t&&(i=i.replace(/[\n]/g,t)),i},ge.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},ge.prototype.set_indent=function(t,e){return t=t||0,e=e||0,this.next_line.set_indent(t,e),this.__lines.length>1?(this.current_line.set_indent(t,e),!0):(this.current_line.set_indent(),!1)},ge.prototype.add_raw_token=function(t){for(var e=0;e<t.newlines;e++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(t.whitespace_before),this.current_line.push(t.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},ge.prototype.add_token=function(t){this.__add_space_before_token(),this.current_line.push(t),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},ge.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},ge.prototype.remove_indent=function(t){for(var e=this.__lines.length;t<e;)this.__lines[t]._remove_indent(),t++;this.current_line._remove_wrap_indent()},ge.prototype.trim=function(t){for(t=void 0!==t&&t,this.current_line.trim();t&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},ge.prototype.just_added_newline=function(){return this.current_line.is_empty()},ge.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},ge.prototype.ensure_empty_line_above=function(t,e){for(var i=this.__lines.length-2;i>=0;){var n=this.__lines[i];if(n.is_empty())break;if(0!==n.item(0).indexOf(t)&&n.item(-1)!==e){this.__lines.splice(i+1,0,new he(this)),this.previous_line=this.__lines[this.__lines.length-2];break}i--}},be.Output=ge;var me={};me.Token=function(t,e,i,n){this.type=t,this.text=e,this.comments_before=null,this.newlines=i||0,this.whitespace_before=n||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null};var fe,ve,ye,xe,we,Se,ke={};we="(?:\\\\u[0-9a-fA-F]{4}|[\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a"+(ye="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc")+"])",Se="(?:\\\\u[0-9a-fA-F]{4}|["+(ve="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a")+ye+(xe="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f")+"])*",(fe=ke).identifier=new RegExp(we+Se,"g"),fe.identifierStart=new RegExp(we),fe.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+ve+ye+xe+"])+"),fe.newline=/[\n\r\u2028\u2029]/,fe.lineBreak=new RegExp("\r\n|"+fe.newline.source),fe.allLineBreaks=new RegExp(fe.lineBreak.source,"g");var _e={},Ce={};function Ee(t,e){this.raw_options=Le(t,e),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs","\t"===this.indent_char),this.indent_with_tabs&&(this.indent_char="\t",1===this.indent_size&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}function Le(t,e){var i,n={};for(i in t=Ae(t))i!==e&&(n[i]=t[i]);if(e&&t[e])for(i in t[e])n[i]=t[e][i];return n}function Ae(t){var e,i={};for(e in t){i[e.replace(/-/g,"_")]=t[e]}return i}Ee.prototype._get_array=function(t,e){var i=this.raw_options[t],n=e||[];return"object"==typeof i?null!==i&&"function"==typeof i.concat&&(n=i.concat()):"string"==typeof i&&(n=i.split(/[^a-zA-Z0-9_\/\-]+/)),n},Ee.prototype._get_boolean=function(t,e){var i=this.raw_options[t];return void 0===i?!!e:!!i},Ee.prototype._get_characters=function(t,e){var i=this.raw_options[t],n=e||"";return"string"==typeof i&&(n=i.replace(/\\r/,"\r").replace(/\\n/,"\n").replace(/\\t/,"\t")),n},Ee.prototype._get_number=function(t,e){var i=this.raw_options[t];e=parseInt(e,10),isNaN(e)&&(e=0);var n=parseInt(i,10);return isNaN(n)&&(n=e),n},Ee.prototype._get_selection=function(t,e,i){var n=this._get_selection_list(t,e,i);if(1!==n.length)throw new Error("Invalid Option Value: The option '"+t+"' can only be one of the following values:\n"+e+"\nYou passed in: '"+this.raw_options[t]+"'");return n[0]},Ee.prototype._get_selection_list=function(t,e,i){if(!e||0===e.length)throw new Error("Selection list cannot be empty.");if(i=i||[e[0]],!this._is_valid_selection(i,e))throw new Error("Invalid Default Value!");var n=this._get_array(t,i);if(!this._is_valid_selection(n,e))throw new Error("Invalid Option Value: The option '"+t+"' can contain only the following values:\n"+e+"\nYou passed in: '"+this.raw_options[t]+"'");return n},Ee.prototype._is_valid_selection=function(t,e){return t.length&&e.length&&!t.some((function(t){return-1===e.indexOf(t)}))},Ce.Options=Ee,Ce.normalizeOpts=Ae,Ce.mergeOpts=Le;var qe=Ce.Options,Te=["before-newline","after-newline","preserve-newline"];function Me(t){qe.call(this,t,"js");var e=this.raw_options.brace_style||null;"expand-strict"===e?this.raw_options.brace_style="expand":"collapse-preserve-inline"===e?this.raw_options.brace_style="collapse,preserve-inline":void 0!==this.raw_options.braces_on_own_line&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var i=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var n=0;n<i.length;n++)"preserve-inline"===i[n]?this.brace_preserve_inline=!0:this.brace_style=i[n];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",Te),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}Me.prototype=new qe,_e.Options=Me;var Oe={},Re={},Ie=RegExp.prototype.hasOwnProperty("sticky");function ze(t){this.__input=t||"",this.__input_length=this.__input.length,this.__position=0}ze.prototype.restart=function(){this.__position=0},ze.prototype.back=function(){this.__position>0&&(this.__position-=1)},ze.prototype.hasNext=function(){return this.__position<this.__input_length},ze.prototype.next=function(){var t=null;return this.hasNext()&&(t=this.__input.charAt(this.__position),this.__position+=1),t},ze.prototype.peek=function(t){var e=null;return t=t||0,(t+=this.__position)>=0&&t<this.__input_length&&(e=this.__input.charAt(t)),e},ze.prototype.__match=function(t,e){t.lastIndex=e;var i=t.exec(this.__input);return!i||Ie&&t.sticky||i.index!==e&&(i=null),i},ze.prototype.test=function(t,e){return e=e||0,(e+=this.__position)>=0&&e<this.__input_length&&!!this.__match(t,e)},ze.prototype.testChar=function(t,e){var i=this.peek(e);return t.lastIndex=0,null!==i&&t.test(i)},ze.prototype.match=function(t){var e=this.__match(t,this.__position);return e?this.__position+=e[0].length:e=null,e},ze.prototype.read=function(t,e,i){var n,o="";return t&&(n=this.match(t))&&(o+=n[0]),!e||!n&&t||(o+=this.readUntil(e,i)),o},ze.prototype.readUntil=function(t,e){var i,n=this.__position;t.lastIndex=this.__position;var o=t.exec(this.__input);return o?(n=o.index,e&&(n+=o[0].length)):n=this.__input_length,i=this.__input.substring(this.__position,n),this.__position=n,i},ze.prototype.readUntilAfter=function(t){return this.readUntil(t,!0)},ze.prototype.get_regexp=function(t,e){var i=null,n="g";return e&&Ie&&(n="y"),"string"==typeof t&&""!==t?i=new RegExp(t,n):t&&(i=new RegExp(t.source,n)),i},ze.prototype.get_literal_regexp=function(t){return RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},ze.prototype.peekUntilAfter=function(t){var e=this.__position,i=this.readUntilAfter(t);return this.__position=e,i},ze.prototype.lookBack=function(t){var e=this.__position-1;return e>=t.length&&this.__input.substring(e-t.length,e).toLowerCase()===t},Re.InputScanner=ze;var Be={},Ne={};function De(t){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=t}De.prototype.restart=function(){this.__position=0},De.prototype.isEmpty=function(){return 0===this.__tokens_length},De.prototype.hasNext=function(){return this.__position<this.__tokens_length},De.prototype.next=function(){var t=null;return this.hasNext()&&(t=this.__tokens[this.__position],this.__position+=1),t},De.prototype.peek=function(t){var e=null;return t=t||0,(t+=this.__position)>=0&&t<this.__tokens_length&&(e=this.__tokens[t]),e},De.prototype.add=function(t){this.__parent_token&&(t.parent=this.__parent_token),this.__tokens.push(t),this.__tokens_length+=1},Ne.TokenStream=De;var Pe={},$e={};function He(t,e){this._input=t,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,e&&(this._starting_pattern=this._input.get_regexp(e._starting_pattern,!0),this._match_pattern=this._input.get_regexp(e._match_pattern,!0),this._until_pattern=this._input.get_regexp(e._until_pattern),this._until_after=e._until_after)}He.prototype.read=function(){var t=this._input.read(this._starting_pattern);return this._starting_pattern&&!t||(t+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),t},He.prototype.read_match=function(){return this._input.match(this._match_pattern)},He.prototype.until_after=function(t){var e=this._create();return e._until_after=!0,e._until_pattern=this._input.get_regexp(t),e._update(),e},He.prototype.until=function(t){var e=this._create();return e._until_after=!1,e._until_pattern=this._input.get_regexp(t),e._update(),e},He.prototype.starting_with=function(t){var e=this._create();return e._starting_pattern=this._input.get_regexp(t,!0),e._update(),e},He.prototype.matching=function(t){var e=this._create();return e._match_pattern=this._input.get_regexp(t,!0),e._update(),e},He.prototype._create=function(){return new He(this._input,this)},He.prototype._update=function(){},$e.Pattern=He;var Fe=$e.Pattern;function je(t,e){Fe.call(this,t,e),e?this._line_regexp=this._input.get_regexp(e._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}je.prototype=new Fe,je.prototype.__set_whitespace_patterns=function(t,e){t+="\\t ",e+="\\n\\r",this._match_pattern=this._input.get_regexp("["+t+e+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+e+"]")},je.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var t=this._input.read(this._match_pattern);if(" "===t)this.whitespace_before_token=" ";else if(t){var e=this.__split(this._newline_regexp,t);this.newline_count=e.length-1,this.whitespace_before_token=e[this.newline_count]}return t},je.prototype.matching=function(t,e){var i=this._create();return i.__set_whitespace_patterns(t,e),i._update(),i},je.prototype._create=function(){return new je(this._input,this)},je.prototype.__split=function(t,e){t.lastIndex=0;for(var i=0,n=[],o=t.exec(e);o;)n.push(e.substring(i,o.index)),i=o.index+o[0].length,o=t.exec(e);return i<e.length?n.push(e.substring(i,e.length)):n.push(""),n},Pe.WhitespacePattern=je;var Ue=Re.InputScanner,We=me.Token,Ge=Ne.TokenStream,Ve=Pe.WhitespacePattern,Ye={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},Xe=function(t,e){this._input=new Ue(t),this._options=e||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new Ve(this._input)};Xe.prototype.tokenize=function(){var t;this._input.restart(),this.__tokens=new Ge,this._reset();for(var e=new We(Ye.START,""),i=null,n=[],o=new Ge;e.type!==Ye.EOF;){for(t=this._get_next_token(e,i);this._is_comment(t);)o.add(t),t=this._get_next_token(e,i);o.isEmpty()||(t.comments_before=o,o=new Ge),t.parent=i,this._is_opening(t)?(n.push(i),i=t):i&&this._is_closing(t,i)&&(t.opened=i,i.closed=t,i=n.pop(),t.parent=i),t.previous=e,e.next=t,this.__tokens.add(t),e=t}return this.__tokens},Xe.prototype._is_first_token=function(){return this.__tokens.isEmpty()},Xe.prototype._reset=function(){},Xe.prototype._get_next_token=function(t,e){this._readWhitespace();var i=this._input.read(/.+/g);return i?this._create_token(Ye.RAW,i):this._create_token(Ye.EOF,"")},Xe.prototype._is_comment=function(t){return!1},Xe.prototype._is_opening=function(t){return!1},Xe.prototype._is_closing=function(t,e){return!1},Xe.prototype._create_token=function(t,e){return new We(t,e,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token)},Xe.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},Be.Tokenizer=Xe,Be.TOKEN=Ye;var Ze={};function Ke(t,e){t="string"==typeof t?t:t.source,e="string"==typeof e?e:e.source,this.__directives_block_pattern=new RegExp(t+/ beautify( \w+[:]\w+)+ /.source+e,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(t+/\sbeautify\signore:end\s/.source+e,"g")}Ke.prototype.get_directives=function(t){if(!t.match(this.__directives_block_pattern))return null;var e={};this.__directive_pattern.lastIndex=0;for(var i=this.__directive_pattern.exec(t);i;)e[i[1]]=i[2],i=this.__directive_pattern.exec(t);return e},Ke.prototype.readIgnored=function(t){return t.readUntilAfter(this.__directives_end_ignore_pattern)},Ze.Directives=Ke;var Qe={},Je=$e.Pattern,ti={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function ei(t,e){Je.call(this,t,e),this.__template_pattern=null,this._disabled=Object.assign({},ti),this._excluded=Object.assign({},ti),e&&(this.__template_pattern=this._input.get_regexp(e.__template_pattern),this._excluded=Object.assign(this._excluded,e._excluded),this._disabled=Object.assign(this._disabled,e._disabled));var i=new Je(t);this.__patterns={handlebars_comment:i.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:i.starting_with(/{{{/).until_after(/}}}/),handlebars:i.starting_with(/{{/).until_after(/}}/),php:i.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:i.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:i.starting_with(/{%/).until_after(/%}/),django_value:i.starting_with(/{{/).until_after(/}}/),django_comment:i.starting_with(/{#/).until_after(/#}/),smarty:i.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:i.starting_with(/{\*/).until_after(/\*}/),smarty_literal:i.starting_with(/{literal}/).until_after(/{\/literal}/)}}ei.prototype=new Je,ei.prototype._create=function(){return new ei(this._input,this)},ei.prototype._update=function(){this.__set_templated_pattern()},ei.prototype.disable=function(t){var e=this._create();return e._disabled[t]=!0,e._update(),e},ei.prototype.read_options=function(t){var e=this._create();for(var i in ti)e._disabled[i]=-1===t.templating.indexOf(i);return e._update(),e},ei.prototype.exclude=function(t){var e=this._create();return e._excluded[t]=!0,e._update(),e},ei.prototype.read=function(){var t="";t=this._match_pattern?this._input.read(this._starting_pattern):this._input.read(this._starting_pattern,this.__template_pattern);for(var e=this._read_template();e;)this._match_pattern?e+=this._input.read(this._match_pattern):e+=this._input.readUntil(this.__template_pattern),t+=e,e=this._read_template();return this._until_after&&(t+=this._input.readUntilAfter(this._until_pattern)),t},ei.prototype.__set_templated_pattern=function(){var t=[];this._disabled.php||t.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||t.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||t.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(t.push(this.__patterns.django._starting_pattern.source),t.push(this.__patterns.django_value._starting_pattern.source),t.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||t.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&t.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+t.join("|")+")")},ei.prototype._read_template=function(){var t="",e=this._input.peek();if("<"===e){var i=this._input.peek(1);this._disabled.php||this._excluded.php||"?"!==i||(t=t||this.__patterns.php.read()),this._disabled.erb||this._excluded.erb||"%"!==i||(t=t||this.__patterns.erb.read())}else"{"===e&&(this._disabled.handlebars||this._excluded.handlebars||(t=(t=(t=t||this.__patterns.handlebars_comment.read())||this.__patterns.handlebars_unescaped.read())||this.__patterns.handlebars.read()),this._disabled.django||(this._excluded.django||this._excluded.handlebars||(t=t||this.__patterns.django_value.read()),this._excluded.django||(t=(t=t||this.__patterns.django_comment.read())||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(t=(t=(t=t||this.__patterns.smarty_comment.read())||this.__patterns.smarty_literal.read())||this.__patterns.smarty.read()));return t},Qe.TemplatablePattern=ei;var ii=Re.InputScanner,ni=Be.Tokenizer,oi=Be.TOKEN,si=Ze.Directives,li=ke,ai=$e.Pattern,ri=Qe.TemplatablePattern;function ci(t,e){return-1!==e.indexOf(t)}var ui={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:oi.START,RAW:oi.RAW,EOF:oi.EOF},di=new si(/\/\*/,/\*\//),bi=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,hi=/[0-9]/,pi=/[^\d\.]/,gi=">>> === !== << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),mi=">>>= ... >>= <<= === >>> !== **= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";mi=(mi="\\?\\.(?!\\d) "+(mi=mi.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"))).replace(/ /g,"|");var fi,vi=new RegExp(mi),yi="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),xi=yi.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as"]),wi=new RegExp("^(?:"+xi.join("|")+")$"),Si=function(t,e){ni.call(this,t,e),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var i=new ai(this._input),n=new ri(this._input).read_options(this._options);this.__patterns={template:n,identifier:n.starting_with(li.identifier).matching(li.identifierMatch),number:i.matching(bi),punct:i.matching(vi),comment:i.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:i.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:i.matching(/<!--/),html_comment_end:i.matching(/-->/),include:i.starting_with(/#include/).until_after(li.lineBreak),shebang:i.starting_with(/#!/).until_after(li.lineBreak),xml:i.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[\s\S]+?}|!\[CDATA\[[\s\S]*?\]\]|)(\s+{[\s\S]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{[\s\S]+?}))*\s*(\/?)\s*>/),single_quote:n.until(/['\\\n\r\u2028\u2029]/),double_quote:n.until(/["\\\n\r\u2028\u2029]/),template_text:n.until(/[`\\$]/),template_expression:n.until(/[`}\\]/)}};(Si.prototype=new ni)._is_comment=function(t){return t.type===ui.COMMENT||t.type===ui.BLOCK_COMMENT||t.type===ui.UNKNOWN},Si.prototype._is_opening=function(t){return t.type===ui.START_BLOCK||t.type===ui.START_EXPR},Si.prototype._is_closing=function(t,e){return(t.type===ui.END_BLOCK||t.type===ui.END_EXPR)&&e&&("]"===t.text&&"["===e.text||")"===t.text&&"("===e.text||"}"===t.text&&"{"===e.text)},Si.prototype._reset=function(){fi=!1},Si.prototype._get_next_token=function(t,e){var i=null;this._readWhitespace();var n=this._input.peek();return null===n?this._create_token(ui.EOF,""):i=(i=(i=(i=(i=(i=(i=(i=(i=i||this._read_non_javascript(n))||this._read_string(n))||this._read_word(t))||this._read_singles(n))||this._read_comment(n))||this._read_regexp(n,t))||this._read_xml(n,t))||this._read_punctuation())||this._create_token(ui.UNKNOWN,this._input.next())},Si.prototype._read_word=function(t){var e;return""!==(e=this.__patterns.identifier.read())?(e=e.replace(li.allLineBreaks,"\n"),t.type!==ui.DOT&&(t.type!==ui.RESERVED||"set"!==t.text&&"get"!==t.text)&&wi.test(e)?"in"===e||"of"===e?this._create_token(ui.OPERATOR,e):this._create_token(ui.RESERVED,e):this._create_token(ui.WORD,e)):""!==(e=this.__patterns.number.read())?this._create_token(ui.WORD,e):void 0},Si.prototype._read_singles=function(t){var e=null;return"("===t||"["===t?e=this._create_token(ui.START_EXPR,t):")"===t||"]"===t?e=this._create_token(ui.END_EXPR,t):"{"===t?e=this._create_token(ui.START_BLOCK,t):"}"===t?e=this._create_token(ui.END_BLOCK,t):";"===t?e=this._create_token(ui.SEMICOLON,t):"."===t&&pi.test(this._input.peek(1))?e=this._create_token(ui.DOT,t):","===t&&(e=this._create_token(ui.COMMA,t)),e&&this._input.next(),e},Si.prototype._read_punctuation=function(){var t=this.__patterns.punct.read();if(""!==t)return"="===t?this._create_token(ui.EQUALS,t):"?."===t?this._create_token(ui.DOT,t):this._create_token(ui.OPERATOR,t)},Si.prototype._read_non_javascript=function(t){var e="";if("#"===t){if(this._is_first_token()&&(e=this.__patterns.shebang.read()))return this._create_token(ui.UNKNOWN,e.trim()+"\n");if(e=this.__patterns.include.read())return this._create_token(ui.UNKNOWN,e.trim()+"\n");t=this._input.next();var i="#";if(this._input.hasNext()&&this._input.testChar(hi)){do{i+=t=this._input.next()}while(this._input.hasNext()&&"#"!==t&&"="!==t);return"#"===t||("["===this._input.peek()&&"]"===this._input.peek(1)?(i+="[]",this._input.next(),this._input.next()):"{"===this._input.peek()&&"}"===this._input.peek(1)&&(i+="{}",this._input.next(),this._input.next())),this._create_token(ui.WORD,i)}this._input.back()}else if("<"===t&&this._is_first_token()){if(e=this.__patterns.html_comment_start.read()){for(;this._input.hasNext()&&!this._input.testChar(li.newline);)e+=this._input.next();return fi=!0,this._create_token(ui.COMMENT,e)}}else if(fi&&"-"===t&&(e=this.__patterns.html_comment_end.read()))return fi=!1,this._create_token(ui.COMMENT,e);return null},Si.prototype._read_comment=function(t){var e=null;if("/"===t){var i="";if("*"===this._input.peek(1)){i=this.__patterns.block_comment.read();var n=di.get_directives(i);n&&"start"===n.ignore&&(i+=di.readIgnored(this._input)),i=i.replace(li.allLineBreaks,"\n"),(e=this._create_token(ui.BLOCK_COMMENT,i)).directives=n}else"/"===this._input.peek(1)&&(i=this.__patterns.comment.read(),e=this._create_token(ui.COMMENT,i))}return e},Si.prototype._read_string=function(t){if("`"===t||"'"===t||'"'===t){var e=this._input.next();return this.has_char_escapes=!1,e+="`"===t?this._read_string_recursive("`",!0,"${"):this._read_string_recursive(t),this.has_char_escapes&&this._options.unescape_strings&&(e=function(t){var e="",i=0,n=new ii(t),o=null;for(;n.hasNext();)if((o=n.match(/([\s]|[^\\]|\\\\)+/g))&&(e+=o[0]),"\\"===n.peek()){if(n.next(),"x"===n.peek())o=n.match(/x([0-9A-Fa-f]{2})/g);else{if("u"!==n.peek()){e+="\\",n.hasNext()&&(e+=n.next());continue}o=n.match(/u([0-9A-Fa-f]{4})/g)}if(!o)return t;if((i=parseInt(o[1],16))>126&&i<=255&&0===o[0].indexOf("x"))return t;if(i>=0&&i<32){e+="\\"+o[0];continue}e+=34===i||39===i||92===i?"\\"+String.fromCharCode(i):String.fromCharCode(i)}return e}(e)),this._input.peek()===t&&(e+=this._input.next()),e=e.replace(li.allLineBreaks,"\n"),this._create_token(ui.STRING,e)}return null},Si.prototype._allow_regexp_or_xml=function(t){return t.type===ui.RESERVED&&ci(t.text,["return","case","throw","else","do","typeof","yield"])||t.type===ui.END_EXPR&&")"===t.text&&t.opened.previous.type===ui.RESERVED&&ci(t.opened.previous.text,["if","while","for"])||ci(t.type,[ui.COMMENT,ui.START_EXPR,ui.START_BLOCK,ui.START,ui.END_BLOCK,ui.OPERATOR,ui.EQUALS,ui.EOF,ui.SEMICOLON,ui.COMMA])},Si.prototype._read_regexp=function(t,e){if("/"===t&&this._allow_regexp_or_xml(e)){for(var i=this._input.next(),n=!1,o=!1;this._input.hasNext()&&(n||o||this._input.peek()!==t)&&!this._input.testChar(li.newline);)i+=this._input.peek(),n?n=!1:(n="\\"===this._input.peek(),"["===this._input.peek()?o=!0:"]"===this._input.peek()&&(o=!1)),this._input.next();return this._input.peek()===t&&(i+=this._input.next(),i+=this._input.read(li.identifier)),this._create_token(ui.STRING,i)}return null},Si.prototype._read_xml=function(t,e){if(this._options.e4x&&"<"===t&&this._allow_regexp_or_xml(e)){var i="",n=this.__patterns.xml.read_match();if(n){for(var o=n[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),s=0===o.indexOf("{"),l=0;n;){var a=!!n[1],r=n[2];if(!(!!n[n.length-1]||"![CDATA["===r.slice(0,8))&&(r===o||s&&r.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(a?--l:++l),i+=n[0],l<=0)break;n=this.__patterns.xml.read_match()}return n||(i+=this._input.match(/[\s\S]*/g)[0]),i=i.replace(li.allLineBreaks,"\n"),this._create_token(ui.STRING,i)}}return null},Si.prototype._read_string_recursive=function(t,e,i){var n,o;"'"===t?o=this.__patterns.single_quote:'"'===t?o=this.__patterns.double_quote:"`"===t?o=this.__patterns.template_text:"}"===t&&(o=this.__patterns.template_expression);for(var s=o.read(),l="";this._input.hasNext();){if((l=this._input.next())===t||!e&&li.newline.test(l)){this._input.back();break}"\\"===l&&this._input.hasNext()?("x"===(n=this._input.peek())||"u"===n?this.has_char_escapes=!0:"\r"===n&&"\n"===this._input.peek(1)&&this._input.next(),l+=this._input.next()):i&&("${"===i&&"$"===l&&"{"===this._input.peek()&&(l+=this._input.next()),i===l&&(l+="`"===t?this._read_string_recursive("}",e,"`"):this._read_string_recursive("`",e,"${"),this._input.hasNext()&&(l+=this._input.next()))),s+=l+=o.read()}return s},Oe.Tokenizer=Si,Oe.TOKEN=ui,Oe.positionable_operators=gi.slice(),Oe.line_starters=yi.slice();var ki=be.Output,_i=me.Token,Ci=ke,Ei=_e.Options,Li=Oe.Tokenizer,Ai=Oe.line_starters,qi=Oe.positionable_operators,Ti=Oe.TOKEN;function Mi(t,e){return-1!==e.indexOf(t)}function Oi(t,e){return t&&t.type===Ti.RESERVED&&t.text===e}function Ri(t,e){return t&&t.type===Ti.RESERVED&&Mi(t.text,e)}var Ii=["case","return","do","if","throw","else","await","break","continue","async"],zi=function(t){for(var e={},i=0;i<t.length;i++)e[t[i].replace(/-/g,"_")]=t[i];return e}(["before-newline","after-newline","preserve-newline"]),Bi=[zi.before_newline,zi.preserve_newline],Ni={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function Di(t,e){e.multiline_frame||e.mode===Ni.ForInitializer||e.mode===Ni.Conditional||t.remove_indent(e.start_line_index)}function Pi(t){return t===Ni.ArrayLiteral}function $i(t){return Mi(t,[Ni.Expression,Ni.ForInitializer,Ni.Conditional])}function Hi(t,e){e=e||{},this._source_text=t||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new Ei(e)}Hi.prototype.create_flags=function(t,e){var i=0;return t&&(i=t.indentation_level,!this._output.just_added_newline()&&t.line_indent_level>i&&(i=t.line_indent_level)),{mode:e,parent:t,last_token:t?t.last_token:new _i(Ti.START_BLOCK,""),last_word:t?t.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,indentation_level:i,alignment:0,line_indent_level:t?t.line_indent_level:i,start_line_index:this._output.get_line_number(),ternary_depth:0}},Hi.prototype._reset=function(t){var e=t.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new ki(this._options,e),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(Ni.BlockStatement);var i=new Li(t,this._options);return this._tokens=i.tokenize(),t},Hi.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var t=this._reset(this._source_text),e=this._options.eol;"auto"===this._options.eol&&(e="\n",t&&Ci.lineBreak.test(t||"")&&(e=t.match(Ci.lineBreak)[0]));for(var i=this._tokens.next();i;)this.handle_token(i),this._last_last_text=this._flags.last_token.text,this._flags.last_token=i,i=this._tokens.next();return this._output.get_code(e)},Hi.prototype.handle_token=function(t,e){t.type===Ti.START_EXPR?this.handle_start_expr(t):t.type===Ti.END_EXPR?this.handle_end_expr(t):t.type===Ti.START_BLOCK?this.handle_start_block(t):t.type===Ti.END_BLOCK?this.handle_end_block(t):t.type===Ti.WORD||t.type===Ti.RESERVED?this.handle_word(t):t.type===Ti.SEMICOLON?this.handle_semicolon(t):t.type===Ti.STRING?this.handle_string(t):t.type===Ti.EQUALS?this.handle_equals(t):t.type===Ti.OPERATOR?this.handle_operator(t):t.type===Ti.COMMA?this.handle_comma(t):t.type===Ti.BLOCK_COMMENT?this.handle_block_comment(t,e):t.type===Ti.COMMENT?this.handle_comment(t,e):t.type===Ti.DOT?this.handle_dot(t):t.type===Ti.EOF?this.handle_eof(t):(t.type,Ti.UNKNOWN,this.handle_unknown(t,e))},Hi.prototype.handle_whitespace_and_comments=function(t,e){var i=t.newlines,n=this._options.keep_array_indentation&&Pi(this._flags.mode);if(t.comments_before)for(var o=t.comments_before.next();o;)this.handle_whitespace_and_comments(o,e),this.handle_token(o,e),o=t.comments_before.next();if(n)for(var s=0;s<i;s+=1)this.print_newline(s>0,e);else if(this._options.max_preserve_newlines&&i>this._options.max_preserve_newlines&&(i=this._options.max_preserve_newlines),this._options.preserve_newlines&&i>1){this.print_newline(!1,e);for(var l=1;l<i;l+=1)this.print_newline(!0,e)}};var Fi=["async","break","continue","return","throw","yield"];Hi.prototype.allow_wrap_or_preserved_newline=function(t,e){if(e=void 0!==e&&e,!this._output.just_added_newline()){var i=this._options.preserve_newlines&&t.newlines||e;if(Mi(this._flags.last_token.text,qi)||Mi(t.text,qi)){var n=Mi(this._flags.last_token.text,qi)&&Mi(this._options.operator_position,Bi)||Mi(t.text,qi);i=i&&n}if(i)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(Ri(this._flags.last_token,Fi))return;this._output.set_wrap_point()}}},Hi.prototype.print_newline=function(t,e){if(!e&&";"!==this._flags.last_token.text&&","!==this._flags.last_token.text&&"="!==this._flags.last_token.text&&(this._flags.last_token.type!==Ti.OPERATOR||"--"===this._flags.last_token.text||"++"===this._flags.last_token.text))for(var i=this._tokens.peek();!(this._flags.mode!==Ni.Statement||this._flags.if_block&&Oi(i,"else")||this._flags.do_block);)this.restore_mode();this._output.add_new_line(t)&&(this._flags.multiline_frame=!0)},Hi.prototype.print_token_line_indentation=function(t){this._output.just_added_newline()&&(this._options.keep_array_indentation&&t.newlines&&("["===t.text||Pi(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(t.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},Hi.prototype.print_token=function(t){if(this._output.raw)this._output.add_raw_token(t);else{if(this._options.comma_first&&t.previous&&t.previous.type===Ti.COMMA&&this._output.just_added_newline()&&","===this._output.previous_line.last()){var e=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(e),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(t),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(t),this._output.non_breaking_space=!0,this._output.add_token(t.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)}},Hi.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},Hi.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},Hi.prototype.set_mode=function(t){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,t),this._flags=this.create_flags(this._previous_flags,t),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},Hi.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===Ni.Statement&&Di(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},Hi.prototype.start_of_object_property=function(){return this._flags.parent.mode===Ni.ObjectLiteral&&this._flags.mode===Ni.Statement&&(":"===this._flags.last_token.text&&0===this._flags.ternary_depth||Ri(this._flags.last_token,["get","set"]))},Hi.prototype.start_of_statement=function(t){var e=!1;return!!(e=(e=(e=(e=(e=(e=(e=e||Ri(this._flags.last_token,["var","let","const"])&&t.type===Ti.WORD)||Oi(this._flags.last_token,"do"))||!(this._flags.parent.mode===Ni.ObjectLiteral&&this._flags.mode===Ni.Statement)&&Ri(this._flags.last_token,Fi)&&!t.newlines)||Oi(this._flags.last_token,"else")&&!(Oi(t,"if")&&!t.comments_before))||this._flags.last_token.type===Ti.END_EXPR&&(this._previous_flags.mode===Ni.ForInitializer||this._previous_flags.mode===Ni.Conditional))||this._flags.last_token.type===Ti.WORD&&this._flags.mode===Ni.BlockStatement&&!this._flags.in_case&&!("--"===t.text||"++"===t.text)&&"function"!==this._last_last_text&&t.type!==Ti.WORD&&t.type!==Ti.RESERVED)||this._flags.mode===Ni.ObjectLiteral&&(":"===this._flags.last_token.text&&0===this._flags.ternary_depth||Ri(this._flags.last_token,["get","set"])))&&(this.set_mode(Ni.Statement),this.indent(),this.handle_whitespace_and_comments(t,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(t,Ri(t,["do","for","if","while"])),!0)},Hi.prototype.handle_start_expr=function(t){this.start_of_statement(t)||this.handle_whitespace_and_comments(t);var e=Ni.Expression;if("["===t.text){if(this._flags.last_token.type===Ti.WORD||")"===this._flags.last_token.text)return Ri(this._flags.last_token,Ai)&&(this._output.space_before_token=!0),this.print_token(t),this.set_mode(e),this.indent(),void(this._options.space_in_paren&&(this._output.space_before_token=!0));e=Ni.ArrayLiteral,Pi(this._flags.mode)&&("["!==this._flags.last_token.text&&(","!==this._flags.last_token.text||"]"!==this._last_last_text&&"}"!==this._last_last_text)||this._options.keep_array_indentation||this.print_newline()),Mi(this._flags.last_token.type,[Ti.START_EXPR,Ti.END_EXPR,Ti.WORD,Ti.OPERATOR,Ti.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===Ti.RESERVED)"for"===this._flags.last_token.text?(this._output.space_before_token=this._options.space_before_conditional,e=Ni.ForInitializer):Mi(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,e=Ni.Conditional):Mi(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:"import"===this._flags.last_token.text&&""===t.whitespace_before?this._output.space_before_token=!1:(Mi(this._flags.last_token.text,Ai)||"catch"===this._flags.last_token.text)&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===Ti.EQUALS||this._flags.last_token.type===Ti.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(t);else if(this._flags.last_token.type===Ti.WORD){this._output.space_before_token=!1;var i=this._tokens.peek(-3);if(this._options.space_after_named_function&&i){var n=this._tokens.peek(-4);Ri(i,["async","function"])||"*"===i.text&&Ri(n,["async","function"])?this._output.space_before_token=!0:this._flags.mode===Ni.ObjectLiteral&&("{"!==i.text&&","!==i.text&&("*"!==i.text||"{"!==n.text&&","!==n.text)||(this._output.space_before_token=!0))}}else this.allow_wrap_or_preserved_newline(t);(this._flags.last_token.type===Ti.RESERVED&&("function"===this._flags.last_word||"typeof"===this._flags.last_word)||"*"===this._flags.last_token.text&&(Mi(this._last_last_text,["function","yield"])||this._flags.mode===Ni.ObjectLiteral&&Mi(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}";"===this._flags.last_token.text||this._flags.last_token.type===Ti.START_BLOCK?this.print_newline():this._flags.last_token.type!==Ti.END_EXPR&&this._flags.last_token.type!==Ti.START_EXPR&&this._flags.last_token.type!==Ti.END_BLOCK&&"."!==this._flags.last_token.text&&this._flags.last_token.type!==Ti.COMMA||this.allow_wrap_or_preserved_newline(t,t.newlines),this.print_token(t),this.set_mode(e),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},Hi.prototype.handle_end_expr=function(t){for(;this._flags.mode===Ni.Statement;)this.restore_mode();this.handle_whitespace_and_comments(t),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(t,"]"===t.text&&Pi(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type!==Ti.START_EXPR||this._options.space_in_empty_paren?this._output.space_before_token=!0:(this._output.trim(),this._output.space_before_token=!1)),this.deindent(),this.print_token(t),this.restore_mode(),Di(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===Ni.Conditional&&(this._previous_flags.mode=Ni.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},Hi.prototype.handle_start_block=function(t){this.handle_whitespace_and_comments(t);var e=this._tokens.peek(),i=this._tokens.peek(1);"switch"===this._flags.last_word&&this._flags.last_token.type===Ti.END_EXPR?(this.set_mode(Ni.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(Ni.BlockStatement):i&&(Mi(i.text,[":",","])&&Mi(e.type,[Ti.STRING,Ti.WORD,Ti.RESERVED])||Mi(e.text,["get","set","..."])&&Mi(i.type,[Ti.WORD,Ti.RESERVED]))?Mi(this._last_last_text,["class","interface"])?this.set_mode(Ni.BlockStatement):this.set_mode(Ni.ObjectLiteral):this._flags.last_token.type===Ti.OPERATOR&&"=>"===this._flags.last_token.text?this.set_mode(Ni.BlockStatement):Mi(this._flags.last_token.type,[Ti.EQUALS,Ti.START_EXPR,Ti.COMMA,Ti.OPERATOR])||Ri(this._flags.last_token,["return","throw","import","default"])?this.set_mode(Ni.ObjectLiteral):this.set_mode(Ni.BlockStatement);var n=!e.comments_before&&"}"===e.text,o=n&&"function"===this._flags.last_word&&this._flags.last_token.type===Ti.END_EXPR;if(this._options.brace_preserve_inline){var s=0,l=null;this._flags.inline_frame=!0;do{if(s+=1,(l=this._tokens.peek(s-1)).newlines){this._flags.inline_frame=!1;break}}while(l.type!==Ti.EOF&&(l.type!==Ti.END_BLOCK||l.opened!==t))}("expand"===this._options.brace_style||"none"===this._options.brace_style&&t.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==Ti.OPERATOR&&(o||this._flags.last_token.type===Ti.EQUALS||Ri(this._flags.last_token,Ii)&&"else"!==this._flags.last_token.text)?this._output.space_before_token=!0:this.print_newline(!1,!0):(!Pi(this._previous_flags.mode)||this._flags.last_token.type!==Ti.START_EXPR&&this._flags.last_token.type!==Ti.COMMA||((this._flags.last_token.type===Ti.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===Ti.COMMA||this._flags.last_token.type===Ti.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(t),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==Ti.OPERATOR&&this._flags.last_token.type!==Ti.START_EXPR&&(this._flags.last_token.type!==Ti.START_BLOCK||this._flags.inline_frame?this._output.space_before_token=!0:this.print_newline())),this.print_token(t),this.indent(),n||this._options.brace_preserve_inline&&this._flags.inline_frame||this.print_newline()},Hi.prototype.handle_end_block=function(t){for(this.handle_whitespace_and_comments(t);this._flags.mode===Ni.Statement;)this.restore_mode();var e=this._flags.last_token.type===Ti.START_BLOCK;this._flags.inline_frame&&!e?this._output.space_before_token=!0:"expand"===this._options.brace_style?e||this.print_newline():e||(Pi(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(t)},Hi.prototype.handle_word=function(t){if(t.type===Ti.RESERVED)if(Mi(t.text,["set","get"])&&this._flags.mode!==Ni.ObjectLiteral)t.type=Ti.WORD;else if("import"===t.text&&"("===this._tokens.peek().text)t.type=Ti.WORD;else if(Mi(t.text,["as","from"])&&!this._flags.import_block)t.type=Ti.WORD;else if(this._flags.mode===Ni.ObjectLiteral){":"===this._tokens.peek().text&&(t.type=Ti.WORD)}if(this.start_of_statement(t)?Ri(this._flags.last_token,["var","let","const"])&&t.type===Ti.WORD&&(this._flags.declaration_statement=!0):!t.newlines||$i(this._flags.mode)||this._flags.last_token.type===Ti.OPERATOR&&"--"!==this._flags.last_token.text&&"++"!==this._flags.last_token.text||this._flags.last_token.type===Ti.EQUALS||!this._options.preserve_newlines&&Ri(this._flags.last_token,["var","let","const","set","get"])?this.handle_whitespace_and_comments(t):(this.handle_whitespace_and_comments(t),this.print_newline()),this._flags.do_block&&!this._flags.do_while){if(Oi(t,"while"))return this._output.space_before_token=!0,this.print_token(t),this._output.space_before_token=!0,void(this._flags.do_while=!0);this.print_newline(),this._flags.do_block=!1}if(this._flags.if_block)if(!this._flags.else_block&&Oi(t,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===Ni.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&Ri(t,["case","default"]))return this.print_newline(),this._flags.last_token.type!==Ti.END_BLOCK&&(this._flags.case_body||this._options.jslint_happy)&&this.deindent(),this._flags.case_body=!1,this.print_token(t),void(this._flags.in_case=!0);if(this._flags.last_token.type!==Ti.COMMA&&this._flags.last_token.type!==Ti.START_EXPR&&this._flags.last_token.type!==Ti.EQUALS&&this._flags.last_token.type!==Ti.OPERATOR||this.start_of_object_property()||this.allow_wrap_or_preserved_newline(t),Oi(t,"function"))return(Mi(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!Mi(this._flags.last_token.text,["(","[","{",":","=",","])&&this._flags.last_token.type!==Ti.OPERATOR)&&(this._output.just_added_blankline()||t.comments_before||(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===Ti.RESERVED||this._flags.last_token.type===Ti.WORD?Ri(this._flags.last_token,["get","set","new","export"])||Ri(this._flags.last_token,Fi)||Oi(this._flags.last_token,"default")&&"export"===this._last_last_text||"declare"===this._flags.last_token.text?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===Ti.OPERATOR||"="===this._flags.last_token.text?this._output.space_before_token=!0:(this._flags.multiline_frame||!$i(this._flags.mode)&&!Pi(this._flags.mode))&&this.print_newline(),this.print_token(t),void(this._flags.last_word=t.text);var e="NONE";(this._flags.last_token.type===Ti.END_BLOCK?this._previous_flags.inline_frame?e="SPACE":Ri(t,["else","catch","finally","from"])?"expand"===this._options.brace_style||"end-expand"===this._options.brace_style||"none"===this._options.brace_style&&t.newlines?e="NEWLINE":(e="SPACE",this._output.space_before_token=!0):e="NEWLINE":this._flags.last_token.type===Ti.SEMICOLON&&this._flags.mode===Ni.BlockStatement?e="NEWLINE":this._flags.last_token.type===Ti.SEMICOLON&&$i(this._flags.mode)?e="SPACE":this._flags.last_token.type===Ti.STRING?e="NEWLINE":this._flags.last_token.type===Ti.RESERVED||this._flags.last_token.type===Ti.WORD||"*"===this._flags.last_token.text&&(Mi(this._last_last_text,["function","yield"])||this._flags.mode===Ni.ObjectLiteral&&Mi(this._last_last_text,["{",","]))?e="SPACE":this._flags.last_token.type===Ti.START_BLOCK?e=this._flags.inline_frame?"SPACE":"NEWLINE":this._flags.last_token.type===Ti.END_EXPR&&(this._output.space_before_token=!0,e="NEWLINE"),Ri(t,Ai)&&")"!==this._flags.last_token.text&&(e=this._flags.inline_frame||"else"===this._flags.last_token.text||"export"===this._flags.last_token.text?"SPACE":"NEWLINE"),Ri(t,["else","catch","finally"]))?(this._flags.last_token.type!==Ti.END_BLOCK||this._previous_flags.mode!==Ni.BlockStatement||"expand"===this._options.brace_style||"end-expand"===this._options.brace_style||"none"===this._options.brace_style&&t.newlines)&&!this._flags.inline_frame?this.print_newline():(this._output.trim(!0),"}"!==this._output.current_line.last()&&this.print_newline(),this._output.space_before_token=!0):"NEWLINE"===e?Ri(this._flags.last_token,Ii)||"declare"===this._flags.last_token.text&&Ri(t,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==Ti.END_EXPR?this._flags.last_token.type===Ti.START_EXPR&&Ri(t,["var","let","const"])||":"===this._flags.last_token.text||(Oi(t,"if")&&Oi(t.previous,"else")?this._output.space_before_token=!0:this.print_newline()):Ri(t,Ai)&&")"!==this._flags.last_token.text&&this.print_newline():this._flags.multiline_frame&&Pi(this._flags.mode)&&","===this._flags.last_token.text&&"}"===this._last_last_text?this.print_newline():"SPACE"===e&&(this._output.space_before_token=!0);!t.previous||t.previous.type!==Ti.WORD&&t.previous.type!==Ti.RESERVED||(this._output.space_before_token=!0),this.print_token(t),this._flags.last_word=t.text,t.type===Ti.RESERVED&&("do"===t.text?this._flags.do_block=!0:"if"===t.text?this._flags.if_block=!0:"import"===t.text?this._flags.import_block=!0:this._flags.import_block&&Oi(t,"from")&&(this._flags.import_block=!1))},Hi.prototype.handle_semicolon=function(t){this.start_of_statement(t)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(t);for(var e=this._tokens.peek();!(this._flags.mode!==Ni.Statement||this._flags.if_block&&Oi(e,"else")||this._flags.do_block);)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(t)},Hi.prototype.handle_string=function(t){(!t.text.startsWith("`")||0!==t.newlines||""!==t.whitespace_before||")"!==t.previous.text&&this._flags.last_token.type!==Ti.WORD)&&(this.start_of_statement(t)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(t),this._flags.last_token.type===Ti.RESERVED||this._flags.last_token.type===Ti.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===Ti.COMMA||this._flags.last_token.type===Ti.START_EXPR||this._flags.last_token.type===Ti.EQUALS||this._flags.last_token.type===Ti.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(t):!t.text.startsWith("`")||this._flags.last_token.type!==Ti.END_EXPR||"]"!==t.previous.text&&")"!==t.previous.text||0!==t.newlines?this.print_newline():this._output.space_before_token=!0)),this.print_token(t)},Hi.prototype.handle_equals=function(t){this.start_of_statement(t)||this.handle_whitespace_and_comments(t),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(t),this._output.space_before_token=!0},Hi.prototype.handle_comma=function(t){this.handle_whitespace_and_comments(t,!0),this.print_token(t),this._output.space_before_token=!0,this._flags.declaration_statement?($i(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(t)):this._flags.mode===Ni.ObjectLiteral||this._flags.mode===Ni.Statement&&this._flags.parent.mode===Ni.ObjectLiteral?(this._flags.mode===Ni.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(t)},Hi.prototype.handle_operator=function(t){var e="*"===t.text&&(Ri(this._flags.last_token,["function","yield"])||Mi(this._flags.last_token.type,[Ti.START_BLOCK,Ti.COMMA,Ti.END_BLOCK,Ti.SEMICOLON])),i=Mi(t.text,["-","+"])&&(Mi(this._flags.last_token.type,[Ti.START_BLOCK,Ti.START_EXPR,Ti.EQUALS,Ti.OPERATOR])||Mi(this._flags.last_token.text,Ai)||","===this._flags.last_token.text);if(this.start_of_statement(t));else{var n=!e;this.handle_whitespace_and_comments(t,n)}if(Ri(this._flags.last_token,Ii))return this._output.space_before_token=!0,void this.print_token(t);if("*"!==t.text||this._flags.last_token.type!==Ti.DOT)if("::"!==t.text){if(this._flags.last_token.type===Ti.OPERATOR&&Mi(this._options.operator_position,Bi)&&this.allow_wrap_or_preserved_newline(t),":"===t.text&&this._flags.in_case)return this.print_token(t),this._flags.in_case=!1,this._flags.case_body=!0,void(this._tokens.peek().type!==Ti.START_BLOCK?(this.indent(),this.print_newline()):this._output.space_before_token=!0);var o=!0,s=!0,l=!1;if(":"===t.text?0===this._flags.ternary_depth?o=!1:(this._flags.ternary_depth-=1,l=!0):"?"===t.text&&(this._flags.ternary_depth+=1),!i&&!e&&this._options.preserve_newlines&&Mi(t.text,qi)){var a=":"===t.text,r=a&&l,c=a&&!l;switch(this._options.operator_position){case zi.before_newline:return this._output.space_before_token=!c,this.print_token(t),a&&!r||this.allow_wrap_or_preserved_newline(t),void(this._output.space_before_token=!0);case zi.after_newline:return this._output.space_before_token=!0,!a||r?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(t):this._output.space_before_token=!1,this.print_token(t),void(this._output.space_before_token=!0);case zi.preserve_newline:return c||this.allow_wrap_or_preserved_newline(t),o=!(this._output.just_added_newline()||c),this._output.space_before_token=o,this.print_token(t),void(this._output.space_before_token=!0)}}if(e){this.allow_wrap_or_preserved_newline(t),o=!1;var u=this._tokens.peek();s=u&&Mi(u.type,[Ti.WORD,Ti.RESERVED])}else"..."===t.text?(this.allow_wrap_or_preserved_newline(t),o=this._flags.last_token.type===Ti.START_BLOCK,s=!1):(Mi(t.text,["--","++","!","~"])||i)&&(this._flags.last_token.type!==Ti.COMMA&&this._flags.last_token.type!==Ti.START_EXPR||this.allow_wrap_or_preserved_newline(t),o=!1,s=!1,!t.newlines||"--"!==t.text&&"++"!==t.text||this.print_newline(!1,!0),";"===this._flags.last_token.text&&$i(this._flags.mode)&&(o=!0),this._flags.last_token.type===Ti.RESERVED?o=!0:this._flags.last_token.type===Ti.END_EXPR?o=!("]"===this._flags.last_token.text&&("--"===t.text||"++"===t.text)):this._flags.last_token.type===Ti.OPERATOR&&(o=Mi(t.text,["--","-","++","+"])&&Mi(this._flags.last_token.text,["--","-","++","+"]),Mi(t.text,["+","-"])&&Mi(this._flags.last_token.text,["--","++"])&&(s=!0)),(this._flags.mode!==Ni.BlockStatement||this._flags.inline_frame)&&this._flags.mode!==Ni.Statement||"{"!==this._flags.last_token.text&&";"!==this._flags.last_token.text||this.print_newline());this._output.space_before_token=this._output.space_before_token||o,this.print_token(t),this._output.space_before_token=s}else this.print_token(t);else this.print_token(t)},Hi.prototype.handle_block_comment=function(t,e){return this._output.raw?(this._output.add_raw_token(t),void(t.directives&&"end"===t.directives.preserve&&(this._output.raw=this._options.test_output_raw))):t.directives?(this.print_newline(!1,e),this.print_token(t),"start"===t.directives.preserve&&(this._output.raw=!0),void this.print_newline(!1,!0)):Ci.newline.test(t.text)||t.newlines?void this.print_block_commment(t,e):(this._output.space_before_token=!0,this.print_token(t),void(this._output.space_before_token=!0))},Hi.prototype.print_block_commment=function(t,e){var i,n=function(t){for(var e=[],i=(t=t.replace(Ci.allLineBreaks,"\n")).indexOf("\n");-1!==i;)e.push(t.substring(0,i)),i=(t=t.substring(i+1)).indexOf("\n");return t.length&&e.push(t),e}(t.text),o=!1,s=!1,l=t.whitespace_before,a=l.length;if(this.print_newline(!1,e),this.print_token_line_indentation(t),this._output.add_token(n[0]),this.print_newline(!1,e),n.length>1){for(o=function(t,e){for(var i=0;i<t.length;i++)if(t[i].trim().charAt(0)!==e)return!1;return!0}(n=n.slice(1),"*"),s=function(t,e){for(var i,n=0,o=t.length;n<o;n++)if((i=t[n])&&0!==i.indexOf(e))return!1;return!0}(n,l),o&&(this._flags.alignment=1),i=0;i<n.length;i++)o?(this.print_token_line_indentation(t),this._output.add_token(n[i].replace(/^\s+/g,""))):s&&n[i]?(this.print_token_line_indentation(t),this._output.add_token(n[i].substring(a))):(this._output.current_line.set_indent(-1),this._output.add_token(n[i])),this.print_newline(!1,e);this._flags.alignment=0}},Hi.prototype.handle_comment=function(t,e){t.newlines?this.print_newline(!1,e):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(t),this.print_newline(!1,e)},Hi.prototype.handle_dot=function(t){this.start_of_statement(t)||this.handle_whitespace_and_comments(t,!0),Ri(this._flags.last_token,Ii)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(t,")"===this._flags.last_token.text&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(t)},Hi.prototype.handle_unknown=function(t,e){this.print_token(t),"\n"===t.text[t.text.length-1]&&this.print_newline(!1,e)},Hi.prototype.handle_eof=function(t){for(;this._flags.mode===Ni.Statement;)this.restore_mode();this.handle_whitespace_and_comments(t)},de.Beautifier=Hi;var ji=de.Beautifier,Ui=_e.Options;ue.exports=function(t,e){return new ji(t,e).beautify()},ue.exports.defaultOptions=function(){return new Ui};var Wi={exports:{}},Gi={},Vi={},Yi=Ce.Options;function Xi(t){Yi.call(this,t,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var e=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||e;var i=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var n=0;n<i.length;n++)"expand"!==i[n]?this.brace_style="collapse":this.brace_style=i[n]}Xi.prototype=new Yi,Vi.Options=Xi;var Zi=Vi.Options,Ki=be.Output,Qi=Re.InputScanner,Ji=new(0,Ze.Directives)(/\/\*/,/\*\//),tn=/\r\n|[\r\n]/,en=/\r\n|[\r\n]/g,nn=/\s/,on=/(?:\s|\n)+/g,sn=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,ln=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function an(t,e){this._source_text=t||"",this._options=new Zi(e),this._ch=null,this._input=null,this.NESTED_AT_RULE={"@page":!0,"@font-face":!0,"@keyframes":!0,"@media":!0,"@supports":!0,"@document":!0},this.CONDITIONAL_GROUP_RULE={"@media":!0,"@supports":!0,"@document":!0}}an.prototype.eatString=function(t){var e="";for(this._ch=this._input.next();this._ch;){if(e+=this._ch,"\\"===this._ch)e+=this._input.next();else if(-1!==t.indexOf(this._ch)||"\n"===this._ch)break;this._ch=this._input.next()}return e},an.prototype.eatWhitespace=function(t){for(var e=nn.test(this._input.peek()),i=0;nn.test(this._input.peek());)this._ch=this._input.next(),t&&"\n"===this._ch&&(0===i||i<this._options.max_preserve_newlines)&&(i++,this._output.add_new_line(!0));return e},an.prototype.foundNestedPseudoClass=function(){for(var t=0,e=1,i=this._input.peek(e);i;){if("{"===i)return!0;if("("===i)t+=1;else if(")"===i){if(0===t)return!1;t-=1}else if(";"===i||"}"===i)return!1;e++,i=this._input.peek(e)}return!1},an.prototype.print_string=function(t){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(t)},an.prototype.preserveSingleSpace=function(t){t&&(this._output.space_before_token=!0)},an.prototype.indent=function(){this._indentLevel++},an.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},an.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var t=this._source_text,e=this._options.eol;"auto"===e&&(e="\n",t&&tn.test(t||"")&&(e=t.match(tn)[0]));var i=(t=t.replace(en,"\n")).match(/^[\t ]*/)[0];this._output=new Ki(this._options,i),this._input=new Qi(t),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var n,o,s=0,l=!1,a=!1,r=!1,c=!1,u=!1,d=this._ch;n=""!==this._input.read(on),o=d,this._ch=this._input.next(),"\\"===this._ch&&this._input.hasNext()&&(this._ch+=this._input.next()),d=this._ch,this._ch;)if("/"===this._ch&&"*"===this._input.peek()){this._output.add_new_line(),this._input.back();var b=this._input.read(sn),h=Ji.get_directives(b);h&&"start"===h.ignore&&(b+=Ji.readIgnored(this._input)),this.print_string(b),this.eatWhitespace(!0),this._output.add_new_line()}else if("/"===this._ch&&"/"===this._input.peek())this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(ln)),this.eatWhitespace(!0);else if("@"===this._ch)if(this.preserveSingleSpace(n),"{"===this._input.peek())this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var p=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);p.match(/[ :]$/)&&(p=this.eatString(": ").replace(/\s$/,""),this.print_string(p),this._output.space_before_token=!0),"extend"===(p=p.replace(/\s$/,""))?c=!0:"import"===p&&(u=!0),p in this.NESTED_AT_RULE?(this._nestedLevel+=1,p in this.CONDITIONAL_GROUP_RULE&&(r=!0)):l||0!==s||-1===p.indexOf(":")||(a=!0,this.indent())}else"#"===this._ch&&"{"===this._input.peek()?(this.preserveSingleSpace(n),this.print_string(this._ch+this.eatString("}"))):"{"===this._ch?(a&&(a=!1,this.outdent()),r?(r=!1,l=this._indentLevel>=this._nestedLevel):l=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&l&&this._output.previous_line&&"{"!==this._output.previous_line.item(-1)&&this._output.ensure_empty_line_above("/",","),this._output.space_before_token=!0,"expand"===this._options.brace_style?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line()):"}"===this._ch?(this.outdent(),this._output.add_new_line(),"{"===o&&this._output.trim(!0),u=!1,c=!1,a&&(this.outdent(),a=!1),this.print_string(this._ch),l=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&"}"!==this._input.peek()&&this._output.add_new_line(!0)):":"===this._ch?!l&&!r||this._input.lookBack("&")||this.foundNestedPseudoClass()||this._input.lookBack("(")||c||0!==s?(this._input.lookBack(" ")&&(this._output.space_before_token=!0),":"===this._input.peek()?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":")):(this.print_string(":"),a||(a=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):'"'===this._ch||"'"===this._ch?(this.preserveSingleSpace(n),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)):";"===this._ch?0===s?(a&&(this.outdent(),a=!1),c=!1,u=!1,this.print_string(this._ch),this.eatWhitespace(!0),"/"!==this._input.peek()&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0):"("===this._ch?this._input.lookBack("url")?(this.print_string(this._ch),this.eatWhitespace(),s++,this.indent(),this._ch=this._input.next(),")"===this._ch||'"'===this._ch||"'"===this._ch?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),s&&(s--,this.outdent()))):(this.preserveSingleSpace(n),this.print_string(this._ch),this.eatWhitespace(),s++,this.indent()):")"===this._ch?(s&&(s--,this.outdent()),this.print_string(this._ch)):","===this._ch?(this.print_string(this._ch),this.eatWhitespace(!0),!this._options.selector_separator_newline||a||0!==s||u||c?this._output.space_before_token=!0:this._output.add_new_line()):">"!==this._ch&&"+"!==this._ch&&"~"!==this._ch||a||0!==s?"]"===this._ch?this.print_string(this._ch):"["===this._ch?(this.preserveSingleSpace(n),this.print_string(this._ch)):"="===this._ch?(this.eatWhitespace(),this.print_string("="),nn.test(this._ch)&&(this._ch="")):"!"!==this._ch||this._input.lookBack("\\")?(this.preserveSingleSpace(n),this.print_string(this._ch)):(this.print_string(" "),this.print_string(this._ch)):this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&nn.test(this._ch)&&(this._ch=""));return this._output.get_code(e)},Gi.Beautifier=an;var rn=Gi.Beautifier,cn=Vi.Options;Wi.exports=function(t,e){return new rn(t,e).beautify()},Wi.exports.defaultOptions=function(){return new cn};var un={exports:{}},dn={},bn={},hn=Ce.Options;function pn(t){hn.call(this,t,"html"),1===this.templating.length&&"auto"===this.templating[0]&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}pn.prototype=new hn,bn.Options=pn;var gn={},mn=Be.Tokenizer,fn=Be.TOKEN,vn=Ze.Directives,yn=Qe.TemplatablePattern,xn=$e.Pattern,wn={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:fn.START,RAW:fn.RAW,EOF:fn.EOF},Sn=new vn(/<\!--/,/-->/),kn=function(t,e){mn.call(this,t,e),this._current_tag_name="";var i=new yn(this._input).read_options(this._options),n=new xn(this._input);if(this.__patterns={word:i.until(/[\n\r\t <]/),single_quote:i.until_after(/'/),double_quote:i.until_after(/"/),attribute:i.until(/[\n\r\t =>]|\/>/),element_name:i.until(/[\n\r\t >\/]/),handlebars_comment:n.starting_with(/{{!--/).until_after(/--}}/),handlebars:n.starting_with(/{{/).until_after(/}}/),handlebars_open:n.until(/[\n\r\t }]/),handlebars_raw_close:n.until(/}}/),comment:n.starting_with(/<!--/).until_after(/-->/),cdata:n.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:n.starting_with(/<!\[/).until_after(/]>/),processing:n.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var o=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=n.matching(o).until_after(o)}};(kn.prototype=new mn)._is_comment=function(t){return!1},kn.prototype._is_opening=function(t){return t.type===wn.TAG_OPEN},kn.prototype._is_closing=function(t,e){return t.type===wn.TAG_CLOSE&&e&&((">"===t.text||"/>"===t.text)&&"<"===e.text[0]||"}}"===t.text&&"{"===e.text[0]&&"{"===e.text[1])},kn.prototype._reset=function(){this._current_tag_name=""},kn.prototype._get_next_token=function(t,e){var i=null;this._readWhitespace();var n=this._input.peek();return null===n?this._create_token(wn.EOF,""):i=(i=(i=(i=(i=(i=(i=(i=(i=i||this._read_open_handlebars(n,e))||this._read_attribute(n,t,e))||this._read_close(n,e))||this._read_raw_content(n,t,e))||this._read_content_word(n))||this._read_comment_or_cdata(n))||this._read_processing(n))||this._read_open(n,e))||this._create_token(wn.UNKNOWN,this._input.next())},kn.prototype._read_comment_or_cdata=function(t){var e=null,i=null,n=null;"<"===t&&("!"===this._input.peek(1)&&((i=this.__patterns.comment.read())?(n=Sn.get_directives(i))&&"start"===n.ignore&&(i+=Sn.readIgnored(this._input)):i=this.__patterns.cdata.read()),i&&((e=this._create_token(wn.COMMENT,i)).directives=n));return e},kn.prototype._read_processing=function(t){var e=null,i=null;if("<"===t){var n=this._input.peek(1);"!"!==n&&"?"!==n||(i=(i=this.__patterns.conditional_comment.read())||this.__patterns.processing.read()),i&&((e=this._create_token(wn.COMMENT,i)).directives=null)}return e},kn.prototype._read_open=function(t,e){var i=null,n=null;return e||"<"===t&&(i=this._input.next(),"/"===this._input.peek()&&(i+=this._input.next()),i+=this.__patterns.element_name.read(),n=this._create_token(wn.TAG_OPEN,i)),n},kn.prototype._read_open_handlebars=function(t,e){var i=null,n=null;return e||this._options.indent_handlebars&&"{"===t&&"{"===this._input.peek(1)&&("!"===this._input.peek(2)?(i=(i=this.__patterns.handlebars_comment.read())||this.__patterns.handlebars.read(),n=this._create_token(wn.COMMENT,i)):(i=this.__patterns.handlebars_open.read(),n=this._create_token(wn.TAG_OPEN,i))),n},kn.prototype._read_close=function(t,e){var i=null,n=null;return e&&("<"===e.text[0]&&(">"===t||"/"===t&&">"===this._input.peek(1))?(i=this._input.next(),"/"===t&&(i+=this._input.next()),n=this._create_token(wn.TAG_CLOSE,i)):"{"===e.text[0]&&"}"===t&&"}"===this._input.peek(1)&&(this._input.next(),this._input.next(),n=this._create_token(wn.TAG_CLOSE,"}}"))),n},kn.prototype._read_attribute=function(t,e,i){var n=null,o="";if(i&&"<"===i.text[0])if("="===t)n=this._create_token(wn.EQUALS,this._input.next());else if('"'===t||"'"===t){var s=this._input.next();s+='"'===t?this.__patterns.double_quote.read():this.__patterns.single_quote.read(),n=this._create_token(wn.VALUE,s)}else(o=this.__patterns.attribute.read())&&(n=e.type===wn.EQUALS?this._create_token(wn.VALUE,o):this._create_token(wn.ATTRIBUTE,o));return n},kn.prototype._is_content_unformatted=function(t){return-1===this._options.void_elements.indexOf(t)&&(-1!==this._options.content_unformatted.indexOf(t)||-1!==this._options.unformatted.indexOf(t))},kn.prototype._read_raw_content=function(t,e,i){var n="";if(i&&"{"===i.text[0])n=this.__patterns.handlebars_raw_close.read();else if(e.type===wn.TAG_CLOSE&&"<"===e.opened.text[0]&&"/"!==e.text[0]){var o=e.opened.text.substr(1).toLowerCase();if("script"===o||"style"===o){var s=this._read_comment_or_cdata(t);if(s)return s.type=wn.TEXT,s;n=this._input.readUntil(new RegExp("</"+o+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(o)&&(n=this._input.readUntil(new RegExp("</"+o+"[\\n\\r\\t ]*?>","ig")))}return n?this._create_token(wn.TEXT,n):null},kn.prototype._read_content_word=function(t){var e="";if(this._options.unformatted_content_delimiter&&t===this._options.unformatted_content_delimiter[0]&&(e=this.__patterns.unformatted_content_delimiter.read()),e||(e=this.__patterns.word.read()),e)return this._create_token(wn.TEXT,e)},gn.Tokenizer=kn,gn.TOKEN=wn;var _n=bn.Options,Cn=be.Output,En=gn.Tokenizer,Ln=gn.TOKEN,An=/\r\n|[\r\n]/,qn=/\r\n|[\r\n]/g,Tn=function(t,e){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=t.max_preserve_newlines,this.preserve_newlines=t.preserve_newlines,this._output=new Cn(t,e)};Tn.prototype.current_line_has_match=function(t){return this._output.current_line.has_match(t)},Tn.prototype.set_space_before_token=function(t,e){this._output.space_before_token=t,this._output.non_breaking_space=e},Tn.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},Tn.prototype.add_raw_token=function(t){this._output.add_raw_token(t)},Tn.prototype.print_preserved_newlines=function(t){var e=0;t.type!==Ln.TEXT&&t.previous.type!==Ln.TEXT&&(e=t.newlines?1:0),this.preserve_newlines&&(e=t.newlines<this.max_preserve_newlines+1?t.newlines:this.max_preserve_newlines+1);for(var i=0;i<e;i++)this.print_newline(i>0);return 0!==e},Tn.prototype.traverse_whitespace=function(t){return!(!t.whitespace_before&&!t.newlines)&&(this.print_preserved_newlines(t)||(this._output.space_before_token=!0),!0)},Tn.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},Tn.prototype.print_newline=function(t){this._output.add_new_line(t)},Tn.prototype.print_token=function(t){t.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(t.text))},Tn.prototype.indent=function(){this.indent_level++},Tn.prototype.get_full_indent=function(t){return(t=this.indent_level+(t||0))<1?"":this._output.get_indent_string(t)};var Mn=function(t,e){var i=null,n=null;return e.closed?("script"===t?i="text/javascript":"style"===t&&(i="text/css"),i=function(t){for(var e=null,i=t.next;i.type!==Ln.EOF&&t.closed!==i;){if(i.type===Ln.ATTRIBUTE&&"type"===i.text){i.next&&i.next.type===Ln.EQUALS&&i.next.next&&i.next.next.type===Ln.VALUE&&(e=i.next.next.text);break}i=i.next}return e}(e)||i,i.search("text/css")>-1?n="css":i.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?n="javascript":i.search(/(text|application|dojo)\/(x-)?(html)/)>-1?n="html":i.search(/test\/null/)>-1&&(n="null"),n):null};function On(t,e){return-1!==e.indexOf(t)}function Rn(t,e,i){this.parent=t||null,this.tag=e?e.tag_name:"",this.indent_level=i||0,this.parser_token=e||null}function In(t){this._printer=t,this._current_frame=null}function zn(t,e,i,n){this._source_text=t||"",e=e||{},this._js_beautify=i,this._css_beautify=n,this._tag_stack=null;var o=new _n(e,"html");this._options=o,this._is_wrap_attributes_force="force"===this._options.wrap_attributes.substr(0,"force".length),this._is_wrap_attributes_force_expand_multiline="force-expand-multiline"===this._options.wrap_attributes,this._is_wrap_attributes_force_aligned="force-aligned"===this._options.wrap_attributes,this._is_wrap_attributes_aligned_multiple="aligned-multiple"===this._options.wrap_attributes,this._is_wrap_attributes_preserve="preserve"===this._options.wrap_attributes.substr(0,"preserve".length),this._is_wrap_attributes_preserve_aligned="preserve-aligned"===this._options.wrap_attributes}In.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},In.prototype.record_tag=function(t){var e=new Rn(this._current_frame,t,this._printer.indent_level);this._current_frame=e},In.prototype._try_pop_frame=function(t){var e=null;return t&&(e=t.parser_token,this._printer.indent_level=t.indent_level,this._current_frame=t.parent),e},In.prototype._get_frame=function(t,e){for(var i=this._current_frame;i&&-1===t.indexOf(i.tag);){if(e&&-1!==e.indexOf(i.tag)){i=null;break}i=i.parent}return i},In.prototype.try_pop=function(t,e){var i=this._get_frame([t],e);return this._try_pop_frame(i)},In.prototype.indent_to_tag=function(t){var e=this._get_frame(t);e&&(this._printer.indent_level=e.indent_level)},zn.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var t=this._source_text,e=this._options.eol;"auto"===this._options.eol&&(e="\n",t&&An.test(t)&&(e=t.match(An)[0]));var i=(t=t.replace(qn,"\n")).match(/^[\t ]*/)[0],n={text:"",type:""},o=new Bn,s=new Tn(this._options,i),l=new En(t,this._options).tokenize();this._tag_stack=new In(s);for(var a=null,r=l.next();r.type!==Ln.EOF;)r.type===Ln.TAG_OPEN||r.type===Ln.COMMENT?o=a=this._handle_tag_open(s,r,o,n):r.type===Ln.ATTRIBUTE||r.type===Ln.EQUALS||r.type===Ln.VALUE||r.type===Ln.TEXT&&!o.tag_complete?a=this._handle_inside_tag(s,r,o,l):r.type===Ln.TAG_CLOSE?a=this._handle_tag_close(s,r,o):r.type===Ln.TEXT?a=this._handle_text(s,r,o):s.add_raw_token(r),n=a,r=l.next();return s._output.get_code(e)},zn.prototype._handle_tag_close=function(t,e,i){var n={text:e.text,type:e.type};return t.alignment_size=0,i.tag_complete=!0,t.set_space_before_token(e.newlines||""!==e.whitespace_before,!0),i.is_unformatted?t.add_raw_token(e):("<"===i.tag_start_char&&(t.set_space_before_token("/"===e.text[0],!0),this._is_wrap_attributes_force_expand_multiline&&i.has_wrapped_attrs&&t.print_newline(!1)),t.print_token(e)),!i.indent_content||i.is_unformatted||i.is_content_unformatted||(t.indent(),i.indent_content=!1),i.is_inline_element||i.is_unformatted||i.is_content_unformatted||t.set_wrap_point(),n},zn.prototype._handle_inside_tag=function(t,e,i,n){var o=i.has_wrapped_attrs,s={text:e.text,type:e.type};if(t.set_space_before_token(e.newlines||""!==e.whitespace_before,!0),i.is_unformatted)t.add_raw_token(e);else if("{"===i.tag_start_char&&e.type===Ln.TEXT)t.print_preserved_newlines(e)?(e.newlines=0,t.add_raw_token(e)):t.print_token(e);else{if(e.type===Ln.ATTRIBUTE?(t.set_space_before_token(!0),i.attr_count+=1):(e.type===Ln.EQUALS||e.type===Ln.VALUE&&e.previous.type===Ln.EQUALS)&&t.set_space_before_token(!1),e.type===Ln.ATTRIBUTE&&"<"===i.tag_start_char&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(t.traverse_whitespace(e),o=o||0!==e.newlines),this._is_wrap_attributes_force)){var l=i.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&1===i.attr_count){var a,r=!0,c=0;do{if((a=n.peek(c)).type===Ln.ATTRIBUTE){r=!1;break}c+=1}while(c<4&&a.type!==Ln.EOF&&a.type!==Ln.TAG_CLOSE);l=!r}l&&(t.print_newline(!1),o=!0)}t.print_token(e),o=o||t.previous_token_wrapped(),i.has_wrapped_attrs=o}return s},zn.prototype._handle_text=function(t,e,i){var n={text:e.text,type:"TK_CONTENT"};return i.custom_beautifier_name?this._print_custom_beatifier_text(t,e,i):i.is_unformatted||i.is_content_unformatted?t.add_raw_token(e):(t.traverse_whitespace(e),t.print_token(e)),n},zn.prototype._print_custom_beatifier_text=function(t,e,i){var n=this;if(""!==e.text){var o,s=e.text,l=1,a="",r="";"javascript"===i.custom_beautifier_name&&"function"==typeof this._js_beautify?o=this._js_beautify:"css"===i.custom_beautifier_name&&"function"==typeof this._css_beautify?o=this._css_beautify:"html"===i.custom_beautifier_name&&(o=function(t,e){return new zn(t,e,n._js_beautify,n._css_beautify).beautify()}),"keep"===this._options.indent_scripts?l=0:"separate"===this._options.indent_scripts&&(l=-t.indent_level);var c=t.get_full_indent(l);if(s=s.replace(/\n[ \t]*$/,""),"html"!==i.custom_beautifier_name&&"<"===s[0]&&s.match(/^(<!--|<!\[CDATA\[)/)){var u=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(s);if(!u)return void t.add_raw_token(e);a=c+u[1]+"\n",s=u[4],u[5]&&(r=c+u[5]),s=s.replace(/\n[ \t]*$/,""),(u[2]||-1!==u[3].indexOf("\n"))&&(u=u[3].match(/[ \t]+$/))&&(e.whitespace_before=u[0])}if(s)if(o){var d=function(){this.eol="\n"};d.prototype=this._options.raw_options,s=o(c+s,new d)}else{var b=e.whitespace_before;b&&(s=s.replace(new RegExp("\n("+b+")?","g"),"\n")),s=c+s.replace(/\n/g,"\n"+c)}a&&(s=s?a+s+"\n"+r:a+r),t.print_newline(!1),s&&(e.text=s,e.whitespace_before="",e.newlines=0,t.add_raw_token(e),t.print_newline(!0))}},zn.prototype._handle_tag_open=function(t,e,i,n){var o=this._get_tag_open_token(e);return!i.is_unformatted&&!i.is_content_unformatted||i.is_empty_element||e.type!==Ln.TAG_OPEN||0!==e.text.indexOf("</")?(t.traverse_whitespace(e),this._set_tag_position(t,e,o,i,n),o.is_inline_element||t.set_wrap_point(),t.print_token(e)):(t.add_raw_token(e),o.start_tag_token=this._tag_stack.try_pop(o.tag_name)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(o.alignment_size=e.text.length+1),o.tag_complete||o.is_unformatted||(t.alignment_size=o.alignment_size),o};var Bn=function(t,e){var i;(this.parent=t||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",e)?(this.tag_start_char=e.text[0],this.text=e.text,"<"===this.tag_start_char?(i=e.text.match(/^<([^\s>]*)/),this.tag_check=i?i[1]:""):(i=e.text.match(/^{{(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=i?i[1]:"","{{#>"===e.text&&">"===this.tag_check&&null!==e.next&&(this.tag_check=e.next.text)),this.tag_check=this.tag_check.toLowerCase(),e.type===Ln.COMMENT&&(this.tag_complete=!0),this.is_start_tag="/"!==this.tag_check.charAt(0),this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||e.closed&&"/>"===e.closed.text,this.is_end_tag=this.is_end_tag||"{"===this.tag_start_char&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(2)))):this.tag_complete=!0};zn.prototype._get_tag_open_token=function(t){var e=new Bn(this._tag_stack.get_parser_token(),t);return e.alignment_size=this._options.wrap_attributes_indent_size,e.is_end_tag=e.is_end_tag||On(e.tag_check,this._options.void_elements),e.is_empty_element=e.tag_complete||e.is_start_tag&&e.is_end_tag,e.is_unformatted=!e.tag_complete&&On(e.tag_check,this._options.unformatted),e.is_content_unformatted=!e.is_empty_element&&On(e.tag_check,this._options.content_unformatted),e.is_inline_element=On(e.tag_name,this._options.inline)||"{"===e.tag_start_char,e},zn.prototype._set_tag_position=function(t,e,i,n,o){if(i.is_empty_element||(i.is_end_tag?i.start_tag_token=this._tag_stack.try_pop(i.tag_name):(this._do_optional_end_element(i)&&(i.is_inline_element||t.print_newline(!1)),this._tag_stack.record_tag(i),"script"!==i.tag_name&&"style"!==i.tag_name||i.is_unformatted||i.is_content_unformatted||(i.custom_beautifier_name=Mn(i.tag_check,e)))),On(i.tag_check,this._options.extra_liners)&&(t.print_newline(!1),t._output.just_added_blankline()||t.print_newline(!0)),i.is_empty_element){if("{"===i.tag_start_char&&"else"===i.tag_check)this._tag_stack.indent_to_tag(["if","unless","each"]),i.indent_content=!0,t.current_line_has_match(/{{#if/)||t.print_newline(!1);"!--"===i.tag_name&&o.type===Ln.TAG_CLOSE&&n.is_end_tag&&-1===i.text.indexOf("\n")||(i.is_inline_element||i.is_unformatted||t.print_newline(!1),this._calcluate_parent_multiline(t,i))}else if(i.is_end_tag){var s=!1;s=(s=i.start_tag_token&&i.start_tag_token.multiline_content)||!i.is_inline_element&&!(n.is_inline_element||n.is_unformatted)&&!(o.type===Ln.TAG_CLOSE&&i.start_tag_token===n)&&"TK_CONTENT"!==o.type,(i.is_content_unformatted||i.is_unformatted)&&(s=!1),s&&t.print_newline(!1)}else i.indent_content=!i.custom_beautifier_name,"<"===i.tag_start_char&&("html"===i.tag_name?i.indent_content=this._options.indent_inner_html:"head"===i.tag_name?i.indent_content=this._options.indent_head_inner_html:"body"===i.tag_name&&(i.indent_content=this._options.indent_body_inner_html)),i.is_inline_element||i.is_unformatted||"TK_CONTENT"===o.type&&!i.is_content_unformatted||t.print_newline(!1),this._calcluate_parent_multiline(t,i)},zn.prototype._calcluate_parent_multiline=function(t,e){!e.parent||!t._output.just_added_newline()||(e.is_inline_element||e.is_unformatted)&&e.parent.is_inline_element||(e.parent.multiline_content=!0)};var Nn=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],Dn=["a","audio","del","ins","map","noscript","video"];zn.prototype._do_optional_end_element=function(t){var e=null;if(!t.is_empty_element&&t.is_start_tag&&t.parent){if("body"===t.tag_name)e=e||this._tag_stack.try_pop("head");else if("li"===t.tag_name)e=e||this._tag_stack.try_pop("li",["ol","ul"]);else if("dd"===t.tag_name||"dt"===t.tag_name)e=(e=e||this._tag_stack.try_pop("dt",["dl"]))||this._tag_stack.try_pop("dd",["dl"]);else if("p"===t.parent.tag_name&&-1!==Nn.indexOf(t.tag_name)){var i=t.parent.parent;i&&-1!==Dn.indexOf(i.tag_name)||(e=e||this._tag_stack.try_pop("p"))}else"rp"===t.tag_name||"rt"===t.tag_name?e=(e=e||this._tag_stack.try_pop("rt",["ruby","rtc"]))||this._tag_stack.try_pop("rp",["ruby","rtc"]):"optgroup"===t.tag_name?e=e||this._tag_stack.try_pop("optgroup",["select"]):"option"===t.tag_name?e=e||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):"colgroup"===t.tag_name?e=e||this._tag_stack.try_pop("caption",["table"]):"thead"===t.tag_name?e=(e=e||this._tag_stack.try_pop("caption",["table"]))||this._tag_stack.try_pop("colgroup",["table"]):"tbody"===t.tag_name||"tfoot"===t.tag_name?e=(e=(e=(e=e||this._tag_stack.try_pop("caption",["table"]))||this._tag_stack.try_pop("colgroup",["table"]))||this._tag_stack.try_pop("thead",["table"]))||this._tag_stack.try_pop("tbody",["table"]):"tr"===t.tag_name?e=(e=(e=e||this._tag_stack.try_pop("caption",["table"]))||this._tag_stack.try_pop("colgroup",["table"]))||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"]):"th"!==t.tag_name&&"td"!==t.tag_name||(e=(e=e||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]))||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return t.parent=this._tag_stack.get_parser_token(),e}},dn.Beautifier=zn;var Pn=dn.Beautifier,$n=bn.Options;un.exports=function(t,e,i,n){return new Pn(t,e,i,n).beautify()},un.exports.defaultOptions=function(){return new $n};var Hn=ue.exports,Fn=Wi.exports,jn=un.exports;function Un(t,e,i,n){return jn(t,e,i=i||Hn,n=n||Fn)}Un.defaultOptions=jn.defaultOptions,ce.js=Hn,ce.css=Fn,ce.html=Un,function(t){var e=ce;e.js_beautify=e.js,e.css_beautify=e.css,e.html_beautify=e.html,t.exports=function(t,e,i){var n=function(e,i){return t.js_beautify(e,i)};return n.js=t.js_beautify,n.css=e.css_beautify,n.html=i.html_beautify,n.js_beautify=t.js_beautify,n.css_beautify=e.css_beautify,n.html_beautify=i.html_beautify,n}(e,e,e)}(re);var Wn=re.exports;function Gn(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Vn(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Yn(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Vn(Object(i),!0).forEach((function(e){Gn(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Vn(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function Xn(t,e){if(null==t)return{};var i,n,o=function(t,e){if(null==t)return{};var i,n,o={},s=Object.keys(t);for(n=0;n<s.length;n++)i=s[n],e.indexOf(i)>=0||(o[i]=t[i]);return o}(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(n=0;n<s.length;n++)i=s[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(o[i]=t[i])}return o}function Zn(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function Kn(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Qn(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Jn(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Qn(Object(i),!0).forEach((function(e){Kn(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Qn(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function to(t){return function e(){for(var i=this,n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return o.length>=t.length?t.apply(this,o):function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e.apply(i,[].concat(o,n))}}}function eo(t){return{}.toString.call(t).includes("Object")}function io(t){return"function"==typeof t}var no=to((function(t,e){throw new Error(t[e]||t.default)}))({initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"}),oo={changes:function(t,e){return eo(e)||no("changeType"),Object.keys(e).some((function(e){return i=t,n=e,!Object.prototype.hasOwnProperty.call(i,n);var i,n}))&&no("changeField"),e},selector:function(t){io(t)||no("selectorType")},handler:function(t){io(t)||eo(t)||no("handlerType"),eo(t)&&Object.values(t).some((function(t){return!io(t)}))&&no("handlersType")},initial:function(t){var e;t||no("initialIsRequired"),eo(t)||no("initialType"),e=t,Object.keys(e).length||no("initialContent")}};function so(t,e){return io(e)?e(t.current):e}function lo(t,e){return t.current=Jn(Jn({},t.current),e),e}function ao(t,e,i){return io(e)?e(t.current):Object.keys(i).forEach((function(i){var n;return null===(n=e[i])||void 0===n?void 0:n.call(e,t.current[i])})),i}var ro={create:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};oo.initial(t),oo.handler(e);var i={current:t},n=to(ao)(i,e),o=to(lo)(i),s=to(oo.changes)(t),l=to(so)(i);return[function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t};return oo.selector(t),t(i.current)},function(t){!function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return function(t){return e.reduceRight((function(t,e){return e(t)}),t)}}(n,o,s,l)(t)}]}};var co,uo={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:"Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "},bo=(co=function(t,e){throw new Error(t[e]||t.default)},function t(){for(var e=this,i=arguments.length,n=new Array(i),o=0;o<i;o++)n[o]=arguments[o];return n.length>=co.length?co.apply(this,n):function(){for(var i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return t.apply(e,[].concat(n,o))}})(uo),ho={config:function(t){var e;return t||bo("configIsRequired"),e=t,{}.toString.call(e).includes("Object")||bo("configType"),t.urls?(console.warn(uo.deprecation),{paths:{vs:t.urls.monacoBase}}):t}};function po(t,e){return Object.keys(e).forEach((function(i){e[i]instanceof Object&&t[i]&&Object.assign(e[i],po(t[i],e[i]))})),Yn(Yn({},t),e)}var go={type:"cancelation",msg:"operation is manually canceled"};function mo(t){var e=!1,i=new Promise((function(i,n){t.then((function(t){return e?n(go):i(t)})),t.catch(n)}));return i.cancel=function(){return e=!0},i}var fo,vo,yo=ro.create({config:{paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.33.0/min/vs"}},isInitialized:!1,resolve:null,reject:null,monaco:null}),xo=(vo=2,function(t){if(Array.isArray(t))return t}(fo=yo)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var i=[],n=!0,o=!1,s=void 0;try{for(var l,a=t[Symbol.iterator]();!(n=(l=a.next()).done)&&(i.push(l.value),!e||i.length!==e);n=!0);}catch(t){o=!0,s=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw s}}return i}}(fo,vo)||function(t,e){if(t){if("string"==typeof t)return Zn(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Zn(t,e):void 0}}(fo,vo)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),wo=xo[0],So=xo[1];function ko(t){return document.body.appendChild(t)}function _o(t){var e=wo((function(t){return{config:t.config,reject:t.reject}})),i=function(t){var e=document.createElement("script");return t&&(e.src=t),e}("".concat(e.config.paths.vs,"/loader.js"));return i.onload=function(){return t()},i.onerror=e.reject,i}function Co(){var t=wo((function(t){return{config:t.config,resolve:t.resolve,reject:t.reject}})),e=window.require;e.config(t.config),e(["vs/editor/editor.main"],(function(e){Eo(e),t.resolve(e)}),(function(e){t.reject(e)}))}function Eo(t){wo().monaco||So({monaco:t})}var Lo=new Promise((function(t,e){return So({resolve:t,reject:e})})),Ao={config:function(t){var e=ho.config(t),i=e.monaco,n=Xn(e,["monaco"]);So((function(t){return{config:po(t.config,n),monaco:i}}))},init:function(){var t=wo((function(t){return{monaco:t.monaco,isInitialized:t.isInitialized,resolve:t.resolve}}));if(!t.isInitialized){if(So({isInitialized:!0}),t.monaco)return t.resolve(t.monaco),mo(Lo);if(window.monaco&&window.monaco.editor)return Eo(window.monaco),t.resolve(window.monaco),mo(Lo);!function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return function(t){return e.reduceRight((function(t,e){return e(t)}),t)}}(ko,_o)(Co)}return mo(Lo)},__getMonacoInstance:function(){return wo((function(t){return t.monaco}))}};let qo={};class To{constructor(t){this.builder=t}renderPanel(){const t=this.builder.builderStuff,e=this.builder.util,i=this.builder.dom;let n=t.querySelector(".viewhtml");if(!n){const o=`<div class="is-modal viewhtml" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">\n <div class="is-modal-content">\n <textarea class="tabSupport" id="__tabsupport" style="width:100%;height:calc(100% - 50px);border:none;margin:0;box-sizing:border-box;"></textarea>\n <div class="is-modal-footer" style="border-top:1px solid ${this.builder.styleSeparatorColor};width:100%;height:50px;position:absolute;left:0;bottom:0;overflow:hidden;text-align:right">\n <button title="${e.out("Cancel")}" class="input-cancel classic-secondary">${e.out("Cancel")}</button>\n <button title="${e.out("Ok")}" class="input-ok classic-primary">${e.out("Ok")}</button>\n </div>\n </div>\n </div>\n\n <div class="is-modal viewhtmlmonaco" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">\n <div class="is-modal-content" style="width:${this.builder.blockCodeEditorWidth};max-width:${this.builder.blockCodeEditorMaxWidth};padding:0">\n <textarea id="__viewhtmlmonaco" style="position:absolute;display:none;"></textarea>\n <div class="input-code-editor" style="width:100%;height:${this.builder.blockCodeEditorHeight};"></div>\n <div class="is-modal-footer" style="display:flex;justify-content:flex-end;border-top:1px solid ${this.builder.styleSeparatorColor};">\n <button title="${e.out("Cancel")}" class="input-cancel classic-secondary">${e.out("Cancel")}</button>\n <button title="${e.out("Ok")}" class="input-ok classic-primary">${e.out("Ok")}</button>\n </div>\n </div>\n </div>\n\n <div class="is-modal viewhtmlexternal" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">\n <div class="is-modal-content" style="width:${this.builder.codeEditorWidth};max-width:${this.builder.codeEditorMaxWidth};padding:0">\n <div class="input-code-editor" id="__input_code_editor" style="width:100%;height:${this.builder.codeEditorHeight};"></div>\n <div class="is-modal-footer" style="display:flex;justify-content:flex-end;border-top:1px solid ${this.builder.styleSeparatorColor};">\n <button title="${e.out("Cancel")}" class="input-cancel classic-secondary">${e.out("Cancel")}</button>\n <button title="${e.out("Ok")}" class="input-ok classic-primary">${e.out("Ok")}</button>\n </div>\n </div>\n </div>\n \n `;i.appendHtml(t,o),n=t.querySelector(".viewhtml");let s=t.querySelector(".viewhtmlmonaco"),l=t.querySelector(".viewhtmlexternal"),a=n.querySelector(".input-ok");i.addEventListener(a,"click",(()=>{this.applyHtml(n)})),a=n.querySelector(".input-cancel"),i.addEventListener(a,"click",(()=>{this.builder.hideModal(n)})),a=s.querySelector(".input-ok"),i.addEventListener(a,"click",(()=>{this.applyHtml(s)})),a=s.querySelector(".input-cancel"),i.addEventListener(a,"click",(()=>{this.builder.hideModal(s)})),a=l.querySelector(".input-ok"),i.addEventListener(a,"click",(()=>{const t=document.querySelector("textarea[data-source-active]"),e=t.getAttribute("data-source-ok");t.removeAttribute("data-source-active"),t.removeAttribute("data-source-ok"),t.removeAttribute("data-source-cancel"),document.querySelector(e).click(),this.builder.hideModal(l)})),a=l.querySelector(".input-cancel"),i.addEventListener(a,"click",(()=>{const t=document.querySelector("textarea[data-source-active]"),e=t.getAttribute("data-source-cancel");t.removeAttribute("data-source-active"),t.removeAttribute("data-source-ok"),t.removeAttribute("data-source-cancel"),document.querySelector(e).click(),this.builder.hideModal(l)}))}}applyHtml(t){const e=this.builder.util,i=e.cellSelected();i&&i.parentNode.classList.add("row-active");let n=this.builder.codeEditorMode,o=this.builder.codeEditorArea;this.builder.uo.saveForUndo();let s=t.querySelector("textarea").value;if("code"===n){let i=this.builder.activeCodeBlock;i.setAttribute("data-html",encodeURIComponent(s)),s=s.replace(/{id}/g,e.makeId());for(let t=1;t<=20;t++)s=s.replace("[%HTML"+t+"%]",void 0===i.getAttribute("data-html-"+t)?"":decodeURIComponent(i.getAttribute("data-html-"+t)));i.innerHTML="";let n=document.createRange();n.setStart(i,0),i.appendChild(n.createContextualFragment(s));let o=this.builder.doc.querySelector(".builder-active");return o&&this.builder.applyBehaviorOn(o),this.builder.opts.onChange(),this.builder.opts.onRender(),this.builder.hideModal(t),void e.hideControls()}if(s=this.fromViewToActual(s),"cell"===n){e.cellSelected().innerHTML=s;let t=this.builder.doc.querySelector(".builder-active");t&&this.builder.applyBehaviorOn(t),this.builder.opts.onChange(),this.builder.opts.onRender()}if("row"===n){let t,i=e.cellSelected();if(t=i?i.parentNode:e.rowSelected(),!t)return;t.innerHTML=s;let n=this.builder.doc.querySelector(".builder-active");n&&this.builder.applyBehaviorOn(n),this.builder.opts.onChange(),this.builder.opts.onRender()}if("full"===n){if(this.builder.docContainer)return this.builder.loadHTML(s),e.clearControls(),void this.builder.hideModal(t);o.innerHTML="";let i=document.createRange();i.setStart(o,0),o.appendChild(i.createContextualFragment(s)),this.builder.applyBehaviorOn(o),this.builder.opts.onChange(),this.builder.opts.onRender(),e.clearActiveCell()}e.clearControls(),this.builder.hideModal(t)}viewHtmlExternal(){const t=this.builder.util,e=this.builder.builderStuff;this.renderPanel();const i=e.querySelector(".viewhtmlexternal");document.activeElement&&(this.elmFocus=document.activeElement),t.showModal(i,!0,(()=>{this.elmFocus&&this.elmFocus.focus()}),!1),i.querySelector(".input-code-editor").style.opacity=.01,this._viewHtmlExternal()}_viewHtmlExternal(){const t=this.builder.builderStuff,e=document.querySelector("textarea[data-source-active]");let i=t.querySelector(".viewhtmlexternal").querySelector(".input-code-editor");if(!i.querySelector(".monaco-editor"))return Ao.init().then((t=>{this.builder.monaco=t,i.getAttribute("data-mode-id")||(this.builder.codeEditorExternal=t.editor.create(i,{value:"",minimap:{enabled:!1},automaticLayout:!0,contextmenu:!1,fontSize:13,wordWrap:!0,scrollbar:{useShadows:!1,vertical:"visible",horizontal:"visible",horizontalScrollbarSize:12,verticalScrollbarSize:12},language:"html",theme:this.builder.styleDark||this.builder.styleColoredDark?"vs-dark":""})),this.builder.codeEditorExternal.onDidChangeModelContent((()=>{document.querySelector("textarea[data-source-active]").value=this.builder.codeEditorExternal.getModel().getValue()}))})),void setTimeout((()=>{this._viewHtmlExternal()}),100);const n=this.builder.monaco.editor.createModel(e.value,"html");this.builder.codeEditorExternal.setModel(n),i.style.opacity=""}view(t,e,i){this.renderPanel();const n=this.builder.util,o=this.builder.builderStuff;let s;s=this.builder.opts.htmlSyntaxHighlighting?o.querySelector(".viewhtmlmonaco"):o.querySelector(".viewhtml");let l=s.querySelector(".is-modal-content"),a=s.querySelector(".input-code-editor");a.style.opacity=.01,"full"===t?(l.style.width=this.builder.codeEditorWidth,l.style.maxWidth=this.builder.codeEditorMaxWidth,a.style.height=this.builder.codeEditorHeight):(l.style.width=this.builder.blockCodeEditorWidth,l.style.maxWidth=this.builder.blockCodeEditorMaxWidth,a.style.height=this.builder.blockCodeEditorHeight);const r=this.builder.doc.querySelector(".row-active");r&&r.classList.remove("row-active"),n.showModal(s,!0,(()=>{i&&(i.removeAttribute("data-focus"),i.focus());const t=n.cellSelected();t&&t.parentNode.classList.add("row-active")})),i&&i.setAttribute("data-focus",!0),this._view(t,e)}_view(t,e){const i=this.builder.dom,n=this.builder.util,o=this.builder.builderStuff;let s;if(this.builder.opts.htmlSyntaxHighlighting){s=o.querySelector(".viewhtmlmonaco");let i=s.querySelector(".input-code-editor");if(!i.querySelector(".monaco-editor"))return Ao.init().then((t=>{this.builder.monaco=t,i.getAttribute("data-mode-id")||(this.builder.codeEditor=t.editor.create(i,{value:"",minimap:{enabled:!1},automaticLayout:!0,contextmenu:!1,fontSize:13,wordWrap:!0,scrollbar:{useShadows:!1,vertical:"visible",horizontal:"visible",horizontalScrollbarSize:12,verticalScrollbarSize:12},language:"html",theme:this.builder.styleDark||this.builder.styleColoredDark?"vs-dark":""}));let e=s.querySelector("textarea");this.builder.codeEditor.onDidChangeModelContent((()=>{e.value=this.builder.codeEditor.getModel().getValue()}))})),void setTimeout((()=>{this._view(t,e)}),100)}else s=o.querySelector(".viewhtml");let l=s.querySelector("textarea");if("cell"===t){const t=n.cellSelected();if(!t)return;let e=s.querySelector("textarea");this.builder.cleanHtmlFormatting=!0,e.value=this.readHtml(t,!0),this.builder.cleanHtmlFormatting=!1}if("row"===t){let t,e=n.cellSelected();if(t=e?e.parentNode:n.rowSelected(),!t)return;let o=s.querySelector("textarea");this.builder.cleanHtmlFormatting=!0,o.value=this.readHtml(t,!0),this.builder.cleanHtmlFormatting=!1,i.removeClass(t,"row-outline")}if("full"===t){if(e);else{const t=this.builder.doc.querySelectorAll(this.builder.opts.container);if(t.length>1){const i=n.cellSelected();e=i?i.parentNode.parentNode:t[0]}else e=t[0];if(""!==this.builder.opts.page){const t=this.builder.doc.querySelector(this.builder.opts.page);t&&(e=t)}}let t=s.querySelector("textarea");this.builder.cleanHtmlFormatting=!0,this.builder.shortenHTML?t.value=this.readHtml(e,!0):t.value=this.readHtml(e,!1),this.builder.cleanHtmlFormatting=!1}if(this.builder.opts.htmlSyntaxHighlighting){const t=this.builder.monaco.editor.createModel(l.value,"html");this.builder.codeEditor.setModel(t)}let a=o.querySelector(".is-pop.columnmore");a&&(a.style.display="");let r=o.querySelector(".is-pop.rowmore");r&&(r.style.display=""),this.builder.codeEditorMode=t,this.builder.codeEditorArea=e,s.querySelector(".input-code-editor").style.opacity=""}fromViewToActual(t){for(var e in qo)t=t.replace(e,qo[e]);return t}readHtml(t,e,i,n){const o=this.builder.dom;if(this.builder.opts.absolutePath){let e=t.querySelectorAll("a");Array.prototype.forEach.call(e,(t=>{let e=t.href;t.setAttribute("href",e)}));let i=t.querySelectorAll("img");Array.prototype.forEach.call(i,(t=>{let e=t.src;t.setAttribute("src",e)}))}this.builder.cleanHtmlFormatting;const s=this.builder.util;let l,a=document.createElement("div");a.innerHTML=t.innerHTML;let r=a.querySelectorAll("[data-html]");if(Array.prototype.forEach.call(r,(t=>{let e=1,i=t.querySelectorAll("[data-subblock]");Array.prototype.forEach.call(i,(i=>{if(i.closest(".glide__slide--clone"))return;let n=i.innerHTML;t.setAttribute("data-html-"+e,encodeURIComponent(n)),e++}))})),r=a.querySelectorAll("[data-html]"),Array.prototype.forEach.call(r,(t=>{let e=decodeURIComponent(t.getAttribute("data-html"));e=e.replace(/{id}/g,s.makeId()),t.innerHTML=e;let i=t.querySelectorAll("[data-subblock]");var n=1;Array.prototype.forEach.call(i,(e=>{e.innerHTML=void 0===t.getAttribute("data-html-"+n)?"":decodeURIComponent(t.getAttribute("data-html-"+n)),n++}))})),e&&(qo={},r=a.querySelectorAll("[data-html]"),Array.prototype.forEach.call(r,(t=>{let e=s.makeId();qo[e]=t.getAttribute("data-html"),t.setAttribute("data-html",e);for(let i=1;i<=20;i++)void 0!==t.getAttribute("data-html-"+i)&&(e=s.makeId(),qo[e]=t.getAttribute("data-html-"+i),t.getAttribute("data-html-"+i,e));void 0!==t.getAttribute("data-settings")&&(e=s.makeId(),qo[e]=t.getAttribute("data-settings"),t.getAttribute("data-settings",e))}))),this.builder.makeAbsolute){const t=t=>{let e=document.createElement("img");return e.src=t,e.setAttribute("data-absoluteurl",e.src),t=e.getAttribute("data-absoluteurl")},e=t=>{let e=document.createElement("img");e.src=t,e.setAttribute("data-absoluteurl",e.src),t=e.getAttribute("data-absoluteurl");let i=window.location.href.substring(0,window.location.href.lastIndexOf("/"));return t.replace(i,"[%PATH%]")},i=(e,i)=>{if(e.hasAttribute(i)){if("video"!==e.parentNode.tagName.toLowerCase()&&"audio"!==e.parentNode.tagName.toLowerCase())return;let n=e.getAttribute(i);n=t(n),e.setAttribute(i,`${n}`)}};let n=a.querySelectorAll("img");Array.prototype.forEach.call(n,(t=>{let e=t.src;t.setAttribute("src",e)})),a.querySelectorAll("*").forEach((n=>{if(n.style.backgroundImage){let t=n.style.backgroundImage;if(-1!==t.indexOf("url(")){let i=t.slice(4,-1).replace(/["']/g,"");i=e(i),n.style.backgroundImage=`url(${i})`}}if(i(n,"src"),i(n,"data-default"),i(n,"data-240"),i(n,"data-360"),i(n,"data-480"),i(n,"data-540"),i(n,"data-720"),i(n,"data-1080"),i(n,"data-1440"),i(n,"data-2160"),n.hasAttribute("href")&&"link"===n.tagName.toLowerCase()){let e=n.getAttribute("href");e=t(e),n.setAttribute("href",`${e}`)}}))}let c=a.querySelectorAll(".is-builder");Array.prototype.forEach.call(c,(t=>{t.style.transform="",t.style.WebkitTransform="",t.style.MozTransform="",t.removeAttribute("data-sort"),o.removeClass(t,"builder-active");o.elementChildren(t).forEach((t=>{o.elementChildren(t).forEach((t=>{t.style.cursor=""}))}))}));let u;if(o.elementChildren(a).forEach((t=>{t.style.cursor="";o.elementChildren(t).forEach((t=>{t.style.cursor=""}))})),u=a.querySelectorAll(".sortable-chosen, .sortable-ghost, .elm-active, .icon-active, .elm-inspected, .cell-active, .row-active, .row-outline, .is-builder"),u.forEach((t=>{t.classList.remove("sortable-chosen"),t.classList.remove("sortable-ghost"),t.classList.remove("elm-active"),t.classList.remove("icon-active"),t.classList.remove("elm-inspected"),t.classList.remove("cell-active"),t.classList.remove("row-active"),t.classList.remove("row-outline"),t.classList.remove("is-builder")})),u=a.querySelectorAll("[data-click], [contenteditable], [draggridoutline], [between-blocks-left], [between-blocks-center], [hideelementhighlight], [data-module-active], [draggable]"),u.forEach((t=>{t.removeAttribute("data-click"),t.removeAttribute("contenteditable"),t.removeAttribute("draggridoutline"),t.removeAttribute("between-blocks-left"),t.removeAttribute("between-blocks-center"),t.removeAttribute("hideelementhighlight"),t.removeAttribute("data-module-active"),t.removeAttribute("draggable")})),u=a.querySelectorAll("[data-animated], [data-saveforundo], [hidesnippetaddtool], [gray], [rowoutline], [hidecolumntool], [grayoutline], [hideoutline]"),u.forEach((t=>{t.removeAttribute("data-animated"),t.removeAttribute("data-saveforundo"),t.removeAttribute("hidesnippetaddtool"),t.removeAttribute("gray"),t.removeAttribute("rowoutline"),t.removeAttribute("hidecolumntool"),t.removeAttribute("grayoutline"),t.removeAttribute("hideoutline")})),u=a.querySelectorAll("[leftrowtool], [minimal], [clean], [grideditor], [gridoutline]"),u.forEach((t=>{t.removeAttribute("leftrowtool"),t.removeAttribute("minimal"),t.removeAttribute("clean"),t.removeAttribute("grideditor"),t.removeAttribute("gridoutline")})),u=a.querySelectorAll(".is-row-tool,.is-col-tool,.is-rowadd-tool,.is-canvas-tool,.is-canvasadd-tool,.h-ruler,.v-ruler"),u.forEach((t=>{t.previousSibling&&t.previousSibling.nodeType===Node.TEXT_NODE&&t.previousSibling.remove(),t.nextSibling&&t.nextSibling.nodeType===Node.TEXT_NODE&&t.nextSibling.remove(),t.remove()})),u=a.querySelectorAll(".ovl,.row-add-initial"),u.forEach((t=>{t.remove()})),this.builder.cleanAOS&&(u=a.querySelectorAll(".aos-init, .aos-animate"),u.forEach((t=>{t.classList.remove("aos-init"),t.classList.remove("aos-animate")}))),u=a.querySelectorAll(".skrollable, .skrollable-after, .skrollable-before, .skrollable-between, .is-inview"),u.forEach((t=>{t.classList.remove("skrollable"),t.classList.remove("skrollable-after"),t.classList.remove("skrollable-before"),t.classList.remove("skrollable-between"),t.classList.remove("is-inview")})),a.querySelectorAll('[class=""]').forEach((t=>{t.removeAttribute("class")})),a.querySelectorAll(".is-row-overlay").forEach((t=>{t.hasAttribute("style")||t.parentNode.removeChild(t)})),o.removeEmptyStyle(a),u=a.querySelectorAll("[data-keep]"),o.removeAttributes(u,"data-keep"),a.querySelectorAll("a").forEach((t=>{"inline-block"===t.style.display&&1===t.parentNode.childElementCount&&"span"===t.parentNode.tagName.toLowerCase()&&(t.parentNode.outerHTML=t.parentNode.innerHTML)})),n){a.querySelectorAll("[data-html]").forEach((t=>{t.innerHTML=""}))}if(l="",i){u=a.querySelectorAll(".is-dummy"),u.forEach((t=>{t.remove()})),u=a.querySelectorAll("[data-scroll], [data-scroll-once]"),u.forEach((t=>{t.removeAttribute("data-scroll"),t.removeAttribute("data-scroll-once")})),this.builder.shortenOutput&&(u=a.querySelectorAll("[data-noedit], [data-module], [data-module-desc], [data-dialog-width], [data-dialog-height], [data-html], [data-settings]"),u.forEach((t=>{t.removeAttribute("data-noedit"),t.removeAttribute("data-module"),t.removeAttribute("data-module-desc"),t.removeAttribute("data-dialog-width"),t.removeAttribute("data-dialog-height"),t.removeAttribute("data-html"),t.removeAttribute("data-settings")})),u=a.querySelectorAll("[data-html-1], [data-html-2], [data-html-3], [data-html-4], [data-html-5], [data-html-6], [data-html-7], [data-html-8], [data-html-9], [data-html-10]"),u.forEach((t=>{t.removeAttribute("data-html-1"),t.removeAttribute("data-html-2"),t.removeAttribute("data-html-3"),t.removeAttribute("data-html-4"),t.removeAttribute("data-html-5"),t.removeAttribute("data-html-6"),t.removeAttribute("data-html-7"),t.removeAttribute("data-html-8"),t.removeAttribute("data-html-9"),t.removeAttribute("data-html-10")}))),u=a.querySelectorAll("[data-bottom-top],[data-center],[data-center-bottom],[data-100-top],[data-50-top],[data-top],[data-top-bottom],[data-center-top],[data--300-bottom],[data--150-bottom],[data--50-bottom],[data-bottom],[data-100-bottom],[data-150-bottom],[data-400-bottom],[data--400-bottom],[data--200-bottom],[data--100-bottom],[data-50-bottom],[data-200-bottom],[data-300-bottom],[data-in],[data-in-150],[data-in-300],[data-cen--150],[data-cen],[data-cen-150],[data-out--300],[data-out--150],[data-out][data-t],[data-t-100],[data-t-200],[data-t-300],[data-t-400],[data-t-500],[data-t-600],[data-t-700],[data-t-800],[data-t-900],[data-t-1000],[data-t-1100],[data-t-1200],[data-t-1300],[data-t-1400],[data-t-1500],[data-t-1600],[data-t-1700],[data-t-1800],[data-t-1900],[data-t-2000],[data-t-2100],[data-t-2200],[data-t-2300],[data-t-2400],[data-t-2500],[data-t-2600],[data-t-2700],[data-t-2800]"),Array.prototype.forEach.call(u,(t=>{t.style.transition="",t.style.transform="",t.style.opacity=""})),u=a.querySelectorAll(".is-animated"),Array.prototype.forEach.call(u,(t=>{o.removeClass(t,"animated"),o.removeClass(t,"pulse"),o.removeClass(t,"bounceIn"),o.removeClass(t,"fadeIn"),o.removeClass(t,"fadeOut"),o.removeClass(t,"fadeInDown"),o.removeClass(t,"fadeInLeft"),o.removeClass(t,"fadeInRight"),o.removeClass(t,"fadeInUp"),o.removeClass(t,"flipInX"),o.removeClass(t,"flipInY"),o.removeClass(t,"slideInUp"),o.removeClass(t,"slideInDown"),o.removeClass(t,"slideInLeft"),o.removeClass(t,"slideInRight"),o.removeClass(t,"zoomIn"),t.style.animationDelay="",t.style.transitionDelay="",t.style.transitionDuration="",t.style.transitionTimingFunction="",t.style.transitionProperty=""}));let t=a.querySelectorAll('[style=""]');Array.prototype.forEach.call(t,(t=>{t.removeAttribute("style")})),u=a.querySelectorAll(".is-appeared, .box-active, .section-active, .section-select, .box-select"),u.forEach((t=>{t.classList.remove("is-appeared"),t.classList.remove("box-active"),t.classList.remove("section-active"),t.classList.remove("section-select"),t.classList.remove("box-select")})),u=a.querySelectorAll(".is-section-tool, .is-box-tool, .is-box-info, .is-section-info"),u.forEach((t=>{t.previousSibling&&t.previousSibling.nodeType===Node.TEXT_NODE&&t.previousSibling.remove(),t.nextSibling&&t.nextSibling.nodeType===Node.TEXT_NODE&&t.nextSibling.remove(),t.remove()})),u=a.querySelectorAll(".is-block .handle, .is-block .rotate-handle"),o.removeElements(u),u=a.querySelectorAll(".is-block"),Array.prototype.forEach.call(u,(t=>{o.removeClass(t,"active"),o.removeClass(t,"multi"),o.removeClass(t,"editable"),o.removeClass(t,"fluid"),o.removeClass(t,"cloned"),t.removeAttribute("data-fluid-val"),t.removeAttribute("data-fluid"),t.removeAttribute("data-prev")})),a.querySelectorAll(".is-block.clone").forEach((t=>t.parentNode.removeChild(t)));var d="",b="",h="";o.elementChildren(a).forEach((t=>{let e=t;if(o.hasClass(e,"is-section")){var i="";e.getAttribute("class")&&(i=' class="'+e.getAttribute("class")+'"');var n=e.cloneNode(!0),s=n.outerHTML;l+=s,-1===i.indexOf("is-static")?d+=s+"\n\n":b+=s+"\n\n"}else s=(n=e.cloneNode(!0)).outerHTML,l+=s,h+=s}));let e=document.querySelector("[data-contentbox]"),i=!1;e&&(i=e.settings.disableStaticSection),i||(l=d+b+h),l=a.innerHTML.trim(),l=l.replace(/<font/g,"<span").replace(/<\/font/g,"</span")}else{let t=a.querySelectorAll('[style=""]');Array.prototype.forEach.call(t,(t=>{t.removeAttribute("style")})),this.builder.shortenOutput&&(u=a.querySelectorAll("[data-noedit], [data-module], [data-module-desc], [data-dialog-width], [data-dialog-height], [data-html], [data-settings]"),u.forEach((t=>{t.removeAttribute("data-noedit"),t.removeAttribute("data-module"),t.removeAttribute("data-module-desc"),t.removeAttribute("data-dialog-width"),t.removeAttribute("data-dialog-height"),t.removeAttribute("data-html"),t.removeAttribute("data-settings")})),u=a.querySelectorAll("[data-html-1], [data-html-2], [data-html-3], [data-html-4], [data-html-5], [data-html-6], [data-html-7], [data-html-8], [data-html-9], [data-html-10]"),u.forEach((t=>{t.removeAttribute("data-html-1"),t.removeAttribute("data-html-2"),t.removeAttribute("data-html-3"),t.removeAttribute("data-html-4"),t.removeAttribute("data-html-5"),t.removeAttribute("data-html-6"),t.removeAttribute("data-html-7"),t.removeAttribute("data-html-8"),t.removeAttribute("data-html-9"),t.removeAttribute("data-html-10")}))),u=a.querySelectorAll(".is-block .handle, .is-block .rotate-handle"),o.removeElements(u),u=a.querySelectorAll(".is-block"),Array.prototype.forEach.call(u,(t=>{o.removeClass(t,"active"),o.removeClass(t,"multi"),o.removeClass(t,"editable"),o.removeClass(t,"fluid"),o.removeClass(t,"cloned"),t.removeAttribute("data-fluid-val"),t.removeAttribute("data-fluid"),t.removeAttribute("data-prev")})),a.querySelectorAll(".is-block.clone").forEach((t=>t.parentNode.removeChild(t))),l=a.innerHTML.trim(),l=l.replace(/<font/g,"<span").replace(/<\/font/g,"</span")}let p=Wn.html;return l=p(l),l=l.replace(/(\r\n|\r|\n){3,}/g,"$1\n"),l}beautify(t){return t=(t=(0,Wn.html)(t)).replace(/(\r\n|\r|\n){3,}/g,"$1\n")}}class Mo{constructor(t){this.builder=t;const e=this.builder.dom;this.dom=e,this.undoList=[]}readStyles(){if(this.builder.opts.undoContainerOnly)return"";let t,e,i="",n=this.builder.doc.getElementsByTagName("link");for(t=0;t<n.length;t++)e=n[t].href.toLowerCase(),-1!==e.indexOf("basetype-")&&(i+=n[t].outerHTML);for(n=this.builder.doc.getElementsByTagName("link"),t=0;t<n.length;t++)e=n[t].href.toLowerCase(),-1!==e.indexOf("basetype-")||-1!==e.indexOf("type-")&&(i+=n[t].outerHTML);return i}writeStyles(t){const e=this.dom;if(this.builder.opts.undoContainerOnly)return;let i,n,o=this.builder.doc.getElementsByTagName("link");for(i=0;i<o.length;i++)n=o[i].href.toLowerCase(),(-1!==n.indexOf("basetype-")||-1!==n.indexOf("type-"))&&o[i].parentNode.removeChild(o[i]);let s=this.builder.doc.getElementsByTagName("head")[0];e.appendHtml(s,t)}readHtml(){if(""===this.builder.opts.page||this.builder.opts.undoContainerOnly){if(this.builder.docContainer){return this.builder.doc.querySelector(this.builder.docContainer).innerHTML}{const t=this.builder.doc.querySelectorAll(this.builder.opts.container);let e="";return Array.prototype.forEach.call(t,(t=>{e+=t.innerHTML+"####|####"})),e=e.substr(0,e.length-9),e}}return this.builder.doc.querySelector(this.builder.opts.page).innerHTML}cleaning(t){const e=this.dom;let i=t.querySelectorAll(".is-builder");Array.prototype.forEach.call(i,(t=>{t.removeAttribute("data-sort")}));let n=t.querySelectorAll("[data-click]");e.removeAttributes(n,"data-click"),e.removeElements(t.querySelectorAll(".is-row-tool")),e.removeElements(t.querySelectorAll(".is-rowadd-tool")),e.removeElements(t.querySelectorAll(".is-col-tool")),e.removeElements(t.querySelectorAll(".is-canvas-tool")),e.removeElements(t.querySelectorAll(".is-canvasadd-tool")),e.removeElements(t.querySelectorAll(".ovl")),e.removeElements(t.querySelectorAll(".row-add-initial")),e.removeElements(t.querySelectorAll(".h-ruler")),e.removeElements(t.querySelectorAll(".v-ruler")),n=t.querySelectorAll(".is-block .handle, .is-block .rotate-handle"),e.removeElements(n),n=t.querySelectorAll(".is-block"),Array.prototype.forEach.call(n,(t=>{e.removeClass(t,"active"),e.removeClass(t,"multi"),e.removeClass(t,"editable"),e.removeClass(t,"fluid"),e.removeClass(t,"cloned"),t.removeAttribute("data-fluid-val"),t.removeAttribute("data-fluid"),t.removeAttribute("data-prev")})),t.querySelectorAll(".is-block.clone").forEach((t=>t.parentNode.removeChild(t))),n=t.querySelectorAll(".is-section-tool"),e.removeElements(n)}writeHtml(t){if(""===this.builder.opts.page||this.builder.opts.undoContainerOnly)if(this.builder.docContainer){let e=this.builder.doc.querySelector(this.builder.docContainer),i=document.createRange();e.innerHTML="",e.appendChild(i.createContextualFragment(t)),this.cleaning(e)}else{const e=this.builder.doc.querySelectorAll(this.builder.opts.container);let i=0;Array.prototype.forEach.call(e,(e=>{var n=document.createRange();e.innerHTML="",e.appendChild(n.createContextualFragment(t.split("####|####")[i])),this.cleaning(e),this.builder.applyBehaviorOn(e),i++}))}else{let e=this.builder.doc.querySelector(this.builder.opts.page),i=document.createRange();e.innerHTML="",e.appendChild(i.createContextualFragment(t)),this.cleaning(e)}this.builder.opts.onRender()}saveForUndo(t){if(this.builder.onBeforeSaveForUndo&&this.builder.onBeforeSaveForUndo(),this.builder.undoRedoStyles){if(this.undoList[120]){let e=this.undoList[120][0].split("###$###")[1];if(this.builder.saveForUndoCheck&&e===this.readHtml())return void(this.builder.saveForUndoCheck=!0===t)}}else if(this.undoList[120]){let e=this.undoList[120][0];if(this.builder.saveForUndoCheck&&e===this.readHtml())return void(this.builder.saveForUndoCheck=!0===t)}if(this.builder.saveForUndoCheck=!0===t,this.undoList[140]=this.undoList[139],this.undoList[139]=this.undoList[138],this.undoList[138]=this.undoList[137],this.undoList[137]=this.undoList[136],this.undoList[136]=this.undoList[135],this.undoList[135]=this.undoList[134],this.undoList[134]=this.undoList[133],this.undoList[133]=this.undoList[132],this.undoList[132]=this.undoList[131],this.undoList[131]=this.undoList[130],this.undoList[130]=this.undoList[129],this.undoList[129]=this.undoList[128],this.undoList[128]=this.undoList[127],this.undoList[127]=this.undoList[126],this.undoList[126]=this.undoList[125],this.undoList[125]=this.undoList[124],this.undoList[124]=this.undoList[123],this.undoList[123]=this.undoList[122],this.undoList[122]=this.undoList[121],this.undoList[121]=this.undoList[120],this.builder.undoRedoStyles){let t=" "+this.readStyles()+"###$###"+this.readHtml();this.undoList[120]=[t,null]}else this.undoList[120]=[this.readHtml(),null]}doUndo(){const t=this.dom;if(!this.undoList[120])return;if(!0===this.builder.undoRedoInProcess)return;if(this.builder.undoRedoInProcess=!0,this.undoList[99]=this.undoList[100],this.undoList[100]=this.undoList[101],this.undoList[101]=this.undoList[102],this.undoList[102]=this.undoList[103],this.undoList[103]=this.undoList[104],this.undoList[104]=this.undoList[105],this.undoList[105]=this.undoList[106],this.undoList[106]=this.undoList[107],this.undoList[107]=this.undoList[108],this.undoList[108]=this.undoList[109],this.undoList[109]=this.undoList[110],this.undoList[110]=this.undoList[111],this.undoList[111]=this.undoList[112],this.undoList[112]=this.undoList[113],this.undoList[113]=this.undoList[114],this.undoList[114]=this.undoList[115],this.undoList[115]=this.undoList[116],this.undoList[116]=this.undoList[117],this.undoList[117]=this.undoList[118],this.undoList[118]=this.undoList[119],this.builder.undoRedoStyles){let t=this.readStyles(),e=this.readHtml(),i=" "+t+"###$###"+e;this.undoList[119]=[i,null],i=this.undoList[120][0],t=i.split("###$###")[0].trim(),e=i.split("###$###")[1],this.writeStyles(t),this.writeHtml(e)}else{this.undoList[119]=[this.readHtml(),null];let t=this.undoList[120][0];this.writeHtml(t)}this.builder.applyBehavior(),this.builder.applyBehaviorCanvas(),this.builder.opts.onChange(),this.undoList[120]=this.undoList[121],this.undoList[121]=this.undoList[122],this.undoList[122]=this.undoList[123],this.undoList[123]=this.undoList[124],this.undoList[124]=this.undoList[125],this.undoList[125]=this.undoList[126],this.undoList[126]=this.undoList[127],this.undoList[127]=this.undoList[128],this.undoList[128]=this.undoList[129],this.undoList[129]=this.undoList[130],this.undoList[130]=this.undoList[131],this.undoList[131]=this.undoList[132],this.undoList[132]=this.undoList[133],this.undoList[133]=this.undoList[134],this.undoList[134]=this.undoList[135],this.undoList[135]=this.undoList[136],this.undoList[136]=this.undoList[137],this.undoList[137]=this.undoList[138],this.undoList[138]=this.undoList[139],this.undoList[139]=this.undoList[140],this.undoList[140]=this.undoList[141];const e=new se(this.builder);e.clearActiveCell(),e.clearAfterUndoRedo();let i=this.builder.doc.querySelector("[data-saveforundo]");if(i){let e=document.querySelector(".is-side.elementstyles");t.addClass(e,"active"),setTimeout((()=>{i.click()}),700)}else{let e=document.querySelector(".is-side.elementstyles");t.removeClass(e,"active")}this.builder.opts.onUndo&&this.builder.opts.onUndo(),this.builder.undoRedoInProcess=!1}doRedo(){const t=this.dom;if(!this.undoList[119])return;if(!0===this.builder.undoRedoInProcess)return;if(this.builder.undoRedoInProcess=!0,this.undoList[141]=this.undoList[140],this.undoList[140]=this.undoList[139],this.undoList[139]=this.undoList[138],this.undoList[138]=this.undoList[137],this.undoList[137]=this.undoList[136],this.undoList[136]=this.undoList[135],this.undoList[135]=this.undoList[134],this.undoList[134]=this.undoList[133],this.undoList[133]=this.undoList[132],this.undoList[132]=this.undoList[131],this.undoList[131]=this.undoList[130],this.undoList[130]=this.undoList[129],this.undoList[129]=this.undoList[128],this.undoList[128]=this.undoList[127],this.undoList[127]=this.undoList[126],this.undoList[126]=this.undoList[125],this.undoList[125]=this.undoList[124],this.undoList[124]=this.undoList[123],this.undoList[123]=this.undoList[122],this.undoList[122]=this.undoList[121],this.undoList[121]=this.undoList[120],this.builder.undoRedoStyles){let t=this.readStyles(),e=this.readHtml(),i=" "+t+"###$###"+e;this.undoList[120]=[i,null],i=this.undoList[119][0],t=i.split("###$###")[0].trim(),e=i.split("###$###")[1],this.writeStyles(t),this.writeHtml(e)}else{this.undoList[120]=[this.readHtml(),null];let t=this.undoList[119][0];this.writeHtml(t)}this.builder.applyBehavior(),this.builder.applyBehaviorCanvas(),this.builder.opts.onChange(),this.undoList[119]=this.undoList[118],this.undoList[118]=this.undoList[117],this.undoList[117]=this.undoList[116],this.undoList[116]=this.undoList[115],this.undoList[115]=this.undoList[114],this.undoList[114]=this.undoList[113],this.undoList[113]=this.undoList[112],this.undoList[112]=this.undoList[111],this.undoList[111]=this.undoList[110],this.undoList[110]=this.undoList[109],this.undoList[109]=this.undoList[108],this.undoList[108]=this.undoList[107],this.undoList[107]=this.undoList[106],this.undoList[106]=this.undoList[105],this.undoList[105]=this.undoList[104],this.undoList[104]=this.undoList[103],this.undoList[103]=this.undoList[102],this.undoList[102]=this.undoList[101],this.undoList[101]=this.undoList[100],this.undoList[100]=this.undoList[99],this.undoList[99]=null;const e=new se(this.builder);e.clearActiveCell(),e.clearAfterUndoRedo();let i=this.builder.doc.querySelector("[data-saveforundo]");if(i){let e=document.querySelector(".is-side.elementstyles");t.addClass(e,"active"),setTimeout((()=>{i.click()}),700)}else{let e=document.querySelector(".is-side.elementstyles");t.removeClass(e,"active")}this.builder.opts.onRedo&&this.builder.opts.onRedo(),this.builder.undoRedoInProcess=!1}}
7
+ */function i(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function n(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?i(Object(n),!0).forEach((function(e){s(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function s(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function l(){return l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},l.apply(this,arguments)}function a(t,e){if(null==t)return{};var i,n,o=function(t,e){if(null==t)return{};var i,n,o={},s=Object.keys(t);for(n=0;n<s.length;n++)i=s[n],e.indexOf(i)>=0||(o[i]=t[i]);return o}(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(n=0;n<s.length;n++)i=s[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(o[i]=t[i])}return o}function r(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}var c=r(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),u=r(/Edge/i),d=r(/firefox/i),b=r(/safari/i)&&!r(/chrome/i)&&!r(/android/i),h=r(/iP(ad|od|hone)/i),p=r(/chrome/i)&&r(/android/i),g={capture:!1,passive:!1};function m(t,e,i){t.addEventListener(e,i,!c&&g)}function f(t,e,i){t.removeEventListener(e,i,!c&&g)}function v(t,e){if(e){if(">"===e[0]&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function y(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function x(t,e,i,n){if(t){i=i||document;do{if(null!=e&&(">"===e[0]?t.parentNode===i&&v(t,e):v(t,e))||n&&t===i)return t;if(t===i)break}while(t=y(t))}return null}var w,S=/\s+/g;function k(t,e,i){if(t&&e)if(t.classList)t.classList[i?"add":"remove"](e);else{var n=(" "+t.className+" ").replace(S," ").replace(" "+e+" "," ");t.className=(n+(i?" "+e:"")).replace(S," ")}}function _(t,e,i){var n=t&&t.style;if(n){if(void 0===i)return document.defaultView&&document.defaultView.getComputedStyle?i=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(i=t.currentStyle),void 0===e?i:i[e];e in n||-1!==e.indexOf("webkit")||(e="-webkit-"+e),n[e]=i+("string"==typeof i?"":"px")}}function C(t,e){var i="";if("string"==typeof t)i=t;else do{var n=_(t,"transform");n&&"none"!==n&&(i=n+" "+i)}while(!e&&(t=t.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(i)}function E(t,e,i){if(t){var n=t.getElementsByTagName(e),o=0,s=n.length;if(i)for(;o<s;o++)i(n[o],o);return n}return[]}function L(){var t=document.scrollingElement;return t||document.documentElement}function A(t,e,i,n,o){if(t.getBoundingClientRect||t===window){var s,l,a,r,u,d,b;if(t!==window&&t.parentNode&&t!==L()?(l=(s=t.getBoundingClientRect()).top,a=s.left,r=s.bottom,u=s.right,d=s.height,b=s.width):(l=0,a=0,r=window.innerHeight,u=window.innerWidth,d=window.innerHeight,b=window.innerWidth),(e||i)&&t!==window&&(o=o||t.parentNode,!c))do{if(o&&o.getBoundingClientRect&&("none"!==_(o,"transform")||i&&"static"!==_(o,"position"))){var h=o.getBoundingClientRect();l-=h.top+parseInt(_(o,"border-top-width")),a-=h.left+parseInt(_(o,"border-left-width")),r=l+s.height,u=a+s.width;break}}while(o=o.parentNode);if(n&&t!==window){var p=C(o||t),g=p&&p.a,m=p&&p.d;p&&(r=(l/=m)+(d/=m),u=(a/=g)+(b/=g))}return{top:l,left:a,bottom:r,right:u,width:b,height:d}}}function q(t,e,i){for(var n=I(t,!0),o=A(t)[e];n;){var s=A(n)[i];if(!("top"===i||"left"===i?o>=s:o<=s))return n;if(n===L())break;n=I(n,!1)}return!1}function T(t,e,i,n){for(var o=0,s=0,l=t.children;s<l.length;){if("none"!==l[s].style.display&&l[s]!==Dt.ghost&&(n||l[s]!==Dt.dragged)&&x(l[s],i.draggable,t,!1)){if(o===e)return l[s];o++}s++}return null}function M(t,e){for(var i=t.lastElementChild;i&&(i===Dt.ghost||"none"===_(i,"display")||e&&!v(i,e));)i=i.previousElementSibling;return i||null}function O(t,e){var i=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||t===Dt.clone||e&&!v(t,e)||i++;return i}function R(t){var e=0,i=0,n=L();if(t)do{var o=C(t),s=o.a,l=o.d;e+=t.scrollLeft*s,i+=t.scrollTop*l}while(t!==n&&(t=t.parentNode));return[e,i]}function I(t,e){if(!t||!t.getBoundingClientRect)return L();var i=t,n=!1;do{if(i.clientWidth<i.scrollWidth||i.clientHeight<i.scrollHeight){var o=_(i);if(i.clientWidth<i.scrollWidth&&("auto"==o.overflowX||"scroll"==o.overflowX)||i.clientHeight<i.scrollHeight&&("auto"==o.overflowY||"scroll"==o.overflowY)){if(!i.getBoundingClientRect||i===document.body)return L();if(n||e)return i;n=!0}}}while(i=i.parentNode);return L()}function z(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}function B(t,e){return function(){if(!w){var i=arguments;1===i.length?t.call(this,i[0]):t.apply(this,i),w=setTimeout((function(){w=void 0}),e)}}}function N(t,e,i){t.scrollLeft+=e,t.scrollTop+=i}function D(t){var e=window.Polymer,i=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):i?i(t).clone(!0)[0]:t.cloneNode(!0)}function P(t,e,i){var n={};return Array.from(t.children).forEach((function(o){var s,l,a,r;if(x(o,e.draggable,t,!1)&&!o.animated&&o!==i){var c=A(o);n.left=Math.min(null!==(s=n.left)&&void 0!==s?s:1/0,c.left),n.top=Math.min(null!==(l=n.top)&&void 0!==l?l:1/0,c.top),n.right=Math.max(null!==(a=n.right)&&void 0!==a?a:-1/0,c.right),n.bottom=Math.max(null!==(r=n.bottom)&&void 0!==r?r:-1/0,c.bottom)}})),n.width=n.right-n.left,n.height=n.bottom-n.top,n.x=n.left,n.y=n.top,n}var $="Sortable"+(new Date).getTime();function H(){var t,e=[];return{captureAnimationState:function(){(e=[],this.options.animation)&&[].slice.call(this.el.children).forEach((function(t){if("none"!==_(t,"display")&&t!==Dt.ghost){e.push({target:t,rect:A(t)});var i=n({},e[e.length-1].rect);if(t.thisAnimationDuration){var o=C(t,!0);o&&(i.top-=o.f,i.left-=o.e)}t.fromRect=i}}))},addAnimationState:function(t){e.push(t)},removeAnimationState:function(t){e.splice(function(t,e){for(var i in t)if(t.hasOwnProperty(i))for(var n in e)if(e.hasOwnProperty(n)&&e[n]===t[i][n])return Number(i);return-1}(e,{target:t}),1)},animateAll:function(i){var n=this;if(!this.options.animation)return clearTimeout(t),void("function"==typeof i&&i());var o=!1,s=0;e.forEach((function(t){var e=0,i=t.target,l=i.fromRect,a=A(i),r=i.prevFromRect,c=i.prevToRect,u=t.rect,d=C(i,!0);d&&(a.top-=d.f,a.left-=d.e),i.toRect=a,i.thisAnimationDuration&&z(r,a)&&!z(l,a)&&(u.top-a.top)/(u.left-a.left)==(l.top-a.top)/(l.left-a.left)&&(e=function(t,e,i,n){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-i.top,2)+Math.pow(e.left-i.left,2))*n.animation}(u,r,c,n.options)),z(a,l)||(i.prevFromRect=l,i.prevToRect=a,e||(e=n.options.animation),n.animate(i,u,a,e)),e&&(o=!0,s=Math.max(s,e),clearTimeout(i.animationResetTimer),i.animationResetTimer=setTimeout((function(){i.animationTime=0,i.prevFromRect=null,i.fromRect=null,i.prevToRect=null,i.thisAnimationDuration=null}),e),i.thisAnimationDuration=e)})),clearTimeout(t),o?t=setTimeout((function(){"function"==typeof i&&i()}),s):"function"==typeof i&&i(),e=[]},animate:function(t,e,i,n){if(n){_(t,"transition",""),_(t,"transform","");var o=C(this.el),s=o&&o.a,l=o&&o.d,a=(e.left-i.left)/(s||1),r=(e.top-i.top)/(l||1);t.animatingX=!!a,t.animatingY=!!r,_(t,"transform","translate3d("+a+"px,"+r+"px,0)"),this.forRepaintDummy=function(t){return t.offsetWidth}(t),_(t,"transition","transform "+n+"ms"+(this.options.easing?" "+this.options.easing:"")),_(t,"transform","translate3d(0,0,0)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout((function(){_(t,"transition",""),_(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1}),n)}}}}var F=[],j={initializeByDefault:!0},U={mount:function(t){for(var e in j)j.hasOwnProperty(e)&&!(e in t)&&(t[e]=j[e]);F.forEach((function(e){if(e.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")})),F.push(t)},pluginEvent:function(t,e,i){var o=this;this.eventCanceled=!1,i.cancel=function(){o.eventCanceled=!0};var s=t+"Global";F.forEach((function(o){e[o.pluginName]&&(e[o.pluginName][s]&&e[o.pluginName][s](n({sortable:e},i)),e.options[o.pluginName]&&e[o.pluginName][t]&&e[o.pluginName][t](n({sortable:e},i)))}))},initializePlugins:function(t,e,i,n){for(var o in F.forEach((function(n){var o=n.pluginName;if(t.options[o]||n.initializeByDefault){var s=new n(t,e,t.options);s.sortable=t,s.options=t.options,t[o]=s,l(i,s.defaults)}})),t.options)if(t.options.hasOwnProperty(o)){var s=this.modifyOption(t,o,t.options[o]);void 0!==s&&(t.options[o]=s)}},getEventProperties:function(t,e){var i={};return F.forEach((function(n){"function"==typeof n.eventProperties&&l(i,n.eventProperties.call(e[n.pluginName],t))})),i},modifyOption:function(t,e,i){var n;return F.forEach((function(o){t[o.pluginName]&&o.optionListeners&&"function"==typeof o.optionListeners[e]&&(n=o.optionListeners[e].call(t[o.pluginName],i))})),n}};var W=["evt"],G=function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.evt,s=a(i,W);U.pluginEvent.bind(Dt)(t,e,n({dragEl:Y,parentEl:X,ghostEl:Z,rootEl:K,nextEl:Q,lastDownEl:J,cloneEl:tt,cloneHidden:et,dragStarted:pt,putSortable:at,activeSortable:Dt.active,originalEvent:o,oldIndex:it,oldDraggableIndex:ot,newIndex:nt,newDraggableIndex:st,hideGhostForTarget:It,unhideGhostForTarget:zt,cloneNowHidden:function(){et=!0},cloneNowShown:function(){et=!1},dispatchSortableEvent:function(t){V({sortable:e,name:t,originalEvent:o})}},s))};function V(t){!function(t){var e=t.sortable,i=t.rootEl,o=t.name,s=t.targetEl,l=t.cloneEl,a=t.toEl,r=t.fromEl,d=t.oldIndex,b=t.newIndex,h=t.oldDraggableIndex,p=t.newDraggableIndex,g=t.originalEvent,m=t.putSortable,f=t.extraEventProperties;if(e=e||i&&i[$]){var v,y=e.options,x="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||c||u?(v=document.createEvent("Event")).initEvent(o,!0,!0):v=new CustomEvent(o,{bubbles:!0,cancelable:!0}),v.to=a||i,v.from=r||i,v.item=s||i,v.clone=l,v.oldIndex=d,v.newIndex=b,v.oldDraggableIndex=h,v.newDraggableIndex=p,v.originalEvent=g,v.pullMode=m?m.lastPutMode:void 0;var w=n(n({},f),U.getEventProperties(o,e));for(var S in w)v[S]=w[S];i&&i.dispatchEvent(v),y[x]&&y[x].call(e,v)}}(n({putSortable:at,cloneEl:tt,targetEl:Y,rootEl:K,oldIndex:it,oldDraggableIndex:ot,newIndex:nt,newDraggableIndex:st},t))}var Y,X,Z,K,Q,J,tt,et,it,nt,ot,st,lt,at,rt,ct,ut,dt,bt,ht,pt,gt,mt,ft,vt,yt=!1,xt=!1,wt=[],St=!1,kt=!1,_t=[],Ct=!1,Et=[],Lt="undefined"!=typeof document,At=h,qt=u||c?"cssFloat":"float",Tt=Lt&&!p&&!h&&"draggable"in document.createElement("div"),Mt=function(){if(Lt){if(c)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),Ot=function(t,e){var i=_(t),n=parseInt(i.width)-parseInt(i.paddingLeft)-parseInt(i.paddingRight)-parseInt(i.borderLeftWidth)-parseInt(i.borderRightWidth),o=T(t,0,e),s=T(t,1,e),l=o&&_(o),a=s&&_(s),r=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+A(o).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+A(s).width;if("flex"===i.display)return"column"===i.flexDirection||"column-reverse"===i.flexDirection?"vertical":"horizontal";if("grid"===i.display)return i.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&l.float&&"none"!==l.float){var u="left"===l.float?"left":"right";return!s||"both"!==a.clear&&a.clear!==u?"horizontal":"vertical"}return o&&("block"===l.display||"flex"===l.display||"table"===l.display||"grid"===l.display||r>=n&&"none"===i[qt]||s&&"none"===i[qt]&&r+c>n)?"vertical":"horizontal"},Rt=function(t){function e(t,i){return function(n,o,s,l){var a=n.options.group.name&&o.options.group.name&&n.options.group.name===o.options.group.name;if(null==t&&(i||a))return!0;if(null==t||!1===t)return!1;if(i&&"clone"===t)return t;if("function"==typeof t)return e(t(n,o,s,l),i)(n,o,s,l);var r=(i?n:o).options.group.name;return!0===t||"string"==typeof t&&t===r||t.join&&t.indexOf(r)>-1}}var i={},n=t.group;n&&"object"==o(n)||(n={name:n}),i.name=n.name,i.checkPull=e(n.pull,!0),i.checkPut=e(n.put),i.revertClone=n.revertClone,t.group=i},It=function(){!Mt&&Z&&_(Z,"display","none")},zt=function(){!Mt&&Z&&_(Z,"display","")};Lt&&!p&&document.addEventListener("click",(function(t){if(xt)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),xt=!1,!1}),!0);var Bt=function(t){if(Y){t=t.touches?t.touches[0]:t;var e=(o=t.clientX,s=t.clientY,wt.some((function(t){var e=t[$].options.emptyInsertThreshold;if(e&&!M(t)){var i=A(t),n=o>=i.left-e&&o<=i.right+e,a=s>=i.top-e&&s<=i.bottom+e;return n&&a?l=t:void 0}})),l);if(e){var i={};for(var n in t)t.hasOwnProperty(n)&&(i[n]=t[n]);i.target=i.rootEl=e,i.preventDefault=void 0,i.stopPropagation=void 0,e[$]._onDragOver(i)}}var o,s,l},Nt=function(t){Y&&Y.parentNode[$]._isOutsideThisEl(t.target)};function Dt(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=l({},e),t[$]=this;var i={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Ot(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Dt.supportPointer&&"PointerEvent"in window&&!b,emptyInsertThreshold:5};for(var n in U.initializePlugins(this,t,i),i)!(n in e)&&(e[n]=i[n]);for(var o in Rt(e),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!e.forceFallback&&Tt,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?m(t,"pointerdown",this._onTapStart):(m(t,"mousedown",this._onTapStart),m(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(m(t,"dragover",this),m(t,"dragenter",this)),wt.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),l(this,H())}function Pt(t,e,i,n,o,s,l,a){var r,d,b=t[$],h=b.options.onMove;return!window.CustomEvent||c||u?(r=document.createEvent("Event")).initEvent("move",!0,!0):r=new CustomEvent("move",{bubbles:!0,cancelable:!0}),r.to=e,r.from=t,r.dragged=i,r.draggedRect=n,r.related=o||e,r.relatedRect=s||A(e),r.willInsertAfter=a,r.originalEvent=l,t.dispatchEvent(r),h&&(d=h.call(b,r,l)),d}function $t(t){t.draggable=!1}function Ht(){Ct=!1}function Ft(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,i=e.length,n=0;i--;)n+=e.charCodeAt(i);return n.toString(36)}function jt(t){return setTimeout(t,0)}function Ut(t){return clearTimeout(t)}Dt.prototype={constructor:Dt,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(gt=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,Y):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,i=this.el,n=this.options,o=n.preventOnFilter,s=t.type,l=t.touches&&t.touches[0]||t.pointerType&&"touch"===t.pointerType&&t,a=(l||t).target,r=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,c=n.filter;if(function(t){Et.length=0;var e=t.getElementsByTagName("input"),i=e.length;for(;i--;){var n=e[i];n.checked&&Et.push(n)}}(i),!Y&&!(/mousedown|pointerdown/.test(s)&&0!==t.button||n.disabled)&&!r.isContentEditable&&(this.nativeDraggable||!b||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=x(a,n.draggable,i,!1))&&a.animated||J===a)){if(it=O(a),ot=O(a,n.draggable),"function"==typeof c){if(c.call(this,t,a,this))return V({sortable:e,rootEl:r,name:"filter",targetEl:a,toEl:i,fromEl:i}),G("filter",e,{evt:t}),void(o&&t.cancelable&&t.preventDefault())}else if(c&&(c=c.split(",").some((function(n){if(n=x(r,n.trim(),i,!1))return V({sortable:e,rootEl:n,name:"filter",targetEl:a,fromEl:i,toEl:i}),G("filter",e,{evt:t}),!0}))))return void(o&&t.cancelable&&t.preventDefault());n.handle&&!x(r,n.handle,i,!1)||this._prepareDragStart(t,l,a)}}},_prepareDragStart:function(t,e,i){var n,o=this,s=o.el,l=o.options,a=s.ownerDocument;if(i&&!Y&&i.parentNode===s){var r=A(i);if(K=s,X=(Y=i).parentNode,Q=Y.nextSibling,J=i,lt=l.group,Dt.dragged=Y,rt={target:Y,clientX:(e||t).clientX,clientY:(e||t).clientY},bt=rt.clientX-r.left,ht=rt.clientY-r.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,Y.style["will-change"]="all",n=function(){G("delayEnded",o,{evt:t}),Dt.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!d&&o.nativeDraggable&&(Y.draggable=!0),o._triggerDragStart(t,e),V({sortable:o,name:"choose",originalEvent:t}),k(Y,l.chosenClass,!0))},l.ignore.split(",").forEach((function(t){E(Y,t.trim(),$t)})),m(a,"dragover",Bt),m(a,"mousemove",Bt),m(a,"touchmove",Bt),m(a,"mouseup",o._onDrop),m(a,"touchend",o._onDrop),m(a,"touchcancel",o._onDrop),d&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Y.draggable=!0),G("delayStart",this,{evt:t}),!l.delay||l.delayOnTouchOnly&&!e||this.nativeDraggable&&(u||c))n();else{if(Dt.eventCanceled)return void this._onDrop();m(a,"mouseup",o._disableDelayedDrag),m(a,"touchend",o._disableDelayedDrag),m(a,"touchcancel",o._disableDelayedDrag),m(a,"mousemove",o._delayedDragTouchMoveHandler),m(a,"touchmove",o._delayedDragTouchMoveHandler),l.supportPointer&&m(a,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(n,l.delay)}}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Y&&$t(Y),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;f(t,"mouseup",this._disableDelayedDrag),f(t,"touchend",this._disableDelayedDrag),f(t,"touchcancel",this._disableDelayedDrag),f(t,"mousemove",this._delayedDragTouchMoveHandler),f(t,"touchmove",this._delayedDragTouchMoveHandler),f(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?m(document,"pointermove",this._onTouchMove):m(document,e?"touchmove":"mousemove",this._onTouchMove):(m(Y,"dragend",this),m(K,"dragstart",this._onDragStart));try{document.selection?jt((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){if(yt=!1,K&&Y){G("dragStarted",this,{evt:e}),this.nativeDraggable&&m(document,"dragover",Nt);var i=this.options;!t&&k(Y,i.dragClass,!1),k(Y,i.ghostClass,!0),Dt.active=this,t&&this._appendGhost(),V({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(ct){this._lastX=ct.clientX,this._lastY=ct.clientY,It();for(var t=document.elementFromPoint(ct.clientX,ct.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(ct.clientX,ct.clientY))!==e;)e=t;if(Y.parentNode[$]._isOutsideThisEl(t),e)do{if(e[$]){if(e[$]._onDragOver({clientX:ct.clientX,clientY:ct.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);zt()}},_onTouchMove:function(t){if(rt){var e=this.options,i=e.fallbackTolerance,n=e.fallbackOffset,o=t.touches?t.touches[0]:t,s=Z&&C(Z,!0),l=Z&&s&&s.a,a=Z&&s&&s.d,r=At&&vt&&R(vt),c=(o.clientX-rt.clientX+n.x)/(l||1)+(r?r[0]-_t[0]:0)/(l||1),u=(o.clientY-rt.clientY+n.y)/(a||1)+(r?r[1]-_t[1]:0)/(a||1);if(!Dt.active&&!yt){if(i&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))<i)return;this._onDragStart(t,!0)}if(Z){s?(s.e+=c-(ut||0),s.f+=u-(dt||0)):s={a:1,b:0,c:0,d:1,e:c,f:u};var d="matrix(".concat(s.a,",").concat(s.b,",").concat(s.c,",").concat(s.d,",").concat(s.e,",").concat(s.f,")");_(Z,"webkitTransform",d),_(Z,"mozTransform",d),_(Z,"msTransform",d),_(Z,"transform",d),ut=c,dt=u,ct=o}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!Z){var t=this.options.fallbackOnBody?document.body:K,e=A(Y,!0,At,!0,t),i=this.options;if(At){for(vt=t;"static"===_(vt,"position")&&"none"===_(vt,"transform")&&vt!==document;)vt=vt.parentNode;vt!==document.body&&vt!==document.documentElement?(vt===document&&(vt=L()),e.top+=vt.scrollTop,e.left+=vt.scrollLeft):vt=L(),_t=R(vt)}k(Z=Y.cloneNode(!0),i.ghostClass,!1),k(Z,i.fallbackClass,!0),k(Z,i.dragClass,!0),_(Z,"transition",""),_(Z,"transform",""),_(Z,"box-sizing","border-box"),_(Z,"margin",0),_(Z,"top",e.top),_(Z,"left",e.left),_(Z,"width",e.width),_(Z,"height",e.height),_(Z,"opacity","0.8"),_(Z,"position",At?"absolute":"fixed"),_(Z,"zIndex","100000"),_(Z,"pointerEvents","none"),Dt.ghost=Z,t.appendChild(Z),_(Z,"transform-origin",bt/parseInt(Z.style.width)*100+"% "+ht/parseInt(Z.style.height)*100+"%")}},_onDragStart:function(t,e){var i=this,n=t.dataTransfer,o=i.options;G("dragStart",this,{evt:t}),Dt.eventCanceled?this._onDrop():(G("setupClone",this),Dt.eventCanceled||((tt=D(Y)).removeAttribute("id"),tt.draggable=!1,tt.style["will-change"]="",this._hideClone(),k(tt,this.options.chosenClass,!1),Dt.clone=tt),i.cloneId=jt((function(){G("clone",i),Dt.eventCanceled||(i.options.removeCloneOnHide||K.insertBefore(tt,Y),i._hideClone(),V({sortable:i,name:"clone"}))})),!e&&k(Y,o.dragClass,!0),e?(xt=!0,i._loopId=setInterval(i._emulateDragOver,50)):(f(document,"mouseup",i._onDrop),f(document,"touchend",i._onDrop),f(document,"touchcancel",i._onDrop),n&&(n.effectAllowed="move",o.setData&&o.setData.call(i,n,Y)),m(document,"drop",i),_(Y,"transform","translateZ(0)")),yt=!0,i._dragStartId=jt(i._dragStarted.bind(i,e,t)),m(document,"selectstart",i),pt=!0,b&&_(document.body,"user-select","none"))},_onDragOver:function(t){var e,i,o,s,l=this.el,a=t.target,r=this.options,c=r.group,u=Dt.active,d=lt===c,b=r.sort,h=at||u,p=this,g=!1;if(!Ct){if(void 0!==t.preventDefault&&t.cancelable&&t.preventDefault(),a=x(a,r.draggable,l,!0),H("dragOver"),Dt.eventCanceled)return g;if(Y.contains(t.target)||a.animated&&a.animatingX&&a.animatingY||p._ignoreWhileAnimating===a)return j(!1);if(xt=!1,u&&!r.disabled&&(d?b||(o=X!==K):at===this||(this.lastPutMode=lt.checkPull(this,u,Y,t))&&c.checkPut(this,u,Y,t))){if(s="vertical"===this._getDirection(t,a),e=A(Y),H("dragOverValid"),Dt.eventCanceled)return g;if(o)return X=K,F(),this._hideClone(),H("revert"),Dt.eventCanceled||(Q?K.insertBefore(Y,Q):K.appendChild(Y)),j(!0);var m=M(l,r.draggable);if(!m||function(t,e,i){var n=A(M(i.el,i.options.draggable)),o=P(i.el,i.options,Z),s=10;return e?t.clientX>o.right+s||t.clientY>n.bottom&&t.clientX>n.left:t.clientY>o.bottom+s||t.clientX>n.right&&t.clientY>n.top}(t,s,this)&&!m.animated){if(m===Y)return j(!1);if(m&&l===t.target&&(a=m),a&&(i=A(a)),!1!==Pt(K,l,Y,e,a,i,t,!!a))return F(),m&&m.nextSibling?l.insertBefore(Y,m.nextSibling):l.appendChild(Y),X=l,U(),j(!0)}else if(m&&function(t,e,i){var n=A(T(i.el,0,i.options,!0)),o=P(i.el,i.options,Z),s=10;return e?t.clientX<o.left-s||t.clientY<n.top&&t.clientX<n.right:t.clientY<o.top-s||t.clientY<n.bottom&&t.clientX<n.left}(t,s,this)){var f=T(l,0,r,!0);if(f===Y)return j(!1);if(i=A(a=f),!1!==Pt(K,l,Y,e,a,i,t,!1))return F(),l.insertBefore(Y,f),X=l,U(),j(!0)}else if(a.parentNode===l){i=A(a);var v,y,w,S=Y.parentNode!==l,C=!function(t,e,i){var n=i?t.left:t.top,o=i?t.right:t.bottom,s=i?t.width:t.height,l=i?e.left:e.top,a=i?e.right:e.bottom,r=i?e.width:e.height;return n===l||o===a||n+s/2===l+r/2}(Y.animated&&Y.toRect||e,a.animated&&a.toRect||i,s),E=s?"top":"left",L=q(a,"top","top")||q(Y,"top","top"),R=L?L.scrollTop:void 0;if(gt!==a&&(y=i[E],St=!1,kt=!C&&r.invertSwap||S),v=function(t,e,i,n,o,s,l,a){var r=n?t.clientY:t.clientX,c=n?i.height:i.width,u=n?i.top:i.left,d=n?i.bottom:i.right,b=!1;if(!l)if(a&&ft<c*o){if(!St&&(1===mt?r>u+c*s/2:r<d-c*s/2)&&(St=!0),St)b=!0;else if(1===mt?r<u+ft:r>d-ft)return-mt}else if(r>u+c*(1-o)/2&&r<d-c*(1-o)/2)return function(t){return O(Y)<O(t)?1:-1}(e);if(b=b||l,b&&(r<u+c*s/2||r>d-c*s/2))return r>u+c/2?1:-1;return 0}(t,a,i,s,C?1:r.swapThreshold,null==r.invertedSwapThreshold?r.swapThreshold:r.invertedSwapThreshold,kt,gt===a),0!==v){var I=O(Y);do{I-=v,w=X.children[I]}while(w&&("none"===_(w,"display")||w===Z))}if(0===v||w===a)return j(!1);gt=a,mt=v;var z=a.nextElementSibling,B=!1,D=Pt(K,l,Y,e,a,i,t,B=1===v);if(!1!==D)return 1!==D&&-1!==D||(B=1===D),Ct=!0,setTimeout(Ht,30),F(),B&&!z?l.appendChild(Y):a.parentNode.insertBefore(Y,B?z:a),L&&N(L,0,R-L.scrollTop),X=Y.parentNode,void 0===y||kt||(ft=Math.abs(y-A(a)[E])),U(),j(!0)}if(l.contains(Y))return j(!1)}return!1}function H(r,c){G(r,p,n({evt:t,isOwner:d,axis:s?"vertical":"horizontal",revert:o,dragRect:e,targetRect:i,canSort:b,fromSortable:h,target:a,completed:j,onMove:function(i,n){return Pt(K,l,Y,e,i,A(i),t,n)},changed:U},c))}function F(){H("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function j(e){return H("dragOverCompleted",{insertion:e}),e&&(d?u._hideClone():u._showClone(p),p!==h&&(k(Y,at?at.options.ghostClass:u.options.ghostClass,!1),k(Y,r.ghostClass,!0)),at!==p&&p!==Dt.active?at=p:p===Dt.active&&at&&(at=null),h===p&&(p._ignoreWhileAnimating=a),p.animateAll((function(){H("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(a===Y&&!Y.animated||a===l&&!a.animated)&&(gt=null),r.dragoverBubble||t.rootEl||a===document||(Y.parentNode[$]._isOutsideThisEl(t.target),!e&&Bt(t)),!r.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),g=!0}function U(){nt=O(Y),st=O(Y,r.draggable),V({sortable:p,name:"change",toEl:l,newIndex:nt,newDraggableIndex:st,originalEvent:t})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){f(document,"mousemove",this._onTouchMove),f(document,"touchmove",this._onTouchMove),f(document,"pointermove",this._onTouchMove),f(document,"dragover",Bt),f(document,"mousemove",Bt),f(document,"touchmove",Bt)},_offUpEvents:function(){var t=this.el.ownerDocument;f(t,"mouseup",this._onDrop),f(t,"touchend",this._onDrop),f(t,"pointerup",this._onDrop),f(t,"touchcancel",this._onDrop),f(document,"selectstart",this)},_onDrop:function(t){var e=this.el,i=this.options;nt=O(Y),st=O(Y,i.draggable),G("drop",this,{evt:t}),X=Y&&Y.parentNode,nt=O(Y),st=O(Y,i.draggable),Dt.eventCanceled||(yt=!1,kt=!1,St=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Ut(this.cloneId),Ut(this._dragStartId),this.nativeDraggable&&(f(document,"drop",this),f(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),b&&_(document.body,"user-select",""),_(Y,"transform",""),t&&(pt&&(t.cancelable&&t.preventDefault(),!i.dropBubble&&t.stopPropagation()),Z&&Z.parentNode&&Z.parentNode.removeChild(Z),(K===X||at&&"clone"!==at.lastPutMode)&&tt&&tt.parentNode&&tt.parentNode.removeChild(tt),Y&&(this.nativeDraggable&&f(Y,"dragend",this),$t(Y),Y.style["will-change"]="",pt&&!yt&&k(Y,at?at.options.ghostClass:this.options.ghostClass,!1),k(Y,this.options.chosenClass,!1),V({sortable:this,name:"unchoose",toEl:X,newIndex:null,newDraggableIndex:null,originalEvent:t}),K!==X?(nt>=0&&(V({rootEl:X,name:"add",toEl:X,fromEl:K,originalEvent:t}),V({sortable:this,name:"remove",toEl:X,originalEvent:t}),V({rootEl:X,name:"sort",toEl:X,fromEl:K,originalEvent:t}),V({sortable:this,name:"sort",toEl:X,originalEvent:t})),at&&at.save()):nt!==it&&nt>=0&&(V({sortable:this,name:"update",toEl:X,originalEvent:t}),V({sortable:this,name:"sort",toEl:X,originalEvent:t})),Dt.active&&(null!=nt&&-1!==nt||(nt=it,st=ot),V({sortable:this,name:"end",toEl:X,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){G("nulling",this),K=Y=X=Z=Q=tt=J=et=rt=ct=pt=nt=st=it=ot=gt=mt=at=lt=Dt.dragged=Dt.ghost=Dt.clone=Dt.active=null,Et.forEach((function(t){t.checked=!0})),Et.length=ut=dt=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":Y&&(this._onDragOver(t),function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move");t.cancelable&&t.preventDefault()}(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t,e=[],i=this.el.children,n=0,o=i.length,s=this.options;n<o;n++)x(t=i[n],s.draggable,this.el,!1)&&e.push(t.getAttribute(s.dataIdAttr)||Ft(t));return e},sort:function(t,e){var i={},n=this.el;this.toArray().forEach((function(t,e){var o=n.children[e];x(o,this.options.draggable,n,!1)&&(i[t]=o)}),this),e&&this.captureAnimationState(),t.forEach((function(t){i[t]&&(n.removeChild(i[t]),n.appendChild(i[t]))})),e&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return x(t,e||this.options.draggable,this.el,!1)},option:function(t,e){var i=this.options;if(void 0===e)return i[t];var n=U.modifyOption(this,t,e);i[t]=void 0!==n?n:e,"group"===t&&Rt(i)},destroy:function(){G("destroy",this);var t=this.el;t[$]=null,f(t,"mousedown",this._onTapStart),f(t,"touchstart",this._onTapStart),f(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(f(t,"dragover",this),f(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),(function(t){t.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),wt.splice(wt.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!et){if(G("hideClone",this),Dt.eventCanceled)return;_(tt,"display","none"),this.options.removeCloneOnHide&&tt.parentNode&&tt.parentNode.removeChild(tt),et=!0}},_showClone:function(t){if("clone"===t.lastPutMode){if(et){if(G("showClone",this),Dt.eventCanceled)return;Y.parentNode!=K||this.options.group.revertClone?Q?K.insertBefore(tt,Q):K.appendChild(tt):K.insertBefore(tt,Y),this.options.group.revertClone&&this.animate(Y,tt),_(tt,"display",""),et=!1}}else this._hideClone()}},Lt&&m(document,"touchmove",(function(t){(Dt.active||yt)&&t.cancelable&&t.preventDefault()})),Dt.utils={on:m,off:f,css:_,find:E,is:function(t,e){return!!x(t,e,t,!1)},extend:function(t,e){if(t&&e)for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t},throttle:B,closest:x,toggleClass:k,clone:D,index:O,nextTick:jt,cancelNextTick:Ut,detectDirection:Ot,getChild:T},Dt.get=function(t){return t[$]},Dt.mount=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];e[0].constructor===Array&&(e=e[0]),e.forEach((function(t){if(!t.prototype||!t.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(t));t.utils&&(Dt.utils=n(n({},Dt.utils),t.utils)),U.mount(t)}))},Dt.create=function(t,e){return new Dt(t,e)},Dt.version="1.15.2";var Wt,Gt,Vt,Yt,Xt,Zt,Kt=[],Qt=!1;function Jt(){Kt.forEach((function(t){clearInterval(t.pid)})),Kt=[]}function te(){clearInterval(Zt)}var ee=B((function(t,e,i,n){if(e.scroll){var o,s=(t.touches?t.touches[0]:t).clientX,l=(t.touches?t.touches[0]:t).clientY,a=e.scrollSensitivity,r=e.scrollSpeed,c=L(),u=!1;Gt!==i&&(Gt=i,Jt(),Wt=e.scroll,o=e.scrollFn,!0===Wt&&(Wt=I(i,!0)));var d=0,b=Wt;do{var h=b,p=A(h),g=p.top,m=p.bottom,f=p.left,v=p.right,y=p.width,x=p.height,w=void 0,S=void 0,k=h.scrollWidth,C=h.scrollHeight,E=_(h),q=h.scrollLeft,T=h.scrollTop;h===c?(w=y<k&&("auto"===E.overflowX||"scroll"===E.overflowX||"visible"===E.overflowX),S=x<C&&("auto"===E.overflowY||"scroll"===E.overflowY||"visible"===E.overflowY)):(w=y<k&&("auto"===E.overflowX||"scroll"===E.overflowX),S=x<C&&("auto"===E.overflowY||"scroll"===E.overflowY));var M=w&&(Math.abs(v-s)<=a&&q+y<k)-(Math.abs(f-s)<=a&&!!q),O=S&&(Math.abs(m-l)<=a&&T+x<C)-(Math.abs(g-l)<=a&&!!T);if(!Kt[d])for(var R=0;R<=d;R++)Kt[R]||(Kt[R]={});Kt[d].vx==M&&Kt[d].vy==O&&Kt[d].el===h||(Kt[d].el=h,Kt[d].vx=M,Kt[d].vy=O,clearInterval(Kt[d].pid),0==M&&0==O||(u=!0,Kt[d].pid=setInterval(function(){n&&0===this.layer&&Dt.active._onTouchMove(Xt);var e=Kt[this.layer].vy?Kt[this.layer].vy*r:0,i=Kt[this.layer].vx?Kt[this.layer].vx*r:0;"function"==typeof o&&"continue"!==o.call(Dt.dragged.parentNode[$],i,e,t,Xt,Kt[this.layer].el)||N(Kt[this.layer].el,i,e)}.bind({layer:d}),24))),d++}while(e.bubbleScroll&&b!==c&&(b=I(b,!1)));Qt=u}}),30),ie=function(t){var e=t.originalEvent,i=t.putSortable,n=t.dragEl,o=t.activeSortable,s=t.dispatchSortableEvent,l=t.hideGhostForTarget,a=t.unhideGhostForTarget;if(e){var r=i||o;l();var c=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,u=document.elementFromPoint(c.clientX,c.clientY);a(),r&&!r.el.contains(u)&&(s("spill"),this.onSpill({dragEl:n,putSortable:i}))}};function ne(){}function oe(){}ne.prototype={startIndex:null,dragStart:function(t){var e=t.oldDraggableIndex;this.startIndex=e},onSpill:function(t){var e=t.dragEl,i=t.putSortable;this.sortable.captureAnimationState(),i&&i.captureAnimationState();var n=T(this.sortable.el,this.startIndex,this.options);n?this.sortable.el.insertBefore(e,n):this.sortable.el.appendChild(e),this.sortable.animateAll(),i&&i.animateAll()},drop:ie},l(ne,{pluginName:"revertOnSpill"}),oe.prototype={onSpill:function(t){var e=t.dragEl,i=t.putSortable||this.sortable;i.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),i.animateAll()},drop:ie},l(oe,{pluginName:"removeOnSpill"}),Dt.mount(new function(){function t(){for(var t in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===t.charAt(0)&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}return t.prototype={dragStarted:function(t){var e=t.originalEvent;this.sortable.nativeDraggable?m(document,"dragover",this._handleAutoScroll):this.options.supportPointer?m(document,"pointermove",this._handleFallbackAutoScroll):e.touches?m(document,"touchmove",this._handleFallbackAutoScroll):m(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var e=t.originalEvent;this.options.dragOverBubble||e.rootEl||this._handleAutoScroll(e)},drop:function(){this.sortable.nativeDraggable?f(document,"dragover",this._handleAutoScroll):(f(document,"pointermove",this._handleFallbackAutoScroll),f(document,"touchmove",this._handleFallbackAutoScroll),f(document,"mousemove",this._handleFallbackAutoScroll)),te(),Jt(),clearTimeout(w),w=void 0},nulling:function(){Xt=Gt=Wt=Qt=Zt=Vt=Yt=null,Kt.length=0},_handleFallbackAutoScroll:function(t){this._handleAutoScroll(t,!0)},_handleAutoScroll:function(t,e){var i=this,n=(t.touches?t.touches[0]:t).clientX,o=(t.touches?t.touches[0]:t).clientY,s=document.elementFromPoint(n,o);if(Xt=t,e||this.options.forceAutoScrollFallback||u||c||b){ee(t,this.options,s,e);var l=I(s,!0);!Qt||Zt&&n===Vt&&o===Yt||(Zt&&te(),Zt=setInterval((function(){var s=I(document.elementFromPoint(n,o),!0);s!==l&&(l=s,Jt()),ee(t,i.options,s,e)}),10),Vt=n,Yt=o)}else{if(!this.options.bubbleScroll||I(s,!0)===L())return void Jt();ee(t,this.options,I(s,!1),!1)}}},l(t,{pluginName:"scroll",initializeByDefault:!0})}),Dt.mount(oe,ne);class se{constructor(t){this.builder=t,this.dom=this.builder.dom}cellSelected(){return this.builder.doc.querySelector(".cell-active")}rowSelected(){return this.builder.doc.querySelector(".row-active")}builderStuff(){return document.querySelector("#_cbhtml")}cellNext(t){const e=this.dom;let i=t.nextElementSibling;return i?e.hasClass(i,"is-row-tool")||e.hasClass(i,"is-col-tool")||e.hasClass(i,"is-rowadd-tool")||e.hasClass(i,"is-row-overlay")?null:i:null}out(t){if(this.builder){let e=this.builder.opts.lang[t];return e||(this.builder.checkLang&&console.log(t),t)}return t}loadLightboxFromCdn(t){const e="https://cdnjs.cloudflare.com/ajax/libs/glightbox/3.2.0/js/glightbox.min.js";if(this.isJsOnContentIncluded(e))this.builder.doc.querySelector("#_skin")||this.builder.doc.body.insertAdjacentHTML("beforeend",`<style>${this.getLightboxCss()}</style>`),t&&t();else{const i=this.builder.doc.createElement("script");i.src=e,i.async=!0,i.onload=()=>{this.loadCssOnContent("https://cdnjs.cloudflare.com/ajax/libs/glightbox/3.2.0/css/glightbox.min.css"),this.builder.doc.body.insertAdjacentHTML("beforeend",`<style id="_skin">${this.getLightboxCss()}</style>`),t&&t()},this.builder.doc.body.appendChild(i)}}loadLightboxScript(t){const e=this.builder.assetPath+"scripts/glightbox/glightbox.min.js";if(this.isJsOnContentIncluded(e))t&&t();else{const i=this.builder.doc.createElement("script");i.src=e,i.async=!0,i.onload=()=>{this.builder.GLightbox?(this.loadCssOnContent(this.builder.assetPath+"scripts/glightbox/glightbox.min.css"),this.loadCssOnContent(this.builder.assetPath+"scripts/glightbox/skin.css"),t&&t()):this.loadLightboxFromCdn(t)},this.builder.doc.body.appendChild(i),i.onerror=()=>{this.loadLightboxFromCdn(t)}}}refreshLightbox(t,e){this.builder.glightbox&&this.builder.GLightbox?(this.builder.glightbox.destroy(),this.builder.glightbox=this.builder.GLightbox(t),e&&e()):this.loadLightboxScript((()=>{this.builder.GLightbox=this.builder.win.GLightbox,this.builder.glightbox=this.builder.win.GLightbox(t),e&&e()}))}openLightbox(t,e){const i=this.builder.openMediaElm;if(this.builder.glightbox){if(this.builder.doc.body.classList.contains("glightbox-open")){this.builder.glightbox.close();let i=this.builder.doc.querySelector(".goverlay");return i&&i.click(),void setTimeout((()=>{this.openLightbox(t,e)}),400)}let n=[],o=0;if(i){const e=i.closest("[data-gallery]");let s=[];if(e)s=e.querySelectorAll(".is-lightbox"),s.forEach(((e,i)=>{let s=e.getAttribute("href");n.push({href:s}),t===s&&(o=i)}));else{this.builder.doc.querySelectorAll(".is-lightbox,.block-click").forEach((t=>{t.closest("[data-gallery]")||t.classList.contains("lightbox-all")||s.push(t)})),s.forEach(((e,i)=>{let s=e.getAttribute("href");s||(s=e.getAttribute("data-modal-url")),n.push({href:s}),t===s&&(o=i)}))}}n.length>0?(this.builder.glightbox.setElements(n),this.builder.glightbox.openAt(o)):(this.builder.glightbox.setElements([{href:t}]),this.builder.glightbox.open()),this.builder.glightbox.on("close",(()=>{this.builder.glightbox.setElements([]),this.refreshLightbox(e)}))}this.builder.openMediaElm=null}isJsOnContentIncluded(t){const e=this.builder.doc.getElementsByTagName("script");for(let i=0;i<e.length;i++)if(e[i].getAttribute("src")===t)return!0;return!1}loadCssOnContent(t){const e=this.builder.doc.createElement("link");e.href=t,e.rel="stylesheet",this.builder.doc.head.appendChild(e)}showMessage(t,e,i){const n=this.dom;let o="";o=`<div class="is-modal modalmessage" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">\n <div class="is-modal-content" style="padding-top: 15px;padding-bottom: 20px;max-width: 450px;">\n <div style="margin: 20px 0 30px;font-size: 17px;">${t}</div>\n <button title="${this.out("Ok")}" class="input-ok classic">${this.out("Ok")}</button>\n </div>\n </div>`;const s=this.builder.builderStuff;let l=s.querySelector(".modalmessage");l||(n.appendHtml(s,o),l=s.querySelector(".modalmessage")),this.showModal(l,!1,(()=>{l.parentNode.removeChild(l),i&&i()}));let a=l.querySelector(".modalmessage .input-ok");n.addEventListener(a,"click",(()=>{this.hideModal(l),l.parentNode&&l.parentNode.removeChild(l),i&&i()})),a.focus(),e&&a.classList.add("focus-outline")}showChoice(t,e,i){const n=this.dom;let o="";o=`<div class="is-modal modalmessage" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">\n <div class="is-modal-content" style="padding-top: 15px;padding-bottom: 20px;max-width: 450px;">\n <div style="margin: 20px 0 30px;font-size: 17px;">${t}</div>\n\n <div style="display:flex;">\n <button title="${this.out("Cancel")}" class="input-cancel classic-secondary" style="width:100%;margin-right:4px;">${this.out("Cancel")}</button>\n <button title="${e}" class="input-ok classic-primary" style="width:100%">${e}</button>\n </div>\n </div>\n </div>`;const s=this.builder.builderStuff;let l=s.querySelector(".modalmessage");l||(n.appendHtml(s,o),l=s.querySelector(".modalmessage")),this.showModal(l,!1,(()=>{l.parentNode.removeChild(l),i(!1)}));let a=l.querySelector(".modalmessage .input-cancel");n.addEventListener(a,"click",(()=>{this.hideModal(l),l.parentNode.removeChild(l),i(!1)})),a.focus();let r=l.querySelector(".modalmessage .input-ok");n.addEventListener(r,"click",(()=>{this.hideModal(l),l.parentNode.removeChild(l),i(!0)}))}confirm(t,e,i,n,o){if(!this.builder.deleteConfirm&&!o)return void e(!0);const s=this.dom;let l="";l=`<div class="is-modal is-confirm" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">\n <div class="is-modal-content" style="padding-bottom:20px;">\n <div style="margin: 20px 0 30px;font-size: 14px;">${t}</div>\n <button title="${this.out("Delete")}" class="input-ok classic focus-warning">${this.out("Delete")}</button>\n </div>\n </div>`,i&&(l=`<div class="is-modal is-confirm" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">\n <div class="is-modal-content" style="padding-bottom:20px;">\n <div style="margin: 20px 0 30px;font-size: 14px;">${t}</div>\n <button title="${this.out("Cancel")}" class="input-cancel classic-secondary">${this.out("Cancel")}</button>\n <button title="${n}" class="input-ok classic-primary">${n}</button>\n </div>\n </div>`);const a=this.builder.builderStuff;let r=a.querySelector(".is-confirm");r||(s.appendHtml(a,l),r=a.querySelector(".is-confirm")),this.showModal(r,!1,(()=>{r.parentNode.removeChild(r),e(!1)}),!0);let c=r.querySelector(".is-confirm .input-ok");s.addEventListener(c,"click",(()=>{this.hideModal(r),r.parentNode.removeChild(r),e(!0)}));let u=r.querySelector(".is-confirm .input-cancel");s.addEventListener(u,"click",(t=>{this.hideModal(r),r.parentNode.removeChild(r),e(!1),t.preventDefault(),t.stopImmediatePropagation()})),c&&c.focus()}showRtePop(t,e,i){const n=this.dom;t.style.display="flex",e&&e(),n.removeClass(t,"deactive"),n.addClass(t,"active");const o=e=>{t.contains(e.target)||i.contains(e.target)||e.target.closest(".pickcolormore")||(this.hideRtePop(t),t.removeEventListener("keydown",s),document.removeEventListener("mousedown",o),document.removeEventListener("touchstart",o),this.builder.iframeDocument&&(this.builder.doc.removeEventListener("mousedown",o),this.builder.doc.removeEventListener("touchstart",o)))},s=e=>{27===e.keyCode&&(this.hideRtePop(t),t.removeEventListener("keydown",s),document.removeEventListener("mousedown",o),document.removeEventListener("touchstart",o),this.builder.iframeDocument&&(this.builder.doc.removeEventListener("mousedown",o),this.builder.doc.removeEventListener("touchstart",o)))};t.addEventListener("keydown",s),document.addEventListener("mousedown",o),document.addEventListener("touchstart",o,{passive:!1}),this.builder.iframeDocument&&(this.builder.doc.addEventListener("mousedown",o),this.builder.doc.addEventListener("touchstart",o,{passive:!1}))}hideRtePop(t){const e=this.dom;t.style.display="",e.removeClass(t,"active"),e.addClass(t,"deactive")}showPopOverlay(t,e,i){const n=this.builder.builderStuff;let o=n.querySelectorAll(".is-pop-overlay");const s=this.makeId(),l=`<div class="is-pop-overlay ${s}" style="display:flex;z-index:10004"></div>`;n.insertAdjacentHTML("beforeend",l);const a=n.querySelector(`.is-pop-overlay.${s}`);0===o.length&&(t.classList.add("pop1"),a.classList.add("pop1")),1===o.length&&(t.classList.add("pop2"),a.classList.add("pop2")),2===o.length&&(t.classList.add("pop3"),a.classList.add("pop3")),4===o.length&&(t.classList.add("pop4"),a.classList.add("pop4"));const r=()=>{a.remove(),t.style.display="",t.classList.remove("active"),t.setAttribute("aria-hidden",!0),a.classList.remove("pop1"),a.classList.remove("pop2"),a.classList.remove("pop3"),a.classList.remove("pop4"),t.classList.remove("pop1"),t.classList.remove("pop2"),t.classList.remove("pop3"),t.classList.remove("pop4"),t.removeEventListener("keydown",c),e&&e(),i&&i.focus()};this.hidePopOverlay=r;const c=t=>{27===t.keyCode&&r()};a.addEventListener("click",(t=>{r(),t.preventDefault(),t.stopImmediatePropagation()})),t.style.display="flex",t.classList.add("active"),t.setAttribute("aria-hidden",!1),this.setupTabKeys(t),t.focus({preventScroll:!0}),t.addEventListener("keydown",c)}showPop(t,e,i,n){const o=this.dom;document.querySelectorAll(".is-pop.active").forEach((e=>{let n=!0;e.contains(i)&&(n=!1),e!==t&&n&&(e.style.display="",o.removeClass(e,"active"),e.setAttribute("aria-hidden",!0))})),n?this.showPopOverlay(t,e,i):(this.clearAllEventListener(t),t.style.display="flex",o.addClass(t,"active"),t.setAttribute("aria-hidden",!1),this.setupTabKeys(t),t.focus({preventScroll:!0}),this.handlePopClickOut=n=>{t.contains(n.target)||i.contains(n.target)||(this.hidePop(t),e&&e(),i&&i.focus())},this.handlePopKeyDown=n=>{27===n.keyCode&&(this.hidePop(t),e&&e(),i&&i.focus())},t.addEventListener("keydown",this.handlePopKeyDown),document.addEventListener("mousedown",this.handlePopClickOut),document.addEventListener("touchstart",this.handlePopClickOut,{passive:!1}),this.builder.iframeDocument&&(this.builder.doc.addEventListener("mousedown",this.handlePopClickOut),this.builder.doc.addEventListener("touchstart",this.handlePopClickOut,{passive:!1})))}hidePop(t){const e=this.dom;t.style.display="",e.removeClass(t,"active"),t.setAttribute("aria-hidden",!0),this.clearAllEventListener(t)}clearAllEventListener(t){for(let e=0;e<10;e++)t.removeEventListener("keydown",this.handlePopKeyDown),document.removeEventListener("mousedown",this.handlePopClickOut),document.removeEventListener("touchstart",this.handlePopClickOut,{passive:!1}),this.builder.iframeDocument&&(this.builder.doc.removeEventListener("mousedown",this.handlePopClickOut),this.builder.doc.removeEventListener("touchstart",this.handlePopClickOut,{passive:!1}))}setupTabKeys(t){let e=t.querySelectorAll('a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]):not([tabindex="-1"]), iframe, object, embed, *[tabindex]:not([tabindex="-1"])');if(0===e.length)return;let i=e[0],n=e[e.length-1];n.addEventListener("keydown",(n=>{9!==n.which||n.shiftKey||(n.preventDefault(),e=t.querySelectorAll('a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]):not([tabindex="-1"]), iframe, object, embed, *[tabindex]:not([tabindex="-1"])'),i=e[0],i.focus())})),i.addEventListener("keydown",(t=>{9===t.which&&t.shiftKey&&(t.preventDefault(),n.focus())}));t.querySelectorAll("iframe").forEach((t=>{t.addEventListener("focus",(()=>{const e=t.contentWindow.document.querySelectorAll('a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]):not([tabindex="-1"]), iframe, object, embed, *[tabindex]:not([tabindex="-1"])');if(0===e.length)return;let i=e[0];i&&i.focus()}))}))}showModal(t,e,i,n,o){const s=this.dom;s.addClass(t,"active"),t.setAttribute("aria-hidden",!1),o&&(document.body.style.overflow="hidden");const l=e=>{if(27===e.keyCode){o&&(document.body.style.overflow=""),s.hasClass(t,"active")&&this.hideModal(t),t.removeEventListener("keydown",l);const e=t.querySelector(".is-modal-close");e&&e.removeEventListener("click",u),i&&i()}};t.addEventListener("keydown",l);let a=t.querySelector(".is-tab-content.active");a?(a.focus(),this.builder.tabs.setupTabKey(a)):(this.setupTabKeys(t),t.focus());let r=!1;if(this.builder?this.builder.opts.animateModal&&(r=!0,n||(r=!1)):n&&(r=!0),r&&this.builder){const t=this.builder.doc.querySelectorAll(this.builder.opts.container);Array.prototype.forEach.call(t,(t=>{t.style.transform=`scale(${this.builder.opts.zoom-.02})`,t.style.WebkitTransform=`scale(${this.builder.opts.zoom-.02})`,t.style.MozTransform=`scale(${this.builder.opts.zoom-.02})`,t.setAttribute("scaled-down","1")}))}const c=t.querySelector(".is-modal-overlay");if(c&&c.parentNode.removeChild(c),!t.querySelector(".is-modal-overlay")){let n;if(n=e?'<div class="is-modal-overlay overlay-stay"></div>':'<div class="is-modal-overlay"></div>',t.insertAdjacentHTML("afterbegin",n),!e){let e=t.querySelector(".is-modal-overlay");s.addEventListener(e,"click",(()=>{o&&(document.body.style.overflow=""),this.hideModal(t),t.removeEventListener("keydown",l);const e=t.querySelector(".is-modal-close");e&&e.removeEventListener("click",u),i&&i()}))}}const u=()=>{o&&(document.body.style.overflow=""),s.hasClass(t,"active")&&this.hideModal(t),t.removeEventListener("keydown",l);const e=t.querySelector(".is-modal-close");e&&e.removeEventListener("click",u),i&&i()},d=t.querySelector(".is-modal-close");d&&s.addEventListener(d,"click",u)}_hideModal(t){let e=t.querySelector(".is-modal-overlay");e?e.classList.contains("overlay-stay")?(this.hideModal(t),t.dispatchEvent(new KeyboardEvent("keydown",{key:"e",keyCode:27,code:"KeyE",which:27,shiftKey:!1,ctrlKey:!1,metaKey:!1}))):e.click():(this.hideModal(t),t.dispatchEvent(new KeyboardEvent("keydown",{key:"e",keyCode:27,code:"KeyE",which:27,shiftKey:!1,ctrlKey:!1,metaKey:!1})))}hideModal(t){if(t.setAttribute("aria-hidden",!0),this.builder){const t=this.builder.doc.querySelectorAll(this.builder.opts.container);Array.prototype.forEach.call(t,(t=>{t.getAttribute("scaled-down")&&(t.style.transform=`scale(${this.builder.opts.zoom})`,t.style.WebkitTransform=`scale(${this.builder.opts.zoom})`,t.style.MozTransform=`scale(${this.builder.opts.zoom})`,t.removeAttribute("scaled-down"))}))}this.dom.removeClass(t,"active"),t.style.display=""}refreshModuleLayout(t){let e;t.style.height?e=t.style.height:t.style.height=`${t.offsetHeight}px`,t.style.opacity=0;let i=decodeURIComponent(t.getAttribute("data-html"));i=i.replace(/{id}/g,this.builder.util.makeId()),t.innerHTML="";let n=document.createRange();n.setStart(t,0),t.appendChild(n.createContextualFragment(i));let o=t.querySelectorAll("[data-subblock]");var s=1;Array.prototype.forEach.call(o,(e=>{t.getAttribute("data-html-"+s)&&(e.innerHTML=decodeURIComponent(t.getAttribute("data-html-"+s)),e.contentEditable=!0),s++})),setTimeout((()=>{t.style.height=e||"",t.style.opacity=""}),100)}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=[];const i=this.dom;return i.elementChildren(t).forEach((t=>{i.hasClass(t,"is-row-tool")||i.hasClass(t,"is-col-tool")||i.hasClass(t,"is-rowadd-tool")||i.hasClass(t,"is-row-overlay")||e.push(t)})),e}fixLayout(t){const e=this.dom;let i=!1,n=!1;if(Array.from(t.children).map((e=>{e.classList.contains("is-row-tool")||e.classList.contains("is-col-tool")||e.classList.contains("is-rowadd-tool")||(e.getAttribute("data-html")?(e.style.width||(e.style.width="50%",e.style.flex="0 0 auto"),1===this.getAllColumns(t).length&&(e.style.width="",e.style.flex="")):(e.style.width="",e.style.flex=""),e.classList.contains("sm-hidden")&&(i=!0),e.classList.contains("md-hidden")&&(n=!0))})),i?t.classList.add("sm-autofit"):t.classList.remove("sm-autofit"),n?t.classList.add("md-autofit"):t.classList.remove("md-autofit"),this.builder.useDefaultGrid){return e.elementChildren(t).forEach((t=>{e.hasClass(t,"is-row-tool")||e.hasClass(t,"is-col-tool")||e.hasClass(t,"is-rowadd-tool")||e.hasClass(t,"is-row-overlay")||this.removeColClasses(t)})),void Array.from(t.children).map((t=>{t.classList.contains("is-row-tool")||t.classList.contains("is-rowadd-tool")||t.classList.contains("is-col-tool")||t.getAttribute("data-module")&&this.refreshModuleLayout(t)}))}let o=3;t.querySelector(".is-row-overlay")&&(o=4);const s=t.childElementCount-o,l=this.builder.opts.row;let a=this.builder.opts.cols;const r=this.builder.opts.colequal;if(r.length>0){return e.elementChildren(t).forEach((t=>{if(!(e.hasClass(t,"is-row-tool")||e.hasClass(t,"is-col-tool")||e.hasClass(t,"is-rowadd-tool")||e.hasClass(t,"is-row-overlay"))){for(let i=0;i<=a.length-1;i++)e.removeClass(t,a[i]);for(let i=0;i<=r.length-1;i++)if(r[i].length===s){e.addClass(t,r[i][0]);break}1===s&&e.addClass(t,a[a.length-1])}})),void Array.from(t.children).map((t=>{t.classList.contains("is-row-tool")||t.classList.contains("is-rowadd-tool")||t.classList.contains("is-col-tool")||t.getAttribute("data-module")&&this.refreshModuleLayout(t)}))}if(""!==l&&a.length>0){let i=0;e.elementChildren(t).forEach((t=>{if(!(e.hasClass(t,"is-row-tool")||e.hasClass(t,"is-col-tool")||e.hasClass(t,"is-rowadd-tool")||e.hasClass(t,"is-row-overlay"))){-1!==t.className.indexOf("col-md-")||(-1!==t.className.indexOf("col-sm-")?a=["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!==t.className.indexOf("col-xs-")?a=["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!==t.className.indexOf("col-lg-")?a=["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!==t.className.indexOf("col-xl-")?a=["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!==t.className.indexOf("col-xxl-")&&(a=["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++;for(var n=0;n<=a.length-1;n++)e.removeClass(t,a[n]);1===s&&e.addClass(t,a[11]),2===s&&e.addClass(t,a[5]),3===s&&e.addClass(t,a[3]),4===s&&e.addClass(t,a[2]),5===s&&(5===i?e.addClass(t,a[3]):e.addClass(t,a[1])),6===s&&e.addClass(t,a[1]),7===s&&(i>=6?e.addClass(t,a[0]):e.addClass(t,a[1])),8===s&&(i>=5?e.addClass(t,a[0]):e.addClass(t,a[1])),9===s&&(i>=4?e.addClass(t,a[0]):e.addClass(t,a[1])),10===s&&(i>=3?e.addClass(t,a[0]):e.addClass(t,a[1])),11===s&&(i>=2?e.addClass(t,a[0]):e.addClass(t,a[1])),12===s&&e.addClass(t,a[0])}}))}Array.from(t.children).map((t=>{t.classList.contains("is-row-tool")||t.classList.contains("is-rowadd-tool")||t.classList.contains("is-col-tool")||t.getAttribute("data-module")&&this.refreshModuleLayout(t)}))}addContent(t,e,i){const n=this.dom;this.builder.opts.onAdd&&(t=this.builder.opts.onAdd(t));const o=this.cellSelected();let s;if(o)s=o.parentNode;else{let t=this.builder.activeElement;if(t&&t.closest(".is-block"));else{if(s=this.builder.doc.querySelector(".row-active"),!s)return;e="row"}}if("cell"===e||"cell-left"===e||"cell-right"===e){let l=4;this.builder.maxColumns&&(l=this.builder.maxColumns);let a,r=3;if(s.querySelector(".is-row-overlay")&&(r=4),s.childElementCount>=l+r)return alert(this.out("You have reached the maximum number of columns")),!1;if(this.builder.uo.saveForUndo(),""===this.builder.opts.row){let e=this.builder.opts.cellFormat,i=e.indexOf("</");t=e.substring(0,i)+t+e.substring(i),a=this.createElementFromHTML(t)}else{a=o.cloneNode(!0),a.removeAttribute("data-noedit"),a.removeAttribute("data-protected"),a.removeAttribute("data-module"),a.removeAttribute("data-module-desc"),a.removeAttribute("data-dialog-width"),a.removeAttribute("data-html"),a.removeAttribute("data-settings");for(let t=1;t<=20;t++)a.removeAttribute("data-html-"+t);a.removeAttribute("data-noedit"),n.removeClass(a,"cell-active"),n.removeClass(a,"is-light-text"),n.removeClass(a,"is-dark-text"),n.removeClass(a,"padding-0"),n.removeClass(a,"p-0"),a.removeAttribute("data-click"),a.removeAttribute("style"),i&&a.setAttribute(i,""),a.innerHTML=t}s.insertBefore(a,o),"cell"!==e&&"cell-right"!==e||n.moveAfter(a,o);let c=this.builder.doc.querySelector(".builder-active");c&&this.builder.applyBehaviorOn(c),this.fixLayout(s),a.click()}if("row"===e){let e,o;if(this.builder.uo.saveForUndo(),""===this.builder.opts.row){e=this.htmlToElement(this.builder.opts.rowFormat);let s=this.builder.opts.cellFormat,l=s.indexOf("</");t=s.substring(0,l)+t+s.substring(l);let a=n.elementChildren(e);for(;a.length>0&&(a=a[0],n.elementChildren(a).length>0);)a=n.elementChildren(a);a.innerHTML=t,o=a.firstChild,i&&o.setAttribute(i,"")}else o=n.createElement("div"),n.addClass(o,this.builder.opts.cols[this.builder.opts.cols.length-1]),o.innerHTML=t,i&&o.setAttribute(i,""),e=n.createElement("div"),n.addClass(e,this.builder.opts.row),n.appendChild(e,o);s.parentNode.insertBefore(e,s),n.moveAfter(e,s);let l=this.builder.doc.querySelector(".builder-active");l&&this.builder.applyBehaviorOn(l),o.click()}if("elm"===e){let e=this.builder.activeElement;if(!e)return;this.builder.uo.saveForUndo();let i,o=e;if(o.nextElementSibling||o.closest("[data-subblock]"))o.insertAdjacentHTML("afterend",t),i=o.nextElementSibling;else{let e,s=this.builder.activeCol;n.elementChildren(s).forEach((t=>{t.contains(o)&&(e=t)})),e&&(e.insertAdjacentHTML("afterend",t),i=e.nextElementSibling)}let s=this.builder.doc.querySelector(".builder-active");if(s&&this.builder.applyBehaviorOn(s),"img"===i.tagName.toLowerCase()){let t=setInterval((()=>{i.complete&&(i.click(),clearInterval(t))}),30)}else i.click();let l=this.builder.builderStuff.querySelector(".quickadd");this.hidePop(l)}if(this.builder.useCssClasses){let t=this.builder.doc.querySelector(".builder-active");t&&n.contentReformat(t,this.builder.cssClasses)}this.builder.opts.onChange(),this.builder.opts.onRender()}htmlToElement(t){var e=document.createElement("template");return t=t.trim(),e.innerHTML=t,e.content.firstChild}addSnippet(t,e,i){this.builder.uo.saveForUndo();const n=this.dom;let o,s,l,a=!1;let r,c=this.builder.builderStuff.querySelector(".quickadd");if(r=c?c.getAttribute("data-mode"):"row",!e||"cell"!==r&&"cell-left"!==r&&"cell-right"!==r){if(e&&"row"===r){let e;if(l=document.createElement("div"),l.className=this.builder.opts.cols[this.builder.opts.cols.length-1],l.innerHTML=t,i&&l.setAttribute("data-noedit",""),o=document.createElement("div"),o.className=this.builder.opts.row,o.appendChild(l),s=this.builder.cellSelected(),s?e=s.parentNode:(e=this.builder.doc.querySelector(".row-active"),e||(a=!0)),a){const t=this.builder.doc.querySelectorAll(".is-builder"),i=t[t.length-1],o=n.elementChildren(i);e=o[o.length-1]}e.parentNode.insertBefore(o,e),n.moveAfter(o,e);let r=this.builder.doc.querySelector(".builder-active");r||(r=this.builder.doc.querySelector(".is-builder")),this.builder.applyBehaviorOn(r),l.click(),o.className=o.className.replace("row-outline",""),this.builder.util.hideColumnTool()}else{if(e)return void(i?this.addContent(t,r,"data-noedit"):this.addContent(t,r));{var u=document.createElement("div");u.innerHTML=t;var d=u.querySelectorAll("[data-html]");if(Array.prototype.forEach.call(d,(e=>{t=(t=(t=decodeURIComponent(e.getAttribute("data-html"))).replace(/{id}/g,this.makeId())).replace(/<script>/g,""+(this.builder.nonce?`<script nonce="${this.builder.nonce}">`:"<script>"));for(var i=1;i<=20;i++)t=t.replace("[%HTML"+i+"%]",void 0===e.getAttribute("data-html-"+i)?"":decodeURIComponent(e.getAttribute("data-html-"+i)));e.innerHTML=t,e.classList.add("dummy-module")})),1===u.childNodes.length&&1===u.childNodes[0].childNodes.length&&("cell"===r||"cell-left"===r||"cell-right"===r)){const t=this.cellSelected();let e=t.parentNode,i=4;if(this.builder.maxColumns&&(i=this.builder.maxColumns),e.querySelector(".is-row-overlay")){if(e.childElementCount>=i+4)return alert(this.out("You have reached the maximum number of columns")),!1}else if(e.childElementCount>=i+3)return alert(this.out("You have reached the maximum number of columns")),!1;this.builder.uo.saveForUndo();let n=u.childNodes[0].childNodes[0];var b=document.createRange();t.parentNode.insertBefore(b.createContextualFragment(n.outerHTML),t),"cell"!==r&&"cell-right"!==r||(t.parentNode.insertBefore(t.previousElementSibling,t),t.parentNode.insertBefore(t,t.previousElementSibling));let o=this.builder.doc.querySelector(".builder-active");return o||(o=this.builder.doc.querySelector(".is-builder")),this.builder.applyBehaviorOn(o),this.fixLayout(e),"cell"===r||"cell-right"===r?t.nextElementSibling.click():t.previousElementSibling.click(),this.builder.opts.onChange(),void this.builder.opts.onRender()}let e;if(s=this.builder.activeCol,s?e=s.parentNode:(e=this.builder.doc.querySelector(".row-active"),e||(a=!0)),a){const t=this.builder.doc.querySelectorAll(".is-builder"),i=t[t.length-1],o=n.elementChildren(i);e=o[o.length-1]}b=document.createRange(),e.parentNode.insertBefore(b.createContextualFragment(u.innerHTML),e.nextSibling),o=u.childNodes[0],o=e.nextElementSibling;let i=this.builder.doc.querySelector(".builder-active");i||(i=this.builder.doc.querySelector(".is-builder")),this.builder.applyBehaviorOn(i),l=o.querySelector("div"),l&&l.click();this.builder.doc.querySelectorAll(".dummy-module").forEach((t=>{t.querySelectorAll(".grid-sortable").forEach((t=>{new Dt(t,{animation:600,dragClass:"hide-drag-class",onStart:()=>{this.builder.uo.saveForUndo(!0)},onSort:()=>{if(t.closest("[data-html]")){const e=t.closest("[data-html]"),i=encodeURIComponent(e.innerHTML);e.setAttribute("data-html",i),this.builder.opts.onChange()}}})}))})),this.builder.doc.querySelectorAll(".dummy-module").forEach((t=>{t.classList.remove("dummy-module")})),o.className=o.className.replace("row-outline",""),this.builder.util.hideColumnTool()}}if(this.builder.useCssClasses){let t=this.builder.doc.querySelector(".builder-active");t&&n.contentReformat(t,this.builder.cssClasses)}this.builder.opts.onChange(),this.builder.opts.onRender()}else i?this.addContent(t,r,"data-noedit"):this.addContent(t,r)}clearActiveCell(){if(!this.builder.builderStuff)return;let t=this.builder.doc.getElementsByClassName("cell-active");for(;t.length;)t[0].classList.remove("cell-active");for(t=this.builder.doc.getElementsByClassName("row-outline");t.length;)t[0].classList.remove("row-outline");for(t=this.builder.doc.getElementsByClassName("row-active");t.length;)t[0].classList.remove("row-active");for(t=this.builder.doc.getElementsByClassName("builder-active");t.length;)t[0].classList.remove("builder-active");this.builder.activeCol=null,this.builder.dom.removeClass(this.builder.doc.body,"content-edit")}clearAfterUndoRedo(){const t=this.dom,e=this.builder.builderStuff;let i=e.querySelectorAll(".is-tool");Array.prototype.forEach.call(i,(e=>{e.style.display="",t.removeClass(e,"active")})),this.builder.iframe&&(i=this.builder.contentStuff.querySelectorAll(".is-tool"),Array.prototype.forEach.call(i,(e=>{e.style.display="",t.removeClass(e,"active")}))),this.builder.moveable&&this.builder.moveable.updateRect();const n=document.querySelector(".moveable-control-box");if(n&&(n.style.display="none"),this.builder.activeSpacer=null,this.builder.activeCodeBlock=null,this.builder.activeLink=null,this.builder.activeLinkButton=null,this.builder.activeButton=null,this.builder.activeIframe=null,this.builder.activeTd=null,this.builder.activeTable=null,this.builder.activeModule=null,this.builder.doc.querySelectorAll(".icon-active").forEach((t=>t.classList.remove("icon-active"))),this.builder.activeIcon=null,!this.builder.controlPanel){let i=e.querySelector(".is-rte-tool").querySelectorAll("button");Array.prototype.forEach.call(i,(e=>{t.removeClass(e,"on")})),i=e.querySelector(".is-elementrte-tool").querySelectorAll("button"),Array.prototype.forEach.call(i,(e=>{t.removeClass(e,"on")}))}let o=e.querySelectorAll(".is-pop");Array.prototype.forEach.call(o,(t=>{t.style.display=""}))}hidePops(){const t=this.dom,e=this.builder.builderStuff;let i=e.querySelectorAll(".is-tool");Array.prototype.forEach.call(i,(e=>{e.style.display="",t.removeClass(e,"active")}));let n=e.querySelectorAll(".is-pop.active");Array.prototype.forEach.call(n,(e=>{e.style.transition="all 200ms ease",setTimeout((()=>{e.style.opacity="0"}),10),setTimeout((()=>{e.style.display="",t.removeClass(e,"active"),e.style.opacity="",e.style.transition=""}),200)}));const o=document.querySelector(".moveable-control-box"),s=document.querySelector("#divImageResizer");o&&s&&!s.getAttribute("data-resizing")&&(o.style.display="none")}hideControls(){const t=this.dom;let e=this.builder.builderStuff.querySelectorAll(".is-tool");Array.prototype.forEach.call(e,(e=>{e.style.display="",t.removeClass(e,"active")})),this.builder.iframe&&(e=this.builder.contentStuff.querySelectorAll(".is-tool"),Array.prototype.forEach.call(e,(e=>{e.style.display="",t.removeClass(e,"active")}))),this.builder.moveable&&this.builder.moveable.updateRect();const i=document.querySelector(".moveable-control-box");i&&(i.style.display="none")}clearActiveElement(t){const e=this.dom,i=this.builder.builderStuff;this.builder.doc.querySelectorAll(".icon-active").forEach((t=>t.classList.remove("icon-active"))),this.builder.activeIcon=null;let n=this.builder.doc.querySelectorAll(".elm-inspected");Array.prototype.forEach.call(n,(t=>{e.removeClass(t,"elm-inspected")})),this.builder.inspectedElement=null,n=this.builder.doc.querySelectorAll(".elm-active"),Array.prototype.forEach.call(n,(t=>{e.removeClass(t,"elm-active")})),this.builder.activeElement=null,this.builder.doc.querySelector(".is-element-tool").style.display="";let o=this.builder.doc.querySelector("#divLinkTool");if(o&&(o.style.display=""),t&&!this.builder.controlPanel){let t=i.querySelector(".is-rte-tool");t&&(t.style.display="none");let e=i.querySelector(".is-elementrte-tool");e&&(e.style.display="flex");let n=i.querySelector(".rte-more-options");n&&(n.style.display="");let o=i.querySelector(".elementrte-more-options");o&&(o.style.display="");let s=e.querySelectorAll("button[data-align]");Array.prototype.forEach.call(s,(t=>{t.style.display="none"})),this.builder.rte.positionToolbar()}}clearPops(){const t=this.dom,e=this.builder.builderStuff;if(!e)return;let i=e.querySelectorAll(".is-tool");Array.prototype.forEach.call(i,(e=>{e.style.display="",t.removeClass(e,"active")})),this.builder.iframe&&(i=this.builder.contentStuff.querySelectorAll(".is-tool"),Array.prototype.forEach.call(i,(e=>{e.style.display="",t.removeClass(e,"active")}))),this.builder.moveable&&this.builder.moveable.updateRect();const n=document.querySelector(".moveable-control-box");n&&(n.style.display="none");let o=this.builder.doc.querySelectorAll(".ovl");Array.prototype.forEach.call(o,(t=>{t.style.display="block"}));let s=e.querySelectorAll(".is-pop");Array.prototype.forEach.call(s,(e=>{e.style.display="",t.removeClass(e,"active"),e.setAttribute("aria-hidden",!0)})),this.builder.colTool.lockIndicator.style.display="",this.builder.resize&&this.builder.resize.destroy()}clearControls(){const t=this.dom,e=this.builder.builderStuff;if(!e)return;let i=e.querySelectorAll(".is-tool");Array.prototype.forEach.call(i,(e=>{e.style.display="",t.removeClass(e,"active")})),this.builder.iframe&&(i=this.builder.contentStuff.querySelectorAll(".is-tool"),Array.prototype.forEach.call(i,(e=>{e.style.display="",t.removeClass(e,"active")}))),this.builder.moveable&&this.builder.moveable.updateRect();const n=document.querySelector(".moveable-control-box");n&&(n.style.display="none"),this.builder.activeSpacer=null,this.builder.activeCodeBlock=null,this.builder.activeLink=null,this.builder.activeLinkButton=null,this.builder.activeButton=null,this.builder.activeIframe=null,this.builder.activeTd=null,this.builder.activeTable=null,this.builder.activeModule=null,this.builder.activeImage=null,this.builder.doc.querySelectorAll(".icon-active").forEach((t=>t.classList.remove("icon-active"))),this.builder.activeIcon=null;let o=this.builder.doc.querySelectorAll(".ovl");Array.prototype.forEach.call(o,(t=>{t.style.display="block"}));var s=e.querySelectorAll(".is-side.elementstyles");Array.prototype.forEach.call(s,(e=>{t.removeClass(e,"active")}));let l=this.builder.doc.querySelectorAll("[data-saveforundo]");if(Array.prototype.forEach.call(l,(t=>{t.removeAttribute("data-saveforundo")})),l=this.builder.doc.querySelectorAll(".elm-inspected"),Array.prototype.forEach.call(l,(e=>{t.removeClass(e,"elm-inspected")})),!this.builder.controlPanel&&"auto"===this.builder.toolbarDisplay){let t=e.querySelector(".is-rte-tool");t&&(t.style.display="none");let i=e.querySelector(".is-elementrte-tool");i&&(i.style.display="none");let n=e.querySelector(".rte-more-options");n&&(n.style.display="");let o=e.querySelector(".elementrte-more-options");o&&(o.style.display="")}if(l=this.builder.doc.querySelectorAll(".elm-active"),Array.prototype.forEach.call(l,(e=>{t.removeClass(e,"elm-active")})),!this.builder.controlPanel){let i=e.querySelectorAll(".is-rte-pop");Array.prototype.forEach.call(i,(e=>{e.style.display="",t.removeClass(e,"active"),t.removeClass(e,"deactive")}))}let a=e.querySelectorAll(".is-pop");Array.prototype.forEach.call(a,(e=>{e.style.display="",t.removeClass(e,"active"),e.setAttribute("aria-hidden",!0)})),this.builder.colTool.lockIndicator.style.display="",this.builder.resize&&this.builder.resize.destroy()}makeId(){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}getSelection(){if(this.builder.dom.getSelectedBlocks().length>0)this.builder.selectionMulti=!0;else{this.builder.selectionMulti=!1;const t=this.builder.win.getSelection(),e=this.builder.dom.getElm();if(!e)return;if(e&&e.innerText===t.toString().trim()||""===t.toString().trim()){this.builder.selectionElm=e;let t=e.closest("a");this.builder.activeLink=t||null}else this.builder.selectionText=t,this.builder.activeLink=null}}saveSelection(){if(this.builder.win.getSelection){let t=this.builder.win.getSelection();if(t.getRangeAt&&t.rangeCount){let e=[];for(let i=0,n=t.rangeCount;i<n;++i)e.push(t.getRangeAt(i));return this.builder.selection=e,e}}else if(this.builder.doc.selection&&this.builder.doc.selection.createRange)return this.builder.selection=this.builder.doc.selection.createRange(),this.builder.doc.selection.createRange();return this.builder.selection=null,null}restoreSelection(){let t=this.builder.selection;if(t)if(this.builder.win.getSelection){let o=this.builder.win.getSelection();if(this.builder.doc.body.createTextRange){var e=this.builder.doc.body.createTextRange();e.collapse(),e.select()}else this.builder.win.getSelection?this.builder.win.getSelection().empty?this.builder.win.getSelection().empty():this.builder.win.getSelection().removeAllRanges&&this.builder.win.getSelection().removeAllRanges():this.builder.doc.selection&&this.builder.doc.selection.empty();for(var i=0,n=t.length;i<n;++i)o.addRange(t[i])}else this.builder.doc.selection&&t.select&&t.select()}cleanHTML(t,e){let i,n=t.replace(/(\n|\r| class=(")?Mso[a-zA-Z]+(")?)/g," "),o=new RegExp("\x3c!--(.*?)--\x3e","g");n=n.replace(o,""),i=e?new RegExp("<(/)*(meta|link|span|\\?xml:|st1:|o:|font)(.*?)>","gi"):new RegExp("<(/)*(meta|link|\\?xml:|st1:|o:|font)(.*?)>","gi"),n=n.replace(i,"");let s,l=["style","script","applet","embed","noframes","noscript"];for(let t=0;t<l.length;t++)i=new RegExp("<"+l[t]+".*?"+l[t]+"(.*?)>","gi"),n=n.replace(i,"");s=e?["style","start"]:["start"];for(let t=0;t<s.length;t++){let e=new RegExp(" "+s[t]+'="(.*?)"',"gi");n=n.replace(e,"")}return n=n.replace(/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s/>]))[^>]*>/gi,""),n=n.replace(/<(\/?)s>/gi,"<$1strike>"),n=n.replace(/&nbsp;/gi," "),n=n.replace(/background-color: rgba\(200, 200, 201, 0.11\);/gi,""),n=n.replace(/background-color: rgba\(200, 200, 201, 0.11\)/gi,""),n}checkEmpty(){const t=this.builder.doc.querySelectorAll(this.builder.opts.container);Array.prototype.forEach.call(t,(t=>{this.checkEmptyOn(t)}))}checkEmptyOn(t){const i=this.dom,n=i.elementChildren(t);let o=!0;if(n.forEach((t=>{i.hasClass(t,"row-add-initial")||i.hasClass(t,"dummy-space")||"link"!==t.tagName.toLowerCase()&&(o=!1)})),o){let n=t.querySelector(".row-add-initial");n||(t.innerHTML=`<button type="button" class="row-add-initial">${this.out("Empty")}<br><span class="block">${this.out("+ Click to add content")}</span></div>`,n=t.querySelector(".row-add-initial")),n.addEventListener("click",(()=>{this.clearActiveCell();const o=this.builder.doc.querySelectorAll(this.builder.opts.container);Array.prototype.forEach.call(o,(t=>{i.removeClass(t,"builder-active")})),i.addClass(t,"builder-active"),i.addClass(n,"row-active");const s=e(this.builder);s.querySelector(".is-pop-tabs").style.display="none";const l=window.innerHeight,a=this.getElementPosition(n);let r=a.top,c=a.left,u=a.scaleX,d=a.scaleY;c+=n.offsetWidth*(u*this.builder.opts.zoom)/2-11,r-=n.offsetHeight-n.offsetHeight*d,s.style.display="flex",this.showPop(s,!1,n);const b=s.offsetWidth,h=s.offsetHeight;l-r>h?(r=r+n.offsetHeight*this.builder.opts.zoom-19,s.style.top=r+window.pageYOffset+27+"px",s.style.left=c-b/2+7+"px",i.removeClass(s,"arrow-bottom"),i.removeClass(s,"arrow-right"),i.removeClass(s,"arrow-left"),i.removeClass(s,"center"),i.addClass(s,"arrow-top"),i.addClass(s,"center")):(s.style.top=r+window.pageYOffset-h-8+"px",s.style.left=c-b/2+7+"px",i.removeClass(s,"arrow-top"),i.removeClass(s,"arrow-right"),i.removeClass(s,"arrow-left"),i.removeClass(s,"center"),i.addClass(s,"arrow-bottom"),i.addClass(s,"center")),s.setAttribute("data-mode","row")}))}else{let e=t.querySelector(".row-add-initial");e&&e.parentNode.removeChild(e)}}clearPreferences(){localStorage.removeItem("_theme"),localStorage.removeItem("_zoom"),localStorage.removeItem("_buildermode"),localStorage.removeItem("_editingtoolbar"),localStorage.removeItem("_editingtoolbardisplay"),localStorage.removeItem("_hidecelltool"),localStorage.removeItem("_rowtool"),localStorage.removeItem("_hideelementtool"),localStorage.removeItem("_hidesnippetaddtool"),localStorage.removeItem("_outlinemode"),localStorage.removeItem("_hiderowcoloutline"),localStorage.removeItem("_outlinestyle"),localStorage.removeItem("_hideelementhighlight"),localStorage.removeItem("_opensnippets"),localStorage.removeItem("_toolstyle"),localStorage.removeItem("_snippetssidebardisplay"),localStorage.removeItem("_htmlview"),localStorage.removeItem("_pasteresult"),localStorage.removeItem("_livepreview"),localStorage.removeItem("_dictation"),localStorage.removeItem("_mic"),localStorage.removeItem("_autosendcommand"),localStorage.removeItem("_disclaimershown"),localStorage.removeItem("_temp"),localStorage.removeItem("_top_p"),localStorage.removeItem("_autosend_delay"),localStorage.removeItem("_auto_editblock"),localStorage.removeItem("_command_lang"),localStorage.removeItem("_ai_panel_open"),localStorage.removeItem("_pagesize"),localStorage.removeItem("_scrollableeditor"),localStorage.removeItem("_animatedsorting"),localStorage.removeItem("_addbuttonplace"),localStorage.removeItem("_hiderowtool"),localStorage.removeItem("_dragwithouthandle"),localStorage.removeItem("_advancedhtmleditor"),localStorage.removeItem("_hidecolhtmleditor"),localStorage.removeItem("_hiderowhtmleditor"),localStorage.removeItem("_sampleshown")}pasteHtmlAtCaret(t,e){var i,n;if(this.restoreSelection(),this.builder.dom.getElm().closest(".is-container"))if(this.builder.win.getSelection){if(!this.builder.activeCol)return;if((i=this.builder.win.getSelection()).getRangeAt&&i.rangeCount){(n=i.getRangeAt(0)).deleteContents();var o=this.builder.doc.createElement("div");o.innerHTML=t;for(var s,l,a=this.builder.doc.createDocumentFragment();s=o.firstChild;)l=a.appendChild(s);var r=a.firstChild;n.insertNode(a),l&&((n=n.cloneRange()).setStartAfter(l),e?n.setStartBefore(r):n.collapse(!0),i.removeAllRanges(),this.builder.isTouchSupport||i.addRange(n))}}else if((i=this.builder.doc.selection)&&"Control"!==i.type){if(!this.builder.activeCol)return;var c=i.createRange();c.collapse(!0),i.createRange().pasteHTML(t),e&&((n=i.createRange()).setEndPoint("StartToStart",c),this.builder.isTouchSupport||n.select())}}refreshModule(){let t=this.builder.activeModule;if(!t)return;let e=1,i=t.querySelectorAll("[data-subblock]");Array.prototype.forEach.call(i,(i=>{let n=i.innerHTML;t.setAttribute("data-html-"+e,encodeURIComponent(n)),e++}));let n=decodeURIComponent(t.getAttribute("data-html"));n=n.replace(/{id}/g,this.makeId()),t.innerHTML="";var o=document.createRange();o.setStart(t,0),t.appendChild(o.createContextualFragment(n)),i=t.querySelectorAll("[data-subblock]");var s=1;Array.prototype.forEach.call(i,(e=>{t.getAttribute("data-html-"+s)&&(e.innerHTML=decodeURIComponent(t.getAttribute("data-html-"+s))),s++})),this.repositionColumnTool(!0),this.builder.onRefreshTool&&this.builder.onRefreshTool()}repositionColumnTool(){let t=this.builder.activeCol;if(!t)return;let e=t.parentNode;if(t.parentNode||(e=this.rowSelected()),this.colTool=e.querySelector(".is-col-tool"),!this.colTool)return;t.parentNode||(this.colTool.style.display="none"),this.colTool.style.left=t.offsetLeft+"px";const i=this.builder.builderStuff.querySelector(".columnmore.active");if(i){const t=this.colTool.querySelector(".cell-more");i.classList.add("transition1"),setTimeout((()=>{const e=this.getElementPosition(t);let n=e.top,o=e.left;i.style.top=n+35+"px",i.style.left=o-7+"px",setTimeout((()=>{i.classList.remove("transition1")}),300)}),30)}}hideColumnTool(){this.builder.doc.querySelectorAll(".is-col-tool").forEach((t=>{t.style.display="none"}))}isTouchSupport(){return!!window.matchMedia("(pointer: coarse)").matches}detectIE(){return!!document.documentMode}LightenDarkenColor(t,e){var i=!1;"#"===t[0]&&(t=t.slice(1),i=!0);var n=parseInt(t,16),o=(n>>16)+e;o>255?o=255:o<0&&(o=0);var s=(n>>8&255)+e;s>255?s=255:s<0&&(s=0);var l=(255&n)+e;return l>255?l=255:l<0&&(l=0),(i?"#":"")+String("000000"+(l|s<<8|o<<16).toString(16)).slice(-6)}getUIStyles(){this.dom.appendHtml(this.builder.builderStuff,'\n <input type="text" class="style-helper-input" id="__style_helper_input" style="display:none;">\n <button class="style-helper-button-classic classic" style="display:none;"><svg><use xlink:href="#ion-code-working"></use></svg></button>\n <select class="style-helper-select" id="__style_helper_select" style="display:none;"><option value=""></option></select>\n\n <div class="style-helper modal-color"></div>\n <div class="style-helper modal-background"></div>\n <div class="style-helper button-pickcolor-border"></div>\n <div class="style-helper button-pickcolor-background"></div>\n\n <button class="style-helper base"><svg><use xlink:href="#ion-code-working"></use></svg></button>\n <div class="style-helper base on"></div>\n <div class="style-helper base hover"></div>\n\n <div class="style-helper snippet-color"></div>\n <div class="style-helper snippet-background"></div>\n <div class="style-helper snippet-tabs-background"></div>\n <div class="style-helper snippet-tab-item-background"></div>\n <div class="style-helper snippet-tab-item-background-active"></div>\n <div class="style-helper snippet-tab-item-background-hover"></div>\n <div class="style-helper snippet-tab-item-color"></div>\n\n <div class="style-helper snippet-more-item-background"></div>\n <div class="style-helper snippet-more-item-background-active"></div>\n <div class="style-helper snippet-more-item-background-hover"></div>\n <div class="style-helper snippet-more-item-color"></div>\n\n <div class="style-helper tabs-background"></div>\n <div class="style-helper tab-item-active-border-bottom"></div>\n <div class="style-helper tab-item-color"></div>\n <div class="style-helper tabs-more-background"></div>\n <div class="style-helper tabs-more-border"></div>\n <div class="style-helper tabs-more-item-color"></div>\n <div class="style-helper tabs-more-item-background-hover"></div>\n <div class="style-helper separator-color"></div>\n <div class="style-helper outline-color"></div>\n ');const t=(t,e)=>{const i=this.builder.builderStuff.querySelector(".style-helper"+t);return window.getComputedStyle(i,null).getPropertyValue(e)},e=this.builder.builderStuff.querySelector(".style-helper-input"),i=this.builder.builderStuff.querySelector(".style-helper-select"),n=this.builder.builderStuff.querySelector(".style-helper-button-classic");this.builder.styleModalColor=t(".modal-color","background-color"),this.builder.styleModalBackground=t(".modal-background","background-color"),this.builder.styleButtonPickColorBorder=t(".button-pickcolor-border","border"),this.builder.styleButtonPickColorBackground=t(".button-pickcolor-background","background-color"),this.builder.styleToolBackground=t(".base","background-color"),this.builder.styleButtonColor=t(".base","color"),this.builder.styleButtonSvgFill=(()=>{const t=this.builder.builderStuff.querySelector(".style-helper.base");return window.getComputedStyle(t.querySelector("svg"),null).getPropertyValue("fill")})(),this.builder.styleButtonBackgroundHover=t(".base.hover","background-color"),this.builder.styleSnippetColor=t(".snippet-color","background-color"),this.builder.styleSnippetBackground=t(".snippet-background","background-color"),this.builder.styleSnippetTabsBackground=t(".snippet-tabs-background","background-color"),this.builder.styleSnippetTabItemBackground=t(".snippet-tab-item-background","background-color"),this.builder.styleSnippetTabItemBackgroundActive=t(".snippet-tab-item-background-active","background-color"),this.builder.styleSnippetTabItemBackgroundHover=t(".snippet-tab-item-background-hover","background-color"),this.builder.styleSnippetTabItemColor=t(".snippet-tab-item-color","background-color"),this.builder.styleSnippetMoreItemBackground=t(".snippet-more-item-background","background-color"),this.builder.styleSnippetMoreItemBackgroundActive=t(".snippet-more-item-background-active","background-color"),this.builder.styleSnippetMoreItemBackgroundHover=t(".snippet-more-item-background-hover","background-color"),this.builder.styleSnippetMoreItemColor=t(".snippet-more-item-color","background-color"),this.builder.styleTabsBackground=t(".tabs-background","background-color"),this.builder.styleTabItemBorderBottomActive=t(".tab-item-active-border-bottom","border"),this.builder.styleTabItemColor=t(".tab-item-color","background-color"),this.builder.styleTabsMoreBackground=t(".tabs-more-background","background-color"),this.builder.styleTabsMoreBorder=t(".tabs-more-border","border"),this.builder.styleTabsMoreItemColor=t(".tabs-more-item-color","background-color"),this.builder.styleTabsMoreBackgroundHover=t(".tabs-more-item-background-hover","background-color"),this.builder.styleSeparatorColor=t(".separator-color","background-color"),this.builder.styleOutlineColor=t(".outline-color","background-color"),this.builder.styleSelectBackground=window.getComputedStyle(i,null).getPropertyValue("background-color"),this.builder.styleSelectColor=window.getComputedStyle(i,null).getPropertyValue("color"),this.builder.styleSelectOptionBackground=window.getComputedStyle(i.querySelector("option"),null).getPropertyValue("background-color"),this.builder.styleInputBackground=window.getComputedStyle(e,null).getPropertyValue("background-color"),this.builder.styleInputBorderBottom=window.getComputedStyle(e,null).getPropertyValue("border-bottom"),this.builder.styleInputColor=window.getComputedStyle(e,null).getPropertyValue("color"),this.builder.styleButtonClassicBackground=window.getComputedStyle(n,null).getPropertyValue("background-color"),this.builder.styleButtonClassicColor=window.getComputedStyle(n,null).getPropertyValue("color"),this.builder.styleButtonClassicBackgroundHover=this.getUIStyleValue(n,"hover","background-color"),this.builder.styleDark=!1,this.builder.styleColored=!1,this.builder.styleColoredDark=!1,this.builder.styleLight=!1,document.body.getAttribute("class")&&(-1!==document.body.getAttribute("class").indexOf("colored-dark")?this.builder.styleColoredDark=!0:-1!==document.body.getAttribute("class").indexOf("dark")?this.builder.styleDark=!0:-1!==document.body.getAttribute("class").indexOf("colored")?this.builder.styleColored=!0:-1!==document.body.getAttribute("class").indexOf("light")&&(this.builder.styleLight=!0))}getUIStyleValue(t,e,i){const n=this.dom;n.addClass(t,e);let o=window.getComputedStyle(t,null).getPropertyValue(i);return n.removeClass(t,e),o}getPageTemplate(t){let e="";return e=""===t?'\n <!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charset="utf-8">\n <title>Page</title>\n <meta name="viewport" content="width=device-width, initial-scale=1">\n <meta name="description" content="">\n <link rel="shortcut icon" href="#">\n \n <link href="[%PATH%]/assets/minimalist-blocks/content.css" rel="stylesheet">\n \n <link href="[%PATH%]/assets/scripts/glide/css/glide.core.css" rel="stylesheet">\n <link href="[%PATH%]/assets/scripts/glide/css/glide.theme.css" rel="stylesheet">\n <script src="[%PATH%]/assets/scripts/glide/glide.js"><\/script>\n \n <style>\n .container {\n margin: 150px auto 0;\n max-width: 800px;\n width: 100%;\n padding: 0 20px;\n box-sizing: border-box;\n }\n </style>\n </head>\n <body>\n \n <div class="container">\n [%CONTENT%]\n </div>\n \n </body>\n </html>\n ':"tailwind"===t?'\n <!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charset="utf-8">\n <title>Page</title>\n <meta name="viewport" content="width=device-width, initial-scale=1">\n <meta name="description" content="">\n <link rel="shortcut icon" href="#">\n \n <link href="[%PATH%]/assets/minimalist-blocks/content-tailwind.css" rel="stylesheet">\n \n <link href="[%PATH%]/assets/scripts/glide/css/glide.core.css" rel="stylesheet">\n <link href="[%PATH%]/assets/scripts/glide/css/glide.theme.css" rel="stylesheet">\n <script src="[%PATH%]/assets/scripts/glide/glide.js"><\/script>\n \n <link rel="stylesheet" href="[%PATH%]/assets/frameworks/tailwindcss/styles.css">\n \x3c!-- To build your own, please see: https://tailwindcss.com/docs/installation --\x3e\n \n <style>\n .container {\n margin: 150px auto 0;\n max-width: 800px;\n width: 100%;\n padding: 0 20px;\n box-sizing: border-box;\n }\n </style>\n </head>\n <body>\n \n <div class="container">\n [%CONTENT%]\n </div>\n \n </body>\n </html>\n ':"bootstrap"===t?'\n <!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charset="utf-8">\n <title>Page</title>\n <meta name="viewport" content="width=device-width, initial-scale=1">\n <meta name="description" content="">\n <link rel="shortcut icon" href="#">\n\n <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">\n \n <link href="[%PATH%]/assets/minimalist-blocks/content.css" rel="stylesheet">\n \n <link href="[%PATH%]/assets/scripts/glide/css/glide.core.css" rel="stylesheet">\n <link href="[%PATH%]/assets/scripts/glide/css/glide.theme.css" rel="stylesheet">\n <script src="[%PATH%]/assets/scripts/glide/glide.js"><\/script>\n \n <style>\n .container {margin: 140px auto; max-width: 800px; width:100%; padding:0 35px; box-sizing: border-box;}\n /* Bootstrap css adjustment to enable column drag to resize */\n .row > *,\n .column {\n max-width: unset !important;\n }\n </style>\n </head>\n <body>\n \n <div class="container">\n [%CONTENT%]\n </div>\n \n </body>\n </html>\n ':"foundation"===t?'\n <!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charset="utf-8">\n <title>Page</title>\n <meta name="viewport" content="width=device-width, initial-scale=1">\n <meta name="description" content="">\n <link rel="shortcut icon" href="#">\n\n <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.5.3/css/foundation.min.css">\n <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.5.3/css/foundation-float.min.css">\n \n <link href="[%PATH%]/assets/minimalist-blocks/content.css" rel="stylesheet">\n \n <link href="[%PATH%]/assets/scripts/glide/css/glide.core.css" rel="stylesheet">\n <link href="[%PATH%]/assets/scripts/glide/css/glide.theme.css" rel="stylesheet">\n <script src="[%PATH%]/assets/scripts/glide/glide.js"><\/script>\n \n <style>\n .container {\n margin: 150px auto 0;\n max-width: 800px;\n width: 100%;\n padding: 0 20px;\n box-sizing: border-box;\n }\n </style>\n </head>\n <body>\n \n <div class="container">\n [%CONTENT%]\n </div>\n \n </body>\n </html>\n ':"[%CONTENT%]",e}getElementPosition(t){const e=this.builder.iframe;let i,n,o,s;if(this.builder.iframe){let l=document.querySelector(".is-content-view");l||(l=e.parentNode);const a=window.getComputedStyle(l).transform;if("none"!==a){const t=a.match(/matrix\(([0-9., -]+)\)/)[1].split(",");o=parseFloat(t[0]),s=parseFloat(t[3])}else o=1,s=1;const r=e.getBoundingClientRect();i=t.getBoundingClientRect().top*s+r.top,n=t.getBoundingClientRect().left*o+r.left}else i=t.getBoundingClientRect().top,n=t.getBoundingClientRect().left,o=1,s=1;return{top:i,left:n,scaleX:o,scaleY:s}}getLightboxCss(){return"\n /* Light */\n .glightbox-light .gslide-description {\n background: #fff;\n }\n \n .glightbox-light .gdesc-inner {\n padding: 22px 20px;\n }\n \n .glightbox-light .gslide-title {\n font-size: 1em;\n font-weight: normal;\n font-family: arial;\n color: #000;\n margin-bottom: 19px;\n line-height: 1.4em;\n }\n \n .glightbox-light .gslide-desc {\n font-size: 0.86em;\n margin-bottom: 0;\n font-family: arial;\n line-height: 1.4em;\n }\n \n .glightbox-light .gslide-video {\n background: #000;\n }\n \n .glightbox-light .gprev,\n .glightbox-light .gnext,\n .glightbox-light .gclose {\n background-color: rgb(255 255 255 / 0%);\n border-radius: 4px;\n }\n \n .glightbox-light .gprev path,\n .glightbox-light .gnext path,\n .glightbox-light .gclose path {\n fill: #000;\n }\n \n .glightbox-light .gprev {\n position: absolute;\n top: -100%;\n left: 30px;\n width: 40px;\n height: 50px;\n }\n \n .glightbox-light .gnext {\n position: absolute;\n top: -100%;\n right: 30px;\n width: 40px;\n height: 50px;\n }\n \n .glightbox-light .gclose {\n width: 35px;\n height: 35px;\n top: 15px;\n right: 10px;\n position: absolute;\n }\n \n .glightbox-light .gclose svg {\n width: 18px;\n height: auto;\n }\n \n .glightbox-light .gclose:hover {\n opacity: 1;\n }\n \n /**/\n .glightbox-light .gslide-media {\n -webkit-box-shadow: none !important;\n box-shadow: none !important;\n }\n .glightbox-light .description-left .gdesc-inner,\n .glightbox-light .description-right .gdesc-inner {\n position: absolute;\n height: 100%;\n overflow-y: auto;\n }\n .glightbox-light .gprev,\n .glightbox-light .gnext,\n .glightbox-light .gclose {\n background-color: rgb(255 255 255 / 0%);\n }\n .glightbox-light .gprev:hover,\n .glightbox-light .gnext:hover,\n .glightbox-light .gclose:hover {\n background-color: rgb(255 255 255 / 0%);\n }\n .glightbox-light .gprev {\n top: 45%;\n }\n .glightbox-light .gnext {\n top: 45%;\n }\n \n @media (min-width: 992px) {\n .glightbox-light .gclose {\n opacity: 0.7;\n right: 20px;\n }\n }\n \n /**/\n .glightbox-light .goverlay {\n background: rgb(255 255 255 / 100%) !important;\n }\n @media screen and (max-height: 420px) {\n .goverlay {\n background: rgb(255 255 255 / 100%);\n }\n }\n \n /* override (light) */\n .glightbox-light .gprev,\n .glightbox-light .gnext {\n width: 55px !important;\n height: 70px !important;\n }\n .gclose svg, .gnext svg, .gprev svg {\n width: 50px !important;\n }\n .glightbox-light .gclose {\n width: 55px !important;\n height: 55px !important;\n }\n .glightbox-light .gclose svg {\n width: 30px !important;\n }\n .glightbox-light .gslide-title {\n font-size: 1.2em !important;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif !important;\n }\n .glightbox-light .gslide-desc {\n font-size: 1em !important;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif !important;\n } \n \n /* override (clean) */\n .glightbox-clean .gprev,\n .glightbox-clean .gnext {\n width: 55px !important;\n height: 70px !important;\n }\n .gclose svg, .gnext svg, .gprev svg {\n width: 50px !important;\n }\n .glightbox-clean .gclose {\n width: 55px !important;\n height: 55px !important;\n }\n .glightbox-clean .gclose svg {\n width: 30px !important;\n }\n .glightbox-clean .gslide-title {\n font-size: 1.2em !important;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif !important;\n }\n .glightbox-clean .gslide-desc {\n font-size: 1em !important;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif !important;\n } \n \n /* other override */\n .gclose.disabled, .gnext.disabled, .gprev.disabled {\n opacity: 0;\n } \n "}}class le{constructor(t){this.builder=t}detectMobileOrTablet(){const t=navigator.userAgent.toLowerCase(),e=/ipad|iphone|ipod/.test(t)&&!window.MSStream,i=/android/.test(t),n="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0,o=window.innerWidth<=1600;return!(!e&&!i)||!(!n||!o)}getScale(t){let e=window.getComputedStyle(t).transform;if("none"===e)return 1;let i=e.split("(")[1];i=i.split(")")[0],i=i.split(",");let n=i[0],o=i[1];return Math.sqrt(n*n+o*o)}createElement(t){return document.createElement(t)}appendChild(t,e){t&&t.appendChild(e)}appendHtml(t,e){t&&t.insertAdjacentHTML("beforeend",e)}addEventListener(t,e,i){t&&t.addEventListener(e,i)}addClass(t,e){t&&(this.hasClass(t,e)||(0===t.classList.length?t.className=e:t.className=t.className+" "+e,t.className=t.className.replace(/ +/g," ")))}removeClass(t,e){if(t&&t.classList.length>0){let i,n,o,s,l=e.split(" ");for(i=0,o=l.length;i<o;++i)if(l[i])try{let e=l[i],o="",a=t.className.split(" ");for(n=0,s=a.length;n<s;++n)a[n]&&a[n]!==e&&(o+=a[n]+" ");t.className=o.trim()}catch(t){}""===t.className&&t.removeAttribute("class")}}removeClassesByPrefix(t,e){t.classList&&t.classList.forEach((i=>{0===i.indexOf(e)&&this.removeClass(t,i)}))}hasClass(t,e){return!!t&&(!!t.className&&(" "+t.className+" ").indexOf(" "+e+" ")>-1)}moveAfter(t,e){e.parentNode.insertBefore(t,e),e.parentNode.insertBefore(e,e.previousElementSibling)}elementChildren(t){const e=t.childNodes;let i=[],n=e.length;for(;n--;)1===e[n].nodeType&&i.unshift(e[n]);return i}getElementOffset(t){const e=t.getBoundingClientRect();return{top:e.top+window.pageYOffset,left:e.left+window.pageXOffset,width:e.width,height:e.height}}parentsHasClass(t,e){for(;t;){if(!t.tagName)return!1;if("BODY"===t.tagName||"HTML"===t.tagName)return!1;if(this.hasClass(t,e))return!0;t=t.parentNode}}parentsHasId(t,e){for(;t;){if(!t.tagName)return!1;if("BODY"===t.tagName||"HTML"===t.tagName)return!1;if(t.id===e)return!0;t=t.parentNode}}parentsHasTag(t,e){for(;t;){if(!t.tagName)return!1;if("BODY"===t.tagName||"HTML"===t.tagName)return!1;if(t.tagName.toLowerCase()===e.toLowerCase())return!0;t=t.parentNode}}parentsHasAttribute(t,e){for(;t;){if(!t.tagName)return!1;if("BODY"===t.tagName||"HTML"===t.tagName)return!1;try{if(t.hasAttribute(e))return!0}catch(t){}t=t.parentNode}}getParentByTag(t,e){for(;t;){if(!t.tagName)return!1;if("BODY"===t.tagName||"HTML"===t.tagName)return!1;if(t.tagName.toLowerCase()===e.toLowerCase())return t;t=t.parentNode}}getParentByAttribute(t,e){for(;t;){if(!t.tagName)return!1;if("BODY"===t.tagName||"HTML"===t.tagName)return!1;try{if(t.hasAttribute(e))return t}catch(t){}t=t.parentNode}}parentsHasElement(t,e){for(;t;){if(!t.tagName)return!1;if("BODY"===t.tagName||"HTML"===t.tagName)return!1;if(!(t=t.parentNode))return!1;if(!t.tagName)return!1;if(t.tagName.toLowerCase()===e)return!0}}getParentElement(t,e){for(;t;){if(!t.tagName)return!1;if("BODY"===t.tagName||"HTML"===t.tagName)return!1;if(!(t=t.parentNode))return!1;if(!t.tagName)return!1;if(t.tagName.toLowerCase()===e)return t}}removeClasses(t,e){for(let i=0;i<t.length;i++)t[i].classList.remove(e)}removeAttributes(t,e){for(let i=0;i<t.length;i++)t[i].removeAttribute(e)}removeElements(t){Array.prototype.forEach.call(t,(t=>{t.parentNode.removeChild(t)}))}moveCursorToElement(t){var e,i;window.getSelection&&this.builder.doc.createRange?((i=this.builder.doc.createRange()).selectNodeContents(t),i.collapse(!1),(e=window.getSelection()).removeAllRanges(),e.addRange(i)):this.builder.doc.body.createTextRange&&((i=this.builder.doc.body.createTextRange()).moveToElementText(t),i.collapse(!1),i.select())}selectElementContents(t){var e=this.builder.doc.createRange();e.selectNodeContents(t);var i=this.builder.win.getSelection();i.removeAllRanges(),i.addRange(e)}getSelected(){if(this.builder.win.getSelection)return this.builder.win.getSelection().toString();if(this.builder.doc.getSelection)return this.builder.doc.getSelection().toString();var t=this.builder.doc.selection&&this.builder.doc.selection.createRange();return!!t.text&&t.text}checkEditable(){try{var t,e;return this.builder.win.getSelection?t=3===(e=this.builder.win.getSelection().getRangeAt(0).commonAncestorContainer).nodeType?e.parentNode:e:this.builder.doc.selection&&(e=this.builder.doc.selection.createRange(),t=this.builder.doc.selection.createRange().parentElement()),!!this.parentsHasAttribute(t,"contenteditable")}catch(t){return!1}}textSelection(){const t=this.getSelection().anchorNode;if(!t)return!1;return t.nodeType!==Node.TEXT_NODE&&t.nodeType!==Node.COMMENT_NODE?t:t.parentElement}getStyle(t,e){return window.getComputedStyle?window.getComputedStyle(t,null).getPropertyValue(e):t.style[e.replace(/-([a-z])/g,(function(t){return t[1].toUpperCase()}))]}observeElement(t,e,i,n=0){let o=Object.getPrototypeOf(t);if(Object.prototype.hasOwnProperty.call(o,e)){let s=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,{get:function(){return s.get.apply(this,arguments)},set:function(){let t=this[e];s.set.apply(this,arguments);let o=this[e];"function"==typeof i&&setTimeout(i.bind(this,t,o),n)}})}}baseName(t){if("string"==typeof t){var e=t.split(".");return e.splice(0,e.length-1).join(".")}}doFunction(t,e,i){if(e(t),i){let i=Array.prototype.slice.call(t.getElementsByTagName("*"));for(var n=0;n<i.length;n++)e(i[n])}}execCommand(t,e,i){const n=this.getSelectedBlocks();if(n.length>0)n.forEach((t=>{i(!0,t)}));else{const n=this.builder.win.getSelection(),o=this.getElm();if(!o)return void(i&&i(!1));let s;s=o&&o.innerText===n.toString().trim()||""===n.toString().trim()?this.updateSelection(t,e,o):this.replaceSelection(t,e,n,o),i&&i(!0,s)}}updateSelection(t,e,i){return i.style[t]=this.getStyleValue(i,t,e),this.checkStyleIfSameAsParent(i,t),this.cleanChildren(t,i),this.cleanUnusedSpan(i),i}replaceSelection(t,e,i,n){const o=i.getRangeAt(0),s=o.extractContents(),l=this.createSpan(n,t,e);return l.appendChild(s),this.cleanChildren(t,l),this.cleanUnusedSpan(l),o.insertNode(l),i.selectAllChildren(l),this.checkStyleIfSameAsParent(l,t),l}checkStyleIfSameAsParent(t,e){if(t.parentNode&&(t.parentNode.style[e]===t.style[e]||window.getComputedStyle(t.parentNode,null).getPropertyValue(e)===t.style[e])){t.style[e]="",""!==t.getAttribute("style")&&null!==t.style||t.removeAttribute("style");let i=0===t.attributes.length||1===t.attributes.length&&t.hasAttribute("data-keep");if("span"===t.nodeName.toLowerCase()&&i){const e=document.createTextNode(t.textContent);t.parentElement.replaceChild(e,t)}}}createSpan(t,e,i){const n=document.createElement("span");return n.style[e]=this.getStyleValue(t,e,i),n}findParentStyle(t,e){if("HTML"===t.nodeName.toUpperCase()||"BODY"===t.nodeName.toUpperCase())return null;if(!t.parentNode)return null;if(null!==t.style[e]&&void 0!==t.style[e]&&""!==t.style[e])return t;this.findParentStyle(t.parentNode,e)}getStyleValue(t,e,i){if("font-weight"===e||"font-style"===e||"text-decoration"===e||"text-transform"===e){let n,o=this.findParentStyle(t,e);if(o&&(n=o.style[e]),i===n){t.style[e]="";let o=window.getComputedStyle(t,null).getPropertyValue(e);t.style[e]=n,i=o}}return i}getParentBlock(t){for(;t;){if(!t.tagName)return!1;if("BODY"===t.tagName||"HTML"===t.tagName)return!1;if("inline"!==this.getStyle(t,"display"))return t;t=t.parentNode}}execCommandClass(t,e,i=!0,n){const o=this.getSelectedBlocks();if(o.length>0)o.forEach((i=>{for(let t=0;t<Object.keys(e).length;t++){let n=Object.values(e)[t];this.removeClass(i,n)}""!==t&&this.addClass(i,t),this.cleanChildrenClass(i,e),this.cleanUnusedSpan(i)}));else{const o=this.builder.win.getSelection();let s=this.getElm();if(!s)return;const l=s&&s.innerText===o.toString().trim();(i||l||""===o.toString().trim())&&("block"===n&&"inline"===this.getStyle(s,"display")&&(s=this.getParentBlock(s)),this.updateSelectionClass(t,e,s))}}updateSelectionClass(t,e,i){for(let t=0;t<Object.keys(e).length;t++){let n=Object.values(e)[t];this.removeClass(i,n)}return""!==t&&this.addClass(i,t),this.cleanChildrenClass(i,e),this.cleanUnusedSpan(i),i}cleanChildrenClass(t,e){if(!t.hasChildNodes())return;Array.from(t.children).map((t=>{for(let i=0;i<Object.keys(e).length;i++){let n=Object.values(e)[i];this.removeClass(t,n)}}));const i=Array.from(t.children).map((t=>this.cleanChildrenClass(t,e)));i&&i.length}getSelectedBlocks(){let t=!1,e=this.builder.win.getSelection(),i=[];if(!e.isCollapsed){let t=e.getRangeAt(0),n=t.commonAncestorContainer;const o=e=>{if(e.nodeType===Node.ELEMENT_NODE&&t.intersectsNode(e)&&i.push(e),e.childNodes.length>0)for(let t=0;t<e.childNodes.length;t++)o(e.childNodes[t])};o(n),i.length>0&&i[0]===n&&i.shift()}let n=[];const o=["p","h1","h2","h3","h4","h5","h6","div","pre","td","th","li"];return i.forEach((e=>{const i=e.tagName.toLowerCase();o.includes(i)&&(t=!0,n.push(e))})),2===n.length&&n[0].innerText.trim()===e.toString().trim()&&n.pop(),t?n:[]}execCommandToggle(t,e,i){const n=this.getSelectedBlocks();if(n.length>0)n.forEach((n=>{if("fontWeight"===t){let t=!1;this.hasClass(n,i.fontWeight.defaultBold)&&(t=!0),this.removeClass(n,i.fontWeight.thin),this.removeClass(n,i.fontWeight.extralight),this.removeClass(n,i.fontWeight.light),this.removeClass(n,i.fontWeight.normal),this.removeClass(n,i.fontWeight.medium),this.removeClass(n,i.fontWeight.semibold),this.removeClass(n,i.fontWeight.bold),this.removeClass(n,i.fontWeight.extrabold),this.removeClass(n,i.fontWeight.black),t||this.addClass(n,i.fontWeight.defaultBold)}if("fontStyle"===t){let t=!1;this.hasClass(n,i.fontStyle.italic)&&(t=!0),this.removeClass(n,i.fontStyle.italic),this.removeClass(n,i.fontStyle.normal),t||this.addClass(n,i.fontStyle.italic)}if("textUnderline"===t){let t=!1;this.hasClass(n,i.textDecoration.underline)&&(t=!0),this.removeClass(n,i.textDecoration.linethrough),this.removeClass(n,i.textDecoration.underline),this.removeClass(n,i.textDecoration.normal),t||this.addClass(n,i.textDecoration.underline)}if("textLinethrough"===t){let t=!1;this.hasClass(n,i.textDecoration.linethrough)&&(t=!0),this.removeClass(n,i.textDecoration.underline),this.removeClass(n,i.textDecoration.linethrough),this.removeClass(n,i.textDecoration.normal),t||this.addClass(n,i.textDecoration.linethrough)}if("textTransform"===t){let t="";this.hasClass(n,i.textTransform.uppercase)&&(t="uppercase"),this.removeClass(n,i.textTransform.uppercase),this.removeClass(n,i.textTransform.lowercase),this.removeClass(n,i.textTransform.capitalize),this.removeClass(n,i.textTransform.normal),""===t&&this.addClass(n,i.textTransform.uppercase)}if("clean"===t&&(n.className="",n.style.cssText=""),"extend"===t){let t=!1;this.hasClass(n,i.extend[e])&&(t=!0),t?this.removeClass(n,i.extend[e]):this.addClass(n,i.extend[e])}this.cleanChildrenToggle(t,e,n,i),this.cleanUnusedSpan(n)}));else{const n=this.builder.win.getSelection(),o=this.getElm();if(!o)return;o&&o.innerText===n.toString().trim()||""===n.toString().trim()?this.updateSelectionToggle(t,e,i,o):this.replaceSelectionToggle(t,e,i,n,o)}}getElm(){const t=this.builder.win.getSelection();if(!t)return!1;const e=t.anchorNode;if(!e)return!1;return e.nodeType!==Node.TEXT_NODE&&e.nodeType!==Node.COMMENT_NODE?e:e.parentElement}updateSelectionToggle(t,e,i,n){if("fontWeight"===t){let t=!1;this.hasClass(n,i.fontWeight.defaultBold)&&(t=!0);parseInt(window.getComputedStyle(n,null).getPropertyValue("font-weight"))>=500&&(t=!0),this.removeClass(n,i.fontWeight.thin),this.removeClass(n,i.fontWeight.extralight),this.removeClass(n,i.fontWeight.light),this.removeClass(n,i.fontWeight.normal),this.removeClass(n,i.fontWeight.medium),this.removeClass(n,i.fontWeight.semibold),this.removeClass(n,i.fontWeight.bold),this.removeClass(n,i.fontWeight.extrabold),this.removeClass(n,i.fontWeight.black),t?this.addClass(n,i.fontWeight.defaultNormal):this.addClass(n,i.fontWeight.defaultBold)}if("fontStyle"===t){let t=!1;this.hasClass(n,i.fontStyle.italic)&&(t=!0),this.removeClass(n,i.fontStyle.italic),this.removeClass(n,i.fontStyle.normal),t?this.addClass(n,i.fontStyle.normal):this.addClass(n,i.fontStyle.italic)}if("textUnderline"===t){let t=!1;this.hasClass(n,i.textDecoration.underline)&&(t=!0),this.removeClass(n,i.textDecoration.underline),this.removeClass(n,i.textDecoration.linethrough),this.removeClass(n,i.textDecoration.normal),t?this.addClass(n,i.textDecoration.normal):this.addClass(n,i.textDecoration.underline)}if("textLinethrough"===t){let t=!1;this.hasClass(n,i.textDecoration.linethrough)&&(t=!0),this.removeClass(n,i.textDecoration.underline),this.removeClass(n,i.textDecoration.linethrough),this.removeClass(n,i.textDecoration.normal),t?this.addClass(n,i.textDecoration.normal):this.addClass(n,i.textDecoration.linethrough)}if("textTransform"===t){let t="";this.hasClass(n,i.textTransform.uppercase)&&(t="uppercase"),this.removeClass(n,i.textTransform.uppercase),this.removeClass(n,i.textTransform.lowercase),this.removeClass(n,i.textTransform.capitalize),this.removeClass(n,i.textTransform.normal),""===t&&this.addClass(n,i.textTransform.uppercase)}if("clean"===t&&(n.className="",n.style.cssText=""),"extend"===t){let t=!1;this.hasClass(n,i.extend[e])&&(t=!0),t?this.removeClass(n,i.extend[e]):this.addClass(n,i.extend[e])}return this.cleanChildrenToggle(t,e,n,i),this.cleanUnusedSpan(n),n}replaceSelectionToggle(t,e,i,n,o){const s=n.getRangeAt(0),l=s.extractContents(),a=document.createElement("span");if("fontWeight"===t){let t=!1;o.closest(`.${i.fontWeight.defaultBold}`)&&(t=!0,this.hasClass(o,i.fontWeight.defaultNormal)&&(t=!1));parseInt(window.getComputedStyle(o,null).getPropertyValue("font-weight"))>=500&&(t=!0),t?this.addClass(a,i.fontWeight.defaultNormal):this.addClass(a,i.fontWeight.defaultBold)}if("fontStyle"===t){let t=!1;o.closest(`.${i.fontStyle.italic}`)&&(t=!0,this.hasClass(o,i.fontStyle.normal)&&(t=!1)),t?this.addClass(a,i.fontStyle.normal):this.addClass(a,i.fontStyle.italic)}if("textUnderline"===t){let t=!1;o.closest(`.${i.textDecoration.underline}`)&&(t=!0),t||this.addClass(a,i.textDecoration.underline)}if("textLinethrough"===t){let t=!1;o.closest(`.${i.textDecoration.linethrough}`)&&(t=!0),t||this.addClass(a,i.textDecoration.linethrough)}if("textTransform"===t){let t="";o.closest(`.${i.textTransform.uppercase}`)&&(t="uppercase"),this.removeClass(a,i.textTransform.uppercase),this.removeClass(a,i.textTransform.lowercase),this.removeClass(a,i.textTransform.capitalize),this.removeClass(a,i.textTransform.normal),""===t&&this.addClass(a,i.textTransform.uppercase)}if("extend"===t){let t=!1;o.closest(`.${i.extend[e]}`)&&(t=!0),t||this.addClass(a,i.extend[e])}return a.appendChild(l),this.cleanChildrenToggle(t,e,a,i),this.cleanUnusedSpan(a),s.insertNode(a),n.selectAllChildren(a),a}cleanChildrenToggle(t,e,i,n){if(!i.hasChildNodes())return;"fontWeight"===t&&Array.from(i.children).map((t=>{this.removeClass(t,n.fontWeight.thin),this.removeClass(t,n.fontWeight.extralight),this.removeClass(t,n.fontWeight.light),this.removeClass(t,n.fontWeight.normal),this.removeClass(t,n.fontWeight.medium),this.removeClass(t,n.fontWeight.semibold),this.removeClass(t,n.fontWeight.bold),this.removeClass(t,n.fontWeight.extrabold),this.removeClass(t,n.fontWeight.black)})),"fontStyle"===t&&Array.from(i.children).map((t=>{this.removeClass(t,n.fontStyle.italic),this.removeClass(t,n.fontStyle.normal)})),"textUnderline"===t&&Array.from(i.children).map((t=>{this.removeClass(t,n.textDecoration.underline),this.removeClass(t,n.textDecoration.linethrough),this.removeClass(t,n.textDecoration.normal)})),"textLinethrough"===t&&Array.from(i.children).map((t=>{this.removeClass(t,n.textDecoration.underline),this.removeClass(t,n.textDecoration.linethrough),this.removeClass(t,n.textDecoration.normal)})),"textTransform"===t&&Array.from(i.children).map((t=>{this.removeClass(t,n.textTransform.uppercase),this.removeClass(t,n.textTransform.lowercase),this.removeClass(t,n.textTransform.capitalize),this.removeClass(t,n.textTransform.normal)})),"clean"===t&&Array.from(i.children).map((t=>{t.className="",t.style.cssText=""})),"extend"===t&&Array.from(i.children).map((t=>{this.removeClass(t,n.extend[e])}));const o=Array.from(i.children).map((i=>this.cleanChildrenToggle(t,e,i,n)));o&&o.length}getSelection(){return this.builder.win&&this.builder.win.getSelection?this.builder.win.getSelection():this.builder.doc&&this.builder.doc.getSelection?this.builder.doc.getSelection():this.builder.doc&&this.builder.doc.selection?this.builder.doc.selection.createRange().text:null}cleanChildren(t,e){if(!e.hasChildNodes())return;const i=Array.from(e.children).filter((e=>void 0!==e.style[t]&&""!==e.style[t.style]));i&&i.length>0&&i.forEach((e=>{e.style[t]="",""!==e.getAttribute("style")&&null!==e.style||e.removeAttribute("style")}));const n=Array.from(e.children).map((e=>this.cleanChildren(t,e)));n&&n.length}addCssClass(t,e,i){this.removeCssClasses(t,i),this.addClass(t,e)}removeCssClasses(t,e){for(let i=0;i<Object.keys(e).length;i++){const n=Object.values(e)[i];this.removeClass(t,n)}}removeEmptyStyle(t){if(!t.hasChildNodes())return;const e=Array.from(t.children).filter((t=>t.getAttribute("style")));e&&e.length>0&&e.forEach((t=>{""!==t.getAttribute("style").trim()&&null!==t.style||t.removeAttribute("style")}));const i=Array.from(t.children).map((t=>this.removeEmptyStyle(t)));i&&i.length}cleanClassSize(t,e){if(!t.hasChildNodes())return;const i=Array.from(t.children).filter((t=>this.hasClass(t,e)));i&&i.length>0&&i.forEach((t=>{this.removeClass(t,e)}));const n=Array.from(t.children).map((t=>this.cleanClassSize(t,e)));n&&n.length}removeFormat(){const t=this.getSelection();if(!t)return;const e=t.anchorNode;if(!e)return;const i=e.nodeType!==Node.TEXT_NODE&&e.nodeType!==Node.COMMENT_NODE?e:e.parentElement;i&&i.innerText===t.toString().trim()||""===t.toString().trim()?this.cleanElement(i):this.cleanSelection(t)}cleanElement(t){t.style.fontWeight="",t.style.fontStyle="",t.style.textDecoration="",t.style.textTransform="",t.style.fontFamily="",t.style.fontSize="",t.style.color="",t.style.backgroundColor="",t.classList.forEach((e=>{-1!==e.indexOf("size-")&&this.removeClass(t,e)})),t.querySelectorAll("*").forEach((t=>{t.style.fontWeight="",t.style.fontStyle="",t.style.textDecoration="",t.style.textTransform="",t.style.fontFamily="",t.style.fontSize="",t.style.color="",t.style.backgroundColor="",t.classList.forEach((e=>{-1!==e.indexOf("size-")&&this.removeClass(t,e)}))})),this.cleanUnusedSpan(t)}cleanSelection(t){const e=t.getRangeAt(0),i=e.extractContents(),n=document.createElement("span");n.appendChild(i),e.insertNode(n),t.selectAllChildren(n),this.cleanElement(n)}cleanUnusedSpan(t){let e=t.querySelectorAll("span");const i=Array.prototype.filter;let n=i.call(e,(t=>0===t.attributes.length));n&&n.length>0&&n.forEach((t=>{t.outerHTML=t.innerHTML})),e=t.querySelectorAll("span"),i.call(e,(t=>{""===t.innerHTML&&t.parentNode.removeChild(t)})),e=t.querySelectorAll("span"),n=i.call(e,(t=>0===t.attributes.length)),n&&n.length>0&&this.cleanUnusedSpan(t)}contentReformat(t,e){this.replaceTag(t,"b",e.fontWeight.defaultBold),this.replaceTag(t,"i",e.fontStyle.italic),this.replaceTag(t,"u",e.textDecoration.underline),this.replaceTag(t,"strike",e.textDecoration.linethrough),this.replaceInline(t,"font-weight","normal",e.fontWeight.defaultBold),this.replaceInline(t,"font-weight","bold",e.fontWeight.defaultBold),this.replaceInline(t,"font-weight","600",e.fontWeight.semibold),this.replaceInline(t,"text-align","left",e.textAlign.left),this.replaceInline(t,"text-align","right",e.textAlign.right),this.replaceInline(t,"text-align","center",e.textAlign.center),this.replaceInline(t,"text-align","justify",e.textAlign.justify),this.replaceInline(t,"display","flex",e.display.flex),this.replaceInline(t,"justiify-content","flex-start",e.justifyContent.start),this.replaceInline(t,"justiify-content","flex-end",e.justifyContent.end),this.replaceInline(t,"justiify-content","center",e.justifyContent.center),this.replaceInline(t,"justiify-content","space-between",e.justifyContent.between),this.replaceInline(t,"flex-direction","column",e.flexDirection.column),this.replaceInline(t,"flex-direction","row",e.flexDirection.row),this.replaceInline(t,"align-items","flex-start",e.alignItems.start),this.replaceInline(t,"align-items","flex-end",e.alignItems.end),this.replaceInline(t,"align-items","center",e.alignItems.center),this.replaceInline(t,"text-transform","uppercase",e.textTransform.uppercase),this.replaceInline(t,"text-transform","lowercase",e.textTransform.lowercase),this.replaceInline(t,"text-transform","none",e.textTransform.normal),this.replaceInline(t,"line-height","1",e.leading.leading_10),this.replaceInline(t,"line-height","1.1",e.leading.leading_11),this.replaceInline(t,"line-height","1.2",e.leading.leading_12),this.replaceInline(t,"line-height","1.25",e.leading.leading_125),this.replaceInline(t,"line-height","1.3",e.leading.leading_13),this.replaceInline(t,"line-height","1.375",e.leading.leading_1375),this.replaceInline(t,"line-height","1.4",e.leading.leading_14),this.replaceInline(t,"line-height","1.5",e.leading.leading_15),this.replaceInline(t,"line-height","1.6",e.leading.leading_16),this.replaceInline(t,"line-height","1.625",e.leading.leading_1625),this.replaceInline(t,"line-height","1.7",e.leading.leading_17),this.replaceInline(t,"line-height","1.8",e.leading.leading_18),this.replaceInline(t,"line-height","1.9",e.leading.leading_19),this.replaceInline(t,"line-height","2",e.leading.leading_20),this.replaceInline(t,"line-height","2.1",e.leading.leading_21),this.replaceInline(t,"line-height","2.2",e.leading.leading_22)}replaceTag(t,e,i){let n=t.querySelectorAll(e);let o=Array.prototype.filter.call(n,(t=>0===t.attributes.length));o&&o.length>0&&o.forEach((t=>{const e=document.createElement("span");e.setAttribute("class",i),e.innerHTML=t.innerHTML,t.outerHTML=e.outerHTML}))}replaceInline(t,e,i,n){t.querySelectorAll("*").forEach((t=>{"justiify-content"===e?t.style.justifyContent===`${i}`&&(this.addClass(t,n),t.style.justifyContent=""):t.style[e]===`${i}`&&(this.addClass(t,n),t.style[e]="")}))}countOccurrences(t,e){const i=new RegExp(e,"gi"),n=t.match(i);return n?n.length:0}}var ae="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},re={exports:{}},ce={},ue={exports:{}},de={},be={};function he(t){this.__parent=t,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}function pe(t,e){this.__cache=[""],this.__indent_size=t.indent_size,this.__indent_string=t.indent_char,t.indent_with_tabs||(this.__indent_string=new Array(t.indent_size+1).join(t.indent_char)),e=e||"",t.indent_level>0&&(e=new Array(t.indent_level+1).join(this.__indent_string)),this.__base_string=e,this.__base_string_length=e.length}function ge(t,e){this.__indent_cache=new pe(t,e),this.raw=!1,this._end_with_newline=t.end_with_newline,this.indent_size=t.indent_size,this.wrap_line_length=t.wrap_line_length,this.indent_empty_lines=t.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new he(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}he.prototype.clone_empty=function(){var t=new he(this.__parent);return t.set_indent(this.__indent_count,this.__alignment_count),t},he.prototype.item=function(t){return t<0?this.__items[this.__items.length+t]:this.__items[t]},he.prototype.has_match=function(t){for(var e=this.__items.length-1;e>=0;e--)if(this.__items[e].match(t))return!0;return!1},he.prototype.set_indent=function(t,e){this.is_empty()&&(this.__indent_count=t||0,this.__alignment_count=e||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},he.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},he.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},he.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var t=this.__parent.current_line;return t.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),t.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),t.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count," "===t.__items[0]&&(t.__items.splice(0,1),t.__character_count-=1),!0}return!1},he.prototype.is_empty=function(){return 0===this.__items.length},he.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},he.prototype.push=function(t){this.__items.push(t);var e=t.lastIndexOf("\n");-1!==e?this.__character_count=t.length-e:this.__character_count+=t.length},he.prototype.pop=function(){var t=null;return this.is_empty()||(t=this.__items.pop(),this.__character_count-=t.length),t},he.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},he.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},he.prototype.trim=function(){for(;" "===this.last();)this.__items.pop(),this.__character_count-=1},he.prototype.toString=function(){var t="";return this.is_empty()?this.__parent.indent_empty_lines&&(t=this.__parent.get_indent_string(this.__indent_count)):(t=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),t+=this.__items.join("")),t},pe.prototype.get_indent_size=function(t,e){var i=this.__base_string_length;return e=e||0,t<0&&(i=0),i+=t*this.__indent_size,i+=e},pe.prototype.get_indent_string=function(t,e){var i=this.__base_string;return e=e||0,t<0&&(t=0,i=""),e+=t*this.__indent_size,this.__ensure_cache(e),i+=this.__cache[e]},pe.prototype.__ensure_cache=function(t){for(;t>=this.__cache.length;)this.__add_column()},pe.prototype.__add_column=function(){var t=this.__cache.length,e=0,i="";this.__indent_size&&t>=this.__indent_size&&(t-=(e=Math.floor(t/this.__indent_size))*this.__indent_size,i=new Array(e+1).join(this.__indent_string)),t&&(i+=new Array(t+1).join(" ")),this.__cache.push(i)},ge.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},ge.prototype.get_line_number=function(){return this.__lines.length},ge.prototype.get_indent_string=function(t,e){return this.__indent_cache.get_indent_string(t,e)},ge.prototype.get_indent_size=function(t,e){return this.__indent_cache.get_indent_size(t,e)},ge.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},ge.prototype.add_new_line=function(t){return!(this.is_empty()||!t&&this.just_added_newline())&&(this.raw||this.__add_outputline(),!0)},ge.prototype.get_code=function(t){this.trim(!0);var e=this.current_line.pop();e&&("\n"===e[e.length-1]&&(e=e.replace(/\n+$/g,"")),this.current_line.push(e)),this._end_with_newline&&this.__add_outputline();var i=this.__lines.join("\n");return"\n"!==t&&(i=i.replace(/[\n]/g,t)),i},ge.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},ge.prototype.set_indent=function(t,e){return t=t||0,e=e||0,this.next_line.set_indent(t,e),this.__lines.length>1?(this.current_line.set_indent(t,e),!0):(this.current_line.set_indent(),!1)},ge.prototype.add_raw_token=function(t){for(var e=0;e<t.newlines;e++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(t.whitespace_before),this.current_line.push(t.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},ge.prototype.add_token=function(t){this.__add_space_before_token(),this.current_line.push(t),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},ge.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},ge.prototype.remove_indent=function(t){for(var e=this.__lines.length;t<e;)this.__lines[t]._remove_indent(),t++;this.current_line._remove_wrap_indent()},ge.prototype.trim=function(t){for(t=void 0!==t&&t,this.current_line.trim();t&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},ge.prototype.just_added_newline=function(){return this.current_line.is_empty()},ge.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},ge.prototype.ensure_empty_line_above=function(t,e){for(var i=this.__lines.length-2;i>=0;){var n=this.__lines[i];if(n.is_empty())break;if(0!==n.item(0).indexOf(t)&&n.item(-1)!==e){this.__lines.splice(i+1,0,new he(this)),this.previous_line=this.__lines[this.__lines.length-2];break}i--}},be.Output=ge;var me={};me.Token=function(t,e,i,n){this.type=t,this.text=e,this.comments_before=null,this.newlines=i||0,this.whitespace_before=n||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null};var fe,ve,ye,xe,we,Se,ke={};we="(?:\\\\u[0-9a-fA-F]{4}|[\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a"+(ye="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc")+"])",Se="(?:\\\\u[0-9a-fA-F]{4}|["+(ve="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a")+ye+(xe="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f")+"])*",(fe=ke).identifier=new RegExp(we+Se,"g"),fe.identifierStart=new RegExp(we),fe.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+ve+ye+xe+"])+"),fe.newline=/[\n\r\u2028\u2029]/,fe.lineBreak=new RegExp("\r\n|"+fe.newline.source),fe.allLineBreaks=new RegExp(fe.lineBreak.source,"g");var _e={},Ce={};function Ee(t,e){this.raw_options=Le(t,e),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs","\t"===this.indent_char),this.indent_with_tabs&&(this.indent_char="\t",1===this.indent_size&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}function Le(t,e){var i,n={};for(i in t=Ae(t))i!==e&&(n[i]=t[i]);if(e&&t[e])for(i in t[e])n[i]=t[e][i];return n}function Ae(t){var e,i={};for(e in t){i[e.replace(/-/g,"_")]=t[e]}return i}Ee.prototype._get_array=function(t,e){var i=this.raw_options[t],n=e||[];return"object"==typeof i?null!==i&&"function"==typeof i.concat&&(n=i.concat()):"string"==typeof i&&(n=i.split(/[^a-zA-Z0-9_\/\-]+/)),n},Ee.prototype._get_boolean=function(t,e){var i=this.raw_options[t];return void 0===i?!!e:!!i},Ee.prototype._get_characters=function(t,e){var i=this.raw_options[t],n=e||"";return"string"==typeof i&&(n=i.replace(/\\r/,"\r").replace(/\\n/,"\n").replace(/\\t/,"\t")),n},Ee.prototype._get_number=function(t,e){var i=this.raw_options[t];e=parseInt(e,10),isNaN(e)&&(e=0);var n=parseInt(i,10);return isNaN(n)&&(n=e),n},Ee.prototype._get_selection=function(t,e,i){var n=this._get_selection_list(t,e,i);if(1!==n.length)throw new Error("Invalid Option Value: The option '"+t+"' can only be one of the following values:\n"+e+"\nYou passed in: '"+this.raw_options[t]+"'");return n[0]},Ee.prototype._get_selection_list=function(t,e,i){if(!e||0===e.length)throw new Error("Selection list cannot be empty.");if(i=i||[e[0]],!this._is_valid_selection(i,e))throw new Error("Invalid Default Value!");var n=this._get_array(t,i);if(!this._is_valid_selection(n,e))throw new Error("Invalid Option Value: The option '"+t+"' can contain only the following values:\n"+e+"\nYou passed in: '"+this.raw_options[t]+"'");return n},Ee.prototype._is_valid_selection=function(t,e){return t.length&&e.length&&!t.some((function(t){return-1===e.indexOf(t)}))},Ce.Options=Ee,Ce.normalizeOpts=Ae,Ce.mergeOpts=Le;var qe=Ce.Options,Te=["before-newline","after-newline","preserve-newline"];function Me(t){qe.call(this,t,"js");var e=this.raw_options.brace_style||null;"expand-strict"===e?this.raw_options.brace_style="expand":"collapse-preserve-inline"===e?this.raw_options.brace_style="collapse,preserve-inline":void 0!==this.raw_options.braces_on_own_line&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var i=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var n=0;n<i.length;n++)"preserve-inline"===i[n]?this.brace_preserve_inline=!0:this.brace_style=i[n];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",Te),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}Me.prototype=new qe,_e.Options=Me;var Oe={},Re={},Ie=RegExp.prototype.hasOwnProperty("sticky");function ze(t){this.__input=t||"",this.__input_length=this.__input.length,this.__position=0}ze.prototype.restart=function(){this.__position=0},ze.prototype.back=function(){this.__position>0&&(this.__position-=1)},ze.prototype.hasNext=function(){return this.__position<this.__input_length},ze.prototype.next=function(){var t=null;return this.hasNext()&&(t=this.__input.charAt(this.__position),this.__position+=1),t},ze.prototype.peek=function(t){var e=null;return t=t||0,(t+=this.__position)>=0&&t<this.__input_length&&(e=this.__input.charAt(t)),e},ze.prototype.__match=function(t,e){t.lastIndex=e;var i=t.exec(this.__input);return!i||Ie&&t.sticky||i.index!==e&&(i=null),i},ze.prototype.test=function(t,e){return e=e||0,(e+=this.__position)>=0&&e<this.__input_length&&!!this.__match(t,e)},ze.prototype.testChar=function(t,e){var i=this.peek(e);return t.lastIndex=0,null!==i&&t.test(i)},ze.prototype.match=function(t){var e=this.__match(t,this.__position);return e?this.__position+=e[0].length:e=null,e},ze.prototype.read=function(t,e,i){var n,o="";return t&&(n=this.match(t))&&(o+=n[0]),!e||!n&&t||(o+=this.readUntil(e,i)),o},ze.prototype.readUntil=function(t,e){var i,n=this.__position;t.lastIndex=this.__position;var o=t.exec(this.__input);return o?(n=o.index,e&&(n+=o[0].length)):n=this.__input_length,i=this.__input.substring(this.__position,n),this.__position=n,i},ze.prototype.readUntilAfter=function(t){return this.readUntil(t,!0)},ze.prototype.get_regexp=function(t,e){var i=null,n="g";return e&&Ie&&(n="y"),"string"==typeof t&&""!==t?i=new RegExp(t,n):t&&(i=new RegExp(t.source,n)),i},ze.prototype.get_literal_regexp=function(t){return RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},ze.prototype.peekUntilAfter=function(t){var e=this.__position,i=this.readUntilAfter(t);return this.__position=e,i},ze.prototype.lookBack=function(t){var e=this.__position-1;return e>=t.length&&this.__input.substring(e-t.length,e).toLowerCase()===t},Re.InputScanner=ze;var Be={},Ne={};function De(t){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=t}De.prototype.restart=function(){this.__position=0},De.prototype.isEmpty=function(){return 0===this.__tokens_length},De.prototype.hasNext=function(){return this.__position<this.__tokens_length},De.prototype.next=function(){var t=null;return this.hasNext()&&(t=this.__tokens[this.__position],this.__position+=1),t},De.prototype.peek=function(t){var e=null;return t=t||0,(t+=this.__position)>=0&&t<this.__tokens_length&&(e=this.__tokens[t]),e},De.prototype.add=function(t){this.__parent_token&&(t.parent=this.__parent_token),this.__tokens.push(t),this.__tokens_length+=1},Ne.TokenStream=De;var Pe={},$e={};function He(t,e){this._input=t,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,e&&(this._starting_pattern=this._input.get_regexp(e._starting_pattern,!0),this._match_pattern=this._input.get_regexp(e._match_pattern,!0),this._until_pattern=this._input.get_regexp(e._until_pattern),this._until_after=e._until_after)}He.prototype.read=function(){var t=this._input.read(this._starting_pattern);return this._starting_pattern&&!t||(t+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),t},He.prototype.read_match=function(){return this._input.match(this._match_pattern)},He.prototype.until_after=function(t){var e=this._create();return e._until_after=!0,e._until_pattern=this._input.get_regexp(t),e._update(),e},He.prototype.until=function(t){var e=this._create();return e._until_after=!1,e._until_pattern=this._input.get_regexp(t),e._update(),e},He.prototype.starting_with=function(t){var e=this._create();return e._starting_pattern=this._input.get_regexp(t,!0),e._update(),e},He.prototype.matching=function(t){var e=this._create();return e._match_pattern=this._input.get_regexp(t,!0),e._update(),e},He.prototype._create=function(){return new He(this._input,this)},He.prototype._update=function(){},$e.Pattern=He;var Fe=$e.Pattern;function je(t,e){Fe.call(this,t,e),e?this._line_regexp=this._input.get_regexp(e._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}je.prototype=new Fe,je.prototype.__set_whitespace_patterns=function(t,e){t+="\\t ",e+="\\n\\r",this._match_pattern=this._input.get_regexp("["+t+e+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+e+"]")},je.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var t=this._input.read(this._match_pattern);if(" "===t)this.whitespace_before_token=" ";else if(t){var e=this.__split(this._newline_regexp,t);this.newline_count=e.length-1,this.whitespace_before_token=e[this.newline_count]}return t},je.prototype.matching=function(t,e){var i=this._create();return i.__set_whitespace_patterns(t,e),i._update(),i},je.prototype._create=function(){return new je(this._input,this)},je.prototype.__split=function(t,e){t.lastIndex=0;for(var i=0,n=[],o=t.exec(e);o;)n.push(e.substring(i,o.index)),i=o.index+o[0].length,o=t.exec(e);return i<e.length?n.push(e.substring(i,e.length)):n.push(""),n},Pe.WhitespacePattern=je;var Ue=Re.InputScanner,We=me.Token,Ge=Ne.TokenStream,Ve=Pe.WhitespacePattern,Ye={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},Xe=function(t,e){this._input=new Ue(t),this._options=e||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new Ve(this._input)};Xe.prototype.tokenize=function(){var t;this._input.restart(),this.__tokens=new Ge,this._reset();for(var e=new We(Ye.START,""),i=null,n=[],o=new Ge;e.type!==Ye.EOF;){for(t=this._get_next_token(e,i);this._is_comment(t);)o.add(t),t=this._get_next_token(e,i);o.isEmpty()||(t.comments_before=o,o=new Ge),t.parent=i,this._is_opening(t)?(n.push(i),i=t):i&&this._is_closing(t,i)&&(t.opened=i,i.closed=t,i=n.pop(),t.parent=i),t.previous=e,e.next=t,this.__tokens.add(t),e=t}return this.__tokens},Xe.prototype._is_first_token=function(){return this.__tokens.isEmpty()},Xe.prototype._reset=function(){},Xe.prototype._get_next_token=function(t,e){this._readWhitespace();var i=this._input.read(/.+/g);return i?this._create_token(Ye.RAW,i):this._create_token(Ye.EOF,"")},Xe.prototype._is_comment=function(t){return!1},Xe.prototype._is_opening=function(t){return!1},Xe.prototype._is_closing=function(t,e){return!1},Xe.prototype._create_token=function(t,e){return new We(t,e,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token)},Xe.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},Be.Tokenizer=Xe,Be.TOKEN=Ye;var Ze={};function Ke(t,e){t="string"==typeof t?t:t.source,e="string"==typeof e?e:e.source,this.__directives_block_pattern=new RegExp(t+/ beautify( \w+[:]\w+)+ /.source+e,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(t+/\sbeautify\signore:end\s/.source+e,"g")}Ke.prototype.get_directives=function(t){if(!t.match(this.__directives_block_pattern))return null;var e={};this.__directive_pattern.lastIndex=0;for(var i=this.__directive_pattern.exec(t);i;)e[i[1]]=i[2],i=this.__directive_pattern.exec(t);return e},Ke.prototype.readIgnored=function(t){return t.readUntilAfter(this.__directives_end_ignore_pattern)},Ze.Directives=Ke;var Qe={},Je=$e.Pattern,ti={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1};function ei(t,e){Je.call(this,t,e),this.__template_pattern=null,this._disabled=Object.assign({},ti),this._excluded=Object.assign({},ti),e&&(this.__template_pattern=this._input.get_regexp(e.__template_pattern),this._excluded=Object.assign(this._excluded,e._excluded),this._disabled=Object.assign(this._disabled,e._disabled));var i=new Je(t);this.__patterns={handlebars_comment:i.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:i.starting_with(/{{{/).until_after(/}}}/),handlebars:i.starting_with(/{{/).until_after(/}}/),php:i.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:i.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:i.starting_with(/{%/).until_after(/%}/),django_value:i.starting_with(/{{/).until_after(/}}/),django_comment:i.starting_with(/{#/).until_after(/#}/),smarty:i.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:i.starting_with(/{\*/).until_after(/\*}/),smarty_literal:i.starting_with(/{literal}/).until_after(/{\/literal}/)}}ei.prototype=new Je,ei.prototype._create=function(){return new ei(this._input,this)},ei.prototype._update=function(){this.__set_templated_pattern()},ei.prototype.disable=function(t){var e=this._create();return e._disabled[t]=!0,e._update(),e},ei.prototype.read_options=function(t){var e=this._create();for(var i in ti)e._disabled[i]=-1===t.templating.indexOf(i);return e._update(),e},ei.prototype.exclude=function(t){var e=this._create();return e._excluded[t]=!0,e._update(),e},ei.prototype.read=function(){var t="";t=this._match_pattern?this._input.read(this._starting_pattern):this._input.read(this._starting_pattern,this.__template_pattern);for(var e=this._read_template();e;)this._match_pattern?e+=this._input.read(this._match_pattern):e+=this._input.readUntil(this.__template_pattern),t+=e,e=this._read_template();return this._until_after&&(t+=this._input.readUntilAfter(this._until_pattern)),t},ei.prototype.__set_templated_pattern=function(){var t=[];this._disabled.php||t.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||t.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||t.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(t.push(this.__patterns.django._starting_pattern.source),t.push(this.__patterns.django_value._starting_pattern.source),t.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||t.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&t.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+t.join("|")+")")},ei.prototype._read_template=function(){var t="",e=this._input.peek();if("<"===e){var i=this._input.peek(1);this._disabled.php||this._excluded.php||"?"!==i||(t=t||this.__patterns.php.read()),this._disabled.erb||this._excluded.erb||"%"!==i||(t=t||this.__patterns.erb.read())}else"{"===e&&(this._disabled.handlebars||this._excluded.handlebars||(t=(t=(t=t||this.__patterns.handlebars_comment.read())||this.__patterns.handlebars_unescaped.read())||this.__patterns.handlebars.read()),this._disabled.django||(this._excluded.django||this._excluded.handlebars||(t=t||this.__patterns.django_value.read()),this._excluded.django||(t=(t=t||this.__patterns.django_comment.read())||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(t=(t=(t=t||this.__patterns.smarty_comment.read())||this.__patterns.smarty_literal.read())||this.__patterns.smarty.read()));return t},Qe.TemplatablePattern=ei;var ii=Re.InputScanner,ni=Be.Tokenizer,oi=Be.TOKEN,si=Ze.Directives,li=ke,ai=$e.Pattern,ri=Qe.TemplatablePattern;function ci(t,e){return-1!==e.indexOf(t)}var ui={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:oi.START,RAW:oi.RAW,EOF:oi.EOF},di=new si(/\/\*/,/\*\//),bi=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,hi=/[0-9]/,pi=/[^\d\.]/,gi=">>> === !== << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),mi=">>>= ... >>= <<= === >>> !== **= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";mi=(mi="\\?\\.(?!\\d) "+(mi=mi.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"))).replace(/ /g,"|");var fi,vi=new RegExp(mi),yi="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),xi=yi.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as"]),wi=new RegExp("^(?:"+xi.join("|")+")$"),Si=function(t,e){ni.call(this,t,e),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var i=new ai(this._input),n=new ri(this._input).read_options(this._options);this.__patterns={template:n,identifier:n.starting_with(li.identifier).matching(li.identifierMatch),number:i.matching(bi),punct:i.matching(vi),comment:i.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:i.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:i.matching(/<!--/),html_comment_end:i.matching(/-->/),include:i.starting_with(/#include/).until_after(li.lineBreak),shebang:i.starting_with(/#!/).until_after(li.lineBreak),xml:i.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[\s\S]+?}|!\[CDATA\[[\s\S]*?\]\]|)(\s+{[\s\S]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{[\s\S]+?}))*\s*(\/?)\s*>/),single_quote:n.until(/['\\\n\r\u2028\u2029]/),double_quote:n.until(/["\\\n\r\u2028\u2029]/),template_text:n.until(/[`\\$]/),template_expression:n.until(/[`}\\]/)}};(Si.prototype=new ni)._is_comment=function(t){return t.type===ui.COMMENT||t.type===ui.BLOCK_COMMENT||t.type===ui.UNKNOWN},Si.prototype._is_opening=function(t){return t.type===ui.START_BLOCK||t.type===ui.START_EXPR},Si.prototype._is_closing=function(t,e){return(t.type===ui.END_BLOCK||t.type===ui.END_EXPR)&&e&&("]"===t.text&&"["===e.text||")"===t.text&&"("===e.text||"}"===t.text&&"{"===e.text)},Si.prototype._reset=function(){fi=!1},Si.prototype._get_next_token=function(t,e){var i=null;this._readWhitespace();var n=this._input.peek();return null===n?this._create_token(ui.EOF,""):i=(i=(i=(i=(i=(i=(i=(i=(i=i||this._read_non_javascript(n))||this._read_string(n))||this._read_word(t))||this._read_singles(n))||this._read_comment(n))||this._read_regexp(n,t))||this._read_xml(n,t))||this._read_punctuation())||this._create_token(ui.UNKNOWN,this._input.next())},Si.prototype._read_word=function(t){var e;return""!==(e=this.__patterns.identifier.read())?(e=e.replace(li.allLineBreaks,"\n"),t.type!==ui.DOT&&(t.type!==ui.RESERVED||"set"!==t.text&&"get"!==t.text)&&wi.test(e)?"in"===e||"of"===e?this._create_token(ui.OPERATOR,e):this._create_token(ui.RESERVED,e):this._create_token(ui.WORD,e)):""!==(e=this.__patterns.number.read())?this._create_token(ui.WORD,e):void 0},Si.prototype._read_singles=function(t){var e=null;return"("===t||"["===t?e=this._create_token(ui.START_EXPR,t):")"===t||"]"===t?e=this._create_token(ui.END_EXPR,t):"{"===t?e=this._create_token(ui.START_BLOCK,t):"}"===t?e=this._create_token(ui.END_BLOCK,t):";"===t?e=this._create_token(ui.SEMICOLON,t):"."===t&&pi.test(this._input.peek(1))?e=this._create_token(ui.DOT,t):","===t&&(e=this._create_token(ui.COMMA,t)),e&&this._input.next(),e},Si.prototype._read_punctuation=function(){var t=this.__patterns.punct.read();if(""!==t)return"="===t?this._create_token(ui.EQUALS,t):"?."===t?this._create_token(ui.DOT,t):this._create_token(ui.OPERATOR,t)},Si.prototype._read_non_javascript=function(t){var e="";if("#"===t){if(this._is_first_token()&&(e=this.__patterns.shebang.read()))return this._create_token(ui.UNKNOWN,e.trim()+"\n");if(e=this.__patterns.include.read())return this._create_token(ui.UNKNOWN,e.trim()+"\n");t=this._input.next();var i="#";if(this._input.hasNext()&&this._input.testChar(hi)){do{i+=t=this._input.next()}while(this._input.hasNext()&&"#"!==t&&"="!==t);return"#"===t||("["===this._input.peek()&&"]"===this._input.peek(1)?(i+="[]",this._input.next(),this._input.next()):"{"===this._input.peek()&&"}"===this._input.peek(1)&&(i+="{}",this._input.next(),this._input.next())),this._create_token(ui.WORD,i)}this._input.back()}else if("<"===t&&this._is_first_token()){if(e=this.__patterns.html_comment_start.read()){for(;this._input.hasNext()&&!this._input.testChar(li.newline);)e+=this._input.next();return fi=!0,this._create_token(ui.COMMENT,e)}}else if(fi&&"-"===t&&(e=this.__patterns.html_comment_end.read()))return fi=!1,this._create_token(ui.COMMENT,e);return null},Si.prototype._read_comment=function(t){var e=null;if("/"===t){var i="";if("*"===this._input.peek(1)){i=this.__patterns.block_comment.read();var n=di.get_directives(i);n&&"start"===n.ignore&&(i+=di.readIgnored(this._input)),i=i.replace(li.allLineBreaks,"\n"),(e=this._create_token(ui.BLOCK_COMMENT,i)).directives=n}else"/"===this._input.peek(1)&&(i=this.__patterns.comment.read(),e=this._create_token(ui.COMMENT,i))}return e},Si.prototype._read_string=function(t){if("`"===t||"'"===t||'"'===t){var e=this._input.next();return this.has_char_escapes=!1,e+="`"===t?this._read_string_recursive("`",!0,"${"):this._read_string_recursive(t),this.has_char_escapes&&this._options.unescape_strings&&(e=function(t){var e="",i=0,n=new ii(t),o=null;for(;n.hasNext();)if((o=n.match(/([\s]|[^\\]|\\\\)+/g))&&(e+=o[0]),"\\"===n.peek()){if(n.next(),"x"===n.peek())o=n.match(/x([0-9A-Fa-f]{2})/g);else{if("u"!==n.peek()){e+="\\",n.hasNext()&&(e+=n.next());continue}o=n.match(/u([0-9A-Fa-f]{4})/g)}if(!o)return t;if((i=parseInt(o[1],16))>126&&i<=255&&0===o[0].indexOf("x"))return t;if(i>=0&&i<32){e+="\\"+o[0];continue}e+=34===i||39===i||92===i?"\\"+String.fromCharCode(i):String.fromCharCode(i)}return e}(e)),this._input.peek()===t&&(e+=this._input.next()),e=e.replace(li.allLineBreaks,"\n"),this._create_token(ui.STRING,e)}return null},Si.prototype._allow_regexp_or_xml=function(t){return t.type===ui.RESERVED&&ci(t.text,["return","case","throw","else","do","typeof","yield"])||t.type===ui.END_EXPR&&")"===t.text&&t.opened.previous.type===ui.RESERVED&&ci(t.opened.previous.text,["if","while","for"])||ci(t.type,[ui.COMMENT,ui.START_EXPR,ui.START_BLOCK,ui.START,ui.END_BLOCK,ui.OPERATOR,ui.EQUALS,ui.EOF,ui.SEMICOLON,ui.COMMA])},Si.prototype._read_regexp=function(t,e){if("/"===t&&this._allow_regexp_or_xml(e)){for(var i=this._input.next(),n=!1,o=!1;this._input.hasNext()&&(n||o||this._input.peek()!==t)&&!this._input.testChar(li.newline);)i+=this._input.peek(),n?n=!1:(n="\\"===this._input.peek(),"["===this._input.peek()?o=!0:"]"===this._input.peek()&&(o=!1)),this._input.next();return this._input.peek()===t&&(i+=this._input.next(),i+=this._input.read(li.identifier)),this._create_token(ui.STRING,i)}return null},Si.prototype._read_xml=function(t,e){if(this._options.e4x&&"<"===t&&this._allow_regexp_or_xml(e)){var i="",n=this.__patterns.xml.read_match();if(n){for(var o=n[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),s=0===o.indexOf("{"),l=0;n;){var a=!!n[1],r=n[2];if(!(!!n[n.length-1]||"![CDATA["===r.slice(0,8))&&(r===o||s&&r.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(a?--l:++l),i+=n[0],l<=0)break;n=this.__patterns.xml.read_match()}return n||(i+=this._input.match(/[\s\S]*/g)[0]),i=i.replace(li.allLineBreaks,"\n"),this._create_token(ui.STRING,i)}}return null},Si.prototype._read_string_recursive=function(t,e,i){var n,o;"'"===t?o=this.__patterns.single_quote:'"'===t?o=this.__patterns.double_quote:"`"===t?o=this.__patterns.template_text:"}"===t&&(o=this.__patterns.template_expression);for(var s=o.read(),l="";this._input.hasNext();){if((l=this._input.next())===t||!e&&li.newline.test(l)){this._input.back();break}"\\"===l&&this._input.hasNext()?("x"===(n=this._input.peek())||"u"===n?this.has_char_escapes=!0:"\r"===n&&"\n"===this._input.peek(1)&&this._input.next(),l+=this._input.next()):i&&("${"===i&&"$"===l&&"{"===this._input.peek()&&(l+=this._input.next()),i===l&&(l+="`"===t?this._read_string_recursive("}",e,"`"):this._read_string_recursive("`",e,"${"),this._input.hasNext()&&(l+=this._input.next()))),s+=l+=o.read()}return s},Oe.Tokenizer=Si,Oe.TOKEN=ui,Oe.positionable_operators=gi.slice(),Oe.line_starters=yi.slice();var ki=be.Output,_i=me.Token,Ci=ke,Ei=_e.Options,Li=Oe.Tokenizer,Ai=Oe.line_starters,qi=Oe.positionable_operators,Ti=Oe.TOKEN;function Mi(t,e){return-1!==e.indexOf(t)}function Oi(t,e){return t&&t.type===Ti.RESERVED&&t.text===e}function Ri(t,e){return t&&t.type===Ti.RESERVED&&Mi(t.text,e)}var Ii=["case","return","do","if","throw","else","await","break","continue","async"],zi=function(t){for(var e={},i=0;i<t.length;i++)e[t[i].replace(/-/g,"_")]=t[i];return e}(["before-newline","after-newline","preserve-newline"]),Bi=[zi.before_newline,zi.preserve_newline],Ni={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function Di(t,e){e.multiline_frame||e.mode===Ni.ForInitializer||e.mode===Ni.Conditional||t.remove_indent(e.start_line_index)}function Pi(t){return t===Ni.ArrayLiteral}function $i(t){return Mi(t,[Ni.Expression,Ni.ForInitializer,Ni.Conditional])}function Hi(t,e){e=e||{},this._source_text=t||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new Ei(e)}Hi.prototype.create_flags=function(t,e){var i=0;return t&&(i=t.indentation_level,!this._output.just_added_newline()&&t.line_indent_level>i&&(i=t.line_indent_level)),{mode:e,parent:t,last_token:t?t.last_token:new _i(Ti.START_BLOCK,""),last_word:t?t.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,indentation_level:i,alignment:0,line_indent_level:t?t.line_indent_level:i,start_line_index:this._output.get_line_number(),ternary_depth:0}},Hi.prototype._reset=function(t){var e=t.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new ki(this._options,e),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(Ni.BlockStatement);var i=new Li(t,this._options);return this._tokens=i.tokenize(),t},Hi.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var t=this._reset(this._source_text),e=this._options.eol;"auto"===this._options.eol&&(e="\n",t&&Ci.lineBreak.test(t||"")&&(e=t.match(Ci.lineBreak)[0]));for(var i=this._tokens.next();i;)this.handle_token(i),this._last_last_text=this._flags.last_token.text,this._flags.last_token=i,i=this._tokens.next();return this._output.get_code(e)},Hi.prototype.handle_token=function(t,e){t.type===Ti.START_EXPR?this.handle_start_expr(t):t.type===Ti.END_EXPR?this.handle_end_expr(t):t.type===Ti.START_BLOCK?this.handle_start_block(t):t.type===Ti.END_BLOCK?this.handle_end_block(t):t.type===Ti.WORD||t.type===Ti.RESERVED?this.handle_word(t):t.type===Ti.SEMICOLON?this.handle_semicolon(t):t.type===Ti.STRING?this.handle_string(t):t.type===Ti.EQUALS?this.handle_equals(t):t.type===Ti.OPERATOR?this.handle_operator(t):t.type===Ti.COMMA?this.handle_comma(t):t.type===Ti.BLOCK_COMMENT?this.handle_block_comment(t,e):t.type===Ti.COMMENT?this.handle_comment(t,e):t.type===Ti.DOT?this.handle_dot(t):t.type===Ti.EOF?this.handle_eof(t):(t.type,Ti.UNKNOWN,this.handle_unknown(t,e))},Hi.prototype.handle_whitespace_and_comments=function(t,e){var i=t.newlines,n=this._options.keep_array_indentation&&Pi(this._flags.mode);if(t.comments_before)for(var o=t.comments_before.next();o;)this.handle_whitespace_and_comments(o,e),this.handle_token(o,e),o=t.comments_before.next();if(n)for(var s=0;s<i;s+=1)this.print_newline(s>0,e);else if(this._options.max_preserve_newlines&&i>this._options.max_preserve_newlines&&(i=this._options.max_preserve_newlines),this._options.preserve_newlines&&i>1){this.print_newline(!1,e);for(var l=1;l<i;l+=1)this.print_newline(!0,e)}};var Fi=["async","break","continue","return","throw","yield"];Hi.prototype.allow_wrap_or_preserved_newline=function(t,e){if(e=void 0!==e&&e,!this._output.just_added_newline()){var i=this._options.preserve_newlines&&t.newlines||e;if(Mi(this._flags.last_token.text,qi)||Mi(t.text,qi)){var n=Mi(this._flags.last_token.text,qi)&&Mi(this._options.operator_position,Bi)||Mi(t.text,qi);i=i&&n}if(i)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(Ri(this._flags.last_token,Fi))return;this._output.set_wrap_point()}}},Hi.prototype.print_newline=function(t,e){if(!e&&";"!==this._flags.last_token.text&&","!==this._flags.last_token.text&&"="!==this._flags.last_token.text&&(this._flags.last_token.type!==Ti.OPERATOR||"--"===this._flags.last_token.text||"++"===this._flags.last_token.text))for(var i=this._tokens.peek();!(this._flags.mode!==Ni.Statement||this._flags.if_block&&Oi(i,"else")||this._flags.do_block);)this.restore_mode();this._output.add_new_line(t)&&(this._flags.multiline_frame=!0)},Hi.prototype.print_token_line_indentation=function(t){this._output.just_added_newline()&&(this._options.keep_array_indentation&&t.newlines&&("["===t.text||Pi(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(t.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},Hi.prototype.print_token=function(t){if(this._output.raw)this._output.add_raw_token(t);else{if(this._options.comma_first&&t.previous&&t.previous.type===Ti.COMMA&&this._output.just_added_newline()&&","===this._output.previous_line.last()){var e=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(e),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(t),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(t),this._output.non_breaking_space=!0,this._output.add_token(t.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)}},Hi.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},Hi.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},Hi.prototype.set_mode=function(t){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,t),this._flags=this.create_flags(this._previous_flags,t),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},Hi.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===Ni.Statement&&Di(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},Hi.prototype.start_of_object_property=function(){return this._flags.parent.mode===Ni.ObjectLiteral&&this._flags.mode===Ni.Statement&&(":"===this._flags.last_token.text&&0===this._flags.ternary_depth||Ri(this._flags.last_token,["get","set"]))},Hi.prototype.start_of_statement=function(t){var e=!1;return!!(e=(e=(e=(e=(e=(e=(e=e||Ri(this._flags.last_token,["var","let","const"])&&t.type===Ti.WORD)||Oi(this._flags.last_token,"do"))||!(this._flags.parent.mode===Ni.ObjectLiteral&&this._flags.mode===Ni.Statement)&&Ri(this._flags.last_token,Fi)&&!t.newlines)||Oi(this._flags.last_token,"else")&&!(Oi(t,"if")&&!t.comments_before))||this._flags.last_token.type===Ti.END_EXPR&&(this._previous_flags.mode===Ni.ForInitializer||this._previous_flags.mode===Ni.Conditional))||this._flags.last_token.type===Ti.WORD&&this._flags.mode===Ni.BlockStatement&&!this._flags.in_case&&!("--"===t.text||"++"===t.text)&&"function"!==this._last_last_text&&t.type!==Ti.WORD&&t.type!==Ti.RESERVED)||this._flags.mode===Ni.ObjectLiteral&&(":"===this._flags.last_token.text&&0===this._flags.ternary_depth||Ri(this._flags.last_token,["get","set"])))&&(this.set_mode(Ni.Statement),this.indent(),this.handle_whitespace_and_comments(t,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(t,Ri(t,["do","for","if","while"])),!0)},Hi.prototype.handle_start_expr=function(t){this.start_of_statement(t)||this.handle_whitespace_and_comments(t);var e=Ni.Expression;if("["===t.text){if(this._flags.last_token.type===Ti.WORD||")"===this._flags.last_token.text)return Ri(this._flags.last_token,Ai)&&(this._output.space_before_token=!0),this.print_token(t),this.set_mode(e),this.indent(),void(this._options.space_in_paren&&(this._output.space_before_token=!0));e=Ni.ArrayLiteral,Pi(this._flags.mode)&&("["!==this._flags.last_token.text&&(","!==this._flags.last_token.text||"]"!==this._last_last_text&&"}"!==this._last_last_text)||this._options.keep_array_indentation||this.print_newline()),Mi(this._flags.last_token.type,[Ti.START_EXPR,Ti.END_EXPR,Ti.WORD,Ti.OPERATOR,Ti.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===Ti.RESERVED)"for"===this._flags.last_token.text?(this._output.space_before_token=this._options.space_before_conditional,e=Ni.ForInitializer):Mi(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,e=Ni.Conditional):Mi(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:"import"===this._flags.last_token.text&&""===t.whitespace_before?this._output.space_before_token=!1:(Mi(this._flags.last_token.text,Ai)||"catch"===this._flags.last_token.text)&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===Ti.EQUALS||this._flags.last_token.type===Ti.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(t);else if(this._flags.last_token.type===Ti.WORD){this._output.space_before_token=!1;var i=this._tokens.peek(-3);if(this._options.space_after_named_function&&i){var n=this._tokens.peek(-4);Ri(i,["async","function"])||"*"===i.text&&Ri(n,["async","function"])?this._output.space_before_token=!0:this._flags.mode===Ni.ObjectLiteral&&("{"!==i.text&&","!==i.text&&("*"!==i.text||"{"!==n.text&&","!==n.text)||(this._output.space_before_token=!0))}}else this.allow_wrap_or_preserved_newline(t);(this._flags.last_token.type===Ti.RESERVED&&("function"===this._flags.last_word||"typeof"===this._flags.last_word)||"*"===this._flags.last_token.text&&(Mi(this._last_last_text,["function","yield"])||this._flags.mode===Ni.ObjectLiteral&&Mi(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}";"===this._flags.last_token.text||this._flags.last_token.type===Ti.START_BLOCK?this.print_newline():this._flags.last_token.type!==Ti.END_EXPR&&this._flags.last_token.type!==Ti.START_EXPR&&this._flags.last_token.type!==Ti.END_BLOCK&&"."!==this._flags.last_token.text&&this._flags.last_token.type!==Ti.COMMA||this.allow_wrap_or_preserved_newline(t,t.newlines),this.print_token(t),this.set_mode(e),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},Hi.prototype.handle_end_expr=function(t){for(;this._flags.mode===Ni.Statement;)this.restore_mode();this.handle_whitespace_and_comments(t),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(t,"]"===t.text&&Pi(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type!==Ti.START_EXPR||this._options.space_in_empty_paren?this._output.space_before_token=!0:(this._output.trim(),this._output.space_before_token=!1)),this.deindent(),this.print_token(t),this.restore_mode(),Di(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===Ni.Conditional&&(this._previous_flags.mode=Ni.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},Hi.prototype.handle_start_block=function(t){this.handle_whitespace_and_comments(t);var e=this._tokens.peek(),i=this._tokens.peek(1);"switch"===this._flags.last_word&&this._flags.last_token.type===Ti.END_EXPR?(this.set_mode(Ni.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(Ni.BlockStatement):i&&(Mi(i.text,[":",","])&&Mi(e.type,[Ti.STRING,Ti.WORD,Ti.RESERVED])||Mi(e.text,["get","set","..."])&&Mi(i.type,[Ti.WORD,Ti.RESERVED]))?Mi(this._last_last_text,["class","interface"])?this.set_mode(Ni.BlockStatement):this.set_mode(Ni.ObjectLiteral):this._flags.last_token.type===Ti.OPERATOR&&"=>"===this._flags.last_token.text?this.set_mode(Ni.BlockStatement):Mi(this._flags.last_token.type,[Ti.EQUALS,Ti.START_EXPR,Ti.COMMA,Ti.OPERATOR])||Ri(this._flags.last_token,["return","throw","import","default"])?this.set_mode(Ni.ObjectLiteral):this.set_mode(Ni.BlockStatement);var n=!e.comments_before&&"}"===e.text,o=n&&"function"===this._flags.last_word&&this._flags.last_token.type===Ti.END_EXPR;if(this._options.brace_preserve_inline){var s=0,l=null;this._flags.inline_frame=!0;do{if(s+=1,(l=this._tokens.peek(s-1)).newlines){this._flags.inline_frame=!1;break}}while(l.type!==Ti.EOF&&(l.type!==Ti.END_BLOCK||l.opened!==t))}("expand"===this._options.brace_style||"none"===this._options.brace_style&&t.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==Ti.OPERATOR&&(o||this._flags.last_token.type===Ti.EQUALS||Ri(this._flags.last_token,Ii)&&"else"!==this._flags.last_token.text)?this._output.space_before_token=!0:this.print_newline(!1,!0):(!Pi(this._previous_flags.mode)||this._flags.last_token.type!==Ti.START_EXPR&&this._flags.last_token.type!==Ti.COMMA||((this._flags.last_token.type===Ti.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===Ti.COMMA||this._flags.last_token.type===Ti.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(t),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==Ti.OPERATOR&&this._flags.last_token.type!==Ti.START_EXPR&&(this._flags.last_token.type!==Ti.START_BLOCK||this._flags.inline_frame?this._output.space_before_token=!0:this.print_newline())),this.print_token(t),this.indent(),n||this._options.brace_preserve_inline&&this._flags.inline_frame||this.print_newline()},Hi.prototype.handle_end_block=function(t){for(this.handle_whitespace_and_comments(t);this._flags.mode===Ni.Statement;)this.restore_mode();var e=this._flags.last_token.type===Ti.START_BLOCK;this._flags.inline_frame&&!e?this._output.space_before_token=!0:"expand"===this._options.brace_style?e||this.print_newline():e||(Pi(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(t)},Hi.prototype.handle_word=function(t){if(t.type===Ti.RESERVED)if(Mi(t.text,["set","get"])&&this._flags.mode!==Ni.ObjectLiteral)t.type=Ti.WORD;else if("import"===t.text&&"("===this._tokens.peek().text)t.type=Ti.WORD;else if(Mi(t.text,["as","from"])&&!this._flags.import_block)t.type=Ti.WORD;else if(this._flags.mode===Ni.ObjectLiteral){":"===this._tokens.peek().text&&(t.type=Ti.WORD)}if(this.start_of_statement(t)?Ri(this._flags.last_token,["var","let","const"])&&t.type===Ti.WORD&&(this._flags.declaration_statement=!0):!t.newlines||$i(this._flags.mode)||this._flags.last_token.type===Ti.OPERATOR&&"--"!==this._flags.last_token.text&&"++"!==this._flags.last_token.text||this._flags.last_token.type===Ti.EQUALS||!this._options.preserve_newlines&&Ri(this._flags.last_token,["var","let","const","set","get"])?this.handle_whitespace_and_comments(t):(this.handle_whitespace_and_comments(t),this.print_newline()),this._flags.do_block&&!this._flags.do_while){if(Oi(t,"while"))return this._output.space_before_token=!0,this.print_token(t),this._output.space_before_token=!0,void(this._flags.do_while=!0);this.print_newline(),this._flags.do_block=!1}if(this._flags.if_block)if(!this._flags.else_block&&Oi(t,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===Ni.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&Ri(t,["case","default"]))return this.print_newline(),this._flags.last_token.type!==Ti.END_BLOCK&&(this._flags.case_body||this._options.jslint_happy)&&this.deindent(),this._flags.case_body=!1,this.print_token(t),void(this._flags.in_case=!0);if(this._flags.last_token.type!==Ti.COMMA&&this._flags.last_token.type!==Ti.START_EXPR&&this._flags.last_token.type!==Ti.EQUALS&&this._flags.last_token.type!==Ti.OPERATOR||this.start_of_object_property()||this.allow_wrap_or_preserved_newline(t),Oi(t,"function"))return(Mi(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!Mi(this._flags.last_token.text,["(","[","{",":","=",","])&&this._flags.last_token.type!==Ti.OPERATOR)&&(this._output.just_added_blankline()||t.comments_before||(this.print_newline(),this.print_newline(!0))),this._flags.last_token.type===Ti.RESERVED||this._flags.last_token.type===Ti.WORD?Ri(this._flags.last_token,["get","set","new","export"])||Ri(this._flags.last_token,Fi)||Oi(this._flags.last_token,"default")&&"export"===this._last_last_text||"declare"===this._flags.last_token.text?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===Ti.OPERATOR||"="===this._flags.last_token.text?this._output.space_before_token=!0:(this._flags.multiline_frame||!$i(this._flags.mode)&&!Pi(this._flags.mode))&&this.print_newline(),this.print_token(t),void(this._flags.last_word=t.text);var e="NONE";(this._flags.last_token.type===Ti.END_BLOCK?this._previous_flags.inline_frame?e="SPACE":Ri(t,["else","catch","finally","from"])?"expand"===this._options.brace_style||"end-expand"===this._options.brace_style||"none"===this._options.brace_style&&t.newlines?e="NEWLINE":(e="SPACE",this._output.space_before_token=!0):e="NEWLINE":this._flags.last_token.type===Ti.SEMICOLON&&this._flags.mode===Ni.BlockStatement?e="NEWLINE":this._flags.last_token.type===Ti.SEMICOLON&&$i(this._flags.mode)?e="SPACE":this._flags.last_token.type===Ti.STRING?e="NEWLINE":this._flags.last_token.type===Ti.RESERVED||this._flags.last_token.type===Ti.WORD||"*"===this._flags.last_token.text&&(Mi(this._last_last_text,["function","yield"])||this._flags.mode===Ni.ObjectLiteral&&Mi(this._last_last_text,["{",","]))?e="SPACE":this._flags.last_token.type===Ti.START_BLOCK?e=this._flags.inline_frame?"SPACE":"NEWLINE":this._flags.last_token.type===Ti.END_EXPR&&(this._output.space_before_token=!0,e="NEWLINE"),Ri(t,Ai)&&")"!==this._flags.last_token.text&&(e=this._flags.inline_frame||"else"===this._flags.last_token.text||"export"===this._flags.last_token.text?"SPACE":"NEWLINE"),Ri(t,["else","catch","finally"]))?(this._flags.last_token.type!==Ti.END_BLOCK||this._previous_flags.mode!==Ni.BlockStatement||"expand"===this._options.brace_style||"end-expand"===this._options.brace_style||"none"===this._options.brace_style&&t.newlines)&&!this._flags.inline_frame?this.print_newline():(this._output.trim(!0),"}"!==this._output.current_line.last()&&this.print_newline(),this._output.space_before_token=!0):"NEWLINE"===e?Ri(this._flags.last_token,Ii)||"declare"===this._flags.last_token.text&&Ri(t,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==Ti.END_EXPR?this._flags.last_token.type===Ti.START_EXPR&&Ri(t,["var","let","const"])||":"===this._flags.last_token.text||(Oi(t,"if")&&Oi(t.previous,"else")?this._output.space_before_token=!0:this.print_newline()):Ri(t,Ai)&&")"!==this._flags.last_token.text&&this.print_newline():this._flags.multiline_frame&&Pi(this._flags.mode)&&","===this._flags.last_token.text&&"}"===this._last_last_text?this.print_newline():"SPACE"===e&&(this._output.space_before_token=!0);!t.previous||t.previous.type!==Ti.WORD&&t.previous.type!==Ti.RESERVED||(this._output.space_before_token=!0),this.print_token(t),this._flags.last_word=t.text,t.type===Ti.RESERVED&&("do"===t.text?this._flags.do_block=!0:"if"===t.text?this._flags.if_block=!0:"import"===t.text?this._flags.import_block=!0:this._flags.import_block&&Oi(t,"from")&&(this._flags.import_block=!1))},Hi.prototype.handle_semicolon=function(t){this.start_of_statement(t)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(t);for(var e=this._tokens.peek();!(this._flags.mode!==Ni.Statement||this._flags.if_block&&Oi(e,"else")||this._flags.do_block);)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(t)},Hi.prototype.handle_string=function(t){(!t.text.startsWith("`")||0!==t.newlines||""!==t.whitespace_before||")"!==t.previous.text&&this._flags.last_token.type!==Ti.WORD)&&(this.start_of_statement(t)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(t),this._flags.last_token.type===Ti.RESERVED||this._flags.last_token.type===Ti.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===Ti.COMMA||this._flags.last_token.type===Ti.START_EXPR||this._flags.last_token.type===Ti.EQUALS||this._flags.last_token.type===Ti.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(t):!t.text.startsWith("`")||this._flags.last_token.type!==Ti.END_EXPR||"]"!==t.previous.text&&")"!==t.previous.text||0!==t.newlines?this.print_newline():this._output.space_before_token=!0)),this.print_token(t)},Hi.prototype.handle_equals=function(t){this.start_of_statement(t)||this.handle_whitespace_and_comments(t),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(t),this._output.space_before_token=!0},Hi.prototype.handle_comma=function(t){this.handle_whitespace_and_comments(t,!0),this.print_token(t),this._output.space_before_token=!0,this._flags.declaration_statement?($i(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(t)):this._flags.mode===Ni.ObjectLiteral||this._flags.mode===Ni.Statement&&this._flags.parent.mode===Ni.ObjectLiteral?(this._flags.mode===Ni.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(t)},Hi.prototype.handle_operator=function(t){var e="*"===t.text&&(Ri(this._flags.last_token,["function","yield"])||Mi(this._flags.last_token.type,[Ti.START_BLOCK,Ti.COMMA,Ti.END_BLOCK,Ti.SEMICOLON])),i=Mi(t.text,["-","+"])&&(Mi(this._flags.last_token.type,[Ti.START_BLOCK,Ti.START_EXPR,Ti.EQUALS,Ti.OPERATOR])||Mi(this._flags.last_token.text,Ai)||","===this._flags.last_token.text);if(this.start_of_statement(t));else{var n=!e;this.handle_whitespace_and_comments(t,n)}if(Ri(this._flags.last_token,Ii))return this._output.space_before_token=!0,void this.print_token(t);if("*"!==t.text||this._flags.last_token.type!==Ti.DOT)if("::"!==t.text){if(this._flags.last_token.type===Ti.OPERATOR&&Mi(this._options.operator_position,Bi)&&this.allow_wrap_or_preserved_newline(t),":"===t.text&&this._flags.in_case)return this.print_token(t),this._flags.in_case=!1,this._flags.case_body=!0,void(this._tokens.peek().type!==Ti.START_BLOCK?(this.indent(),this.print_newline()):this._output.space_before_token=!0);var o=!0,s=!0,l=!1;if(":"===t.text?0===this._flags.ternary_depth?o=!1:(this._flags.ternary_depth-=1,l=!0):"?"===t.text&&(this._flags.ternary_depth+=1),!i&&!e&&this._options.preserve_newlines&&Mi(t.text,qi)){var a=":"===t.text,r=a&&l,c=a&&!l;switch(this._options.operator_position){case zi.before_newline:return this._output.space_before_token=!c,this.print_token(t),a&&!r||this.allow_wrap_or_preserved_newline(t),void(this._output.space_before_token=!0);case zi.after_newline:return this._output.space_before_token=!0,!a||r?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(t):this._output.space_before_token=!1,this.print_token(t),void(this._output.space_before_token=!0);case zi.preserve_newline:return c||this.allow_wrap_or_preserved_newline(t),o=!(this._output.just_added_newline()||c),this._output.space_before_token=o,this.print_token(t),void(this._output.space_before_token=!0)}}if(e){this.allow_wrap_or_preserved_newline(t),o=!1;var u=this._tokens.peek();s=u&&Mi(u.type,[Ti.WORD,Ti.RESERVED])}else"..."===t.text?(this.allow_wrap_or_preserved_newline(t),o=this._flags.last_token.type===Ti.START_BLOCK,s=!1):(Mi(t.text,["--","++","!","~"])||i)&&(this._flags.last_token.type!==Ti.COMMA&&this._flags.last_token.type!==Ti.START_EXPR||this.allow_wrap_or_preserved_newline(t),o=!1,s=!1,!t.newlines||"--"!==t.text&&"++"!==t.text||this.print_newline(!1,!0),";"===this._flags.last_token.text&&$i(this._flags.mode)&&(o=!0),this._flags.last_token.type===Ti.RESERVED?o=!0:this._flags.last_token.type===Ti.END_EXPR?o=!("]"===this._flags.last_token.text&&("--"===t.text||"++"===t.text)):this._flags.last_token.type===Ti.OPERATOR&&(o=Mi(t.text,["--","-","++","+"])&&Mi(this._flags.last_token.text,["--","-","++","+"]),Mi(t.text,["+","-"])&&Mi(this._flags.last_token.text,["--","++"])&&(s=!0)),(this._flags.mode!==Ni.BlockStatement||this._flags.inline_frame)&&this._flags.mode!==Ni.Statement||"{"!==this._flags.last_token.text&&";"!==this._flags.last_token.text||this.print_newline());this._output.space_before_token=this._output.space_before_token||o,this.print_token(t),this._output.space_before_token=s}else this.print_token(t);else this.print_token(t)},Hi.prototype.handle_block_comment=function(t,e){return this._output.raw?(this._output.add_raw_token(t),void(t.directives&&"end"===t.directives.preserve&&(this._output.raw=this._options.test_output_raw))):t.directives?(this.print_newline(!1,e),this.print_token(t),"start"===t.directives.preserve&&(this._output.raw=!0),void this.print_newline(!1,!0)):Ci.newline.test(t.text)||t.newlines?void this.print_block_commment(t,e):(this._output.space_before_token=!0,this.print_token(t),void(this._output.space_before_token=!0))},Hi.prototype.print_block_commment=function(t,e){var i,n=function(t){for(var e=[],i=(t=t.replace(Ci.allLineBreaks,"\n")).indexOf("\n");-1!==i;)e.push(t.substring(0,i)),i=(t=t.substring(i+1)).indexOf("\n");return t.length&&e.push(t),e}(t.text),o=!1,s=!1,l=t.whitespace_before,a=l.length;if(this.print_newline(!1,e),this.print_token_line_indentation(t),this._output.add_token(n[0]),this.print_newline(!1,e),n.length>1){for(o=function(t,e){for(var i=0;i<t.length;i++)if(t[i].trim().charAt(0)!==e)return!1;return!0}(n=n.slice(1),"*"),s=function(t,e){for(var i,n=0,o=t.length;n<o;n++)if((i=t[n])&&0!==i.indexOf(e))return!1;return!0}(n,l),o&&(this._flags.alignment=1),i=0;i<n.length;i++)o?(this.print_token_line_indentation(t),this._output.add_token(n[i].replace(/^\s+/g,""))):s&&n[i]?(this.print_token_line_indentation(t),this._output.add_token(n[i].substring(a))):(this._output.current_line.set_indent(-1),this._output.add_token(n[i])),this.print_newline(!1,e);this._flags.alignment=0}},Hi.prototype.handle_comment=function(t,e){t.newlines?this.print_newline(!1,e):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(t),this.print_newline(!1,e)},Hi.prototype.handle_dot=function(t){this.start_of_statement(t)||this.handle_whitespace_and_comments(t,!0),Ri(this._flags.last_token,Ii)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(t,")"===this._flags.last_token.text&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(t)},Hi.prototype.handle_unknown=function(t,e){this.print_token(t),"\n"===t.text[t.text.length-1]&&this.print_newline(!1,e)},Hi.prototype.handle_eof=function(t){for(;this._flags.mode===Ni.Statement;)this.restore_mode();this.handle_whitespace_and_comments(t)},de.Beautifier=Hi;var ji=de.Beautifier,Ui=_e.Options;ue.exports=function(t,e){return new ji(t,e).beautify()},ue.exports.defaultOptions=function(){return new Ui};var Wi={exports:{}},Gi={},Vi={},Yi=Ce.Options;function Xi(t){Yi.call(this,t,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var e=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||e;var i=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var n=0;n<i.length;n++)"expand"!==i[n]?this.brace_style="collapse":this.brace_style=i[n]}Xi.prototype=new Yi,Vi.Options=Xi;var Zi=Vi.Options,Ki=be.Output,Qi=Re.InputScanner,Ji=new(0,Ze.Directives)(/\/\*/,/\*\//),tn=/\r\n|[\r\n]/,en=/\r\n|[\r\n]/g,nn=/\s/,on=/(?:\s|\n)+/g,sn=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,ln=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function an(t,e){this._source_text=t||"",this._options=new Zi(e),this._ch=null,this._input=null,this.NESTED_AT_RULE={"@page":!0,"@font-face":!0,"@keyframes":!0,"@media":!0,"@supports":!0,"@document":!0},this.CONDITIONAL_GROUP_RULE={"@media":!0,"@supports":!0,"@document":!0}}an.prototype.eatString=function(t){var e="";for(this._ch=this._input.next();this._ch;){if(e+=this._ch,"\\"===this._ch)e+=this._input.next();else if(-1!==t.indexOf(this._ch)||"\n"===this._ch)break;this._ch=this._input.next()}return e},an.prototype.eatWhitespace=function(t){for(var e=nn.test(this._input.peek()),i=0;nn.test(this._input.peek());)this._ch=this._input.next(),t&&"\n"===this._ch&&(0===i||i<this._options.max_preserve_newlines)&&(i++,this._output.add_new_line(!0));return e},an.prototype.foundNestedPseudoClass=function(){for(var t=0,e=1,i=this._input.peek(e);i;){if("{"===i)return!0;if("("===i)t+=1;else if(")"===i){if(0===t)return!1;t-=1}else if(";"===i||"}"===i)return!1;e++,i=this._input.peek(e)}return!1},an.prototype.print_string=function(t){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(t)},an.prototype.preserveSingleSpace=function(t){t&&(this._output.space_before_token=!0)},an.prototype.indent=function(){this._indentLevel++},an.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},an.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var t=this._source_text,e=this._options.eol;"auto"===e&&(e="\n",t&&tn.test(t||"")&&(e=t.match(tn)[0]));var i=(t=t.replace(en,"\n")).match(/^[\t ]*/)[0];this._output=new Ki(this._options,i),this._input=new Qi(t),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var n,o,s=0,l=!1,a=!1,r=!1,c=!1,u=!1,d=this._ch;n=""!==this._input.read(on),o=d,this._ch=this._input.next(),"\\"===this._ch&&this._input.hasNext()&&(this._ch+=this._input.next()),d=this._ch,this._ch;)if("/"===this._ch&&"*"===this._input.peek()){this._output.add_new_line(),this._input.back();var b=this._input.read(sn),h=Ji.get_directives(b);h&&"start"===h.ignore&&(b+=Ji.readIgnored(this._input)),this.print_string(b),this.eatWhitespace(!0),this._output.add_new_line()}else if("/"===this._ch&&"/"===this._input.peek())this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(ln)),this.eatWhitespace(!0);else if("@"===this._ch)if(this.preserveSingleSpace(n),"{"===this._input.peek())this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var p=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);p.match(/[ :]$/)&&(p=this.eatString(": ").replace(/\s$/,""),this.print_string(p),this._output.space_before_token=!0),"extend"===(p=p.replace(/\s$/,""))?c=!0:"import"===p&&(u=!0),p in this.NESTED_AT_RULE?(this._nestedLevel+=1,p in this.CONDITIONAL_GROUP_RULE&&(r=!0)):l||0!==s||-1===p.indexOf(":")||(a=!0,this.indent())}else"#"===this._ch&&"{"===this._input.peek()?(this.preserveSingleSpace(n),this.print_string(this._ch+this.eatString("}"))):"{"===this._ch?(a&&(a=!1,this.outdent()),r?(r=!1,l=this._indentLevel>=this._nestedLevel):l=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&l&&this._output.previous_line&&"{"!==this._output.previous_line.item(-1)&&this._output.ensure_empty_line_above("/",","),this._output.space_before_token=!0,"expand"===this._options.brace_style?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line()):"}"===this._ch?(this.outdent(),this._output.add_new_line(),"{"===o&&this._output.trim(!0),u=!1,c=!1,a&&(this.outdent(),a=!1),this.print_string(this._ch),l=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&"}"!==this._input.peek()&&this._output.add_new_line(!0)):":"===this._ch?!l&&!r||this._input.lookBack("&")||this.foundNestedPseudoClass()||this._input.lookBack("(")||c||0!==s?(this._input.lookBack(" ")&&(this._output.space_before_token=!0),":"===this._input.peek()?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":")):(this.print_string(":"),a||(a=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):'"'===this._ch||"'"===this._ch?(this.preserveSingleSpace(n),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)):";"===this._ch?0===s?(a&&(this.outdent(),a=!1),c=!1,u=!1,this.print_string(this._ch),this.eatWhitespace(!0),"/"!==this._input.peek()&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0):"("===this._ch?this._input.lookBack("url")?(this.print_string(this._ch),this.eatWhitespace(),s++,this.indent(),this._ch=this._input.next(),")"===this._ch||'"'===this._ch||"'"===this._ch?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),s&&(s--,this.outdent()))):(this.preserveSingleSpace(n),this.print_string(this._ch),this.eatWhitespace(),s++,this.indent()):")"===this._ch?(s&&(s--,this.outdent()),this.print_string(this._ch)):","===this._ch?(this.print_string(this._ch),this.eatWhitespace(!0),!this._options.selector_separator_newline||a||0!==s||u||c?this._output.space_before_token=!0:this._output.add_new_line()):">"!==this._ch&&"+"!==this._ch&&"~"!==this._ch||a||0!==s?"]"===this._ch?this.print_string(this._ch):"["===this._ch?(this.preserveSingleSpace(n),this.print_string(this._ch)):"="===this._ch?(this.eatWhitespace(),this.print_string("="),nn.test(this._ch)&&(this._ch="")):"!"!==this._ch||this._input.lookBack("\\")?(this.preserveSingleSpace(n),this.print_string(this._ch)):(this.print_string(" "),this.print_string(this._ch)):this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&nn.test(this._ch)&&(this._ch=""));return this._output.get_code(e)},Gi.Beautifier=an;var rn=Gi.Beautifier,cn=Vi.Options;Wi.exports=function(t,e){return new rn(t,e).beautify()},Wi.exports.defaultOptions=function(){return new cn};var un={exports:{}},dn={},bn={},hn=Ce.Options;function pn(t){hn.call(this,t,"html"),1===this.templating.length&&"auto"===this.templating[0]&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}pn.prototype=new hn,bn.Options=pn;var gn={},mn=Be.Tokenizer,fn=Be.TOKEN,vn=Ze.Directives,yn=Qe.TemplatablePattern,xn=$e.Pattern,wn={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:fn.START,RAW:fn.RAW,EOF:fn.EOF},Sn=new vn(/<\!--/,/-->/),kn=function(t,e){mn.call(this,t,e),this._current_tag_name="";var i=new yn(this._input).read_options(this._options),n=new xn(this._input);if(this.__patterns={word:i.until(/[\n\r\t <]/),single_quote:i.until_after(/'/),double_quote:i.until_after(/"/),attribute:i.until(/[\n\r\t =>]|\/>/),element_name:i.until(/[\n\r\t >\/]/),handlebars_comment:n.starting_with(/{{!--/).until_after(/--}}/),handlebars:n.starting_with(/{{/).until_after(/}}/),handlebars_open:n.until(/[\n\r\t }]/),handlebars_raw_close:n.until(/}}/),comment:n.starting_with(/<!--/).until_after(/-->/),cdata:n.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:n.starting_with(/<!\[/).until_after(/]>/),processing:n.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var o=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=n.matching(o).until_after(o)}};(kn.prototype=new mn)._is_comment=function(t){return!1},kn.prototype._is_opening=function(t){return t.type===wn.TAG_OPEN},kn.prototype._is_closing=function(t,e){return t.type===wn.TAG_CLOSE&&e&&((">"===t.text||"/>"===t.text)&&"<"===e.text[0]||"}}"===t.text&&"{"===e.text[0]&&"{"===e.text[1])},kn.prototype._reset=function(){this._current_tag_name=""},kn.prototype._get_next_token=function(t,e){var i=null;this._readWhitespace();var n=this._input.peek();return null===n?this._create_token(wn.EOF,""):i=(i=(i=(i=(i=(i=(i=(i=(i=i||this._read_open_handlebars(n,e))||this._read_attribute(n,t,e))||this._read_close(n,e))||this._read_raw_content(n,t,e))||this._read_content_word(n))||this._read_comment_or_cdata(n))||this._read_processing(n))||this._read_open(n,e))||this._create_token(wn.UNKNOWN,this._input.next())},kn.prototype._read_comment_or_cdata=function(t){var e=null,i=null,n=null;"<"===t&&("!"===this._input.peek(1)&&((i=this.__patterns.comment.read())?(n=Sn.get_directives(i))&&"start"===n.ignore&&(i+=Sn.readIgnored(this._input)):i=this.__patterns.cdata.read()),i&&((e=this._create_token(wn.COMMENT,i)).directives=n));return e},kn.prototype._read_processing=function(t){var e=null,i=null;if("<"===t){var n=this._input.peek(1);"!"!==n&&"?"!==n||(i=(i=this.__patterns.conditional_comment.read())||this.__patterns.processing.read()),i&&((e=this._create_token(wn.COMMENT,i)).directives=null)}return e},kn.prototype._read_open=function(t,e){var i=null,n=null;return e||"<"===t&&(i=this._input.next(),"/"===this._input.peek()&&(i+=this._input.next()),i+=this.__patterns.element_name.read(),n=this._create_token(wn.TAG_OPEN,i)),n},kn.prototype._read_open_handlebars=function(t,e){var i=null,n=null;return e||this._options.indent_handlebars&&"{"===t&&"{"===this._input.peek(1)&&("!"===this._input.peek(2)?(i=(i=this.__patterns.handlebars_comment.read())||this.__patterns.handlebars.read(),n=this._create_token(wn.COMMENT,i)):(i=this.__patterns.handlebars_open.read(),n=this._create_token(wn.TAG_OPEN,i))),n},kn.prototype._read_close=function(t,e){var i=null,n=null;return e&&("<"===e.text[0]&&(">"===t||"/"===t&&">"===this._input.peek(1))?(i=this._input.next(),"/"===t&&(i+=this._input.next()),n=this._create_token(wn.TAG_CLOSE,i)):"{"===e.text[0]&&"}"===t&&"}"===this._input.peek(1)&&(this._input.next(),this._input.next(),n=this._create_token(wn.TAG_CLOSE,"}}"))),n},kn.prototype._read_attribute=function(t,e,i){var n=null,o="";if(i&&"<"===i.text[0])if("="===t)n=this._create_token(wn.EQUALS,this._input.next());else if('"'===t||"'"===t){var s=this._input.next();s+='"'===t?this.__patterns.double_quote.read():this.__patterns.single_quote.read(),n=this._create_token(wn.VALUE,s)}else(o=this.__patterns.attribute.read())&&(n=e.type===wn.EQUALS?this._create_token(wn.VALUE,o):this._create_token(wn.ATTRIBUTE,o));return n},kn.prototype._is_content_unformatted=function(t){return-1===this._options.void_elements.indexOf(t)&&(-1!==this._options.content_unformatted.indexOf(t)||-1!==this._options.unformatted.indexOf(t))},kn.prototype._read_raw_content=function(t,e,i){var n="";if(i&&"{"===i.text[0])n=this.__patterns.handlebars_raw_close.read();else if(e.type===wn.TAG_CLOSE&&"<"===e.opened.text[0]&&"/"!==e.text[0]){var o=e.opened.text.substr(1).toLowerCase();if("script"===o||"style"===o){var s=this._read_comment_or_cdata(t);if(s)return s.type=wn.TEXT,s;n=this._input.readUntil(new RegExp("</"+o+"[\\n\\r\\t ]*?>","ig"))}else this._is_content_unformatted(o)&&(n=this._input.readUntil(new RegExp("</"+o+"[\\n\\r\\t ]*?>","ig")))}return n?this._create_token(wn.TEXT,n):null},kn.prototype._read_content_word=function(t){var e="";if(this._options.unformatted_content_delimiter&&t===this._options.unformatted_content_delimiter[0]&&(e=this.__patterns.unformatted_content_delimiter.read()),e||(e=this.__patterns.word.read()),e)return this._create_token(wn.TEXT,e)},gn.Tokenizer=kn,gn.TOKEN=wn;var _n=bn.Options,Cn=be.Output,En=gn.Tokenizer,Ln=gn.TOKEN,An=/\r\n|[\r\n]/,qn=/\r\n|[\r\n]/g,Tn=function(t,e){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=t.max_preserve_newlines,this.preserve_newlines=t.preserve_newlines,this._output=new Cn(t,e)};Tn.prototype.current_line_has_match=function(t){return this._output.current_line.has_match(t)},Tn.prototype.set_space_before_token=function(t,e){this._output.space_before_token=t,this._output.non_breaking_space=e},Tn.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},Tn.prototype.add_raw_token=function(t){this._output.add_raw_token(t)},Tn.prototype.print_preserved_newlines=function(t){var e=0;t.type!==Ln.TEXT&&t.previous.type!==Ln.TEXT&&(e=t.newlines?1:0),this.preserve_newlines&&(e=t.newlines<this.max_preserve_newlines+1?t.newlines:this.max_preserve_newlines+1);for(var i=0;i<e;i++)this.print_newline(i>0);return 0!==e},Tn.prototype.traverse_whitespace=function(t){return!(!t.whitespace_before&&!t.newlines)&&(this.print_preserved_newlines(t)||(this._output.space_before_token=!0),!0)},Tn.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},Tn.prototype.print_newline=function(t){this._output.add_new_line(t)},Tn.prototype.print_token=function(t){t.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(t.text))},Tn.prototype.indent=function(){this.indent_level++},Tn.prototype.get_full_indent=function(t){return(t=this.indent_level+(t||0))<1?"":this._output.get_indent_string(t)};var Mn=function(t,e){var i=null,n=null;return e.closed?("script"===t?i="text/javascript":"style"===t&&(i="text/css"),i=function(t){for(var e=null,i=t.next;i.type!==Ln.EOF&&t.closed!==i;){if(i.type===Ln.ATTRIBUTE&&"type"===i.text){i.next&&i.next.type===Ln.EQUALS&&i.next.next&&i.next.next.type===Ln.VALUE&&(e=i.next.next.text);break}i=i.next}return e}(e)||i,i.search("text/css")>-1?n="css":i.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?n="javascript":i.search(/(text|application|dojo)\/(x-)?(html)/)>-1?n="html":i.search(/test\/null/)>-1&&(n="null"),n):null};function On(t,e){return-1!==e.indexOf(t)}function Rn(t,e,i){this.parent=t||null,this.tag=e?e.tag_name:"",this.indent_level=i||0,this.parser_token=e||null}function In(t){this._printer=t,this._current_frame=null}function zn(t,e,i,n){this._source_text=t||"",e=e||{},this._js_beautify=i,this._css_beautify=n,this._tag_stack=null;var o=new _n(e,"html");this._options=o,this._is_wrap_attributes_force="force"===this._options.wrap_attributes.substr(0,"force".length),this._is_wrap_attributes_force_expand_multiline="force-expand-multiline"===this._options.wrap_attributes,this._is_wrap_attributes_force_aligned="force-aligned"===this._options.wrap_attributes,this._is_wrap_attributes_aligned_multiple="aligned-multiple"===this._options.wrap_attributes,this._is_wrap_attributes_preserve="preserve"===this._options.wrap_attributes.substr(0,"preserve".length),this._is_wrap_attributes_preserve_aligned="preserve-aligned"===this._options.wrap_attributes}In.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},In.prototype.record_tag=function(t){var e=new Rn(this._current_frame,t,this._printer.indent_level);this._current_frame=e},In.prototype._try_pop_frame=function(t){var e=null;return t&&(e=t.parser_token,this._printer.indent_level=t.indent_level,this._current_frame=t.parent),e},In.prototype._get_frame=function(t,e){for(var i=this._current_frame;i&&-1===t.indexOf(i.tag);){if(e&&-1!==e.indexOf(i.tag)){i=null;break}i=i.parent}return i},In.prototype.try_pop=function(t,e){var i=this._get_frame([t],e);return this._try_pop_frame(i)},In.prototype.indent_to_tag=function(t){var e=this._get_frame(t);e&&(this._printer.indent_level=e.indent_level)},zn.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var t=this._source_text,e=this._options.eol;"auto"===this._options.eol&&(e="\n",t&&An.test(t)&&(e=t.match(An)[0]));var i=(t=t.replace(qn,"\n")).match(/^[\t ]*/)[0],n={text:"",type:""},o=new Bn,s=new Tn(this._options,i),l=new En(t,this._options).tokenize();this._tag_stack=new In(s);for(var a=null,r=l.next();r.type!==Ln.EOF;)r.type===Ln.TAG_OPEN||r.type===Ln.COMMENT?o=a=this._handle_tag_open(s,r,o,n):r.type===Ln.ATTRIBUTE||r.type===Ln.EQUALS||r.type===Ln.VALUE||r.type===Ln.TEXT&&!o.tag_complete?a=this._handle_inside_tag(s,r,o,l):r.type===Ln.TAG_CLOSE?a=this._handle_tag_close(s,r,o):r.type===Ln.TEXT?a=this._handle_text(s,r,o):s.add_raw_token(r),n=a,r=l.next();return s._output.get_code(e)},zn.prototype._handle_tag_close=function(t,e,i){var n={text:e.text,type:e.type};return t.alignment_size=0,i.tag_complete=!0,t.set_space_before_token(e.newlines||""!==e.whitespace_before,!0),i.is_unformatted?t.add_raw_token(e):("<"===i.tag_start_char&&(t.set_space_before_token("/"===e.text[0],!0),this._is_wrap_attributes_force_expand_multiline&&i.has_wrapped_attrs&&t.print_newline(!1)),t.print_token(e)),!i.indent_content||i.is_unformatted||i.is_content_unformatted||(t.indent(),i.indent_content=!1),i.is_inline_element||i.is_unformatted||i.is_content_unformatted||t.set_wrap_point(),n},zn.prototype._handle_inside_tag=function(t,e,i,n){var o=i.has_wrapped_attrs,s={text:e.text,type:e.type};if(t.set_space_before_token(e.newlines||""!==e.whitespace_before,!0),i.is_unformatted)t.add_raw_token(e);else if("{"===i.tag_start_char&&e.type===Ln.TEXT)t.print_preserved_newlines(e)?(e.newlines=0,t.add_raw_token(e)):t.print_token(e);else{if(e.type===Ln.ATTRIBUTE?(t.set_space_before_token(!0),i.attr_count+=1):(e.type===Ln.EQUALS||e.type===Ln.VALUE&&e.previous.type===Ln.EQUALS)&&t.set_space_before_token(!1),e.type===Ln.ATTRIBUTE&&"<"===i.tag_start_char&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(t.traverse_whitespace(e),o=o||0!==e.newlines),this._is_wrap_attributes_force)){var l=i.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&1===i.attr_count){var a,r=!0,c=0;do{if((a=n.peek(c)).type===Ln.ATTRIBUTE){r=!1;break}c+=1}while(c<4&&a.type!==Ln.EOF&&a.type!==Ln.TAG_CLOSE);l=!r}l&&(t.print_newline(!1),o=!0)}t.print_token(e),o=o||t.previous_token_wrapped(),i.has_wrapped_attrs=o}return s},zn.prototype._handle_text=function(t,e,i){var n={text:e.text,type:"TK_CONTENT"};return i.custom_beautifier_name?this._print_custom_beatifier_text(t,e,i):i.is_unformatted||i.is_content_unformatted?t.add_raw_token(e):(t.traverse_whitespace(e),t.print_token(e)),n},zn.prototype._print_custom_beatifier_text=function(t,e,i){var n=this;if(""!==e.text){var o,s=e.text,l=1,a="",r="";"javascript"===i.custom_beautifier_name&&"function"==typeof this._js_beautify?o=this._js_beautify:"css"===i.custom_beautifier_name&&"function"==typeof this._css_beautify?o=this._css_beautify:"html"===i.custom_beautifier_name&&(o=function(t,e){return new zn(t,e,n._js_beautify,n._css_beautify).beautify()}),"keep"===this._options.indent_scripts?l=0:"separate"===this._options.indent_scripts&&(l=-t.indent_level);var c=t.get_full_indent(l);if(s=s.replace(/\n[ \t]*$/,""),"html"!==i.custom_beautifier_name&&"<"===s[0]&&s.match(/^(<!--|<!\[CDATA\[)/)){var u=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(s);if(!u)return void t.add_raw_token(e);a=c+u[1]+"\n",s=u[4],u[5]&&(r=c+u[5]),s=s.replace(/\n[ \t]*$/,""),(u[2]||-1!==u[3].indexOf("\n"))&&(u=u[3].match(/[ \t]+$/))&&(e.whitespace_before=u[0])}if(s)if(o){var d=function(){this.eol="\n"};d.prototype=this._options.raw_options,s=o(c+s,new d)}else{var b=e.whitespace_before;b&&(s=s.replace(new RegExp("\n("+b+")?","g"),"\n")),s=c+s.replace(/\n/g,"\n"+c)}a&&(s=s?a+s+"\n"+r:a+r),t.print_newline(!1),s&&(e.text=s,e.whitespace_before="",e.newlines=0,t.add_raw_token(e),t.print_newline(!0))}},zn.prototype._handle_tag_open=function(t,e,i,n){var o=this._get_tag_open_token(e);return!i.is_unformatted&&!i.is_content_unformatted||i.is_empty_element||e.type!==Ln.TAG_OPEN||0!==e.text.indexOf("</")?(t.traverse_whitespace(e),this._set_tag_position(t,e,o,i,n),o.is_inline_element||t.set_wrap_point(),t.print_token(e)):(t.add_raw_token(e),o.start_tag_token=this._tag_stack.try_pop(o.tag_name)),(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(o.alignment_size=e.text.length+1),o.tag_complete||o.is_unformatted||(t.alignment_size=o.alignment_size),o};var Bn=function(t,e){var i;(this.parent=t||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",e)?(this.tag_start_char=e.text[0],this.text=e.text,"<"===this.tag_start_char?(i=e.text.match(/^<([^\s>]*)/),this.tag_check=i?i[1]:""):(i=e.text.match(/^{{(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=i?i[1]:"","{{#>"===e.text&&">"===this.tag_check&&null!==e.next&&(this.tag_check=e.next.text)),this.tag_check=this.tag_check.toLowerCase(),e.type===Ln.COMMENT&&(this.tag_complete=!0),this.is_start_tag="/"!==this.tag_check.charAt(0),this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||e.closed&&"/>"===e.closed.text,this.is_end_tag=this.is_end_tag||"{"===this.tag_start_char&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(2)))):this.tag_complete=!0};zn.prototype._get_tag_open_token=function(t){var e=new Bn(this._tag_stack.get_parser_token(),t);return e.alignment_size=this._options.wrap_attributes_indent_size,e.is_end_tag=e.is_end_tag||On(e.tag_check,this._options.void_elements),e.is_empty_element=e.tag_complete||e.is_start_tag&&e.is_end_tag,e.is_unformatted=!e.tag_complete&&On(e.tag_check,this._options.unformatted),e.is_content_unformatted=!e.is_empty_element&&On(e.tag_check,this._options.content_unformatted),e.is_inline_element=On(e.tag_name,this._options.inline)||"{"===e.tag_start_char,e},zn.prototype._set_tag_position=function(t,e,i,n,o){if(i.is_empty_element||(i.is_end_tag?i.start_tag_token=this._tag_stack.try_pop(i.tag_name):(this._do_optional_end_element(i)&&(i.is_inline_element||t.print_newline(!1)),this._tag_stack.record_tag(i),"script"!==i.tag_name&&"style"!==i.tag_name||i.is_unformatted||i.is_content_unformatted||(i.custom_beautifier_name=Mn(i.tag_check,e)))),On(i.tag_check,this._options.extra_liners)&&(t.print_newline(!1),t._output.just_added_blankline()||t.print_newline(!0)),i.is_empty_element){if("{"===i.tag_start_char&&"else"===i.tag_check)this._tag_stack.indent_to_tag(["if","unless","each"]),i.indent_content=!0,t.current_line_has_match(/{{#if/)||t.print_newline(!1);"!--"===i.tag_name&&o.type===Ln.TAG_CLOSE&&n.is_end_tag&&-1===i.text.indexOf("\n")||(i.is_inline_element||i.is_unformatted||t.print_newline(!1),this._calcluate_parent_multiline(t,i))}else if(i.is_end_tag){var s=!1;s=(s=i.start_tag_token&&i.start_tag_token.multiline_content)||!i.is_inline_element&&!(n.is_inline_element||n.is_unformatted)&&!(o.type===Ln.TAG_CLOSE&&i.start_tag_token===n)&&"TK_CONTENT"!==o.type,(i.is_content_unformatted||i.is_unformatted)&&(s=!1),s&&t.print_newline(!1)}else i.indent_content=!i.custom_beautifier_name,"<"===i.tag_start_char&&("html"===i.tag_name?i.indent_content=this._options.indent_inner_html:"head"===i.tag_name?i.indent_content=this._options.indent_head_inner_html:"body"===i.tag_name&&(i.indent_content=this._options.indent_body_inner_html)),i.is_inline_element||i.is_unformatted||"TK_CONTENT"===o.type&&!i.is_content_unformatted||t.print_newline(!1),this._calcluate_parent_multiline(t,i)},zn.prototype._calcluate_parent_multiline=function(t,e){!e.parent||!t._output.just_added_newline()||(e.is_inline_element||e.is_unformatted)&&e.parent.is_inline_element||(e.parent.multiline_content=!0)};var Nn=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"],Dn=["a","audio","del","ins","map","noscript","video"];zn.prototype._do_optional_end_element=function(t){var e=null;if(!t.is_empty_element&&t.is_start_tag&&t.parent){if("body"===t.tag_name)e=e||this._tag_stack.try_pop("head");else if("li"===t.tag_name)e=e||this._tag_stack.try_pop("li",["ol","ul"]);else if("dd"===t.tag_name||"dt"===t.tag_name)e=(e=e||this._tag_stack.try_pop("dt",["dl"]))||this._tag_stack.try_pop("dd",["dl"]);else if("p"===t.parent.tag_name&&-1!==Nn.indexOf(t.tag_name)){var i=t.parent.parent;i&&-1!==Dn.indexOf(i.tag_name)||(e=e||this._tag_stack.try_pop("p"))}else"rp"===t.tag_name||"rt"===t.tag_name?e=(e=e||this._tag_stack.try_pop("rt",["ruby","rtc"]))||this._tag_stack.try_pop("rp",["ruby","rtc"]):"optgroup"===t.tag_name?e=e||this._tag_stack.try_pop("optgroup",["select"]):"option"===t.tag_name?e=e||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):"colgroup"===t.tag_name?e=e||this._tag_stack.try_pop("caption",["table"]):"thead"===t.tag_name?e=(e=e||this._tag_stack.try_pop("caption",["table"]))||this._tag_stack.try_pop("colgroup",["table"]):"tbody"===t.tag_name||"tfoot"===t.tag_name?e=(e=(e=(e=e||this._tag_stack.try_pop("caption",["table"]))||this._tag_stack.try_pop("colgroup",["table"]))||this._tag_stack.try_pop("thead",["table"]))||this._tag_stack.try_pop("tbody",["table"]):"tr"===t.tag_name?e=(e=(e=e||this._tag_stack.try_pop("caption",["table"]))||this._tag_stack.try_pop("colgroup",["table"]))||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"]):"th"!==t.tag_name&&"td"!==t.tag_name||(e=(e=e||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]))||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return t.parent=this._tag_stack.get_parser_token(),e}},dn.Beautifier=zn;var Pn=dn.Beautifier,$n=bn.Options;un.exports=function(t,e,i,n){return new Pn(t,e,i,n).beautify()},un.exports.defaultOptions=function(){return new $n};var Hn=ue.exports,Fn=Wi.exports,jn=un.exports;function Un(t,e,i,n){return jn(t,e,i=i||Hn,n=n||Fn)}Un.defaultOptions=jn.defaultOptions,ce.js=Hn,ce.css=Fn,ce.html=Un,function(t){var e=ce;e.js_beautify=e.js,e.css_beautify=e.css,e.html_beautify=e.html,t.exports=function(t,e,i){var n=function(e,i){return t.js_beautify(e,i)};return n.js=t.js_beautify,n.css=e.css_beautify,n.html=i.html_beautify,n.js_beautify=t.js_beautify,n.css_beautify=e.css_beautify,n.html_beautify=i.html_beautify,n}(e,e,e)}(re);var Wn=re.exports;function Gn(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Vn(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Yn(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Vn(Object(i),!0).forEach((function(e){Gn(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Vn(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function Xn(t,e){if(null==t)return{};var i,n,o=function(t,e){if(null==t)return{};var i,n,o={},s=Object.keys(t);for(n=0;n<s.length;n++)i=s[n],e.indexOf(i)>=0||(o[i]=t[i]);return o}(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(n=0;n<s.length;n++)i=s[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(o[i]=t[i])}return o}function Zn(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function Kn(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Qn(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Jn(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Qn(Object(i),!0).forEach((function(e){Kn(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Qn(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function to(t){return function e(){for(var i=this,n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return o.length>=t.length?t.apply(this,o):function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e.apply(i,[].concat(o,n))}}}function eo(t){return{}.toString.call(t).includes("Object")}function io(t){return"function"==typeof t}var no=to((function(t,e){throw new Error(t[e]||t.default)}))({initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"}),oo={changes:function(t,e){return eo(e)||no("changeType"),Object.keys(e).some((function(e){return i=t,n=e,!Object.prototype.hasOwnProperty.call(i,n);var i,n}))&&no("changeField"),e},selector:function(t){io(t)||no("selectorType")},handler:function(t){io(t)||eo(t)||no("handlerType"),eo(t)&&Object.values(t).some((function(t){return!io(t)}))&&no("handlersType")},initial:function(t){var e;t||no("initialIsRequired"),eo(t)||no("initialType"),e=t,Object.keys(e).length||no("initialContent")}};function so(t,e){return io(e)?e(t.current):e}function lo(t,e){return t.current=Jn(Jn({},t.current),e),e}function ao(t,e,i){return io(e)?e(t.current):Object.keys(i).forEach((function(i){var n;return null===(n=e[i])||void 0===n?void 0:n.call(e,t.current[i])})),i}var ro={create:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};oo.initial(t),oo.handler(e);var i={current:t},n=to(ao)(i,e),o=to(lo)(i),s=to(oo.changes)(t),l=to(so)(i);return[function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return t};return oo.selector(t),t(i.current)},function(t){!function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return function(t){return e.reduceRight((function(t,e){return e(t)}),t)}}(n,o,s,l)(t)}]}};var co,uo={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:"Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "},bo=(co=function(t,e){throw new Error(t[e]||t.default)},function t(){for(var e=this,i=arguments.length,n=new Array(i),o=0;o<i;o++)n[o]=arguments[o];return n.length>=co.length?co.apply(this,n):function(){for(var i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return t.apply(e,[].concat(n,o))}})(uo),ho={config:function(t){var e;return t||bo("configIsRequired"),e=t,{}.toString.call(e).includes("Object")||bo("configType"),t.urls?(console.warn(uo.deprecation),{paths:{vs:t.urls.monacoBase}}):t}};function po(t,e){return Object.keys(e).forEach((function(i){e[i]instanceof Object&&t[i]&&Object.assign(e[i],po(t[i],e[i]))})),Yn(Yn({},t),e)}var go={type:"cancelation",msg:"operation is manually canceled"};function mo(t){var e=!1,i=new Promise((function(i,n){t.then((function(t){return e?n(go):i(t)})),t.catch(n)}));return i.cancel=function(){return e=!0},i}var fo,vo,yo=ro.create({config:{paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.33.0/min/vs"}},isInitialized:!1,resolve:null,reject:null,monaco:null}),xo=(vo=2,function(t){if(Array.isArray(t))return t}(fo=yo)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var i=[],n=!0,o=!1,s=void 0;try{for(var l,a=t[Symbol.iterator]();!(n=(l=a.next()).done)&&(i.push(l.value),!e||i.length!==e);n=!0);}catch(t){o=!0,s=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw s}}return i}}(fo,vo)||function(t,e){if(t){if("string"==typeof t)return Zn(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Zn(t,e):void 0}}(fo,vo)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),wo=xo[0],So=xo[1];function ko(t){return document.body.appendChild(t)}function _o(t){var e=wo((function(t){return{config:t.config,reject:t.reject}})),i=function(t){var e=document.createElement("script");return t&&(e.src=t),e}("".concat(e.config.paths.vs,"/loader.js"));return i.onload=function(){return t()},i.onerror=e.reject,i}function Co(){var t=wo((function(t){return{config:t.config,resolve:t.resolve,reject:t.reject}})),e=window.require;e.config(t.config),e(["vs/editor/editor.main"],(function(e){Eo(e),t.resolve(e)}),(function(e){t.reject(e)}))}function Eo(t){wo().monaco||So({monaco:t})}var Lo=new Promise((function(t,e){return So({resolve:t,reject:e})})),Ao={config:function(t){var e=ho.config(t),i=e.monaco,n=Xn(e,["monaco"]);So((function(t){return{config:po(t.config,n),monaco:i}}))},init:function(){var t=wo((function(t){return{monaco:t.monaco,isInitialized:t.isInitialized,resolve:t.resolve}}));if(!t.isInitialized){if(So({isInitialized:!0}),t.monaco)return t.resolve(t.monaco),mo(Lo);if(window.monaco&&window.monaco.editor)return Eo(window.monaco),t.resolve(window.monaco),mo(Lo);!function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return function(t){return e.reduceRight((function(t,e){return e(t)}),t)}}(ko,_o)(Co)}return mo(Lo)},__getMonacoInstance:function(){return wo((function(t){return t.monaco}))}};let qo={};class To{constructor(t){this.builder=t}renderPanel(){const t=this.builder.builderStuff,e=this.builder.util,i=this.builder.dom;let n=t.querySelector(".viewhtml");if(!n){const o=`<div class="is-modal viewhtml" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">\n <div class="is-modal-content">\n <textarea class="tabSupport" id="__tabsupport" style="width:100%;height:calc(100% - 50px);border:none;margin:0;box-sizing:border-box;"></textarea>\n <div class="is-modal-footer" style="border-top:1px solid ${this.builder.styleSeparatorColor};width:100%;height:50px;position:absolute;left:0;bottom:0;overflow:hidden;text-align:right">\n <button title="${e.out("Cancel")}" class="input-cancel classic-secondary">${e.out("Cancel")}</button>\n <button title="${e.out("Ok")}" class="input-ok classic-primary">${e.out("Ok")}</button>\n </div>\n </div>\n </div>\n\n <div class="is-modal viewhtmlmonaco" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">\n <div class="is-modal-content" style="width:${this.builder.blockCodeEditorWidth};max-width:${this.builder.blockCodeEditorMaxWidth};padding:0">\n <textarea id="__viewhtmlmonaco" style="position:absolute;display:none;"></textarea>\n <div class="input-code-editor" style="width:100%;height:${this.builder.blockCodeEditorHeight};"></div>\n <div class="is-modal-footer" style="display:flex;justify-content:flex-end;border-top:1px solid ${this.builder.styleSeparatorColor};">\n <button title="${e.out("Cancel")}" class="input-cancel classic-secondary">${e.out("Cancel")}</button>\n <button title="${e.out("Ok")}" class="input-ok classic-primary">${e.out("Ok")}</button>\n </div>\n </div>\n </div>\n\n <div class="is-modal viewhtmlexternal" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">\n <div class="is-modal-content" style="width:${this.builder.codeEditorWidth};max-width:${this.builder.codeEditorMaxWidth};padding:0">\n <div class="input-code-editor" id="__input_code_editor" style="width:100%;height:${this.builder.codeEditorHeight};"></div>\n <div class="is-modal-footer" style="display:flex;justify-content:flex-end;border-top:1px solid ${this.builder.styleSeparatorColor};">\n <button title="${e.out("Cancel")}" class="input-cancel classic-secondary">${e.out("Cancel")}</button>\n <button title="${e.out("Ok")}" class="input-ok classic-primary">${e.out("Ok")}</button>\n </div>\n </div>\n </div>\n \n `;i.appendHtml(t,o),n=t.querySelector(".viewhtml");let s=t.querySelector(".viewhtmlmonaco"),l=t.querySelector(".viewhtmlexternal"),a=n.querySelector(".input-ok");i.addEventListener(a,"click",(()=>{this.applyHtml(n)})),a=n.querySelector(".input-cancel"),i.addEventListener(a,"click",(()=>{this.builder.hideModal(n)})),a=s.querySelector(".input-ok"),i.addEventListener(a,"click",(()=>{this.applyHtml(s)})),a=s.querySelector(".input-cancel"),i.addEventListener(a,"click",(()=>{this.builder.hideModal(s)})),a=l.querySelector(".input-ok"),i.addEventListener(a,"click",(()=>{const t=document.querySelector("textarea[data-source-active]"),e=t.getAttribute("data-source-ok");t.removeAttribute("data-source-active"),t.removeAttribute("data-source-ok"),t.removeAttribute("data-source-cancel"),document.querySelector(e).click(),this.builder.hideModal(l)})),a=l.querySelector(".input-cancel"),i.addEventListener(a,"click",(()=>{const t=document.querySelector("textarea[data-source-active]"),e=t.getAttribute("data-source-cancel");t.removeAttribute("data-source-active"),t.removeAttribute("data-source-ok"),t.removeAttribute("data-source-cancel"),document.querySelector(e).click(),this.builder.hideModal(l)}))}}applyHtml(t){const e=this.builder.util,i=e.cellSelected();i&&i.parentNode.classList.add("row-active");let n=this.builder.codeEditorMode,o=this.builder.codeEditorArea;this.builder.uo.saveForUndo();let s=t.querySelector("textarea").value;if("code"===n){let i=this.builder.activeCodeBlock;i.setAttribute("data-html",encodeURIComponent(s)),s=s.replace(/{id}/g,e.makeId());for(let t=1;t<=20;t++)s=s.replace("[%HTML"+t+"%]",void 0===i.getAttribute("data-html-"+t)?"":decodeURIComponent(i.getAttribute("data-html-"+t)));i.innerHTML="";let n=document.createRange();n.setStart(i,0),i.appendChild(n.createContextualFragment(s));let o=this.builder.doc.querySelector(".builder-active");return o&&this.builder.applyBehaviorOn(o),this.builder.opts.onChange(),this.builder.opts.onRender(),this.builder.hideModal(t),void e.hideControls()}if(s=this.fromViewToActual(s),"cell"===n){e.cellSelected().innerHTML=s;let t=this.builder.doc.querySelector(".builder-active");t&&this.builder.applyBehaviorOn(t),this.builder.opts.onChange(),this.builder.opts.onRender()}if("row"===n){let t,i=e.cellSelected();if(t=i?i.parentNode:e.rowSelected(),!t)return;t.innerHTML=s;let n=this.builder.doc.querySelector(".builder-active");n&&this.builder.applyBehaviorOn(n),this.builder.opts.onChange(),this.builder.opts.onRender(),t.firstChild&&t.firstChild.click(),t.classList.remove("row-outline"),e.hideColumnTool()}if("full"===n){if(this.builder.docContainer)return this.builder.loadHTML(s),e.clearControls(),void this.builder.hideModal(t);o.innerHTML="";let i=document.createRange();i.setStart(o,0),o.appendChild(i.createContextualFragment(s)),this.builder.applyBehaviorOn(o),this.builder.opts.onChange(),this.builder.opts.onRender(),e.clearActiveCell()}e.clearControls(),this.builder.hideModal(t)}viewHtmlExternal(){const t=this.builder.util,e=this.builder.builderStuff;this.renderPanel();const i=e.querySelector(".viewhtmlexternal");document.activeElement&&(this.elmFocus=document.activeElement),t.showModal(i,!0,(()=>{this.elmFocus&&this.elmFocus.focus()}),!1),i.querySelector(".input-code-editor").style.opacity=.01,this._viewHtmlExternal()}_viewHtmlExternal(){const t=this.builder.builderStuff,e=document.querySelector("textarea[data-source-active]");let i=t.querySelector(".viewhtmlexternal").querySelector(".input-code-editor");if(!i.querySelector(".monaco-editor"))return Ao.init().then((t=>{this.builder.monaco=t,i.getAttribute("data-mode-id")||(this.builder.codeEditorExternal=t.editor.create(i,{value:"",minimap:{enabled:!1},automaticLayout:!0,contextmenu:!1,fontSize:13,wordWrap:!0,scrollbar:{useShadows:!1,vertical:"visible",horizontal:"visible",horizontalScrollbarSize:12,verticalScrollbarSize:12},language:"html",theme:this.builder.styleDark||this.builder.styleColoredDark?"vs-dark":""})),this.builder.codeEditorExternal.onDidChangeModelContent((()=>{document.querySelector("textarea[data-source-active]").value=this.builder.codeEditorExternal.getModel().getValue()}))})),void setTimeout((()=>{this._viewHtmlExternal()}),100);const n=this.builder.monaco.editor.createModel(e.value,"html");this.builder.codeEditorExternal.setModel(n),i.style.opacity=""}view(t,e,i){this.renderPanel();const n=this.builder.util,o=this.builder.builderStuff;let s;s=this.builder.opts.htmlSyntaxHighlighting?o.querySelector(".viewhtmlmonaco"):o.querySelector(".viewhtml");let l=s.querySelector(".is-modal-content"),a=s.querySelector(".input-code-editor");a.style.opacity=.01,"full"===t?(l.style.width=this.builder.codeEditorWidth,l.style.maxWidth=this.builder.codeEditorMaxWidth,a.style.height=this.builder.codeEditorHeight):(l.style.width=this.builder.blockCodeEditorWidth,l.style.maxWidth=this.builder.blockCodeEditorMaxWidth,a.style.height=this.builder.blockCodeEditorHeight);const r=this.builder.doc.querySelector(".row-active");r&&r.classList.remove("row-active"),n.showModal(s,!0,(()=>{i&&(i.removeAttribute("data-focus"),i.focus());const t=n.cellSelected();t&&t.parentNode.classList.add("row-active")})),i&&i.setAttribute("data-focus",!0),this._view(t,e)}_view(t,e){const i=this.builder.dom,n=this.builder.util,o=this.builder.builderStuff;let s;if(this.builder.opts.htmlSyntaxHighlighting){s=o.querySelector(".viewhtmlmonaco");let i=s.querySelector(".input-code-editor");if(!i.querySelector(".monaco-editor"))return Ao.init().then((t=>{this.builder.monaco=t,i.getAttribute("data-mode-id")||(this.builder.codeEditor=t.editor.create(i,{value:"",minimap:{enabled:!1},automaticLayout:!0,contextmenu:!1,fontSize:13,wordWrap:!0,scrollbar:{useShadows:!1,vertical:"visible",horizontal:"visible",horizontalScrollbarSize:12,verticalScrollbarSize:12},language:"html",theme:this.builder.styleDark||this.builder.styleColoredDark?"vs-dark":""}));let e=s.querySelector("textarea");this.builder.codeEditor.onDidChangeModelContent((()=>{e.value=this.builder.codeEditor.getModel().getValue()}))})),void setTimeout((()=>{this._view(t,e)}),100)}else s=o.querySelector(".viewhtml");let l=s.querySelector("textarea");if("cell"===t){const t=n.cellSelected();if(!t)return;let e=s.querySelector("textarea");this.builder.cleanHtmlFormatting=!0,e.value=this.readHtml(t,!0),this.builder.cleanHtmlFormatting=!1}if("row"===t){let t,e=n.cellSelected();if(t=e?e.parentNode:n.rowSelected(),!t)return;let o=s.querySelector("textarea");this.builder.cleanHtmlFormatting=!0,o.value=this.readHtml(t,!0),this.builder.cleanHtmlFormatting=!1,i.removeClass(t,"row-outline")}if("full"===t){if(e);else{const t=this.builder.doc.querySelectorAll(this.builder.opts.container);if(t.length>1){const i=n.cellSelected();e=i?i.parentNode.parentNode:t[0]}else e=t[0];if(""!==this.builder.opts.page){const t=this.builder.doc.querySelector(this.builder.opts.page);t&&(e=t)}}let t=s.querySelector("textarea");this.builder.cleanHtmlFormatting=!0,this.builder.shortenHTML?t.value=this.readHtml(e,!0):t.value=this.readHtml(e,!1),this.builder.cleanHtmlFormatting=!1}if(this.builder.opts.htmlSyntaxHighlighting){const t=this.builder.monaco.editor.createModel(l.value,"html");this.builder.codeEditor.setModel(t)}let a=o.querySelector(".is-pop.columnmore");a&&(a.style.display="");let r=o.querySelector(".is-pop.rowmore");r&&(r.style.display=""),this.builder.codeEditorMode=t,this.builder.codeEditorArea=e,s.querySelector(".input-code-editor").style.opacity=""}fromViewToActual(t){for(var e in qo)t=t.replace(e,qo[e]);return t}readHtml(t,e,i,n){const o=this.builder.dom;if(this.builder.opts.absolutePath){let e=t.querySelectorAll("a");Array.prototype.forEach.call(e,(t=>{let e=t.href;t.setAttribute("href",e)}));let i=t.querySelectorAll("img");Array.prototype.forEach.call(i,(t=>{let e=t.src;t.setAttribute("src",e)}))}this.builder.cleanHtmlFormatting;const s=this.builder.util;let l,a=document.createElement("div");a.innerHTML=t.innerHTML;let r=a.querySelectorAll("[data-html]");if(Array.prototype.forEach.call(r,(t=>{let e=1,i=t.querySelectorAll("[data-subblock]");Array.prototype.forEach.call(i,(i=>{if(i.closest(".glide__slide--clone"))return;let n=i.innerHTML;t.setAttribute("data-html-"+e,encodeURIComponent(n)),e++}))})),r=a.querySelectorAll("[data-html]"),Array.prototype.forEach.call(r,(t=>{let e=decodeURIComponent(t.getAttribute("data-html"));e=e.replace(/{id}/g,s.makeId()),t.innerHTML=e;let i=t.querySelectorAll("[data-subblock]");var n=1;Array.prototype.forEach.call(i,(e=>{e.innerHTML=void 0===t.getAttribute("data-html-"+n)?"":decodeURIComponent(t.getAttribute("data-html-"+n)),n++}))})),e&&(qo={},r=a.querySelectorAll("[data-html]"),Array.prototype.forEach.call(r,(t=>{let e=s.makeId();qo[e]=t.getAttribute("data-html"),t.setAttribute("data-html",e);for(let i=1;i<=20;i++)void 0!==t.getAttribute("data-html-"+i)&&(e=s.makeId(),qo[e]=t.getAttribute("data-html-"+i),t.getAttribute("data-html-"+i,e));void 0!==t.getAttribute("data-settings")&&(e=s.makeId(),qo[e]=t.getAttribute("data-settings"),t.getAttribute("data-settings",e))}))),this.builder.makeAbsolute){const t=t=>{let e=document.createElement("img");return e.src=t,e.setAttribute("data-absoluteurl",e.src),t=e.getAttribute("data-absoluteurl")},e=t=>{let e=document.createElement("img");e.src=t,e.setAttribute("data-absoluteurl",e.src),t=e.getAttribute("data-absoluteurl");let i=window.location.href.substring(0,window.location.href.lastIndexOf("/"));return t.replace(i,"[%PATH%]")},i=(e,i)=>{if(e.hasAttribute(i)){if("video"!==e.parentNode.tagName.toLowerCase()&&"audio"!==e.parentNode.tagName.toLowerCase())return;let n=e.getAttribute(i);n=t(n),e.setAttribute(i,`${n}`)}};let n=a.querySelectorAll("img");Array.prototype.forEach.call(n,(t=>{let e=t.src;t.setAttribute("src",e)})),a.querySelectorAll("*").forEach((n=>{if(n.style.backgroundImage){let t=n.style.backgroundImage;if(-1!==t.indexOf("url(")){let i=t.slice(4,-1).replace(/["']/g,"");i=e(i),n.style.backgroundImage=`url(${i})`}}if(i(n,"src"),i(n,"data-default"),i(n,"data-240"),i(n,"data-360"),i(n,"data-480"),i(n,"data-540"),i(n,"data-720"),i(n,"data-1080"),i(n,"data-1440"),i(n,"data-2160"),n.hasAttribute("href")&&"link"===n.tagName.toLowerCase()){let e=n.getAttribute("href");e=t(e),n.setAttribute("href",`${e}`)}}))}let c=a.querySelectorAll(".is-builder");Array.prototype.forEach.call(c,(t=>{t.style.transform="",t.style.WebkitTransform="",t.style.MozTransform="",t.removeAttribute("data-sort"),o.removeClass(t,"builder-active");o.elementChildren(t).forEach((t=>{o.elementChildren(t).forEach((t=>{t.style.cursor=""}))}))}));let u;if(o.elementChildren(a).forEach((t=>{t.style.cursor="";o.elementChildren(t).forEach((t=>{t.style.cursor=""}))})),u=a.querySelectorAll(".sortable-chosen, .sortable-ghost, .elm-active, .icon-active, .elm-inspected, .cell-active, .row-active, .row-outline, .is-builder"),u.forEach((t=>{t.classList.remove("sortable-chosen"),t.classList.remove("sortable-ghost"),t.classList.remove("elm-active"),t.classList.remove("icon-active"),t.classList.remove("elm-inspected"),t.classList.remove("cell-active"),t.classList.remove("row-active"),t.classList.remove("row-outline"),t.classList.remove("is-builder")})),u=a.querySelectorAll("[data-click], [contenteditable], [draggridoutline], [between-blocks-left], [between-blocks-center], [hideelementhighlight], [data-module-active], [draggable]"),u.forEach((t=>{t.removeAttribute("data-click"),t.removeAttribute("contenteditable"),t.removeAttribute("draggridoutline"),t.removeAttribute("between-blocks-left"),t.removeAttribute("between-blocks-center"),t.removeAttribute("hideelementhighlight"),t.removeAttribute("data-module-active"),t.removeAttribute("draggable")})),u=a.querySelectorAll("[data-animated], [data-saveforundo], [hidesnippetaddtool], [gray], [rowoutline], [hidecolumntool], [grayoutline], [hideoutline]"),u.forEach((t=>{t.removeAttribute("data-animated"),t.removeAttribute("data-saveforundo"),t.removeAttribute("hidesnippetaddtool"),t.removeAttribute("gray"),t.removeAttribute("rowoutline"),t.removeAttribute("hidecolumntool"),t.removeAttribute("grayoutline"),t.removeAttribute("hideoutline")})),u=a.querySelectorAll("[leftrowtool], [minimal], [clean], [grideditor], [gridoutline]"),u.forEach((t=>{t.removeAttribute("leftrowtool"),t.removeAttribute("minimal"),t.removeAttribute("clean"),t.removeAttribute("grideditor"),t.removeAttribute("gridoutline")})),u=a.querySelectorAll(".is-row-tool,.is-col-tool,.is-rowadd-tool,.is-canvas-tool,.is-canvasadd-tool,.h-ruler,.v-ruler"),u.forEach((t=>{t.previousSibling&&t.previousSibling.nodeType===Node.TEXT_NODE&&t.previousSibling.remove(),t.nextSibling&&t.nextSibling.nodeType===Node.TEXT_NODE&&t.nextSibling.remove(),t.remove()})),u=a.querySelectorAll(".ovl,.row-add-initial"),u.forEach((t=>{t.remove()})),this.builder.cleanAOS&&(u=a.querySelectorAll(".aos-init, .aos-animate"),u.forEach((t=>{t.classList.remove("aos-init"),t.classList.remove("aos-animate")}))),u=a.querySelectorAll(".skrollable, .skrollable-after, .skrollable-before, .skrollable-between, .is-inview"),u.forEach((t=>{t.classList.remove("skrollable"),t.classList.remove("skrollable-after"),t.classList.remove("skrollable-before"),t.classList.remove("skrollable-between"),t.classList.remove("is-inview")})),a.querySelectorAll('[class=""]').forEach((t=>{t.removeAttribute("class")})),a.querySelectorAll(".is-row-overlay").forEach((t=>{t.hasAttribute("style")||t.parentNode.removeChild(t)})),o.removeEmptyStyle(a),u=a.querySelectorAll("[data-keep]"),o.removeAttributes(u,"data-keep"),a.querySelectorAll("a").forEach((t=>{"inline-block"===t.style.display&&1===t.parentNode.childElementCount&&"span"===t.parentNode.tagName.toLowerCase()&&(t.parentNode.outerHTML=t.parentNode.innerHTML)})),n){a.querySelectorAll("[data-html]").forEach((t=>{t.innerHTML=""}))}if(l="",i){u=a.querySelectorAll(".is-dummy"),u.forEach((t=>{t.remove()})),u=a.querySelectorAll("[data-scroll], [data-scroll-once]"),u.forEach((t=>{t.removeAttribute("data-scroll"),t.removeAttribute("data-scroll-once")})),this.builder.shortenOutput&&(u=a.querySelectorAll("[data-noedit], [data-module], [data-module-desc], [data-dialog-width], [data-dialog-height], [data-html], [data-settings]"),u.forEach((t=>{t.removeAttribute("data-noedit"),t.removeAttribute("data-module"),t.removeAttribute("data-module-desc"),t.removeAttribute("data-dialog-width"),t.removeAttribute("data-dialog-height"),t.removeAttribute("data-html"),t.removeAttribute("data-settings")})),u=a.querySelectorAll("[data-html-1], [data-html-2], [data-html-3], [data-html-4], [data-html-5], [data-html-6], [data-html-7], [data-html-8], [data-html-9], [data-html-10]"),u.forEach((t=>{t.removeAttribute("data-html-1"),t.removeAttribute("data-html-2"),t.removeAttribute("data-html-3"),t.removeAttribute("data-html-4"),t.removeAttribute("data-html-5"),t.removeAttribute("data-html-6"),t.removeAttribute("data-html-7"),t.removeAttribute("data-html-8"),t.removeAttribute("data-html-9"),t.removeAttribute("data-html-10")}))),u=a.querySelectorAll("[data-bottom-top],[data-center],[data-center-bottom],[data-100-top],[data-50-top],[data-top],[data-top-bottom],[data-center-top],[data--300-bottom],[data--150-bottom],[data--50-bottom],[data-bottom],[data-100-bottom],[data-150-bottom],[data-400-bottom],[data--400-bottom],[data--200-bottom],[data--100-bottom],[data-50-bottom],[data-200-bottom],[data-300-bottom],[data-in],[data-in-150],[data-in-300],[data-cen--150],[data-cen],[data-cen-150],[data-out--300],[data-out--150],[data-out][data-t],[data-t-100],[data-t-200],[data-t-300],[data-t-400],[data-t-500],[data-t-600],[data-t-700],[data-t-800],[data-t-900],[data-t-1000],[data-t-1100],[data-t-1200],[data-t-1300],[data-t-1400],[data-t-1500],[data-t-1600],[data-t-1700],[data-t-1800],[data-t-1900],[data-t-2000],[data-t-2100],[data-t-2200],[data-t-2300],[data-t-2400],[data-t-2500],[data-t-2600],[data-t-2700],[data-t-2800]"),Array.prototype.forEach.call(u,(t=>{t.style.transition="",t.style.transform="",t.style.opacity=""})),u=a.querySelectorAll(".is-animated"),Array.prototype.forEach.call(u,(t=>{o.removeClass(t,"animated"),o.removeClass(t,"pulse"),o.removeClass(t,"bounceIn"),o.removeClass(t,"fadeIn"),o.removeClass(t,"fadeOut"),o.removeClass(t,"fadeInDown"),o.removeClass(t,"fadeInLeft"),o.removeClass(t,"fadeInRight"),o.removeClass(t,"fadeInUp"),o.removeClass(t,"flipInX"),o.removeClass(t,"flipInY"),o.removeClass(t,"slideInUp"),o.removeClass(t,"slideInDown"),o.removeClass(t,"slideInLeft"),o.removeClass(t,"slideInRight"),o.removeClass(t,"zoomIn"),t.style.animationDelay="",t.style.transitionDelay="",t.style.transitionDuration="",t.style.transitionTimingFunction="",t.style.transitionProperty=""}));let t=a.querySelectorAll('[style=""]');Array.prototype.forEach.call(t,(t=>{t.removeAttribute("style")})),u=a.querySelectorAll(".is-appeared, .box-active, .section-active, .section-select, .box-select"),u.forEach((t=>{t.classList.remove("is-appeared"),t.classList.remove("box-active"),t.classList.remove("section-active"),t.classList.remove("section-select"),t.classList.remove("box-select")})),u=a.querySelectorAll(".is-section-tool, .is-box-tool, .is-box-info, .is-section-info"),u.forEach((t=>{t.previousSibling&&t.previousSibling.nodeType===Node.TEXT_NODE&&t.previousSibling.remove(),t.nextSibling&&t.nextSibling.nodeType===Node.TEXT_NODE&&t.nextSibling.remove(),t.remove()})),u=a.querySelectorAll(".is-block .handle, .is-block .rotate-handle"),o.removeElements(u),u=a.querySelectorAll(".is-block"),Array.prototype.forEach.call(u,(t=>{o.removeClass(t,"active"),o.removeClass(t,"multi"),o.removeClass(t,"editable"),o.removeClass(t,"fluid"),o.removeClass(t,"cloned"),t.removeAttribute("data-fluid-val"),t.removeAttribute("data-fluid"),t.removeAttribute("data-prev")})),a.querySelectorAll(".is-block.clone").forEach((t=>t.parentNode.removeChild(t)));var d="",b="",h="";o.elementChildren(a).forEach((t=>{let e=t;if(o.hasClass(e,"is-section")){var i="";e.getAttribute("class")&&(i=' class="'+e.getAttribute("class")+'"');var n=e.cloneNode(!0),s=n.outerHTML;l+=s,-1===i.indexOf("is-static")?d+=s+"\n\n":b+=s+"\n\n"}else s=(n=e.cloneNode(!0)).outerHTML,l+=s,h+=s}));let e=document.querySelector("[data-contentbox]"),i=!1;e&&(i=e.settings.disableStaticSection),i||(l=d+b+h),l=a.innerHTML.trim(),l=l.replace(/<font/g,"<span").replace(/<\/font/g,"</span")}else{let t=a.querySelectorAll('[style=""]');Array.prototype.forEach.call(t,(t=>{t.removeAttribute("style")})),this.builder.shortenOutput&&(u=a.querySelectorAll("[data-noedit], [data-module], [data-module-desc], [data-dialog-width], [data-dialog-height], [data-html], [data-settings]"),u.forEach((t=>{t.removeAttribute("data-noedit"),t.removeAttribute("data-module"),t.removeAttribute("data-module-desc"),t.removeAttribute("data-dialog-width"),t.removeAttribute("data-dialog-height"),t.removeAttribute("data-html"),t.removeAttribute("data-settings")})),u=a.querySelectorAll("[data-html-1], [data-html-2], [data-html-3], [data-html-4], [data-html-5], [data-html-6], [data-html-7], [data-html-8], [data-html-9], [data-html-10]"),u.forEach((t=>{t.removeAttribute("data-html-1"),t.removeAttribute("data-html-2"),t.removeAttribute("data-html-3"),t.removeAttribute("data-html-4"),t.removeAttribute("data-html-5"),t.removeAttribute("data-html-6"),t.removeAttribute("data-html-7"),t.removeAttribute("data-html-8"),t.removeAttribute("data-html-9"),t.removeAttribute("data-html-10")}))),u=a.querySelectorAll(".is-block .handle, .is-block .rotate-handle"),o.removeElements(u),u=a.querySelectorAll(".is-block"),Array.prototype.forEach.call(u,(t=>{o.removeClass(t,"active"),o.removeClass(t,"multi"),o.removeClass(t,"editable"),o.removeClass(t,"fluid"),o.removeClass(t,"cloned"),t.removeAttribute("data-fluid-val"),t.removeAttribute("data-fluid"),t.removeAttribute("data-prev")})),a.querySelectorAll(".is-block.clone").forEach((t=>t.parentNode.removeChild(t))),l=a.innerHTML.trim(),l=l.replace(/<font/g,"<span").replace(/<\/font/g,"</span")}let p=Wn.html;return l=p(l),l=l.replace(/(\r\n|\r|\n){3,}/g,"$1\n"),l}beautify(t){return t=(t=(0,Wn.html)(t)).replace(/(\r\n|\r|\n){3,}/g,"$1\n")}}class Mo{constructor(t){this.builder=t;const e=this.builder.dom;this.dom=e,this.undoList=[]}readStyles(){if(this.builder.opts.undoContainerOnly)return"";let t,e,i="",n=this.builder.doc.getElementsByTagName("link");for(t=0;t<n.length;t++)e=n[t].href.toLowerCase(),-1!==e.indexOf("basetype-")&&(i+=n[t].outerHTML);for(n=this.builder.doc.getElementsByTagName("link"),t=0;t<n.length;t++)e=n[t].href.toLowerCase(),-1!==e.indexOf("basetype-")||-1!==e.indexOf("type-")&&(i+=n[t].outerHTML);return i}writeStyles(t){const e=this.dom;if(this.builder.opts.undoContainerOnly)return;let i,n,o=this.builder.doc.getElementsByTagName("link");for(i=0;i<o.length;i++)n=o[i].href.toLowerCase(),(-1!==n.indexOf("basetype-")||-1!==n.indexOf("type-"))&&o[i].parentNode.removeChild(o[i]);let s=this.builder.doc.getElementsByTagName("head")[0];e.appendHtml(s,t)}readHtml(){if(""===this.builder.opts.page||this.builder.opts.undoContainerOnly){if(this.builder.docContainer){return this.builder.doc.querySelector(this.builder.docContainer).innerHTML}{const t=this.builder.doc.querySelectorAll(this.builder.opts.container);let e="";return Array.prototype.forEach.call(t,(t=>{e+=t.innerHTML+"####|####"})),e=e.substr(0,e.length-9),e}}return this.builder.doc.querySelector(this.builder.opts.page).innerHTML}cleaning(t){const e=this.dom;let i=t.querySelectorAll(".is-builder");Array.prototype.forEach.call(i,(t=>{t.removeAttribute("data-sort")}));let n=t.querySelectorAll("[data-click]");e.removeAttributes(n,"data-click"),e.removeElements(t.querySelectorAll(".is-row-tool")),e.removeElements(t.querySelectorAll(".is-rowadd-tool")),e.removeElements(t.querySelectorAll(".is-col-tool")),e.removeElements(t.querySelectorAll(".is-canvas-tool")),e.removeElements(t.querySelectorAll(".is-canvasadd-tool")),e.removeElements(t.querySelectorAll(".ovl")),e.removeElements(t.querySelectorAll(".row-add-initial")),e.removeElements(t.querySelectorAll(".h-ruler")),e.removeElements(t.querySelectorAll(".v-ruler")),n=t.querySelectorAll(".is-block .handle, .is-block .rotate-handle"),e.removeElements(n),n=t.querySelectorAll(".is-block"),Array.prototype.forEach.call(n,(t=>{e.removeClass(t,"active"),e.removeClass(t,"multi"),e.removeClass(t,"editable"),e.removeClass(t,"fluid"),e.removeClass(t,"cloned"),t.removeAttribute("data-fluid-val"),t.removeAttribute("data-fluid"),t.removeAttribute("data-prev")})),t.querySelectorAll(".is-block.clone").forEach((t=>t.parentNode.removeChild(t))),n=t.querySelectorAll(".is-section-tool"),e.removeElements(n)}writeHtml(t){if(""===this.builder.opts.page||this.builder.opts.undoContainerOnly)if(this.builder.docContainer){let e=this.builder.doc.querySelector(this.builder.docContainer),i=document.createRange();e.innerHTML="",e.appendChild(i.createContextualFragment(t)),this.cleaning(e)}else{const e=this.builder.doc.querySelectorAll(this.builder.opts.container);let i=0;Array.prototype.forEach.call(e,(e=>{var n=document.createRange();e.innerHTML="",e.appendChild(n.createContextualFragment(t.split("####|####")[i])),this.cleaning(e),this.builder.applyBehaviorOn(e),i++}))}else{let e=this.builder.doc.querySelector(this.builder.opts.page),i=document.createRange();e.innerHTML="",e.appendChild(i.createContextualFragment(t)),this.cleaning(e)}this.builder.opts.onRender()}saveForUndo(t){if(this.builder.onBeforeSaveForUndo&&this.builder.onBeforeSaveForUndo(),this.builder.undoRedoStyles){if(this.undoList[120]){let e=this.undoList[120][0].split("###$###")[1];if(this.builder.saveForUndoCheck&&e===this.readHtml())return void(this.builder.saveForUndoCheck=!0===t)}}else if(this.undoList[120]){let e=this.undoList[120][0];if(this.builder.saveForUndoCheck&&e===this.readHtml())return void(this.builder.saveForUndoCheck=!0===t)}if(this.builder.saveForUndoCheck=!0===t,this.undoList[140]=this.undoList[139],this.undoList[139]=this.undoList[138],this.undoList[138]=this.undoList[137],this.undoList[137]=this.undoList[136],this.undoList[136]=this.undoList[135],this.undoList[135]=this.undoList[134],this.undoList[134]=this.undoList[133],this.undoList[133]=this.undoList[132],this.undoList[132]=this.undoList[131],this.undoList[131]=this.undoList[130],this.undoList[130]=this.undoList[129],this.undoList[129]=this.undoList[128],this.undoList[128]=this.undoList[127],this.undoList[127]=this.undoList[126],this.undoList[126]=this.undoList[125],this.undoList[125]=this.undoList[124],this.undoList[124]=this.undoList[123],this.undoList[123]=this.undoList[122],this.undoList[122]=this.undoList[121],this.undoList[121]=this.undoList[120],this.builder.undoRedoStyles){let t=" "+this.readStyles()+"###$###"+this.readHtml();this.undoList[120]=[t,null]}else this.undoList[120]=[this.readHtml(),null]}doUndo(){const t=this.dom;if(!this.undoList[120])return;if(!0===this.builder.undoRedoInProcess)return;if(this.builder.undoRedoInProcess=!0,this.undoList[99]=this.undoList[100],this.undoList[100]=this.undoList[101],this.undoList[101]=this.undoList[102],this.undoList[102]=this.undoList[103],this.undoList[103]=this.undoList[104],this.undoList[104]=this.undoList[105],this.undoList[105]=this.undoList[106],this.undoList[106]=this.undoList[107],this.undoList[107]=this.undoList[108],this.undoList[108]=this.undoList[109],this.undoList[109]=this.undoList[110],this.undoList[110]=this.undoList[111],this.undoList[111]=this.undoList[112],this.undoList[112]=this.undoList[113],this.undoList[113]=this.undoList[114],this.undoList[114]=this.undoList[115],this.undoList[115]=this.undoList[116],this.undoList[116]=this.undoList[117],this.undoList[117]=this.undoList[118],this.undoList[118]=this.undoList[119],this.builder.undoRedoStyles){let t=this.readStyles(),e=this.readHtml(),i=" "+t+"###$###"+e;this.undoList[119]=[i,null],i=this.undoList[120][0],t=i.split("###$###")[0].trim(),e=i.split("###$###")[1],this.writeStyles(t),this.writeHtml(e)}else{this.undoList[119]=[this.readHtml(),null];let t=this.undoList[120][0];this.writeHtml(t)}this.builder.applyBehavior(),this.builder.applyBehaviorCanvas(),this.builder.opts.onChange(),this.undoList[120]=this.undoList[121],this.undoList[121]=this.undoList[122],this.undoList[122]=this.undoList[123],this.undoList[123]=this.undoList[124],this.undoList[124]=this.undoList[125],this.undoList[125]=this.undoList[126],this.undoList[126]=this.undoList[127],this.undoList[127]=this.undoList[128],this.undoList[128]=this.undoList[129],this.undoList[129]=this.undoList[130],this.undoList[130]=this.undoList[131],this.undoList[131]=this.undoList[132],this.undoList[132]=this.undoList[133],this.undoList[133]=this.undoList[134],this.undoList[134]=this.undoList[135],this.undoList[135]=this.undoList[136],this.undoList[136]=this.undoList[137],this.undoList[137]=this.undoList[138],this.undoList[138]=this.undoList[139],this.undoList[139]=this.undoList[140],this.undoList[140]=this.undoList[141];const e=new se(this.builder);e.clearActiveCell(),e.clearAfterUndoRedo();let i=this.builder.doc.querySelector("[data-saveforundo]");if(i){let e=document.querySelector(".is-side.elementstyles");t.addClass(e,"active"),setTimeout((()=>{i.click()}),700)}else{let e=document.querySelector(".is-side.elementstyles");t.removeClass(e,"active")}this.builder.opts.onUndo&&this.builder.opts.onUndo(),this.builder.undoRedoInProcess=!1}doRedo(){const t=this.dom;if(!this.undoList[119])return;if(!0===this.builder.undoRedoInProcess)return;if(this.builder.undoRedoInProcess=!0,this.undoList[141]=this.undoList[140],this.undoList[140]=this.undoList[139],this.undoList[139]=this.undoList[138],this.undoList[138]=this.undoList[137],this.undoList[137]=this.undoList[136],this.undoList[136]=this.undoList[135],this.undoList[135]=this.undoList[134],this.undoList[134]=this.undoList[133],this.undoList[133]=this.undoList[132],this.undoList[132]=this.undoList[131],this.undoList[131]=this.undoList[130],this.undoList[130]=this.undoList[129],this.undoList[129]=this.undoList[128],this.undoList[128]=this.undoList[127],this.undoList[127]=this.undoList[126],this.undoList[126]=this.undoList[125],this.undoList[125]=this.undoList[124],this.undoList[124]=this.undoList[123],this.undoList[123]=this.undoList[122],this.undoList[122]=this.undoList[121],this.undoList[121]=this.undoList[120],this.builder.undoRedoStyles){let t=this.readStyles(),e=this.readHtml(),i=" "+t+"###$###"+e;this.undoList[120]=[i,null],i=this.undoList[119][0],t=i.split("###$###")[0].trim(),e=i.split("###$###")[1],this.writeStyles(t),this.writeHtml(e)}else{this.undoList[120]=[this.readHtml(),null];let t=this.undoList[119][0];this.writeHtml(t)}this.builder.applyBehavior(),this.builder.applyBehaviorCanvas(),this.builder.opts.onChange(),this.undoList[119]=this.undoList[118],this.undoList[118]=this.undoList[117],this.undoList[117]=this.undoList[116],this.undoList[116]=this.undoList[115],this.undoList[115]=this.undoList[114],this.undoList[114]=this.undoList[113],this.undoList[113]=this.undoList[112],this.undoList[112]=this.undoList[111],this.undoList[111]=this.undoList[110],this.undoList[110]=this.undoList[109],this.undoList[109]=this.undoList[108],this.undoList[108]=this.undoList[107],this.undoList[107]=this.undoList[106],this.undoList[106]=this.undoList[105],this.undoList[105]=this.undoList[104],this.undoList[104]=this.undoList[103],this.undoList[103]=this.undoList[102],this.undoList[102]=this.undoList[101],this.undoList[101]=this.undoList[100],this.undoList[100]=this.undoList[99],this.undoList[99]=null;const e=new se(this.builder);e.clearActiveCell(),e.clearAfterUndoRedo();let i=this.builder.doc.querySelector("[data-saveforundo]");if(i){let e=document.querySelector(".is-side.elementstyles");t.addClass(e,"active"),setTimeout((()=>{i.click()}),700)}else{let e=document.querySelector(".is-side.elementstyles");t.removeClass(e,"active")}this.builder.opts.onRedo&&this.builder.opts.onRedo(),this.builder.undoRedoInProcess=!1}}
8
8
  /*!
9
9
  Ionicons
10
10
  License: MIT