1import{aW as b,_ as g,aX as v,aY as y,$ as w}from"./index.ddc2eb7f.js";import C from"./TmlIconButton.191cd413.js";import{f as k}from"./faCopy.79a3668d.js";import{f as P,a as j}from"./faTwitter.3e917b24.js";import{N as E,D as l,E as u,f as O,a5 as p,W as _}from"./vue.00f7c436.js";import{c as S}from"./copyToClipboard.c31b50ce.js";import"./sentry.09480738.js";var c={},d;function B(){return d||(d=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="far",a="envelope",s=512,r=512,i=[128386,9993,61443],n="f0e0",o="M0 128C0 92.65 28.65 64 64 64H448C483.3 64 512 92.65 512 128V384C512 419.3 483.3 448 448 448H64C28.65 448 0 419.3 0 384V128zM48 128V150.1L220.5 291.7C241.1 308.7 270.9 308.7 291.5 291.7L464 150.1V127.1C464 119.2 456.8 111.1 448 111.1H64C55.16 111.1 48 119.2 48 127.1L48 128zM48 212.2V384C48 392.8 55.16 400 64 400H448C456.8 400 464 392.8 464 384V212.2L322 328.8C283.6 360.3 228.4 360.3 189.1 328.8L48 212.2z";e.definition={prefix:t,iconName:a,icon:[s,r,i,n,o]},e.faEnvelope=e.definition,e.prefix=t,e.iconName=a,e.width=s,e.height=r,e.ligatures=i,e.unicode=n,e.svgPathData=o,e.aliases=i}(c)),c}var U=B(),h={},f;function D(){return f||(f=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="fab",a="pinterest-p",s=384,r=512,i=[],n="f231",o="M204 6.5C101.4 6.5 0 74.9 0 185.6 0 256 39.6 296 63.6 296c9.9 0 15.6-27.6 15.6-35.4 0-9.3-23.7-29.1-23.7-67.8 0-80.4 61.2-137.4 140.4-137.4 68.1 0 118.5 38.7 118.5 109.8 0 53.1-21.3 152.7-90.3 152.7-24.9 0-46.2-18-46.2-43.8 0-37.8 26.4-74.4 26.4-113.4 0-66.2-93.9-54.2-93.9 25.8 0 16.8 2.1 35.4 9.6 50.7-13.8 59.4-42 147.9-42 209.1 0 18.9 2.7 37.5 4.5 56.4 3.4 3.8 1.7 3.4 6.9 1.5 50.4-69 48.6-82.5 71.4-172.8 12.3 23.4 44.1 36 69.3 36 106.2 0 153.9-103.5 153.9-196.8C384 71.3 298.2 6.5 204 6.5z";e.definition={prefix:t,iconName:a,icon:[s,r,i,n,o]},e.faPinterestP=e.definition,e.prefix=t,e.iconName=a,e.width=s,e.height=r,e.ligatures=i,e.unicode=n,e.svgPathData=o,e.aliases=i}(h)),h}var L=D();const T={type:"email",label:"Email",icon:U.faEnvelope,baseUrl:"mailto:",paramTransformer:e=>({subject:e.title,body:[e.text,e.url].filter(t=>t).join(` 2`)})},V={type:"facebook",label:"Facebook",icon:P.faFacebookF,baseUrl:"https://www.facebook.com/sharer/sharer.php",paramTransformer:e=>{const t={u:b(e.url),quote:[e.title,e.text].filter(a=>a).join(` 3`),hashtag:e.hashtags?e.hashtags[0].replace(/ /g,""):void 0};return t.hashtag&&t.hashtag[0]!=="#"&&(t.hashtag="#"+t.hashtag),t}},F={type:"twitter",label:"Twitter",icon:j.faTwitter,baseUrl:"https://twitter.com/intent/tweet",paramTransformer:e=>{var s;const t=(s=e.hashtags)==null?void 0:s.filter(r=>r).map(r=>r.replace(/ /g,"")).join(","),a=[e.title,e.text].filter(r=>r).join(` 4`);return{url:b(e.url),text:a,hashtags:t}}},M={type:"pinterest",label:"Pinterest",icon:L.faPinterestP},N={type:"copyUrl",label:"Copy URL",icon:k.faCopy},m={email:T,facebook:V,twitter:F,pinterest:M,copyUrl:N},q={name:"TmlShareButton",components:{TmlIconButton:C},props:{type:{type:String,required:!0,validator:e=>Object.keys(m).includes(e)},shareOptions:{type:Object,required:!1,validator:e=>{const t=["url","title","text","hashtags"];return Object.keys(e).every(r=>t.includes(r))?!e.hashtags||Array.isArray(e.hashtags):!1}},textColor:String,iconColor:String,backgroundColor:String,backgroundGradient:String,maxSize:String,showLabel:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},disabledMessage:{type:String,default:"Oops... Looks like this page doesn't have a sharable URL yet"}},data(){return{shareObjects:m,openedEmailClient:!1}},computed:{shareObject(){return this.shareObjects[this.type]},iconProps(){return{href:this.href,icon:this.shareObject.icon,text:this.showLabel?this.shareObject.label:null,title:this.showLabel?null:this.shareObject.label,ariaLabel:this.shareObject.label,disabled:this.disabled,iconColor:this.iconColor,backgroundColor:this.backgroundColor,textColor:this.textColor,maxSize:this.maxSize||"3rem",circle:!0}},pageUrl(){return this.$route.meta.shareToHomepage?`${window.location.origin}/`:window.location.href},href(){var a;if(!((a=this.shareObject)!=null&&a.baseUrl))return;const e={...this.shareOptions};e.url=e.url||this.pageUrl;let t=this.shareObject.paramTransformer(e);return t=v(t,s=>!s),y(this.shareObject.baseUrl,t)}},mounted(){this.type==="pinterest"&&(Array.from(document.scripts).some(t=>t.src.includes("https://assets.pinterest.com/js/pinit_main.js"))||setTimeout(()=>{w("https://assets.pinterest.com/js/pinit.js")},1e3))},beforeUnmount(){window.removeEventListener("blur",this.onBlur)},methods:{onClick(e){switch(this.type){case"email":this.onEmail();return;case"copyUrl":e.preventDefault(),this.onCopyUrl();return;case"pinterest":e.preventDefault(),this.$refs.pinterestWrapper.click();return;default:e.preventDefault(),window.open(this.href,"_blank","width=500, height=500, noopener, noreferrer")}},onCopyUrl(){var e;S(((e=this.shareOptions)==null?void 0:e.url)||this.pageUrl),this.$dialogs.showSnackBar({message:"\u2713 copied to clipboard"})},onEmail(){window.addEventListener("blur",this.onBlur),setTimeout(()=>{this.openedEmailClient||this.$dialogs.showSnackBar({type:"error",message:"Oops...looks like you don't have an email client. Please try copying the link instead."}),this.openedEmailClient=!1,window.removeEventListener("blur",this.onBlur)},1e3)},onDisabled(){this.$dialogs.showSnackBar({type:"error",message:this.disabledMessage})},onBlur(){this.openedEmailClient=!0}}},z={key:0,ref:"pinterestWrapper",href:"https://www.pinterest.com/pin/create/button/","data-
4pin-do":"buttonBookmark","data-pin-custom":"true"};function R(e,t,a,s,r,i){const n=E("tml-icon-button");return l(),u("div",null,[a.type==="pinterest"?(l(),u("a",z,[O(n,p({style:{whiteSpace:"nowrap"}},i.iconProps,{onDisabled:i.onDisabled,onClick:i.onClick}),null,16,["onDisabled","onClick"])],512)):(l(),_(n,p({key:1,style:{whiteSpace:"nowrap"}},i.iconProps,{onClick:i.onClick,onDisabled:i.onDisabled}),null,16,["onClick","onDisabled"]))])}const G=g(q,[["render",R]]);export{G as default}; 5//# sourceMappingURL=TmlShareButton.5d518501.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.