nodality
Version:
A lightweight library for declarative UI elements.
2 lines • 32.6 kB
JavaScript
/*! For license information please see image.cjs.js.LICENSE.txt */
(()=>{"use strict";var t={d:(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,s,o,a=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=s.call(r)).done)&&(a.push(i.value),a.length!==e);l=!0);}catch(t){c=!0,n=t}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw n}}return a}}(t,e)||s(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=s(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0,n=function(){};return{s:n,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw o}}}}function s(t,e){if(t){if("string"==typeof t)return o(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}function a(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,l(i.key),i)}}function l(t){var e=function(t){if("object"!=r(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:e+""}function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}function h(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,y(i.key),i)}}function y(t){var e=function(t){if("object"!=c(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==c(e)?e:e+""}function d(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(d=function(){return!!t})()}function f(t,e,r,i){var n=p(m(1&i?t.prototype:t),e,r);return 2&i&&"function"==typeof n?function(t){return n.apply(r,t)}:n}function p(){return p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var i=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=m(t)););return t}(t,e);if(i){var n=Object.getOwnPropertyDescriptor(i,e);return n.get?n.get.call(arguments.length<3?t:r):n.value}},p.apply(null,arguments)}function m(t){return m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},m(t)}function v(t,e){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},v(t,e)}t.r(e),t.d(e,{Image:()=>g});var g=function(t){function e(t,r,i,n){var s;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(s=function(t,e,r){return e=m(e),function(t,e){if(e&&("object"==c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,d()?Reflect.construct(e,r||[],m(t).constructor):e.apply(t,r))}(this,e)).url=t,s.res=null,s.code=[],s}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e)}(e,t),r=e,i=[{key:"removeQuotesFromFirstWord",value:function(t){return t.replace(/"([^"]+)":/g,"$1:")}},{key:"setType",value:function(t){t.url;var e=t.type,r=t.mode;if(this.code=[],"exact"===e){var i='new Image("'.concat(this.url,'", "exact")');this.code.push(i)}else if("uncover"===e){var n='new Image("'.concat(this.url,'", "uncover")');this.code.push(n)}else this.code.push("new Image('".concat(this.url,"')"));return this.image(this.url,r,e),this}},{key:"flexOne",value:function(){return this.res.style.flex="1",this}},{key:"hand",value:function(){return this.res.style.cursor="hand",this}},{key:"setGridWithoutCode",value:function(){return this.res.style.border="1px solid white",this}},{key:"maxWidth",value:function(t){return this.res.style.maxWidth=t,this}},{key:"getHeight",value:function(){return this.res.height}},{key:"getWidth",value:function(){return this.res.width}},{key:"getType",value:function(){return"HTMLImageElement"}},{key:"toCode",value:function(){var t=this.options;this.res.style.border&&(t.border=this.res.style.border);var e=Object.fromEntries(Object.entries(t).filter((function(t){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var i,n,s,o,a=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=s.call(r)).done)&&(a.push(i.value),a.length!==e);l=!0);}catch(t){c=!0,n=t}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw n}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return u(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t,2);return e[0],null!==e[1]})));return["new Image().set(".concat(JSON.stringify(e,null,2).replace(/"(\w+)"\s*:/g,"$1:"),")")]}},{key:"formatObj",value:function(t){return JSON.stringify(t,null,2).replace(/"(\w+)"\s*:/g,"$1:")}},{key:"set",value:function(t){var r="";this.options=t;var i=t.isFull;if(i?this.image(t.url,"exact",i,"a"):this.setup(),t.url&&this.res.setAttribute("src",t.url),"exact"===i?'new Image("'.concat(this.url,'", "exact")'):"uncover"===i&&'new Image("'.concat(this.url,'", "uncover")'),t.vtn&&(this.res.style.viewTransitionName=t.vtn),this.vtn=t.vtn,t.minHeight&&(this.res.style.minHeight=t.minHeight),t.index&&f(e,"setIndex",this,3)([t.index]),t.index&&(this.index=t.index),t.index&&(r+='\n index: "'.concat(t.index,'",')),t.centerSelf&&(this.res.style.marginRight="auto",this.res.style.marginLeft="auto"),t.fitContent&&(this.res.style.width="100%",this.res.style.height="100%",this.res.style.marginRight="auto",this.res.style.marginTop="auto",this.res.style.objectFit="cover"),t.objectFit&&(this.res.style.objectFit=t.objectFit),t.objectFit&&(r+='\n objectFit: "'.concat(t.objectFit,'",')),t.as&&this.as(t.as),t.onScroll&&this.onScroll(t.onScroll),t.class&&this.res.setAttribute("class",t.class),t.gpos&&(this.gposObject=t.gpos),t.gpos&&(this.res.style.gridColumn=t.gpos.col,this.res.style.gridRow=t.gpos.row,r+="\n gpos: ".concat(this.removeQuotesFromFirstWord(JSON.stringify(t.gpos)),", ")),t.filtera){var n;n=Array.isArray(t.filtera)?c.filtera.filter((function(t){return"filter"===t.op.name}))[0]:t.filtera;var s=this.removeQuotesFromFirstWord(JSON.stringify(n));r+="\n filtera: ".concat(s,", \n")}if(t.keySet&&this.keySet(t.keySet),t.stype&&this.setType(t.stype),t.isBackground&&(this.isBackground=t.isBackground),t.zIndex&&(this.res.style.zIndex=t.zIndex),t.zIndex&&(r+='\n zIndex: "'.concat(t.zIndex,'", \n')),t.id&&this.res.setAttribute("id",t.id),t.id&&(r+=' id: "'.concat(t.id,'", \n')),this.id=t.id,t.area&&this.setArea(t.area),t.area&&(r+='area: "'.concat(t.area,'", \n')),t.opacity&&(this.res.style.opacity=t.opacity),t.width&&(this.res.style.width=t.width),t.width&&(r+='width: "'.concat(t.width,'", ')),t.maxWidth&&(this.res.style.maxWidth=t.maxWidth),t.maxWidth&&(r+='maxWidth: "'.concat(t.maxWidth,'", ')),t.height&&(this.res.style.height=t.height),t.height&&(r+='height: "'.concat(t.height,'", ')),t.multimargin&&this.makeMultiMargin(t.multimargin),t.multimargin&&(r+="multimargin: [ \n"),t.arrayMargin&&this.arrayMargin(t.arrayMargin.sides,t.arrayMargin.value),t.multimargin){for(var o=0;o<t.multimargin.length;o++){var a=t.multimargin[o];r+='{side: "'.concat(a.side,'", value: "').concat(a.value,'"}, \n')}r+="], \n"}if(t.maxWidth&&this.maxWidth(t.maxWidth),t.maxWidth&&(r+='maxWidth: "'.concat(t.maxWidth,'", \n')),t.radius&&this.cornerRadius(t.radius),t.radius&&(r+='radius: "'.concat(t.radius,'", \n')),t.marginOp){var l=this.removeQuotesFromFirstWord(JSON.stringify(t.marginOp));r+="\n marginOp: ".concat(l,",")}t.clipPath&&this.clipPath(t.clipPath),t.clipPath&&(r+='clipPath: "'.concat(t.clipPath,'", \n'));var c=t;if(c.stroke||c.gradient||c.span||c.backgroundOp||c.layout||c.marginOp||c.shadow||c.filtera||c.animation){c.gradient,c.gradient&&(this.globalGradient=c.gradient.op.gradient),c.stroke&&f(e,"setAny",this,3)([{globalBlast:"".concat(c.stroke.op.width," ").concat(c.stroke.op.color)}]);var u=[c.stroke,c.gradient,c.animation,c.span,c.backgroundOp,c.layout,c.marginOp,c.shadow,c.filtera,c.animation];u=u.filter((function(t){return null!=t}));var h=[];for(o=0;o<u.length;o++)h.push({range:u[o].range,log:u[o].op.name,target:u[o].target,op:u[o].op});this.chainReact(h,this.options.id)}if(c.shadow){var y=c.shadow,d=this.removeQuotesFromFirstWord(JSON.stringify(y));r+="\n shadow: ".concat(d,",")}if(c.animation){var p=c.animation,m=this.removeQuotesFromFirstWord(JSON.stringify(p));r+="\n animation: ".concat(m,",")}var v="\n .set({".concat(r,"}) \n \n");return Object.keys(t).length>0?this.code.push(v):this.code.push(","),this}},{key:"setFilter",value:function(t){var e=[],r=[t];r=r.filter((function(t){return null!=t}));for(var i=0;i<r.length;i++)e.push({range:r[i].range,log:r[i].op.name,target:r[i].target})}},{key:"makeMultiMargin",value:function(t){for(var e=0;e<t.length;e++)"left"===t[e].side&&(this.res.style.marginLeft=t[e].value),"right"===t[e].side&&(this.res.style.marginRight=t[e].value),"top"===t[e].side&&(this.res.style.marginTop=t[e].value),"bottom"===t[e].side&&(this.res.style.marginBottom=t[e].value);return this}},{key:"setID",value:function(t){return this.res.setAttribute("id",t),this}},{key:"square",value:function(){return this.res.style.width="30%",this.res.style.paddingBottom="30%",this}},{key:"opacity",value:function(t){return this.res.style.opacity="".concat(t),this}},{key:"rowCol",value:function(t,e){return this.res.style.gridRow=t,this.res.style.gridColumn=e,this}},{key:"setArea",value:function(t){return this.res.style.gridArea=t,this}},{key:"setGridRow",value:function(t){return this.res.style.gridRow=t,this}},{key:"setGridCol",value:function(t){return this.res.style.gridColumn=t,this}},{key:"setGrid",value:function(){return this.res.style.gridRow="span 2",this.res.style.gridColumn="span 3",this}},{key:"transform",value:function(t){return this.res.style.transform=t,this}},{key:"offset",value:function(){return this.res.style.marginLeft="-60px",this}},{key:"offseta",value:function(){return this.res.style.marginLeft="90px",this.res.style.marginTop="-30px",this}},{key:"borderAround",value:function(t){return this.res.style.border=t,this}},{key:"setClass",value:function(t){return this.res.setAttribute("class",t),this}},{key:"scale",value:function(t){var e=this;return this.res.style.width,this.res.style.transition="0.5s all",this.res.addEventListener("mouseover",(function(){e.res.style.width,e.res.style.transform="scale(1.04)"})),this.res.addEventListener("mouseout",(function(){e.res.style.width,e.res.style.transform="scale(1.0)"})),this}},{key:"onTap",value:function(t){return this.res.addEventListener("click",t),this}},{key:"border",value:function(t){return this.res.style.borderTopLeftRadius="16px",this.res.style.borderTopRightRadius="16px",this}},{key:"allRound",value:function(t){return this.res.style.borderRadius=t,this}},{key:"mobileWidth",value:function(){return window.matchMedia("(max-device-width: 415px)").matches&&(this.res.style.width="120%"),this}},{key:"image",value:function(t,e,r,i,n){var s=window.matchMedia("(max-device-width: 415px)"),o=document.createElement("div");return o.style.viewTransitionName=i,o.style.width="100%",o.style.height=this.options.height?this.options.height:"400px",n&&(o.style.gridColumn=n.gridColumn,o.style.gridRow=n.gridRow),s.matches&&(o.style.height="500"),o.style.backgroundImage="url(".concat(t,")"),o.style.backgroundPosition="center center",o.style.backgroundRepeat="no-repeat",o.style.backgroundSize="cover","uncover"===r&&(o.style.backgroundSize="contain"),"contain"===e&&(o.style.backgroundSize="contain"),this.res=o,this}},{key:"arrayPadding",value:function(t,e){return t.includes("left")&&(this.res.style.paddingLeft=e),t.includes("right")&&(this.res.style.paddingRight=e),t.includes("top")&&(this.res.style.paddingTop=e),t.includes("bottom")&&(this.res.style.paddingBottom=e),this}},{key:"arrayMargin",value:function(t,e){return t.includes("left")&&(this.res.style.marginLeft=e),t.includes("right")&&(this.res.style.marginRight=e),t.includes("top")&&(this.res.style.marginTop=e),t.includes("bottom")&&(this.res.style.marginBottom=e),this}},{key:"setup",value:function(){var t=document.createElement("img");return t.style.width="100%",t.src=this.url,this.res=t,this}},{key:"autoW",value:function(){return this.res.style.width="initial",this}},{key:"float",value:function(t){return this.res.style.float="".concat(t),this}},{key:"fillAvailable",value:function(){return this.res.style.height="-webkit-fill-available",this}},{key:"grayscale",value:function(t){return this.res.style.filter="grayscale(".concat(t,"%)"),this}},{key:"flex",value:function(t){return this.res.style.flex=1,this}},{key:"height",value:function(t){return this.res.style.height=t,this.res.style.width="auto",this}},{key:"expand",value:function(t){var e=this,r=function(){var r,i;if(window.matchMedia("(min-width: ".concat(t.at,")")).matches){e.res.style.width="".concat(t.width);var n=window.innerWidth/2-(i=r=t.width,(r.includes("%")||r.includes("px"))&&(i=i.substr(0,2)),(r.includes("%")?Number(i/100*window.innerWidth):r.includes("px")?Number(i):void 0)/2);e.res.style.marginLeft="".concat(n,"px")}else e.res.style.width="100%",e.res.style.marginLeft="0px";window.matchMedia("(max-device-width: 415px)").matches&&(e.res.style.width="100%",e.res.style.marginLeft="0px")};return r(),window.addEventListener("resize",r),this}},{key:"width",value:function(t){return this.res.style.width=t,this.res.style.height="auto",this}},{key:"toBack",value:function(){return this.res.style.zIndex="-1",this}},{key:"margin",value:function(t,e,r,i){return(t||e||r||i)&&(this.res.style.marginLeft=t,this.res.style.marginTop=e,this.res.style.marginRight=r,this.res.style.marginBottom=i),e||r||i||0===e&&0===r&&0===i||(this.res.style.margin=t),this}},{key:"padding",value:function(t){return this.res.style.padding=t,this}},{key:"size",value:function(t,e){return t&&e?(this.res.style.width=t,this.res.style.height=e):(this.res.style.width=t,this.res.style.height=t),this}},{key:"frame",value:function(t){var e=t.width,r=t.height;return e&&r?(this.res.style.width=e,this.res.style.height=r):(this.res.style.width=e,this.res.style.height=e),this}},{key:"RSize",value:function(t,e,r){var i=window.matchMedia("(max-device-width: 420px)");return t&&e?(this.res.style.width=i.matches?t*r:t,this.res.style.height=i.matches?e*r:e):(this.res.style.width=i.matches?t*r:t,this.res.style.height=i.matches?t*r:t),this}},{key:"shadow",value:function(t){return"mild"===t.type?this.res.style.boxShadow="0px 3px 15px rgba(0,0,0,0.2)":this.res.style.boxShadow="".concat(t.x,"px ").concat(t.y,"px ").concat(t.radius,"px ").concat(t.color),this}},{key:"clipShape",value:function(t){return this.res.style.borderRadius="50%",this}},{key:"cornerRadius",value:function(t){return this.res.style.borderRadius=t,this}},{key:"clipPath",value:function(t){this.res.style.clipPath='path("'.concat(t,'")');var e=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.style.display="block",e.style.width="100%",e.style.height="100%",e.style.overflow="visible",this}},{key:"render",value:function(t){var e=this.res;if(!t)return e;document.querySelector(t).appendChild(e)}}],i&&h(r.prototype,i),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,i}(function(){return t=function t(){var e,r,i,n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=this,i=function(t){if(console.log("LOBJO IS"),console.log(t),t.transform||t.op&&t.op.transform){var e=t.transform;t.transform||(e=t.op.transform),e.duration||(e.duration="3s-ease-in-out"),n.setDefault=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"0px";return 0===t.length?e+" ":t};var r=function(){var r="",i="",s="",o="",a="",l="",c="",u="",h="";if(0!==e.values.length){e.values.forEach((function(t){t.startsWith("tx:")&&(r=t.replace("tx:","")),t.startsWith("ty:")&&(i=t.replace("ty:","")),t.startsWith("tz:")?s=t.replace("tz:",""):t.startsWith("scale(")?o=t:t.startsWith("skew(")?a=t:t.startsWith("rotate(")?l=function(t){var e=t.match(/rotate\(([^)]+)\)/);if(!e)return t;var r=e[1].split(",").map((function(t){return t.trim()}));return 1===r.length?"rotate(".concat(r[0],")"):2===r.length?"rotateX(".concat(r[0],") rotateY(").concat(r[1],")"):3===r.length?"rotateX(".concat(r[0],") rotateY(").concat(r[1],") rotate(").concat(r[2],")"):t}(t):t.startsWith("perspective(")?c=t:t.startsWith("matrix(")?u=t:t.startsWith("opacity:")&&(h=t.replace("opacity:",""))})),r=n.setDefault(r),i=n.setDefault(i),s=n.setDefault(s);var y="";if("0px"!=i&&"0px"!=r&&"0px"!=s?y+="translate3d(".concat(r,", ").concat(i,", ").concat(s,")"):"0px"==i&&"0px"==r||(y+="translate(".concat(r,", ").concat(i,")")),o&&(y+=" ".concat(o)),l&&(y+=" ".concat(l)),a&&(y+=" ".concat(a)),c&&(y+=" ".concat(c)),u&&(y+=" ".concat(u)),y){if(t.op.transform.duration){var d=t.op.transform.duration.replace(/^(\d+)(s)-/,(function(t,e,r){return e/2+r+" "})),f="transform ".concat(d,", opacity ").concat(d);n.res.style.transition=f}else n.res.style.transition="transform 3s ease-in-out, opacity 3s ease-in-out";t.op.transform.static&&(n.res.style.transition=""),(n.blastTarget||n.res).style.transform=y,n.res.style.opacity=h}else alert("OPE")}};e.on?n.res.addEventListener(e.on,(function(){e.delay?setTimeout((function(){r()}),e.delay):r()})):window.addEventListener("load",(function(){e.delay?setTimeout((function(){r()}),e.delay):r()}));var i=function(){var t="";e.values.forEach((function(e){e.startsWith("tx:")?t+="translateX(0) ":e.startsWith("ty:")?t+="translateY(0) ":e.startsWith("tz:")?t+="translateZ(0) ":e.startsWith("scale(")?t+="scale(1) ":e.startsWith("skew(")?t+="skew(0, 0) ":e.startsWith("rotate(")?t+="rotate(0) ":e.startsWith("perspective(")?t+="perspective(0) ":e.startsWith("matrix(")&&(t+="matrix(1, 0, 0, 1, 0, 0) "),n.res.style.opacity="1"})),t&&(n.res.style.transform=t.trim())};if(e.on)n.res.addEventListener("mouseout",(function(){e.keep||i()}));else{var s=1e3*parseFloat(e.duration),o=e.closeAfter?e.closeAfter:0;setTimeout((function(){e.keep||i()}),s/2+o)}e.hardCSS&&(n.res.style.transform=e.hardCSS)}else alert("THIS FIRE WITH GRADIENT (invalid block"),console.log("INVALID BLOCKA"),console.log(t)},(r=l(r="reactOnTransform"))in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,this.state={isExpanded:!1,isMovedUp:!1,isMovedDown:!1}},e=[{key:"keySet",value:function(t){return this.temporaryVal=1,this.res.style[t.key]=t.value,this}},{key:"onScroll",value:function(t){var e=this;"opacity"===t.value?this.res.style.opacity=t.valMin:"scale"===t.value&&(this.res.style.transform="scale(".concat(t.valMax,")")),window.addEventListener("scroll",(function(){var r=e.smartRange(window.scrollY,{min:t.from,max:t.to},{min:t.valMin,max:t.valMax});"opacity"===t.value?e.res.style.opacity=r:"scale"===t.value&&(e.res.style.transform="scale(".concat(r,")"))}))}},{key:"setAny",value:function(t){this[Object.keys(t)[0]]=[Object.values(t)[0]]}},{key:"setID",value:function(t){this.id=t}},{key:"setPrevText",value:function(t){this.prevText=t}},{key:"getCSS",value:function(){return this.css}},{key:"getPX",value:function(t){return{xs:"0px",sm:"576px",md:"768px",lg:"992px",xl:"1200px",xxl:"1400px",mxxl:"1800px"}[t]||"Invalid breakpoint"}},{key:"respad",value:function(t){var e=this,r=function(){e.pad(t[0].values);for(var r=0;r<t.length;r++){var i=t[r].breakpoint;window.matchMedia("(min-width: ".concat(e.getPX(i))).matches&&e.pad(t[r].values)}};window.addEventListener("resize",r),r()}},{key:"resmar",value:function(t){var e=this,r=function(){e.mar(t[0].values);for(var r=0;r<t.length;r++){var i=t[r].breakpoint;window.matchMedia("(max-width: ".concat(e.getPX(i))).matches&&e.mar(t[r].values)}};window.addEventListener("resize",r),r()}},{key:"resprop",value:function(t){var e=this;console.log("RES STYLE"),console.log(t),this.prevStyles={};for(var r=0;r<this.res.style.length;r++){var i=this.res.style[r];this.prevStyles[i]=this.res.style[i],console.log("kio")}var n=function(){for(var r in e.prevStyles)e.res.style[r]=e.prevStyles[r];console.log("mkio");for(var i=0;i<t.length;i++){var n=t[i].breakpoint,s="(max-width: ".concat(n,")");if(console.log("testing media query:",s,window.matchMedia(s).matches),window.matchMedia(s).matches)for(var o in t[i])"breakpoint"!==o&&(console.log("ukio"),e.res.style[o]=t[i][o])}};window.addEventListener("resize",n),n()}},{key:"isNumber",value:function(t){return"number"==typeof t&&!isNaN(t)}},{key:"pad",value:function(t){for(var e=0;e<t.length;e++)for(var r=Object.keys(t[e]),i=0;i<r.length;i++)for(var n=r[i],s=t[e][n],o=0;o<n.length;o++)switch(n[o]){case"a":this.res.style.padding=this.isNumber(s)?"".concat(s,"px"):s;break;case"t":this.res.style.paddingTop=this.isNumber(s)?"".concat(s,"px"):s;break;case"l":this.res.style.paddingLeft=this.isNumber(s)?"".concat(s,"px"):s;break;case"r":this.res.style.paddingRight=this.isNumber(s)?"".concat(s,"px"):s;break;case"b":this.res.style.paddingBottom=this.isNumber(s)?"".concat(s,"px"):s}return this}},{key:"as",value:function(t){return this.res.style.alignSelf=t,this}},{key:"mar",value:function(t){for(var e=0;e<t.length;e++)for(var r=Object.keys(t[e]),i=0;i<r.length;i++)for(var n=r[i],s=t[e][n],o=0;o<n.length;o++){switch(n[o]){case"a":this.res.style.margin=this.isNumber(s)?"".concat(s,"px"):s;break;case"t":this.res.style.marginTop=this.isNumber(s)?"".concat(s,"px"):s;break;case"l":this.res.style.marginLeft=this.isNumber(s)?"".concat(s,"px"):s;break;case"r":this.res.style.marginRight=this.isNumber(s)?"".concat(s,"px"):s;break;case"b":this.res.style.marginBottom=this.isNumber(s)?"".concat(s,"px"):s}"auto"===n[o]&&(this.res.style.marginLeft="auto",this.res.style.marginRight="auto")}return this}},{key:"smartRange",value:function(t,e,r){t<e.min&&(t=e.min),t>e.max&&(t=e.max);var i=(t-e.min)/(e.max-e.min);e.min>e.max&&(i=(t-e.max)/(e.min-e.max));var n=(r.min-r.max)*i-r.min;if(n=Math.abs(n),r.min<r.max){var s=(r.max+Math.abs(r.min))*i;n=r.min+s}return n}},{key:"gpos",value:function(t){return this.res.style.gridColumn=t.col,this.res.style.gridRow=t.row,this}},{key:"fluidCopy",value:function(t){if(t instanceof Object){this.prevStylex=this.res.style,this.res=document.createElement("h1"),this.res.style.cssText=this.prevStylex.cssText;var e=document.createTextNode(this.text);return this.res.appendChild(e),this.res.style.fontSize=t.exact,this}if("S1"===t){this.prevStylex=this.res.style,this.res=document.createElement("h1"),this.res.style.cssText=this.prevStylex.cssText;var r=document.createTextNode(this.text);this.res.appendChild(r),this.res.style.fontSize="calc(1.625rem + 5.075vw)"}if("S2"===t){this.prevStylex=this.res.style,this.res=document.createElement("h2"),this.res.style.cssText=this.prevStylex.cssText;var i=document.createTextNode(this.text);this.res.appendChild(i),this.res.style.fontSize="calc(1.500rem + 4.3vw)"}if("S3"===t){this.prevStylex=this.res.style,this.res=document.createElement("h3"),this.res.style.cssText=this.prevStylex.cssText;var n=document.createTextNode(this.text);this.res.appendChild(n),this.res.style.fontSize="calc(1.375rem + 3.525vw)"}if("S4"===t){this.prevStylex=this.res.style,this.res=document.createElement("h4"),this.res.style.cssText=this.prevStylex.cssText;var s=document.createTextNode(this.text);this.res.appendChild(s),this.res.style.fontSize="calc(1.250rem + 2.75vw)"}if("S5"===t){this.prevStylex=this.res.style,this.res=document.createElement("h5"),this.res.style.cssText=this.prevStylex.cssText;var o=document.createTextNode(this.text);this.res.appendChild(o),this.res.style.fontSize="calc(1.125rem + 1.975vw)"}return"S6"===t&&(this.res.style.fontSize="calc(1rem + 0.5vw)"),this}},{key:"setIndex",value:function(t){this.index=t}},{key:"borderObj",value:function(t){var e,r=null!==(e=t.type)&&void 0!==e?e:"solid";return this.res.style.border="".concat(t.width," ").concat(r," ").concat(t.color),this.res.style.borderRadius=t.radius,this}},{key:"setPref",value:function(t){this.preffersId=t}},{key:"setClass",value:function(t){this.class=t}},{key:"setTags",value:function(t){this.openTag=t.open,this.closeTag=t.close,console.log("TAGS SET"),console.log(t)}},{key:"chainReact",value:function(t,e,r){var s=this;console.log("0P"),this.ap=!1,this.cta=0,this.once=!1;var o,a=n(t);try{for(a.s();!(o=a.n()).done;){var l=o.value;l.range||(l.range=["0px","999999px"])}}catch(t){a.e(t)}finally{a.f()}t.sort((function(t,e){return parseInt(t.range[0])-parseInt(e.range[0])}));var c=function(o){var a=window.visualViewport.width,l=[],c=[];s.resCopy=s.res,s.storedQueries=t.map((function(t){return t.target})).filter((function(t){return null!=t}));var u,h=n(t);try{for(h.s();!(u=h.n()).done;){var y=u.value;s.counterIndex++;var d=i(y.range,2),f=d[0],p=d[1],m=parseInt(f),v=parseInt(p),g=!0;if(y.target){g=!1;for(var b=0;b<y.target.length;b++)y.target[b]===e&&(g=!0)}a>=m&&a<=v&&g&&(l.push(y.log),c.push(y),y.op&&y.op.margin&&(s.useMargin=y.op.margin))}}catch(t){h.e(t)}finally{h.f()}if(r&&!r.includes("background")&&(s.res.style.background="",s.res.style.backgroundColor=""),s.res.style.textShadow="",r&&!r.includes("border")&&(s.res.style.border=""),r&&!r.includes("margin")&&(s.res.style.margin=""),s.res.style["-webkit-text-fill-color"]="",s.res.style["-webkit-text-stroke-color"]="",s.res.style["-webkit-text-stroke-width"]="",s.res.style.filter="",s.options.background&&(console.log(s.options.background),s.res.style.background=s.options.background),l.includes("gradient"),(l.includes("gradient")||l.includes("shadow"))&&(s.res.style.position="relative"),l.includes("blast")){var w,x=c.filter((function(t){return"blast"===t.log}))[0].op.color,k=null!==(w=c.filter((function(t){return"blast"===t.log}))[0].op.width)&&void 0!==w?w:"1px";"FlexRowLayoutElement"===s.getType()||"LayoutWrapperElement"===s.getType()?(s.res.style.border="".concat("number"==typeof k?k+"px":k," solid orange"),s.res.style.display="inline-block","FlexRowLayoutElement"===s.getType()&&(s.res.style.display="flex"),s.res.style.boxSizing="border-box",s.res.style.transformOrigin="center",s.blastTarget=s.res):(s.text&&(s.res.textContent=s.text),s.res.style["-webkit-text-fill-color"]="transparent",s.res.style["-webkit-text-stroke-color"]=x,s.res.style["-webkit-text-stroke-width"]="".concat(k))}if(l.includes("filter")){var S=c.filter((function(t){return"filter"===t.log}))[0].op.filter;s.res.style.filter=S}if(l.includes("background")&&(s.res.style.backgroundColor="green"),l.includes("gradient")&&("LayoutWrapperElement"!==s.getType()&&"FlexRowLayoutElement"!==s.getType()&&(s.res.style["-webkit-text-fill-color"]="transparent"),s.res.style.background=s.globalGradient,"LayoutWrapperElement"!==s.getType()&&"FlexRowLayoutElement"!==s.getType()&&(s.res.style["background-clip"]="text")),l.includes("shadow")){var T,O="",E=0;for(b=0;b<s.options.shadow.op.steps;b++){var W;O+="drop-shadow(".concat(E+=3,"px ").concat(E,"px ").concat(E,"px ").concat(null!==(W=s.options.shadow.color)&&void 0!==W?W:"gray",") ")}"FlexRowLayoutElement"===s.getType()||"LayoutWrapperElement"===s.getType()?s.res.style.boxShadow="".concat(E,"px ").concat(E,"px ").concat(E,"px ").concat(null!==(T=s.options.shadow.color)&&void 0!==T?T:"gray"):s.res.style.filter=O}if(l.includes("margin"))for(b=0;b<t.length;b++)if(t[b].op){var j=t[b].op.offsets;j&&void 0!==s.index&&(s.res.style.margin=j[Number(s.index)]+"px")}if(l.includes("spana")||l.includes("span")){if(s.res=s.resCopy,s.options.span){var R;for(R=Array.isArray(s.options.span)?s.options.span.filter((function(t){return"span"===t.op.name}))[0]:s.options.span,s.res.textContent="",b=0;b<R.op.parts.length;b++){var L=R.op.parts[b].style,A=new s.constructor(R.op.parts[b].text).setup({type:"span"}).set(L).render();s.res.appendChild(A)}}}else{var I=new s.constructor(s.prevText).set({}).render();s.prevText&&s.prevText.length>0&&o&&s.res.appendChild(I)}if(l.includes("animation")){if(s.options.animation&&!s.hasAnimated&&!s.options.animation.op.fireAt){console.warn(s.openTag),s.hasAnimated=!0;var C=s.options.animation.op;window.addEventListener("sidebar:open",(function(){s.res.animate(C.keyframesOpen,C.openOptions)})),window.addEventListener("sidebar:closed",(function(){s.res.animate(C.keyframesClose,C.closeOptions)})),s.res.animate(C.keyframesClose,{duration:0,fill:"forwards"}),s.openTag&&s.closeTag&&(window.addEventListener(s.openTag,(function(){s.res.animate(C.keyframesOpen,C.openOptions)})),window.addEventListener(s.closeTag,(function(){s.res.animate(C.keyframesClose,C.closeOptions)})))}if(s.options.animation&&s.options.animation.op.fireAt&&s.options.animation.op.fireAt.endsWith("px")){var P=s.options.animation.op;s.res.animate(P.keyframesClose,{duration:0,fill:"forwards"});var N=function(){window.scrollY>parseFloat(P.fireAt)&&(s.res.animate(P.keyframesOpen,P.openOptions),window.removeEventListener("scroll",N))};window.addEventListener("scroll",N)}if(s.options.animation&&s.options.animation.op.fireAt&&"inview"===s.options.animation.op.fireAt){var M=s.options.animation.op;s.res.animate(M.keyframesClose,{duration:0,fill:"forwards"}),new IntersectionObserver((function(t,e){t.forEach((function(t){t.isIntersecting&&(s.res.animate(M.keyframesOpen,M.openOptions),e.disconnect())}))})).observe(s.res)}}};this.options.animation||window.addEventListener("resize",(function(){return c()})),c()}},{key:"maxWidth",value:function(t){return this.res.style.maxWidth=t,this}},{key:"removeQuotesFromFirstWord",value:function(t){return t.replace(/"([^"]+)":/g,"$1:")}},{key:"arrayMargin",value:function(t,e){return t.includes("left")&&(this.res.style.marginLeft=e),t.includes("right")&&(this.res.style.marginRight=e),t.includes("top")&&(this.res.style.marginTop=e),t.includes("bottom")&&(this.res.style.marginBottom=e),t.includes("all")&&(this.res.style.margin=e),e||(this.res.style.marginBottom=t),this}}],e&&a(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}());module.exports=e})();