|
1
|
|
-(()=>{"use strict";const t=window.ReactDOM;window.React;const n="linear-gradient(135deg, #0040E3, #18D4FD)",e=t=>{const n=(t=>{try{const n=new URL(t);return["http:","https:"].includes(n.protocol)?n.toString():null}catch(n){return"string"==typeof t&&t.startsWith("/")&&!t.startsWith("//")?t:null}})(t);return n?`url('${n.replace(/['"()]/g,"")}')`:"none"},r=(t,n)=>{return null==(e=n)||""===e||Array.isArray(e)&&0===e.length||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&""===e.trim()||"number"==typeof e&&0===e?"":`${t}: ${n};`;var e},o=(t,o=!0,i=!0,a=!0)=>{const{type:c="solid",color:s="",gradient:l=n,image:d={},position:$="center center",attachment:u="",repeat:g="no-repeat",size:b="",overlayColor:p=""}=t||{};return"gradient"===c&&i?r("background",l):"image"===c&&a?`background: ${e(d?.url)};\n\t\t\t\t${r("background-color",p)}\n\t\t\t\t${r("background-position",$)}\n\t\t\t\t${r("background-size",b)}\n\t\t\t\t${r("background-repeat",g)}\n\t\t\t\t${r("background-attachment",u)}\n\t\t\t\t${r("background-repeat",g)}\n\t\t\t\tbackground-blend-mode: overlay;`:o&&r("background",s)},i=t=>{const{width:n="",style:e="solid",color:o="",side:i="all",radius:a=""}=t||{},c=t=>{const n=i?.toLowerCase();return n?.includes("all")||n?.includes(t)},s=`${n} ${e} ${o}`,l=`\n\t\t${n&&0!==parseInt(n)?["top","right","bottom","left"].map((t=>c(t)?`border-${t}: ${s};`:"")).join(""):""}\n\t\t${r("border-radius",a)}\n\t`;return l},a=(t,n="box")=>{const{hOffset:e="0px",vOffset:r="0px",blur:o="0px",spreed:i="0px",color:a="#7090b0",isInset:c=!1}=t||{},s=`${e} ${r} ${o}`;return("text"===n?`${s} ${a}`:`${s} ${i} ${a} ${c?"inset":""}`)||"none"},c="bBlocksSocialShare",s=window.ReactJSXRuntime,l=({attributes:t,id:e})=>{const{socials:l,alignment:d,background:$,size:u,padding:g,margin:b,border:p,shadow:h}=t,m=`#${e}`,k=`${m} ul.${c}`;return(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n\t\t${m}{\n\t\t\ttext-align: ${d};\n\t\t}\n\t\t${k} li.icon{\n\t\t\tfont-size: ${u};\n\t\t\t${o($)}\n\t\t\twidth: calc( ${u} + ${g} + ${g} );\n\t\t\theight: calc( ${u} + ${g} + ${g} );\n\t\t\tmargin: 0 calc( ${b} / 2 );\n\t\t\t${i(p)}\n\t\t\tbox-shadow: ${a(h)||"none"};\n\t\t}\n\t\t${k} li.icon img{\n\t\t\twidth: ${u};\n\t\t}\n\n\t\t${l?.map(((t,e)=>`\n\t\t\t${k} li.icon-${e} i{\n\t\t\t\t${((t,e=!0,o=!0)=>{const{fontSize:i=16,colorType:a="solid",color:c="inherit",gradient:s=n}=t||{},l="gradient"===a?`color: transparent; background-image: ${s}; -webkit-background-clip: text; background-clip: text;`:r("color",c);return`\n\t\t${i&&e?r("font-size",i?`${i}px`:""):""}\n\t\t${o?l:""}\n\t`})(t?.icon)}\n\t\t\t\tfont-size: inherit;\n\t\t\t}`)).join(" ")}\n\t\t`.replace(/\s+/g," ")}})};document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".wp-block-b-blocks-social-share").forEach((n=>{const e=JSON.parse(n.dataset.attributes),r=document.querySelector(`#${n.id} .${c}Style`);(0,t.createRoot)(r).render((0,s.jsx)(l,{attributes:e,id:n.id})),n?.removeAttribute("data-attributes")}))}))})(); |
|
1
|
+(()=>{"use strict";const t=window.ReactDOM;window.React;new class{constructor(t={}){this.defaultOptions={allowedTags:["svg","g","path","rect","circle","ellipse","line","polyline","polygon","text","tspan","defs","clipPath","mask","linearGradient","radialGradient","stop","style","title","desc"],allowedAttributes:["id","class","style","transform","xmlns","xmlns:xlink","version","baseProfile","xml:space","d","x","y","width","height","cx","cy","r","rx","ry","points","x1","y1","x2","y2","viewBox","preserveAspectRatio","overflow","fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","opacity","color","paint-order","vector-effect","shape-rendering","display","visibility","clip-path","clip-rule","clipPathUnits","mask","maskUnits","maskContentUnits","offset","stop-color","stop-opacity","gradientUnits","gradientTransform","spreadMethod","fx","fy","fr","dx","dy","text-anchor","dominant-baseline","alignment-baseline","font-family","font-size","font-style","font-weight","letter-spacing","word-spacing","textLength","lengthAdjust","role","focusable","aria-hidden","aria-label","aria-labelledby","aria-describedby"],allowedProtocols:["http","https","data"],removeScripts:!0,removeEvents:!0,removeExternalResources:!0,sanitizeStyle:!0},this.options={...this.defaultOptions,...t},this.allowedTagSet=new Set(this.options.allowedTags.map((t=>t.toLowerCase()))),this.allowedAttributeSet=new Set(this.options.allowedAttributes.map((t=>t.toLowerCase())))}sanitize(t){if("string"!=typeof t||""===t.trim())return"";const e=(new DOMParser).parseFromString(t,"image/svg+xml"),r=e.documentElement;return!r||"svg"!==r.localName.toLowerCase()||e.getElementsByTagName("parsererror").length?"":(this.removeScripts(e),this.sanitizeElements(e),(new XMLSerializer).serializeToString(e.documentElement))}async sanitizeFile(t){const e=await fetch(t),r=await e.text();return this.sanitize(`${r}`)}removeScripts(t){this.options.removeScripts&&Array.from(t.querySelectorAll("*")).forEach((t=>{t.localName.toLowerCase().includes("script")&&t.remove()}))}sanitizeElements(t){Array.from(t.querySelectorAll("*")).forEach((t=>{const e=t.localName.toLowerCase();this.allowedTagSet.has(e)?("style"===e&&this.options.sanitizeStyle&&(t.textContent=this.sanitizeCss(t.textContent)),this.sanitizeAttributes(t)):t.remove()}))}sanitizeAttributes(t){Array.from(t.attributes).forEach((e=>{const r=e.name,i=r.toLowerCase(),n=e.value;if(this.options.removeEvents&&i.startsWith("on"))return void t.removeAttribute(r);if(this.options.removeExternalResources&&("href"===i||i.endsWith(":href"))&&!this.isAllowedUrl(n))return void t.removeAttribute(r);const o=i.replace("xlink:","");this.allowedAttributeSet.has(i)||this.allowedAttributeSet.has(o)?this.options.removeExternalResources&&this.hasExternalUrl(n)?t.removeAttribute(r):"style"===i&&this.options.sanitizeStyle&&t.setAttribute(r,this.sanitizeCss(n)):t.removeAttribute(r)}))}hasExternalUrl(t){return!("string"!=typeof t||!/url\s*\(/i.test(t))&&Array.from(t.matchAll(/url\s*\(\s*['"]?([^'")]*)/gi)).some((([,t])=>!t.trim().startsWith("#")))}isAllowedUrl(t){const e=String(t||"").trim();if(e.startsWith("#"))return!0;if(/^data:/i.test(e))return this.options.allowedProtocols.includes("data")&&/^data:image\/(png|jpe?g|gif|webp);base64,/i.test(e);try{return this.options.allowedProtocols.includes(new URL(e).protocol.replace(":",""))}catch{return!1}}sanitizeCss(t){return String(t||"").replace(/expression\s*\(/gi,"").replace(/javascript:/gi,"").replace(/behavior\s*:/gi,"").replace(/binding\s*:/gi,"").replace(/@import[^;]*;?/gi,"").replace(/url\s*\(\s*(['"]?)(?!#)[^)]*\)/gi,"none")}};const e="linear-gradient(135deg, #0040E3, #18D4FD)",r=t=>{const e=(t=>{try{const e=new URL(t);return["http:","https:"].includes(e.protocol)?e.toString():null}catch(e){return"string"==typeof t&&t.startsWith("/")&&!t.startsWith("//")?t:null}})(t);return e?`url('${e.replace(/['"()]/g,"")}')`:"none"},i=(t,e)=>{return null==(r=e)||""===r||Array.isArray(r)&&0===r.length||"object"==typeof r&&0===Object.keys(r).length||"string"==typeof r&&""===r.trim()||"number"==typeof r&&0===r?"":`${t}: ${e};`;var r},n=(t,n=!0,o=!0,s=!0)=>{const{type:a="solid",color:l="",gradient:c=e,image:d={},position:p="center center",attachment:u="",repeat:h="no-repeat",size:g="",overlayColor:m=""}=t||{};return"gradient"===a&&o?i("background",c):"image"===a&&s?`background: ${r(d?.url)};\n\t\t\t\t${i("background-color",m)}\n\t\t\t\t${i("background-position",p)}\n\t\t\t\t${i("background-size",g)}\n\t\t\t\t${i("background-repeat",h)}\n\t\t\t\t${i("background-attachment",u)}\n\t\t\t\t${i("background-repeat",h)}\n\t\t\t\tbackground-blend-mode: overlay;`:n&&i("background",l)},o=t=>{const{width:e="",style:r="solid",color:n="",side:o="all",radius:s=""}=t||{},a=t=>{const e=o?.toLowerCase();return e?.includes("all")||e?.includes(t)},l=`${e} ${r} ${n}`,c=`\n\t\t${e&&0!==parseInt(e)?["top","right","bottom","left"].map((t=>a(t)?`border-${t}: ${l};`:"")).join(""):""}\n\t\t${i("border-radius",s)}\n\t`;return c},s=(t,e="box")=>{const{hOffset:r="0px",vOffset:i="0px",blur:n="0px",spreed:o="0px",color:s="#7090b0",isInset:a=!1}=t||{},l=`${r} ${i} ${n}`;return("text"===e?`${l} ${s}`:`${l} ${o} ${s} ${a?"inset":""}`)||"none"},a="bBlocksSocialShare",l=window.ReactJSXRuntime,c=({attributes:t,id:r})=>{const{socials:c,alignment:d,background:p,size:u,padding:h,margin:g,border:m,shadow:b}=t,f=`#${r}`,y=`${f} ul.${a}`;return(0,l.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n\t\t${f}{\n\t\t\ttext-align: ${d};\n\t\t}\n\t\t${y} li.icon{\n\t\t\tfont-size: ${u};\n\t\t\t${n(p)}\n\t\t\twidth: calc( ${u} + ${h} + ${h} );\n\t\t\theight: calc( ${u} + ${h} + ${h} );\n\t\t\tmargin: 0 calc( ${g} / 2 );\n\t\t\t${o(m)}\n\t\t\tbox-shadow: ${s(b)||"none"};\n\t\t}\n\t\t${y} li.icon img{\n\t\t\twidth: ${u};\n\t\t}\n\n\t\t${c?.map(((t,r)=>`\n\t\t\t${y} li.icon-${r} i{\n\t\t\t\t${((t,r=!0,n=!0)=>{const{fontSize:o=16,colorType:s="solid",color:a="inherit",gradient:l=e}=t||{},c="gradient"===s?`color: transparent; background-image: ${l}; -webkit-background-clip: text; background-clip: text;`:i("color",a);return`\n\t\t${o&&r?i("font-size",o?`${o}px`:""):""}\n\t\t${n?c:""}\n\t`})(t?.icon)}\n\t\t\t\tfont-size: inherit;\n\t\t\t}`)).join(" ")}\n\t\t`.replace(/\s+/g," ")}})};document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".wp-block-b-blocks-social-share").forEach((e=>{const r=JSON.parse(e.dataset.attributes),i=document.querySelector(`#${e.id} .${a}Style`);(0,t.createRoot)(i).render((0,l.jsx)(c,{attributes:r,id:e.id})),e?.removeAttribute("data-attributes")}))}))})(); |