1?o:1,n.choiceList.scrollTop=i-s,i>a&&(A=!0)),A&&requestAnimationFrame(function(n){e(n,a,t)})};requestAnimationFrame(function(e){s(e,a,t)})}}},{key:"_highlightChoice",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=Array.from(this.dropdown.querySelectorAll("[data-choice-selectable]")),r=t;if(n&&n.length){var i=Array.from(this.dropdown.querySelectorAll("."+this.config.classNames.highlightedState));i.forEach(function(t){t.classList.remove(e.config.classNames.highlightedState),t.setAttribute("aria-selected","false")}),r?this.highlightPosition=n.indexOf(r):(r=n.length>this.highlightPosition?n[this.highlightPosition]:n[n.length-1],r||(r=n[0])),r.classList.add(this.config.classNames.highlightedState),r.setAttribute("aria-selected","true"),this.containerOuter.setAttribute("aria-activedescendant",r.id)}}},{key:"_addItem",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,A=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,a=(0,h.isType)("String",e)?e.trim():e,s=o,l=this.store.getItems(),c=t||a,u=parseInt(n,10)||-1,d=r>=0?this.store.getGroupById(r):null,f=l?l.length+1:1;return this.config.prependValue&&(a=this.config.prependValue+a.toString()),this.config.appendValue&&(a+=this.config.appendValue.toString()),this.store.dispatch((0,p.addItem)(a,c,f,u,r,i,A,s)),this.isSelectOneElement&&this.removeActiveItems(f),d&&d.value?(0,h.triggerEvent)(this.passedElement,"addItem",{
id:f,value:a,label:c,groupValue:d.value,keyCode:s}):(0,h.triggerEvent)(this.passedElement,"addItem",{id:f,value:a,label:c,keyCode:s}),this}},{key:"_removeItem",value:function(e){if(!e||!(0,h.isType)("Object",e))return this;var t=e.id,n=e.value,r=e.label,i=e.choiceId,A=e.groupId,o=A>=0?this.store.getGroupById(A):null;return this.store.dispatch((0,p.removeItem)(t,i)),o&&o.value?(0,h.triggerEvent)(this.passedElement,"removeItem",{id:t,value:n,label:r,groupValue:o.value}):(0,h.triggerEvent)(this.passedElement,"removeItem",{id:t,value:n,label:r}),this}},{key:"_addChoice",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,A=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=arguments.length>6&&void 0!==arguments[6]&&arguments[6],a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;if("undefined"!=typeof e&&null!==e){var s=this.store.getChoices(),l=t||e,c=s?s.length+1:1,u=this.baseId+"-"+this.idNames.itemChoice+"-"+c;this.store.dispatch((0,p.addChoice)(e,l,c,i,r,u,A,o,a)),n&&this._addItem(e,l,c,void 0,A,o,a)}}},{key:"_clearChoices",value:function(){this.store.dispatch((0,p.clearChoices)())}},{key:"_addGroup",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"value",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"label",A=(0,h.isType)("Object",e)?e.choices:Array.from(e.getElementsByTagName("OPTION")),o=t?t:Math.floor((new Date).valueOf()*Math.random()),a=!!e.disabled&&e.disabled;A?(this.store.dispatch((0,p.addGroup)(e.label,o,!0,a)),A.forEach(function(e){var t=e.disabled||e.parentNode&&e.parentNode.disabled;n._addChoice(e[r],(0,h.isType)("Object",e)?e[i]:e.innerHTML,e.selected,t,o,e.customProperties,e.placeholder)})):this.store.dispatch((0,p.addGroup)(e.label,e.id,!1,e.disabled))}},{key:"_getTemplate",value:function(e){if(!e)return null;for(var t=this.config.templates,n=arguments.length,r=Array(n>1?n-1:0),i=1;i\n \n ')},containerInner:function(){return(0,h.strToEl)('\n
\n ')},itemList:function(){var n,r=(0,u.default)(t.list,(n={},i(n,t.listSingle,e.isSelectOneElement),i(n,t.listItems,!e.isSelectOneElement),n));return(0,h.strToEl)('\n
\n ')},placeholder:function(e){return(0,h.strToEl)('\n \n '+e+"\n
\n ")},item:function(n){var r,A=(0,u.default)(t.item,(r={},i(r,t.highlightedState,n.highlighted),i(r,t.itemSelectable,!n.highlighted),i(r,t.placeholder,n.placeholder),r));if(e.config.removeItemButton){var o;return A=(0,u.default)(t.item,(o={},i(o,t.highlightedState,n.highlighted),i(o,t.itemSelectable,!n.disabled),i(o,t.placeholder,n.placeholder),o)),(0,h.strToEl)('\n \n "+n.label+'\n Remove item\n \n
\n ")}return(0,h.strToEl)('\n \n "+n.label+"\n
\n ")},choiceList:function(){return(0,h.strToEl)('\n \n
\n ")},choiceGroup:function(e){var n=(0,u.default)(t.group,i({},t.itemDisabled,e.disabled));return(0,h.strToEl)('\n \n ")},choice:function(n){var r,A=(0,u.default)(t.item,t.itemChoice,(r={},i(r,t.itemDisabled,n.disabled),i(r,t.itemSelectable,!n.disabled),i(r,t.placeholder,n.placeholder),r));return(0,h.strToEl)('\n 0?'role="treeitem"':'role="option"')+"\n >\n "+n.label+"\n
\n ")},input:function(){var e=(0,u.default)(t.input,t.inputCloned);return(0,h.strToEl)('\n \n ')},dropdown:function(){var e=(0,u.default)(t.list,t.listDropdown);return(0,h.strToEl)('\n \n
\n ')},notice:function(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",A=(0,u.default)(t.item,t.itemChoice,(n={},i(n,t.noResults,"no-results"===r),i(n,t.noChoices,"no-choices"===r),n));return(0,h.strToEl)('\n \n '+e+"\n
\n ")},option:function(e){return(0,h.strToEl)('\n '+e.label+" \n ")}},r=this.config.callbackOnCreateTemplates,A={};r&&(0,h.isType)("Function",r)&&(A=r.call(this,h.strToEl)),this.config.templates=(0,h.extend)(n,A)}},{key:"_setLoading",value:function(e){this.store.dispatch((0,p.setIsLoading)(e))}},{key:"_createInput",value:function(){var e=this,t=this.passedElement.getAttribute("dir")||"ltr",n=this._getTemplate("containerOuter",t),r=this._getTemplate("containerInner"),i=this._getTemplate("itemList"),A=this._getTemplate("choiceList"),o=this._getTemplate("input"),a=this._getTemplate("dropdown");this.containerOuter=n,this.containerInner=r,this.input=o,this.choiceList=A,this.itemList=i,this.dropdown=a,this.passedElement.classList.add(this.config.classNames.input,this.config.classNames.hiddenState),this.passedElement.tabIndex="-1";var s=this.passedElement.getAttribute("style");if(Boolean(s)&&this.passedElement.setAttribute("data-choice-orig-style",s),this.passedElement.setAttribute("style","display:none;"),this.passedElement.setAttribute("aria-hidden","true"),this.passedElement.setAttribute("data-choice","active"),(0,h.wrap)(this.passedElement,r),(0,h.wrap)(r,n),this.isSelectOneElement?o.placeholder=this.config.searchPlaceholderValue||"":this.placeholder&&(o.placeholder=this.placeholder,o.style.width=(0,h.getWidthOfInput)(o)),this.config.addItems||this.disable(),n.appendChild(r),n.appendChild(a),r.appendChild(i),this.isTextElement||a.appendChild(A),this.isSelectMultipleElement||this.isTextElement?r.appendChild(o):this.canSearch&&a.insertBefore(o,a.firstChild),this.isSelectElement){var l=Array.from(this.passedElement.getElementsByTagName("OPTGROUP"));if(this.highlightPosition=0,this.isSearching=!1,this._setLoading(!0),l&&l.length)l.forEach(function(t){e._addGroup(t,t.id||null)});else{var c=Array.from(this.passedElement.options),u=this.config.sortFilter,d=this.presetChoices;c.forEach(function(e){d.push({value:e.value,label:e.innerHTML,selected:e.selected,disabled:e.disabled||e.parentNode.disabled,placeholder:e.hasAttribute("placeholder")})}),this.config.shouldSort&&d.sort(u);var f=d.some(function(e){return e.selected});d.forEach(function(t,n){if(e.isSelectOneElement){var r=f||!f&&n>0;e._addChoice(t.value,t.label,!r||t.selected,!!r&&t.disabled,void 0,t.customProperties,t.placeholder)}else e._addChoice(t.value,t.label,t.selected,t.disabled,void 0,t.customProperties,t.placeholder)})}this._setLoading(!1)}else this.isTextElement&&this.presetItems.forEach(function(t){var n=(0,h.getType)(t);if("Object"===n){if(!t.value)return;e._addItem(t.value,t.label,t.id,void 0,t.customProperties,t.placeholder)}else"String"===n&&e._addItem(t)})}}]),e}();e.exports=g},function(e,t,n){!function(t){"use strict";function n(){console.log.apply(console,arguments)}function r(e,t){var n;this.list=e,this.options=t=t||{};for(n in a)a.hasOwnProperty(n)&&("boolean"==typeof a[n]?this.options[n]=n in t?t[n]:a[n]:this.options[n]=t[n]||a[n])}function i(e,t,n){var r,o,a,s,l,c;if(t){if(a=t.indexOf("."),a!==-1?(r=t.slice(0,a),o=t.slice(a+1)):r=t,s=e[r],null!==s&&void 0!==s)if(o||"string"!=typeof s&&"number"!=typeof s)if(A(s))for(l=0,c=s.length;l1)throw new Error("Key weight has to be > 0 and <= 1");e=e.name}else this._keyMap[e]={weight:1};this._analyze(e,A(c,e,[]),c,n)}},r.prototype._analyze=function(e,t,r,i){var o,a,s,l,c,u,d,f,p,h,g,m,v,B,w,y=this.options,b=!1;if(void 0!==t&&null!==t){a=[];var C=0;if("string"==typeof t){if(o=t.split(y.tokenSeparator),y.verbose&&n("---------\nKey:",e),this.options.tokenize){for(B=0;B=this.tokenSearchers.length,y.verbose&&n("Check Matches",v),(b||d.isMatch)&&v&&(s=this.resultMap[i],s?s.output.push({key:e,score:c,matchedIndices:d.matchedIndices}):(this.resultMap[i]={item:r,output:[{key:e,score:c,matchedIndices:d.matchedIndices}]},this.results.push(this.resultMap[i])))}else if(A(t))for(B=0;B0){if(t={item:o.item},l.indexOf("matches")!==-1)for(r=o.output,t.matches=[],n=0;nE.maxPatternLength){if(v=e.match(new RegExp(this.pattern.replace(E.tokenSeparator,"|"))),B=!!v)for(y=[],t=0,b=v.length;t=u;n--)if(h=this.patternAlphabet[e.charAt(n-1)],h&&(w[n-1]=1),f[n]=(f[n+1]<<1|1)&h,0!==t&&(f[n]|=(p[n+1]|p[n])<<1|1|p[n+1]),f[n]&this.matchmask&&(g=this._bitapScore(t,n-1),g<=o)){if(o=g,a=n-1,m.push(a),a<=A)break;u=Math.max(1,2*A-a)}if(this._bitapScore(t+1,A)>o)break;p=f}return y=this._getMatchedIndices(w),{isMatch:a>=0,score:0===g?.001:g,matchedIndices:y}},o.prototype._getMatchedIndices=function(e){for(var t,n=[],r=-1,i=-1,A=0,o=e.length;A=this.options.minMatchCharLength&&n.push([r,i]),r=-1);return e[A-1]&&A-1-r+1>=this.options.minMatchCharLength&&n.push([r,A-1]),n},e.exports=r}(this)},function(e,t,n){var r,i;!function(){"use strict";function n(){for(var e=[],t=0;t0&&void 0!==arguments[0]?arguments[0]:this.getItems(),t=e.reduce(function(e,t){return e.push(t.value),e},[]);return t}},{key:"getChoices",value:function(){var e=this.store.getState();return e.choices}},{key:"getChoicesFilteredByActive",value:function(){var e=this.getChoices(),t=e.filter(function(e){return e.active===!0});return t}},{key:"getChoicesFilteredBySelectable",value:function(){var e=this.getChoices(),t=e.filter(function(e){return e.disabled!==!0});return t}},{key:"getSearchableChoices",value:function(){var e=this.getChoicesFilteredBySelectable();return e.filter(function(e){return e.placeholder!==!0})}},{key:"getChoiceById",value:function(e){if(e){var t=this.getChoicesFilteredByActive(),n=t.find(function(t){return t.id===parseInt(e,10)});return n}return!1}},{key:"getGroups",value:function(){var e=this.store.getState();return e.groups}},{key:"getGroupsFilteredByActive",value:function(){var e=this.getGroups(),t=this.getChoices(),n=e.filter(function(e){var n=e.active===!0&&e.disabled===!1,r=t.some(function(e){return e.active===!0&&e.disabled===!1});return n&&r},[]);return n}},{key:"getGroupById",value:function(e){var t=this.getGroups(),n=t.find(function(t){return t.id===e});return n}},{key:"getPlaceholderChoice",value:function(){var e=this.getChoices(),t=[].concat(i(e)).reverse().find(function(e){return e.placeholder===!0});return t}}]),e}();t.default=c,e.exports=c},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.compose=t.applyMiddleware=t.bindActionCreators=t.combineReducers=t.createStore=void 0;var i=n(6),A=r(i),o=n(21),a=r(o),s=n(23),l=r(s),c=n(24),u=r(c),d=n(25),f=r(d),p=n(22);r(p),t.createStore=A.default,t.combineReducers=a.default,t.bindActionCreators=l.default,t.applyMiddleware=u.default,t.compose=f.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n){function r(){m===g&&(m=g.slice())}function A(){return h}function a(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;return r(),m.push(e),function(){if(t){t=!1,r();var n=m.indexOf(e);m.splice(n,1)}}}function c(e){if(!(0,o.default)(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if("undefined"==typeof e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(v)throw new Error("Reducers may not dispatch actions.");try{v=!0,h=p(h,e)}finally{v=!1}for(var t=g=m,n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(s)throw s;for(var r=!1,A={},o=0;o0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1];switch(t.type){case"ADD_ITEM":var r=[].concat(n(e),[{id:t.id,choiceId:t.choiceId,groupId:t.groupId,value:t.value,label:t.label,active:!0,highlighted:!1,customProperties:t.customProperties,placeholder:t.placeholder||!1,keyCode:null}]);return r.map(function(e){return e.highlighted&&(e.highlighted=!1),e});case"REMOVE_ITEM":return e.map(function(e){return e.id===t.id&&(e.active=!1),e});case"HIGHLIGHT_ITEM":return e.map(function(e){return e.id===t.id&&(e.highlighted=t.highlighted),e});default:return e}};t.default=r},function(e,t){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1];switch(t.type){case"ADD_GROUP":return[].concat(n(e),[{id:t.id,value:t.value,active:t.active,disabled:t.disabled}]);case"CLEAR_CHOICES":return e.groups=[];default:return e}};t.default=r},function(e,t){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1];switch(t.type){case"ADD_CHOICE":return[].concat(n(e),[{id:t.id,elementId:t.elementId,groupId:t.groupId,value:t.value,label:t.label||t.value,disabled:t.disabled||!1,selected:!1,active:!0,score:9999,customProperties:t.customProperties,placeholder:t.placeholder||!1,keyCode:null}]);case"ADD_ITEM":var r=e;return t.activateOptions&&(r=e.map(function(e){return e.active=t.active,e})),t.choiceId>-1&&(r=e.map(function(e){return e.id===parseInt(t.choiceId,10)&&(e.selected=!0),e})),r;case"REMOVE_ITEM":return t.choiceId>-1?e.map(function(e){return e.id===parseInt(t.choiceId,10)&&(e.selected=!1),e}):e;case"FILTER_CHOICES":var i=t.results,A=e.map(function(e){return e.active=i.some(function(t){return t.item.id===e.id&&(e.score=t.score,!0)}),e});return A;case"ACTIVATE_CHOICES":return e.map(function(e){return e.active=t.active,e});case"CLEAR_CHOICES":return e.choices=[];default:return e}};t.default=r},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{loading:!1},t=arguments[1];switch(t.type){case"LOADING":return{loading:t.isLoading};default:return e}};t.default=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addItem=function(e,t,n,r,i,A,o,a){return{type:"ADD_ITEM",value:e,label:t,id:n,choiceId:r,groupId:i,customProperties:A,placeholder:o,keyCode:a}},t.removeItem=function(e,t){return{type:"REMOVE_ITEM",id:e,choiceId:t}},t.highlightItem=function(e,t){return{type:"HIGHLIGHT_ITEM",id:e,highlighted:t}},t.addChoice=function(e,t,n,r,i,A,o,a,s){return{type:"ADD_CHOICE",value:e,label:t,id:n,groupId:r,disabled:i,elementId:A,customProperties:o,placeholder:a,keyCode:s}},t.filterChoices=function(e){return{type:"FILTER_CHOICES",results:e}},t.activateChoices=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return{type:"ACTIVATE_CHOICES",active:e}},t.clearChoices=function(){return{type:"CLEAR_CHOICES"}},t.addGroup=function(e,t,n,r){return{type:"ADD_GROUP",value:e,id:t,active:n,disabled:r}},t.clearAll=function(){return{type:"CLEAR_ALL"}},t.setIsLoading=function(e){return{type:"LOADING",isLoading:e}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=(t.capitalise=function(e){return e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})},t.generateChars=function(e){for(var t="",n=0;n=0?t:0},t.getElementOffset=function(e,t){var n=t;return n>1&&(n=1),n>0&&(n=0),Math.max(e.offsetHeight*n)},t.getAdjacentEl=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(e&&t){var r=e.parentNode.parentNode,i=Array.from(r.querySelectorAll(t)),A=i.indexOf(e),o=n>0?1:-1;return i[A+o]}},t.getScrollPosition=function(e){return"bottom"===e?Math.max((window.scrollY||window.pageYOffset)+(window.innerHeight||document.documentElement.clientHeight)):window.scrollY||window.pageYOffset},t.isInView=function(e,t,n){return this.getScrollPosition(t)>this.getElemDistance(e)+this.getElementOffset(e,n)},t.isScrolledIntoView=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(e){var r=void 0;return r=n>0?t.scrollTop+t.offsetHeight>=e.offsetTop+e.offsetHeight:e.offsetTop>=t.scrollTop}},t.stripHTML=function(e){return e.replace(/&/g,"&").replace(/>/g,"&rt;").replace(/"+a(t)+"");if(r.style.position="absolute",r.style.padding="0",r.style.top="-9999px",r.style.left="-9999px",r.style.width="auto",r.style.whiteSpace="pre",document.body.contains(e)&&window.getComputedStyle){var i=window.getComputedStyle(e);i&&(r.style.fontSize=i.fontSize,r.style.fontFamily=i.fontFamily,r.style.fontWeight=i.fontWeight,r.style.fontStyle=i.fontStyle,r.style.letterSpacing=i.letterSpacing,r.style.textTransform=i.textTransform,r.style.padding=i.padding)}document.body.appendChild(r),t&&r.offsetWidth!==e.offsetWidth&&(n=r.offsetWidth+4),document.body.removeChild(r)}return n+"px"},t.sortByAlpha=function(e,t){var n=(e.label||e.value).toLowerCase(),r=(t.label||t.value).toLowerCase();return nr?1:0},t.sortByScore=function(e,t){return e.score-t.score},t.triggerEvent=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=new CustomEvent(t,{detail:n,bubbles:!0,cancelable:!0});return e.dispatchEvent(r)}},function(e,t){"use strict";!function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}Array.from||(Array.from=function(){var e=Object.prototype.toString,t=function(t){return"function"==typeof t||"[object Function]"===e.call(t)},n=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t},r=Math.pow(2,53)-1,i=function(e){var t=n(e);return Math.min(Math.max(t,0),r)};return function(e){var n=this,r=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var A,o=arguments.length>1?arguments[1]:void 0;if("undefined"!=typeof o){if(!t(o))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(A=arguments[2])}for(var a,s=i(r.length),l=t(n)?Object(new n(s)):new Array(s),c=0;c>>0,i=arguments[1],A=0;A-1,v=window.navigator.userAgent.indexOf("rv:")>-1,B={attachTo:"body",showHSL:!0,showRGB:!0,showHEX:!0,showAlpha:!1,color:"#ff0000",palette:null,paletteEditable:!1},w=[200,150],y=[150,16],b=y,C="H",E="S",Q="L",F="RGB",U="R",_="G",H="B",T="RGBHEX",S="COLOR",x="RGBA_USER",k="HSLA_USER",I="ALPHA",N='\n \n \n H \n \n S \n \n L \n \n
\n \n R \n \n G \n \n B \n \n
\n \n HEX \n \n
\n
',L=function(){function e(t){i(this,e);var n=A(t);if(n?this.options=Object.assign({},B,{attachTo:t}):(this.options=Object.assign({},B,t),n=A(this.options.attachTo)),!n)throw"Container not found: "+this.options.attachTo;this.H=0,this.S=0,this.L=0,this.R=0,this.G=0,this.B=0,this.A=1,this.element=document.createElement("div"),this.element.className="a-color-picker",this.options.showRGB||(this.element.className+=" hide-rgb"),this.options.showHSL||(this.element.className+=" hide-hsl"),this.options.showHEX||(this.element.className+=" hide-single-input"),this.options.showAlpha||(this.element.className+=" hide-alpha"),this.element.innerHTML=N,n.appendChild(this.element);var r=this.element.querySelector(".a-color-picker-h");this.setupHueCanvas(r),this.hueBarHelper=o(r),this.huePointer=this.element.querySelector(".a-color-picker-h+.a-color-picker-dot");var a=this.element.querySelector(".a-color-picker-sl");this.setupSlCanvas(a),this.slBarHelper=o(a),this.slPointer=this.element.querySelector(".a-color-picker-sl+.a-color-picker-dot"),this.preview=this.element.querySelector(".a-color-picker-preview"),this.setupClipboard(this.preview.querySelector(".a-color-picker-clipbaord")),this.setupInput(this.inputH=this.element.querySelector(".a-color-picker-hsl>input[name=H]")),this.setupInput(this.inputS=this.element.querySelector(".a-color-picker-hsl>input[name=S]")),this.setupInput(this.inputL=this.element.querySelector(".a-color-picker-hsl>input[name=L]")),this.setupInput(this.inputR=this.element.querySelector(".a-color-picker-rgb>input[name=R]")),this.setupInput(this.inputG=this.element.querySelector(".a-color-picker-rgb>input[name=G]")),this.setupInput(this.inputB=this.element.querySelector(".a-color-picker-rgb>input[name=B]")),this.setupInput(this.inputRGBHEX=this.element.querySelector("input[name=RGBHEX]")),this.setPalette(this.element.querySelector(".a-color-picker-palette")),this.setupAlphaCanvas(this.element.querySelector(".a-color-picker-a")),this.alphaPointer=this.element.querySelector(".a-color-picker-a+.a-color-picker-dot"),this.onValueChanged(S,this.options.color)}return p(e,[{key:"setupHueCanvas",value:function(e){var t=this;e.width=y[0],e.height=y[1];for(var n=e.getContext("2d"),r=n.createLinearGradient(0,0,y[0],0),i=1/360,A=0;A<=1;A+=i)r.addColorStop(A,"hsl("+360*A+", 100%, 50%)");n.fillStyle=r,n.fillRect(0,0,y[0],y[1]);var o=function(n){var r=(0,g.limit)(n.clientX-e.getBoundingClientRect().left,0,y[0]),i=Math.round(360*r/y[0]);t.huePointer.style.left=r-7+"px",t.onValueChanged(C,i)},a=function e(){document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",e)};e.addEventListener("mousedown",function(e){o(e),document.addEventListener("mousemove",o),document.addEventListener("mouseup",a)})}},{key:"setupSlCanvas",value:function(e){var t=this;e.width=w[0],e.height=w[1];var n=function(n){var r=(0,g.limit)(n.clientX-e.getBoundingClientRect().left,0,w[0]-1),i=(0,g.limit)(n.clientY-e.getBoundingClientRect().top,0,w[1]-1),A=t.slBarHelper.grabColor(r,i);t.slPointer.style.left=r-7+"px",t.slPointer.style.top=i-7+"px",t.onValueChanged(F,A)},r=function e(){document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",e)};e.addEventListener("mousedown",function(e){n(e),document.addEventListener("mousemove",n),document.addEventListener("mouseup",r)})}},{key:"setupAlphaCanvas",value:function(e){var t=this;e.width=b[0],e.height=b[1];var n=e.getContext("2d"),r=n.createLinearGradient(0,0,e.width-1,0);r.addColorStop(0,"hsla(0, 0%, 50%, 0)"),r.addColorStop(1,"hsla(0, 0%, 50%, 1)"),n.fillStyle=r,n.fillRect(0,0,b[0],b[1]);var i=function(n){var r=(0,g.limit)(n.clientX-e.getBoundingClientRect().left,0,b[0]),i=+(r/b[0]).toFixed(2);t.alphaPointer.style.left=r-7+"px",t.onValueChanged(I,i)},A=function e(){document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",e)};e.addEventListener("mousedown",function(e){i(e),document.addEventListener("mousemove",i),document.addEventListener("mouseup",A)})}},{key:"setupInput",value:function(e){var t=this,n=+e.min,r=+e.max,i=e.name;e.hasAttribute("select-on-focus")&&e.addEventListener("focus",function(){e.select()}),"text"===e.type?e.addEventListener("change",function(){t.onValueChanged(i,e.value)}):((m||v)&&e.addEventListener("keydown",function(A){"Up"===A.key?(e.value=(0,g.limit)(+e.value+1,n,r),t.onValueChanged(i,e.value),A.returnValue=!1):"Down"===A.key&&(e.value=(0,g.limit)(+e.value-1,n,r),t.onValueChanged(i,e.value),A.returnValue=!1)}),e.addEventListener("change",function(){var A=+e.value;t.onValueChanged(i,(0,g.limit)(A,n,r))}))}},{key:"setupClipboard",value:function(e){var t=this;e.title="click to copy",e.addEventListener("click",function(n){e.value=(0,g.rgbToHex)(t.R,t.G,t.B),e.select(),document.execCommand("copy")})}},{key:"setPalette",value:function(e){var t=this,n=(0,g.ensureArray)(this.options.palette);if(this.options.paletteEditable||n.length>0){var i=function(n,r,i){var A=e.querySelector('.a-color-picker-palette-color[data-color="'+n+'"]')||document.createElement("div");A.className="a-color-picker-palette-color",A.style.backgroundColor=n,A.setAttribute("data-color",n),A.title=n,e.insertBefore(A,r),i&&t.onPaletteColorAdd(n)},A=function(n,r){n?(e.removeChild(n),r&&t.onPaletteColorRemove(n.getAttribute("data-color"))):(e.querySelectorAll(".a-color-picker-palette-color[data-color]").forEach(function(t){e.removeChild(t)}),r&&t.onPaletteColorRemove())};if(n.map(function(e){return e&&c(e)}).filter(function(e){return!!e}).forEach(function(e){return i(g.rgbToHex.apply(void 0,r(e)))}),this.options.paletteEditable){var o=document.createElement("div");o.className="a-color-picker-palette-color a-color-picker-palette-add",o.innerHTML="+",e.appendChild(o)}e.addEventListener("click",function(e){/a-color-picker-palette-add/.test(e.target.className)?e.shiftKey?A(null,!0):i((0,g.rgbToHex)(t.R,t.G,t.B),e.target,!0):/a-color-picker-palette-color/.test(e.target.className)&&(e.shiftKey?A(e.target,!0):t.onValueChanged(S,e.target.getAttribute("data-color")))})}else e.style.display="none"}},{key:"onValueChanged",value:function(e,t){switch(e){case C:this.H=t;var n=(0,g.hslToRgb)(this.H,this.S,this.L),r=h(n,3);this.R=r[0],this.G=r[1],this.B=r[2],this.slBarHelper.setHue(t),this.updatePointerH(this.H),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B);break;case E:this.S=t;var i=(0,g.hslToRgb)(this.H,this.S,this.L),A=h(i,3);this.R=A[0],this.G=A[1],this.B=A[2],this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B);break;case Q:this.L=t;var o=(0,g.hslToRgb)(this.H,this.S,this.L),s=h(o,3);this.R=s[0],this.G=s[1],this.B=s[2],this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B);break;case U:this.R=t;var l=(0,g.rgbToHsl)(this.R,this.G,this.B),c=h(l,3);this.H=c[0],this.S=c[1],this.L=c[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGBHEX(this.R,this.G,this.B);break;case _:this.G=t;var d=(0,g.rgbToHsl)(this.R,this.G,this.B),f=h(d,3);this.H=f[0],this.S=f[1],this.L=f[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGBHEX(this.R,this.G,this.B);break;case H:this.B=t;var p=(0,g.rgbToHsl)(this.R,this.G,this.B),m=h(p,3);this.H=m[0],this.S=m[1],this.L=m[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGBHEX(this.R,this.G,this.B);break;case F:var v=h(t,3);this.R=v[0],this.G=v[1],this.B=v[2];var B=(0,g.rgbToHsl)(this.R,this.G,this.B),w=h(B,3);this.H=w[0],this.S=w[1],this.L=w[2],this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B);break;case x:var y=h(t,4);this.R=y[0],this.G=y[1],this.B=y[2],this.A=y[3];var b=(0,g.rgbToHsl)(this.R,this.G,this.B),N=h(b,3);this.H=N[0],this.S=N[1],this.L=N[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B),this.updatePointerA(this.A);break;case k:var L=h(t,4);this.H=L[0],this.S=L[1],this.L=L[2],this.A=L[3];var O=(0,g.hslToRgb)(this.H,this.S,this.L),D=h(O,3);this.R=D[0],this.G=D[1],this.B=D[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B),this.updatePointerA(this.A);break;case T:var M=a(t)||[this.R,this.G,this.B],P=h(M,3);this.R=P[0],this.G=P[1],this.B=P[2];var K=(0,g.rgbToHsl)(this.R,this.G,this.B),R=h(K,3);this.H=R[0],this.S=R[1],this.L=R[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B);break;case S:var z=u(t)||[0,0,0,1],j=h(z,4);this.R=j[0],this.G=j[1],this.B=j[2],this.A=j[3];var V=(0,g.rgbToHsl)(this.R,this.G,this.B),X=h(V,3);this.H=X[0],this.S=X[1],this.L=X[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B),this.updatePointerA(this.A);break;case I:this.A=t}this.onColorChanged(this.R,this.G,this.B,this.A)}},{key:"onColorChanged",value:function(e,t,n,r){1===r?this.preview.style.backgroundColor="rgb("+e+","+t+","+n+")":this.preview.style.backgroundColor="rgba("+e+","+t+","+n+","+r+")",this.onchange&&this.onchange()}},{key:"onPaletteColorAdd",value:function(e){this.oncoloradd&&this.oncoloradd(e)}},{key:"onPaletteColorRemove",value:function(e){this.oncolorremove&&this.oncolorremove(e)}},{key:"updateInputHSL",value:function(e,t,n){this.inputH.value=e,this.inputS.value=t,this.inputL.value=n}},{key:"updateInputRGB",value:function(e,t,n){this.inputR.value=e,this.inputG.value=t,this.inputB.value=n}},{key:"updateInputRGBHEX",value:function(e,t,n){this.inputRGBHEX.value=(0,g.rgbToHex)(e,t,n)}},{key:"updatePointerH",value:function(e){var t=y[0]*e/360;this.huePointer.style.left=t-7+"px"}},{key:"updatePointerSL",value:function(e,t,n){var r=(0,g.hslToRgb)(e,t,n),i=h(r,3),A=i[0],o=i[1],a=i[2],s=this.slBarHelper.findColor(A,o,a),l=h(s,2),c=l[0],u=l[1];c>=0&&(this.slPointer.style.left=c-7+"px",this.slPointer.style.top=u-7+"px")}},{key:"updatePointerA",value:function(e){var t=b[0]*e;this.alphaPointer.style.left=t-7+"px"}}]),e}();t.default={createPicker:f,parseColorToRgb:c,parseColorToRgba:u,rgbToHex:g.rgbToHex,hslToRgb:g.hslToRgb,rgbToHsl:g.rgbToHsl,rgbToInt:g.rgbToInt,intToRgb:g.intToRgb,COLOR_NAMES:g.COLOR_NAMES,PALETTE_MATERIAL_500:g.PALETTE_MATERIAL_500,PALETTE_MATERIAL_CHROME:g.PALETTE_MATERIAL_CHROME},e.exports=t.default},function(e,t){"use strict";function n(e,t,n){return e=+e,isNaN(e)?t:en?n:e}function r(e,t){return null===e||void 0===e?t:e}function i(e){return e?Array.from(e):[]}function A(e,t,r){var i=[n(e,0,255),n(t,0,255),n(r,0,255)];return e=i[0],t=i[1],r=i[2],"#"+("000000"+(e<<16|t<<8|r).toString(16)).slice(-6)}function o(e,t,r){var i=void 0,A=void 0,o=void 0,a=[n(e,0,360)/360,n(t,0,100)/100,n(r,0,100)/100];if(e=a[0],t=a[1],r=a[2],0==t)i=A=o=r;else{var s=function(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e},l=r<.5?r*(1+t):r+t-r*t,c=2*r-l;i=s(c,l,e+1/3),A=s(c,l,e),o=s(c,l,e-1/3)}return[255*i,255*A,255*o].map(Math.round)}function a(e,t,r){var i=[n(e,0,255)/255,n(t,0,255)/255,n(r,0,255)/255];e=i[0],t=i[1],r=i[2];var A=Math.max(e,t,r),o=Math.min(e,t,r),a=void 0,s=void 0,l=(A+o)/2;if(A==o)a=s=0;else{var c=A-o;switch(s=l>.5?c/(2-A-o):c/(A+o),A){case e:a=(t-r)/c+(t>16&255,e>>8&255,255&e]}Object.defineProperty(t,"__esModule",{value:!0});var c={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#00FFFF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blue:"#0000FF",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#FF00FF",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4","indianred ":"#CD5C5C","indigo ":"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#00FF00",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#663399",red:"#FF0000",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFFFFF",whitesmoke:"#F5F5F5",yellow:"#FFFF00",yellowgreen:"#9ACD32"},u=["#F44336","#E91E63","#E91E63","#9C27B0","#9C27B0","#673AB7","#673AB7","#3F51B5","#3F51B5","#2196F3","#2196F3","#03A9F4","#03A9F4","#00BCD4","#00BCD4","#009688","#009688","#4CAF50","#4CAF50","#8BC34A","#8BC34A","#CDDC39","#CDDC39","#FFEB3B","#FFEB3B","#FFC107","#FFC107","#FF9800","#FF9800","#FF5722","#FF5722","#795548","#795548","#9E9E9E","#9E9E9E","#607D8B","#607D8B"],d=["#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#2196f3","#03a9f4","#00bcd4","#009688","#4caf50","#8bc34a","#cddc39","#ffeb3b","#ffc107","#ff9800","#ff5722","#795548","#9e9e9e","#607d8b"];t.COLOR_NAMES=c,t.PALETTE_MATERIAL_500=u,t.PALETTE_MATERIAL_CHROME=d,t.rgbToHex=A,t.hslToRgb=o,t.rgbToHsl=a,t.rgbToInt=s,t.intToRgb=l,t.limit=n,t.ensureArray=i,t.nvl=r},function(e,t,n){var r,i,A;/*! nouislider - 11.1.0 - 2018-04-02 11:18:13 */
!function(n){i=[],r=n,A="function"==typeof r?r.apply(t,i):r,!(void 0!==A&&(e.exports=A))}(function(){"use strict";function e(e){return"object"==typeof e&&"function"==typeof e.to&&"function"==typeof e.from}function t(e){e.parentElement.removeChild(e)}function n(e){return null!==e&&void 0!==e}function r(e){e.preventDefault()}function i(e){return e.filter(function(e){return!this[e]&&(this[e]=!0)},{})}function A(e,t){return Math.round(e/t)*t}function o(e,t){var n=e.getBoundingClientRect(),r=e.ownerDocument,i=r.documentElement,A=h(r);return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(A.x=0),t?n.top+A.y-i.clientTop:n.left+A.x-i.clientLeft}function a(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}function s(e,t,n){n>0&&(d(e,t),setTimeout(function(){f(e,t)},n))}function l(e){return Math.max(Math.min(e,100),0)}function c(e){return Array.isArray(e)?e:[e]}function u(e){e=String(e);var t=e.split(".");return t.length>1?t[1].length:0}function d(e,t){e.classList?e.classList.add(t):e.className+=" "+t}function f(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")}function p(e,t){return e.classList?e.classList.contains(t):new RegExp("\\b"+t+"\\b").test(e.className)}function h(e){var t=void 0!==window.pageXOffset,n="CSS1Compat"===(e.compatMode||""),r=t?window.pageXOffset:n?e.documentElement.scrollLeft:e.body.scrollLeft,i=t?window.pageYOffset:n?e.documentElement.scrollTop:e.body.scrollTop;return{x:r,y:i}}function g(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function m(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("test",null,t)}catch(e){}return e}function v(){return window.CSS&&CSS.supports&&CSS.supports("touch-action","none")}function B(e,t){return 100/(t-e)}function w(e,t){return 100*t/(e[1]-e[0])}function y(e,t){return w(e,e[0]<0?t+Math.abs(e[0]):t-e[0])}function b(e,t){return t*(e[1]-e[0])/100+e[0]}function C(e,t){for(var n=1;e>=t[n];)n+=1;return n}function E(e,t,n){if(n>=e.slice(-1)[0])return 100;var r=C(n,e),i=e[r-1],A=e[r],o=t[r-1],a=t[r];return o+y([i,A],n)/B(o,a)}function Q(e,t,n){if(n>=100)return e.slice(-1)[0];var r=C(n,t),i=e[r-1],A=e[r],o=t[r-1],a=t[r];return b([i,A],(n-o)*B(o,a))}function F(e,t,n,r){if(100===r)return r;var i=C(r,e),o=e[i-1],a=e[i];return n?r-o>(a-o)/2?a:o:t[i-1]?e[i-1]+A(r-e[i-1],t[i-1]):r}function U(e,t,n){var r;if("number"==typeof t&&(t=[t]),!Array.isArray(t))throw new Error("noUiSlider ("+Z+"): 'range' contains invalid value.");if(r="min"===e?0:"max"===e?100:parseFloat(e),!a(r)||!a(t[0]))throw new Error("noUiSlider ("+Z+"): 'range' value isn't numeric.");n.xPct.push(r),n.xVal.push(t[0]),r?n.xSteps.push(!isNaN(t[1])&&t[1]):isNaN(t[1])||(n.xSteps[0]=t[1]),n.xHighestCompleteStep.push(0)}function _(e,t,n){if(!t)return!0;n.xSteps[e]=w([n.xVal[e],n.xVal[e+1]],t)/B(n.xPct[e],n.xPct[e+1]);var r=(n.xVal[e+1]-n.xVal[e])/n.xNumSteps[e],i=Math.ceil(Number(r.toFixed(3))-1),A=n.xVal[e]+n.xNumSteps[e]*i;n.xHighestCompleteStep[e]=A}function H(e,t,n){this.xPct=[],this.xVal=[],this.xSteps=[n||!1],this.xNumSteps=[!1],this.xHighestCompleteStep=[],this.snap=t;var r,i=[];for(r in e)e.hasOwnProperty(r)&&i.push([e[r],r]);for(i.length&&"object"==typeof i[0][0]?i.sort(function(e,t){return e[0][0]-t[0][0]}):i.sort(function(e,t){return e[0]-t[0]}),r=0;r=100)throw new Error("noUiSlider ("+Z+"): 'padding' option must not exceed 100% of the range.")}}function R(e,t){switch(t){case"ltr":e.dir=0;break;case"rtl":e.dir=1;break;default:throw new Error("noUiSlider ("+Z+"): 'direction' option was not recognized.")}}function z(e,t){if("string"!=typeof t)throw new Error("noUiSlider ("+Z+"): 'behaviour' must be a string containing options.");var n=t.indexOf("tap")>=0,r=t.indexOf("drag")>=0,i=t.indexOf("fixed")>=0,A=t.indexOf("snap")>=0,o=t.indexOf("hover")>=0;if(i){if(2!==e.handles)throw new Error("noUiSlider ("+Z+"): 'fixed' behaviour must be used with 2 handles");M(e,e.start[1]-e.start[0])}e.events={tap:n||A,drag:r,fixed:i,snap:A,hover:o}}function j(e,t){if(t!==!1)if(t===!0){e.tooltips=[];for(var n=0;n= 2) required for mode 'count'.");var r=t-1,i=100/r;for(t=[];r--;)t[r]=r*i;t.push(100),e="positions"}return"positions"===e?t.map(function(e){return ye.fromStepping(n?ye.getStep(e):e)}):"values"===e?n?t.map(function(e){return ye.fromStepping(ye.getStep(ye.toStepping(e)))}):t:void 0}function F(e,t,n){function r(e,t){return(e+t).toFixed(7)/1}var A={},o=ye.xVal[0],a=ye.xVal[ye.xVal.length-1],s=!1,l=!1,c=0;return n=i(n.slice().sort(function(e,t){return e-t})),n[0]!==o&&(n.unshift(o),s=!0),n[n.length-1]!==a&&(n.push(a),l=!0),n.forEach(function(i,o){var a,u,d,f,p,h,g,m,v,B,w=i,y=n[o+1];if("steps"===t&&(a=ye.xNumSteps[o]),a||(a=y-w),w!==!1&&void 0!==y)for(a=Math.max(a,1e-7),u=w;u<=y;u=r(u,a)){for(f=ye.toStepping(u),p=f-c,m=p/e,v=Math.round(m),B=p/v,d=1;d<=v;d+=1)h=c+d*B,A[h.toFixed(5)]=["x",0];g=n.indexOf(u)>-1?1:"steps"===t?2:0,!o&&s&&(g=0),u===y&&l||(A[f.toFixed(5)]=[u,g]),c=f}}),A}function U(e,t,r){function i(e,t){var r=t===n.cssClasses.value,i=r?c:u,A=r?s:l;return t+" "+i[n.ort]+" "+A[e]}function A(e,A){A[1]=A[1]&&t?t(A[0],A[1]):A[1];var s=a(o,!1);s.className=i(A[1],n.cssClasses.marker),s.style[n.style]=e+"%",A[1]&&(s=a(o,!1),s.className=i(A[1],n.cssClasses.value),s.setAttribute("data-value",A[0]),s.style[n.style]=e+"%",s.innerText=r.to(A[0]))}var o=Ee.createElement("div"),s=[n.cssClasses.valueNormal,n.cssClasses.valueLarge,n.cssClasses.valueSub],l=[n.cssClasses.markerNormal,n.cssClasses.markerLarge,n.cssClasses.markerSub],c=[n.cssClasses.valueHorizontal,n.cssClasses.valueVertical],u=[n.cssClasses.markerHorizontal,n.cssClasses.markerVertical];return d(o,n.cssClasses.pips),d(o,0===n.ort?n.cssClasses.pipsHorizontal:n.cssClasses.pipsVertical),Object.keys(e).forEach(function(t){A(t,e[t])}),o}function _(){fe&&(t(fe),fe=null)}function H(e){_();var t=e.mode,n=e.density||1,r=e.filter||!1,i=e.values||!1,A=e.stepped||!1,o=Q(t,i,A),a=F(n,t,o),s=e.format||{to:Math.round};return fe=me.appendChild(U(a,r,s))}/*! In this file: Browser events (not slider events like slide, change); */
function T(){var e=le.getBoundingClientRect(),t="offset"+["Width","Height"][n.ort];return 0===n.ort?e.width||le[t]:e.height||le[t]}function S(e,t,r,i){var A=function(A){return!!(A=x(A,i.pageOffset,i.target||t))&&(!(me.hasAttribute("disabled")&&!i.doNotReject)&&(!(p(me,n.cssClasses.tap)&&!i.doNotReject)&&(!(e===pe.start&&void 0!==A.buttons&&A.buttons>1)&&((!i.hover||!A.buttons)&&(ge||A.preventDefault(),A.calcPoint=A.points[n.ort],void r(A,i))))))},o=[];return e.split(" ").forEach(function(e){t.addEventListener(e,A,!!ge&&{passive:!0}),o.push([e,A])}),o}function x(e,t,n){var r,i,A=0===e.type.indexOf("touch"),o=0===e.type.indexOf("mouse"),a=0===e.type.indexOf("pointer");if(0===e.type.indexOf("MSPointer")&&(a=!0),A){var s=function(e){return e.target===n||n.contains(e.target)};if("touchstart"===e.type){var l=Array.prototype.filter.call(e.touches,s);if(l.length>1)return!1;r=l[0].pageX,i=l[0].pageY}else{var c=Array.prototype.find.call(e.changedTouches,s);if(!c)return!1;r=c.pageX,i=c.pageY}}return t=t||h(Ee),(o||a)&&(r=e.clientX+t.x,i=e.clientY+t.y),e.pageOffset=t,e.points=[r,i],e.cursor=o||a,e}function k(e){var t=e-o(le,n.ort),r=100*t/T();return r=l(r),n.dir?100-r:r}function I(e){var t=100,n=!1;return ce.forEach(function(r,i){if(!r.hasAttribute("disabled")){var A=Math.abs(ve[i]-e);(A0,i,t.locations,t.handleNumbers)}function O(e,t){t.handle&&(f(t.handle,n.cssClasses.active),we-=1),t.listeners.forEach(function(e){Qe.removeEventListener(e[0],e[1])}),0===we&&(f(me,n.cssClasses.drag),$(),e.cursor&&(Fe.style.cursor="",Fe.removeEventListener("selectstart",r))),t.handleNumbers.forEach(function(e){j("change",e),j("set",e),j("end",e)})}function D(e,t){var i;if(1===t.handleNumbers.length){var A=ce[t.handleNumbers[0]];if(A.hasAttribute("disabled"))return!1;i=A.children[0],we+=1,d(i,n.cssClasses.active)}e.stopPropagation();var o=[],a=S(pe.move,Qe,L,{target:e.target,handle:i,listeners:o,startCalcPoint:e.calcPoint,baseSize:T(),pageOffset:e.pageOffset,handleNumbers:t.handleNumbers,buttonsProperty:e.buttons,locations:ve.slice()}),s=S(pe.end,Qe,O,{target:e.target,handle:i,listeners:o,doNotReject:!0,handleNumbers:t.handleNumbers}),l=S("mouseout",Qe,N,{target:e.target,handle:i,listeners:o,doNotReject:!0,handleNumbers:t.handleNumbers});o.push.apply(o,a.concat(s,l)),e.cursor&&(Fe.style.cursor=getComputedStyle(e.target).cursor,ce.length>1&&d(me,n.cssClasses.drag),Fe.addEventListener("selectstart",r,!1)),t.handleNumbers.forEach(function(e){j("start",e)})}function M(e){e.stopPropagation();var t=k(e.calcPoint),r=I(t);return r!==!1&&(n.events.snap||s(me,n.cssClasses.tap,n.animationDuration),ee(r,t,!0,!0),$(),j("slide",r,!0),j("update",r,!0),j("change",r,!0),j("set",r,!0),void(n.events.snap&&D(e,{handleNumbers:[r]})))}function P(e){var t=k(e.calcPoint),n=ye.getStep(t),r=ye.fromStepping(n);Object.keys(Ce).forEach(function(e){"hover"===e.split(".")[0]&&Ce[e].forEach(function(e){e.call(de,r)})})}function K(e){e.fixed||ce.forEach(function(e,t){S(pe.start,e.children[0],D,{handleNumbers:[t]})}),e.tap&&S(pe.start,le,M,{}),e.hover&&S(pe.move,le,P,{hover:!0}),e.drag&&ue.forEach(function(t,r){if(t!==!1&&0!==r&&r!==ue.length-1){var i=ce[r-1],A=ce[r],o=[t];d(t,n.cssClasses.draggable),e.fixed&&(o.push(i.children[0]),o.push(A.children[0])),o.forEach(function(e){S(pe.start,e,D,{handles:[i,A],handleNumbers:[r-1,r]})})}})}/*! In this file: Slider events (not browser events); */
function R(e,t){Ce[e]=Ce[e]||[],Ce[e].push(t),"update"===e.split(".")[0]&&ce.forEach(function(e,t){j("update",t)})}function z(e){var t=e&&e.split(".")[0],n=t&&e.substring(t.length);Object.keys(Ce).forEach(function(e){var r=e.split(".")[0],i=e.substring(r.length);t&&t!==r||n&&n!==i||delete Ce[e]})}function j(e,t,r){Object.keys(Ce).forEach(function(i){var A=i.split(".")[0];e===A&&Ce[i].forEach(function(e){e.call(de,be.map(n.format.to),t,be.slice(),r||!1,ve.slice())})})}/*! In this file: Mechanics for slider operation */
function V(e){return e+"%"}function X(e,t,r,i,A,o){return ce.length>1&&(i&&t>0&&(r=Math.max(r,e[t-1]+n.margin)),A&&t1&&n.limit&&(i&&t>0&&(r=Math.min(r,e[t-1]+n.limit)),A&&t1?r.forEach(function(e,n){var r=X(i,e,i[e]+t,A[n],o[n],!1);r===!1?t=0:(t=r-i[e],i[e]=r)}):A=o=[!0];var a=!1;r.forEach(function(e,r){a=ee(e,n[e]+t,A[r],o[r])||a}),a&&r.forEach(function(e){j("update",e),j("slide",e)})}function W(e,t){return n.dir?100-e-t:e}function q(e,t){ve[e]=t,be[e]=ye.fromStepping(t);var r="translate("+G(V(W(t,0)-Ue),"0")+")";ce[e].style[n.transformRule]=r,te(e),te(e+1)}function $(){Be.forEach(function(e){var t=ve[e]>50?-1:1,n=3+(ce.length+t*e);ce[e].style.zIndex=n})}function ee(e,t,n,r){return t=X(ve,e,t,n,r,!1),t!==!1&&(q(e,t),!0)}function te(e){if(ue[e]){var t=0,r=100;0!==e&&(t=ve[e-1]),e!==ue.length-1&&(r=ve[e]);var i=r-t,A="translate("+G(V(W(t,i)),"0")+")",o="scale("+G(i/100,"1")+")";ue[e].style[n.transformRule]=A+" "+o}}/*! In this file: All methods eventually exposed in slider.noUiSlider... */
function ne(e,t){return null===e||e===!1||void 0===e?ve[t]:("number"==typeof e&&(e=String(e)),e=n.format.from(e),e=ye.toStepping(e),e===!1||isNaN(e)?ve[t]:e)}function re(e,t){var r=c(e),i=void 0===ve[0];t=void 0===t||!!t,n.animate&&!i&&s(me,n.cssClasses.tap,n.animationDuration),Be.forEach(function(e){ee(e,ne(r[e],e),!0,!1)}),Be.forEach(function(e){ee(e,ve[e],!0,!0)}),$(),Be.forEach(function(e){j("update",e),null!==r[e]&&t&&j("set",e)})}function ie(e){re(n.start,e)}function Ae(){var e=be.map(n.format.to);return 1===e.length?e[0]:e}function oe(){for(var e in n.cssClasses)n.cssClasses.hasOwnProperty(e)&&f(me,n.cssClasses[e]);for(;me.firstChild;)me.removeChild(me.firstChild);delete me.noUiSlider}function ae(){return ve.map(function(e,t){var n=ye.getNearbySteps(e),r=be[t],i=n.thisStep.step,A=null;i!==!1&&r+i>n.stepAfter.startValue&&(i=n.stepAfter.startValue-r),A=r>n.thisStep.startValue?n.thisStep.step:n.stepBefore.step!==!1&&r-n.stepBefore.highestStep,100===e?i=null:0===e&&(A=null);var o=ye.countStepDecimals();return null!==i&&i!==!1&&(i=Number(i.toFixed(o))),null!==A&&A!==!1&&(A=Number(A.toFixed(o))),[A,i]})}function se(e,t){var r=Ae(),i=["margin","limit","padding","range","animate","snap","step","format"];i.forEach(function(t){void 0!==e[t]&&(A[t]=e[t])});var o=J(A);i.forEach(function(t){void 0!==e[t]&&(n[t]=o[t])}),ye=o.spectrum,n.margin=o.margin,n.limit=o.limit,n.padding=o.padding,n.pips&&H(n.pips),ve=[],re(e.start||r,t)}var le,ce,ue,de,fe,pe=g(),he=v(),ge=he&&m(),me=e,ve=[],Be=[],we=0,ye=n.spectrum,be=[],Ce={},Ee=e.ownerDocument,Qe=Ee.documentElement,Fe=Ee.body,Ue="rtl"===Ee.dir||1===n.ort?0:100;/*! In this file: Calls to functions. All other scope_ files define functions only; */
return y(me),w(n.connect,le),K(n.events),re(n.start),de={destroy:oe,steps:ae,on:R,off:z,get:Ae,set:re,reset:ie,__moveHandles:function(e,t,n){Y(e,t,ve,n)},options:A,updateOptions:se,target:me,removePips:_,pips:H},n.pips&&H(n.pips),n.tooltips&&C(),E(),de}function q(e,t){if(!e||!e.nodeName)throw new Error("noUiSlider ("+Z+"): create requires a single element, got: "+e);if(e.noUiSlider)throw new Error("noUiSlider ("+Z+"): Slider was already initialized.");var n=J(t,e),r=W(e,n,t);return e.noUiSlider=r,r}var Z="11.1.0";H.prototype.getMargin=function(e){var t=this.xNumSteps[0];if(t&&e/t%1!==0)throw new Error("noUiSlider ("+Z+"): 'limit', 'margin' and 'padding' must be divisible by step.");return 2===this.xPct.length&&w(this.xVal,e)},H.prototype.toStepping=function(e){return e=E(this.xVal,this.xPct,e)},H.prototype.fromStepping=function(e){return Q(this.xVal,this.xPct,e)},H.prototype.getStep=function(e){return e=F(this.xPct,this.xSteps,this.snap,e)},H.prototype.getNearbySteps=function(e){var t=C(e,this.xPct);return{stepBefore:{startValue:this.xVal[t-2],step:this.xNumSteps[t-2],highestStep:this.xHighestCompleteStep[t-2]},thisStep:{startValue:this.xVal[t-1],step:this.xNumSteps[t-1],highestStep:this.xHighestCompleteStep[t-1]},stepAfter:{startValue:this.xVal[t-0],step:this.xNumSteps[t-0],highestStep:this.xHighestCompleteStep[t-0]}}},H.prototype.countStepDecimals=function(){var e=this.xNumSteps.map(u);return Math.max.apply(null,e)},H.prototype.convert=function(e){return this.getStep(this.toStepping(e))};var $={to:function(e){return void 0!==e&&e.toFixed(2)},from:Number};return{version:Z,create:q}})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.Finder=void 0;var A=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:function(e,t){},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"fred.fe.browse_files",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};i(this,e),this.wrapper=null,c.default.lngExists(n)&&(n=c.default.lng(n)),this.title=n,this.options=A({width:"800px",height:"600px"},r),this.onSelect=t.bind(this)}return o(e,[{key:"render",value:function(){var e=this;this.wrapper=(0,u.section)(["fred--modal-bg"]);var t=(0,u.div)(["fred--modal"]);t.setAttribute("aria-hidden","true");var n=(0,u.div)(["fred--modal-header"]),r=(0,u.button)(' ',"fred.fe.close",["button"],this.close.bind(this));this.titleEl=(0,u.h4)(this.title),this.body=(0,u.div)(["fred--modal-body"]),t.style.width=this.options.width||"800px",t.style.height=this.options.height||"600px",this.body.style.padding="0";var i=["fredToken="+c.default.jwt];this.options.mediaSource&&i.push("mediaSource="+this.options.mediaSource);var A="";i.length>0&&(A="?"+i.join("&"));var o=(0,u.iFrame)(c.default.config.assetsUrl+"elfinder/index.html"+A);return o.style.width="100%",o.style.height="100%",this.body.appendChild(o),n.appendChild(r),n.appendChild(this.titleEl),t.appendChild(n),t.appendChild(this.body),this.wrapper.appendChild(t),window.fredFinderOnChange=function(t,n){e.onSelect(t,n),e.close()},s.default.emit("fred-wrapper-insert",this.wrapper),this.wrapper}},{key:"close",value:function(){delete window.fredFinderOnChange,this.wrapper.remove()}}],[{key:"getFinderOptionsFromElement",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={},r="";return e.fredEl.options.mediaSource&&""!==e.fredEl.options.mediaSource&&(r=e.fredEl.options.mediaSource),t&&e.fredEl.options.imageMediaSource&&""!==e.fredEl.options.imageMediaSource&&(r=e.fredEl.options.imageMediaSource),e.dataset.fredMediaSource&&""!==e.dataset.fredMediaSource&&(r=e.dataset.fredMediaSource),t&&e.dataset.fredImageMediaSource&&""!==e.dataset.fredImageMediaSource&&(r=e.dataset.fredImageMediaSource),""!==r&&(n.mediaSource=r),n}}]),e}();t.default=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t=200&&e.status<300?e.json():e.json().then(function(e){var t=new Error(e.message);throw t.response=e,t})},t.applyScripts=function(e){var t=e.querySelectorAll("script"),n=!0,r=!1,i=void 0;try{for(var A,o=t[Symbol.iterator]();!(n=(A=o.next()).done);n=!0){var a=A.value,s=document.createElement("script");s.dataset.fredRender="false",s.innerHTML=a.innerHTML,a.parentNode.replaceChild(s,a)}}catch(e){r=!0,i=e}finally{try{!n&&o.return&&o.return()}finally{if(r)throw i}}},t.fixChoices=function(e){var t=function(e,t){return e.score-t.score};e.renderChoices=function(e,n){var r=this,A=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=n||document.createDocumentFragment(),a=this.config,s=a.renderSelectedChoices,l=a.searchResultLimit,c=a.renderChoiceLimit,u=this.isSearching?t:this.config.sortFilter,d=function(e){var t="auto"!==s||(r.isSelectOneElement||!e.selected);if(t){var n=r._getTemplate("choice",e);o.appendChild(n)}},f=e;"auto"!==s||this.isSelectOneElement||(f=e.filter(function(e){return!e.selected}));var p=f.reduce(function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e},{placeholderChoices:[],normalChoices:[]}),h=p.placeholderChoices,g=p.normalChoices;(this.config.shouldSort||this.isSearching)&&g.sort(u);var m=f.length,v=[].concat(i(h),i(g));this.isSearching?l>0&&(m=l):c>0&&!A&&(m=c);for(var B=0;B3&&void 0!==arguments[3]&&arguments[3],o=[],s=function(s){if(t.hasOwnProperty(s)){var l=[];t[s].forEach(function(t){var o=(0,A.div)(["chunk"]);o.setAttribute("hidden","hidden"),o.dataset.fredElementId=t.widget,o.dataset.fredElementTitle=r[t.widget].title,o.dataset.invalidTheme=r[t.widget].invalidTheme,o.elementMarkup=r[t.widget].html,o.elementOptions=r[t.widget].options||{};var c=new a.default(o,s,n,t.values,t.settings||{});l.push(c.render().then(function(){return e(t.children,c,r,i).then(function(){if(i===!0){var e=new CustomEvent("FredElementDrop",{detail:{fredEl:c}});document.body.dispatchEvent(e);var t=c.wrapper.querySelectorAll("[data-fred-on-drop]"),r=!0,A=!1,o=void 0;try{for(var a,l=t[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var u=a.value;window[u.dataset.fredOnDrop]&&window[u.dataset.fredOnDrop](u)}}catch(e){A=!0,o=e}finally{try{!r&&l.return&&l.return()}finally{if(A)throw o}}}return{zoneName:s,contentElement:c,parent:n}})}))}),o.push(Promise.all(l).then(function(e){e.forEach(function(e){e.parent.addElementToDropZone(e.zoneName,e.contentElement)})}))}};for(var l in t)s(l);return Promise.all(o)});t.loadElements=function(e){var t=e.data,n=[],r=function(r){if(t.hasOwnProperty(r)){var i=document.querySelector('[data-fred-dropzone="'+r+'"]');if(i){var o=[];i.innerHTML="",t[r].forEach(function(t){if(e.elements[t.widget].html){var n=(0,A.div)(["chunk"]);n.setAttribute("hidden","hidden"),n.dataset.fredElementId=t.widget,n.dataset.fredElementTitle=e.elements[t.widget].title,n.dataset.invalidTheme=e.elements[t.widget].invalidTheme,n.elementMarkup=e.elements[t.widget].html,n.elementOptions=e.elements[t.widget].options||{};var i=new a.default(n,r,null,t.values,t.settings||{});o.push(i.render().then(function(n){return c(t.children,i,e.elements).then(function(){return n})}))}}),n.push(Promise.all(o).then(function(e){e.forEach(function(e){i.appendChild(e)})}))}}};for(var i in t)r(i);return Promise.all(n)},t.buildBlueprint=function(e,t,n,r){var i=e.complete||!1,o=!0,s=!0,u=!1,d=void 0;try{for(var f,p=l.default.fred.dropzones[Symbol.iterator]();!(s=(f=p.next()).done);s=!0){var h=f.value;if(h.querySelector(".fred--block")){o=!1;break}}}catch(e){u=!0,d=e}finally{try{!s&&p.return&&p.return()}finally{if(u)throw d}}var g=[];if(i===!1)g=e.data;else{if(o===!0){var m=e.data,v=[],B=function(t){if(m.hasOwnProperty(t)){var n=document.querySelector('[data-fred-dropzone="'+t+'"]');if(n){var r=[];m[t].forEach(function(n){var i=(0,A.div)(["chunk"]);i.setAttribute("hidden","hidden"),i.dataset.fredElementId=n.widget,i.dataset.fredElementTitle=e.elements[n.widget].title,i.elementMarkup=e.elements[n.widget].html,i.elementOptions=e.elements[n.widget].options;var o=new a.default(i,t,null,n.values,n.settings||{});r.push(o.render().then(function(t){return c(n.children,o,e.elements,!0).then(function(){var e=new CustomEvent("FredElementDrop",{detail:{fredEl:o}});document.body.dispatchEvent(e);var t=o.wrapper.querySelectorAll("[data-fred-on-drop]"),n=!0,r=!1,i=void 0;try{for(var A,a=t[Symbol.iterator]();!(n=(A=a.next()).done);n=!0){var s=A.value;window[s.dataset.fredOnDrop]&&window[s.dataset.fredOnDrop](s)}}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}}),t}))}),v.push(Promise.all(r).then(function(e){e.forEach(function(e){n.appendChild(e)})}))}}};for(var w in m)B(w);return Promise.all(v)}var y="";if(null===t&&e.data[n.dataset.fredDropzone]?y=n.dataset.fredDropzone:e.data.content&&(y="content"),""===y)return void console.error("Something wrong happened with blueprint.");g=e.data[y]}var b=[];return g.forEach(function(i){var o=(0,A.div)(["chunk"]);o.setAttribute("hidden","hidden"),o.dataset.fredElementId=i.widget,o.dataset.fredElementTitle=e.elements[i.widget].title,o.elementMarkup=e.elements[i.widget].html,o.elementOptions=e.elements[i.widget].options||{};var s=new a.default(o,n.dataset.fredDropzone,t,i.values,i.settings||{});b.push(s.render().then(function(){t&&(null===r?t.dzs[n.dataset.fredDropzone].children.push(s.wrapper):t.dzs[n.dataset.fredDropzone].children.splice(t.dzs[n.dataset.fredDropzone].children.indexOf(r),0,s.wrapper)),c(i.children,s,e.elements,!0).then(function(){var e=new CustomEvent("FredElementDrop",{detail:{fredEl:s}});document.body.dispatchEvent(e);var t=s.wrapper.querySelectorAll("[data-fred-on-drop]"),n=!0,r=!1,i=void 0;try{for(var A,o=t[Symbol.iterator]();!(n=(A=o.next()).done);n=!0){var a=A.value;window[a.dataset.fredOnDrop]&&window[a.dataset.fredOnDrop](a)}}catch(e){r=!0,i=e}finally{try{!n&&o.return&&o.return()}finally{if(r)throw i}}}),null!==r?r.insertAdjacentElement("beforeBegin",s.wrapper):n.appendChild(s.wrapper)}))}),Promise.all(b)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t2&&void 0!==arguments[2]?arguments[2]:null,i=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};A(this,e),this.config=p.default.config,this.el=t,this.template=(0,d.twig)({data:this.el.elementMarkup}),this.id=this.el.dataset.fredElementId,this.title=this.el.dataset.fredElementTitle,this.wrapper=null,this.invalidTheme="true"===this.el.dataset.invalidTheme,this.setUpEditors(),this.render=this.render.bind(this),this.moveUp=this.moveUp.bind(this),this.moveDown=this.moveDown.bind(this),this.parent=r,this.dzName=n,this.options=JSON.parse(JSON.stringify(this.el.elementOptions||{})),this.content=JSON.parse(JSON.stringify(a)),Array.isArray(this.content)&&(this.content={}),this.settings={},this.options.rteConfig||(this.options.rteConfig={}),this.options.settings&&this.options.settings.forEach(function(e){e.group&&e.settings?e.settings.forEach(function(e){i.settings[e.name]=void 0!==e.value?e.value:""}):i.settings[e.name]=void 0!==e.value?e.value:""}),this.settings=o({},this.settings,JSON.parse(JSON.stringify(s))),this.dzs={},this.inEditor=!1}return a(e,[{key:"setUpEditors",value:function(){this.editors=p.default.editors,this.iconEditor=this.config.iconEditor||"IconEditor",this.iconEditor=this.editors[this.iconEditor]||null,this.imageEditor=this.config.imageEditor||"ImageEditor",this.imageEditor=this.editors[this.imageEditor]||null}},{key:"setEl",value:function(e){void 0===e.elementMarkup?this.el.elementMarkup=e:this.el.elementMarkup=e.elementMarkup,this.template=(0,d.twig)({data:this.el.elementMarkup})}},{key:"getContent",value:function(){var e=this,t={widget:this.id,values:this.content,settings:this.settings,children:{}},n=function(n){e.dzs.hasOwnProperty(n)&&e.dzs[n].children.length>0&&(t.children[n]=[],e.dzs[n].children.forEach(function(e){t.children[n].push(e.fredEl.getContent())}))};for(var r in this.dzs)n(r);return t}},{key:"setWrapperActiveState",value:function(e){var t=this;(0,w.default)(e,function(e){var n=!1;if(e.path)e.path.forEach(function(e){e.classList&&e.classList.contains("fred--block")&&(e.classList.add("fred--block-active"),t.atTop(e)&&e.classList.add("fred--block-active_top"),n===!0&&e.classList.add("fred--block-active_parent"),n===!1&&t.options.settings&&v.default.bind("mod+alt+s",function(){b.default.open(t)}),n=!0)});else for(var r=e.target.parentNode;r;)r.classList&&r.classList.contains("fred--block")&&(r.classList.add("fred--block-active"),t.atTop(r)&&r.classList.add("fred--block-active_top"),n===!0&&r.classList.add("fred--block-active_parent"),n=!0),r=r.parentNode},function(n){if(t.inEditor===!1){e.classList.remove("fred--block-active"),e.classList.remove("fred--block-active_top"),e.classList.remove("fred--block-active_parent");for(var r=n.target.parentNode,i=!1;r;)r.classList&&r.classList.contains("fred--block-active_parent")&&i===!1&&(r.classList.remove("fred--block-active_parent"),i=!0),r=r.parentNode;if(n.target.hasChildNodes())for(var A=n.target.childNodes,o=0;o0?(this.parent.dzs[o].children.splice(a,1),n(s.fredEl,l[0])):r(this,a)}else this.parent.dzs[o].children.pop(),A=!0}}A===!0&&i()}else if(this.wrapper.nextElementSibling){var c=Object.keys(this.wrapper.nextElementSibling.fredEl.dzs);c.length>0?n(this.wrapper.nextElementSibling.fredEl,c[0]):t()}}}},{key:"moveUp",value:function(){var e=this;if(p.default.permission.fred_element_move){var t=function(){e.wrapper.parentElement.insertBefore(e.wrapper,e.wrapper.previousElementSibling)},n=function(t,n){t.addElementToDropZone(n,e)},r=function(){if(e.parent.parent){var t=e.parent.parent.dzs[e.parent.dzName].children.indexOf(e.parent.wrapper);t!==-1&&(0===t?e.parent.parent.unshiftElementToDropZone(e.parent.dzName,e):e.parent.parent.insertBeforeElementToDropZone(e.parent.dzName,e.parent,e))}else e.dzName=e.parent.wrapper.parentElement.dataset.fredDropzone,e.parent.wrapper.parentElement.insertBefore(e.wrapper,e.parent.wrapper),e.parent=null},i=function(e,t){e.parent.dzs[e.dzName].children[t-1].insertAdjacentElement("beforebegin",e.wrapper),e.parent.dzs[e.dzName].children[t-1]=e.parent.dzs[e.dzName].children.splice(t,1,e.parent.dzs[e.dzName].children[t-1])[0]};if(this.parent){for(var A=!1,o=Object.keys(this.parent.dzs),a=o.length;a--;){var s=o[a];if(A===!0){A=!1,n(this.parent,s);break}if(s===this.dzName){var l=this.parent.dzs[s].children.indexOf(this.wrapper);if(l!==-1){var c=this.parent.dzs[s].children[l-1];if(c){var u=Object.keys(c.fredEl.dzs);u.length>0?(this.parent.dzs[s].children.splice(l,1),n(c.fredEl,u[u.length-1])):i(this,l)}else this.parent.dzs[s].children.shift(),A=!0}}}A===!0&&r()}else if(this.wrapper.previousElementSibling){var d=Object.keys(this.wrapper.previousElementSibling.fredEl.dzs);d.length>0?n(this.wrapper.previousElementSibling.fredEl,d[d.length-1]):t()}}}},{key:"render",value:function(){var e=this,t=["fred--block"];this.invalidTheme&&t.push("fred--block-invalid");var n=(0,h.div)(t);n.fredEl=this,this.setWrapperActiveState(n),n.appendChild(this.buildToolbar());var r=(0,h.div)(["fred--block_content"]);return r.dataset.fredElementId=this.el.dataset.fredElementId,r.dataset.fredElementTitle=this.title,this.templateRender().then(function(t){r.innerHTML=t,(0,g.applyScripts)(r);var A=r.querySelectorAll("[data-fred-block-class]"),o=!0,a=!1,s=void 0;try{for(var l,c=A[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var u=l.value,d=u.dataset.fredBlockClass.split(" ").filter(function(e){return e});if(d.length>0){var f;(f=n.classList).add.apply(f,i(d))}}}catch(e){a=!0,s=e}finally{try{!o&&c.return&&c.return()}finally{if(a)throw s}}return e.initElements(n,r),e.initDropZones(n,r),n.appendChild(r),null!==e.wrapper&&e.wrapper.replaceWith(n),e.wrapper=n,n})}},{key:"buildToolbar",value:function(){var e=this,t=(0,h.div)(!this.invalidTheme&&p.default.permission.fred_element_move?["fred--toolbar","handle"]:["fred--toolbar"]);if(!this.invalidTheme&&p.default.permission.fred_element_move){var n=(0,h.div)(["fred--toolbar-grip","handle"]);t.appendChild(n)}if(!this.invalidTheme&&p.default.permission.fred_element_screenshot){var r=(0,h.button)("","fred.fe.content.element_screenshot",["fred--element_screenshot"],this.takeScreenshot.bind(this));t.appendChild(r)}if(!this.invalidTheme&&p.default.permission.fred_blueprints_save){var i=(0,h.button)("","fred.fe.content.partial_blueprint",["fred--blueprint"],function(){E.default.open(e)});t.appendChild(i)}if(this.options.settings&&this.options.settings.length>0){var A=(0,h.button)("","fred.fe.content.settings",["fred--element-settings"],function(){b.default.open(e)});t.appendChild(A)}if(!this.invalidTheme){var o=(0,h.button)("","fred.fe.content.duplicate",["fred--duplicate-icon"],this.duplicate.bind(this));t.appendChild(o)}if(p.default.permission.fred_element_delete){var a=(0,h.button)("","fred.fe.content.delete",["fred--trash"],this.remove.bind(this));t.appendChild(a)}if(!this.invalidTheme&&p.default.permission.fred_element_move){var s=(0,h.div)(["fred--position-group"]),l=(0,h.button)("","fred.fe.content.move_up",["fred--position-up"],this.moveUp),c=(0,h.button)("","fred.fe.content.move_down",["fred--position-down"],this.moveDown);s.appendChild(l),s.appendChild(c),t.appendChild(s)}return t}},{key:"takeScreenshot",value:function(){var e=this;if(p.default.permission.fred_element_screenshot){var t="",n=new U.default("Element Screenshot","",function(){u.default.emit("fred-loading",p.default.lng("fred.fe.content.element_replacing_thumbnail")),(0,Q.replaceImage)(e.id,t).then(function(){S.default.kill("elements",{name:"elements"}),u.default.emit("fred-loading-hide")})},{showCancelButton:!0,saveButtonText:"fred.fe.content.replace_element_thumbnail"}),r=(0,h.span)(["fred--loading"]);n.setContent(r),n.render(),n.disableSave(),(0,H.default)(this.wrapper,{logging:!1,ignoreElements:function(e){return!!e.classList.contains("fred")||!!e.classList.contains("fred--toolbar")}}).then(function(e){var r=540;if(e.width>r){var i=r/e.width,A=new Image;A.onload=function(){var r=document.createElement("canvas"),o=r.getContext("2d");r.width=e.width*i,r.height=e.height*i,o.drawImage(A,0,0,r.width,r.height),t=r.toDataURL(),n.setContent((0,h.img)(t)),n.enableSave()},A.src=e.toDataURL()}else t=e.toDataURL(),n.setContent((0,h.img)(t)),n.enableSave()}).catch(function(e){n.setContent((0,h.img)("https://via.placeholder.com/300x150/000000/FF0000?text=Generation%20Failed"))})}}},{key:"initDropZones",value:function(e,t){var n=this,r=t.querySelectorAll("[data-fred-dropzone]"),i=null,A=!0,o=!1,a=void 0;try{for(var s,l=function(){var e=s.value;null===i?(i=e,e.fredEl=n,n.dzs[e.dataset.fredDropzone]?(n.dzs[e.dataset.fredDropzone].el=e,n.dzs[e.dataset.fredDropzone].children.forEach(function(t){n.dzs[e.dataset.fredDropzone].el.appendChild(t)})):n.dzs[e.dataset.fredDropzone]={el:e,children:[]}):i.contains(e)||(e.fredEl=n,i=e,n.dzs[e.dataset.fredDropzone]?(n.dzs[e.dataset.fredDropzone].el=e,n.dzs[e.dataset.fredDropzone].children.forEach(function(t){n.dzs[e.dataset.fredDropzone].el.appendChild(t)})):n.dzs[e.dataset.fredDropzone]={el:e,children:[]})},c=r[Symbol.iterator]();!(A=(s=c.next()).done);A=!0)l()}catch(e){o=!0,a=e}finally{try{!A&&c.return&&c.return()}finally{if(o)throw a}}}},{key:"onRTEInitFactory",value:function(e){return function(){e.rteInited=!0}}},{key:"onRTEContentChangeFactory",value:function(e,t){var n=this;return function(r){n.setContentValue(e,r,t)}}},{key:"onRTEFocusFactory",value:function(e,t){var n=this;return function(){n.inEditor=!0}}},{key:"onRTEBlurFactory",value:function(e,t){var n=this;return function(){n.inEditor=!1,e.classList.remove("fred--block-active"),e.classList.remove("fred--block-active_top"),e.classList.remove("fred--block-active_parent")}}},{key:"setContentValue",value:function(e,t,n){this.content[e.dataset.fredName]||(this.content[e.dataset.fredName]={}),this.content[e.dataset.fredName]._raw||(this.content[e.dataset.fredName]._raw={}),this.content[e.dataset.fredName]._raw._value=t,this.setValueForBindElements(n,e.dataset.fredName,t),e.dataset.fredTarget&&(e.silent!==!0?u.default.emit("fred-page-setting-change",e.dataset.fredTarget,this.content[e.dataset.fredName]._raw._value,e):e.silent=null)}},{key:"setValueForBindElements",value:function(e,t,n){var r=e.querySelectorAll('[data-fred-bind="'+t+'"]'),i=!0,A=!1,o=void 0;try{for(var a,s=r[Symbol.iterator]();!(i=(a=s.next()).done);i=!0){var l=a.value;switch(l.nodeName.toLowerCase()){case"i":l.className=n;break;case"img":l.setAttribute("src",n);break;default:l.innerHTML=n}}}catch(e){A=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(A)throw o}}}},{key:"setContentElValue",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];switch(e.nodeName.toLowerCase()){case"i":void 0!==this.content[e.dataset.fredName]._raw._value?e.className=this.content[e.dataset.fredName]._raw._value:r||(this.content[e.dataset.fredName]._raw._value=e.className),this.setValueForBindElements(t,e.dataset.fredName,this.content[e.dataset.fredName]._raw._value),i&&"true"===e.getAttribute("data-fred-editable")&&e.addEventListener("click",function(t){t.preventDefault(),null!==n.iconEditor?new n.iconEditor(e):console.log("Editor "+n.config.iconEditor+" not found")});break;case"img":void 0!==this.content[e.dataset.fredName]._raw._value?e.setAttribute("src",this.content[e.dataset.fredName]._raw._value):r||(this.content[e.dataset.fredName]._raw._value=e.getAttribute("src")),this.setValueForBindElements(t,e.dataset.fredName,this.content[e.dataset.fredName]._raw._value),i&&"true"===e.getAttribute("data-fred-editable")&&e.addEventListener("click",function(t){t.preventDefault(),null!==n.imageEditor?new n.imageEditor(e):console.log("Editor "+n.config.imageEditor+" not found")});break;default:void 0!==this.content[e.dataset.fredName]._raw._value?e.innerHTML=this.content[e.dataset.fredName]._raw._value:r||(this.content[e.dataset.fredName]._raw._value=e.innerHTML),this.setValueForBindElements(t,e.dataset.fredName,this.content[e.dataset.fredName]._raw._value)}if(e.dataset.fredAttrs){var A=e.dataset.fredAttrs.split(",");A.forEach(function(t){void 0!==n.content[e.dataset.fredName]._raw[t]?e.setAttribute(t,n.content[e.dataset.fredName]._raw[t]):r&&(n.content[e.dataset.fredName]._raw[t]=e.getAttribute(t))})}}},{key:"getRTEConfig",value:function(e){var t={};return e.dataset.fredRteConfig&&p.default.config.rteConfig[e.dataset.fredRteConfig]?(t=p.default.config.rteConfig[e.dataset.fredRteConfig],this.options.rteConfig&&this.options.rteConfig[e.dataset.fredRteConfig]&&(t=o({},t,this.options.rteConfig[e.dataset.fredRteConfig])),t):(p.default.config.rteConfig[this.config.rte]&&(t=p.default.config.rteConfig[this.config.rte],this.options.rteConfig&&this.options.rteConfig[this.config.rte]&&(t=o({},t,this.options.rteConfig[this.config.rte]))),t)}},{key:"getSelectionHtml",value:function(){var e="";if("undefined"!=typeof window.getSelection){var t=window.getSelection();if(t.rangeCount){for(var n=document.createElement("div"),r=0,i=t.rangeCount;r0&&void 0!==arguments[0])||arguments[0];return this.options.remote===!0?this.remoteTemplateRender(e):Promise.resolve(this.localTemplateRender())}},{key:"localTemplateRender",value:function(){return this.template.render(this.settings)}},{key:"remoteTemplateRender",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return(0,Q.renderElement)(this.id,this.settings,t).then(function(t){return e.setEl(t.data.html),t.data.html}).catch(function(e){return u.default.emit("fred-loading",e.message),""})}},{key:"cleanRender",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=(0,h.div)();return this.templateRender(t).then(function(A){r.innerHTML=A;var o=r.querySelectorAll("[data-fred-render]"),a=!0,s=!1,l=void 0;try{for(var c,u=o[Symbol.iterator]();!(a=(c=u.next()).done);a=!0){var d=c.value;"false"===d.getAttribute("data-fred-render")?d.remove():d.removeAttribute("data-fred-render")}}catch(e){s=!0,l=e}finally{try{!a&&u.return&&u.return()}finally{if(s)throw l}}var f=r.querySelectorAll("[data-fred-name]"),p=!0,h=!1,g=void 0;try{for(var m,v=f[Symbol.iterator]();!(p=(m=v.next()).done);p=!0){var B=m.value;e.setContentElValue(B,r,!0,!1),B.removeAttribute("contenteditable"),B.removeAttribute("data-fred-editable"),B.removeAttribute("data-fred-name"),B.removeAttribute("data-fred-rte"),B.removeAttribute("data-fred-rte-config"),
B.removeAttribute("data-fred-target"),B.removeAttribute("data-fred-attrs"),B.removeAttribute("data-fred-media-source"),B.removeAttribute("data-fred-image-media-source")}}catch(e){h=!0,g=e}finally{try{!p&&v.return&&v.return()}finally{if(h)throw g}}if(n===!0){var w=r.querySelectorAll("[data-fred-link-type]"),y=!0,b=!1,C=void 0;try{for(var E,Q=w[Symbol.iterator]();!(y=(E=Q.next()).done);y=!0){var F=E.value,U=F.dataset.fredLinkType;if(F.removeAttribute("data-fred-link-type"),"page"===U){var _=parseInt(F.dataset.fredLinkPage),H=F.dataset.fredLinkAnchor?"#"+F.dataset.fredLinkAnchor:"";_>0?F.setAttribute("href","[[~"+_+"]]"+H):F.setAttribute("href",H),F.removeAttribute("data-fred-link-page"),F.removeAttribute("data-fred-link-anchor")}}}catch(e){b=!0,C=e}finally{try{!y&&Q.return&&Q.return()}finally{if(b)throw C}}}var T=r.querySelectorAll("[data-fred-block-class]"),S=!0,x=!1,k=void 0;try{for(var I,N=T[Symbol.iterator]();!(S=(I=N.next()).done);S=!0){var L=I.value,O=L.dataset.fredBlockClass.split(" ").filter(function(e){return e});if(O.length>0){var D;(D=L.classList).add.apply(D,i(O))}L.removeAttribute("data-fred-block-class")}}catch(e){x=!0,k=e}finally{try{!S&&N.return&&N.return()}finally{if(x)throw k}}var M=r.querySelectorAll("[data-fred-class]"),P=!0,K=!1,R=void 0;try{for(var z,j=M[Symbol.iterator]();!(P=(z=j.next()).done);P=!0){var V=z.value,X=V.dataset.fredClass.split(" ").filter(function(e){return e});if(X.length>0){var G;(G=V.classList).add.apply(G,i(X))}V.removeAttribute("data-fred-class")}}catch(e){K=!0,R=e}finally{try{!P&&j.return&&j.return()}finally{if(K)throw R}}var Y=r.querySelectorAll("[data-fred-bind]"),J=!0,W=!1,q=void 0;try{for(var Z,$=Y[Symbol.iterator]();!(J=(Z=$.next()).done);J=!0){var ee=Z.value;ee.removeAttribute("data-fred-bind")}}catch(e){W=!0,q=e}finally{try{!J&&$.return&&$.return()}finally{if(W)throw q}}var te=r.querySelectorAll("[data-fred-on-drop]"),ne=!0,re=!1,ie=void 0;try{for(var Ae,oe=te[Symbol.iterator]();!(ne=(Ae=oe.next()).done);ne=!0){var ae=Ae.value;ae.removeAttribute("data-fred-on-drop")}}catch(e){re=!0,ie=e}finally{try{!ne&&oe.return&&oe.return()}finally{if(re)throw ie}}var se=r.querySelectorAll("[data-fred-on-setting-change]"),le=!0,ce=!1,ue=void 0;try{for(var de,fe=se[Symbol.iterator]();!(le=(de=fe.next()).done);le=!0){var pe=de.value;pe.removeAttribute("data-fred-on-setting-change")}}catch(e){ce=!0,ue=e}finally{try{!le&&fe.return&&fe.return()}finally{if(ce)throw ue}}var he=[];for(var ge in e.dzs)e.dzs.hasOwnProperty(ge)&&!function(){var i=r.querySelector('[data-fred-dropzone="'+ge+'"]');if(i&&(i.removeAttribute("data-fred-dropzone"),e.dzs[ge].children.length>0)){var A="",o=[];e.dzs[ge].children.forEach(function(e){o.push(e.fredEl.cleanRender(t,n))}),he.push(Promise.all(o).then(function(e){e.forEach(function(e){A+=e.innerHTML}),i.innerHTML=A}))}}();return Promise.all(he).then(function(){return r})})}},{key:"remove",value:function(){if(p.default.permission.fred_element_delete){if(this.parent){var e=this.parent.dzs[this.dzName].children.indexOf(this.wrapper);e>-1&&this.parent.dzs[this.dzName].children.splice(e,1)}this.wrapper.remove(),p.default.invalidElements&&u.default.emit("fred-clear-invalid-elements-warning")}}},{key:"duplicateDropZones",value:function(t){var n=this,r=function(r){t.hasOwnProperty(r)&&t[r].children.forEach(function(t){if(n.dzs[r]){var i=new e(t.fredEl.el,r,n,t.fredEl.content,t.fredEl.settings);i.render().then(function(){n.addElementToDropZone(r,i),i.duplicateDropZones(t.fredEl.dzs)})}})};for(var i in t)r(i)}},{key:"duplicate",value:function(){var t=this,n=new e(this.el,this.dzName,this.parent,this.content,this.settings);n.render().then(function(){if(n.duplicateDropZones(t.dzs),null===t.wrapper.nextSibling?t.wrapper.parentNode.appendChild(n.wrapper):t.wrapper.parentNode.insertBefore(n.wrapper,t.wrapper.nextSibling),t.parent){var e=t.parent.dzs[t.dzName].children.indexOf(t.wrapper);e>-1&&t.parent.dzs[t.dzName].children.splice(e+1,0,n.wrapper)}l.default.reloadContainers()})}},{key:"addElementToDropZone",value:function(e,t){return!!this.dzs[e]&&(t.dzName=e,t.parent=this,this.dzs[e].children.push(t.wrapper),this.dzs[e].el.appendChild(t.wrapper),!0)}},{key:"unshiftElementToDropZone",value:function(e,t){return!!this.dzs[e]&&(t.dzName=e,t.parent=this,this.dzs[e].children.unshift(t.wrapper),this.dzs[e].el.firstElementChild?this.dzs[e].el.insertBefore(t.wrapper,this.dzs[e].el.firstElementChild):this.dzs[e].el.appendChild(t.wrapper),!0)}},{key:"insertBeforeElementToDropZone",value:function(e,t,n){return!!this.dzs[e]&&(n.dzName=e,n.parent=this,this.dzs[e].children.splice(this.dzs[e].children.indexOf(t.wrapper),0,n.wrapper),void t.wrapper.insertAdjacentElement("beforebegin",n.wrapper))}}],[{key:"getElValue",value:function(e){switch(e.nodeName.toLowerCase()){case"i":return e.className;case"img":return e.getAttribute("src");default:return e.innerHTML}}}]),e}();t.default=x},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);twindow.innerHeight-n.offset;i=i||r,r&&(A=n.speed)}else{var o=e.y0?e:le.revertOnSpill,n=Ae||Z,r=f(n),i=M(r);i===!1&&t&&(Ae?r&&r.removeChild(Ae):q.insertBefore(n,re)),i||t?ce.emit("cancel",n,q,q):ce.emit("drop",n,r,q,ie),D()}}function D(){var e=Ae||Z;k(),V(),e&&y.rm(e,"gu-transit"),oe&&clearTimeout(oe),ce.dragging=!1,se&&ce.emit("out",e,se,q),ce.emit("dragend",e),q=Z=Ae=re=ie=oe=se=null}function M(e,t){var n;return n=void 0!==t?t:W?ie:g(Ae||Z),e===q&&n===re}function P(e,t,r){function i(){var i=n(A);if(i===!1)return!1;var o=X(A,e),a=G(A,o,t,r),s=M(A,a);return!!s||le.accepts(Z,A,q,a)}for(var A=e;A&&!i();)A=f(A);return A}function K(e){function t(e){ce.emit(e,l,se,q)}function n(){d&&t("over")}function r(){se&&t("out")}if(W){e.preventDefault();var i=v("clientX",e),A=v("clientY",e),o=i-$,a=A-ee;W.style.left=o+"px",W.style.top=a+"px";var l=Ae||Z,c=s(W,i,A),u=P(c,i,A),d=null!==u&&u!==se;(d||null===u)&&(r(),se=u,n());var p=f(l);if(u===q&&Ae&&!le.copySortSource)return void(p&&p.removeChild(l));var h,m=X(u,c);if(null!==m)h=G(u,m,i,A);else{if(le.revertOnSpill!==!0||Ae)return void(Ae&&p&&p.removeChild(l));h=re,u=q}(null===h&&d||h!==l&&h!==g(l))&&(ie=h,u.insertBefore(l,h),ce.emit("shadow",l,u,q))}}function R(e){y.rm(e,"gu-hide")}function z(e){ce.dragging&&y.add(e,"gu-hide")}function j(){if(!W){var e=Z.getBoundingClientRect();W=Z.cloneNode(!0),W.style.width=u(e)+"px",W.style.height=d(e)+"px",y.rm(W,"gu-transit"),y.add(W,"gu-mirror"),le.mirrorContainer.appendChild(W),i(C,"add","mousemove",K),y.add(le.mirrorContainer,"gu-unselectable"),ce.emit("cloned",W,Z,"mirror")}}function V(){W&&(y.rm(le.mirrorContainer,"gu-unselectable"),i(C,"remove","mousemove",K),f(W).removeChild(W),W=null)}function X(e,t){for(var n=t;n!==e&&f(n)!==e;)n=f(n);return n===C?null:n}function G(e,t,n,r){function i(){var t,i,A,o=e.children.length;for(t=0;tn)return i;if(!a&&A.top+A.height/2>r)return i}return null}function A(){var e=t.getBoundingClientRect();return o(a?n>e.left+u(e)/2:r>e.top+d(e)/2)}function o(e){return e?g(t):t}var a="horizontal"===le.direction,s=t!==e?A():i();return s}function Y(e,t){return"boolean"==typeof le.copy?le.copy:le.copy(e,t)}var J=arguments.length;1===J&&Array.isArray(e)===!1&&(t=e,e=[]);var W,q,Z,$,ee,te,ne,re,ie,Ae,oe,ae,se=null,le=t||{};void 0===le.moves&&(le.moves=c),void 0===le.accepts&&(le.accepts=c),void 0===le.invalid&&(le.invalid=S),void 0===le.containers&&(le.containers=e||[]),void 0===le.isContainer&&(le.isContainer=l),void 0===le.copy&&(le.copy=!1),void 0===le.copySortSource&&(le.copySortSource=!1),void 0===le.revertOnSpill&&(le.revertOnSpill=!1),void 0===le.removeOnSpill&&(le.removeOnSpill=!1),void 0===le.direction&&(le.direction="vertical"),void 0===le.ignoreInputTextSelection&&(le.ignoreInputTextSelection=!0),void 0===le.mirrorContainer&&(le.mirrorContainer=b.body);var ce=B({containers:le.containers,start:H,end:x,cancel:O,remove:L,destroy:m,canMove:_,dragging:!1});return le.removeOnSpill===!0&&ce.on("over",R).on("out",z),r(),ce}function i(e,n,r,i){var A={mouseup:"touchend",mousedown:"touchstart",mousemove:"touchmove"},o={mouseup:"pointerup",mousedown:"pointerdown",mousemove:"pointermove"},a={mouseup:"MSPointerUp",mousedown:"MSPointerDown",mousemove:"MSPointerMove"};t.navigator.pointerEnabled?w[n](e,o[r],i):t.navigator.msPointerEnabled?w[n](e,a[r],i):(w[n](e,A[r],i),w[n](e,r,i))}function A(e){if(void 0!==e.touches)return e.touches.length;if(void 0!==e.which&&0!==e.which)return e.which;if(void 0!==e.buttons)return e.buttons;var t=e.button;return void 0!==t?1&t?1:2&t?3:4&t?2:0:void 0}function o(e){var t=e.getBoundingClientRect();return{left:t.left+a("scrollLeft","pageXOffset"),top:t.top+a("scrollTop","pageYOffset")}}function a(e,n){return"undefined"!=typeof t[n]?t[n]:C.clientHeight?C[e]:b.body[e]}function s(e,t,n){var r,i=e||{},A=i.className;return i.className+=" gu-hide",r=b.elementFromPoint(t,n),i.className=A,r}function l(){return!1}function c(){return!0}function u(e){return e.width||e.right-e.left}function d(e){return e.height||e.bottom-e.top}function f(e){return e.parentNode===b?null:e.parentNode}function p(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName||"SELECT"===e.tagName||h(e)}function h(e){return!!e&&("false"!==e.contentEditable&&("true"===e.contentEditable||h(f(e))))}function g(e){function t(){var t=e;do t=t.nextSibling;while(t&&1!==t.nodeType);return t}return e.nextElementSibling||t()}function m(e){return e.targetTouches&&e.targetTouches.length?e.targetTouches[0]:e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e}function v(e,t){var n=m(t),r={pageX:"clientX",pageY:"clientY"};return e in r&&!(e in n)&&r[e]in n&&(e=r[e]),n[e]}var B=n(24),w=n(31),y=n(34),b=document,C=b.documentElement;e.exports=r}).call(t,function(){return this}())},function(e,t,n){"use strict";var r=n(25),i=n(26);e.exports=function(e,t){var n=t||{},A={};return void 0===e&&(e={}),e.on=function(t,n){return A[t]?A[t].push(n):A[t]=[n],e},e.once=function(t,n){return n._once=!0,e.on(t,n),e},e.off=function(t,n){var r=arguments.length;if(1===r)delete A[t];else if(0===r)A={};else{var i=A[t];if(!i)return e;i.splice(i.indexOf(n),1)}return e},e.emit=function(){var t=r(arguments);return e.emitterSnapshot(t.shift()).apply(this,t)},e.emitterSnapshot=function(t){var o=(A[t]||[]).slice(0);return function(){var A=r(arguments),a=this||e;if("error"===t&&n.throws!==!1&&!o.length)throw 1===A.length?A[0]:A;return o.forEach(function(r){n.async?i(r,A,a):r.apply(a,A),r._once&&e.off(t,r)}),e}},e}},function(e,t){e.exports=function(e,t){return Array.prototype.slice.call(e,t)}},function(e,t,n){"use strict";var r=n(27);e.exports=function(e,t,n){e&&r(function(){e.apply(n||null,t||[])})}},function(e,t,n){(function(t){var n,r="function"==typeof t;n=r?function(e){t(e)}:function(e){setTimeout(e,0)},e.exports=n}).call(t,n(28).setImmediate)},function(e,t,n){(function(e){function r(e,t){this._id=e,this._clearFn=t}var i=Function.prototype.apply;t.setTimeout=function(){return new r(i.call(setTimeout,window,arguments),clearTimeout)},t.setInterval=function(){return new r(i.call(setInterval,window,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(window,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(29),t.setImmediate="undefined"!=typeof self&&self.setImmediate||"undefined"!=typeof e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||"undefined"!=typeof e&&e.clearImmediate||this&&this.clearImmediate}).call(t,function(){return this}())},function(e,t,n){(function(e,t){!function(e,n){"use strict";function r(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n1)for(var n=1;n0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.default.config.theme;return a.default.load("blueprints",{name:"blueprints",complete:e,theme:t},function(){var n=null!==e?"&complete="+ +e:"";return(0,A.default)(c.default.config.assetsUrl+"endpoints/ajax.php?action=get-blueprints&theme="+t+n,{credentials:"same-origin",headers:{"X-Fred-Token":c.default.jwt}}).then(function(e){return e.json()}).then(function(e){return e.data.blueprints})})},t.createBlueprint=function(e,t,n,r,i,o,a,l,u){var d={name:e,description:t,category:n,rank:r,public:i,data:o,generatedImage:"",image:l,complete:u};return""===l&&(d.generatedImage=a),(0,A.default)(c.default.config.assetsUrl+"endpoints/ajax.php?action=blueprints-create-blueprint",{method:"post",credentials:"same-origin",headers:{"Content-Type":"application/json","X-Fred-Token":c.default.jwt},body:JSON.stringify(d)}).then(s.errorHandler)},t.createBlueprintCategory=function(e,t,n){return(0,A.default)(c.default.config.assetsUrl+"endpoints/ajax.php?action=blueprints-create-category",{method:"post",credentials:"same-origin",headers:{"Content-Type":"application/json","X-Fred-Token":c.default.jwt},body:JSON.stringify({name:e,rank:t,public:n,theme:c.default.config.theme})}).then(s.errorHandler)},t.loadBlueprint=function(e){return a.default.load("blueprints",{name:"load-blueprint",blueprint:e},function(){return(0,A.default)(c.default.config.assetsUrl+"endpoints/ajax.php?action=load-blueprint&blueprint="+e,{credentials:"same-origin",headers:{"X-Fred-Token":c.default.jwt}}).then(s.errorHandler).catch(function(e){console.log(e)})})}},function(e,t,n){n(37),e.exports=self.fetch.bind(self)},function(e,t){!function(e){"use strict";function t(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function n(e){return"string"!=typeof e&&(e=String(e)),e}function r(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return m.iterable&&(t[Symbol.iterator]=function(){return t}),t}function i(e){this.map={},e instanceof i?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function A(e){return e.bodyUsed?Promise.reject(new TypeError("Already read")):void(e.bodyUsed=!0)}function o(e){return new Promise(function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}})}function a(e){var t=new FileReader,n=o(t);return t.readAsArrayBuffer(e),n}function s(e){var t=new FileReader,n=o(t);return t.readAsText(e),n}function l(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?t:e}function f(e,t){t=t||{};var n=t.body;if(e instanceof f){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new i(e.headers)),this.method=e.method,this.mode=e.mode,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new i(t.headers)),this.method=d(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function p(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}}),t}function h(e){var t=new i;return e.split(/\r?\n/).forEach(function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}}),t}function g(e,t){t||(t={}),this.type="default",this.status="status"in t?t.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new i(t.headers),this.url=t.url||"",this._initBody(e)}if(!e.fetch){var m={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(m.arrayBuffer)var v=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],B=function(e){
return e&&DataView.prototype.isPrototypeOf(e)},w=ArrayBuffer.isView||function(e){return e&&v.indexOf(Object.prototype.toString.call(e))>-1};i.prototype.append=function(e,r){e=t(e),r=n(r);var i=this.map[e];this.map[e]=i?i+","+r:r},i.prototype.delete=function(e){delete this.map[t(e)]},i.prototype.get=function(e){return e=t(e),this.has(e)?this.map[e]:null},i.prototype.has=function(e){return this.map.hasOwnProperty(t(e))},i.prototype.set=function(e,r){this.map[t(e)]=n(r)},i.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},i.prototype.keys=function(){var e=[];return this.forEach(function(t,n){e.push(n)}),r(e)},i.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),r(e)},i.prototype.entries=function(){var e=[];return this.forEach(function(t,n){e.push([n,t])}),r(e)},m.iterable&&(i.prototype[Symbol.iterator]=i.prototype.entries);var y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];f.prototype.clone=function(){return new f(this,{body:this._bodyInit})},u.call(f.prototype),u.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new i(this.headers),url:this.url})},g.error=function(){var e=new g(null,{status:0,statusText:""});return e.type="error",e};var b=[301,302,303,307,308];g.redirect=function(e,t){if(b.indexOf(t)===-1)throw new RangeError("Invalid status code");return new g(null,{status:t,headers:{location:e}})},e.Headers=i,e.Request=f,e.Response=g,e.fetch=function(e,t){return new Promise(function(n,r){var i=new f(e,t),A=new XMLHttpRequest;A.onload=function(){var e={status:A.status,statusText:A.statusText,headers:h(A.getAllResponseHeaders()||"")};e.url="responseURL"in A?A.responseURL:e.headers.get("X-Request-URL");var t="response"in A?A.response:A.responseText;n(new g(t,e))},A.onerror=function(){r(new TypeError("Network request failed"))},A.ontimeout=function(){r(new TypeError("Network request failed"))},A.open(i.method,i.url,!0),"include"===i.credentials&&(A.withCredentials=!0),"responseType"in A&&m.blob&&(A.responseType="blob"),i.headers.forEach(function(e,t){A.setRequestHeader(t,e)}),A.send("undefined"==typeof i._bodyInit?null:i._bodyInit)})},e.fetch.polyfill=!0}}("undefined"!=typeof self?self:this)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var A=function(){function e(e,t){for(var n=0;n3&&void 0!==arguments[3]?arguments[3]:300,A=new a.default("SHA-256","TEXT");A.update(JSON.stringify(t));var o=A.getHash("HEX"),s=Math.floor(Date.now()/1e3);return this._cache[e]&&this._cache[e][o]&&this._cache[e][o].expires>s?Promise.resolve(this._cache[e][o].value):Promise.resolve(n()).then(function(t){return r._setValue(e,o,t,s+i),t})}},{key:"kill",value:function(e,t){var n=new a.default("SHA-256","TEXT");n.update(JSON.stringify(t));var r=n.getHash("HEX");this._cache[e]&&this._cache[e][r]&&delete this._cache[e][r]}},{key:"killNamespace",value:function(e){this._cache[e]&&delete this._cache[e]}}]),e}(),l=new s;t.default=l,e.exports=t.default},function(e,t,n){var r;!function(i){function A(e,t,n){var r,i,A,o,f,p,h,g,m,v=0,B=[],w=0,y=!1,b=[],C=[],E=!1,Q=!1,F=-1;if(n=n||{},r=n.encoding||"UTF8",m=n.numRounds||1,m!==parseInt(m,10)||1>m)throw Error("numRounds must a integer >= 1");if("SHA-1"===e)f=512,p=D,h=M,o=160,g=function(e){return e.slice()};else if(0===e.lastIndexOf("SHA-",0))if(p=function(t,n){return P(t,n,e)},h=function(t,n,r,i){var A,o;if("SHA-224"===e||"SHA-256"===e)A=(n+65>>>9<<4)+15,o=16;else{if("SHA-384"!==e&&"SHA-512"!==e)throw Error("Unexpected error in SHA-2 implementation");A=(n+129>>>10<<5)+31,o=32}for(;t.length<=A;)t.push(0);for(t[n>>>5]|=128<<24-n%32,n+=r,t[A]=4294967295&n,t[A-1]=n/4294967296|0,r=t.length,n=0;nt;t+=1)n[t]=e[t].slice();return n},F=1,"SHA3-224"===e)f=1152,o=224;else if("SHA3-256"===e)f=1088,o=256;else if("SHA3-384"===e)f=832,o=384;else if("SHA3-512"===e)f=576,o=512;else if("SHAKE128"===e)f=1344,o=-1,U=31,Q=!0;else{if("SHAKE256"!==e)throw Error("Chosen SHA variant is not supported");f=1088,o=-1,U=31,Q=!0}h=function(e,t,n,r,i){n=f;var A,o=U,a=[],s=n>>>5,l=0,c=t>>>5;for(A=0;A=n;A+=s)r=K(e.slice(A,A+s),r),t-=n;for(e=e.slice(A),t%=n;e.length>>3,e[A>>2]^=o<=i));)a.push(e.a),l+=1,0===64*l%n&&K(null,r);return a}}A=d(t,r,F),i=O(e),this.setHMACKey=function(t,n,A){var a;if(!0===y)throw Error("HMAC key already set");if(!0===E)throw Error("Cannot set HMAC key after calling update");if(!0===Q)throw Error("SHAKE is not supported for HMAC");if(r=(A||{}).encoding||"UTF8",n=d(n,r,F)(t),t=n.binLen,n=n.value,a=f>>>3,A=a/4-1,at/8){for(;n.length<=A;)n.push(0);n[A]&=4294967040}for(t=0;t<=A;t+=1)b[t]=909522486^n[t],C[t]=1549556828^n[t];i=p(b,i),v=f,y=!0},this.update=function(e){var t,n,r,o=0,a=f>>>5;for(t=A(e,B,w),e=t.binLen,n=t.value,t=e>>>5,r=0;r>>5),w=e%f,E=!0},this.getHash=function(t,n){var r,A,d,f;if(!0===y)throw Error("Cannot call getHash after setting HMAC key");if(d=u(n),!0===Q){if(-1===d.shakeLen)throw Error("shakeLen must be specified in options");o=d.shakeLen}switch(t){case"HEX":r=function(e){return a(e,o,F,d)};break;case"B64":r=function(e){return s(e,o,F,d)};break;case"BYTES":r=function(e){return l(e,o,F)};break;case"ARRAYBUFFER":try{A=new ArrayBuffer(0)}catch(e){throw Error("ARRAYBUFFER not supported by this environment")}r=function(e){return c(e,o,F)};break;default:throw Error("format must be HEX, B64, BYTES, or ARRAYBUFFER")}for(f=h(B.slice(),w,v,g(i),o),A=1;A>>24-o%32),f=h(f,o,0,O(e),o);return r(f)},this.getHMAC=function(t,n){var r,A,d,m;if(!1===y)throw Error("Cannot call getHMAC without first setting HMAC key");switch(d=u(n),t){case"HEX":r=function(e){return a(e,o,F,d)};break;case"B64":r=function(e){return s(e,o,F,d)};break;case"BYTES":r=function(e){return l(e,o,F)};break;case"ARRAYBUFFER":try{r=new ArrayBuffer(0)}catch(e){throw Error("ARRAYBUFFER not supported by this environment")}r=function(e){return c(e,o,F)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, or ARRAYBUFFER")}return A=h(B.slice(),w,v,g(i),o),m=p(C,O(e)),m=h(A,o,f,m,o),r(m)}}function o(e,t){this.a=e,this.b=t}function a(e,t,n,r){var i="";t/=8;var A,o,a;for(a=-1===n?3:0,A=0;A>>2]>>>8*(a+A%4*n),i+="0123456789abcdef".charAt(o>>>4&15)+"0123456789abcdef".charAt(15&o);return r.outputUpper?i.toUpperCase():i}function s(e,t,n,r){var i,A,o,a,s="",l=t/8;for(a=-1===n?3:0,i=0;i>>2]:0,o=i+2>>2]:0,o=(e[i>>>2]>>>8*(a+i%4*n)&255)<<16|(A>>>8*(a+(i+1)%4*n)&255)<<8|o>>>8*(a+(i+2)%4*n)&255,A=0;4>A;A+=1)s+=8*i+6*A<=t?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(o>>>6*(3-A)&63):r.b64Pad;return s}function l(e,t,n){var r="";t/=8;var i,A,o;for(o=-1===n?3:0,i=0;i>>2]>>>8*(o+i%4*n)&255,r+=String.fromCharCode(A);return r}function c(e,t,n){t/=8;var r,i,A,o=new ArrayBuffer(t);for(A=new Uint8Array(o),i=-1===n?3:0,r=0;r>>2]>>>8*(i+r%4*n)&255;return o}function u(e){var t={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(e=e||{},t.outputUpper=e.outputUpper||!1,!0===e.hasOwnProperty("b64Pad")&&(t.b64Pad=e.b64Pad),!0===e.hasOwnProperty("shakeLen")){if(0!==e.shakeLen%8)throw Error("shakeLen must be a multiple of 8");t.shakeLen=e.shakeLen}if("boolean"!=typeof t.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof t.b64Pad)throw Error("Invalid b64Pad formatting option");return t}function d(e,t,n){switch(t){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(e){case"HEX":e=function(e,t,r){var i,A,o,a,s,l,c=e.length;if(0!==c%2)throw Error("String of HEX type must be in byte increments");for(t=t||[0],r=r||0,s=r>>>3,l=-1===n?3:0,i=0;i>>1)+s,o=a>>>2;t.length<=o;)t.push(0);t[o]|=A<<8*(l+a%4*n)}return{value:t,binLen:4*c+r}};break;case"TEXT":e=function(e,r,i){var A,o,a,s,l,c,u,d,f=0;if(r=r||[0],i=i||0,l=i>>>3,"UTF8"===t)for(d=-1===n?3:0,a=0;aA?o.push(A):2048>A?(o.push(192|A>>>6),o.push(128|63&A)):55296>A||57344<=A?o.push(224|A>>>12,128|A>>>6&63,128|63&A):(a+=1,A=65536+((1023&A)<<10|1023&e.charCodeAt(a)),o.push(240|A>>>18,128|A>>>12&63,128|A>>>6&63,128|63&A)),s=0;s>>2;r.length<=c;)r.push(0);r[c]|=o[s]<<8*(d+u%4*n),f+=1}else if("UTF16BE"===t||"UTF16LE"===t)for(d=-1===n?2:0,o="UTF16LE"===t&&1!==n||"UTF16LE"!==t&&1===n,a=0;a>>8),u=f+l,c=u>>>2;r.length<=c;)r.push(0);r[c]|=A<<8*(d+u%4*n),f+=2}return{value:r,binLen:8*f+i}};break;case"B64":e=function(e,t,r){var i,A,o,a,s,l,c,u,d=0;if(-1===e.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(A=e.indexOf("="),e=e.replace(/\=/g,""),-1!==A&&A>>3,u=-1===n?3:0,A=0;A>>2;t.length<=i;)t.push(0);t[i]|=(a>>>16-8*o&255)<<8*(u+c%4*n),d+=1}}return{value:t,binLen:8*d+r}};break;case"BYTES":e=function(e,t,r){var i,A,o,a,s,l;for(t=t||[0],r=r||0,o=r>>>3,l=-1===n?3:0,A=0;A>>2,t.length<=a&&t.push(0),t[a]|=i<<8*(l+s%4*n);return{value:t,binLen:8*e.length+r}};break;case"ARRAYBUFFER":try{e=new ArrayBuffer(0)}catch(e){throw Error("ARRAYBUFFER not supported by this environment")}e=function(e,t,r){var i,A,o,a,s,l;for(t=t||[0],r=r||0,A=r>>>3,s=-1===n?3:0,l=new Uint8Array(e),i=0;i>>2,t.length<=o&&t.push(0),t[o]|=l[i]<<8*(s+a%4*n);return{value:t,binLen:8*e.byteLength+r}};break;default:throw Error("format must be HEX, TEXT, B64, BYTES, or ARRAYBUFFER")}return e}function f(e,t){return e<>>32-t}function p(e,t){return 32>>32-t,e.a<>>32-t)):0!==t?new o(e.a<>>32-t,e.b<>>32-t):e}function h(e,t){return e>>>t|e<<32-t}function g(e,t){var n=null,n=new o(e.a,e.b);return n=32>=t?new o(n.a>>>t|n.b<<32-t&4294967295,n.b>>>t|n.a<<32-t&4294967295):new o(n.b>>>t-32|n.a<<64-t&4294967295,n.a>>>t-32|n.b<<64-t&4294967295)}function m(e,t){var n=null;return n=32>=t?new o(e.a>>>t,e.b>>>t|e.a<<32-t&4294967295):new o(0,e.a>>>t-32)}function v(e,t,n){return e&t^~e&n}function B(e,t,n){return new o(e.a&t.a^~e.a&n.a,e.b&t.b^~e.b&n.b)}function w(e,t,n){return e&t^e&n^t&n}function y(e,t,n){return new o(e.a&t.a^e.a&n.a^t.a&n.a,e.b&t.b^e.b&n.b^t.b&n.b)}function b(e){return h(e,2)^h(e,13)^h(e,22)}function C(e){var t=g(e,28),n=g(e,34);return e=g(e,39),new o(t.a^n.a^e.a,t.b^n.b^e.b)}function E(e){return h(e,6)^h(e,11)^h(e,25)}function Q(e){var t=g(e,14),n=g(e,18);return e=g(e,41),new o(t.a^n.a^e.a,t.b^n.b^e.b)}function F(e){return h(e,7)^h(e,18)^e>>>3}function U(e){var t=g(e,1),n=g(e,8);return e=m(e,7),new o(t.a^n.a^e.a,t.b^n.b^e.b)}function _(e){return h(e,17)^h(e,19)^e>>>10}function H(e){var t=g(e,19),n=g(e,61);return e=m(e,6),new o(t.a^n.a^e.a,t.b^n.b^e.b)}function T(e,t){var n=(65535&e)+(65535&t);return((e>>>16)+(t>>>16)+(n>>>16)&65535)<<16|65535&n}function S(e,t,n,r){var i=(65535&e)+(65535&t)+(65535&n)+(65535&r);return((e>>>16)+(t>>>16)+(n>>>16)+(r>>>16)+(i>>>16)&65535)<<16|65535&i}function x(e,t,n,r,i){var A=(65535&e)+(65535&t)+(65535&n)+(65535&r)+(65535&i);return((e>>>16)+(t>>>16)+(n>>>16)+(r>>>16)+(i>>>16)+(A>>>16)&65535)<<16|65535&A}function k(e,t){var n,r,i;return n=(65535&e.b)+(65535&t.b),r=(e.b>>>16)+(t.b>>>16)+(n>>>16),i=(65535&r)<<16|65535&n,n=(65535&e.a)+(65535&t.a)+(r>>>16),r=(e.a>>>16)+(t.a>>>16)+(n>>>16),new o((65535&r)<<16|65535&n,i)}function I(e,t,n,r){var i,A,a;return i=(65535&e.b)+(65535&t.b)+(65535&n.b)+(65535&r.b),A=(e.b>>>16)+(t.b>>>16)+(n.b>>>16)+(r.b>>>16)+(i>>>16),a=(65535&A)<<16|65535&i,i=(65535&e.a)+(65535&t.a)+(65535&n.a)+(65535&r.a)+(A>>>16),A=(e.a>>>16)+(t.a>>>16)+(n.a>>>16)+(r.a>>>16)+(i>>>16),new o((65535&A)<<16|65535&i,a)}function N(e,t,n,r,i){var A,a,s;return A=(65535&e.b)+(65535&t.b)+(65535&n.b)+(65535&r.b)+(65535&i.b),a=(e.b>>>16)+(t.b>>>16)+(n.b>>>16)+(r.b>>>16)+(i.b>>>16)+(A>>>16),s=(65535&a)<<16|65535&A,A=(65535&e.a)+(65535&t.a)+(65535&n.a)+(65535&r.a)+(65535&i.a)+(a>>>16),a=(e.a>>>16)+(t.a>>>16)+(n.a>>>16)+(r.a>>>16)+(i.a>>>16)+(A>>>16),new o((65535&a)<<16|65535&A,s)}function L(e,t){return new o(e.a^t.a,e.b^t.b)}function O(e){var t,n=[];if("SHA-1"===e)n=[1732584193,4023233417,2562383102,271733878,3285377520];else if(0===e.lastIndexOf("SHA-",0))switch(n=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],t=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],e){case"SHA-224":break;case"SHA-256":n=t;break;case"SHA-384":n=[new o(3418070365,n[0]),new o(1654270250,n[1]),new o(2438529370,n[2]),new o(355462360,n[3]),new o(1731405415,n[4]),new o(41048885895,n[5]),new o(3675008525,n[6]),new o(1203062813,n[7])];break;case"SHA-512":n=[new o(t[0],4089235720),new o(t[1],2227873595),new o(t[2],4271175723),new o(t[3],1595750129),new o(t[4],2917565137),new o(t[5],725511199),new o(t[6],4215389547),new o(t[7],327033209)];break;default:throw Error("Unknown SHA variant")}else{if(0!==e.lastIndexOf("SHA3-",0)&&0!==e.lastIndexOf("SHAKE",0))throw Error("No SHA variants supported");for(e=0;5>e;e+=1)n[e]=[new o(0,0),new o(0,0),new o(0,0),new o(0,0),new o(0,0)]}return n}function D(e,t){var n,r,i,A,o,a,s,l=[];for(n=t[0],r=t[1],i=t[2],A=t[3],o=t[4],s=0;80>s;s+=1)l[s]=16>s?e[s]:f(l[s-3]^l[s-8]^l[s-14]^l[s-16],1),a=20>s?x(f(n,5),r&i^~r&A,o,1518500249,l[s]):40>s?x(f(n,5),r^i^A,o,1859775393,l[s]):60>s?x(f(n,5),w(r,i,A),o,2400959708,l[s]):x(f(n,5),r^i^A,o,3395469782,l[s]),o=A,A=i,i=f(r,30),r=n,n=a;return t[0]=T(n,t[0]),t[1]=T(r,t[1]),t[2]=T(i,t[2]),t[3]=T(A,t[3]),t[4]=T(o,t[4]),t}function M(e,t,n,r){var i;for(i=(t+65>>>9<<4)+15;e.length<=i;)e.push(0);for(e[t>>>5]|=128<<24-t%32,t+=n,e[i]=4294967295&t,e[i-1]=t/4294967296|0,t=e.length,i=0;ip?(d=p*h,u=e.length<=d?0:e[d],d=e.length<=d+1?0:e[d+1],G[p]=new V(u,d)):G[p]=m(D(G[p-2]),G[p-7],O(G[p-15]),G[p-16]),u=L(c,P(a),K(a,s,l),X[p],G[p]),d=g(M(n),j(n,r,i)),c=l,l=s,s=a,a=g(A,u),A=i,i=r,r=n,n=g(u,d);return t[0]=g(n,t[0]),t[1]=g(r,t[1]),t[2]=g(i,t[2]),t[3]=g(A,t[3]),t[4]=g(a,t[4]),t[5]=g(s,t[5]),t[6]=g(l,t[6]),t[7]=g(c,t[7]),t}function K(e,t){var n,r,i,A,a=[],s=[];if(null!==e)for(r=0;r>>1)%5][(r>>>1)/5|0]=L(t[(r>>>1)%5][(r>>>1)/5|0],new o(e[r+1],e[r]));for(n=0;24>n;n+=1){for(A=O("SHA3-"),r=0;5>r;r+=1){i=t[r][0];var l=t[r][1],c=t[r][2],u=t[r][3],d=t[r][4];a[r]=new o(i.a^l.a^c.a^u.a^d.a,i.b^l.b^c.b^u.b^d.b)}for(r=0;5>r;r+=1)s[r]=L(a[(r+4)%5],p(a[(r+1)%5],1));for(r=0;5>r;r+=1)for(i=0;5>i;i+=1)t[r][i]=L(t[r][i],s[r]);for(r=0;5>r;r+=1)for(i=0;5>i;i+=1)A[i][(2*r+3*i)%5]=p(t[r][i],j[r][i]);for(r=0;5>r;r+=1)for(i=0;5>i;i+=1)t[r][i]=L(A[r][i],new o(~A[(r+1)%5][i].a&A[(r+2)%5][i].a,~A[(r+1)%5][i].b&A[(r+2)%5][i].b));t[0][0]=L(t[0][0],V[n])}return t}var R,z,j,V;R=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],z=[new o(R[0],3609767458),new o(R[1],602891725),new o(R[2],3964484399),new o(R[3],2173295548),new o(R[4],4081628472),new o(R[5],3053834265),new o(R[6],2937671579),new o(R[7],3664609560),new o(R[8],2734883394),new o(R[9],1164996542),new o(R[10],1323610764),new o(R[11],3590304994),new o(R[12],4068182383),new o(R[13],991336113),new o(R[14],633803317),new o(R[15],3479774868),new o(R[16],2666613458),new o(R[17],944711139),new o(R[18],2341262773),new o(R[19],2007800933),new o(R[20],1495990901),new o(R[21],1856431235),new o(R[22],3175218132),new o(R[23],2198950837),new o(R[24],3999719339),new o(R[25],766784016),new o(R[26],2566594879),new o(R[27],3203337956),new o(R[28],1034457026),new o(R[29],2466948901),new o(R[30],3758326383),new o(R[31],168717936),new o(R[32],1188179964),new o(R[33],1546045734),new o(R[34],1522805485),new o(R[35],2643833823),new o(R[36],2343527390),new o(R[37],1014477480),new o(R[38],1206759142),new o(R[39],344077627),new o(R[40],1290863460),new o(R[41],3158454273),new o(R[42],3505952657),new o(R[43],106217008),new o(R[44],3606008344),new o(R[45],1432725776),new o(R[46],1467031594),new o(R[47],851169720),new o(R[48],3100823752),new o(R[49],1363258195),new o(R[50],3750685593),new o(R[51],3785050280),new o(R[52],3318307427),new o(R[53],3812723403),new o(R[54],2003034995),new o(R[55],3602036899),new o(R[56],1575990012),new o(R[57],1125592928),new o(R[58],2716904306),new o(R[59],442776044),new o(R[60],593698344),new o(R[61],3733110249),new o(R[62],2999351573),new o(R[63],3815920427),new o(3391569614,3928383900),new o(3515267271,566280711),new o(3940187606,3454069534),new o(4118630271,4000239992),new o(116418474,1914138554),new o(174292421,2731055270),new o(289380356,3203993006),new o(460393269,320620315),new o(685471733,587496836),new o(852142971,1086792851),new o(1017036298,365543100),new o(1126000580,2618297676),new o(1288033470,3409855158),new o(1501505948,4234509866),new o(1607167915,987167468),new o(1816402316,1246189591)],V=[new o(0,1),new o(0,32898),new o(2147483648,32906),new o(2147483648,2147516416),new o(0,32907),new o(0,2147483649),new o(2147483648,2147516545),new o(2147483648,32777),new o(0,138),new o(0,136),new o(0,2147516425),new o(0,2147483658),new o(0,2147516555),new o(2147483648,139),new o(2147483648,32905),new o(2147483648,32771),new o(2147483648,32770),new o(2147483648,128),new o(0,32778),new o(2147483648,2147483658),new o(2147483648,2147516545),new o(2147483648,32896),new o(0,2147483649),new o(2147483648,2147516424)],j=[[0,36,3,41,18],[1,44,10,45,2],[62,6,43,15,61],[28,55,25,21,56],[27,20,39,8,14]],r=function(){return A}.call(t,n,t,e),!(void 0!==r&&(e.exports=r))}(this)},function(e,t,n){(function(t,r){!function(t,n){e.exports=n()}(t,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var i in e)t.d(r,i,function(t){return e[t]}.bind(null,i));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=27)}([function(e,t){e.exports=n(41)},function(e,t,n){"use strict";e.exports=function(){var e=arguments,t=0,n=function(e,t,n,r){n||(n=" ");var i=e.length>=t?"":new Array(1+t-e.length>>>0).join(n);return r?e+i:i+e},r=function(e,t,r,i,A,o){var a=i-e.length;return a>0&&(e=r||!A?n(e,i,o,r):[e.slice(0,t.length),n("",a,"0",!0),e.slice(t.length)].join("")),e},i=function(e,t,i,A,o,a,s){var l=e>>>0;return e=(i=i&&l&&{2:"0b",8:"0",16:"0x"}[t]||"")+n(l.toString(t),a||0,"0",!1),r(e,i,A,o,s)},A=function(e,t,n,i,A,o){return null!==i&&void 0!==i&&(e=e.slice(0,i)),r(e,"",t,n,A,o)};return e[t++].replace(/%%|%(\d+\$)?([-+'#0 ]*)(\*\d+\$|\*|\d+)?(?:\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,function(o,a,s,l,c,u){var d,f,p,h,g;if("%%"===o)return"%";var m,v=!1,B="",w=!1,y=!1,b=" ",C=s.length;for(m=0;m-1?6:"d"===u?0:void 0,g=a?e[a.slice(0,-1)]:e[t++],u){case"s":return A(g+"",v,l,c,w,b);case"c":return A(String.fromCharCode(+g),v,l,c,w);case"b":return i(g,2,y,v,l,c,w);case"o":return i(g,8,y,v,l,c,w);case"x":return i(g,16,y,v,l,c,w);case"X":return i(g,16,y,v,l,c,w).toUpperCase();case"u":return i(g,10,y,v,l,c,w);case"i":case"d":return d=+g||0,g=(f=(d=Math.round(d-d%1))<0?"-":B)+n(String(Math.abs(d)),c,"0",!1),r(g,f,v,l,w);case"e":case"E":case"f":case"F":case"g":case"G":return f=(d=+g)<0?"-":B,p=["toExponential","toFixed","toPrecision"]["efg".indexOf(u.toLowerCase())],h=["toString","toUpperCase"]["eEfFgG".indexOf(u)%2],g=f+Math.abs(d)[p](c),r(g,f,v,l,w)[h]();default:return o}})}},function(e,t){e.exports=function(e){"use strict";return e.exports={VERSION:e.VERSION},e.exports.twig=function(t){var n=t.id,r={strict_variables:t.strict_variables||!1,autoescape:null!=t.autoescape&&t.autoescape||!1,allowInlineIncludes:t.allowInlineIncludes||!1,rethrow:t.rethrow||!1,namespaces:t.namespaces};if(e.cache&&n&&e.validateId(n),void 0!==t.debug&&(e.debug=t.debug),void 0!==t.trace&&(e.trace=t.trace),void 0!==t.data)return e.Templates.parsers.twig({data:t.data,path:t.hasOwnProperty("path")?t.path:void 0,module:t.module,id:n,options:r});if(void 0!==t.ref){if(void 0!==t.id)throw new e.Error("Both ref and id cannot be set on a twig.js template.");return e.Templates.load(t.ref)}if(void 0!==t.method){if(!e.Templates.isRegisteredLoader(t.method))throw new e.Error('Loader for "'+t.method+'" is not defined.');return e.Templates.loadRemote(t.name||t.href||t.path||n||void 0,{id:n,method:t.method,parser:t.parser||"twig",base:t.base,module:t.module,precompiled:t.precompiled,async:t.async,options:r},t.load,t.error)}return void 0!==t.href?e.Templates.loadRemote(t.href,{id:n,method:"ajax",parser:t.parser||"twig",base:t.base,module:t.module,precompiled:t.precompiled,async:t.async,options:r},t.load,t.error):void 0!==t.path?e.Templates.loadRemote(t.path,{id:n,method:"fs",parser:t.parser||"twig",base:t.base,module:t.module,precompiled:t.precompiled,async:t.async,options:r},t.load,t.error):void 0},e.exports.extendFilter=function(t,n){e.filter.extend(t,n)},e.exports.extendFunction=function(t,n){e._function.extend(t,n)},e.exports.extendTest=function(t,n){e.test.extend(t,n)},e.exports.extendTag=function(t){e.logic.extend(t)},e.exports.extend=function(t){t(e)},e.exports.compile=function(t,n){var r,i=n.filename,A=n.filename;return r=new e.Template({data:t,path:A,id:i,options:n.settings["twig options"]}),function(e){return r.render(e)}},e.exports.renderFile=function(t,n,r){"function"==typeof n&&(r=n,n={});var i=(n=n||{}).settings||{},A=i["twig options"],o={path:t,base:i.views,load:function(e){A&&A.allow_async?e.renderAsync(n).then(function(e){r(null,e)},r):r(null,""+e.render(n))}};if(A)for(var a in A)A.hasOwnProperty(a)&&(o[a]=A[a]);e.exports.twig(o)},e.exports.__express=e.exports.renderFile,e.exports.cache=function(t){e.cache=t},e.exports.path=e.path,e.exports.filters=e.filters,e.exports.Promise=e.Promise,e}},function(e,t){e.exports=function(e){"use strict";var t=1,n=2;return e.parseAsync=function(t,n){return e.parse.call(this,t,n,!0)},e.expression.parseAsync=function(t,n,r){return e.expression.parse.call(this,t,n,r,!0)},e.logic.parseAsync=function(t,n,r){return e.logic.parse.call(this,t,n,r,!0)},e.Template.prototype.renderAsync=function(e,t){return this.render(e,t,!0)},e.async={},e.isPromise=function(e){return e&&e.then&&"function"==typeof e.then},e.async.potentiallyAsync=function(t,n,r){return n?e.Promise.resolve(r.call(t)):function(t,n,r){var i=r.call(t),A=null,o=!0;if(!e.isPromise(i))return i;if(i.then(function(e){i=e,o=!1}).catch(function(e){A=e}),null!==A)throw A;if(o)throw new e.Error("You are using Twig.js in sync mode in combination with async extensions.");return i}(t,0,r)},e.Thenable=function(e,t,n){this.then=e,this._value=n?t:null,this._state=n||0},e.Thenable.prototype.catch=function(e){return this._state==t?this:this.then(null,e)},e.Thenable.resolvedThen=function(t){try{return e.Promise.resolve(t(this._value))}catch(t){return e.Promise.reject(t)}},e.Thenable.rejectedThen=function(t,n){if(!n||"function"!=typeof n)return this;var r=this._value,i=e.attempt(function(){return n(r)},e.Promise.reject);return e.Promise.resolve(i)},e.Promise=function(r){var i=0,A=null,o=function(e,t){i=e,A=t};return function(e,t,n){try{e(t,n)}catch(e){n(e)}}(r,function(e){o(t,e)},function(e){o(n,e)}),i===t?e.Promise.resolve(A):i===n?e.Promise.reject(A):(o=e.FullPromise()).promise},e.FullPromise=function(){function n(e){e(a._value)}function r(e,t){t(a._value)}function i(i,s){a._state||(a._value=s,a._state=i,o=i==t?n:r,A&&(-2===A[2]&&(o(A[0],A[1]),A=null),e.forEach(A,function(e){o(e[0],e[1])}),A=null))}var A=null,o=function(e,t){A=function(e,t,n){var r=[t,n,-2];return e?-2==e[2]?e=[e,r]:e.push(r):e=r,e}(A,e,t)},a=new e.Thenable(function(n,r){var i="function"==typeof n;if(a._state==t&&!i)return e.Promise.resolve(a._value);if(a._state===t)return e.attempt(function(){return e.Promise.resolve(n(a._value))},e.Promise.reject);var A="function"==typeof r;return e.Promise(function(t,a){o(i?function(r){e.attempt(function(){t(n(r))},a)}:t,A?function(n){e.attempt(function(){t(r(n))},a)}:a)})});return i.promise=a,i},e.Promise.defaultResolved=new e.Thenable(e.Thenable.resolvedThen,void 0,t),e.Promise.emptyStringResolved=new e.Thenable(e.Thenable.resolvedThen,"",t),e.Promise.resolve=function(n){return arguments.length<1||void 0===n?e.Promise.defaultResolved:e.isPromise(n)?n:""===n?e.Promise.emptyStringResolved:new e.Thenable(e.Thenable.resolvedThen,n,t)},e.Promise.reject=function(t){return new e.Thenable(e.Thenable.rejectedThen,t,n)},e.Promise.all=function(n){var r=new Array(n.length);return e.async.forEach(n,function(n,i){if(e.isPromise(n)){if(n._state!=t)return n.then(function(e){r[i]=e});r[i]=n._value}else r[i]=n}).then(function(){return r})},e.async.forEach=function(n,r){var i=n.length,A=0;return function o(){var a=null;do{if(A==i)return e.Promise.resolve();a=r(n[A],A),A++}while(!a||!e.isPromise(a)||a._state==t);return a.then(o)}()},e}},function(e,t){e.exports=function(e){"use strict";return e.tests={empty:function(e){if(null===e||void 0===e)return!0;if("number"==typeof e)return!1;if(e.length&&e.length>0)return!1;for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},odd:function(e){return e%2==1},even:function(e){return e%2==0},divisibleby:function(e,t){return e%t[0]==0},defined:function(e){return void 0!==e},none:function(e){return null===e},null:function(e){return this.none(e)},"same as":function(e,t){return e===t[0]},sameas:function(t,n){return console.warn("`sameas` is deprecated use `same as`"),e.tests["same as"](t,n)},iterable:function(t){return t&&(e.lib.is("Array",t)||e.lib.is("Object",t))}},e.test=function(t,n,r){if(!e.tests[t])throw"Test "+t+" is not defined.";return e.tests[t](n,r)},e.test.extend=function(t,n){e.tests[t]=n},e}},function(e,t,n){e.exports=function(e){"use strict";e.path={};var t=/.::/,r=/@/;return e.path.parsePath=function(n,i){var A=null,o=n.options.namespaces,a=i||"";if(o&&"object"==typeof o)for(A in o){if(t.test(a))return a=a.replace(A+"::",o[A]);if(r.test(a))return a=a.replace("@"+A,o[A])}return e.path.relativePath(n,a)},e.path.relativePath=function(t,r){var i,A,o,a="/",s=[];if(r=r||"",t.url)i=void 0!==t.base?t.base+("/"===t.base.charAt(t.base.length-1)?"":"/"):t.url;else if(t.path){var l=n(0),c=l.sep||a,u=new RegExp("^\\.{1,2}"+c.replace("\\","\\\\"));r=r.replace(/\//g,c),void 0!==t.base&&null==r.match(u)?(r=r.replace(t.base,""),i=t.base+c):i=l.normalize(t.path),i=i.replace(c+c,c),a=c}else{if(!t.name&&!t.id||!t.method||"fs"===t.method||"ajax"===t.method)throw new e.Error("Cannot extend an inline template.");i=t.base||t.name||t.id}for((A=i.split(a)).pop(),A=A.concat(r.split(a));A.length>0;)"."==(o=A.shift())||(".."==o&&s.length>0&&".."!=s[s.length-1]?s.pop():s.push(o));return s.join(a)},e}},function(e,t){e.exports=function(e){"use strict";e.Templates.registerParser("twig",function(t){return new e.Template(t)})}},function(e,t){e.exports=function(e){"use strict";e.Templates.registerParser("source",function(e){return e.data||""})}},function(e,t){e.exports=function(e){"use strict";for(e.logic={},e.logic.type={if_:"Twig.logic.type.if",endif:"Twig.logic.type.endif",for_:"Twig.logic.type.for",endfor:"Twig.logic.type.endfor",else_:"Twig.logic.type.else",elseif:"Twig.logic.type.elseif",set:"Twig.logic.type.set",setcapture:"Twig.logic.type.setcapture",endset:"Twig.logic.type.endset",filter:"Twig.logic.type.filter",endfilter:"Twig.logic.type.endfilter",shortblock:"Twig.logic.type.shortblock",block:"Twig.logic.type.block",endblock:"Twig.logic.type.endblock",extends_:"Twig.logic.type.extends",use:"Twig.logic.type.use",include:"Twig.logic.type.include",spaceless:"Twig.logic.type.spaceless",endspaceless:"Twig.logic.type.endspaceless",macro:"Twig.logic.type.macro",endmacro:"Twig.logic.type.endmacro",import_:"Twig.logic.type.import",from:"Twig.logic.type.from",embed:"Twig.logic.type.embed",endembed:"Twig.logic.type.endembed",with:"Twig.logic.type.with",endwith:"Twig.logic.type.endwith"},e.logic.definitions=[{type:e.logic.type.if_,regex:/^if\s+([\s\S]+)$/,next:[e.logic.type.else_,e.logic.type.elseif,e.logic.type.endif],
open:!0,compile:function(t){var n=t.match[1];return t.stack=e.expression.compile.call(this,{type:e.expression.type.expression,value:n}).stack,delete t.match,t},parse:function(t,n,r){var i=this;return e.expression.parseAsync.call(this,t.stack,n).then(function(A){return r=!0,e.lib.boolval(A)?(r=!1,e.parseAsync.call(i,t.output,n)):""}).then(function(e){return{chain:r,output:e}})}},{type:e.logic.type.elseif,regex:/^elseif\s+([^\s].*)$/,next:[e.logic.type.else_,e.logic.type.elseif,e.logic.type.endif],open:!1,compile:function(t){var n=t.match[1];return t.stack=e.expression.compile.call(this,{type:e.expression.type.expression,value:n}).stack,delete t.match,t},parse:function(t,n,r){var i=this;return e.expression.parseAsync.call(this,t.stack,n).then(function(A){return r&&e.lib.boolval(A)?(r=!1,e.parseAsync.call(i,t.output,n)):""}).then(function(e){return{chain:r,output:e}})}},{type:e.logic.type.else_,regex:/^else$/,next:[e.logic.type.endif,e.logic.type.endfor],open:!1,parse:function(t,n,r){var i=e.Promise.resolve("");return r&&(i=e.parseAsync.call(this,t.output,n)),i.then(function(e){return{chain:r,output:e}})}},{type:e.logic.type.endif,regex:/^endif$/,next:[],open:!1},{type:e.logic.type.for_,regex:/^for\s+([a-zA-Z0-9_,\s]+)\s+in\s+([\S\s]+?)(?:\s+if\s+([^\s].*))?$/,next:[e.logic.type.else_,e.logic.type.endfor],open:!0,compile:function(t){var n=t.match[1],r=t.match[2],i=t.match[3],A=null;if(t.key_var=null,t.value_var=null,n.indexOf(",")>=0){if(2!==(A=n.split(",")).length)throw new e.Error("Invalid expression in for loop: "+n);t.key_var=A[0].trim(),t.value_var=A[1].trim()}else t.value_var=n;return t.expression=e.expression.compile.call(this,{type:e.expression.type.expression,value:r}).stack,i&&(t.conditional=e.expression.compile.call(this,{type:e.expression.type.expression,value:i}).stack),delete t.match,t},parse:function(t,n,r){var i,A,o=[],a=0,s=this,l=t.conditional,c=function(r,A){var c=e.ChildContext(n);return c[t.value_var]=A,t.key_var&&(c[t.key_var]=r),c.loop=function(e,t){var r=void 0!==l;return{index:e+1,index0:e,revindex:r?void 0:t-e,revindex0:r?void 0:t-e-1,first:0===e,last:r?void 0:e===t-1,length:r?void 0:t,parent:n}}(a,i),(void 0===l?e.Promise.resolve(!0):e.expression.parseAsync.call(s,l,c)).then(function(n){if(n)return e.parseAsync.call(s,t.output,c).then(function(e){o.push(e),a+=1})}).then(function(){delete c.loop,delete c[t.value_var],delete c[t.key_var],e.merge(n,c,!0)})};return e.expression.parseAsync.call(this,t.expression,n).then(function(t){return e.lib.isArray(t)?(i=t.length,e.async.forEach(t,function(e){return c(a,e)})):e.lib.is("Object",t)?(A=void 0!==t._keys?t._keys:Object.keys(t),i=A.length,e.async.forEach(A,function(e){if("_keys"!==e)return c(e,t[e])})):void 0}).then(function(){return{chain:0===o.length,output:e.output.call(s,o)}})}},{type:e.logic.type.endfor,regex:/^endfor$/,next:[],open:!1},{type:e.logic.type.set,regex:/^set\s+([a-zA-Z0-9_,\s]+)\s*=\s*([\s\S]+)$/,next:[],open:!0,compile:function(t){var n=t.match[1].trim(),r=t.match[2],i=e.expression.compile.call(this,{type:e.expression.type.expression,value:r}).stack;return t.key=n,t.expression=i,delete t.match,t},parse:function(t,n,r){var i=t.key;return e.expression.parseAsync.call(this,t.expression,n).then(function(t){return t===n&&(t=e.lib.copy(t)),n[i]=t,{chain:r,context:n}})}},{type:e.logic.type.setcapture,regex:/^set\s+([a-zA-Z0-9_,\s]+)$/,next:[e.logic.type.endset],open:!0,compile:function(e){var t=e.match[1].trim();return e.key=t,delete e.match,e},parse:function(t,n,r){var i=this,A=t.key;return e.parseAsync.call(this,t.output,n).then(function(e){return i.context[A]=e,n[A]=e,{chain:r,context:n}})}},{type:e.logic.type.endset,regex:/^endset$/,next:[],open:!1},{type:e.logic.type.filter,regex:/^filter\s+(.+)$/,next:[e.logic.type.endfilter],open:!0,compile:function(t){var n="|"+t.match[1].trim();return t.stack=e.expression.compile.call(this,{type:e.expression.type.expression,value:n}).stack,delete t.match,t},parse:function(t,n,r){var i=this;return e.parseAsync.call(this,t.output,n).then(function(r){var A=[{type:e.expression.type.string,value:r}].concat(t.stack);return e.expression.parseAsync.call(i,A,n)}).then(function(e){return{chain:r,output:e}})}},{type:e.logic.type.endfilter,regex:/^endfilter$/,next:[],open:!1},{type:e.logic.type.block,regex:/^block\s+([a-zA-Z0-9_]+)$/,next:[e.logic.type.endblock],open:!0,compile:function(e){return e.block=e.match[1].trim(),delete e.match,e},parse:function(t,n,r){var i,A=this,o=e.Promise.resolve(),a=e.indexOf(this.importedBlocks,t.block)>-1,s=this.blocks[t.block]&&e.indexOf(this.blocks[t.block],e.placeholders.parent)>-1;return e.forEach(this.parseStack,function(n){n.type==e.logic.type.for_&&(t.overwrite=!0)}),(void 0===this.blocks[t.block]||a||s||t.overwrite)&&(o=(o=t.expression?e.expression.parseAsync.call(this,t.output,n).then(function(t){return e.expression.parseAsync.call(A,{type:e.expression.type.string,value:t},n)}):e.parseAsync.call(this,t.output,n).then(function(t){return e.expression.parseAsync.call(A,{type:e.expression.type.string,value:t},n)})).then(function(n){a&&A.importedBlocks.splice(A.importedBlocks.indexOf(t.block),1),A.blocks[t.block]=s?e.Markup(A.blocks[t.block].replace(e.placeholders.parent,n)):n,A.originalBlockTokens[t.block]={type:t.type,block:t.block,output:t.output,overwrite:!0}})),o.then(function(){return i=A.child.blocks[t.block]?A.child.blocks[t.block]:A.blocks[t.block],{chain:r,output:i}})}},{type:e.logic.type.shortblock,regex:/^block\s+([a-zA-Z0-9_]+)\s+(.+)$/,next:[],open:!0,compile:function(t){return t.expression=t.match[2].trim(),t.output=e.expression.compile({type:e.expression.type.expression,value:t.expression}).stack,t.block=t.match[1].trim(),delete t.match,t},parse:function(t,n,r){for(var i=new Array(arguments.length),A=arguments.length;A-- >0;)i[A]=arguments[A];return e.logic.handler[e.logic.type.block].parse.apply(this,i)}},{type:e.logic.type.endblock,regex:/^endblock(?:\s+([a-zA-Z0-9_]+))?$/,next:[],open:!1},{type:e.logic.type.extends_,regex:/^extends\s+(.+)$/,next:[],open:!0,compile:function(t){var n=t.match[1].trim();return delete t.match,t.stack=e.expression.compile.call(this,{type:e.expression.type.expression,value:n}).stack,t},parse:function(t,n,r){var i=this,A=e.ChildContext(n);return e.expression.parseAsync.call(this,t.stack,n).then(function(t){return i.extend=t,(t instanceof e.Template?t:i.importFile(t)).renderAsync(A)}).then(function(){return e.lib.extend(n,A),{chain:r,output:""}})}},{type:e.logic.type.use,regex:/^use\s+(.+)$/,next:[],open:!0,compile:function(t){var n=t.match[1].trim();return delete t.match,t.stack=e.expression.compile.call(this,{type:e.expression.type.expression,value:n}).stack,t},parse:function(t,n,r){var i=this;return e.expression.parseAsync.call(this,t.stack,n).then(function(e){return i.importBlocks(e),{chain:r,output:""}})}},{type:e.logic.type.include,regex:/^include\s+(.+?)(?:\s|$)(ignore missing(?:\s|$))?(?:with\s+([\S\s]+?))?(?:\s|$)(only)?$/,next:[],open:!0,compile:function(t){var n=t.match,r=n[1].trim(),i=void 0!==n[2],A=n[3],o=void 0!==n[4]&&n[4].length;return delete t.match,t.only=o,t.ignoreMissing=i,t.stack=e.expression.compile.call(this,{type:e.expression.type.expression,value:r}).stack,void 0!==A&&(t.withStack=e.expression.compile.call(this,{type:e.expression.type.expression,value:A.trim()}).stack),t},parse:function(t,n,r){var i=t.only?{}:e.ChildContext(n),A=t.ignoreMissing,o=this,a={chain:r,output:""};return(void 0!==t.withStack?e.expression.parseAsync.call(this,t.withStack,n).then(function(t){e.lib.extend(i,t)}):e.Promise.resolve()).then(function(){return e.expression.parseAsync.call(o,t.stack,n)}).then(function(t){if(t instanceof e.Template)return t.renderAsync(i);try{return o.importFile(t).renderAsync(i)}catch(e){if(A)return"";throw e}}).then(function(e){return""!==e&&(a.output=e),a})}},{type:e.logic.type.spaceless,regex:/^spaceless$/,next:[e.logic.type.endspaceless],open:!0,parse:function(t,n,r){return e.parseAsync.call(this,t.output,n).then(function(t){var n=t.replace(/>\s+<").trim();return n=e.Markup(n),{chain:r,output:n}})}},{type:e.logic.type.endspaceless,regex:/^endspaceless$/,next:[],open:!1},{type:e.logic.type.macro,regex:/^macro\s+([a-zA-Z0-9_]+)\s*\(\s*((?:[a-zA-Z0-9_]+(?:\s*=\s*([\s\S]+))?(?:,\s*)?)*)\s*\)$/,next:[e.logic.type.endmacro],open:!0,compile:function(t){var n=t.match[1],r=t.match[2].split(/\s*,\s*/),i=r.map(function(e){return e.split(/\s*=\s*/)[0]}),A=i.length;if(A>1)for(var o={},a=0;a0;)e.logic.extend(e.logic.definitions.shift());return e.logic.compile=function(t){var n=t.value.trim(),r=e.logic.tokenize.call(this,n),i=e.logic.handler[r.type];return i.compile&&(r=i.compile.call(this,r),e.log.trace("Twig.logic.compile: ","Compiled logic token to ",r)),r},e.logic.tokenize=function(t){var n=null,r=null,i=null,A=null,o=null,a=null,s=null;for(n in t=t.trim(),e.logic.handler)for(r=e.logic.handler[n].type,A=i=e.logic.handler[n].regex,e.lib.isArray(i)||(A=[i]),o=A.length,a=0;a9?-1:0)},Y:function(){return n.getFullYear()},y:function(){return r.Y().toString().slice(-2)},a:function(){return n.getHours()>11?"pm":"am"},A:function(){return r.a().toUpperCase()},B:function(){var e=3600*n.getUTCHours(),t=60*n.getUTCMinutes(),r=n.getUTCSeconds();return a(Math.floor((e+t+r+3600)/86.4)%1e3,3)},g:function(){return r.G()%12||12},G:function(){return n.getHours()},h:function(){return a(r.g(),2)},H:function(){return a(r.G(),2)},i:function(){return a(n.getMinutes(),2)},s:function(){return a(n.getSeconds(),2)},u:function(){return a(1e3*n.getMilliseconds(),6)},e:function(){throw new Error("Not supported (see source code of date() for timezone on how to add support)")},I:function(){return new Date(r.Y(),0)-Date.UTC(r.Y(),0)!=new Date(r.Y(),6)-Date.UTC(r.Y(),6)?1:0},O:function(){var e=n.getTimezoneOffset(),t=Math.abs(e);return(e>0?"-":"+")+a(100*Math.floor(t/60)+t%60,4)},P:function(){var e=r.O();return e.substr(0,3)+":"+e.substr(3,2)},T:function(){return"UTC"},Z:function(){return 60*-n.getTimezoneOffset()},c:function(){return"Y-m-d\\TH:i:sP".replace(A,o)},r:function(){return"D, d M Y H:i:s O".replace(A,o)},U:function(){return n/1e3|0}},function(e,t){return n=void 0===t?new Date:t instanceof Date?new Date(t):new Date(1e3*t),e.replace(A,o)}(e,t)}},function(e,t,n){"use strict";e.exports=function(e,t){function n(e){var t=e.split(" "),n=t[0],r=t[1].substring(0,3),i=/\d+/.test(n),A="ago"===t[2],o=("last"===n?-1:1)*(A?-1:1);if(i&&(o*=parseInt(n,10)),l.hasOwnProperty(r)&&!t[1].match(/^mon(day|\.)?$/i))return a["set"+l[r]](a["get"+l[r]]()+o);if("wee"===r)return a.setDate(a.getDate()+7*o);if("next"===n||"last"===n)!function(e,t,n){var r,i=s[t];void 0!==i&&(0==(r=i-a.getDay())?r=7*n:r>0&&"last"===e?r-=7:r<0&&"next"===e&&(r+=7),a.setDate(a.getDate()+r))}(n,r,o);else if(!i)return!1;return!0}var r,i,A,o,a,s,l,c,u,d,f;if(!e)return!1;e=e.replace(/^\s+|\s+$/g,"").replace(/\s{2,}/g," ").replace(/[\t\r\n]/g,"").toLowerCase();var p=new RegExp(["^(\\d{1,4})","([\\-\\.\\/:])","(\\d{1,2})","([\\-\\.\\/:])","(\\d{1,4})","(?:\\s(\\d{1,2}):(\\d{2})?:?(\\d{2})?)?","(?:\\s([A-Z]+)?)?$"].join(""));if((i=e.match(p))&&i[2]===i[4])if(i[1]>1901)switch(i[2]){case"-":return!(i[3]>12||i[5]>31)&&new Date(i[1],parseInt(i[3],10)-1,i[5],i[6]||0,i[7]||0,i[8]||0,i[9]||0)/1e3;case".":return!1;case"/":return!(i[3]>12||i[5]>31)&&new Date(i[1],parseInt(i[3],10)-1,i[5],i[6]||0,i[7]||0,i[8]||0,i[9]||0)/1e3}else if(i[5]>1901)switch(i[2]){case"-":case".":return!(i[3]>12||i[1]>31)&&new Date(i[5],parseInt(i[3],10)-1,i[1],i[6]||0,i[7]||0,i[8]||0,i[9]||0)/1e3;case"/":return!(i[1]>12||i[3]>31)&&new Date(i[5],parseInt(i[1],10)-1,i[3],i[6]||0,i[7]||0,i[8]||0,i[9]||0)/1e3}else switch(i[2]){case"-":return!(i[3]>12||i[5]>31||i[1]<70&&i[1]>38)&&(o=i[1]>=0&&i[1]<=38?+i[1]+2e3:i[1],new Date(o,parseInt(i[3],10)-1,i[5],i[6]||0,i[7]||0,i[8]||0,i[9]||0)/1e3);case".":return i[5]>=70?!(i[3]>12||i[1]>31)&&new Date(i[5],parseInt(i[3],10)-1,i[1],i[6]||0,i[7]||0,i[8]||0,i[9]||0)/1e3:i[5]<60&&!i[6]&&!(i[1]>23||i[3]>59)&&(A=new Date,new Date(A.getFullYear(),A.getMonth(),A.getDate(),i[1]||0,i[3]||0,i[5]||0,i[9]||0)/1e3);case"/":return!(i[1]>12||i[3]>31||i[5]<70&&i[5]>38)&&(o=i[5]>=0&&i[5]<=38?+i[5]+2e3:i[5],new Date(o,parseInt(i[1],10)-1,i[3],i[6]||0,i[7]||0,i[8]||0,i[9]||0)/1e3);case":":return!(i[1]>23||i[3]>59||i[5]>59)&&(A=new Date,new Date(A.getFullYear(),A.getMonth(),A.getDate(),i[1]||0,i[3]||0,i[5]||0)/1e3)}if("now"===e)return null===t||isNaN(t)?(new Date).getTime()/1e3|0:0|t;if(!isNaN(r=Date.parse(e)))return r/1e3|0;if(p=new RegExp(["^([0-9]{4}-[0-9]{2}-[0-9]{2})","[ t]","([0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?)","([\\+-][0-9]{2}(:[0-9]{2})?|z)"].join("")),(i=e.match(p))&&("z"===i[4]?i[4]="Z":i[4].match(/^([+-][0-9]{2})$/)&&(i[4]=i[4]+":00"),!isNaN(r=Date.parse(i[1]+"T"+i[2]+i[4]))))return r/1e3|0;if(a=t?new Date(1e3*t):new Date,s={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6},l={yea:"FullYear",mon:"Month",day:"Date",hou:"Hours",min:"Minutes",sec:"Seconds"},d="([+-]?\\d+\\s"+(u="(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)")+"|(last|next)\\s"+u+")(\\sago)?",!(i=e.match(new RegExp(d,"gi"))))return!1;for(f=0,c=i.length;f/g)||[]).join(""),e.replace(/|<\?(?:php)?[\s\S]*?\?>/gi,"").replace(/<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,function(e,n){return t.indexOf("<"+n.toLowerCase()+">")>-1?e:""})}},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};e.exports=function(){var e,t,n,i=0,A=arguments,o=A.length,a=function(e){if("[object Array]"===Object.prototype.toString.call(e))return e;var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t},s=function e(t,n){var i=0,A=0,o=0,s=0,l=0;if(t===n)return 0;if("object"===(void 0===t?"undefined":r(t))){if("object"===(void 0===n?"undefined":r(n))){if(t=a(t),n=a(n),l=t.length,(s=n.length)>l)return 1;if(s0?1:-1:n===t?0:n>t?1:-1};if(0===o)throw new Error("At least one value should be passed to min()");if(1===o){if("object"!==r(A[0]))throw new Error("Wrong parameter count for min()");if(0===(e=a(A[0])).length)throw new Error("Array must contain at least one element for min()")}else e=A;for(t=e[0],i=1,n=e.length;il)return 1;if(s0?1:-1:n===t?0:n>t?1:-1};if(0===o)throw new Error("At least one value should be passed to max()");if(1===o){if("object"!==r(A[0]))throw new Error("Wrong parameter count for max()");if(0===(e=a(A[0])).length)throw new Error("Array must contain at least one element for max()")}else e=A;for(t=e[0],i=1,n=e.length;i0|-(e<0)),i=Math.floor(e),A)switch(n){case"PHP_ROUND_HALF_DOWN":e=i+(o<0);break;case"PHP_ROUND_HALF_EVEN":e=i+i%2*o;break;case"PHP_ROUND_HALF_ODD":e=i+!(i%2);break;default:e=i+(o>0)}return(A?e:Math.round(e))/r}},function(e,t,n){"use strict";e.exports=function(e,t){return n(1).apply(this,[e].concat(t))}},function(e,t,n){e.exports=function(e){e.lib={},e.lib.sprintf=n(1),e.lib.vsprintf=n(19),e.lib.round=n(18),e.lib.max=n(17),e.lib.min=n(16),e.lib.strip_tags=n(15),e.lib.strtotime=n(14),e.lib.date=n(13),e.lib.boolval=n(12);var t=Object.prototype.toString;return e.lib.is=function(e,n){return void 0!==n&&null!==n&&("Array"===e&&Array.isArray?Array.isArray(n):t.call(n).slice(8,-1)===e)},e.lib.isArray=Array.isArray||function(e){return"Array"===t.call(e).slice(8,-1)},e.lib.copy=function(e){var t,n={};for(t in e)n[t]=e[t];return n},e.lib.extend=function(e,t){var n,r=Object.keys(t||{});for(n=r.length;n--;)e[r[n]]=t[r[n]];return e},e.lib.replaceAll=function(e,t,n){return e.split(t).join(n)},e.lib.chunkArray=function(t,n){var r=[],i=0,A=t.length;if(n<1||!e.lib.is("Array",t))return[];for(;ii)for(;r>=i;)A.push(a?String.fromCharCode(r):r),r-=o;else for(;r<=i;)A.push(a?String.fromCharCode(r):r),r+=o;return A},cycle:function(e,t){return e[t%e.length]},dump:function(){var e=arguments.length;for(args=new Array(e);e-- >0;)args[e]=arguments[e];var n=0,r="",i=function(e){for(var t="";e>0;)e--,t+=" ";return t},A=function(e){r+=i(n),"object"==typeof e?o(e):"function"==typeof e?r+="function()\n":"string"==typeof e?r+="string("+e.length+') "'+e+'"\n':"number"==typeof e?r+="number("+e+")\n":"boolean"==typeof e&&(r+="bool("+e+")\n")},o=function(e){var t;if(null===e)r+="NULL\n";else if(void 0===e)r+="undefined\n";else if("object"==typeof e){for(t in r+=i(n)+typeof e,n++,r+="("+function(e){var t,n=0;for(t in e)e.hasOwnProperty(t)&&n++;return n}(e)+") {\n",e)r+=i(n)+"["+t+"]=> \n",A(e[t]);r+=i(--n)+"}\n"}else A(e)};return 0==args.length&&args.push(this.context),t.forEach(args,function(e){o(e)}),r},date:function(e,n){var r;if(void 0===e||null===e||""===e)r=new Date;else if(t.lib.is("Date",e))r=e;else if(t.lib.is("String",e))r=e.match(/^[0-9]+$/)?new Date(1e3*e):new Date(1e3*t.lib.strtotime(e));else{if(!t.lib.is("Number",e))throw new t.Error("Unable to parse date "+e);r=new Date(1e3*e)}return r},block:function(e){return this.originalBlockTokens[e]?t.logic.parse.call(this,this.originalBlockTokens[e],this.context).output:this.blocks[e]},parent:function(){return t.placeholders.parent},attribute:function(e,n,r){return t.lib.is("Object",e)&&e.hasOwnProperty(n)?"function"==typeof e[n]?e[n].apply(void 0,r):e[n]:e[n]||void 0},max:function(e){return t.lib.is("Object",e)?(delete e._keys,t.lib.max(e)):t.lib.max.apply(null,arguments)},min:function(e){return t.lib.is("Object",e)?(delete e._keys,t.lib.min(e)):t.lib.min.apply(null,arguments)},template_from_string:function(e){return void 0===e&&(e=""),t.Templates.parsers.twig({options:this.options,data:e})},random:function(e){function n(e){var t=Math.floor(Math.random()*r),n=Math.min.call(null,0,e),i=Math.max.call(null,0,e);return n+Math.floor((i-n+1)*t/r)}var r=2147483648;if(t.lib.is("Number",e))return n(e);if(t.lib.is("String",e))return e.charAt(n(e.length-1));if(t.lib.is("Array",e))return e[n(e.length-1)];if(t.lib.is("Object",e)){var i=Object.keys(e);return e[i[n(i.length-1)]]}return n(r-1)},source:function(n,i){var A,o,a,s=!1;void 0!==e&&void 0!==e.exports&&"undefined"==typeof window?(o="fs",a=r+"/"+n):(o="ajax",a=n);var l={id:n,path:a,method:o,parser:"source",async:!1,fetchTemplateSource:!0};void 0===i&&(i=!1);try{void 0===(A=t.Templates.loadRemote(n,l))||null===A?A="":s=!0}catch(e){t.log.debug("Twig.functions.source: ","Problem loading template ",e)}return s||i?A:'Template "{name}" is not defined.'.replace("{name}",n)}},t._function=function(e,n,r){if(!t.functions[e])throw"Unable to find function "+e;return t.functions[e](n,r)},t._function.extend=function(e,n){t.functions[e]=n},t}},function(e,t){e.exports=function(e){function t(e,t){var n=Object.prototype.toString.call(t).slice(8,-1);return void 0!==t&&null!==t&&n===e}return e.filters={upper:function(e){return"string"!=typeof e?e:e.toUpperCase()},lower:function(e){return"string"!=typeof e?e:e.toLowerCase()},capitalize:function(e){return"string"!=typeof e?e:e.substr(0,1).toUpperCase()+e.toLowerCase().substr(1)},title:function(e){return"string"!=typeof e?e:e.toLowerCase().replace(/(^|\s)([a-z])/g,function(e,t,n){return t+n.toUpperCase()})},length:function(t){return e.lib.is("Array",t)||"string"==typeof t?t.length:e.lib.is("Object",t)?void 0===t._keys?Object.keys(t).length:t._keys.length:0},reverse:function(e){if(t("Array",e))return e.reverse();if(t("String",e))return e.split("").reverse().join("");if(t("Object",e)){var n=e._keys||Object.keys(e).reverse();return e._keys=n,e}},sort:function(e){if(t("Array",e))return e.sort();if(t("Object",e)){delete e._keys;var n=Object.keys(e).sort(function(t,n){var r;return e[t]>e[n]==!(e[t]<=e[n])?e[t]>e[n]?1:e[t]e[n].toString()?1:e[t]e[n]?1:e[t].toString()b1?1:r1)throw new e.Error("default filter expects one argument");return void 0===t||null===t||""===t?void 0===n?"":n[0]:t},json_encode:function(n){if(void 0===n||null===n)return"null";if("object"==typeof n&&t("Array",n))return i=[],e.forEach(n,function(t){i.push(e.filters.json_encode(t))}),"["+i.join(",")+"]";if("object"==typeof n&&t("Date",n))return'"'+n.toISOString()+'"';if("object"==typeof n){var r=n._keys||Object.keys(n),i=[];return e.forEach(r,function(t){i.push(JSON.stringify(t)+":"+e.filters.json_encode(n[t]))}),"{"+i.join(",")+"}"}return JSON.stringify(n)},merge:function(n,r){var i=[],A=0,o=[];if(t("Array",n)?e.forEach(r,function(e){t("Array",e)||(i={})}):i={},t("Array",i)||(i._keys=[]),t("Array",n)?e.forEach(n,function(e){i._keys&&i._keys.push(A),i[A]=e,A++}):(o=n._keys||Object.keys(n),e.forEach(o,function(e){i[e]=n[e],i._keys.push(e);var t=parseInt(e,10);!isNaN(t)&&t>=A&&(A=t+1)})),e.forEach(r,function(n){t("Array",n)?e.forEach(n,function(e){i._keys&&i._keys.push(A),i[A]=e,A++}):(o=n._keys||Object.keys(n),e.forEach(o,function(e){i[e]||i._keys.push(e),i[e]=n[e];var t=parseInt(e,10);!isNaN(t)&&t>=A&&(A=t+1)}))}),0===r.length)throw new e.Error("Filter merge expects at least one parameter");return i},date:function(t,n){var r=e.functions.date(t),i=n&&n.length?n[0]:"F j, Y H:i";return e.lib.date(i,r)},date_modify:function(t,n){if(void 0!==t&&null!==t){if(void 0===n||1!==n.length)throw new e.Error("date_modify filter expects 1 argument");var r,i=n[0];return e.lib.is("Date",t)&&(r=e.lib.strtotime(i,t.getTime()/1e3)),e.lib.is("String",t)&&(r=e.lib.strtotime(i,e.lib.strtotime(t))),e.lib.is("Number",t)&&(r=e.lib.strtotime(i,t)),new Date(1e3*r);
}},replace:function(t,n){if(void 0!==t&&null!==t){var r,i=n[0];for(r in i)i.hasOwnProperty(r)&&"_keys"!==r&&(t=e.lib.replaceAll(t,r,i[r]));return t}},format:function(t,n){if(void 0!==t&&null!==t)return e.lib.vsprintf(t,n)},striptags:function(t,n){if(void 0!==t&&null!==t)return e.lib.strip_tags(t,n)},escape:function(t,n){if(void 0!==t&&null!==t){var r="html";if(n&&n.length&&!0!==n[0]&&(r=n[0]),"html"==r){var i=t.toString().replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'");return e.Markup(i,"html")}if("js"==r){i=t.toString();for(var A="",o=0;o"]$/))A+=i[o].replace(/&/g,"&").replace(//g,">").replace(/"/g,""");else{var a;A+=(a=i.charCodeAt(o))<=31&&9!=a&&10!=a&&13!=a?"�":a<128?e.lib.sprintf("%02s;",a.toString(16).toUpperCase()):e.lib.sprintf("%04s;",a.toString(16).toUpperCase())}return e.Markup(A,"html_attr")}throw new e.Error("escape strategy unsupported")}},e:function(t,n){return e.filters.escape(t,n)},nl2br:function(t){if(void 0!==t&&null!==t){var n=" BACKSLASH_n_replace";return t=e.filters.escape(t).replace(/\r\n/g,n).replace(/\r/g,n).replace(/\n/g,n),t=e.lib.replaceAll(t,"BACKSLASH_n_replace","\n"),e.Markup(t)}},number_format:function(e,t){var n=e,r=t&&t[0]?t[0]:void 0,i=t&&void 0!==t[1]?t[1]:".",A=t&&void 0!==t[2]?t[2]:",";n=(n+"").replace(/[^0-9+\-Ee.]/g,"");var o=isFinite(+n)?+n:0,a=isFinite(+r)?Math.abs(r):0,s="";return(s=(a?function(e,t){var n=Math.pow(10,t);return""+Math.round(e*n)/n}(o,a):""+Math.round(o)).split("."))[0].length>3&&(s[0]=s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,A)),(s[1]||"").length=0;i--)if(-1===n.indexOf(r.charAt(i))){r=r.substring(0,i+1);break}return-1===n.indexOf(r.charAt(0))?r:""}},truncate:function(e,t){var n=30,r=!1,i="...";if(e+="",t&&(t[0]&&(n=t[0]),t[1]&&(r=t[1]),t[2]&&(i=t[2])),e.length>n){if(r&&-1===(n=e.indexOf(" ",n)))return e;e=e.substr(0,n)+i}return e},slice:function(t,n){if(void 0!==t&&null!==t){if(void 0===n||n.length<1)throw new e.Error("slice filter expects at least 1 argument");var r=n[0]||0,i=n.length>1?n[1]:t.length,A=r>=0?r:Math.max(t.length+r,0);if(e.lib.is("Array",t)){for(var o=[],a=A;a 2)throw new e.Error("split filter expects 1 or 2 argument");if(e.lib.is("String",t)){var r=n[0],i=n[1],A=t.split(r);if(void 0===i)return A;if(i<0)return t.split(r,A.length+i);var o=[];if(""==r)for(;A.length>0;){for(var a="",s=0;s0;s++)a+=A.shift();o.push(a)}else{for(s=0;s0;s++)o.push(A.shift());A.length>0&&o.push(A.join(r))}return o}throw new e.Error("split filter expects value to be a string")}},last:function(t){var n;return e.lib.is("Object",t)?t[(n=void 0===t._keys?Object.keys(t):t._keys)[n.length-1]]:t[t.length-1]},raw:function(t){return e.Markup(t)},batch:function(t,n){var r,i,A,o=n.shift(),a=n.shift();if(!e.lib.is("Array",t))throw new e.Error("batch filter expects items to be an array");if(!e.lib.is("Number",o))throw new e.Error("batch filter expects size to be a number");if(o=Math.ceil(o),r=e.lib.chunkArray(t,o),a&&t.length%o!=0){for(A=o-(i=r.pop()).length;A--;)i.push(a);r.push(i)}return r},round:function(t,n){var r=(n=n||[]).length>0?n[0]:0,i=n.length>1?n[1]:"common";if(t=parseFloat(t),r&&!e.lib.is("Number",r))throw new e.Error("round filter expects precision to be a number");if("common"===i)return e.lib.round(t,r);if(!e.lib.is("Function",Math[i]))throw new e.Error("round filter expects method to be 'floor', 'ceil', or 'common'");return Math[i](t*Math.pow(10,r))/Math.pow(10,r)}},e.filter=function(t,n,r){if(!e.filters[t])throw"Unable to find filter "+t;return e.filters[t].call(this,n,r)},e.filter.extend=function(t,n){e.filters[t]=n},e}},function(e,t){e.exports=function(e){"use strict";e.expression.operator={leftToRight:"leftToRight",rightToLeft:"rightToLeft"};var t=function(e,t){if(void 0===t||null===t)return null;if(void 0!==t.indexOf)return e===t||""!==e&&t.indexOf(e)>-1;var n;for(n in t)if(t.hasOwnProperty(n)&&t[n]===e)return!0;return!1};return e.expression.operator.lookup=function(t,n){switch(t){case"..":n.precidence=20,n.associativity=e.expression.operator.leftToRight;break;case",":n.precidence=18,n.associativity=e.expression.operator.leftToRight;break;case"?:":case"?":case":":n.precidence=16,n.associativity=e.expression.operator.rightToLeft;break;case"or":n.precidence=14,n.associativity=e.expression.operator.leftToRight;break;case"and":n.precidence=13,n.associativity=e.expression.operator.leftToRight;break;case"b-or":n.precidence=12,n.associativity=e.expression.operator.leftToRight;break;case"b-xor":n.precidence=11,n.associativity=e.expression.operator.leftToRight;break;case"b-and":n.precidence=10,n.associativity=e.expression.operator.leftToRight;break;case"==":case"!=":n.precidence=9,n.associativity=e.expression.operator.leftToRight;break;case"<":case"<=":case">":case">=":case"not in":case"in":n.precidence=8,n.associativity=e.expression.operator.leftToRight;break;case"~":case"+":case"-":n.precidence=6,n.associativity=e.expression.operator.leftToRight;break;case"//":case"**":case"*":case"/":case"%":n.precidence=5,n.associativity=e.expression.operator.leftToRight;break;case"not":n.precidence=3,n.associativity=e.expression.operator.rightToLeft;break;default:throw new e.Error("Failed to lookup operator: "+t+" is an unknown operator.")}return n.operator=t,n},e.expression.operator.parse=function(n,r){var i,A,o;switch(e.log.trace("Twig.expression.operator.parse: ","Handling ",n),"?"===n&&(o=r.pop()),A=r.pop(),"not"!==n&&(i=r.pop()),"in"!==n&&"not in"!==n&&(i&&Array.isArray(i)&&(i=i.length),A&&Array.isArray(A)&&(A=A.length)),n){case":":break;case"?:":e.lib.boolval(i)?r.push(i):r.push(A);break;case"?":void 0===i&&(i=A,A=o,o=void 0),e.lib.boolval(i)?r.push(A):r.push(o);break;case"+":A=parseFloat(A),i=parseFloat(i),r.push(i+A);break;case"-":A=parseFloat(A),i=parseFloat(i),r.push(i-A);break;case"*":A=parseFloat(A),i=parseFloat(i),r.push(i*A);break;case"/":A=parseFloat(A),i=parseFloat(i),r.push(i/A);break;case"//":A=parseFloat(A),i=parseFloat(i),r.push(Math.floor(i/A));break;case"%":A=parseFloat(A),i=parseFloat(i),r.push(i%A);break;case"~":r.push((null!=i?i.toString():"")+(null!=A?A.toString():""));break;case"not":case"!":r.push(!e.lib.boolval(A));break;case"<":r.push(i":r.push(i>A);break;case">=":r.push(i>=A);break;case"===":r.push(i===A);break;case"==":r.push(i==A);break;case"!==":r.push(i!==A);break;case"!=":r.push(i!=A);break;case"or":r.push(e.lib.boolval(i)||e.lib.boolval(A));break;case"b-or":r.push(i|A);break;case"b-xor":r.push(i^A);break;case"and":r.push(e.lib.boolval(i)&&e.lib.boolval(A));break;case"b-and":r.push(i&A);break;case"**":r.push(Math.pow(i,A));break;case"not in":r.push(!t(i,A));break;case"in":r.push(t(i,A));break;case"..":r.push(e.functions.range(i,A));break;default:throw new e.Error("Failed to parse operator: "+n+" is an unknown operator.")}},e}},function(e,t,n){e.exports=function(e){"use strict";function t(t,n,r){return n?e.expression.parseAsync.call(t,n,r):e.Promise.resolve(!1)}for((e.expression={},n(23)(e),e.expression.reservedWords=["true","false","null","TRUE","FALSE","NULL","_context","and","b-and","or","b-or","b-xor","in","not in","if"],e.expression.type={comma:"Twig.expression.type.comma",operator:{unary:"Twig.expression.type.operator.unary",binary:"Twig.expression.type.operator.binary"},string:"Twig.expression.type.string",bool:"Twig.expression.type.bool",slice:"Twig.expression.type.slice",array:{start:"Twig.expression.type.array.start",end:"Twig.expression.type.array.end"},object:{start:"Twig.expression.type.object.start",end:"Twig.expression.type.object.end"},parameter:{start:"Twig.expression.type.parameter.start",end:"Twig.expression.type.parameter.end"},subexpression:{start:"Twig.expression.type.subexpression.start",end:"Twig.expression.type.subexpression.end"},key:{period:"Twig.expression.type.key.period",brackets:"Twig.expression.type.key.brackets"},filter:"Twig.expression.type.filter",_function:"Twig.expression.type._function",variable:"Twig.expression.type.variable",number:"Twig.expression.type.number",_null:"Twig.expression.type.null",context:"Twig.expression.type.context",test:"Twig.expression.type.test"},e.expression.set={operations:[e.expression.type.filter,e.expression.type.operator.unary,e.expression.type.operator.binary,e.expression.type.array.end,e.expression.type.object.end,e.expression.type.parameter.end,e.expression.type.subexpression.end,e.expression.type.comma,e.expression.type.test],expressions:[e.expression.type._function,e.expression.type.bool,e.expression.type.string,e.expression.type.variable,e.expression.type.number,e.expression.type._null,e.expression.type.context,e.expression.type.parameter.start,e.expression.type.array.start,e.expression.type.object.start,e.expression.type.subexpression.start,e.expression.type.operator.unary]},e.expression.set.operations_extended=e.expression.set.operations.concat([e.expression.type.key.period,e.expression.type.key.brackets,e.expression.type.slice]),e.expression.fn={compile:{push:function(e,t,n){n.push(e)},push_both:function(e,t,n){n.push(e),t.push(e)}},parse:{push:function(e,t,n){t.push(e)},push_value:function(e,t,n){t.push(e.value)}}},e.expression.definitions=[{type:e.expression.type.test,regex:/^is\s+(not)?\s*([a-zA-Z_][a-zA-Z0-9_]*(\s?as)?)/,next:e.expression.set.operations.concat([e.expression.type.parameter.start]),compile:function(e,t,n){e.filter=e.match[2],e.modifier=e.match[1],delete e.match,delete e.value,n.push(e)},parse:function(n,r,i){var A=r.pop();return t(this,n.params,i).then(function(t){var i=e.test(n.filter,A,t);"not"==n.modifier?r.push(!i):r.push(i)})}},{type:e.expression.type.comma,regex:/^,/,next:e.expression.set.expressions.concat([e.expression.type.array.end,e.expression.type.object.end]),compile:function(t,n,r){var i,A=n.length-1;for(delete t.match,delete t.value;A>=0;A--){if((i=n.pop()).type===e.expression.type.object.start||i.type===e.expression.type.parameter.start||i.type===e.expression.type.array.start){n.push(i);break}r.push(i)}r.push(t)}},{type:e.expression.type.number,regex:/^\-?\d+(\.\d+)?/,next:e.expression.set.operations,compile:function(e,t,n){e.value=Number(e.value),n.push(e)},parse:e.expression.fn.parse.push_value},{type:e.expression.type.operator.binary,regex:/(^\?\:|^(b\-and)|^(b\-or)|^(b\-xor)|^[\+\-~%\?]|^[\:](?!\d\])|^[!=]==?|^[!<>]=?|^\*\*?|^\/\/?|^(and)[\(|\s+]|^(or)[\(|\s+]|^(in)[\(|\s+]|^(not in)[\(|\s+]|^\.\.)/,next:e.expression.set.expressions,transform:function(e,t){switch(e[0]){case"and(":case"or(":case"in(":case"not in(":return t[t.length-1].value=e[2],e[0];default:return""}},compile:function(t,n,r){delete t.match,t.value=t.value.trim();var i=t.value,A=e.expression.operator.lookup(i,t);for(e.log.trace("Twig.expression.compile: ","Operator: ",A," from ",i);n.length>0&&(n[n.length-1].type==e.expression.type.operator.unary||n[n.length-1].type==e.expression.type.operator.binary)&&(A.associativity===e.expression.operator.leftToRight&&A.precidence>=n[n.length-1].precidence||A.associativity===e.expression.operator.rightToLeft&&A.precidence>n[n.length-1].precidence);){var o=n.pop();r.push(o)}if(":"===i){if(!n[n.length-1]||"?"!==n[n.length-1].value){var a=r.pop();if(a.type===e.expression.type.string||a.type===e.expression.type.variable)t.key=a.value;else if(a.type===e.expression.type.number)t.key=a.value.toString();else{if(!a.expression||a.type!==e.expression.type.parameter.end&&a.type!=e.expression.type.subexpression.end)throw new e.Error("Unexpected value before ':' of "+a.type+" = "+a.value);t.params=a.params}return void r.push(t)}}else n.push(A)},parse:function(t,n,r){if(t.key)n.push(t);else{if(t.params)return e.expression.parseAsync.call(this,t.params,r).then(function(e){t.key=e,n.push(t),r.loop||delete t.params});e.expression.operator.parse(t.value,n)}}},{type:e.expression.type.operator.unary,regex:/(^not\s+)/,next:e.expression.set.expressions,compile:function(t,n,r){delete t.match,t.value=t.value.trim();var i=t.value,A=e.expression.operator.lookup(i,t);for(e.log.trace("Twig.expression.compile: ","Operator: ",A," from ",i);n.length>0&&(n[n.length-1].type==e.expression.type.operator.unary||n[n.length-1].type==e.expression.type.operator.binary)&&(A.associativity===e.expression.operator.leftToRight&&A.precidence>=n[n.length-1].precidence||A.associativity===e.expression.operator.rightToLeft&&A.precidence>n[n.length-1].precidence);){var o=n.pop();r.push(o)}n.push(A)},parse:function(t,n,r){e.expression.operator.parse(t.value,n)}},{type:e.expression.type.string,regex:/^(["'])(?:(?=(\\?))\2[\s\S])*?\1/,next:e.expression.set.operations_extended,compile:function(t,n,r){var i=t.value;delete t.match,i='"'===i.substring(0,1)?i.replace('\\"','"'):i.replace("\\'","'"),t.value=i.substring(1,i.length-1).replace(/\\n/g,"\n").replace(/\\r/g,"\r"),e.log.trace("Twig.expression.compile: ","String value: ",t.value),r.push(t)},parse:e.expression.fn.parse.push_value},{type:e.expression.type.subexpression.start,regex:/^\(/,next:e.expression.set.expressions.concat([e.expression.type.subexpression.end]),compile:function(e,t,n){e.value="(",n.push(e),t.push(e)},parse:e.expression.fn.parse.push},{type:e.expression.type.subexpression.end,regex:/^\)/,next:e.expression.set.operations_extended,validate:function(t,n){for(var r=n.length-1,i=!1,A=!1,o=0;!i&&r>=0;){var a=n[r];(i=a.type===e.expression.type.subexpression.start)&&A&&(A=!1,i=!1),a.type===e.expression.type.parameter.start?o++:a.type===e.expression.type.parameter.end?o--:a.type===e.expression.type.subexpression.end&&(A=!0),r--}return i&&0===o},compile:function(t,n,r){var i,A=t;for(i=n.pop();n.length>0&&i.type!=e.expression.type.subexpression.start;)r.push(i),i=n.pop();for(var o=[];t.type!==e.expression.type.subexpression.start;)o.unshift(t),t=r.pop();o.unshift(t),void 0===(i=n[n.length-1])||i.type!==e.expression.type._function&&i.type!==e.expression.type.filter&&i.type!==e.expression.type.test&&i.type!==e.expression.type.key.brackets?(A.expression=!0,o.pop(),o.shift(),A.params=o,r.push(A)):(A.expression=!1,i.params=o)},parse:function(t,n,r){if(t.expression)return e.expression.parseAsync.call(this,t.params,r).then(function(e){n.push(e)});throw new e.Error("Unexpected subexpression end when token is not marked as an expression")}},{type:e.expression.type.parameter.start,regex:/^\(/,next:e.expression.set.expressions.concat([e.expression.type.parameter.end]),validate:function(t,n){var r=n[n.length-1];return r&&e.indexOf(e.expression.reservedWords,r.value.trim())<0},compile:e.expression.fn.compile.push_both,parse:e.expression.fn.parse.push},{type:e.expression.type.parameter.end,regex:/^\)/,next:e.expression.set.operations_extended,compile:function(t,n,r){var i,A=t;for(i=n.pop();n.length>0&&i.type!=e.expression.type.parameter.start;)r.push(i),i=n.pop();for(var o=[];t.type!==e.expression.type.parameter.start;)o.unshift(t),t=r.pop();o.unshift(t),void 0===(t=r[r.length-1])||t.type!==e.expression.type._function&&t.type!==e.expression.type.filter&&t.type!==e.expression.type.test&&t.type!==e.expression.type.key.brackets?(A.expression=!0,o.pop(),o.shift(),A.params=o,r.push(A)):(A.expression=!1,t.params=o)},parse:function(t,n,r){var i=[],A=!1,o=null;if(t.expression)return e.expression.parseAsync.call(this,t.params,r).then(function(e){n.push(e)});for(;n.length>0;){if((o=n.pop())&&o.type&&o.type==e.expression.type.parameter.start){A=!0;break}i.unshift(o)}if(!A)throw new e.Error("Expected end of parameter set.");n.push(i)}},{type:e.expression.type.slice,regex:/^\[(\d*\:\d*)\]/,next:e.expression.set.operations_extended,compile:function(e,t,n){var r=e.match[1].split(":"),i=r[0]?parseInt(r[0]):void 0,A=r[1]?parseInt(r[1]):void 0;e.value="slice",e.params=[i,A],A||(e.params=[i]),n.push(e)},parse:function(t,n,r){var i=n.pop(),A=t.params;n.push(e.filter.call(this,t.value,i,A))}},{type:e.expression.type.array.start,regex:/^\[/,next:e.expression.set.expressions.concat([e.expression.type.array.end]),compile:e.expression.fn.compile.push_both,parse:e.expression.fn.parse.push},{type:e.expression.type.array.end,regex:/^\]/,next:e.expression.set.operations_extended,compile:function(t,n,r){for(var i,A=n.length-1;A>=0&&(i=n.pop()).type!==e.expression.type.array.start;A--)r.push(i);r.push(t)},parse:function(t,n,r){for(var i=[],A=!1,o=null;n.length>0;){if((o=n.pop()).type&&o.type==e.expression.type.array.start){A=!0;break}i.unshift(o)}if(!A)throw new e.Error("Expected end of array.");n.push(i)}},{type:e.expression.type.object.start,regex:/^\{/,next:e.expression.set.expressions.concat([e.expression.type.object.end]),compile:e.expression.fn.compile.push_both,parse:e.expression.fn.parse.push},{type:e.expression.type.object.end,regex:/^\}/,next:e.expression.set.operations_extended,compile:function(t,n,r){for(var i,A=n.length-1;A>=0&&(!(i=n.pop())||i.type!==e.expression.type.object.start);A--)r.push(i);r.push(t)},parse:function(t,n,r){for(var i={},A=!1,o=null,a=!1,s=null;n.length>0;){if((o=n.pop())&&o.type&&o.type===e.expression.type.object.start){A=!0;break}if(o&&o.type&&(o.type===e.expression.type.operator.binary||o.type===e.expression.type.operator.unary)&&o.key){if(!a)throw new e.Error("Missing value for key '"+o.key+"' in object definition.");i[o.key]=s,void 0===i._keys&&(i._keys=[]),i._keys.unshift(o.key),s=null,a=!1}else a=!0,s=o}if(!A)throw new e.Error("Unexpected end of object.");n.push(i)}},{type:e.expression.type.filter,regex:/^\|\s?([a-zA-Z_][a-zA-Z0-9_\-]*)/,next:e.expression.set.operations_extended.concat([e.expression.type.parameter.start]),compile:function(e,t,n){e.value=e.match[1],n.push(e)},parse:function(n,r,i){var A=this,o=r.pop();return t(this,n.params,i).then(function(t){return e.filter.call(A,n.value,o,t)}).then(function(e){r.push(e)})}},{type:e.expression.type._function,regex:/^([a-zA-Z_][a-zA-Z0-9_]*)\s*\(/,next:e.expression.type.parameter.start,validate:function(t,n){return t[1]&&e.indexOf(e.expression.reservedWords,t[1])<0},transform:function(e,t){return"("},compile:function(e,t,n){var r=e.match[1];e.fn=r,delete e.match,delete e.value,n.push(e)},parse:function(n,r,i){var A,o=this,a=n.fn;return t(this,n.params,i).then(function(t){if(e.functions[a])A=e.functions[a].apply(o,t);else{if("function"!=typeof i[a])throw new e.Error(a+" function does not exist and is not defined in the context");A=i[a].apply(i,t)}return A}).then(function(e){r.push(e)})}},{type:e.expression.type.variable,regex:/^[a-zA-Z_][a-zA-Z0-9_]*/,next:e.expression.set.operations_extended.concat([e.expression.type.parameter.start]),compile:e.expression.fn.compile.push,validate:function(t,n){return e.indexOf(e.expression.reservedWords,t[0])<0},parse:function(t,n,r){return e.expression.resolveAsync.call(this,r[t.value],r).then(function(e){n.push(e)})}},{type:e.expression.type.key.period,regex:/^\.([a-zA-Z0-9_]+)/,next:e.expression.set.operations_extended.concat([e.expression.type.parameter.start]),compile:function(e,t,n){e.key=e.match[1],delete e.match,delete e.value,n.push(e)},parse:function(n,r,i,A){var o,a=this,s=n.key,l=r.pop();return t(this,n.params,i).then(function(t){if(null===l||void 0===l){if(a.options.strict_variables)throw new e.Error("Can't access a key "+s+" on an null or undefined object.");o=void 0}else{var n=function(e){return e.substr(0,1).toUpperCase()+e.substr(1)};o="object"==typeof l&&s in l?l[s]:void 0!==l["get"+n(s)]?l["get"+n(s)]:void 0!==l["is"+n(s)]?l["is"+n(s)]:void 0}return e.expression.resolveAsync.call(a,o,i,t,A,l)}).then(function(e){r.push(e)})}},{type:e.expression.type.key.brackets,regex:/^\[([^\]\:]*)\]/,next:e.expression.set.operations_extended.concat([e.expression.type.parameter.start]),compile:function(t,n,r){var i=t.match[1];delete t.value,delete t.match,t.stack=e.expression.compile({value:i}).stack,r.push(t)},parse:function(n,r,i,A){var o,a,s=this,l=null;return t(this,n.params,i).then(function(t){return l=t,e.expression.parseAsync.call(s,n.stack,i)}).then(function(t){if(null===(o=r.pop())||void 0===o){if(s.options.strict_variables)throw new e.Error("Can't access a key "+t+" on an null or undefined object.");return null}return a="object"==typeof o&&t in o?o[t]:null,e.expression.resolveAsync.call(s,a,o,l,A)}).then(function(e){r.push(e)})}},{type:e.expression.type._null,regex:/^(null|NULL|none|NONE)/,next:e.expression.set.operations,compile:function(e,t,n){delete e.match,e.value=null,n.push(e)},parse:e.expression.fn.parse.push_value},{type:e.expression.type.context,regex:/^_context/,next:e.expression.set.operations_extended.concat([e.expression.type.parameter.start]),compile:e.expression.fn.compile.push,parse:function(e,t,n){t.push(n)}},{type:e.expression.type.bool,regex:/^(true|TRUE|false|FALSE)/,next:e.expression.set.operations,compile:function(e,t,n){e.value="true"===e.match[0].toLowerCase(),delete e.match,n.push(e)},parse:e.expression.fn.parse.push_value}],e.expression.resolveAsync=function(t,n,r,i,A){if("function"!=typeof t)return e.Promise.resolve(t);var o=e.Promise.resolve(r);return i&&i.type===e.expression.type.parameter.end&&(o=o.then(function(){return i.params&&e.expression.parseAsync.call(this,i.params,n,!0)}).then(function(e){return i.cleanup=!0,e})),o.then(function(e){return t.apply(A||n,e||[])})},e.expression.resolve=function(t,n,r,i,A){return e.async.potentiallyAsync(this,!1,function(){return e.expression.resolveAsync.call(this,t,n,r,i,A)})},e.expression.handler={},e.expression.extendType=function(t){e.expression.type[t]="Twig.expression.type."+t},e.expression.extend=function(t){if(!t.type)throw new e.Error("Unable to extend logic definition. No type provided for "+t);e.expression.handler[t.type]=t});e.expression.definitions.length>0;)e.expression.extend(e.expression.definitions.shift());return e.expression.tokenize=function(t){var n,r,i,A,o,a,s=[],l=0,c=null,u=[];for(a=function(){for(var t=arguments.length-2,r=new Array(t);t-- >0;)r[t]=arguments[t];if(e.log.trace("Twig.expression.tokenize","Matched a ",n," regular expression of ",r),c&&e.indexOf(c,n)<0)return u.push(n+" cannot follow a "+s[s.length-1].type+" at template:"+l+" near '"+r[0].substring(0,20)+"...'"),r[0];var i=e.expression.handler[n];return i.validate&&!i.validate(r,s)?r[0]:(u=[],s.push({type:n,value:r[0],match:r}),o=!0,c=A,l+=r[0].length,i.transform?i.transform(r,s):"")},e.log.debug("Twig.expression.tokenize","Tokenizing expression ",t);t.length>0;){for(n in t=t.trim(),e.expression.handler){if(A=e.expression.handler[n].next,r=e.expression.handler[n].regex,e.log.trace("Checking type ",n," on ",t),o=!1,e.lib.isArray(r))for(i=r.length;i-- >0;)t=t.replace(r[i],a);else t=t.replace(r,a);if(o)break}if(!o)throw u.length>0?new e.Error(u.join(" OR ")):new e.Error("Unable to parse '"+t+"' at template position"+l)}return e.log.trace("Twig.expression.tokenize","Tokenized to ",s),s},e.expression.compile=function(t){var n=t.value,r=e.expression.tokenize(n),i=null,A=[],o=[],a=null;for(e.log.trace("Twig.expression.compile: ","Compiling ",n);r.length>0;)i=r.shift(),a=e.expression.handler[i.type],e.log.trace("Twig.expression.compile: ","Compiling ",i),a.compile&&a.compile(i,o,A),e.log.trace("Twig.expression.compile: ","Stack is",o),e.log.trace("Twig.expression.compile: ","Output is",A);for(;o.length>0;)A.push(o.pop());return e.log.trace("Twig.expression.compile: ","Final output is",A),t.stack=A,delete t.value,t},e.expression.parse=function(t,n,r,i){var A=this;e.lib.isArray(t)||(t=[t]);var o=[],a=[],s=e.expression.type.operator.binary;return e.async.potentiallyAsync(this,i,function(){return e.async.forEach(t,function(r,i){var l,c=null,u=null;if(!r.cleanup)return t.length>i+1&&(u=t[i+1]),(c=e.expression.handler[r.type]).parse&&(l=c.parse.call(A,r,o,n,u)),r.type===s&&n.loop&&a.push(r),l}).then(function(){for(var e=a.length,t=null;e-- >0;)(t=a[e]).params&&t.key&&delete t.key;if(r){var n=o.splice(0);o.push(n)}return o.pop()})})},e}},function(e,t){e.exports=function(e){return e.compiler={module:{}},e.compiler.compile=function(t,n){var r,i=JSON.stringify(t.tokens),A=t.id;if(n.module){if(void 0===e.compiler.module[n.module])throw new e.Error("Unable to find module type "+n.module);r=e.compiler.module[n.module](A,i,n.twig)}else r=e.compiler.wrap(A,i);return r},e.compiler.module={amd:function(t,n,r){return'define(["'+r+'"], function (Twig) {\n\tvar twig, templates;\ntwig = Twig.twig;\ntemplates = '+e.compiler.wrap(t,n)+"\n\treturn templates;\n});"},node:function(t,n){return'var twig = require("twig").twig;\nexports.template = '+e.compiler.wrap(t,n)},cjs2:function(t,n,r){return'module.declare([{ twig: "'+r+'" }], function (require, exports, module) {\n\tvar twig = require("twig").twig;\n\texports.template = '+e.compiler.wrap(t,n)+"\n});"}},e.compiler.wrap=function(e,t){return'twig({id:"'+e.replace('"','\\"')+'", data:'+t+", precompiled: true});\n"},e}},function(e,t){e.exports=function(e){"use strict";function t(t,n){if(t.options.rethrow)throw"string"==typeof n&&(n=new e.Error(n)),"TwigException"!=n.type||n.file||(n.file=t.id),n;if(e.log.error("Error parsing twig template "+t.id+": "),n.stack?e.log.error(n.stack):e.log.error(n.toString()),e.debug)return n.toString()}return e.trace=!1,e.debug=!1,e.cache=!0,e.noop=function(){},e.placeholders={parent:"{{|PARENT|}}"},e.hasIndexOf=Array.prototype.hasOwnProperty("indexOf"),e.indexOf=function(t,n){if(e.hasIndexOf)return t.indexOf(n);if(void 0===t||null===t)throw new TypeError;var r=Object(t),i=r.length>>>0;if(0===i)return-1;var A=0;if(arguments.length>0&&((A=Number(arguments[1]))!=A?A=0:0!==A&&A!==1/0&&A!==-1/0&&(A=(A>0||-1)*Math.floor(Math.abs(A)))),A>=i)return-1;for(var o=A>=0?A:Math.max(i-Math.abs(A),0);o>>0;if("[object Function]"!={}.toString.call(t))throw new TypeError(t+" is not a function");for(n&&(r=n),i=0;i=0&&r.open.length!==r.close.length&&A<0||(i>=0&&(null===o.position||i=0&&null!==o.position&&i===o.position&&(r.open.length>o.def.open.length?(o.position=i,o.def=r,a=A):r.open.length===o.def.open.length&&(r.close.length,o.def.close.length,A>=0&&A=0))throw new e.Error("Unable to find closing bracket '"+n.close+"' opened near template position "+r);if(o=u,a=!0,n.type===e.token.type.comment)break;if(n.type===e.token.type.raw)break;for(A=e.token.strings.length,i=0;i 0&&f0;)if(i=e.token.findStart(t),e.log.trace("Twig.tokenize: ","Found token: ",i),null!==i.position){if(i.position>0&&n.push({type:e.token.type.raw,value:t.substring(0,i.position)}),t=t.substr(i.position+i.def.open.length),r+=i.position+i.def.open.length,A=e.token.findEnd(t,i.def,r),e.log.trace("Twig.tokenize: ","Token ends at ",A),n.push({type:i.def.type,value:t.substring(0,A).trim()}),"\n"===t.substr(A+i.def.close.length,1))switch(i.def.type){case"logic_whitespace_pre":case"logic_whitespace_post":case"logic_whitespace_both":case"logic":A+=1}t=t.substr(A+i.def.close.length),r+=A+i.def.close.length}else n.push({type:e.token.type.raw,value:t}),t="";return n},e.compile=function(t){var n=this;return e.attempt(function(){for(var r=[],i=[],A=[],o=null,a=null,s=null,l=null,c=null,u=null,d=null,f=null,p=null,h=null,g=null,m=null,v=function(t){e.expression.compile.call(n,t),i.length>0?A.push(t):r.push(t)},B=function(t){if(a=e.logic.compile.call(n,t),h=a.type,g=e.logic.handler[h].open,m=e.logic.handler[h].next,e.log.trace("Twig.compile: ","Compiled logic token to ",a," next is: ",m," open is : ",g),void 0!==g&&!g){if(l=i.pop(),d=e.logic.handler[l.type],e.indexOf(d.next,h)<0)throw new Error(h+" not expected after a "+l.type);l.output=l.output||[],l.output=l.output.concat(A),A=[],p={type:e.token.type.logic,token:l},i.length>0?A.push(p):r.push(p)}void 0!==m&&m.length>0?(e.log.trace("Twig.compile: ","Pushing ",a," to logic stack."),i.length>0&&((l=i.pop()).output=l.output||[],l.output=l.output.concat(A),i.push(l),A=[]),i.push(a)):void 0!==g&&g&&(p={type:e.token.type.logic,token:a},i.length>0?A.push(p):r.push(p));
};t.length>0;){switch(o=t.shift(),c=r[r.length-1],u=A[A.length-1],f=t[0],e.log.trace("Compiling token ",o),o.type){case e.token.type.raw:i.length>0?A.push(o):r.push(o);break;case e.token.type.logic:B.call(n,o);break;case e.token.type.comment:break;case e.token.type.output:v.call(n,o);break;case e.token.type.logic_whitespace_pre:case e.token.type.logic_whitespace_post:case e.token.type.logic_whitespace_both:case e.token.type.output_whitespace_pre:case e.token.type.output_whitespace_post:case e.token.type.output_whitespace_both:switch(o.type!==e.token.type.output_whitespace_post&&o.type!==e.token.type.logic_whitespace_post&&(c&&c.type===e.token.type.raw&&(r.pop(),null===c.value.match(/^\s*$/)&&(c.value=c.value.trim(),r.push(c))),u&&u.type===e.token.type.raw&&(A.pop(),null===u.value.match(/^\s*$/)&&(u.value=u.value.trim(),A.push(u)))),o.type){case e.token.type.output_whitespace_pre:case e.token.type.output_whitespace_post:case e.token.type.output_whitespace_both:v.call(n,o);break;case e.token.type.logic_whitespace_pre:case e.token.type.logic_whitespace_post:case e.token.type.logic_whitespace_both:B.call(n,o)}o.type!==e.token.type.output_whitespace_pre&&o.type!==e.token.type.logic_whitespace_pre&&f&&f.type===e.token.type.raw&&(t.shift(),null===f.value.match(/^\s*$/)&&(f.value=f.value.trim(),t.unshift(f)))}e.log.trace("Twig.compile: "," Output: ",r," Logic Stack: ",i," Pending Output: ",A)}if(i.length>0)throw s=i.pop(),new Error("Unable to find an end tag for "+s.type+", expecting one of "+s.next);return r},function(t){if(n.options.rethrow)throw"TwigException"!=t.type||t.file||(t.file=n.id),t;e.log.error("Error compiling twig template "+n.id+": "),t.stack?e.log.error(t.stack):e.log.error(t.toString())})},e.parse=function(n,r,i){function A(e){l.push(e)}function o(e){void 0!==e.chain&&(d=e.chain),void 0!==e.context&&(r=e.context),void 0!==e.output&&l.push(e.output)}var a,s=this,l=[],c=null,u=!0,d=!0;if(a=e.async.forEach(n,function(t){switch(e.log.debug("Twig.parse: ","Parsing token: ",t),t.type){case e.token.type.raw:l.push(e.filters.raw(t.value));break;case e.token.type.logic:return e.logic.parseAsync.call(s,t.token,r,d).then(o);case e.token.type.comment:break;case e.token.type.output_whitespace_pre:case e.token.type.output_whitespace_post:case e.token.type.output_whitespace_both:case e.token.type.output:return e.log.debug("Twig.parse: ","Output token: ",t.stack),e.expression.parseAsync.call(s,t.stack,r).then(A)}}).then(function(){return l=e.output.call(s,l),u=!1,l}).catch(function(e){i&&t(s,e),c=e}),i)return a;if(null!==c)return t(this,c);if(u)throw new e.Error("You are using Twig.js in sync mode in combination with async extensions.");return l},e.prepare=function(t){var n,r;return e.log.debug("Twig.prepare: ","Tokenizing ",t),r=e.tokenize.call(this,t),e.log.debug("Twig.prepare: ","Compiling ",r),n=e.compile.call(this,r),e.log.debug("Twig.prepare: ","Compiled ",n),n},e.output=function(t){var n=this.options.autoescape;if(!n)return t.join("");var r="string"==typeof n?n:"html",i=0,A=t.length,o="",a=new Array(A);for(i=0;i=0;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r=-1&&!i;A--){var o=A>=0?arguments[A]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(t=o+"/"+t,i="/"===o.charAt(0))}return t=n(r(t.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+t||"."},t.normalize=function(e){var i=t.isAbsolute(e),A="/"===o(e,-1);return e=n(r(e.split("/"),function(e){return!!e}),!i).join("/"),e||i||(e="."),e&&A&&(e+="/"),(i?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(r(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,n){function r(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=t.resolve(e).substr(1),n=t.resolve(n).substr(1);for(var i=r(e.split("/")),A=r(n.split("/")),o=Math.min(i.length,A.length),a=o,s=0;s95&&e<112||y.hasOwnProperty(e)&&(w[y[e]]=e)}return w}function h(e,t,n){return n||(n=p()[e]?"keydown":"keypress"),"keypress"==n&&t.length&&(n="keydown"),n}function g(e){return"+"===e?["+"]:(e=e.replace(/\+{2}/g,"+plus"),e.split("+"))}function m(e,t){var n,r,i,A=[];for(n=g(e),i=0;i1?void p(e,a,t,r):(o=m(e,r),g._callbacks[o.key]=g._callbacks[o.key]||[],n(o.key,o.modifiers,{type:o.action},i,e,A),void g._callbacks[o.key][i?"unshift":"push"]({callback:t,modifiers:o.modifiers,action:o.action,seq:i,level:A,combo:e}))}var g=this;if(e=e||A,!(g instanceof B))return new B(e);g.target=e,g._callbacks={},g._directMap={};var v,w={},y=!1,b=!1,C=!1;g._handleKey=function(e,i,A){var o,a=n(e,i,A),s={},l=0,c=!1;for(o=0;o":".","?":"/","|":"\\"},E={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},Q=1;Q<20;++Q)y[111+Q]="f"+Q;for(Q=0;Q<=9;++Q)y[Q+96]=Q.toString();B.prototype.bind=function(e,t,n){var r=this;return e=e instanceof Array?e:[e],r._bindMultiple.call(r,e,t,n),r},B.prototype.unbind=function(e,t){var n=this;return n.bind.call(n,e,function(){},t)},B.prototype.trigger=function(e,t){var n=this;return n._directMap[e+":"+t]&&n._directMap[e+":"+t]({},e),n},B.prototype.reset=function(){var e=this;return e._callbacks={},e._directMap={},e},B.prototype.stopCallback=function(e,t){var n=this;return!((" "+t.className+" ").indexOf(" mousetrap ")>-1)&&(!v(t,n.target)&&("INPUT"==t.tagName||"SELECT"==t.tagName||"TEXTAREA"==t.tagName||t.isContentEditable))},B.prototype.handleKey=function(){var e=this;return e._handleKey.apply(e,arguments)},B.addKeycodes=function(e){for(var t in e)e.hasOwnProperty(t)&&(y[t]=e[t]);w=null},B.init=function(){var e=B(A);for(var t in e)"_"!==t.charAt(0)&&(B[t]=function(t){return function(){return e[t].apply(e,arguments)}}(t))},B.init(),i.Mousetrap=B,"undefined"!=typeof e&&e.exports&&(e.exports=B),r=function(){return B}.call(t,n,t,e),!(r!==o&&(e.exports=r))}}("undefined"!=typeof window?window:null,"undefined"!=typeof window?document:null)},function(e,t){"use strict";e.exports=function(e,t,n){function r(e,t){return p&&(p=clearTimeout(p)),f=0,n.call(e,t)}function i(e){s=e.clientX,l=e.clientY}function A(e,n){return p&&(p=clearTimeout(p)),Math.abs(c-s)+Math.abs(u-l)n){var r=n/t.width,i=new Image;i.onload=function(){var n=document.createElement("canvas"),A=n.getContext("2d");n.width=t.width*r,n.height=t.height*r,A.drawImage(i,0,0,n.width,n.height),e.state.generatedImage=n.toDataURL(),B.remove(),d.setPreview(e.state.generatedImage)},i.src=t.toDataURL()}else e.state.generatedImage=t.toDataURL(),B.remove(),d.setPreview(e.state.generatedImage)}).catch(function(e){B.remove(),d.setPreview("https://via.placeholder.com/300x150/000000/FF0000?text=Generation%20Failed")})}var w=(0,l.button)("fred.fe.blueprints.create_blueprint","fred.fe.blueprints.create_blueprint",["fred--btn-panel","fred--btn-apply"],function(){f.default.emit("fred-loading",h.default.lng("fred.fe.blueprints.creating_blueprint")),(0,v.createBlueprint)(e.state.name,e.state.description,e.state.category,e.state.rank,e.state.public,[e.el.getContent()],e.state.generatedImage,e.state.image,!1).then(function(e){u.default.killNamespace("blueprints"),a.default.close(),f.default.emit("fred-loading-hide")}).catch(function(e){e.response&&e.response._fields&&(e.response._fields.name&&o.onError(e.response._fields.name),e.response._fields.category&&p.onError(e.response._fields.category),f.default.emit("fred-loading-hide"))})}),y=(0,l.button)("fred.fe.cancel","fred.fe.cancel",["fred--btn-panel"],function(){a.default.close()}),b=(0,l.div)(["fred--panel_button_wrapper"]);return b.appendChild(w),b.appendChild(y),n.appendChild(b),t.appendChild(n),t}}]),e}(),w=new B;t.default=w},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=Object.assign||function(e){for(var t=1;t4)&&[Number(t[1]),Number(t[2]),Number(t[3]),Number(t[4])]},f=function(e){return[Math.min(e[0],255),Math.min(e[1],255),Math.min(e[2],255),e.length>3?e[3]:null]},p=function(e){var t=g[e.toLowerCase()];return!!t&&t},h=function(){function e(t){n(this,e);var i=Array.isArray(t)?f(t):o(t)||c(t)||d(t)||p(t)||s(t)||[0,0,0,null],A=r(i,4),a=A[0],l=A[1],u=A[2],h=A[3];this.r=a,this.g=l,this.b=u,this.a=h}return i(e,[{key:"isTransparent",value:function(){return 0===this.a}},{key:"toString",value:function(){return null!==this.a&&1!==this.a?"rgba("+this.r+","+this.g+","+this.b+","+this.a+")":"rgb("+this.r+","+this.g+","+this.b+")"}}]),e}();t.default=h;var g={transparent:[0,0,0,0],aliceblue:[240,248,255,null],antiquewhite:[250,235,215,null],aqua:[0,255,255,null],aquamarine:[127,255,212,null],azure:[240,255,255,null],beige:[245,245,220,null],bisque:[255,228,196,null],black:[0,0,0,null],blanchedalmond:[255,235,205,null],blue:[0,0,255,null],blueviolet:[138,43,226,null],brown:[165,42,42,null],burlywood:[222,184,135,null],cadetblue:[95,158,160,null],chartreuse:[127,255,0,null],chocolate:[210,105,30,null],coral:[255,127,80,null],cornflowerblue:[100,149,237,null],cornsilk:[255,248,220,null],crimson:[220,20,60,null],cyan:[0,255,255,null],darkblue:[0,0,139,null],darkcyan:[0,139,139,null],darkgoldenrod:[184,134,11,null],darkgray:[169,169,169,null],darkgreen:[0,100,0,null],darkgrey:[169,169,169,null],darkkhaki:[189,183,107,null],darkmagenta:[139,0,139,null],darkolivegreen:[85,107,47,null],darkorange:[255,140,0,null],darkorchid:[153,50,204,null],darkred:[139,0,0,null],darksalmon:[233,150,122,null],darkseagreen:[143,188,143,null],darkslateblue:[72,61,139,null],darkslategray:[47,79,79,null],darkslategrey:[47,79,79,null],darkturquoise:[0,206,209,null],darkviolet:[148,0,211,null],deeppink:[255,20,147,null],deepskyblue:[0,191,255,null],dimgray:[105,105,105,null],dimgrey:[105,105,105,null],dodgerblue:[30,144,255,null],firebrick:[178,34,34,null],floralwhite:[255,250,240,null],forestgreen:[34,139,34,null],fuchsia:[255,0,255,null],gainsboro:[220,220,220,null],ghostwhite:[248,248,255,null],gold:[255,215,0,null],goldenrod:[218,165,32,null],gray:[128,128,128,null],green:[0,128,0,null],greenyellow:[173,255,47,null],grey:[128,128,128,null],honeydew:[240,255,240,null],hotpink:[255,105,180,null],indianred:[205,92,92,null],indigo:[75,0,130,null],ivory:[255,255,240,null],khaki:[240,230,140,null],lavender:[230,230,250,null],lavenderblush:[255,240,245,null],lawngreen:[124,252,0,null],lemonchiffon:[255,250,205,null],lightblue:[173,216,230,null],lightcoral:[240,128,128,null],lightcyan:[224,255,255,null],lightgoldenrodyellow:[250,250,210,null],lightgray:[211,211,211,null],lightgreen:[144,238,144,null],lightgrey:[211,211,211,null],lightpink:[255,182,193,null],lightsalmon:[255,160,122,null],lightseagreen:[32,178,170,null],lightskyblue:[135,206,250,null],lightslategray:[119,136,153,null],lightslategrey:[119,136,153,null],lightsteelblue:[176,196,222,null],lightyellow:[255,255,224,null],lime:[0,255,0,null],limegreen:[50,205,50,null],linen:[250,240,230,null],magenta:[255,0,255,null],maroon:[128,0,0,null],mediumaquamarine:[102,205,170,null],mediumblue:[0,0,205,null],mediumorchid:[186,85,211,null],mediumpurple:[147,112,219,null],mediumseagreen:[60,179,113,null],mediumslateblue:[123,104,238,null],mediumspringgreen:[0,250,154,null],mediumturquoise:[72,209,204,null],mediumvioletred:[199,21,133,null],midnightblue:[25,25,112,null],mintcream:[245,255,250,null],mistyrose:[255,228,225,null],moccasin:[255,228,181,null],navajowhite:[255,222,173,null],navy:[0,0,128,null],oldlace:[253,245,230,null],olive:[128,128,0,null],olivedrab:[107,142,35,null],orange:[255,165,0,null],orangered:[255,69,0,null],orchid:[218,112,214,null],palegoldenrod:[238,232,170,null],palegreen:[152,251,152,null],paleturquoise:[175,238,238,null],palevioletred:[219,112,147,null],papayawhip:[255,239,213,null],peachpuff:[255,218,185,null],peru:[205,133,63,null],pink:[255,192,203,null],plum:[221,160,221,null],powderblue:[176,224,230,null],purple:[128,0,128,null],rebeccapurple:[102,51,153,null],red:[255,0,0,null],rosybrown:[188,143,143,null],royalblue:[65,105,225,null],saddlebrown:[139,69,19,null],salmon:[250,128,114,null],sandybrown:[244,164,96,null],seagreen:[46,139,87,null],seashell:[255,245,238,null],sienna:[160,82,45,null],silver:[192,192,192,null],skyblue:[135,206,235,null],slateblue:[106,90,205,null],slategray:[112,128,144,null],slategrey:[112,128,144,null],snow:[255,250,250,null],springgreen:[0,255,127,null],steelblue:[70,130,180,null],tan:[210,180,140,null],teal:[0,128,128,null],thistle:[216,191,216,null],tomato:[255,99,71,null],turquoise:[64,224,208,null],violet:[238,130,238,null],wheat:[245,222,179,null],white:[255,255,255,null],whitesmoke:[245,245,245,null],yellow:[255,255,0,null],yellowgreen:[154,205,50,null]
};t.TRANSPARENT=new h([0,0,0,0])},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n0&&n.childNodes.push(l.default.fromTextNode(p,n));else if(p instanceof m.HTMLElement||p instanceof HTMLElement||m.parent&&p instanceof m.parent.HTMLElement){if(f.indexOf(p.nodeName)===-1){var v=new a.default(p,n,i,o++);if(v.isVisible()){"INPUT"===p.tagName?(0,c.inlineInputElement)(p,v):"TEXTAREA"===p.tagName?(0,c.inlineTextAreaElement)(p,v):"SELECT"===p.tagName?(0,c.inlineSelectElement)(p,v):v.style.listStyle&&v.style.listStyle.listStyleType!==d.LIST_STYLE_TYPE.NONE&&(0,u.inlineListItemElement)(p,v,i);var B="TEXTAREA"!==p.tagName,w=h(v,p);if(w||g(v)){var y=w||v.isPositioned()?r.getRealParentStackingContext():r,b=new A.default(v,y,w);y.contexts.push(b),B&&e(p,v,b,i,o)}else r.children.push(v),B&&e(p,v,r,i,o)}}}else if(p instanceof m.SVGSVGElement||p instanceof SVGSVGElement||m.parent&&p instanceof m.parent.SVGSVGElement){var C=new a.default(p,n,i,o++),E=h(C,p);if(E||g(C)){var Q=E||C.isPositioned()?r.getRealParentStackingContext():r,F=new A.default(C,Q,E);Q.contexts.push(F)}else r.children.push(C)}}},h=function(e,t){return e.isRootElement()||e.isPositionedWithZIndex()||e.style.opacity<1||e.isTransformed()||m(e,t)},g=function(e){return e.isPositioned()||e.isFloating()},m=function(e,t){return"BODY"===t.nodeName&&e.parent instanceof a.default&&e.parent.style.background.backgroundColor.isTransparent()}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var A=function(){function e(e,t){for(var n=0;n0&&this.style.visibility===U.VISIBILITY.VISIBLE}},{key:"isAbsolutelyPositioned",value:function(){return this.style.position!==b.POSITION.STATIC&&this.style.position!==b.POSITION.RELATIVE}},{key:"isPositioned",value:function(){return this.style.position!==b.POSITION.STATIC}},{key:"isFloating",value:function(){return this.style.float!==f.FLOAT.NONE}},{key:"isRootElement",value:function(){return null===this.parent}},{key:"isTransformed",value:function(){return null!==this.style.transform}},{key:"isPositionedWithZIndex",value:function(){return this.isPositioned()&&!this.style.zIndex.auto}},{key:"isInlineLevel",value:function(){return(0,s.contains)(this.style.display,d.DISPLAY.INLINE)||(0,s.contains)(this.style.display,d.DISPLAY.INLINE_BLOCK)||(0,s.contains)(this.style.display,d.DISPLAY.INLINE_FLEX)||(0,s.contains)(this.style.display,d.DISPLAY.INLINE_GRID)||(0,s.contains)(this.style.display,d.DISPLAY.INLINE_LIST_ITEM)||(0,s.contains)(this.style.display,d.DISPLAY.INLINE_TABLE)}},{key:"isInlineBlockOrInlineTable",value:function(){return(0,s.contains)(this.style.display,d.DISPLAY.INLINE_BLOCK)||(0,s.contains)(this.style.display,d.DISPLAY.INLINE_TABLE)}}]),e}();t.default=I;var N=function(e,t){if(e instanceof e.ownerDocument.defaultView.SVGSVGElement||e instanceof SVGSVGElement){var n=new XMLSerializer;return t.loadImage("data:image/svg+xml,"+encodeURIComponent(n.serializeToString(e)))}switch(e.tagName){case"IMG":var r=e;return t.loadImage(r.currentSrc||r.src);case"CANVAS":var i=e;return t.loadCanvas(i);case"IFRAME":var A=e.getAttribute("data-html2canvas-internal-iframe-key");if(A)return A}return null}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.contains=function(e,t){return 0!==(e&t)},t.distance=function(e,t){return Math.sqrt(e*e+t*t)},t.copyCSSStyles=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e.item(n);"content"!==r&&t.style.setProperty(r,e.getPropertyValue(r))}return t},t.SMALL_IMAGE="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.parseBackgroundImage=t.parseBackground=t.calculateBackgroundRepeatPath=t.calculateBackgroundPosition=t.calculateBackgroungPositioningArea=t.calculateBackgroungPaintingArea=t.calculateGradientBackgroundSize=t.calculateBackgroundSize=t.BACKGROUND_ORIGIN=t.BACKGROUND_CLIP=t.BACKGROUND_SIZE=t.BACKGROUND_REPEAT=void 0;var A=n(52),o=r(A),a=n(60),s=r(a),l=n(61),c=r(l),u=n(62),d=r(u),f=n(63),p=n(65),h=t.BACKGROUND_REPEAT={REPEAT:0,NO_REPEAT:1,REPEAT_X:2,REPEAT_Y:3},g=t.BACKGROUND_SIZE={AUTO:0,CONTAIN:1,COVER:2,LENGTH:3},m=t.BACKGROUND_CLIP={BORDER_BOX:0,PADDING_BOX:1,CONTENT_BOX:2},v=t.BACKGROUND_ORIGIN=m,B="auto",w=function e(t){switch(i(this,e),t){case"contain":this.size=g.CONTAIN;break;case"cover":this.size=g.COVER;break;case"auto":this.size=g.AUTO;break;default:this.value=new s.default(t)}},y=(t.calculateBackgroundSize=function(e,t,n){var r=0,i=0,A=e.size;if(A[0].size===g.CONTAIN||A[0].size===g.COVER){var o=n.width/n.height,a=t.width/t.height;return o0&&(e=i.substr(0,t).toLowerCase(),i=i.substr(t)),i=i.toLowerCase(),"none"!==i&&n.push({prefix:e,method:i,args:r})}r=[],i=o=""};return e.split("").forEach(function(e){if(0!==a||!t.test(e)){switch(e){case'"':A?A===e&&(A=null):A=e;break;case"(":if(A)break;if(0===a)return void(a=1);s++;break;case")":if(A)break;if(1===a){if(0===s)return a=0,void l();s--}break;case",":if(A)break;if(0===a)return void l();if(1===a&&0===s&&!i.match(/^url$/i))return r.push(o.trim()),void(o="")}0===a?i+=e:o+=e}}),l(),n}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.calculateLengthFromValueWithUnit=t.LENGTH_TYPE=void 0;var A=function(){function e(e,t){for(var n=0;n1&&(r/=y,i/=y,A/=y,o/=y,s/=y,l/=y,g/=y,m/=y);var b=e.width-A,C=e.height-l,E=e.width-s,Q=e.height-m;return{topLeftOuter:r>0||i>0?B(e.left,e.top,r,i,v.TOP_LEFT):new a.default(e.left,e.top),topLeftInner:r>0||i>0?B(e.left+t[f].borderWidth,e.top+t[c].borderWidth,Math.max(0,r-t[f].borderWidth),Math.max(0,i-t[c].borderWidth),v.TOP_LEFT):new a.default(e.left+t[f].borderWidth,e.top+t[c].borderWidth),topRightOuter:A>0||o>0?B(e.left+b,e.top,A,o,v.TOP_RIGHT):new a.default(e.left+e.width,e.top),topRightInner:A>0||o>0?B(e.left+Math.min(b,e.width+t[f].borderWidth),e.top+t[c].borderWidth,b>e.width+t[f].borderWidth?0:A-t[f].borderWidth,o-t[c].borderWidth,v.TOP_RIGHT):new a.default(e.left+e.width-t[u].borderWidth,e.top+t[c].borderWidth),bottomRightOuter:s>0||l>0?B(e.left+E,e.top+C,s,l,v.BOTTOM_RIGHT):new a.default(e.left+e.width,e.top+e.height),bottomRightInner:s>0||l>0?B(e.left+Math.min(E,e.width-t[f].borderWidth),e.top+Math.min(C,e.height+t[c].borderWidth),Math.max(0,s-t[u].borderWidth),l-t[d].borderWidth,v.BOTTOM_RIGHT):new a.default(e.left+e.width-t[u].borderWidth,e.top+e.height-t[d].borderWidth),bottomLeftOuter:g>0||m>0?B(e.left,e.top+Q,g,m,v.BOTTOM_LEFT):new a.default(e.left,e.top+e.height),bottomLeftInner:g>0||m>0?B(e.left+t[f].borderWidth,e.top+Q,Math.max(0,g-t[f].borderWidth),m-t[d].borderWidth,v.BOTTOM_LEFT):new a.default(e.left+t[f].borderWidth,e.top+e.height-t[d].borderWidth)}},{TOP_LEFT:0,TOP_RIGHT:1,BOTTOM_RIGHT:2,BOTTOM_LEFT:3}),B=function(e,t,n,r,i){var A=4*((Math.sqrt(2)-1)/3),o=n*A,s=r*A,c=e+n,u=t+r;switch(i){case v.TOP_LEFT:return new l.default(new a.default(e,u),new a.default(e,u-s),new a.default(c-o,t),new a.default(c,t));case v.TOP_RIGHT:return new l.default(new a.default(e,t),new a.default(e+o,t),new a.default(c,u-s),new a.default(c,u));case v.BOTTOM_RIGHT:return new l.default(new a.default(c,t),new a.default(c,t+s),new a.default(e+o,u),new a.default(e,u));case v.BOTTOM_LEFT:default:return new l.default(new a.default(c,u),new a.default(c-o,u),new a.default(e,t+s),new a.default(e,t))}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var A=function(){function e(e,t){for(var n=0;ne.height?(e.left+=(e.width-e.height)/2,e.width=e.height):e.width0&&i){var o=t.ownerDocument.createElement("html2canvaswrapper");(0,g.copyCSSStyles)(t.ownerDocument.defaultView.getComputedStyle(t,null),o),o.style.position="absolute",o.style.left=n.bounds.left+"px",o.style.top=n.bounds.top+"px",r||(o.style.whiteSpace="nowrap");var a=t.ownerDocument.createTextNode(e);o.appendChild(a),i.appendChild(o),n.childNodes.push(A.default.fromTextNode(a,n)),i.removeChild(o)}}),U=function(e){var t="password"===e.type?new Array(e.value.length+1).join("•"):e.value;return 0===t.length?e.placeholder||"":t}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t,n){return e.length>0?t+n.toUpperCase():e}Object.defineProperty(t,"__esModule",{value:!0});var A=function(){function e(e,t){for(var n=0;n0)if(s.default.SUPPORT_RANGE_BOUNDS)h.push(new c(v,d(n,g,v.length,f,p)));else{var B=n.splitText(v.length);h.push(new c(v,u(n,f,p))),n=B}else s.default.SUPPORT_RANGE_BOUNDS||(n=n.splitText(v.length));g+=v.length}return h},function(e,t,n){var r=e.ownerDocument.createElement("html2canvaswrapper");r.appendChild(e.cloneNode(!0));var i=e.parentNode;if(i){i.replaceChild(r,e);var o=(0,A.parseBounds)(r,t,n);return r.firstChild&&i.replaceChild(r.firstChild,r),o}return new A.Bounds(0,0,0,0)}),d=function(e,t,n,r,i){var o=e.ownerDocument.createRange();return o.setStart(e,t),o.setEnd(e,t+n),A.Bounds.fromClientRect(o.getBoundingClientRect(),r,i)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(88),i=function(e){var t=123;if(e.createRange){var n=e.createRange();if(n.getBoundingClientRect){var r=e.createElement("boundtest");r.style.height=t+"px",r.style.display="block",e.body.appendChild(r),n.selectNode(r);var i=n.getBoundingClientRect(),A=Math.round(i.height);if(e.body.removeChild(r),A===t)return!0}}return!1},A=function(e,t){var n=new Image,r=e.createElement("canvas"),i=r.getContext("2d");return new Promise(function(e){n.src=t;var A=function(){try{i.drawImage(n,0,0),r.toDataURL()}catch(t){return e(!1)}return e(!0)};n.onload=A,n.onerror=function(){return e(!1)},n.complete===!0&&setTimeout(function(){A()},500)})},o=function(){return"undefined"!=typeof(new Image).crossOrigin},a=function(){return"string"==typeof(new XMLHttpRequest).responseType},s=function(e){var t=new Image,n=e.createElement("canvas"),r=n.getContext("2d");t.src="data:image/svg+xml, ";try{r.drawImage(t,0,0),n.toDataURL()}catch(e){return!1}return!0},l=function(e){return 0===e[0]&&255===e[1]&&0===e[2]&&255===e[3]},c=function(e){var t=e.createElement("canvas"),n=100;t.width=n,t.height=n;var i=t.getContext("2d");i.fillStyle="rgb(0, 255, 0)",i.fillRect(0,0,n,n);var A=new Image,o=t.toDataURL();A.src=o;var a=(0,r.createForeignObjectSVG)(n,n,0,0,A);return i.fillStyle="red",i.fillRect(0,0,n,n),(0,r.loadSerializedSVG)(a).then(function(t){i.drawImage(t,0,0);var A=i.getImageData(0,0,n,n).data;i.fillStyle="red",i.fillRect(0,0,n,n);var a=e.createElement("div");return a.style.backgroundImage="url("+o+")",a.style.height=n+"px",l(A)?(0,r.loadSerializedSVG)((0,r.createForeignObjectSVG)(n,n,0,0,a)):Promise.reject(!1)}).then(function(e){return i.drawImage(e,0,0),l(i.getImageData(0,0,n,n).data)}).catch(function(e){return!1})},u={get SUPPORT_RANGE_BOUNDS(){var e=i(document);return Object.defineProperty(u,"SUPPORT_RANGE_BOUNDS",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=s(document);return Object.defineProperty(u,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_BASE64_DRAWING(){return function(e){var t=A(document,e);return Object.defineProperty(u,"SUPPORT_BASE64_DRAWING",{value:function(){return t}}),t}},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e="function"==typeof Array.from&&"function"==typeof window.fetch?c(document):Promise.resolve(!1);return Object.defineProperty(u,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=o();return Object.defineProperty(u,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=a();return Object.defineProperty(u,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){var e="withCredentials"in new XMLHttpRequest;return Object.defineProperty(u,"SUPPORT_CORS_XHR",{value:e}),e}};t.default=u},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n=55296&&i<=56319&&n>10)+55296,i%1024+56320)),(n+1===e||t.length>16384)&&(r+=String.fromCharCode.apply(String,t),t.length=0)}return r},"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),r="undefined"==typeof Uint8Array?[]:new Uint8Array(256),i=0;i>4,u[A++]=(15&a)<<4|s>>2,u[A++]=(3&s)<<6|63&l;return c},t.polyUint16Array=function(e){for(var t=e.length,n=[],r=0;r1&&void 0!==arguments[1]?arguments[1]:"strict",n=[],r=[],i=[];return e.forEach(function(e,A){var o=Ae.get(e);if(o>d?(i.push(!0),o-=d):i.push(!1),["normal","auto","loose"].indexOf(t)!==-1&&[8208,8211,12316,12448].indexOf(e)!==-1)return r.push(A),n.push(_);if(o===g||o===C){if(0===A)return r.push(A),n.push(R);var a=n[A-1];return ce.indexOf(a)===-1?(r.push(r[A-1]),n.push(a)):(r.push(A),n.push(R))}return r.push(A),o===z?n.push("strict"===t?k:J):o===ee?n.push(R):o===K?n.push(R):o===te?e>=131072&&e<=196605||e>=196608&&e<=262141?n.push(J):n.push(R):void n.push(o)}),[r,n,i]},pe=function(e,t,n,r){var i=r[n];if(Array.isArray(e)?e.indexOf(i)!==-1:e===i)for(var A=n;A<=r.length;){A++;var o=r[A];if(o===t)return!0;if(o!==b)break}if(i===b)for(var a=n;a>0;){a--;var s=r[a];if(Array.isArray(e)?e.indexOf(s)!==-1:e===s)for(var l=n;l<=r.length;){l++;var c=r[l];if(c===t)return!0;if(c!==b)break}if(s!==b)break}return!1},he=function(e,t){for(var n=e;n>=0;){var r=t[n];if(r!==b)return r;n--}return 0},ge=function(e,t,n,r,i){if(0===n[r])return re;var A=r-1;if(Array.isArray(i)&&i[A]===!0)return re;var o=A-1,a=A+1,s=t[A],l=o>=0?t[o]:0,c=t[a];if(s===p&&c===h)return re;if(ae.indexOf(s)!==-1)return ne;if(ae.indexOf(c)!==-1)return re;if(se.indexOf(c)!==-1)return re;if(he(A,t)===w)return ie;if(Ae.get(e[A])===C&&(c===J||c===j||c===V))return re;if(s===B||c===B)return re;if(s===y)return re;if([b,Q,U].indexOf(s)===-1&&c===y)return re;if([H,T,S,L,P].indexOf(c)!==-1)return re;if(he(A,t)===I)return re;if(pe(N,I,A,t))return re;if(pe([H,T],k,A,t))return re;if(pe(E,E,A,t))return re;if(s===b)return ie;if(s===N||c===N)return re;if(c===_||s===_)return ie;if([Q,U,k].indexOf(c)!==-1||s===F)return re;if(l===Y&&de.indexOf(s)!==-1)return re;if(s===P&&c===Y)return re;if(c===x&&oe.concat(x,S,O,J,j,V).indexOf(s)!==-1)return re;if(oe.indexOf(c)!==-1&&s===O||oe.indexOf(s)!==-1&&c===O)return re;if(s===M&&[J,j,V].indexOf(c)!==-1||[J,j,V].indexOf(s)!==-1&&c===D)return re;if(oe.indexOf(s)!==-1&&le.indexOf(c)!==-1||le.indexOf(s)!==-1&&oe.indexOf(c)!==-1)return re;if([M,D].indexOf(s)!==-1&&(c===O||[I,U].indexOf(c)!==-1&&t[a+1]===O)||[I,U].indexOf(s)!==-1&&c===O||s===O&&[O,P,L].indexOf(c)!==-1)return re;if([O,P,L,H,T].indexOf(c)!==-1)for(var u=A;u>=0;){var d=t[u];if(d===O)return re;if([P,L].indexOf(d)===-1)break;u--}if([M,D].indexOf(c)!==-1)for(var f=[H,T].indexOf(s)!==-1?o:A;f>=0;){var g=t[f];if(g===O)return re;if([P,L].indexOf(g)===-1)break;f--}if(W===s&&[W,q,X,G].indexOf(c)!==-1||[q,X].indexOf(s)!==-1&&[q,Z].indexOf(c)!==-1||[Z,G].indexOf(s)!==-1&&c===Z)return re;if(ue.indexOf(s)!==-1&&[x,D].indexOf(c)!==-1||ue.indexOf(c)!==-1&&s===M)return re;if(oe.indexOf(s)!==-1&&oe.indexOf(c)!==-1)return re;if(s===L&&oe.indexOf(c)!==-1)return re;if(oe.concat(O).indexOf(s)!==-1&&c===I||oe.concat(O).indexOf(c)!==-1&&s===T)return re;if(s===$&&c===$){for(var m=n[A],v=1;m>0&&(m--,t[m]===$);)v++;if(v%2!==0)return re}return s===j&&c===V?re:ie},me=(t.lineBreakAtIndex=function(e,t){if(0===t)return re;if(t>=e.length)return ne;var n=fe(e),r=a(n,2),i=r[0],A=r[1];return ge(e,A,i,t)},function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var n=fe(e,t.lineBreak),r=a(n,3),i=r[0],A=r[1],o=r[2];"break-all"!==t.wordBreak&&"break-word"!==t.wordBreak||(A=A.map(function(e){return[O,R,ee].indexOf(e)!==-1?J:e}));var s="keep-all"===t.wordBreak?o.map(function(t,n){return t&&e[n]>=19968&&e[n]<=40959}):null;return[i,A,s]}),ve=(t.inlineBreakOpportunities=function(e,t){var n=(0,u.toCodePoints)(e),r=re,i=me(n,t),A=a(i,3),o=A[0],s=A[1],l=A[2];return n.forEach(function(e,t){r+=(0,u.fromCodePoint)(e)+(t>=n.length-1?ne:ge(n,s,o,t+1,l))}),r},function(){function e(t,n,r,i){A(this,e),this._codePoints=t,this.required=n===ne,this.start=r,this.end=i}return o(e,[{key:"slice",value:function(){return u.fromCodePoint.apply(void 0,i(this._codePoints.slice(this.start,this.end)))}}]),e}());t.LineBreaker=function(e,t){var n=(0,u.toCodePoints)(e),r=me(n,t),i=a(r,3),A=i[0],o=i[1],s=i[2],l=n.length,c=0,d=0;return{next:function(){if(d>=l)return{done:!0};for(var e=re;d>o,u=t.UTRIE2_DATA_BLOCK_LENGTH=1<>o,p=t.UTRIE2_INDEX_2_BMP_LENGTH=c+f,h=t.UTRIE2_UTF8_2B_INDEX_2_OFFSET=p,g=t.UTRIE2_UTF8_2B_INDEX_2_LENGTH=32,m=t.UTRIE2_INDEX_1_OFFSET=h+g,v=t.UTRIE2_OMITTED_BMP_INDEX_1_LENGTH=65536>>a,B=t.UTRIE2_INDEX_2_BLOCK_LENGTH=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>o],t=(t<>o)],t=(t<>a),t=this.index[t],t+=e>>o&w,t=this.index[t],t=(t<n?T(e,i,A.length>0):r.integers.reduce(function(t,n,i){for(;e>=n;)e-=n,t+=r.values[i];return t},"")+A},v=function(e,t,n,r){var i="";do n||e--,i=r(e)+i,e/=t;while(e*t>=t);return i},B=function(e,t,n,r,i){var A=n-t+1;return(e<0?"-":"")+(v(Math.abs(e),A,r,function(e){return(0,c.fromCodePoint)(Math.floor(e%A)+t)})+i)},w=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:". ",r=t.length;return v(Math.abs(e),r,!1,function(e){return t[Math.floor(e%r)]})+n},y=1,b=2,C=4,E=8,Q=function(e,t,n,r,A,o){if(e<-9999||e>9999)return T(e,l.LIST_STYLE_TYPE.CJK_DECIMAL,A.length>0);var a=Math.abs(e),s=A;if(0===a)return t[0]+s;for(var c=0;a>0&&c<=4;c++){var u=a%10;0===u&&(0,i.contains)(o,y)&&""!==s?s=t[u]+s:u>1||1===u&&0===c||1===u&&1===c&&(0,i.contains)(o,b)||1===u&&1===c&&(0,i.contains)(o,C)&&e>100||1===u&&c>1&&(0,i.contains)(o,E)?s=t[u]+(c>0?n[c-1]:"")+s:1===u&&c>0&&(s=n[c-1]+s),a=Math.floor(a/10)}return(e<0?r:"")+s},F="十百千萬",U="拾佰仟萬",_="マイナス",H="마이너스 ",T=t.createCounterText=function(e,t,n){var r=n?". ":"",i=n?"、":"",A=n?", ":"";switch(t){case l.LIST_STYLE_TYPE.DISC:return"•";case l.LIST_STYLE_TYPE.CIRCLE:return"◦";case l.LIST_STYLE_TYPE.SQUARE:return"◾";case l.LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO:var o=B(e,48,57,!0,r);return o.length<4?"0"+o:o;case l.LIST_STYLE_TYPE.CJK_DECIMAL:return w(e,"〇一二三四五六七八九",i);case l.LIST_STYLE_TYPE.LOWER_ROMAN:return m(e,1,3999,f,l.LIST_STYLE_TYPE.DECIMAL,r).toLowerCase();case l.LIST_STYLE_TYPE.UPPER_ROMAN:return m(e,1,3999,f,l.LIST_STYLE_TYPE.DECIMAL,r);case l.LIST_STYLE_TYPE.LOWER_GREEK:return B(e,945,969,!1,r);case l.LIST_STYLE_TYPE.LOWER_ALPHA:return B(e,97,122,!1,r);case l.LIST_STYLE_TYPE.UPPER_ALPHA:return B(e,65,90,!1,r);case l.LIST_STYLE_TYPE.ARABIC_INDIC:return B(e,1632,1641,!0,r);case l.LIST_STYLE_TYPE.ARMENIAN:case l.LIST_STYLE_TYPE.UPPER_ARMENIAN:return m(e,1,9999,p,l.LIST_STYLE_TYPE.DECIMAL,r);case l.LIST_STYLE_TYPE.LOWER_ARMENIAN:return m(e,1,9999,p,l.LIST_STYLE_TYPE.DECIMAL,r).toLowerCase();case l.LIST_STYLE_TYPE.BENGALI:return B(e,2534,2543,!0,r);case l.LIST_STYLE_TYPE.CAMBODIAN:case l.LIST_STYLE_TYPE.KHMER:return B(e,6112,6121,!0,r);case l.LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH:return w(e,"子丑寅卯辰巳午未申酉戌亥",i);case l.LIST_STYLE_TYPE.CJK_HEAVENLY_STEM:return w(e,"甲乙丙丁戊己庚辛壬癸",i);case l.LIST_STYLE_TYPE.CJK_IDEOGRAPHIC:case l.LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL:return Q(e,"零一二三四五六七八九",F,"負",i,b|C|E);case l.LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL:return Q(e,"零壹貳參肆伍陸柒捌玖",U,"負",i,y|b|C|E);case l.LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL:return Q(e,"零一二三四五六七八九",F,"负",i,b|C|E);case l.LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL:return Q(e,"零壹贰叁肆伍陆柒捌玖",U,"负",i,y|b|C|E);case l.LIST_STYLE_TYPE.JAPANESE_INFORMAL:return Q(e,"〇一二三四五六七八九","十百千万",_,i,0);case l.LIST_STYLE_TYPE.JAPANESE_FORMAL:return Q(e,"零壱弐参四伍六七八九","拾百千万",_,i,y|b|C);case l.LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL:return Q(e,"영일이삼사오육칠팔구","십백천만",H,A,y|b|C);case l.LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL:return Q(e,"零一二三四五六七八九","十百千萬",H,A,0);case l.LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL:return Q(e,"零壹貳參四五六七八九","拾百千",H,A,y|b|C);case l.LIST_STYLE_TYPE.DEVANAGARI:return B(e,2406,2415,!0,r);case l.LIST_STYLE_TYPE.GEORGIAN:return m(e,1,19999,g,l.LIST_STYLE_TYPE.DECIMAL,r);case l.LIST_STYLE_TYPE.GUJARATI:return B(e,2790,2799,!0,r);case l.LIST_STYLE_TYPE.GURMUKHI:return B(e,2662,2671,!0,r);case l.LIST_STYLE_TYPE.HEBREW:return m(e,1,10999,h,l.LIST_STYLE_TYPE.DECIMAL,r);case l.LIST_STYLE_TYPE.HIRAGANA:return w(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case l.LIST_STYLE_TYPE.HIRAGANA_IROHA:return w(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case l.LIST_STYLE_TYPE.KANNADA:return B(e,3302,3311,!0,r);case l.LIST_STYLE_TYPE.KATAKANA:return w(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case l.LIST_STYLE_TYPE.KATAKANA_IROHA:return w(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case l.LIST_STYLE_TYPE.LAO:return B(e,3792,3801,!0,r);case l.LIST_STYLE_TYPE.MONGOLIAN:return B(e,6160,6169,!0,r);case l.LIST_STYLE_TYPE.MYANMAR:return B(e,4160,4169,!0,r);case l.LIST_STYLE_TYPE.ORIYA:return B(e,2918,2927,!0,r);case l.LIST_STYLE_TYPE.PERSIAN:return B(e,1776,1785,!0,r);case l.LIST_STYLE_TYPE.TAMIL:return B(e,3046,3055,!0,r);case l.LIST_STYLE_TYPE.TELUGU:return B(e,3174,3183,!0,r);case l.LIST_STYLE_TYPE.THAI:return B(e,3664,3673,!0,r);case l.LIST_STYLE_TYPE.TIBETAN:return B(e,3872,3881,!0,r);case l.LIST_STYLE_TYPE.DECIMAL:default:return B(e,48,57,!0,r)}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var A=function(){function e(e,t){var n=[],r=!0,i=!1,A=void 0;try{for(var o,a=e[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,A=e}finally{try{!r&&a.return&&a.return()}finally{if(i)throw A}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function e(e,t){for(var n=0;n0?n.width:r.width,A="number"==typeof n.height&&n.height>0?n.height:r.height;i>0&&A>0&&t.target.clip([(0,a.calculatePaddingBoxPath)(e.curvedBounds)],function(){t.target.drawImage(n,new a.Bounds(0,0,i,A),r)})}}},r=e.getClipPaths();r.length?this.target.clip(r,n):n()}},{key:"renderNodeBackgroundAndBorders",value:function(e){var t=this,n=!e.style.background.backgroundColor.isTransparent()||e.style.background.backgroundImage.length,r=e.style.border.some(function(e){return e.borderStyle!==d.BORDER_STYLE.NONE&&!e.borderColor.isTransparent()}),i=function(){var r=(0,u.calculateBackgroungPaintingArea)(e.curvedBounds,e.style.background.backgroundClip);n&&t.target.clip([r],function(){e.style.background.backgroundColor.isTransparent()||t.target.fill(e.style.background.backgroundColor),t.renderBackgroundImage(e)}),e.style.border.forEach(function(n,r){n.borderStyle===d.BORDER_STYLE.NONE||n.borderColor.isTransparent()||t.renderBorder(n,r,e.curvedBounds)})};if(n||r){var A=e.parent?e.parent.getClipPaths():[];A.length?this.target.clip(A,i):i()}}},{key:"renderBackgroundImage",value:function(e){var t=this;e.style.background.backgroundImage.slice(0).reverse().forEach(function(n){"url"===n.source.method&&n.source.args.length?t.renderBackgroundRepeat(e,n):/gradient/i.test(n.source.method)&&t.renderBackgroundGradient(e,n)})}},{key:"renderBackgroundRepeat",value:function(e,t){var n=this.options.imageStore.get(t.source.args[0]);if(n){var r=(0,u.calculateBackgroungPositioningArea)(e.style.background.backgroundOrigin,e.bounds,e.style.padding,e.style.border),i=(0,u.calculateBackgroundSize)(t,n,r),A=(0,u.calculateBackgroundPosition)(t.position,i,r),o=(0,u.calculateBackgroundRepeatPath)(t,A,i,r,e.bounds),a=Math.round(r.left+A.x),s=Math.round(r.top+A.y);this.target.renderRepeat(o,n,i,a,s)}}},{key:"renderBackgroundGradient",value:function(e,t){var n=(0,u.calculateBackgroungPositioningArea)(e.style.background.backgroundOrigin,e.bounds,e.style.padding,e.style.border),r=(0,u.calculateGradientBackgroundSize)(t,n),i=(0,u.calculateBackgroundPosition)(t.position,r,n),A=new a.Bounds(Math.round(n.left+i.x),Math.round(n.top+i.y),r.width,r.height),o=(0,s.parseGradient)(e,t.source,A);if(o)switch(o.type){case s.GRADIENT_TYPE.LINEAR_GRADIENT:this.target.renderLinearGradient(A,o);break;case s.GRADIENT_TYPE.RADIAL_GRADIENT:this.target.renderRadialGradient(A,o)}}},{key:"renderBorder",value:function(e,t,n){this.target.drawShape((0,a.parsePathForBorder)(n,t),e.borderColor)}},{key:"renderStack",value:function(e){var t=this;if(e.container.isVisible()){var n=e.getOpacity();n!==this._opacity&&(this.target.setOpacity(e.getOpacity()),this._opacity=n);var r=e.container.style.transform;null!==r?this.target.transform(e.container.bounds.left+r.transformOrigin[0].value,e.container.bounds.top+r.transformOrigin[1].value,r.transform,function(){return t.renderStackContent(e)}):this.renderStackContent(e)}}},{key:"renderStackContent",value:function(e){var t=h(e),n=A(t,5),r=n[0],i=n[1],o=n[2],a=n[3],s=n[4],l=p(e),c=A(l,2),u=c[0],d=c[1];this.renderNodeBackgroundAndBorders(e.container),r.sort(g).forEach(this.renderStack,this),this.renderNodeContent(e.container),d.forEach(this.renderNode,this),a.forEach(this.renderStack,this),s.forEach(this.renderStack,this),u.forEach(this.renderNode,this),i.forEach(this.renderStack,this),o.sort(g).forEach(this.renderStack,this)}},{key:"render",value:function(e){this.options.backgroundColor&&this.target.rectangle(this.options.x,this.options.y,this.options.width,this.options.height,this.options.backgroundColor),this.renderStack(e);var t=this.target.getTarget();return t}}]),e}();t.default=f;var p=function(e){for(var t=[],n=[],r=e.children.length,i=0;i0?r.push(s):n.push(s):s.container.isFloating()?i.push(s):A.push(s)}return[t,n,r,i,A]},g=function(e,t){return e.container.style.zIndex.order>t.container.style.zIndex.order?1:e.container.style.zIndex.ordert.container.index?1:-1}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.FontMetrics=void 0;var i=function(){function e(e,t){for(var n=0;ne.optimumDistance)?{optimumCorner:i,optimumDistance:A}:e},{optimumDistance:r?1/0:-(1/0),optimumCorner:null}).optimumCorner},S=function(e,t,n,r,i){var A=n.x,o=n.y,a=0,s=0;switch(e){case"closest-side":t===B.CIRCLE?a=s=Math.min(Math.abs(A),Math.abs(A-i.width),Math.abs(o),Math.abs(o-i.height)):t===B.ELLIPSE&&(a=Math.min(Math.abs(A),Math.abs(A-i.width)),s=Math.min(Math.abs(o),Math.abs(o-i.height)));break;case"closest-corner":if(t===B.CIRCLE)a=s=Math.min((0,d.distance)(A,o),(0,d.distance)(A,o-i.height),(0,d.distance)(A-i.width,o),(0,d.distance)(A-i.width,o-i.height));else if(t===B.ELLIPSE){var l=Math.min(Math.abs(o),Math.abs(o-i.height))/Math.min(Math.abs(A),Math.abs(A-i.width)),c=T(i,A,o,!0);a=(0,d.distance)(c.x-A,(c.y-o)/l),s=l*a}break;case"farthest-side":t===B.CIRCLE?a=s=Math.max(Math.abs(A),Math.abs(A-i.width),Math.abs(o),Math.abs(o-i.height)):t===B.ELLIPSE&&(a=Math.max(Math.abs(A),Math.abs(A-i.width)),s=Math.max(Math.abs(o),Math.abs(o-i.height)));break;case"farthest-corner":if(t===B.CIRCLE)a=s=Math.max((0,d.distance)(A,o),(0,d.distance)(A,o-i.height),(0,d.distance)(A-i.width,o),(0,d.distance)(A-i.width,o-i.height));else if(t===B.ELLIPSE){var u=Math.max(Math.abs(o),Math.abs(o-i.height))/Math.max(Math.abs(A),Math.abs(A-i.width)),f=T(i,A,o,!1);a=(0,d.distance)(f.x-A,(f.y-o)/u),s=u*a}break;default:a=r.x||0,s=void 0!==r.y?r.y:a}return{x:a,y:s}},x=t.transformWebkitRadialGradientArgs=function(e){var t="",n="",r="",i="",A=0,o=/^(left|center|right|\d+(?:px|r?em|%)?)(?:\s+(top|center|bottom|\d+(?:px|r?em|%)?))?$/i,a=/^(circle|ellipse)?\s*(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)?$/i,s=/^\d+(px|r?em|%)?(?:\s+\d+(px|r?em|%)?)?$/i,l=e[A].match(o);l&&A++;var c=e[A].match(a);c&&(t=c[1]||"",r=c[2]||"","contain"===r?r="closest-side":"cover"===r&&(r="farthest-corner"),A++);var u=e[A].match(s);u&&A++;var d=e[A].match(o);d&&A++;var f=e[A].match(s);f&&A++;var p=d||l;p&&p[1]&&(i=p[1]+(/^\d+$/.test(p[1])?"px":""),p[2]&&(i+=" "+p[2]+(/^\d+$/.test(p[2])?"px":"")));var h=f||u;return h&&(n=h[0],h[1]||(n+="px")),!i||t||n||r||(n=i,i=""),i&&(i="at "+i),[[t,r,n,i].filter(function(e){return!!e}).join(" ")].concat(e.slice(A))},k=function(e){return e.map(function(e){return e.match(g)}).map(function(t,n){if(!t)return e[n];switch(t[1]){case"from":return t[4]+" 0%";case"to":return t[4]+" 100%";case"color-stop":return"%"===t[3]?t[4]+" "+t[2]:t[4]+" "+100*parseFloat(t[2])+"%"}})}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=/([+-]?\d*\.?\d+)(deg|grad|rad|turn)/i;t.parseAngle=function(e){var t=e.match(n);if(t){var r=parseFloat(t[1]);switch(t[2].toLowerCase()){case"deg":return Math.PI*r/180;case"grad":return Math.PI/200*r;case"rad":return r;case"turn":return 2*Math.PI*r}}return null}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.cloneWindow=t.DocumentCloner=void 0;var A=function(){function e(e,t){var n=[],r=!0,i=!1,A=void 0;try{for(var o,a=e[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,A=e}finally{try{!r&&a.return&&a.return()}finally{if(i)throw A}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function e(e,t){for(var n=0;n1&&(n.backgroundColor=""),n.backgroundImage=e.join(",")}),e instanceof HTMLImageElement&&this.resourceLoader.inlineImage(e.src).then(function(t){if(t&&e instanceof HTMLImageElement&&e.parentNode){var n=e.parentNode,r=(0,u.copyCSSStyles)(e.style,t.cloneNode(!1));n.replaceChild(r,e)}}).catch(function(e){})}}},{key:"inlineFonts",value:function(e){var t=this;return Promise.all(Array.from(e.styleSheets).map(function(t){return t.href?fetch(t.href).then(function(e){return e.text()}).then(function(e){return B(e,t.href)}).catch(function(e){return[]}):v(t,e)})).then(function(e){return e.reduce(function(e,t){return e.concat(t)},[])}).then(function(e){return Promise.all(e.map(function(e){return fetch(e.formats[0].src).then(function(e){return e.blob()}).then(function(e){return new Promise(function(t,n){var r=new FileReader;r.onerror=n,r.onload=function(){var e=r.result;t(e)},r.readAsDataURL(e)})}).then(function(t){return e.fontFace.setProperty("src",'url("'+t+'")'),"@font-face {"+e.fontFace.cssText+" "})}))}).then(function(n){var r=e.createElement("style");r.textContent=n.join("\n"),t.documentElement.appendChild(r)})}},{key:"createElementClone",value:function(e){var t=this;if(this.copyStyles&&e instanceof HTMLCanvasElement){var n=e.ownerDocument.createElement("img");try{return n.src=e.toDataURL(),n}catch(e){}}if(e instanceof HTMLIFrameElement){var r=e.cloneNode(!1),i=S();r.setAttribute("data-html2canvas-internal-iframe-key",i);var A=(0,a.parseBounds)(e,0,0),o=A.width,s=A.height;return this.resourceLoader.cache[i]=k(e,this.options).then(function(e){return t.renderer(e,{async:t.options.async,allowTaint:t.options.allowTaint,backgroundColor:"#ffffff",canvas:null,imageTimeout:t.options.imageTimeout,logging:t.options.logging,proxy:t.options.proxy,removeContainer:t.options.removeContainer,scale:t.options.scale,foreignObjectRendering:t.options.foreignObjectRendering,useCORS:t.options.useCORS,target:new p.default,width:o,height:s,x:0,y:0,windowWidth:e.ownerDocument.defaultView.innerWidth,windowHeight:e.ownerDocument.defaultView.innerHeight,scrollX:e.ownerDocument.defaultView.pageXOffset,scrollY:e.ownerDocument.defaultView.pageYOffset},t.logger.child(i))}).then(function(t){return new Promise(function(n,i){var A=document.createElement("img");A.onload=function(){return n(t)},A.onerror=i,A.src=t.toDataURL(),r.parentNode&&r.parentNode.replaceChild((0,u.copyCSSStyles)(e.ownerDocument.defaultView.getComputedStyle(e),A),r)})}),r}if(e instanceof HTMLStyleElement&&e.sheet&&e.sheet.cssRules){var l=[].slice.call(e.sheet.cssRules,0).reduce(function(e,n){try{return n&&n.cssText?e+n.cssText:e}catch(r){return t.logger.log("Unable to access cssText property",n.name),e}},""),c=e.cloneNode(!1);return c.textContent=l,c}return e.cloneNode(!1)}},{key:"cloneNode",value:function(e){var t=e.nodeType===Node.TEXT_NODE?document.createTextNode(e.nodeValue):this.createElementClone(e),n=e.ownerDocument.defaultView,r=e instanceof n.HTMLElement?n.getComputedStyle(e):null,i=e instanceof n.HTMLElement?n.getComputedStyle(e,":before"):null,A=e instanceof n.HTMLElement?n.getComputedStyle(e,":after"):null;this.referenceElement===e&&t instanceof n.HTMLElement&&(this.clonedReferenceElement=t),t instanceof n.HTMLBodyElement&&_(t);for(var o=(0,h.parseCounterReset)(r,this.pseudoContentData),a=(0,h.resolvePseudoContent)(e,i,this.pseudoContentData),s=e.firstChild;s;s=s.nextSibling)s.nodeType===Node.ELEMENT_NODE&&("SCRIPT"===s.nodeName||s.hasAttribute(g)||"function"==typeof this.options.ignoreElements&&this.options.ignoreElements(s))||this.copyStyles&&"STYLE"===s.nodeName||t.appendChild(this.cloneNode(s));var l=(0,h.resolvePseudoContent)(e,A,this.pseudoContentData);if((0,h.popCounters)(o,this.pseudoContentData),e instanceof n.HTMLElement&&t instanceof n.HTMLElement)switch(i&&this.inlineAllImages(b(e,t,i,a,C)),A&&this.inlineAllImages(b(e,t,A,l,E)),!r||!this.copyStyles||e instanceof HTMLIFrameElement||(0,u.copyCSSStyles)(r,t),this.inlineAllImages(t),0===e.scrollTop&&0===e.scrollLeft||this.scrolledElements.push([t,e.scrollLeft,e.scrollTop]),e.nodeName){case"CANVAS":this.copyStyles||y(e,t);break;case"TEXTAREA":case"SELECT":t.value=e.value}return t}}]),e}(),v=function(e,t){return(e.cssRules?Array.from(e.cssRules):[]).filter(function(e){return e.type===CSSRule.FONT_FACE_RULE}).map(function(e){for(var n=(0,d.parseBackgroundImage)(e.style.getPropertyValue("src")),r=[],i=0;i0&&"complete"===n.readyState&&(clearInterval(t),r(e))},50)}})},L=(t.cloneWindow=function(e,t,n,r,i,A){var o=new m(n,r,i,!1,A),a=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset;return I(e,t).then(function(i){var A=i.contentWindow,l=A.document,c=N(i).then(function(){o.scrolledElements.forEach(T),A.scrollTo(t.left,t.top),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||A.scrollY===t.top&&A.scrollX===t.left||(l.documentElement.style.top=-t.top+"px",l.documentElement.style.left=-t.left+"px",l.documentElement.style.position="absolute");var n=Promise.resolve([i,o.clonedReferenceElement,o.resourceLoader]),a=r.onclone;return o.clonedReferenceElement instanceof A.HTMLElement||o.clonedReferenceElement instanceof e.defaultView.HTMLElement||o.clonedReferenceElement instanceof HTMLElement?"function"==typeof a?Promise.resolve().then(function(){return a(l)}).then(function(){return n}):n:Promise.reject("")});return l.open(),l.write(L(document.doctype)+""),w(n.ownerDocument,a,s),l.replaceChild(l.adoptNode(o.documentElement),l.documentElement),l.close(),c})},function(e){var t="";return e&&(t+=""),t})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Proxy=void 0;var i=n(87),A=r(i);t.Proxy=function(e,t){if(!t.proxy)return Promise.reject(null);var n=t.proxy;return new Promise(function(r,i){var o=A.default.SUPPORT_CORS_XHR&&A.default.SUPPORT_RESPONSE_TYPE?"blob":"text",a=A.default.SUPPORT_CORS_XHR?new XMLHttpRequest:new XDomainRequest;if(a.onload=function(){if(a instanceof XMLHttpRequest)if(200===a.status)if("text"===o)r(a.response);else{var e=new FileReader;e.addEventListener("load",function(){return r(e.result)},!1),e.addEventListener("error",function(e){return i(e)},!1),e.readAsDataURL(a.response)}else i("");else r(a.responseText)},a.onerror=i,a.open("GET",n+"?url="+encodeURIComponent(e)+"&responseType="+o),"text"!==o&&a instanceof XMLHttpRequest&&(a.responseType=o),t.imageTimeout){var s=t.imageTimeout;a.timeout=s,a.ontimeout=function(){return i("")}}a.send()})}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.ResourceStore=void 0;var A=function(){function e(e,t){for(var n=0;n0&&n.push({type:a.ATTRIBUTE,value:u[0]});break;case"counter":if(u.length>0){var p={type:a.COUNTER,name:u[0]};u.length>1&&(p.format=u[1]),n.push(p)}break;case"counters":if(u.length>0){var h={type:a.COUNTERS,name:u[0]};u.length>1&&(h.glue=u[1]),u.length>2&&(h.format=u[2]),n.push(h)}break;case"url":u.length>0&&n.push({type:a.URL,value:u[0]})}o=!1,s=""}break;case",":i?s+=f:o&&(u.push(s),s="");break;case" ":case"\t":i?s+=f:s&&(l(n,s),s="");break;default:s+=f}"\\"!==f&&(A=!1)}return s&&l(n,s),t&&(t[e]=n),n}),l=function(e,t){switch(t){case"open-quote":e.push({type:a.OPENQUOTE});break;case"close-quote":e.push({type:a.CLOSEQUOTE})}},c=function(e,t,n){var r=e.quotes?e.quotes.split(/\s+/):["'\"'","'\"'"],i=2*n;return i>=r.length&&(i=r.length-2),t||++i,r[i].replace(/^["']|["']$/g,"")},u=function(e,t,n){for(var r=e.length,o="",a=0;a0&&(o+=t||""),o+=(0,i.createCounterText)(e[a],(0,A.parseListStyleType)(n||"decimal"),!1);return o}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.replaceImage=t.renderElement=t.getElements=void 0;var i=n(36),A=r(i),o=n(38),a=r(o),s=n(6),l=r(s),c=n(20);t.getElements=function(){return a.default.load("elements",{name:"elements"},function(){return(0,A.default)(l.default.config.assetsUrl+"endpoints/ajax.php?action=get-elements&theme="+l.default.config.theme,{credentials:"same-origin",headers:{"X-Fred-Token":l.default.jwt}}).then(function(e){return e.json()}).then(function(e){return e.data})})},t.renderElement=function(e,t,n){return(0,A.default)(l.default.config.assetsUrl+"endpoints/ajax.php?action=render-element",{method:"post",credentials:"same-origin",headers:{"Content-Type":"application/json","X-Fred-Token":l.default.jwt},body:JSON.stringify({resource:l.default.resource.id,parseModx:n,element:e,settings:t})}).then(c.errorHandler)},t.replaceImage=function(e,t){var n={element:e,image:t};return""===t&&(n.generatedImage=generatedImage),(0,A.default)(l.default.config.assetsUrl+"endpoints/ajax.php?action=element-replace-image",{method:"post",credentials:"same-origin",headers:{"Content-Type":"application/json","X-Fred-Token":l.default.jwt},body:JSON.stringify(n)}).then(c.errorHandler)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){};i(this,e),this.group=t,this.inputToggle=null,this.inputWrapper=null,null===n&&(l.default.pageSettings.tagger||(l.default.pageSettings.tagger={}),l.default.pageSettings.tagger["tagger-"+this.group.id]||(l.default.pageSettings.tagger["tagger-"+this.group.id]=[]),n=l.default.pageSettings.tagger["tagger-"+this.group.id]),this.currentTags=n,this.onChange=r.bind(this),this.onTagToggle=this.onTagToggle.bind(this),this.onTagRemove=this.onTagRemove.bind(this)}return o(e,[{key:"render",value:function(){var e=(0,a.div)("fred--tagger_field",(0,a.div)("fred--tagger_group_title",this.group.name));switch(this.group.field_type){case"tagger-field-tags":var t=(0,a.div)("fred--tagger_tags_wrapper");this.group.hide_input===!1&&(this.renderInput(t),e.appendChild(this.inputToggle),e.appendChild(this.inputWrapper)),this.group.show_autotag?this.renderAutoTag(t):this.renderTags(t),this.toggleInput(),e.appendChild(t);break;case"tagger-combo-tag":this.group.allow_new===!1?this.renderSingleSelectInput():this.renderSingleTagInput(),e.appendChild(this.inputWrapper);break;default:return!1}return e}},{key:"renderTagInput",value:function(e){var t=this,n=(0,a.input)("","text","fred--tagger_input");n.addEventListener("keyup",function(r){188!==r.keyCode&&13!==r.keyCode||t.onTagSubmit(e,n)}),n.addEventListener("keydown",function(e){13===e.keyCode&&e.preventDefault()});var r=(0,a.button)("fred.fe.tagger.add","fred.fe.tagger.add","fred--tagger_add_tag",function(){t.onTagSubmit(e,n)});this.inputWrapper.appendChild(n),this.inputWrapper.appendChild(r);var i=null;this.autoComplete({selector:n,onSelect:function(r,i,A){t.onTagSubmit(e,n)},source:function(e,n){null!==i&&(i.cancel(),i=null),i=(0,u.default)((0,m.getTags)(t.group.id,e)),i.promise.then(function(e){n(e)})}})}},{key:"renderSelectInput",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=(0,a.select)();this.inputWrapper.appendChild(r);var i=null,A={},o=[],s=new h.default(r,{shouldSort:!1,removeItemButton:!1,searchResultLimit:0});(0,g.fixChoices)(s),null!==t&&(s._handleChoiceAction=function(e,t){if(e&&t){var n=t.getAttribute("data-id"),r=this.store.getChoiceById(n),i=e[0]&&e[0].keyCode?e[0].keyCode:null,A=this.dropdown.classList.contains(this.config.classNames.activeState);r.keyCode=i;var o=new CustomEvent("choice",{detail:null,bubbles:!0,cancelable:!0});if(this.passedElement.dispatchEvent(o),r&&!r.selected&&!r.disabled){var a=this._canAddItem(e,r.value);a.response&&(this._addItem(r.value,r.label,r.id,r.groupId,r.customProperties,r.placeholder,r.keyCode),this._triggerChange(r.value))}A&&this.isSelectOneElement}}),null!==n&&s.setValue([n]),s.ajax(function(t){(0,m.getTags)(e.group.id).then(function(e){var n=[];e.forEach(function(e){n.push({value:""+e,label:""+e})}),o=n,t(n,"value","label")}).catch(function(e){f.default.emit("fred-loading",e.message)})});var l=function(e){s.setChoices(e,"value","label",!0)},c=function(){var t=s.input.value;t in A?l(A[t]):(0,m.getTags)(e.group.id,t).then(function(e){var n=[];e.forEach(function(e){n.push({value:""+e,label:""+e})}),A[t]=n,l(n)}).catch(function(e){f.default.emit("fred-loading",e.message)})};s.passedElement.addEventListener("search",function(e){clearTimeout(i),i=setTimeout(c,200)}),s.passedElement.addEventListener("change",function(n){null===t?(e.currentTags=[n.detail.value.trim()],e.onChange(e.currentTags),s.setChoices(o,"value","label",!0)):e.onTagAdd(t,n.detail.value)}),null!==t&&s.passedElement.addEventListener("hideDropdown",function(e){s.clearStore(),s.clearInput(),s.setChoices(o,"value","label",!0)})}},{key:"renderSingleSelectInput",value:function(){this.inputWrapper=(0,a.div)("fred--tagger_input_wrapper");var e=null;this.currentTags.length>0&&(e=this.currentTags[0]),this.renderSelectInput(null,e)}},{key:"renderSingleTagInput",value:function(){var e=this;this.inputWrapper=(0,a.div)("fred--tagger_input_wrapper");var t=(0,a.input)("","text","fred--tagger_input");this.currentTags.length>0&&(t.value=this.currentTags[0]),t.addEventListener("keydown",function(e){13===e.keyCode&&e.preventDefault()}),t.addEventListener("keyup",function(n){e.currentTags=[t.value.trim()],e.onChange(e.currentTags)});var n=(0,a.button)("fred.fe.tagger.toggle_list","fred.fe.tagger.toggle_list","fred--tagger_open_list",function(){n.listVisible?t.blur():(t.openList(t.value,0),t.focus())});n.addEventListener("mousedown",function(e){n.listVisible="block"===t.sc.style.display}),this.inputWrapper.appendChild(t),this.inputWrapper.appendChild(n);var r=null;this.autoComplete({hideOnSelect:!0,selector:t,onSelect:function(n,r,i){e.currentTags=[t.value.trim()],e.onChange(e.currentTags)},source:function(t,n){null!==r&&(r.cancel(),r=null),r=(0,u.default)((0,m.getTags)(e.group.id,t)),r.promise.then(function(e){n(e)})}})}},{key:"renderInput",value:function(e){var t=this;this.inputWrapper=(0,a.div)(["fred--tagger_input_wrapper","fred--hidden"]),this.inputToggle=(0,a.button)("fred.fe.tagger.toggle_input","fred.fe.tagger.toggle_input","fred--tagger_input_toggle",function(){t.inputWrapper.classList.contains("fred--hidden")?(t.inputWrapper.classList.remove("fred--hidden"),t.inputToggle.classList.add("fred--tagger_input_toggle_open")):(t.inputWrapper.classList.add("fred--hidden"),t.inputToggle.classList.remove("fred--tagger_input_toggle_open"))}),this.group.allow_new===!0?this.renderTagInput(e):this.renderSelectInput(e)}},{key:"renderTag",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},r=(0,a.span)("fred--tagger_tag",e);return r.setAttribute("data-tag",e),t&&r.classList.add("fred--tagger_tag_active"),"function"==typeof n&&r.addEventListener("click",function(t){t.preventDefault(),n(r,e)}),r}},{key:"renderAutoTag",value:function(e){var t=this;this.group.tags.forEach(function(n){var r=!1;~t.currentTags.indexOf(n)&&(r=!0),e.appendChild(t.renderTag(n,r,t.onTagToggle))})}},{key:"renderTags",value:function(e){var t=this;this.currentTags.forEach(function(n){e.appendChild(t.renderTag(n,!0,t.onTagRemove))})}},{key:"onTagToggle",value:function(e,t){if(this.group.as_radio===!0){var n=e.classList.contains("fred--tagger_tag_active"),r=e.parentElement.querySelectorAll(".fred--tagger_tag_active"),i=!0,A=!1,o=void 0;try{for(var a,s=r[Symbol.iterator]();!(i=(a=s.next()).done);i=!0){var l=a.value;l.classList.remove("fred--tagger_tag_active")}}catch(e){A=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(A)throw o}}return n?(e.classList.remove("fred--tagger_tag_active"),this.currentTags=[]):(e.classList.add("fred--tagger_tag_active"),this.currentTags=[t]),void this.onChange(this.currentTags)}e.classList.contains("fred--tagger_tag_active")?(e.classList.remove("fred--tagger_tag_active"),this.currentTags.splice(this.currentTags.indexOf(t),1),this.toggleInput()):(this.checkTagLimit()&&(e.classList.add("fred--tagger_tag_active"),this.currentTags.push(t)),this.toggleInput()),this.onChange(this.currentTags)}},{key:"onTagRemove",value:function(e,t){this.currentTags.splice(this.currentTags.indexOf(t),1),this.onChange(this.currentTags),e.remove(),this.toggleInput()}},{key:"onTagSubmit",value:function(e,t){this.onTagAdd(e,t.value),t.value=""}},{key:"onTagAdd",value:function(e,t){var n=this,r=t.trim().split(",");r.forEach(function(t){if(n.checkTagLimit()){if(t=t.trim(),!t)return;if(~n.currentTags.indexOf(t))return;var r=e.querySelector('[data-tag="'+t+'"]');if(r)return r.classList.add("fred--tagger_tag_active"),n.currentTags.push(t),n.onChange(n.currentTags),void n.toggleInput();var i=n.renderTag(t,!0,function(){n.group.show_autotag?n.onTagToggle(i,t):n.onTagRemove(i,t)});e.appendChild(i),n.currentTags.push(t),n.onChange(n.currentTags),n.toggleInput()}})}},{key:"toggleInput",value:function(){this.inputToggle&&this.inputWrapper&&(this.checkTagLimit()?this.inputToggle.classList.contains("fred--hidden")&&(this.inputToggle.classList.remove("fred--tagger_input_toggle_open"),this.inputToggle.classList.remove("fred--hidden")):(this.inputToggle.classList.add("fred--hidden"),this.inputWrapper.classList.add("fred--hidden"),this.inputToggle.classList.remove("fred--tagger_input_toggle_open")))}},{key:"checkTagLimit",value:function(){return 0===this.group.tag_limit||this.currentTags.length0?r.timer=setTimeout(function(){t.source(e,function(t){o(t,e)})},n):t.source(e,function(t){o(t,e)})},r.updateSC=function(e,t){var n=r.getBoundingClientRect();if(r.sc.style.width=Math.round(n.right-n.left)+"px",!e&&(r.sc.style.display="block",r.sc.maxHeight||(r.sc.maxHeight=parseInt((window.getComputedStyle?getComputedStyle(r.sc,null):r.sc.currentStyle).maxHeight)),r.sc.suggestionHeight||(r.sc.suggestionHeight=r.sc.querySelector(".fred--autocomplete_suggestion").offsetHeight),r.sc.suggestionHeight))if(t){var i=r.sc.scrollTop,A=t.getBoundingClientRect().top-r.sc.getBoundingClientRect().top;A+r.sc.suggestionHeight-r.sc.maxHeight>0?r.sc.scrollTop=A+r.sc.suggestionHeight+i-r.sc.maxHeight:A<0&&(r.sc.scrollTop=A+i)}else r.sc.scrollTop=0},r.blurHandler=function(){var e=!1;try{e=r.parentNode.querySelector(".fred--autocomplete_suggestions:hover")}catch(t){e=!1}e?r!==document.activeElement&&setTimeout(function(){r.focus()},20):(r.last_val=r.value,r.sc.style.display="none")},r.keydownHandler=function(e){var n=window.event?e.keyCode:e.which;if((40===n||38===n)&&r.sc.innerHTML){var i=void 0,A=r.sc.querySelector(".fred--autocomplete_suggestion.fred--autocomplete_suggestion_selected");return A?(i=40===n?A.nextSibling:A.previousSibling,i?(A.classList.remove("fred--autocomplete_suggestion_selected"),i.classList.add("fred--autocomplete_suggestion_selected"),r.value=i.getAttribute("data-val")):(A.classList.remove("fred--autocomplete_suggestion_selected"),r.value=r.last_val,i=0)):(i=40===n?r.sc.querySelector(".fred--autocomplete_suggestion"):r.sc.childNodes[r.sc.childNodes.length-1],i.classList.add("fred--autocomplete_suggestion_selected"),r.value=i.getAttribute("data-val")),r.updateSC(0,i),!1}if(27===n)r.value=r.last_val,r.sc.style.display="none";else if(13===n||9===n){var o=r.sc.querySelector(".fred--autocomplete_suggestion.fred--autocomplete_suggestion_selected");o&&"none"!==r.sc.style.display&&(t.onSelect(e,o.getAttribute("data-val"),o),t.hideOnSelect===!0&&setTimeout(function(){r.sc.style.display="none"},20))}},r.keyupHandler=function(e){var n=window.event?e.keyCode:e.which;if(!n||(n<35||n>40)&&13!==n&&27!==n){var i=r.value;i.length>=t.minChars?i!==r.last_val&&r.openList(i,t.delay):(r.last_val=i,r.sc.style.display="none")}},r.focusHandler=function(e){r.last_val="\n",r.keyupHandler(e)};var i=function(e,n){n=n.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");var i=new RegExp("("+n.split(" ").join("|")+")","gi"),A=(0,a.div)("fred--autocomplete_suggestion",e.replace(i,"$1 "));return A.setAttribute("data-val",e),A.addEventListener("mouseover",function(e){A.classList.add("fred--autocomplete_suggestion_selected")}),A.addEventListener("mouseleave",function(e){var t=A.parentElement.querySelectorAll(".fred--autocomplete_suggestion_selected"),n=!0,r=!1,i=void 0;try{for(var o,a=t[Symbol.iterator]();!(n=(o=a.next()).done);n=!0){var s=o.value;s.classList.remove("fred--autocomplete_suggestion_selected")}}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}}),A.addEventListener("mousedown",function(e){var n=A.getAttribute("data-val");r.value=n,t.onSelect(e,n,A),t.hideOnSelect===!0&&(r.sc.style.display="none")}),A},o=function(e,n){var A=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(A===!0&&(r.cache[n]=e),e.length&&n.length>=t.minChars){r.sc.innerHTML="";for(var o=0;o1&&void 0!==arguments[1]?arguments[1]:null,n="&group="+e;return null!==t&&(n+="&query="+t),A.default.load("tagger",{name:"tags",group:e,query:t},function(){return(0,a.default)(l.default.config.assetsUrl+"endpoints/ajax.php?action=tagger-get-tags&"+n,{credentials:"same-origin",headers:{"X-Fred-Token":l.default.jwt}}).then(c.errorHandler).then(function(e){return e.data.tags})})}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.duplicateResource=t.undeleteResource=t.deleteResource=t.unpublishResource=t.publishResource=t.getResources=t.createResource=t.getTemplates=t.getResourceTree=void 0;var i=n(38),A=r(i),o=n(36),a=r(o),s=n(6),l=r(s),c=n(20);t.getResourceTree=function(e){return A.default.load("resources",{name:"resource-tree"},function(){return(0,a.default)(l.default.config.assetsUrl+"endpoints/ajax.php?action=get-resource-tree&context="+e,{credentials:"same-origin",headers:{"X-Fred-Token":l.default.jwt}}).then(function(e){return e.json()}).then(function(e){return e.data.resources})})},t.getTemplates=function(e){return A.default.load("templates",{name:"templates"},function(){return(0,a.default)(l.default.config.assetsUrl+"endpoints/ajax.php?action=get-templates",{credentials:"same-origin",headers:{"X-Fred-Token":l.default.jwt}}).then(c.errorHandler)})},t.createResource=function(e,t,n,r){return(0,a.default)(l.default.config.assetsUrl+"endpoints/ajax.php?action=create-resource",{method:"post",credentials:"same-origin",headers:{"Content-Type":"application/json","X-Fred-Token":l.default.jwt},body:JSON.stringify({parent:e,template:t,pagetitle:n,blueprint:r,contextKey:l.default.config.contextKey})}).then(c.errorHandler)},t.getResources=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n="";null!==e&&(n+="¤t="+e);for(var r in t)t.hasOwnProperty(r)&&(n+="&"+r+"="+t[r]);return(0,a.default)(l.default.config.assetsUrl+"endpoints/ajax.php?action=get-resources"+n,{credentials:"same-origin",headers:{"X-Fred-Token":l.default.jwt}}).then(c.errorHandler)},t.publishResource=function(e){return(0,a.default)(l.default.config.assetsUrl+"endpoints/ajax.php?action=publish-resource",{method:"post",credentials:"same-origin",headers:{"Content-Type":"application/json","X-Fred-Token":l.default.jwt},body:JSON.stringify({resource:e})}).then(c.errorHandler)},t.unpublishResource=function(e){return(0,a.default)(l.default.config.assetsUrl+"endpoints/ajax.php?action=unpublish-resource",{method:"post",credentials:"same-origin",headers:{"Content-Type":"application/json","X-Fred-Token":l.default.jwt},body:JSON.stringify({resource:e})}).then(c.errorHandler)},t.deleteResource=function(e){return(0,a.default)(l.default.config.assetsUrl+"endpoints/ajax.php?action=delete-resource",{method:"post",credentials:"same-origin",headers:{"Content-Type":"application/json","X-Fred-Token":l.default.jwt},body:JSON.stringify({resource:e})}).then(c.errorHandler)},t.undeleteResource=function(e){return(0,a.default)(l.default.config.assetsUrl+"endpoints/ajax.php?action=undelete-resource",{method:"post",credentials:"same-origin",headers:{"Content-Type":"application/json","X-Fred-Token":l.default.jwt},body:JSON.stringify({resource:e})}).then(c.errorHandler)},t.duplicateResource=function(e,t,n,r){return(0,a.default)(l.default.config.assetsUrl+"endpoints/ajax.php?action=duplicate-resource",{method:"post",credentials:"same-origin",headers:{"Content-Type":"application/json","X-Fred-Token":l.default.jwt},body:JSON.stringify({pagetitle:e,duplicate_children:t,publishing_options:n,resource:r})}).then(c.errorHandler)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t"+t+""+n+" "),c=(0,d.div)(["chunk"]);return c.dataset.fredElementId=e,c.dataset.fredElementTitle=t,c.setAttribute("hidden","hidden"),c.elementMarkup=i,c.elementOptions=A,o.appendChild(a),o.appendChild(l),o.appendChild(c),o}}]),t}(l.default);v.title="fred.fe.elements",v.icon="fred--sidebar_elements",v.expandable=!0,t.default=v,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n0&&e.appendChild(this.getTaggerFields()),this.fredConfig.permission.fred_settings_tvs&&this.fredConfig.tvs.length>0&&e.appendChild(this.getTVFields()),e}},{key:"getGeneralFields",value:function(){var e=this,t=(0,d.fieldSet)();t.appendChild(g.default.text({name:"pagetitle",label:"fred.fe.page_settings.page_title"},this.pageSettings.pagetitle,this.setSettingWithEmitter,this.addSettingChangeListener)),t.appendChild(g.default.text({name:"longtitle",label:"fred.fe.page_settings.long_title"},this.pageSettings.longtitle,this.setSettingWithEmitter,this.addSettingChangeListener)),t.appendChild(g.default.area({name:"description",label:"fred.fe.page_settings.description"},this.pageSettings.description,this.setSettingWithEmitter,this.addSettingChangeListener)),t.appendChild(g.default.area({name:"introtext",label:"fred.fe.page_settings.intro_text"},this.pageSettings.introtext,this.setSettingWithEmitter,this.addSettingChangeListener)),t.appendChild(g.default.text({name:"menutitle",label:"fred.fe.page_settings.menu_title"},this.pageSettings.menutitle,this.setSettingWithEmitter,this.addSettingChangeListener)),t.appendChild(g.default.text({name:"alias",label:"fred.fe.page_settings.alias"},this.pageSettings.alias,this.setSettingWithEmitter,this.addSettingChangeListener));var n=g.default.toggle({name:"published",label:"fred.fe.page_settings.published"},this.pageSettings.published,function(t,n){e.setSetting(t,n)});return this.fredConfig.permission.publish_document&&this.fredConfig.resource.publish||this.pageSettings.published||n.inputEl.setAttribute("disabled","disabled"),this.fredConfig.permission.unpublish_document&&this.fredConfig.resource.unpublish||!this.pageSettings.published||n.inputEl.setAttribute("disabled","disabled"),t.appendChild(n),t.appendChild(g.default.toggle({name:"hidemenu",label:"fred.fe.page_settings.hide_from_menu"},this.pageSettings.hidemenu,function(t,n){e.setSetting(t,n)})),u.default.on("fred-after-save",function(){e.fredConfig.permission.publish_document&&e.fredConfig.resource.publish||e.pageSettings.published||n.inputEl.setAttribute("disabled","disabled"),e.fredConfig.permission.unpublish_document&&e.fredConfig.resource.unpublish||!e.pageSettings.published||n.inputEl.setAttribute("disabled","disabled")}),t}},{key:"getAdvancedFields",value:function(){var e=this,t=(0,d.dl)(),n=(0,d.dt)("fred.fe.page_settings.advanced_settings",["fred--accordion-cog"],function(e){var i=t.parentElement.querySelectorAll("dt.active"),A=n.classList.contains("active"),o=!0,a=!1,s=void 0;try{for(var l,c=i[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var d=l.value;d.classList.remove("active")}}catch(e){a=!0,s=e}finally{try{!o&&c.return&&c.return()}finally{if(a)throw s}}A||(n.classList.add("active"),e.stopPropagation(),u.default.emit("fred-sidebar-dt-active",n,r))}),r=(0,d.dd)(),i=(0,d.fieldSet)(["fred--page_settings_form_advanced"]),A=g.default.dateTime({name:"publishedon",label:"fred.fe.page_settings.published_on"},this.pageSettings.publishedon,function(t,n){e.setSetting(t,n)});i.appendChild(A),i.appendChild(g.default.dateTime({name:"publishon",label:"fred.fe.page_settings.publish_on"},this.pageSettings.publishon,function(t,n){e.setSetting(t,n)})),i.appendChild(g.default.dateTime({name:"unpublishon",label:"fred.fe.page_settings.unpublish_on"},this.pageSettings.unpublishon,function(t,n){e.setSetting(t,n)})),i.appendChild(g.default.text({name:"menuindex",label:"fred.fe.page_settings.menu_index"},this.pageSettings.menuindex,function(t,n){e.setSetting(t,n)}));var o=g.default.toggle({name:"deleted",label:"fred.fe.page_settings.deleted"},this.pageSettings.deleted,function(t,n){e.setSetting(t,n)});return this.fredConfig.permission.delete_document&&this.fredConfig.resource.delete||this.pageSettings.deleted||o.inputEl.setAttribute("disabled","disabled"),this.fredConfig.permission.undelete_document&&this.fredConfig.resource.undelete||!this.pageSettings.deleted||o.inputEl.setAttribute("disabled","disabled"),i.appendChild(o),r.appendChild(i),t.appendChild(n),t.appendChild(r),u.default.on("fred-after-save",function(){e.fredConfig.permission.delete_document&&e.fredConfig.resource.delete||e.pageSettings.deleted||o.inputEl.setAttribute("disabled","disabled"),e.fredConfig.permission.undelete_document&&e.fredConfig.resource.undelete||!e.pageSettings.deleted||o.inputEl.setAttribute("disabled","disabled"),e.pageSettings.publishedon?A.picker.setDate(1e3*e.pageSettings.publishedon):A.picker.clear()}),t}},{key:"getTaggerFields",value:function(){var e=(0,d.dl)(),t=(0,d.dt)("fred.fe.tagger.tagger",["fred--accordion-cog"],function(r){var i=e.parentElement.querySelectorAll("dt.active"),A=t.classList.contains("active"),o=!0,a=!1,s=void 0;try{for(var l,c=i[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var d=l.value;d.classList.remove("active")}}catch(e){a=!0,s=e}finally{try{!o&&c.return&&c.return()}finally{if(a)throw s}}A||(t.classList.add("active"),r.stopPropagation(),u.default.emit("fred-sidebar-dt-active",t,n))}),n=(0,d.dd)(),r=(0,d.fieldSet)(["fred--page_settings_form_advanced"]);return this.fredConfig.tagger.forEach(function(e){var t=new p.default(e),n=t.render();n&&r.appendChild(n)}),n.appendChild(r),e.appendChild(t),e.appendChild(n),e}},{key:"getTVFields",value:function(){var e=this,t=(0,d.dl)(),n=(0,d.dt)("fred.fe.page_settings.tvs",["fred--accordion-cog"],function(e){var i=t.parentElement.querySelectorAll("dt.active"),A=n.classList.contains("active"),o=!0,a=!1,s=void 0;try{for(var l,c=i[Symbol.iterator]();!(o=(l=c.next()).done);o=!0){var d=l.value;d.classList.remove("active")}}catch(e){a=!0,s=e}finally{try{!o&&c.return&&c.return()}finally{if(a)throw s}}A||(n.classList.add("active"),e.stopPropagation(),u.default.emit("fred-sidebar-dt-active",n,r))}),r=(0,d.dd)(),i=(0,d.fieldSet)(["fred--page_settings_form_advanced"]);return this.fredConfig.tvs.forEach(function(t){switch(t.type){case"image":i.appendChild(g.default.image(t,e.pageSettings.tvs[t.name],e.setTVWithEmitter,e.addTVChangeListener));break;case"textarea":i.appendChild(g.default.area(t,e.pageSettings.tvs[t.name],e.setTVWithEmitter,e.addTVChangeListener));break;default:i.appendChild(g.default.text(t,e.pageSettings.tvs[t.name],e.setTVWithEmitter,e.addTVChangeListener))}}),r.appendChild(i),t.appendChild(n),t.appendChild(r),t}},{key:"setSetting",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;n?(this.pageSettings[n]||(this.pageSettings[n]={}),this.pageSettings[n][e]=t):this.pageSettings[e]=t}},{key:"setSettingWithEmitter",value:function(e,t,n){this.setSetting(e,t),u.default.emit("fred-page-setting-change",e,t,n)}},{key:"addSettingChangeListener",value:function(e,t,n){var r=this;u.default.on("fred-page-setting-change",function(t,i,A){n!==A&&e.name===t&&(r.setSetting(t,i),n.value=i)})}},{key:"setTVWithEmitter",value:function(e,t,n){this.setSetting(e,t,"tvs"),u.default.emit("fred-page-setting-change","tv_"+e,t,n)}},{key:"addTVChangeListener",value:function(e,t,n){var r=this;u.default.on("fred-page-setting-change",function(i,A,o){n!==o&&"tv_"+e.name===i&&(r.setSetting(e.name,A,"tvs"),n.value=A,t.setPreview&&"function"==typeof t.setPreview&&t.setPreview(n.value))})}}]),t}(l.default);m.title="fred.fe.page_settings",m.icon="fred--sidebar_page_settings",m.expandable=!0,t.default=m,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;nr){var i=r/n.width,A=new Image;A.onload=function(){var r=document.createElement("canvas"),o=r.getContext("2d");r.width=n.width*i,r.height=n.height*i,o.drawImage(A,0,0,r.width,r.height),t.state.blueprint.generatedImage=r.toDataURL(),x.remove(),H.setPreview(t.state.blueprint.generatedImage),e.parentNode.style.display="none",e.parentNode.style.opacity=null,e.parentNode.style.zIndex=null},A.src=n.toDataURL()}else t.state.blueprint.generatedImage=n.toDataURL(),x.remove(),H.setPreview(t.state.blueprint.generatedImage),e.parentNode.style.display="none",e.parentNode.style.opacity=null,e.parentNode.style.zIndex=null}).catch(function(t){e.parentNode.style.display="none",e.parentNode.style.opacity=null,e.parentNode.style.zIndex=null,x.remove(),H.setPreview("https://via.placeholder.com/300x150/000000/FF0000?text=Generation%20Failed")})})}var k=(0,d.button)("fred.fe.blueprints.create_blueprint","fred.fe.blueprints.create_blueprint",["fred--btn-panel","fred--btn-apply"],function(){u.default.emit("fred-loading",h.default.lng("fred.fe.blueprints.creating_blueprint")),(0,E.createBlueprint)(t.state.blueprint.name,t.state.blueprint.description,t.state.blueprint.category,t.state.blueprint.rank,t.state.blueprint.public,h.default.fred.getContent(),t.state.blueprint.generatedImage,t.state.blueprint.image,!0).then(function(n){m.default.killNamespace("blueprints"),t.click().then(function(t){e.replaceWith(t),y.default.reloadContainers(),u.default.emit("fred-loading-hide")})}).catch(function(e){e.response&&e.response._fields&&(e.response._fields.name&&U.onError(e.response._fields.name),e.response._fields.category&&T.onError(e.response._fields.category),u.default.emit("fred-loading-hide"))})});w.appendChild(k),r.appendChild(w),o.classList.add("active"),A.stopPropagation(),u.default.emit("fred-sidebar-dt-active",i,n)}});n.appendChild(r),e.appendChild(i),e.appendChild(n)}},{key:"afterExpand",value:function(){y.default.reloadContainers()}}],[{key:"wrapper",value:function(e,t,n,r){var i=(0,d.figure)(["fred--thumb"]),A=(0,d.div)(),o=(0,d.img)(r,t);A.appendChild(o);var a=(0,d.figCaption)(""+t+" "+n+" "),s=(0,d.div)(["chunk"]);return s.dataset.fredBlueprintId=e,s.dataset.fredBlueprintName=t,s.setAttribute("hidden","hidden"),i.appendChild(A),i.appendChild(a),i.appendChild(s),i}}]),t}(l.default);Q.title="fred.fe.blueprints",Q.icon="fred--sidebar_blueprints",Q.expandable=!0,t.default=Q,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.isVisible=t.hide=t.show=t.render=void 0;var i=n(6),A=r(i),o=n(11),a=void 0,s=t.render=function(e,t,n,r,i){var s=function(){var n=(0,o.dl)("fred--accordion");return e.forEach(function(e){var r=new e(n);t(r)}),n},l=(0,o.img)((A.default.config.assetsUrl||"")+"images/modx-revo-icon-48.svg","MODX FRED","fred--logo");l.setAttribute("title",A.default.lng("fred.fe.close_sidebar")),l.addEventListener("click",function(e){e.preventDefault(),n()}),a=(0,o.div)(["fred--sidebar","fred--hidden"],[(0,o.div)("fred--sidebar_title",[l,(0,o.h1)("Fred")])]),a.appendChild(s());var c=(0,o.div)(["fred--sidebar_button-group"]);return c.appendChild((0,o.button)("","fred.fe.toggle_preview",["fred--btn-sidebar","fred--btn-sidebar_preview"],i)),c.appendChild((0,o.button)("","fred.fe.close_sidebar",["fred--btn-sidebar","fred--btn-sidebar_close"],n)),A.default.permission.save_document&&c.appendChild((0,o.button)("","fred.fe.save",["fred--btn-sidebar","fred--btn-sidebar_save"],r)),a.appendChild(c),a.setAttribute("aria-hidden","true"),a},l=t.show=function(){a.classList.remove("fred--hidden")},c=t.hide=function(){a.classList.add("fred--hidden")},u=t.isVisible=function(){return!a.classList.contains("fred--hidden")};t.default={render:s,show:l,hide:c,isVisible:u}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var A=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"bottom_left";i(this,e),this.position=t,this.previewMode=!1,this.hidden=!1,this.render()}return A(e,[{key:"render",value:function(){var e=this,t=(0,s.div)(["fred--launcher","fred--launcher_"+this.position]),n=(0,s.button)("","fred.fe.open_sidebar",["fred--launcher_btn","fred--launcher_btn_fred"],function(){a.default.emit("fred-sidebar-toggle")});t.appendChild(n);var r=(0,s.button)("","fred.fe.save",["fred--launcher_btn","fred--launcher_btn_save"],function(){a.default.emit("fred-save")});c.default.permission.save_document&&t.appendChild(r);var i=(0,s.button)("","fred.fe.toggle_preview",["fred--launcher_btn","fred--launcher_btn_preview"],function(){e.previewMode===!1?a.default.emit("fred-preview-on"):a.default.emit("fred-preview-off")});if(t.appendChild(i),c.default.permission.fred_elements){var A=(0,s.button)("","fred.fe.elements",["fred--launcher_btn","fred--launcher_btn_elements"],function(){a.default.emit("fred-sidebar-toggle");var e=document.querySelectorAll("dt.fred--sidebar_elements")[0];e.classList.contains("active")||e.click()});t.appendChild(A)}a.default.on("fred-sidebar-hide",function(n){n!==!0&&(e.hidden=!1,t.classList.remove("fred--hidden"))}),a.default.on("fred-sidebar-show",function(n){n!==!0&&(e.hidden=!0,t.classList.add("fred--hidden"))}),a.default.on("fred-preview-on",function(){e.previewMode=!0,t.style.zIndex="9999999999",n.style.display="none",r.style.display="none",i.classList.add("active"),e.hidden&&t.classList.remove("fred--hidden")}),a.default.on("fred-preview-off",function(){e.previewMode=!1,t.style.zIndex="",n.style.display="",r.style.display="",i.classList.remove("active"),e.hidden&&t.classList.add("fred--hidden")}),a.default.emit("fred-wrapper-insert",t)}}]),e}();t.default=u,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(15),A=r(i),o=n(14),a=r(o),s=n(16),l=r(s),c=n(18),u=r(c),d=n(36),f=r(d),p={Choices:A.default,flatpickr:a.default,ColorPicker:l.default,noUiSlider:u.default,fetch:f.default};t.default=p,e.exports=t.default},function(e,t){!function(e){var t={},n=e.prototype.stopCallback;e.prototype.stopCallback=function(e,r,i,A){return!!this.paused||!t[i]&&!t[A]&&n.call(this,e,r,i)},e.prototype.bindGlobal=function(e,n,r){if(this.bind(e,n,r),e instanceof Array)for(n=0;n