(function(){"use strict";const r="appear",d="resize",a="position",g=t=>window.addEventListener("message",({data:{type:e,payload:s}})=>t(e,s)),o=t=>"".concat(t,"px"),l=t=>{const e=document.createElement("div");return e.style.cssText="border: 0; background-color: transparent; pointer-events: none; overflow: visible; opacity: 1; max-width: 100%; max-height: 100%;",u(e),e},u=t=>{!document.currentScript||document.currentScript.parentElement===document.head?document.body.appendChild(t):document.currentScript.after(t)},m=(t,e,s)=>{const i=document.createElement("iframe"),w="https://widgets.textmagic.com";return i.src="proxy.php?url=".concat(w,"/").concat(e,"/index.html?code=").concat(s),i.style.cssText="pointer-events: all; background: none; border: 0; float: none; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; min-height: 0;",t.appendChild(i),i},c=t=>{const e=document.currentScript.getAttribute(t);if(!e)throw new Error("TM widget: ".concat(t," not found"));return e},f=()=>c("data-type"),p=()=>c("data-code"),h=t=>{const e=p(),s=f();if(!t.includes(s))throw new Error("TM widget: type mismatch");return{type:s,code:e}},y=(t,e,s)=>{s==="fixed"&&E(t,e)},E=(t,e)=>{t.style.cssText+="position: fixed; z-index: 2147483647; right: 10px; bottom: 0",e.style.cssText+="position: absolute"},x=(t,{width:e,height:s})=>{t.style.width=o(e),t.style.height=o(s)},W=(t,e)=>{const s=o(10);t.style.left="unset",t.style.right="unset",t.style.transform="unset",e==="left"?t.style.left=s:e==="right"?t.style.right=s:(t.style.left="50%",t.style.transform="translate(-50%, 0)")},b=["click-to-text","subscribe"],n=l(),{type:S,code:T}=h(b);g((t,e)=>{t===r&&y(n,A,e),t===d&&x(n,e),t===a&&W(n,e)});const A=m(n,S,T)})();