@creaditor/newsletter-starterkit 1.0.46 → 1.0.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1013,4 +1013,4 @@ max-height: 90vh;max-width:500px;"
1013
1013
  .dropdown-button {
1014
1014
  min-width: 100px;
1015
1015
  }
1016
- `,customElements.define("cdtr-font-family-editor",n)},74726(t,e,r){function a(t){try{return function(t){const e=t.split(/ (?![^(]*\))/);let r="",a=0,o=0,i=0,n=0,s=!1;for(let t of e)t=t.trim(),"inset"===t?s=!0:t.endsWith("px")||t.endsWith("em")?0===o?o=parseFloat(t):0===a?a=parseFloat(t):0===i?i=parseFloat(t):0===n&&(n=parseFloat(t)):(t.includes("rgb")||t.includes("#"))&&(r=t);return[{color:r,offsetY:a,offsetX:o,blurRadius:i,spreadRadius:n,inset:s}]}(t)}catch(t){console.error(t)}}r.d(e,{A:()=>a})},13681(t,e,r){r.d(e,{vP:()=>c});const a=window.cdtrSignalKey||`___${Math.random().toString(36).substr(2,9)}`;window.cdtrSignalKey=a,window[a]||(window[a]={});const o=window[a],i=window.__cdtrEvents||{};function n(t){return crypto.subtle.digest("SHA-256",(new TextEncoder).encode(t)).then(t=>Array.from(new Uint8Array(t)).map(t=>t.toString(16).padStart(2,"0")).join(""))}function s(t){if(t.length%2!=0)throw new Error("Invalid hex string");const e=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)e[r/2]=parseInt(t.substr(r,2),16);return e}async function l(t){const e=await n(t),r=o[e];if(r){const t=await crypto.subtle.importKey("raw",s(e),{name:"AES-GCM"},!1,["encrypt","decrypt"]),a=await async function(t,e,r){const a=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return(new TextDecoder).decode(a)}(t,r.iv,r.encrypted);return JSON.parse(a)}return null}function d(t,e){if(i[t])for(const r in i[t])Object.prototype.hasOwnProperty.call(i[t],r)&&i[t][r].forEach(t=>t(e));Array.isArray(i["*"])&&i["*"].forEach(t=>t(e))}window.__cdtrEvents=i;const c={set:async function(t,e){const r=JSON.parse(JSON.stringify(e)),a=await n(t),l=await crypto.subtle.importKey("raw",s(a),{name:"AES-GCM"},!1,["encrypt","decrypt"]),c=await async function(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),a=(new TextEncoder).encode(e),o=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,a);return{iv:r,encrypted:new Uint8Array(o)}}(l,JSON.stringify(r));o[a]=c,i.set&&i.set[a]&&i.set[a].forEach(t=>t(r)),Array.isArray(i["*"])&&i["*"].forEach(t=>t(r)),d(t,r)},get:l,remove:async function(t){const e=await n(t);delete o[e]},on:async function(t,e,r){i[t]||(i[t]={});const a=await n(e);i[t][a]||(i[t][a]=[]),i[t][a].push(t=>{!function(){const t=(new Error).stack;if(t&&t.indexOf(" at <anonymous>:1")>-1)throw console.warn("Function call blocked: Detected console execution."),new Error("Function call blocked: Detected console execution.")}(),r(t)});const o=await l(e);return o&&r(o),a},off:function(t,e){i[t]&&i[t][e]&&delete i[t][e]},dispatch:d,OPTIONS:{SET:"set"}}},88385(t,e,r){r.d(e,{A:()=>s});const a=t=>!(!t||!t.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/)),o=t=>!(!t||!t.replace("-","").match(/^[+]*[(]{0,1}[0-9]{9,9}[)]{0,1}[-\s\./0-9]*$/g)&&!t.match(/[0-9]{3}-[0-9]{3}-[0-9]{4}/));function i(t){const e={},r=/([^&=]+)=?([^&]*)/g,a=t=>{try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t.replace(/\+/g," ")}},o=t.indexOf("?");let i,n=-1!==o?t.substring(o+1):"";for(;null!==(i=r.exec(n));){const t=a(i[1]),r=a(i[2]);t&&(e[t]=r)}return e}function n(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],encodeURIComponent(e).replace(/%24/g,"$")}class s{static getProtocol(t){if(!t)return"";const e=t.indexOf(":");return e>0?t.slice(0,e):""}constructor(t,e){this.protocol="",this.href="",this.fullHref="",this.target="_self",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.url="",this.isValid=!0,this.params={},"string"==typeof t?this.href=t:t&&"object"==typeof t&&Object.assign(this,t),this.isValid=this.isValidUrl(this.href),this.protocol=e?.protocol??s.getProtocol(this.href);const r=function(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],e}(this.href);if(this.isEmail=a(r),this.isPhone=o(r),this.protocol||(this.isEmail?this.protocol="mailto:":this.isPhone?this.protocol="tel:":this.isValid&&(this.protocol="https:")),this.isAnchor=this.href.startsWith("#"),e?.target){if(!["_blank","_self","_parent","_top"].includes(e.target))throw new Error(`Url: invalid target "${e.target}"`);this.target=e.target}this.params={...this.params,...e?.params,...i(this.href)},this.url=n(this.href),this.protocol&&!this.protocol.endsWith(":")&&(this.protocol+=":");const l="http:"===this.protocol||"https:"===this.protocol;this.href=l?`${this.protocol}//${this.url}`:this.protocol+this.url,this.fullHref=this.getUrlWithParams(),this.href=this.getUrlWithParams()}addParam(t,e){this.href=this.href.replace(new RegExp(`${t}=[^&]*`),`${t}=${e}`),this.params[t]=e}getUrlWithParams(){let t,e="";try{t=decodeURIComponent(this.url)}catch(e){t=this.url}if(Object.keys(this.params).length>0){t+="?",e="?";for(const r in this.params){const a=this.params[r],o=encodeURIComponent(r).replace(/%24/g,"$");if(a){const r=encodeURIComponent(a).replace(/%24/g,"$");t+=`${o}=${r}&`,e+=`${o}=${r}&`}else t+=`${o}&`,e+=`${o}&`}t=t.slice(0,-1)}const r=t=>{try{return decodeURIComponent(t)}catch{return t}};if(this.protocol&&("http:"===this.protocol||"https:"===this.protocol))return r(this.protocol+"//"+t);if("whatsapp:"===this.protocol){const a=this.extractPhoneFromTextUsingRegex(t);return a.length>0?r("https://wa.me/"+a[0]+e):r("https://wa.me/"+e)}return r(this.protocol+t)}extractPhoneFromTextUsingRegex(t){if(!t)return[];const e=[...t.matchAll(/(?:whatsapp:([^?\s]+)|\+?[\d\s\-\(\)\.]{7,20})/g)];return Array.from(new Set(e.map(t=>t[1]||t[0]).filter(t=>{const e=t.replace(/\D/g,"");return e.length>=7&&e.length<=15}).map(t=>t.trim())))}isValidUrl(t){if(!t)return!1;return/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\/.*)?$/.test(t)}}s.resetURL=n},50742(t,e,r){r.d(e,{P:()=>a});const a=[{rule:"rgba(149, 157, 165, 0.2) 0px 8px 24px;"},{rule:"rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;"},{rule:"rgba(0, 0, 0, 0.15) 1.95px 1.95px 2.6px;"},{rule:"rgba(0, 0, 0, 0.35) 0px 5px 15px;"},{rule:"rgba(0, 0, 0, 0.16) 0px 1px 4px;"},{rule:"rgba(0, 0, 0, 0.24) 0px 3px 8px;"},{rule:"rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;"},{rule:"rgba(0, 0, 0, 0.16) 0px 1px 4px, rgb(51, 51, 51) 0px 0px 0px 3px;"},{rule:"rgba(0, 0, 0, 0.02) 0px 1px 3px 0px, rgba(27, 31, 35, 0.15) 0px 0px 0px 1px;"},{rule:"rgba(0, 0, 0, 0.1) 0px 4px 12px;"},{rule:"rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px;"},{rule:"rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;"},{rule:"rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;"},{rule:"rgba(0, 0, 0, 0.16) 0px 10px 36px 0px, rgba(0, 0, 0, 0.06) 0px 0px 0px 1px;"},{rule:"rgba(17, 12, 46, 0.15) 0px 48px 100px 0px;"},{rule:"rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px, rgba(10, 37, 64, 0.35) 0px -2px 6px 0px inset;"},{rule:"rgba(255, 255, 255, 0.1) 0px 1px 1px 0px inset, rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px;"},{rule:"rgba(0, 0, 0, 0.16) 0px 10px 36px 0px, rgba(0, 0, 0, 0.06) 0px 0px 0px 1px;"},{rule:"rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px;"},{rule:"rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;"},{rule:"rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;"},{rule:"rgb(38, 57, 77) 0px 20px 30px -10px;"},{rule:"rgba(6, 24, 44, 0.4) 0px 0px 0px 2px, rgba(6, 24, 44, 0.65) 0px 4px 6px -1px, rgba(255, 255, 255, 0.08) 0px 1px 0px inset;"},{rule:"rgba(50, 50, 93, 0.25) 0px 6px 12px -2px, rgba(0, 0, 0, 0.3) 0px 3px 7px -3px;"},{rule:"rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;"},{rule:"rgba(50, 50, 93, 0.25) 0px 30px 60px -12px, rgba(0, 0, 0, 0.3) 0px 18px 36px -18px;"},{rule:"rgba(50, 50, 93, 0.25) 0px 30px 60px -12px inset, rgba(0, 0, 0, 0.3) 0px 18px 36px -18px inset;"},{rule:"rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px;"},{rule:"rgba(0, 0, 0, 0.12) 0px 1px 3px, rgba(0, 0, 0, 0.24) 0px 1px 2px;"},{rule:"rgba(0, 0, 0, 0.16) 0px 3px 6px, rgba(0, 0, 0, 0.23) 0px 3px 6px;"},{rule:"rgba(0, 0, 0, 0.19) 0px 10px 20px, rgba(0, 0, 0, 0.23) 0px 6px 6px;"},{rule:"rgba(0, 0, 0, 0.25) 0px 14px 28px, rgba(0, 0, 0, 0.22) 0px 10px 10px;"},{rule:"rgba(0, 0, 0, 0.3) 0px 19px 38px, rgba(0, 0, 0, 0.22) 0px 15px 12px;"},{rule:"rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;"},{rule:"rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 1px 3px 1px;"},{rule:"rgba(0, 0, 0, 0.05) 0px 0px 0px 1px;"},{rule:"rgba(0, 0, 0, 0.05) 0px 1px 2px 0px;"},{rule:"rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px;"},{rule:"rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.06) 0px 2px 4px -1px;"},{rule:"rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;"},{rule:"rgba(0, 0, 0, 0.1) 0px 20px 25px -5px, rgba(0, 0, 0, 0.04) 0px 10px 10px -5px;"},{rule:"rgba(0, 0, 0, 0.25) 0px 25px 50px -12px;"},{rule:"rgba(0, 0, 0, 0.06) 0px 2px 4px 0px inset;"},{rule:"rgba(0, 0, 0, 0.1) 0px 0px 5px 0px, rgba(0, 0, 0, 0.1) 0px 0px 1px 0px;"},{rule:"rgba(0, 0, 0, 0.07) 0px 1px 2px, rgba(0, 0, 0, 0.07) 0px 2px 4px, rgba(0, 0, 0, 0.07) 0px 4px 8px, rgba(0, 0, 0, 0.07) 0px 8px 16px, rgba(0, 0, 0, 0.07) 0px 16px 32px, rgba(0, 0, 0, 0.07) 0px 32px 64px;"},{rule:"rgba(0, 0, 0, 0.09) 0px 2px 1px, rgba(0, 0, 0, 0.09) 0px 4px 2px, rgba(0, 0, 0, 0.09) 0px 8px 4px, rgba(0, 0, 0, 0.09) 0px 16px 8px, rgba(0, 0, 0, 0.09) 0px 32px 16px;"},{rule:"rgba(0, 0, 0, 0.2) 0px 18px 50px -10px;"},{rule:"rgba(0, 0, 0, 0.1) 0px 10px 50px;"},{rule:"rgba(240, 46, 170, 0.4) -5px 5px, rgba(240, 46, 170, 0.3) -10px 10px, rgba(240, 46, 170, 0.2) -15px 15px, rgba(240, 46, 170, 0.1) -20px 20px, rgba(240, 46, 170, 0.05) -25px 25px;"},{rule:"rgba(240, 46, 170, 0.4) 0px 5px, rgba(240, 46, 170, 0.3) 0px 10px, rgba(240, 46, 170, 0.2) 0px 15px, rgba(240, 46, 170, 0.1) 0px 20px, rgba(240, 46, 170, 0.05) 0px 25px;"},{rule:"rgba(240, 46, 170, 0.4) 5px 5px, rgba(240, 46, 170, 0.3) 10px 10px, rgba(240, 46, 170, 0.2) 15px 15px, rgba(240, 46, 170, 0.1) 20px 20px, rgba(240, 46, 170, 0.05) 25px 25px;"}]}}]);
1016
+ `,customElements.define("cdtr-font-family-editor",n)},74726(t,e,r){function a(t){try{return function(t){const e=t.split(/ (?![^(]*\))/);let r="",a=0,o=0,i=0,n=0,s=!1;for(let t of e)t=t.trim(),"inset"===t?s=!0:t.endsWith("px")||t.endsWith("em")?0===o?o=parseFloat(t):0===a?a=parseFloat(t):0===i?i=parseFloat(t):0===n&&(n=parseFloat(t)):(t.includes("rgb")||t.includes("#"))&&(r=t);return[{color:r,offsetY:a,offsetX:o,blurRadius:i,spreadRadius:n,inset:s}]}(t)}catch(t){console.error(t)}}r.d(e,{A:()=>a})},13681(t,e,r){r.d(e,{vP:()=>c});const a=window.cdtrSignalKey||`___${Math.random().toString(36).substr(2,9)}`;window.cdtrSignalKey=a,window[a]||(window[a]={});const o=window[a],i=window.__cdtrEvents||{};function n(t){return crypto.subtle.digest("SHA-256",(new TextEncoder).encode(t)).then(t=>Array.from(new Uint8Array(t)).map(t=>t.toString(16).padStart(2,"0")).join(""))}function s(t){if(t.length%2!=0)throw new Error("Invalid hex string");const e=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)e[r/2]=parseInt(t.substr(r,2),16);return e}async function l(t){const e=await n(t),r=o[e];if(r){const t=await crypto.subtle.importKey("raw",s(e),{name:"AES-GCM"},!1,["encrypt","decrypt"]),a=await async function(t,e,r){const a=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,r);return(new TextDecoder).decode(a)}(t,r.iv,r.encrypted);return JSON.parse(a)}return null}function d(t,e){if(i[t])for(const r in i[t])Object.prototype.hasOwnProperty.call(i[t],r)&&i[t][r].forEach(t=>t(e));Array.isArray(i["*"])&&i["*"].forEach(t=>t(e))}window.__cdtrEvents=i;const c={set:async function(t,e){const r=JSON.parse(JSON.stringify(e)),a=await n(t),l=await crypto.subtle.importKey("raw",s(a),{name:"AES-GCM"},!1,["encrypt","decrypt"]),c=await async function(t,e){const r=crypto.getRandomValues(new Uint8Array(12)),a=(new TextEncoder).encode(e),o=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},t,a);return{iv:r,encrypted:new Uint8Array(o)}}(l,JSON.stringify(r));o[a]=c,i.set&&i.set[a]&&i.set[a].forEach(t=>t(r)),Array.isArray(i["*"])&&i["*"].forEach(t=>t(r)),d(t,r)},get:l,remove:async function(t){const e=await n(t);delete o[e]},on:async function(t,e,r){i[t]||(i[t]={});const a=await n(e);i[t][a]||(i[t][a]=[]),i[t][a].push(t=>{!function(){const t=(new Error).stack;if(t&&t.indexOf(" at <anonymous>:1")>-1)throw console.warn("Function call blocked: Detected console execution."),new Error("Function call blocked: Detected console execution.")}(),r(t)});const o=await l(e);return o&&r(o),a},off:function(t,e){i[t]&&i[t][e]&&delete i[t][e]},dispatch:d,OPTIONS:{SET:"set"}}},88385(t,e,r){r.d(e,{A:()=>s});const a=t=>!(!t||!t.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/)),o=t=>!(!t||!t.replace("-","").match(/^[+]*[(]{0,1}[0-9]{9,9}[)]{0,1}[-\s\./0-9]*$/g)&&!t.match(/[0-9]{3}-[0-9]{3}-[0-9]{4}/));function i(t){const e={},r=/([^&=]+)=?([^&]*)/g,a=t=>{try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t.replace(/\+/g," ")}},o=t.indexOf("?");let i,n=-1!==o?t.substring(o+1):"";for(;null!==(i=r.exec(n));){const t=a(i[1]),r=a(i[2]);t&&(e[t]=r)}return e}function n(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],encodeURIComponent(e).replace(/%24/g,"$")}class s{static getProtocol(t){if(!t)return"";const e=t.indexOf(":");return e>0?t.slice(0,e):""}constructor(t,e){if(this.protocol="",this.href="",this.fullHref="",this.target="_self",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.url="",this.isValid=!0,this.params={},"string"==typeof t?this.href=t:t&&"object"==typeof t&&Object.assign(this,t),/^\[\[[^\]]+\]\]\?/.test(this.href)){const t=this.href;this.isValid=!1,this.protocol=e?.protocol??"",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.params={...this.params,...e?.params,...i(t)};const r=t.indexOf("?");return this.url=r>-1?t.slice(0,r):t,this.href=t,void(this.fullHref=t)}this.isValid=this.isValidUrl(this.href),this.protocol=e?.protocol??s.getProtocol(this.href);const r=function(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],e}(this.href);if(this.isEmail=a(r),this.isPhone=o(r),this.protocol||(this.isEmail?this.protocol="mailto:":this.isPhone?this.protocol="tel:":this.isValid&&(this.protocol="https:")),this.isAnchor=this.href.startsWith("#"),e?.target){if(!["_blank","_self","_parent","_top"].includes(e.target))throw new Error(`Url: invalid target "${e.target}"`);this.target=e.target}this.params={...this.params,...e?.params,...i(this.href)},this.url=n(this.href),this.protocol&&!this.protocol.endsWith(":")&&(this.protocol+=":");const l="http:"===this.protocol||"https:"===this.protocol;this.href=l?`${this.protocol}//${this.url}`:this.protocol+this.url,this.fullHref=this.getUrlWithParams(),this.href=this.getUrlWithParams()}addParam(t,e){this.href=this.href.replace(new RegExp(`${t}=[^&]*`),`${t}=${e}`),this.params[t]=e}getUrlWithParams(){let t,e="";try{t=decodeURIComponent(this.url)}catch(e){t=this.url}if(Object.keys(this.params).length>0){t+="?",e="?";for(const r in this.params){const a=this.params[r],o=encodeURIComponent(r).replace(/%24/g,"$");if(a){const r=encodeURIComponent(a).replace(/%24/g,"$");t+=`${o}=${r}&`,e+=`${o}=${r}&`}else t+=`${o}&`,e+=`${o}&`}t=t.slice(0,-1)}const r=t=>{try{return decodeURIComponent(t)}catch{return t}};if(this.protocol&&("http:"===this.protocol||"https:"===this.protocol))return r(this.protocol+"//"+t);if("whatsapp:"===this.protocol){const a=this.extractPhoneFromTextUsingRegex(t);return a.length>0?r("https://wa.me/"+a[0]+e):r("https://wa.me/"+e)}return r(this.protocol+t)}extractPhoneFromTextUsingRegex(t){if(!t)return[];const e=[...t.matchAll(/(?:whatsapp:([^?\s]+)|\+?[\d\s\-\(\)\.]{7,20})/g)];return Array.from(new Set(e.map(t=>t[1]||t[0]).filter(t=>{const e=t.replace(/\D/g,"");return e.length>=7&&e.length<=15}).map(t=>t.trim())))}isValidUrl(t){if(!t)return!1;return/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\/.*)?$/.test(t)}}s.resetURL=n},50742(t,e,r){r.d(e,{P:()=>a});const a=[{rule:"rgba(149, 157, 165, 0.2) 0px 8px 24px;"},{rule:"rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;"},{rule:"rgba(0, 0, 0, 0.15) 1.95px 1.95px 2.6px;"},{rule:"rgba(0, 0, 0, 0.35) 0px 5px 15px;"},{rule:"rgba(0, 0, 0, 0.16) 0px 1px 4px;"},{rule:"rgba(0, 0, 0, 0.24) 0px 3px 8px;"},{rule:"rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;"},{rule:"rgba(0, 0, 0, 0.16) 0px 1px 4px, rgb(51, 51, 51) 0px 0px 0px 3px;"},{rule:"rgba(0, 0, 0, 0.02) 0px 1px 3px 0px, rgba(27, 31, 35, 0.15) 0px 0px 0px 1px;"},{rule:"rgba(0, 0, 0, 0.1) 0px 4px 12px;"},{rule:"rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px;"},{rule:"rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;"},{rule:"rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;"},{rule:"rgba(0, 0, 0, 0.16) 0px 10px 36px 0px, rgba(0, 0, 0, 0.06) 0px 0px 0px 1px;"},{rule:"rgba(17, 12, 46, 0.15) 0px 48px 100px 0px;"},{rule:"rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px, rgba(10, 37, 64, 0.35) 0px -2px 6px 0px inset;"},{rule:"rgba(255, 255, 255, 0.1) 0px 1px 1px 0px inset, rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px;"},{rule:"rgba(0, 0, 0, 0.16) 0px 10px 36px 0px, rgba(0, 0, 0, 0.06) 0px 0px 0px 1px;"},{rule:"rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px;"},{rule:"rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;"},{rule:"rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;"},{rule:"rgb(38, 57, 77) 0px 20px 30px -10px;"},{rule:"rgba(6, 24, 44, 0.4) 0px 0px 0px 2px, rgba(6, 24, 44, 0.65) 0px 4px 6px -1px, rgba(255, 255, 255, 0.08) 0px 1px 0px inset;"},{rule:"rgba(50, 50, 93, 0.25) 0px 6px 12px -2px, rgba(0, 0, 0, 0.3) 0px 3px 7px -3px;"},{rule:"rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;"},{rule:"rgba(50, 50, 93, 0.25) 0px 30px 60px -12px, rgba(0, 0, 0, 0.3) 0px 18px 36px -18px;"},{rule:"rgba(50, 50, 93, 0.25) 0px 30px 60px -12px inset, rgba(0, 0, 0, 0.3) 0px 18px 36px -18px inset;"},{rule:"rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px;"},{rule:"rgba(0, 0, 0, 0.12) 0px 1px 3px, rgba(0, 0, 0, 0.24) 0px 1px 2px;"},{rule:"rgba(0, 0, 0, 0.16) 0px 3px 6px, rgba(0, 0, 0, 0.23) 0px 3px 6px;"},{rule:"rgba(0, 0, 0, 0.19) 0px 10px 20px, rgba(0, 0, 0, 0.23) 0px 6px 6px;"},{rule:"rgba(0, 0, 0, 0.25) 0px 14px 28px, rgba(0, 0, 0, 0.22) 0px 10px 10px;"},{rule:"rgba(0, 0, 0, 0.3) 0px 19px 38px, rgba(0, 0, 0, 0.22) 0px 15px 12px;"},{rule:"rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;"},{rule:"rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 1px 3px 1px;"},{rule:"rgba(0, 0, 0, 0.05) 0px 0px 0px 1px;"},{rule:"rgba(0, 0, 0, 0.05) 0px 1px 2px 0px;"},{rule:"rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px;"},{rule:"rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.06) 0px 2px 4px -1px;"},{rule:"rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px;"},{rule:"rgba(0, 0, 0, 0.1) 0px 20px 25px -5px, rgba(0, 0, 0, 0.04) 0px 10px 10px -5px;"},{rule:"rgba(0, 0, 0, 0.25) 0px 25px 50px -12px;"},{rule:"rgba(0, 0, 0, 0.06) 0px 2px 4px 0px inset;"},{rule:"rgba(0, 0, 0, 0.1) 0px 0px 5px 0px, rgba(0, 0, 0, 0.1) 0px 0px 1px 0px;"},{rule:"rgba(0, 0, 0, 0.07) 0px 1px 2px, rgba(0, 0, 0, 0.07) 0px 2px 4px, rgba(0, 0, 0, 0.07) 0px 4px 8px, rgba(0, 0, 0, 0.07) 0px 8px 16px, rgba(0, 0, 0, 0.07) 0px 16px 32px, rgba(0, 0, 0, 0.07) 0px 32px 64px;"},{rule:"rgba(0, 0, 0, 0.09) 0px 2px 1px, rgba(0, 0, 0, 0.09) 0px 4px 2px, rgba(0, 0, 0, 0.09) 0px 8px 4px, rgba(0, 0, 0, 0.09) 0px 16px 8px, rgba(0, 0, 0, 0.09) 0px 32px 16px;"},{rule:"rgba(0, 0, 0, 0.2) 0px 18px 50px -10px;"},{rule:"rgba(0, 0, 0, 0.1) 0px 10px 50px;"},{rule:"rgba(240, 46, 170, 0.4) -5px 5px, rgba(240, 46, 170, 0.3) -10px 10px, rgba(240, 46, 170, 0.2) -15px 15px, rgba(240, 46, 170, 0.1) -20px 20px, rgba(240, 46, 170, 0.05) -25px 25px;"},{rule:"rgba(240, 46, 170, 0.4) 0px 5px, rgba(240, 46, 170, 0.3) 0px 10px, rgba(240, 46, 170, 0.2) 0px 15px, rgba(240, 46, 170, 0.1) 0px 20px, rgba(240, 46, 170, 0.05) 0px 25px;"},{rule:"rgba(240, 46, 170, 0.4) 5px 5px, rgba(240, 46, 170, 0.3) 10px 10px, rgba(240, 46, 170, 0.2) 15px 15px, rgba(240, 46, 170, 0.1) 20px 20px, rgba(240, 46, 170, 0.05) 25px 25px;"}]}}]);
Binary file
@@ -1,14 +1,14 @@
1
- "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[3095,4569,7307],{73095(t,e,i){i.r(e),i.d(e,{default:()=>r});var s=i(59929),o=i(21421),n=i(69600);class r extends s.WF{constructor(){super(),this.contentRef=(0,o._)(),this.toggle=this.toggle.bind(this),this.onEnter=this.onEnter.bind(this),this.onKeydown=this.onKeydown.bind(this),this.overflow=!0,this.maxHeight=300,this.left=0,this.top=0,this.custom=!1,this.opened=!1}close(){this.toggle()}onBouncing(t){this.searchText=t.target.value;const e=new UIEvent("search",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e)}render(){return s.qy`
1
+ "use strict";(("undefined"!=typeof self?self:this).webpackChunkCreaditor=("undefined"!=typeof self?self:this).webpackChunkCreaditor||[]).push([[3095,4569,7307],{73095(t,e,i){i.r(e),i.d(e,{default:()=>n});var s=i(59929),o=i(21421),r=i(69600);class n extends s.WF{constructor(){super(),this.contentRef=(0,o._)(),this.toggle=this.toggle.bind(this),this.onEnter=this.onEnter.bind(this),this.onKeydown=this.onKeydown.bind(this),this.overflow=!0,this.maxHeight=300,this.left=0,this.top=0,this.custom=!1,this.opened=!1}close(){this.toggle()}onBouncing(t){this.searchText=t.target.value;const e=new UIEvent("search",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e)}render(){return s.qy`
2
2
  <slot @click=${()=>this.toggle()} tabindex="0" name="trigger"></slot>
3
3
  ${this.opened?s.qy` <div
4
4
  @mouseup=${this.onClickOutside}
5
5
  class="backdrop"
6
- style="z-index:${(0,n.A)()};"
6
+ style="z-index:${(0,r.A)()};"
7
7
  >
8
8
  <div
9
9
  ${(0,o.K)(this.contentRef)}
10
10
  @mouseup=${this.preventClosing}
11
- style="z-index:${(0,n.A)()};left:${this.left}px;top:${this.top}px;"
11
+ style="z-index:${(0,r.A)()};left:${this.left}px;top:${this.top}px;"
12
12
  class="dropdown-content fade-in ${this.custom?"":"dropdown-background"}"
13
13
  >
14
14
  ${this.search?s.qy`<cdtr-input
@@ -19,7 +19,7 @@
19
19
  <slot name="content"></slot>
20
20
  </div>
21
21
  </div>`:null}
22
- `}preventClosing(t){return t.stopPropagation(),setTimeout(()=>{this.calcRects()},0),!1}onClickOutside(){this.toggle(!1)}updated(){this.opened&&(setTimeout(()=>{this.calcRects()},0),this.contentRef.value?.classList.add("fade-in"),this.contentRef.value.style.maxHeight=`${this.maxHeight}px`)}calcRects(){let t=0,e=0;const i=this.getBoundingClientRect(),s=this.contentRef?.value?.getBoundingClientRect();s&&(t=i.left,e=i.top,t<0&&(t=0),e<0&&(e=0),t+s.width>window.innerWidth&&(t=window.innerWidth-s.width),e+s.height>window.innerHeight&&(e=window.innerHeight-s.height),this.left=t,this.top=e,this.contentRef.value.style.left=`${i.left}px`,this.contentRef.value.style.top=`${e+i.height}px`,this.contentRef.value.style.overflow=this.overflow?"hidden auto":"hidden")}toggle(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=t||!this.opened;e?(window.removeEventListener("keydown",this.onKeydown),window.addEventListener("keydown",this.onKeydown),this.opened=e,setTimeout(()=>{const t=this.focusedItem=this.querySelector("cdtr-dropdown-item[focused]")||this.querySelector("cdtr-dropdown-item");t&&t.focus()},20)):(window.removeEventListener("keydown",this.onKeydown),this.contentRef.value?.classList.add("fade-out"),setTimeout(()=>{this.opened=e},150)),this.setAttribute("aria-expanded",e)}onEnter(t){t.target===this&&13===t.keyCode&&this.toggle()}onKeydown(t){this.focusedItem&&40===t.keyCode&&this.focusedItem.nextElementSibling&&"CDTR-DROPDOWN-ITEM"===this.focusedItem.nextElementSibling.nodeName?(this.focusedItem=this.focusedItem.nextElementSibling,this.focusedItem&&this.focusedItem.focus()):this.focusedItem&&38===t.keyCode&&this.focusedItem.previousElementSibling&&"CDTR-DROPDOWN-ITEM"===this.focusedItem.previousElementSibling.nodeName?(this.focusedItem=this.focusedItem.previousElementSibling,this.focusedItem&&this.focusedItem.focus()):27===t.keyCode&&this.toggle();const e=new UIEvent("keypress",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e)}connectedCallback(){super.connectedCallback(),this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",this.opened),this.addEventListener("keydown",this.onEnter),setTimeout(()=>{this.opened&&this.toggle(!0)},50)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKeydown)}patch(t){this.value=t,this.toggle(!1);const e=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e),setTimeout(()=>{this.focus()},0)}}r.styles=s.AH`
22
+ `}preventClosing(t){return t.stopPropagation(),setTimeout(()=>{this.calcRects()},0),!1}onClickOutside(){this.toggle(!1)}updated(){this.opened&&(setTimeout(()=>{this.calcRects()},0),this.contentRef.value?.classList.add("fade-in"),this.contentRef.value.style.maxHeight=`${this.maxHeight}px`)}calcRects(){let t=0,e=0;const i=this.getBoundingClientRect(),s=this.contentRef?.value?.getBoundingClientRect();s&&(t=i.left,e=i.top,t<0&&(t=0),e<0&&(e=0),t+s.width>window.innerWidth&&(t=window.innerWidth-s.width),e+s.height>window.innerHeight&&(e=window.innerHeight-s.height),this.left=t,this.top=e,this.contentRef.value.style.left=`${i.left}px`,this.contentRef.value.style.top=`${e+i.height}px`,this.contentRef.value.style.overflow=this.overflow?"hidden auto":"hidden")}toggle(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=t||!this.opened;e?(window.removeEventListener("keydown",this.onKeydown),window.addEventListener("keydown",this.onKeydown),this.opened=e,setTimeout(()=>{const t=this.focusedItem=this.querySelector("cdtr-dropdown-item[focused]")||this.querySelector("cdtr-dropdown-item");t&&t.focus()},20)):(window.removeEventListener("keydown",this.onKeydown),this.contentRef.value?.classList.add("fade-out"),setTimeout(()=>{this.opened=e},150)),this.setAttribute("aria-expanded",e)}onEnter(t){t.target===this&&13===t.keyCode&&this.toggle()}onKeydown(t){this.focusedItem&&40===t.keyCode&&this.focusedItem.nextElementSibling&&"CDTR-DROPDOWN-ITEM"===this.focusedItem.nextElementSibling.nodeName?(this.focusedItem=this.focusedItem.nextElementSibling,this.focusedItem&&this.focusedItem.focus()):this.focusedItem&&38===t.keyCode&&this.focusedItem.previousElementSibling&&"CDTR-DROPDOWN-ITEM"===this.focusedItem.previousElementSibling.nodeName?(this.focusedItem=this.focusedItem.previousElementSibling,this.focusedItem&&this.focusedItem.focus()):27===t.keyCode&&this.toggle();const e=new UIEvent("keypress",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e)}connectedCallback(){super.connectedCallback(),this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.setAttribute("aria-disabled","false"),this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",this.opened),this.addEventListener("keydown",this.onEnter),setTimeout(()=>{this.opened&&this.toggle(!0)},50)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("keydown",this.onKeydown)}patch(t){this.value=t,this.toggle(!1);const e=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e),setTimeout(()=>{this.focus()},0)}}n.styles=s.AH`
23
23
  :host {
24
24
  display: inline-block;
25
25
  overflow: hidden;
@@ -73,7 +73,7 @@
73
73
  opacity: 0;
74
74
  }
75
75
  }
76
- `,r.properties={search:{type:Boolean},searchText:{type:String},left:{type:Number},top:{type:Number},opened:{type:Boolean},maxHeight:{type:Number},overflow:{type:Boolean},value:{type:String},custom:{type:String}};class a extends s.WF{constructor(){super(),this.minWidth=50}render(){return s.qy`<paper-button style="min-width:${this.minWidth}px"
76
+ `,n.properties={search:{type:Boolean},searchText:{type:String},left:{type:Number},top:{type:Number},opened:{type:Boolean},maxHeight:{type:Number},overflow:{type:Boolean},value:{type:String},custom:{type:String}};class a extends s.WF{constructor(){super(),this.minWidth=50}render(){return s.qy`<paper-button style="min-width:${this.minWidth}px"
77
77
  ><slot></slot> <cdtr-dd-arrow-icon></cdtr-dd-arrow-icon
78
78
  ></paper-button>`}}a.properties={minWidth:{type:Number}},a.styles=s.AH`
79
79
  paper-button {
@@ -158,7 +158,7 @@
158
158
  transform: translate(-70%, -50%);
159
159
  top: 50%;
160
160
  }
161
- `,customElements.get("cdtr-dropdown-item")||customElements.define("cdtr-dropdown-item",l),customElements.get("cdtr-dropdown-button")||customElements.define("cdtr-dropdown-button",a),customElements.get("cdtr-dropdown")||customElements.define("cdtr-dropdown",r)},47307(t,e,i){i.r(e),i.d(e,{default:()=>c});var s=i(59929),o=i(21421),n=i(91597),r=i(81744),a=i(86319);const l=(0,n.S)();class c extends s.WF{constructor(){super(),this.inputRef=(0,o._)(),this.min=0,this.max=100,this.step=1,this.autofocus=!1,this.type="text",this.value="number"===this.type?"0":"",this.placeholder="",this.oldValue=this.value,this.successActive=!1,this._successTimeout=null}onSubmit(t){t.preventDefault();const e=new UIEvent("submit",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e),this.oldValue=this.value}focus(){const t=this.inputRef.value;t.focus(),t.setSelectionRange(t.value.length,t.value.length)}onFocus(){const t=new UIEvent("focus",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t)}onBlur(){const t=new UIEvent("blur",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t),this.oldValue=this.value}render(){this.fullWidth&&(this.style.width="100%"),this.value||"text"!==this.type||(this.value=""),this.icon&&"string"!=typeof this.inputStyle&&(this.inputStyle="");const t=a.M.get("lang",this.placeholder)||this.placeholder||"";t&&("string"!=typeof this.inputStyle&&(this.inputStyle=""),-1===this.inputStyle.indexOf("text-align")&&(this.inputStyle+=";text-align:"+("rtl"===(0,r.o)(t)?"right":"")));const e=this.multiline?s.qy` <textarea
161
+ `,customElements.get("cdtr-dropdown-item")||customElements.define("cdtr-dropdown-item",l),customElements.get("cdtr-dropdown-button")||customElements.define("cdtr-dropdown-button",a),customElements.get("cdtr-dropdown")||customElements.define("cdtr-dropdown",n)},47307(t,e,i){i.r(e),i.d(e,{default:()=>c});var s=i(59929),o=i(21421),r=i(91597),n=i(81744),a=i(86319);const l=(0,r.S)();class c extends s.WF{constructor(){super(),this.inputRef=(0,o._)(),this.min=0,this.max=100,this.step=1,this.autofocus=!1,this.type="text",this.value="number"===this.type?"0":"",this.placeholder="",this.oldValue=this.value,this.successActive=!1,this._successTimeout=null}onSubmit(t){t.preventDefault();const e=new UIEvent("submit",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(e),this.oldValue=this.value}focus(){const t=this.inputRef.value;t.focus(),t.setSelectionRange(t.value.length,t.value.length)}onFocus(){const t=new UIEvent("focus",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t)}onBlur(){const t=new UIEvent("blur",{view:window,bubbles:!0,cancelable:!0});this.dispatchEvent(t),this.oldValue=this.value}render(){this.fullWidth&&(this.style.width="100%"),this.value||"text"!==this.type||(this.value=""),this.icon&&"string"!=typeof this.inputStyle&&(this.inputStyle="");const t=a.M.get("lang",this.placeholder)||this.placeholder||"";t&&("string"!=typeof this.inputStyle&&(this.inputStyle=""),-1===this.inputStyle.indexOf("text-align")&&(this.inputStyle+=";text-align:"+("rtl"===(0,n.o)(t)?"right":"")));const e=this.multiline?s.qy` <textarea
162
162
  row=${this.row||4}
163
163
  .disabled=${this.disabled}
164
164
  dir="auto"
@@ -343,7 +343,7 @@
343
343
  box-shadow: 0 0 10px rgba(79, 192, 111, 0.2);
344
344
  }
345
345
  }
346
- `,c.properties={value:{type:String,reflect:!0},step:{type:Number,reflect:!0},min:{type:Number,reflect:!0},max:{type:Number,reflect:!0},type:{type:String,reflect:!0},inputDir:{type:String},icon:{type:String,reflect:!0},placeholder:{type:String,reflect:!0},autofocus:{type:Boolean,reflect:!0},fullWidth:{type:Boolean,reflect:!0},selectionStart:{type:Number},inputStyle:{type:String,reflect:!0},maxLength:{type:Number},couchOnEmpty:{type:Boolean},disabled:{type:Boolean},multiline:{type:Boolean},row:{type:Number},successActive:{type:Boolean}},customElements.get("cdtr-input")||customElements.define("cdtr-input",c)},64569(t,e,i){i.r(e),i.d(e,{LinkElement:()=>x});var s=i(59929),o=i(86319),n=i(88385);const r=s.AH`
346
+ `,c.properties={value:{type:String,reflect:!0},step:{type:Number,reflect:!0},min:{type:Number,reflect:!0},max:{type:Number,reflect:!0},type:{type:String,reflect:!0},inputDir:{type:String},icon:{type:String,reflect:!0},placeholder:{type:String,reflect:!0},autofocus:{type:Boolean,reflect:!0},fullWidth:{type:Boolean,reflect:!0},selectionStart:{type:Number},inputStyle:{type:String,reflect:!0},maxLength:{type:Number},couchOnEmpty:{type:Boolean},disabled:{type:Boolean},multiline:{type:Boolean},row:{type:Number},successActive:{type:Boolean}},customElements.get("cdtr-input")||customElements.define("cdtr-input",c)},64569(t,e,i){i.r(e),i.d(e,{LinkElement:()=>x});var s=i(59929),o=i(86319),r=i(88385);const n=s.AH`
347
347
  :host {
348
348
  --paper-radio-button-checked-color: var(--primary);
349
349
  box-sizing: border-box;
@@ -494,11 +494,11 @@
494
494
  margin-top: 0.75rem;
495
495
  padding-left: 1rem;
496
496
  }
497
- `;var a=i(21421);i(73095),i(47307);const l="260px",c=[{type:"https:",text:"link"},{type:"http:",text:"link"},{type:"mailto:",text:"sendEmail"},{type:"tel:",text:"tel"},{type:"sms:",text:"sendSms"},{type:"whatsapp:",text:"sendWhatsapp"},{type:"anchor:",text:"anchor"}],d="cdtrAdd",h="cdtrRemove",p="cdtrAutomation",u=[d,h,p];function m(t,e){t=t.replace(/[\[\]]/g,"\\$&");var i=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(e);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null}function f(t,e){switch(t){case"anchor:":return function(t){const{url:e,anchors:i,href:o,protocol:n,onChangeLink:r,onBlur:a,onRequest:l}=t;return s.qy`
497
+ `;var a=i(21421);i(73095),i(47307);const l="260px",c=[{type:"https:",text:"link"},{type:"http:",text:"link"},{type:"mailto:",text:"sendEmail"},{type:"tel:",text:"tel"},{type:"sms:",text:"sendSms"},{type:"whatsapp:",text:"sendWhatsapp"},{type:"anchor:",text:"anchor"}],d="cdtrAdd",h="cdtrRemove",p="cdtrAutomation",u=[d,h,p];function m(t,e){t=t.replace(/[\[\]]/g,"\\$&");var i=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(e);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null}function f(t,e){switch(t){case"anchor:":return function(t){const{url:e,anchors:i,href:o,protocol:r,onChangeLink:n,onBlur:a,onRequest:l}=t;return s.qy`
498
498
  <cdtr-row alignItems="center" spacing="5">
499
499
  <cdtr-dropdown
500
- @change=${t=>{r({target:{value:"#"+t.target.value},anchor:!0}),a()}}
501
- .opened=${i.length>0&&"anchor:"===n&&!o}
500
+ @change=${t=>{n({target:{value:"#"+t.target.value},anchor:!0}),a()}}
501
+ .opened=${i.length>0&&"anchor:"===r&&!o}
502
502
  class="anchor-dd"
503
503
  >
504
504
  <cdtr-dropdown-button
@@ -520,7 +520,7 @@
520
520
  ><lang-text text="create_anchor"></lang-text></cdtr-title
521
521
  ></paper-button>`:null}
522
522
  </cdtr-row>
523
- `}(e);case"mailto:":return function(t){const{href:e,body:i,subject:o,onBlur:n,updateBody:r,updateSubject:a}=t,c="string"==typeof e?m("body",e):i||e.params.body,d="string"==typeof e?m("subject",e):o||e.params.subject;return s.qy`
523
+ `}(e);case"mailto:":return function(t){const{href:e,body:i,subject:o,onBlur:r,updateBody:n,updateSubject:a}=t,c="string"==typeof e?m("body",e):i||e.params.body,d="string"==typeof e?m("subject",e):o||e.params.subject;return s.qy`
524
524
  <cdtr-row spacing="5">
525
525
  <cdtr-title class="explain-title"
526
526
  ><lang-text text="add_catchy_subject"></lang-text
@@ -528,7 +528,7 @@
528
528
  <cdtr-input
529
529
  inputStyle="height:${"40px"};"
530
530
  style="width:${l};"
531
- @change=${t=>{let{target:e}=t;a(e.value),n()}}
531
+ @change=${t=>{let{target:e}=t;a(e.value),r()}}
532
532
  value=${d||o||""}
533
533
  ></cdtr-input>
534
534
  <cdtr-title class="explain-title"
@@ -538,34 +538,34 @@
538
538
  .multiline=${!0}
539
539
  value="${c||i||""}"
540
540
  style="width:${l};"
541
- @change=${t=>{let{target:e}=t;r(e.value),n()}}
541
+ @change=${t=>{let{target:e}=t;n(e.value),r()}}
542
542
  ></cdtr-input>
543
543
  </cdtr-row>
544
- `}(e);case"sms:":return function(t){const{href:e,body:i,onBlur:o,updateBody:n}=t,r="string"==typeof e?m("body",e):e.params.body;return s.qy`
544
+ `}(e);case"sms:":return function(t){const{href:e,body:i,onBlur:o,updateBody:r}=t,n="string"==typeof e?m("body",e):e.params.body;return s.qy`
545
545
  <cdtr-row spacing="5">
546
546
  <cdtr-title class="explain-title"
547
547
  ><lang-text text="sms_body_if_needed"></lang-text
548
548
  ></cdtr-title>
549
549
  <cdtr-input
550
550
  .multiline=${!0}
551
- value="${r||i||""}"
551
+ value="${n||i||""}"
552
552
  style="width:${l};"
553
- @change=${t=>{let{target:e}=t;n(e.value),o()}}
553
+ @change=${t=>{let{target:e}=t;r(e.value),o()}}
554
554
  ></cdtr-input>
555
555
  </cdtr-row>
556
- `}(e);case"whatsapp:":return function(t){const{href:e,body:i,onBlur:o,updateBody:n}=t,r="string"==typeof e?m("text",e)||m("body",e):e.params&&(e.params.text||e.params.body)||"";return s.qy`
556
+ `}(e);case"whatsapp:":return function(t){const{href:e,body:i,onBlur:o,updateBody:r}=t,n="string"==typeof e?m("text",e)||m("body",e):e.params&&(e.params.text||e.params.body)||"";return s.qy`
557
557
  <cdtr-row spacing="5">
558
558
  <cdtr-title class="explain-title"
559
559
  ><lang-text text="whatsapp_body_if_needed"></lang-text
560
560
  ></cdtr-title>
561
561
  <cdtr-input
562
562
  .multiline=${!0}
563
- value="${r||i||""}"
563
+ value="${n||i||""}"
564
564
  style="width:${l};"
565
- @change=${t=>{let{target:e}=t;n(e.value),o()}}
565
+ @change=${t=>{let{target:e}=t;r(e.value),o()}}
566
566
  ></cdtr-input>
567
567
  </cdtr-row>
568
- `}(e);default:return""}}function g(t,e,i,s,o,r){if(!t)return null;const a="string"==typeof t?new n.A({href:t,protocol:e,params:i}):new n.A(t);return t?"whatsapp:"===e||"whatsapp:"===a.protocol?function(t,e,i,s,o){const r="string"==typeof t?new n.A({href:t,protocol:e,params:i}):new n.A(t),a=(r.params&&(r.params.phone||function(t){try{const e=/whatsapp:([^?]+)/,i=t.match(e);return i?i[1]:""}catch(t){return""}}(r.fullHref))||m("phone",r.href||"")||r.url||"").replace(/\D+/g,"");if(!a)return null;const l=s||r.params&&(r.params.text||r.params.body)||"",c=l?encodeURIComponent(l):"";let d=`https://wa.me/${a}`;c&&(d+=`?text=${c}`);const h=new n.A(d);return h.target=o||h.target||"_blank",{url:h,params:h.params,protocol:"whatsapp:"}}(t,e,i,s,r):(a.isEmail?function(t,e,i){let s=!1;e?t.addParam("subject",e):t.params&&"subject"in t.params&&(delete t.params.subject,s=!0),i?t.addParam("body",i):t.params&&"body"in t.params&&(delete t.params.body,s=!0),s&&(t.href=t.getUrlWithParams())}(a,o,s):s?a.addParam("body",s):a.params&&"body"in a.params&&(delete a.params.body,a.href=a.getUrlWithParams()),a.target=r||a.target||"_blank",{url:a,params:a.params,protocol:a.protocol}):null}function b(t,e,i){if(!t)return{href:{},protocol:null,body:"",subject:""};if(t.startsWith("http")&&!t.startsWith("http://")&&!t.startsWith("https://"))return null;const s=n.A.getProtocol(t);let o=e;s&&(o=s+":");const r=new n.A({href:t,protocol:o||null});console.log("output",r);const a=(i instanceof n.A?i:new n.A(i)).url!==r.url;return{href:r,protocol:r.protocol,shouldBlur:r.isValid,clearParams:a}}function y(t){const{value:e="",inputRef:i,autofocus:o=!1,onChange:n,onBlur:r,onFocus:c,onKeyDown:d,placeholder:h="",inputStyle:p="",style:u="width:260px;",width:m=l}=t,f=t=>{n&&n(t),r&&r()},g=(()=>{if(null==e||""===e)return"";try{return decodeURI(String(e))||""}catch{return String(e)}})();return s.qy`
568
+ `}(e);default:return""}}function g(t,e,i,s,o,n){if(!t)return null;const a="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t);return t?"whatsapp:"===e||"whatsapp:"===a.protocol?function(t,e,i,s,o){const n="string"==typeof t?new r.A({href:t,protocol:e,params:i}):new r.A(t),a=(n.params&&(n.params.phone||function(t){try{const e=/whatsapp:([^?]+)/,i=t.match(e);return i?i[1]:""}catch(t){return""}}(n.fullHref))||m("phone",n.href||"")||n.url||"").replace(/\D+/g,"");if(!a)return null;const l=s||n.params&&(n.params.text||n.params.body)||"",c=l?encodeURIComponent(l):"";let d=`https://wa.me/${a}`;c&&(d+=`?text=${c}`);const h=new r.A(d);return h.target=o||h.target||"_blank",{url:h,params:h.params,protocol:"whatsapp:"}}(t,e,i,s,n):(a.isEmail?function(t,e,i){let s=!1;e?t.addParam("subject",e):t.params&&"subject"in t.params&&(delete t.params.subject,s=!0),i?t.addParam("body",i):t.params&&"body"in t.params&&(delete t.params.body,s=!0),s&&(t.href=t.getUrlWithParams())}(a,o,s):s?a.addParam("body",s):a.params&&"body"in a.params&&(delete a.params.body,a.href=a.getUrlWithParams()),a.target=n||a.target||"_blank",{url:a,params:a.params,protocol:a.protocol}):null}function b(t,e,i){if(!t)return{href:{},protocol:null,body:"",subject:""};if(t.startsWith("http")&&!t.startsWith("http://")&&!t.startsWith("https://"))return null;const s=r.A.getProtocol(t);let o=e;s&&(o=s+":");const n=new r.A({href:t,protocol:o||null});console.log("output",n);const a=(i instanceof r.A?i:new r.A(i)).url!==n.url;return{href:n,protocol:n.protocol,shouldBlur:n.isValid,clearParams:a}}function y(t){const{value:e="",inputRef:i,autofocus:o=!1,onChange:r,onBlur:n,onFocus:c,onKeyDown:d,placeholder:h="",inputStyle:p="",style:u="width:260px;",width:m=l}=t,f=t=>{r&&r(t),n&&n()},g=(()=>{if(null==e||""===e)return"";try{return decodeURI(String(e))||""}catch{return String(e)}})();return s.qy`
569
569
  <cdtr-row style="position:relative;" spacing="5">
570
570
  <span style="display:none;" aria-hidden="true">${e}</span>
571
571
  <cdtr-input
@@ -577,14 +577,14 @@
577
577
  type="search"
578
578
  width="${m}"
579
579
  placeholder="${h}"
580
- @input=${t=>{if(t.target.selectionStart!==t.target.value.length)return;const e=t.target.value.trim();/^[^a-zA-Z0-9]+$/.test(e)||n&&n(t)}}
580
+ @input=${t=>{if(t.target.selectionStart!==t.target.value.length)return;const e=t.target.value.trim();/^[^a-zA-Z0-9]+$/.test(e)||r&&r(t)}}
581
581
  @change=${f}
582
582
  @focus=${c}
583
583
  @submit=${d||f}
584
584
  .value="${g}"
585
585
  ></cdtr-input>
586
586
  </cdtr-row>
587
- `}function v(t){return class extends t{initAutomations(){this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.activeTab="add",this.baseUrl="",this.showSaveSuccess=!1;const t=o.M.get("config","editor","configure","editorProps","mailingLists","items");this.mailingLists=t||[];const e=o.M.get("config","editor","configure","editorProps","automations")||{};this.automations=[],e.addAndRemoveFromMailingList&&this.automations.push({id:"addAndRemoveFromMailingList",name:"moving_from_mailing_list"})}onAutomationsClick(){if(this.showAutomations=!0,this.protocol="automation:",this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.href&&this.href.href){const t=this.href.href;if("string"==typeof t&&t.match(/^\[\[([^\]]+)\]\]\?/))this.parseAutomationLink(this.href);else{const t=new n.A(this.href);t.params&&t.params[p]?(this.baseUrl=this.extractBaseUrl(t),this.parseAutomationLink(t)):this.baseUrl=t.href||""}}else this.baseUrl="";this.requestUpdate()}extractBaseUrl(t){const e=[];t.protocol&&e.push(t.protocol),t.host&&(e.push("//"),e.push(t.host)),t.pathname&&e.push(t.pathname);const i=u,s=[];t.params&&Object.keys(t.params).forEach(e=>{if(!i.includes(e)){const i=t.params[e];s.push(`${e}=${encodeURIComponent(i)}`)}});let o=e.join("");return s.length>0&&(o+=`?${s.join("&")}`),t.href}onBackClick(){if(this.selectedAutomation)this.selectedAutomation=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null;else if(this.showAutomations=!1,this.activeAutomationId=null,"automation:"===this.protocol)if(this.baseUrl){const t=new n.A(this.baseUrl);this.href=t,this.protocol=t.protocol}else this.protocol=null,this.href={};this.requestUpdate()}onAutomationClick(t){this.selectedAutomation=t,this.activeAutomationId=t.id,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.requestUpdate()}onActionSelect(t){this.automationAction===t?this.automationAction=null:this.automationAction=t,this.requestUpdate()}onTabChange(t){this.activeTab=t,this.requestUpdate()}onMailingListToggle(t,e){("add"===e?this.selectedMailingListsForAdd:this.selectedMailingListsForRemove).indexOf(t)>-1?"add"===e?this.selectedMailingListsForAdd=this.selectedMailingListsForAdd.filter(e=>e!==t):this.selectedMailingListsForRemove=this.selectedMailingListsForRemove.filter(e=>e!==t):"add"===e?this.selectedMailingListsForAdd=[...this.selectedMailingListsForAdd,t]:this.selectedMailingListsForRemove=[...this.selectedMailingListsForRemove,t],this.requestUpdate()}createAutomationLink(){if(!this.selectedAutomation)return null;const t=[];if(this.selectedMailingListsForAdd.length>0&&t.push(`${d}=${this.selectedMailingListsForAdd.join(",")}`),this.selectedMailingListsForRemove.length>0&&t.push(`${h}=${this.selectedMailingListsForRemove.join(",")}`),0===t.length)return null;const e=this.selectedAutomation.name||this.selectedAutomation.id;if(this.baseUrl&&this.baseUrl.trim()){let e=this.baseUrl.trim();e.match(/^https?:\/\//i)||e.includes("://")||!e.includes(".")&&e.match(/^[a-zA-Z]+:/)||(e=`https://${e}`),t.push(`url=${encodeURIComponent(e)}`)}return`[[${e}]]?${t.join("&")}`}onSaveAutomation(){const t=this.createAutomationLink();if(!t)return;console.log("Saving automation link:",t);const e=t.match(/^\[\[([^\]]+)\]\]\?(.+)$/);if(!e)return void console.error("Invalid automation link format:",t);const i=e[1],s=e[2],o={};s.split("&").forEach(t=>{const[e,i]=t.split("=");e&&i&&(o[decodeURIComponent(e)]=decodeURIComponent(i))});const r=o.url;let a;if(delete o.url,a=r?new n.A(r):new n.A("https://example.com"),a.params||(a.params={}),o[d]&&(a.params[d]=o[d]),o[h]&&(a.params[h]=o[h]),a.params[p]=i,a.href=t,a.url=r||"",this.href=a,this.protocol=null,this.value=a,this.link=a,this.lastUrl=a,console.log("Set href to:",this.href),console.log("Set href.href to:",this.href?.href),this.onDispatch(),console.log("After dispatch, href:",this.href),console.log("After dispatch, href.href:",this.href?.href),console.log("After dispatch, href.params:",this.href?.params),this.href&&(!this.href.params||!this.href.params[p])){console.log("Restoring automation params after dispatch");const t=this.href.href||this.href,e=String(t).match(/^\[\[([^\]]+)\]\]\?(.+)$/);if(e){const i=e[2],s={};i.split("&").forEach(t=>{const[e,i]=t.split("=");e&&i&&(s[decodeURIComponent(e)]=decodeURIComponent(i))});const o=s.url,r=o?new n.A(o):new n.A("https://example.com");r.params||(r.params={}),s[d]&&(r.params[d]=s[d]),s[h]&&(r.params[h]=s[h]),r.params[p]=e[1],r.href=t,r.url=o||"",this.href=r,this.value=r,this.link=r,this.lastUrl=r,console.log("Restored href:",this.href?.href),console.log("Restored params:",this.href?.params)}}this.showSaveSuccess=!0,this.requestUpdate(),setTimeout(()=>{this.showSaveSuccess=!1,this.requestUpdate()},2e3)}parseAutomationLink(t){if(!t)return;let e=null,i=!1,s=t.href||t;if("string"==typeof s&&s.match(/^\[\[([^\]]+)\]\]\?/)){i=!0;e=s.match(/^\[\[([^\]]+)\]\]\?/)[1]}else t.params&&(e=t.params[p],i=e&&""!==e&&"string"==typeof e&&""!==e.trim());if(i){if("string"==typeof s&&s.match(/^\[\[([^\]]+)\]\]\?(.+)$/)){const t=s.match(/^\[\[([^\]]+)\]\]\?(.+)$/)[2],e={};if(t.split("&").forEach(t=>{const[i,s]=t.split("=");i&&s&&(e[decodeURIComponent(i)]=decodeURIComponent(s))}),e.url?this.baseUrl=e.url:this.baseUrl="",e[d]){const t="string"==typeof e[d]?e[d].split(",").filter(t=>t.trim()):Array.isArray(e[d])?e[d]:[];this.selectedMailingListsForAdd=t}if(e[h]){const t="string"==typeof e[h]?e[h].split(",").filter(t=>t.trim()):Array.isArray(e[h])?e[h]:[];this.selectedMailingListsForRemove=t}}else if(t.params){const e=this.extractBaseUrl(t);if(this.baseUrl=e,t.params[d]){const e="string"==typeof t.params[d]?t.params[d].split(",").filter(t=>t.trim()):Array.isArray(t.params[d])?t.params[d]:[];this.selectedMailingListsForAdd=e}if(t.params[h]){const e="string"==typeof t.params[h]?t.params[h].split(",").filter(t=>t.trim()):Array.isArray(t.params[h])?t.params[h]:[];this.selectedMailingListsForRemove=e}}if((this.selectedMailingListsForAdd.length>0||this.selectedMailingListsForRemove.length>0)&&(this.showAutomations=!0,this.automations&&this.automations.length>0)){const t=String(e).trim(),i=this.automations.find(e=>e.name&&String(e.name).trim()===t||e.id&&String(e.id).trim()===t)||this.automations[0];this.selectedAutomation=i,this.activeAutomationId=i.id}}}renderAutomationsView(){return this.selectedAutomation?this.renderAutomationDetails():s.qy`
587
+ `}function v(t){return class extends t{initAutomations(){this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.activeTab="add",this.baseUrl="",this.showSaveSuccess=!1;const t=o.M.get("config","editor","configure","editorProps","mailingLists","items");this.mailingLists=t||[];const e=o.M.get("config","editor","configure","editorProps","automations")||{};this.automations=[],e.addAndRemoveFromMailingList&&this.automations.push({id:"addAndRemoveFromMailingList",name:"moving_from_mailing_list"})}onAutomationsClick(){if(this.showAutomations=!0,this.protocol="automation:",this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.href&&this.href.href){const t=this.href.href;if("string"==typeof t&&t.match(/^\[\[([^\]]+)\]\]\?/))this.parseAutomationLink(this.href);else{const t=new r.A(this.href);t.params&&t.params[p]?(this.baseUrl=this.extractBaseUrl(t),this.parseAutomationLink(t)):this.baseUrl=t.href||""}}else this.baseUrl="";this.requestUpdate()}extractBaseUrl(t){const e=[];t.protocol&&e.push(t.protocol),t.host&&(e.push("//"),e.push(t.host)),t.pathname&&e.push(t.pathname);const i=u,s=[];t.params&&Object.keys(t.params).forEach(e=>{if(!i.includes(e)){const i=t.params[e];s.push(`${e}=${encodeURIComponent(i)}`)}});let o=e.join("");return s.length>0&&(o+=`?${s.join("&")}`),t.href}onBackClick(){if(this.selectedAutomation)this.selectedAutomation=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null;else if(this.showAutomations=!1,this.activeAutomationId=null,"automation:"===this.protocol)if(this.baseUrl){const t=new r.A(this.baseUrl);this.href=t,this.protocol=t.protocol}else this.protocol=null,this.href={};this.requestUpdate()}onAutomationClick(t){this.selectedAutomation=t,this.activeAutomationId=t.id,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.requestUpdate()}onActionSelect(t){this.automationAction===t?this.automationAction=null:this.automationAction=t,this.requestUpdate()}onTabChange(t){this.activeTab=t,this.requestUpdate()}onMailingListToggle(t,e){("add"===e?this.selectedMailingListsForAdd:this.selectedMailingListsForRemove).indexOf(t)>-1?"add"===e?this.selectedMailingListsForAdd=this.selectedMailingListsForAdd.filter(e=>e!==t):this.selectedMailingListsForRemove=this.selectedMailingListsForRemove.filter(e=>e!==t):"add"===e?this.selectedMailingListsForAdd=[...this.selectedMailingListsForAdd,t]:this.selectedMailingListsForRemove=[...this.selectedMailingListsForRemove,t],this.requestUpdate()}createAutomationLink(){if(!this.selectedAutomation)return null;const t=[];if(this.selectedMailingListsForAdd.length>0&&t.push(`${d}=${this.selectedMailingListsForAdd.join(",")}`),this.selectedMailingListsForRemove.length>0&&t.push(`${h}=${this.selectedMailingListsForRemove.join(",")}`),0===t.length)return null;const e=this.selectedAutomation.name||this.selectedAutomation.id;if(this.baseUrl&&this.baseUrl.trim()){let e=this.baseUrl.trim();e.match(/^https?:\/\//i)||e.includes("://")||!e.includes(".")&&e.match(/^[a-zA-Z]+:/)||(e=`https://${e}`),t.push(`url=${encodeURIComponent(e)}`)}return`[[${e}]]?${t.join("&")}`}onSaveAutomation(){const t=this.createAutomationLink();if(!t)return;console.log("Saving automation link:",t);const e=t.match(/^\[\[([^\]]+)\]\]\?(.+)$/);if(!e)return void console.error("Invalid automation link format:",t);const i=e[1],s=e[2],o={};s.split("&").forEach(t=>{const[e,i]=t.split("=");e&&i&&(o[decodeURIComponent(e)]=decodeURIComponent(i))});const n=o.url;let a;if(delete o.url,a=n?new r.A(n):new r.A("https://example.com"),a.params||(a.params={}),o[d]&&(a.params[d]=o[d]),o[h]&&(a.params[h]=o[h]),a.params[p]=i,a.href=t,a.url=n||"",this.href=a,this.protocol=null,this.value=a,this.link=a,this.lastUrl=a,console.log("Set href to:",this.href),console.log("Set href.href to:",this.href?.href),this.onDispatch(),console.log("After dispatch, href:",this.href),console.log("After dispatch, href.href:",this.href?.href),console.log("After dispatch, href.params:",this.href?.params),this.href&&(!this.href.params||!this.href.params[p])){console.log("Restoring automation params after dispatch");const t=this.href.href||this.href,e=String(t).match(/^\[\[([^\]]+)\]\]\?(.+)$/);if(e){const i=e[2],s={};i.split("&").forEach(t=>{const[e,i]=t.split("=");e&&i&&(s[decodeURIComponent(e)]=decodeURIComponent(i))});const o=s.url,n=o?new r.A(o):new r.A("https://example.com");n.params||(n.params={}),s[d]&&(n.params[d]=s[d]),s[h]&&(n.params[h]=s[h]),n.params[p]=e[1],n.href=t,n.url=o||"",this.href=n,this.value=n,this.link=n,this.lastUrl=n,console.log("Restored href:",this.href?.href),console.log("Restored params:",this.href?.params)}}this.showSaveSuccess=!0,this.requestUpdate(),setTimeout(()=>{this.showSaveSuccess=!1,this.requestUpdate()},2e3)}parseAutomationLink(t){if(!t)return;let e=null,i=!1,s=t.href||t;if("string"==typeof s&&s.match(/^\[\[([^\]]+)\]\]\?/)){i=!0;e=s.match(/^\[\[([^\]]+)\]\]\?/)[1]}else t.params&&(e=t.params[p],i=e&&""!==e&&"string"==typeof e&&""!==e.trim());if(i){if("string"==typeof s&&s.match(/^\[\[([^\]]+)\]\]\?(.+)$/)){const t=s.match(/^\[\[([^\]]+)\]\]\?(.+)$/)[2],e={};if(t.split("&").forEach(t=>{const[i,s]=t.split("=");i&&s&&(e[decodeURIComponent(i)]=decodeURIComponent(s))}),e.url?this.baseUrl=e.url:this.baseUrl="",e[d]){const t="string"==typeof e[d]?e[d].split(",").filter(t=>t.trim()):Array.isArray(e[d])?e[d]:[];this.selectedMailingListsForAdd=t}if(e[h]){const t="string"==typeof e[h]?e[h].split(",").filter(t=>t.trim()):Array.isArray(e[h])?e[h]:[];this.selectedMailingListsForRemove=t}}else if(t.params){const e=this.extractBaseUrl(t);if(this.baseUrl=e,t.params[d]){const e="string"==typeof t.params[d]?t.params[d].split(",").filter(t=>t.trim()):Array.isArray(t.params[d])?t.params[d]:[];this.selectedMailingListsForAdd=e}if(t.params[h]){const e="string"==typeof t.params[h]?t.params[h].split(",").filter(t=>t.trim()):Array.isArray(t.params[h])?t.params[h]:[];this.selectedMailingListsForRemove=e}}if((this.selectedMailingListsForAdd.length>0||this.selectedMailingListsForRemove.length>0)&&(this.showAutomations=!0,this.automations&&this.automations.length>0)){const t=String(e).trim(),i=this.automations.find(e=>e.name&&String(e.name).trim()===t||e.id&&String(e.id).trim()===t)||this.automations[0];this.selectedAutomation=i,this.activeAutomationId=i.id}}}renderAutomationsView(){return this.selectedAutomation?this.renderAutomationDetails():s.qy`
588
588
  <div class="automations-view">
589
589
  <cdtr-row justify="space-between" alignItems="center" mb="1">
590
590
  <cdtr-title
@@ -782,7 +782,7 @@
782
782
  >
783
783
  <lang-text text="url"></lang-text> (Optional)
784
784
  </cdtr-title>
785
- ${y({value:this.baseUrl||"",onChange:t=>{const e=t.target.value||"",i=b(e,null,this.baseUrl?new n.A(this.baseUrl):{});null===i?this.baseUrl=e:i.href?i.href instanceof n.A?this.baseUrl=i.href.href||e:"string"==typeof i.href?this.baseUrl=i.href:this.baseUrl=e:this.baseUrl=e,this.requestUpdate()},placeholder:"https://example.com",inputStyle:"height: 40px; padding: 0.5rem; border: 1px solid #e0e0e0; border-radius: 4px; width: 100%;",style:"width: 100%;"})}
785
+ ${y({value:this.baseUrl||"",onChange:t=>{const e=t.target.value||"",i=b(e,null,this.baseUrl?new r.A(this.baseUrl):{});null===i?this.baseUrl=e:i.href?i.href instanceof r.A?this.baseUrl=i.href.href||e:"string"==typeof i.href?this.baseUrl=i.href:this.baseUrl=e:this.baseUrl=e,this.requestUpdate()},placeholder:"https://example.com",inputStyle:"height: 40px; padding: 0.5rem; border: 1px solid #e0e0e0; border-radius: 4px; width: 100%;",style:"width: 100%;"})}
786
786
  </div>
787
787
 
788
788
  <h6
@@ -948,7 +948,7 @@
948
948
  </cdtr-row>
949
949
  </div>
950
950
  </div>
951
- `}}}customElements.get("paper-button")||Promise.resolve().then(i.bind(i,39239)),customElements.get("cdtr-emoji-picker")||i.e(3105).then(i.t.bind(i,63105,23));class x extends(v(s.WF)){constructor(){super(),this.inputRef=(0,a._)(),this.onBlur=this.onBlur.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.urlInputFocused=!1,this._urlInputRawValue="",this._lastSyncedMyHref=void 0,this._lastBodySyncHref=void 0,this.lastUrl=void 0,this.target="_blank",this.anchors=[],this.event=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0}),this.options=c,this.body="",this.subject="",this.name=o.M.get("lang",c[0].text),this.initAutomations()}onDispatch(){const t=function(t){const{href:e,protocol:i,params:s,body:o,subject:n,target:r,dispatchEvent:a,event:l}=t;if(!e)return a(l),{dispatched:!0};const c=g(e,i,s,o,n,r);return c?{dispatched:!0,href:c.url,protocol:c.protocol,params:c.params,value:c.url,link:c.url,lastUrl:c.url}:{dispatched:!1}}({href:this.href,protocol:this.protocol,params:this.params,body:this.body,subject:this.subject,target:this.target,dispatchEvent:this.dispatchEvent.bind(this),event:this.event});if(t.dispatched){if(t.href){this.href=t.href,this.protocol=t.protocol,this.params=t.params?{...t.params}:{},this.value=t.value,this.link=t.link,this.lastUrl=t.lastUrl;const e="string"==typeof t.href?t.href:t.href?.href;this._urlInputRawValue=null!=e&&""!==e?String(e):""}this.dispatchEvent(this.event)}}onChangeLink(t){const e=t.target.value;this._urlInputRawValue=e;const i=b(e,this.protocol,this.href);null!==i?(this.href=i.href,this.protocol=i.protocol,i.clearParams&&(this.body="",this.subject=""),void 0!==i.body&&(this.body=i.body),void 0!==i.subject&&(this.subject=i.subject),i.shouldBlur&&this.onBlur()):this.href=e}onKeyDown(t){if("submit"===t.type){const t=this.inputRef?.value;void 0!==t?.value&&this.onChangeLink({target:{value:t.value}}),t&&"function"==typeof t.success&&t.success(),this.onDispatch()}}onUrlInputFocus(){const t=this.inputRef?.value?.value;null!=t&&(this._urlInputRawValue=t),this.urlInputFocused=!0}onUrlInputBlur(){this.urlInputFocused=!1,this.hasButton||this.onDispatch()}onBlur(){this.hasButton||this.onDispatch()}onClickOk(){this.onDispatch()}onChangeTarget(t){const e={target:t.target.value};this.target=e.target,t.stopPropagation(),!this.hasButton&&this.href&&this.onBlur()}resolveAnchors(){this.anchors=function(){const t=o.M.get("components");return t?.filter(t=>"anchor"===t.type&&t.props.name||t.props.element_ID)||[]}()}onChangeType(t){const e=function(t,e,i,s){const o=e.find(e=>e.type===t);if(!o)return{forceProtocolChange:!1};const n="anchor"===o.text,r=s!==o.type;return setTimeout(()=>{i&&i.value&&i.value.focus()},500),{protocol:o.type,forceProtocolChange:!0,shouldResolveAnchors:n,clearParams:r}}(t,this.options,this.inputRef,this.protocol);if(e.shouldResolveAnchors&&this.resolveAnchors(),this.protocol=e.protocol,this.forceProtocolChange=e.forceProtocolChange,e.clearParams&&(this.body="",this.subject=""),e.forceProtocolChange){const t=new n.A(this.href,{protocol:this.protocol});t.protocol=this.protocol,this.href=t,this.onBlur()}}connectedCallback(){super.connectedCallback(),this.href=new n.A(this.href);const t=String(this.href?.href||"").match(/^\[\[([^\]]+)\]\]\?/),e=this.href&&this.href.params&&this.href.params[p];(t||e)&&this.parseAutomationLink(this.href)}render(){const t=o.M.get("config","editor","configure","editorProps","linkPicker","savedVariables");this.resolveAnchors();const e=this.lastUrl!==this.href,i=new n.A(this.href,{protocol:e?null:this.protocol});this.protocol&&!e?i.protocol=this.protocol:i.protocol&&(this.protocol=i.protocol);const r=String(this.href?.href||this.href||"");if(this._lastBodySyncHref!==r){this._lastBodySyncHref=r,i.params?(this.body=i.params.text||i.params.body||"",this.subject=i.params.subject||""):(this.body="",this.subject="");r.match(/^\[\[([^\]]+)\]\]\?/)||i.params&&i.params[p]?(this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.showAutomations=!0,this.parseAutomationLink(this.href)):(this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null)}const l=function(t,e,i){let s=[];return t.isEmail?s=[]:t.isPhone?s=i.filter(t=>("tel:"===t.type||"sms:"===t.type||"whatsapp:"===t.type)&&t.type!==e):-1!==t.href.indexOf("http://")&&"https:"!==e&&(s=[{type:"https:",text:o.M.get("lang","is_user_wants_https"),reccomanded:!0}]),"anchor:"===e&&(s=[]),s}(i,this.protocol,this.options);let c=i.href;const d=String(i.href||""),h=d.match(/^\[\[([^\]]+)\]\]\?/),m=i.params&&i.params[p];if(h)c=d;else if(m){const t=u,e=[];i.params&&Object.keys(i.params).forEach(s=>{if(!t.includes(s)){const t=i.params[s];e.push(`${s}=${encodeURIComponent(t).replace(/%24/g,"$")}`)}});const s=i.url||"";c=i.protocol?"http:"===i.protocol||"https:"===i.protocol?`${i.protocol}//${s}`:`${i.protocol}${s}`:s,e.length>0&&(c+=`?${e.join("&")}`)}const g=function(t){switch(t){case"mailto:":return"what_the_email_address";case"tel:":return"what_the_phone_number";case"sms:":case"whatsapp:":return"what_the_phone_number_to_send_msg";case"anchor:":return"what_the_anchor_name";case"file:":return"what_the_file_name";default:return"what_the_url_address"}}(this.protocol),b=[...this.options],v=b.findIndex(t=>"http:"===t.type);v>-1&&b.splice(v,1);const x=o.M.get("config","editor","configure","editorProps","automations"),w={url:i,href:this.href,protocol:this.protocol,anchors:this.anchors,body:this.body,subject:this.subject,onChangeLink:this.onChangeLink.bind(this),onBlur:this.onBlur.bind(this),onRequest:this.onRequest,updateBody:t=>{this.body=t},updateSubject:t=>{this.subject=t}},$=null!=c&&""!==c?String(c):"",k=this._urlInputRawValue!==$,A=void 0!==this._lastSyncedMyHref&&$!==this._lastSyncedMyHref,_=this.urlInputFocused&&this._urlInputRawValue&&$&&!A;k&&!_?(this._urlInputRawValue=$,this._lastSyncedMyHref=$):k||(this._lastSyncedMyHref=$);const R=this.urlInputFocused&&void 0!==this._urlInputRawValue?this._urlInputRawValue:c,S={protocol:this.protocol,url:i,autofocus:this.autofocus,inputRef:(0,a.K)(this.inputRef),onChangeLink:this.onChangeLink.bind(this),onBlur:this.onUrlInputBlur.bind(this),onFocus:this.onUrlInputFocus.bind(this),onKeyDown:this.onKeyDown.bind(this),myHref:R};return this.showAutomations?s.qy` <div class="root">${this.renderAutomationsView()}</div>`:s.qy` <div class="root">
951
+ `}}}customElements.get("paper-button")||Promise.resolve().then(i.bind(i,39239)),customElements.get("cdtr-emoji-picker")||i.e(3105).then(i.t.bind(i,63105,23));class x extends(v(s.WF)){constructor(){super(),this.inputRef=(0,a._)(),this.onBlur=this.onBlur.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.urlInputFocused=!1,this._urlInputRawValue="",this._lastSyncedMyHref=void 0,this._lastBodySyncHref=void 0,this.lastUrl=void 0,this.target="_blank",this.anchors=[],this.event=new UIEvent("change",{view:window,bubbles:!0,cancelable:!0}),this.options=c,this.body="",this.subject="",this.name=o.M.get("lang",c[0].text),this.initAutomations()}onDispatch(){const t=function(t){const{href:e,protocol:i,params:s,body:o,subject:r,target:n,dispatchEvent:a,event:l}=t;if(!e)return a(l),{dispatched:!0};const c=g(e,i,s,o,r,n);return c?{dispatched:!0,href:c.url,protocol:c.protocol,params:c.params,value:c.url,link:c.url,lastUrl:c.url}:{dispatched:!1}}({href:this.href,protocol:this.protocol,params:this.params,body:this.body,subject:this.subject,target:this.target,dispatchEvent:this.dispatchEvent.bind(this),event:this.event});if(t.dispatched){if(t.href){this.href=t.href,this.protocol=t.protocol,this.params=t.params?{...t.params}:{},this.value=t.value,this.link=t.link,this.lastUrl=t.lastUrl;const e="string"==typeof t.href?t.href:t.href?.href;this._urlInputRawValue=null!=e&&""!==e?String(e):""}this.dispatchEvent(this.event)}}onChangeLink(t){const e=t.target.value;this._urlInputRawValue=e;const i=b(e,this.protocol,this.href);null!==i?(this.href=i.href,this.protocol=i.protocol,i.clearParams&&(this.body="",this.subject=""),void 0!==i.body&&(this.body=i.body),void 0!==i.subject&&(this.subject=i.subject),i.shouldBlur&&this.onBlur()):this.href=e}onKeyDown(t){if("submit"===t.type){const t=this.inputRef?.value;void 0!==t?.value&&this.onChangeLink({target:{value:t.value}}),t&&"function"==typeof t.success&&t.success(),this.onDispatch()}}onUrlInputFocus(){const t=this.inputRef?.value?.value;null!=t&&(this._urlInputRawValue=t),this.urlInputFocused=!0}onUrlInputBlur(){this.urlInputFocused=!1,this.hasButton||this.onDispatch()}onBlur(){this.hasButton||this.onDispatch()}onClickOk(){this.onDispatch()}onChangeTarget(t){const e={target:t.target.value};this.target=e.target,t.stopPropagation(),!this.hasButton&&this.href&&this.onBlur()}resolveAnchors(){this.anchors=function(){const t=o.M.get("components");return t?.filter(t=>"anchor"===t.type&&t.props.name||t.props.element_ID)||[]}()}onChangeType(t){const e=function(t,e,i,s){const o=e.find(e=>e.type===t);if(!o)return{forceProtocolChange:!1};const r="anchor"===o.text,n=s!==o.type;return setTimeout(()=>{i&&i.value&&i.value.focus()},500),{protocol:o.type,forceProtocolChange:!0,shouldResolveAnchors:r,clearParams:n}}(t,this.options,this.inputRef,this.protocol);if(e.shouldResolveAnchors&&this.resolveAnchors(),this.protocol=e.protocol,this.forceProtocolChange=e.forceProtocolChange,e.clearParams&&(this.body="",this.subject=""),e.forceProtocolChange){const t=new r.A(this.href,{protocol:this.protocol});t.protocol=this.protocol,this.href=t,this.onBlur()}}connectedCallback(){super.connectedCallback(),this.href=new r.A(this.href);const t=String(this.href?.href||"").match(/^\[\[([^\]]+)\]\]\?/),e=this.href&&this.href.params&&this.href.params[p];(t||e)&&this.parseAutomationLink(this.href)}render(){const t=o.M.get("config","editor","configure","editorProps","linkPicker","savedVariables");this.resolveAnchors();const e=this.lastUrl!==this.href,i=new r.A(this.href,{protocol:e?null:this.protocol});this.protocol&&!e?i.protocol=this.protocol:i.protocol&&(this.protocol=i.protocol);const n=String(this.href?.href||this.href||"");if(this._lastBodySyncHref!==n){this._lastBodySyncHref=n,i.params?(this.body=i.params.text||i.params.body||"",this.subject=i.params.subject||""):(this.body="",this.subject="");n.match(/^\[\[([^\]]+)\]\]\?/)||i.params&&i.params[p]?(this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null,this.showAutomations=!0,this.parseAutomationLink(this.href)):(this.showAutomations=!1,this.selectedAutomation=null,this.activeAutomationId=null,this.selectedMailingLists=[],this.selectedMailingListsForAdd=[],this.selectedMailingListsForRemove=[],this.automationAction=null)}const l=function(t,e,i){let s=[];return t.isEmail?s=[]:t.isPhone?s=i.filter(t=>("tel:"===t.type||"sms:"===t.type||"whatsapp:"===t.type)&&t.type!==e):-1!==t.href.indexOf("http://")&&"https:"!==e&&(s=[{type:"https:",text:o.M.get("lang","is_user_wants_https"),reccomanded:!0}]),"anchor:"===e&&(s=[]),s}(i,this.protocol,this.options);let c=i.href;const d=String(i.href||""),h=d.match(/^\[\[([^\]]+)\]\]\?/),m=i.params&&i.params[p];if(h)c=d;else if(m){const t=u,e=[];i.params&&Object.keys(i.params).forEach(s=>{if(!t.includes(s)){const t=i.params[s];e.push(`${s}=${encodeURIComponent(t).replace(/%24/g,"$")}`)}});const s=i.url||"";c=i.protocol?"http:"===i.protocol||"https:"===i.protocol?`${i.protocol}//${s}`:`${i.protocol}${s}`:s,e.length>0&&(c+=`?${e.join("&")}`)}const g=function(t){switch(t){case"mailto:":return"what_the_email_address";case"tel:":return"what_the_phone_number";case"sms:":case"whatsapp:":return"what_the_phone_number_to_send_msg";case"anchor:":return"what_the_anchor_name";case"file:":return"what_the_file_name";default:return"what_the_url_address"}}(this.protocol),b=[...this.options],v=b.findIndex(t=>"http:"===t.type);v>-1&&b.splice(v,1);const x=o.M.get("config","editor","configure","editorProps","automations"),w={url:i,href:this.href,protocol:this.protocol,anchors:this.anchors,body:this.body,subject:this.subject,onChangeLink:this.onChangeLink.bind(this),onBlur:this.onBlur.bind(this),onRequest:this.onRequest,updateBody:t=>{this.body=t},updateSubject:t=>{this.subject=t}},$=null!=c&&""!==c?String(c):"",k=this._urlInputRawValue!==$,A=void 0!==this._lastSyncedMyHref&&$!==this._lastSyncedMyHref,_=this.urlInputFocused&&this._urlInputRawValue&&$&&!A;k&&!_?(this._urlInputRawValue=$,this._lastSyncedMyHref=$):k||(this._lastSyncedMyHref=$);const R=this.urlInputFocused&&void 0!==this._urlInputRawValue?this._urlInputRawValue:c,S={protocol:this.protocol,url:i,autofocus:this.autofocus,inputRef:(0,a.K)(this.inputRef),onChangeLink:this.onChangeLink.bind(this),onBlur:this.onUrlInputBlur.bind(this),onFocus:this.onUrlInputFocus.bind(this),onKeyDown:this.onKeyDown.bind(this),myHref:R};return this.showAutomations?s.qy` <div class="root">${this.renderAutomationsView()}</div>`:s.qy` <div class="root">
952
952
  ${q=this.label,q?s.qy`<cdtr-title
953
953
  style="font-weight: 700;
954
954
  font-size: 14.4px;
@@ -1012,7 +1012,7 @@
1012
1012
  <cdtr-title class="explain-title"
1013
1013
  ><lang-text .text="${g}"></lang-text
1014
1014
  ></cdtr-title>
1015
- ${function(t){const{protocol:e,url:i,autofocus:s,inputRef:o,onChangeLink:n,onBlur:r,onFocus:a,onKeyDown:l,myHref:c}=t;return"anchor:"===e?null:y({value:c,inputRef:o,autofocus:s,onChange:n,onBlur:r,onFocus:a,onKeyDown:l})}(S)}
1015
+ ${function(t){const{protocol:e,url:i,autofocus:s,inputRef:o,onChangeLink:r,onBlur:n,onFocus:a,onKeyDown:l,myHref:c}=t;return"anchor:"===e?null:y({value:c,inputRef:o,autofocus:s,onChange:r,onBlur:n,onFocus:a,onKeyDown:l})}(S)}
1016
1016
  ${f(this.protocol,w)}
1017
1017
  ${x?s.qy` <cdtr-divider></cdtr-divider>
1018
1018
  <cdtr-row justify="flex-start" mt="1">
@@ -1044,4 +1044,4 @@
1044
1044
  <lang-text text="add_now"></lang-text>
1045
1045
  </paper-button>
1046
1046
  </cdtr-row>`:null}
1047
- </div>`;var C,I,L,U,E,B,M,q}}x.styles=r,x.properties={href:{type:String,reflect:!0},value:{type:Object},protocol:{type:String},name:{type:String},label:{type:String},target:{type:String},hasButton:{type:Boolean},params:{type:Object},explain:{type:String},anchors:{type:Array},link:{},body:{type:String},subject:{type:String},autofocus:{type:Boolean},onRequest:{type:Function}},customElements.get("cdtr-link-element")||customElements.define("cdtr-link-element",x)},88385(t,e,i){i.d(e,{A:()=>a});const s=t=>!(!t||!t.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/)),o=t=>!(!t||!t.replace("-","").match(/^[+]*[(]{0,1}[0-9]{9,9}[)]{0,1}[-\s\./0-9]*$/g)&&!t.match(/[0-9]{3}-[0-9]{3}-[0-9]{4}/));function n(t){const e={},i=/([^&=]+)=?([^&]*)/g,s=t=>{try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t.replace(/\+/g," ")}},o=t.indexOf("?");let n,r=-1!==o?t.substring(o+1):"";for(;null!==(n=i.exec(r));){const t=s(n[1]),i=s(n[2]);t&&(e[t]=i)}return e}function r(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],encodeURIComponent(e).replace(/%24/g,"$")}class a{static getProtocol(t){if(!t)return"";const e=t.indexOf(":");return e>0?t.slice(0,e):""}constructor(t,e){this.protocol="",this.href="",this.fullHref="",this.target="_self",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.url="",this.isValid=!0,this.params={},"string"==typeof t?this.href=t:t&&"object"==typeof t&&Object.assign(this,t),this.isValid=this.isValidUrl(this.href),this.protocol=e?.protocol??a.getProtocol(this.href);const i=function(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],e}(this.href);if(this.isEmail=s(i),this.isPhone=o(i),this.protocol||(this.isEmail?this.protocol="mailto:":this.isPhone?this.protocol="tel:":this.isValid&&(this.protocol="https:")),this.isAnchor=this.href.startsWith("#"),e?.target){if(!["_blank","_self","_parent","_top"].includes(e.target))throw new Error(`Url: invalid target "${e.target}"`);this.target=e.target}this.params={...this.params,...e?.params,...n(this.href)},this.url=r(this.href),this.protocol&&!this.protocol.endsWith(":")&&(this.protocol+=":");const l="http:"===this.protocol||"https:"===this.protocol;this.href=l?`${this.protocol}//${this.url}`:this.protocol+this.url,this.fullHref=this.getUrlWithParams(),this.href=this.getUrlWithParams()}addParam(t,e){this.href=this.href.replace(new RegExp(`${t}=[^&]*`),`${t}=${e}`),this.params[t]=e}getUrlWithParams(){let t,e="";try{t=decodeURIComponent(this.url)}catch(e){t=this.url}if(Object.keys(this.params).length>0){t+="?",e="?";for(const i in this.params){const s=this.params[i],o=encodeURIComponent(i).replace(/%24/g,"$");if(s){const i=encodeURIComponent(s).replace(/%24/g,"$");t+=`${o}=${i}&`,e+=`${o}=${i}&`}else t+=`${o}&`,e+=`${o}&`}t=t.slice(0,-1)}const i=t=>{try{return decodeURIComponent(t)}catch{return t}};if(this.protocol&&("http:"===this.protocol||"https:"===this.protocol))return i(this.protocol+"//"+t);if("whatsapp:"===this.protocol){const s=this.extractPhoneFromTextUsingRegex(t);return s.length>0?i("https://wa.me/"+s[0]+e):i("https://wa.me/"+e)}return i(this.protocol+t)}extractPhoneFromTextUsingRegex(t){if(!t)return[];const e=[...t.matchAll(/(?:whatsapp:([^?\s]+)|\+?[\d\s\-\(\)\.]{7,20})/g)];return Array.from(new Set(e.map(t=>t[1]||t[0]).filter(t=>{const e=t.replace(/\D/g,"");return e.length>=7&&e.length<=15}).map(t=>t.trim())))}isValidUrl(t){if(!t)return!1;return/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\/.*)?$/.test(t)}}a.resetURL=r}}]);
1047
+ </div>`;var C,I,L,U,E,B,M,q}}x.styles=n,x.properties={href:{type:String,reflect:!0},value:{type:Object},protocol:{type:String},name:{type:String},label:{type:String},target:{type:String},hasButton:{type:Boolean},params:{type:Object},explain:{type:String},anchors:{type:Array},link:{},body:{type:String},subject:{type:String},autofocus:{type:Boolean},onRequest:{type:Function}},customElements.get("cdtr-link-element")||customElements.define("cdtr-link-element",x)},88385(t,e,i){i.d(e,{A:()=>a});const s=t=>!(!t||!t.match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/)),o=t=>!(!t||!t.replace("-","").match(/^[+]*[(]{0,1}[0-9]{9,9}[)]{0,1}[-\s\./0-9]*$/g)&&!t.match(/[0-9]{3}-[0-9]{3}-[0-9]{4}/));function r(t){const e={},i=/([^&=]+)=?([^&]*)/g,s=t=>{try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t.replace(/\+/g," ")}},o=t.indexOf("?");let r,n=-1!==o?t.substring(o+1):"";for(;null!==(r=i.exec(n));){const t=s(r[1]),i=s(r[2]);t&&(e[t]=i)}return e}function n(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],encodeURIComponent(e).replace(/%24/g,"$")}class a{static getProtocol(t){if(!t)return"";const e=t.indexOf(":");return e>0?t.slice(0,e):""}constructor(t,e){if(this.protocol="",this.href="",this.fullHref="",this.target="_self",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.url="",this.isValid=!0,this.params={},"string"==typeof t?this.href=t:t&&"object"==typeof t&&Object.assign(this,t),/^\[\[[^\]]+\]\]\?/.test(this.href)){const t=this.href;this.isValid=!1,this.protocol=e?.protocol??"",this.isEmail=!1,this.isPhone=!1,this.isAnchor=!1,this.params={...this.params,...e?.params,...r(t)};const i=t.indexOf("?");return this.url=i>-1?t.slice(0,i):t,this.href=t,void(this.fullHref=t)}this.isValid=this.isValidUrl(this.href),this.protocol=e?.protocol??a.getProtocol(this.href);const i=function(t){if(!t)return"";let e=t.replace(/^[^:]+:(?:\/\/)?/,"");return e=e.replace(/^\/+/,""),e=e.split("?")[0],e}(this.href);if(this.isEmail=s(i),this.isPhone=o(i),this.protocol||(this.isEmail?this.protocol="mailto:":this.isPhone?this.protocol="tel:":this.isValid&&(this.protocol="https:")),this.isAnchor=this.href.startsWith("#"),e?.target){if(!["_blank","_self","_parent","_top"].includes(e.target))throw new Error(`Url: invalid target "${e.target}"`);this.target=e.target}this.params={...this.params,...e?.params,...r(this.href)},this.url=n(this.href),this.protocol&&!this.protocol.endsWith(":")&&(this.protocol+=":");const l="http:"===this.protocol||"https:"===this.protocol;this.href=l?`${this.protocol}//${this.url}`:this.protocol+this.url,this.fullHref=this.getUrlWithParams(),this.href=this.getUrlWithParams()}addParam(t,e){this.href=this.href.replace(new RegExp(`${t}=[^&]*`),`${t}=${e}`),this.params[t]=e}getUrlWithParams(){let t,e="";try{t=decodeURIComponent(this.url)}catch(e){t=this.url}if(Object.keys(this.params).length>0){t+="?",e="?";for(const i in this.params){const s=this.params[i],o=encodeURIComponent(i).replace(/%24/g,"$");if(s){const i=encodeURIComponent(s).replace(/%24/g,"$");t+=`${o}=${i}&`,e+=`${o}=${i}&`}else t+=`${o}&`,e+=`${o}&`}t=t.slice(0,-1)}const i=t=>{try{return decodeURIComponent(t)}catch{return t}};if(this.protocol&&("http:"===this.protocol||"https:"===this.protocol))return i(this.protocol+"//"+t);if("whatsapp:"===this.protocol){const s=this.extractPhoneFromTextUsingRegex(t);return s.length>0?i("https://wa.me/"+s[0]+e):i("https://wa.me/"+e)}return i(this.protocol+t)}extractPhoneFromTextUsingRegex(t){if(!t)return[];const e=[...t.matchAll(/(?:whatsapp:([^?\s]+)|\+?[\d\s\-\(\)\.]{7,20})/g)];return Array.from(new Set(e.map(t=>t[1]||t[0]).filter(t=>{const e=t.replace(/\D/g,"");return e.length>=7&&e.length<=15}).map(t=>t.trim())))}isValidUrl(t){if(!t)return!1;return/^(https?:\/\/)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(\/.*)?$/.test(t)}}a.resetURL=n}}]);
Binary file