import{_ as f,o as s,c as o,V as _,a as h,n as u,d as c,i as p,F as S,r as k,v as m,w as b,f as g}from"./entry.DPwc-EV0.js";import{s as y}from"./interval-CU92HWeN.mjs";const i=[];i.facebook="https://www.facebook.com/sharer/sharer.php?u={url}&title={title}&description={desc}";i.flipboard="https://share.flipboard.com/bookmarklet/popout?v=2&url={url}&title={title}";i.instapaper="http://www.instapaper.com/edit?url={url}&title={title}&description={desc}";i.linkedin="https://www.linkedin.com/sharing/share-offsite/?url={url}";i.pinterest="https://pinterest.com/pin/create/button/?url={url}&description={title}";i.pocket="https://getpocket.com/save?url={url}&title={title}";i.quora="https://www.quora.com/share?url={url}&title={title}";i.reddit="https://www.reddit.com/submit?url={url}&title={title}";i.skype="https://web.skype.com/share?url={title}%0D%0A{url}%0D%0A{desc}";i.telegram="https://t.me/share/url?url={url}&text={title}%0D%0A{desc}";i.tumblr="https://www.tumblr.com/share/link?url={url}&name={title}&description={desc}";i.twitter="https://twitter.com/intent/tweet?text={title}&url={url}";i.whatsapp="https://api.whatsapp.com/send?text={title}%0D%0A{url}%0D%0A{desc}";const I=(e,n,t,a)=>(i[e]??"").replace(/\{url\}/g,encodeURIComponent(n)).replace(/\{title\}/g,encodeURIComponent(t)).replace(/\{desc\}/g,encodeURIComponent(a)),L={props:{network:{type:String,required:!0},url:{type:String,required:!0},title:{type:String,required:!0},description:{type:String,default:""},shareWindowSize:{type:Object,default:()=>({width:626,height:436})}},data(){return{shareWindowSizeTop:0,shareWindowSizeLeft:0,shareWindowSizeWindow:void 0,shareWindowSizeInterval:null}},computed:{renderedShareLink(){var e;return I((e=this.network)==null?void 0:e.toLowerCase(),this.url,this.title,this.description)}},methods:{resizeShareWindow(){const e=window.innerWidth||document.documentElement.clientWidth||window.screenX,n=window.innerHeight||document.documentElement.clientHeight||window.screenY,t=e/window.screen.availWidth;this.shareWindowSizeLeft=(e-this.shareWindowSize.width)/2/t+(window.screenLeft!==void 0?window.screenLeft:window.screenX),this.shareWindowSizeTop=(n-this.shareWindowSize.height)/2/t+(window.screenTop!==void 0?window.screenTop:window.screenY)},openShareWindow(){var e;this.resizeShareWindow(),this.shareWindow&&this.winInterval&&(clearInterval(this.winInterval),this.shareWindow.close()),this.shareWindow=window.open(this.renderedShareLink,"web-share-link-"+((e=this.network)==null?void 0:e.toLowerCase()),",height="+this.shareWindowSize.height+",width="+this.shareWindowSize.width+",left="+this.shareWindowSizeLeft+",top="+this.shareWindowSizeTop+",screenX="+this.shareWindowSizeLeft+",screenY="+this.shareWindowSizeTop),this.shareWindow&&(this.shareWindow.focus(),this.winInterval=y(()=>{(!this.shareWindow||this.shareWindow.closed)&&(clearInterval(this.winInterval),this.shareWindow=null)},500))}}};function v(e,n,t,a,l,r){return s(),o("a",{href:"javascript:void(0)",onClick:n[0]||(n[0]=d=>r.openShareWindow())},[_(e.$slots,"default")])}const z=f(L,[["render",v]]),x={props:{contentId:{type:Number,required:!0},title:{type:String,required:!0},description:{type:String},iconWidth:{type:Number,default:40},useEmail:{type:Boolean,default:!0},path:{type:String,required:!0}},data(){return{shareNetworks:["facebook","linkedin","twitter","pinterest"],fullURL:"",showAllIcons:!1}},computed:{filterShareNetworks(){return this.showAllIcons?this.shareNetworks:this.shareNetworks.slice(0,4)},iconElementWidth(){return 3/5*this.iconWidth},iconWrapperStyle(){return{padding:`${this.iconWidth/5}px`}},mailToLink(){return`mailto:?subject=${this.title}&body=${this.fullURL}%0D%0A${this.description??""}`}},mounted(){var n;this.fullURL=window.location.hostname+this.path;const e=(n=this.$ss.contentStyle)==null?void 0:n.socialShareLinks;if(e!==void 0){this.shareNetworks=[];for(let t=0;t<(e==null?void 0:e.length);t++){const a=e[t];this.shareNetworks.push(a)}}},methods:{showAll(){this.showAllIcons=!this.showAllIcons},getIcon(e){return e==="flipboard"?"simple-icons:flipboard":e==="twitter"?"fa6-brands:x-twitter":`mdi:${e==null?void 0:e.toLowerCase()}`}}},A={class:"ebm-share-wrapper"},N={key:0,class:"ebm-share-item printer-icon"},C=["href"],E={key:1,class:"ebm-share-item email-icon"},q=["href"],T={key:2,class:"ebm-plus-icon"};function R(e,n,t,a,l,r){const d=g,W=z;return s(),o("div",A,[h("ul",{class:m(["ebm-share-list",l.showAllIcons?"expanded":"collapsed"])},[t.contentId?(s(),o("li",N,[h("a",{href:`/print/content/${t.contentId}`,target:"_blank"},[h("div",{style:u(r.iconWrapperStyle)},[c(d,{icon:"mdi:printer","icon-color":"white",width:r.iconElementWidth},null,8,["width"])],4)],8,C)])):p("",!0),t.useEmail?(s(),o("li",E,[h("a",{href:r.mailToLink},[h("div",{style:u(r.iconWrapperStyle)},[c(d,{icon:"mdi:email","icon-color":"white",width:r.iconElementWidth},null,8,["width"])],4)],8,q)])):p("",!0),(s(!0),o(S,null,k(r.filterShareNetworks,w=>(s(),o("li",{key:w,class:m(`ebm-share-item ${w}-icon`)},[c(W,{network:w,url:l.fullURL,title:t.title,description:t.description},{default:b(()=>[h("div",{style:u(r.iconWrapperStyle)},[c(d,{icon:r.getIcon(w),"icon-color":"white",width:r.iconElementWidth},null,8,["icon","width"])],4)]),_:2},1032,["network","url","title","description"])],2))),128)),l.shareNetworks.length>4?(s(),o("li",T,[c(d,{icon:l.showAllIcons?"bxs:left-arrow":"bxs:right-arrow",width:r.iconElementWidth,onClick:r.showAll},null,8,["icon","width","onClick"])])):p("",!0)],2)])}const B=f(x,[["render",R],["__scopeId","data-v-9ced0684"]]);export{B as default};