wp_back/wp-content/plugins/wordpress-seo/js/dist/externals/helpers.js

30 lines
48 KiB
JavaScript
Raw Normal View History

2024-05-20 15:37:46 +03:00
window.yoast=window.yoast||{},window.yoast.helpers=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=400)}({0:function(t,e){t.exports=window.yoast.propTypes},1:function(t,e){t.exports=window.wp.element},12:function(t,e){function n(){return t.exports=n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},t.exports.default=t.exports,t.exports.__esModule=!0,n.apply(this,arguments)}t.exports=n,t.exports.default=t.exports,t.exports.__esModule=!0},181:function(t,e,n){(function(e){(function(){"use strict";var e=this;function n(t){return"string"==typeof t}function r(t,e,n){return t.call.apply(t.bind,arguments)}function o(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function i(t,e,n){return(i=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?r:o).apply(null,arguments)}function a(t){var e=st;function n(){}n.prototype=e.prototype,t.G=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.F=function(t,n,r){for(var o=Array(arguments.length-2),i=2;i<arguments.length;i++)o[i-2]=arguments[i];return e.prototype[n].apply(t,o)}}var s=String.prototype.trim?function(t){return t.trim()}:function(t){return t.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")};function u(t,e){return-1!=t.indexOf(e)}function c(t,e){return t<e?-1:t>e?1:0}var l,f=Array.prototype.indexOf?function(t,e,n){return Array.prototype.indexOf.call(t,e,n)}:function(t,e,r){if(r=null==r?0:0>r?Math.max(0,t.length+r):r,n(t))return n(e)&&1==e.length?t.indexOf(e,r):-1;for(;r<t.length;r++)if(r in t&&t[r]===e)return r;return-1},h=Array.prototype.forEach?function(t,e,n){Array.prototype.forEach.call(t,e,n)}:function(t,e,r){for(var o=t.length,i=n(t)?t.split(""):t,a=0;a<o;a++)a in i&&e.call(r,i[a],a,t)},p=Array.prototype.filter?function(t,e,n){return Array.prototype.filter.call(t,e,n)}:function(t,e,r){for(var o=t.length,i=[],a=0,s=n(t)?t.split(""):t,u=0;u<o;u++)if(u in s){var c=s[u];e.call(r,c,u,t)&&(i[a++]=c)}return i},d=Array.prototype.reduce?function(t,e,n,r){return r&&(e=i(e,r)),Array.prototype.reduce.call(t,e,n)}:function(t,e,n,r){var o=n;return h(t,(function(n,i){o=e.call(r,o,n,i,t)})),o},y=Array.prototype.some?function(t,e,n){return Array.prototype.some.call(t,e,n)}:function(t,e,r){for(var o=t.length,i=n(t)?t.split(""):t,a=0;a<o;a++)if(a in i&&e.call(r,i[a],a,t))return!0;return!1};function g(t,e,n){return 2>=arguments.length?Array.prototype.slice.call(t,e):Array.prototype.slice.call(t,e,n)}t:{var b=e.navigator;if(b){var m=b.userAgent;if(m){l=m;break t}}l=""}var w,v,E=u(l,"Opera")||u(l,"OPR"),x=u(l,"Trident")||u(l,"MSIE"),T=u(l,"Edge"),N=u(l,"Gecko")&&!(u(l.toLowerCase(),"webkit")&&!u(l,"Edge"))&&!(u(l,"Trident")||u(l,"MSIE"))&&!u(l,"Edge"),_=u(l.toLowerCase(),"webkit")&&!u(l,"Edge");function O(){var t=e.document;return t?t.documentMode:void 0}t:{var j="",R=(v=l,N?/rv\:([^\);]+)(\)|;)/.exec(v):T?/Edge\/([\d\.]+)/.exec(v):x?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(v):_?/WebKit\/(\S+)/.exec(v
width: ${t=>t.size};
height: ${t=>t.size};
flex: none;
`;class A extends _.a.Component{render(){const{iconSet:t,icon:e,className:n,color:r,size:o}=this.props,i=t[e];if(!i)return console.warn(`Invalid icon name ("${e}") passed to the SvgIcon component.`),null;const a=i.path,s=i.viewbox,u=["yoast-svg-icon","yoast-svg-icon-"+e,n].filter(Boolean).join(" "),c=i.CustomComponent?i.CustomComponent:P;return Object(E.createElement)(c,{"aria-hidden":!0,role:"img",focusable:"false",size:o,className:u,xmlns:"http://www.w3.org/2000/svg",viewBox:s,fill:r},Object(R.isArray)(a)?a:Object(E.createElement)("path",{d:a}))}}A.propTypes={icon:T.a.string.isRequired,iconSet:T.a.object.isRequired,color:T.a.string,size:T.a.string,className:T.a.string},A.defaultProps={size:"16px",color:"currentColor",className:""};var S,D=t=>{const e=e=>Object(E.createElement)(A,v()({},e,{iconSet:t}));return e.propTypes={icon:T.a.string.isRequired,color:T.a.string,size:T.a.string,className:T.a.string},e.defaultProps={size:"16px",color:"currentColor",className:""},e},I=function(){return[" ","\\n","\\r","\\t"," "," ",".",",","'","(",")",'"',"+","-",";","!","?",":","/","»","«","","","<",">"]},B=function(t){return(t=(t=t.replace(/\s{2,}/g," ")).replace(/\s\.$/,".")).replace(/^\s+|\s+$/g,"")},k=n(50),C=n.n(k),U=["address","article","aside","blockquote","canvas","dd","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","section","table","tfoot","ul","video"],F=["b","big","i","small","tt","abbr","acronym","cite","code","dfn","em","kbd","strong","samp","time","var","a","bdo","br","img","map","object","q","script","span","sub","sup","button","input","label","select","textarea"],M=(new RegExp("^("+U.join("|")+")$","i"),new RegExp("^("+F.join("|")+")$","i"),new RegExp("^<("+U.join("|")+")[^>]*?>$","i")),L=new RegExp("^</("+U.join("|")+")[^>]*?>$","i"),Y=new RegExp("^<("+F.join("|")+")[^>]*>$","i"),H=new RegExp("^</("+F.join("|")+")[^>]*>$","i"),$=/^<([^>\s/]+)[^>]*>$/,q=/^<\/([^>\s]+)[^>]*>$/,V=/^[^<]+$/,G=/^<[^><]*$/,z=/<!--(.|[\r\n])*?-->/g,X=[];Object(R.memoize)((function(t){var e=[],n=0,r="",o="",i="";return t=t.replace(z,""),X=[],(S=C()((function(t){X.push(t)}))).addRule(V,"content"),S.addRule(G,"greater-than-sign-content"),S.addRule(M,"block-start"),S.addRule(L,"block-end"),S.addRule(Y,"inline-start"),S.addRule(H,"inline-end"),S.addRule($,"other-element-start"),S.addRule(q,"other-element-end"),S.onText(t),S.end(),Object(R.forEach)(X,(function(t,a){var s=X[a+1];switch(t.type){case"content":case"greater-than-sign-content":case"inline-start":case"inline-end":case"other-tag":case"other-element-start":case"other-element-end":case"greater than sign":s&&(0!==n||"block-start"!==s.type&&"block-end"!==s.type)?o+=t.src:(o+=t.src,e.push(o),r="",o="",i="");break;case"block-start":0!==n&&(""!==o.trim()&&e.push(o),o="",i=""),n++,r=t.src;break;case"block-end":n--,i=t.src,""!==r&&""!==i?e.push(r+o+i):""!==o.trim()&&e.push(o),r="",o="",i=""}n<0&&(n=0)})),e})),new RegExp("^<("+U.join("|")+")[^>]*?>","i"),new RegExp("</("+U.join("|")+")[^>]*?>$","i");var W=function(t){return t=t.replace(/(<([^>]+)>)/gi," "),B(t)};const Q=["script","style"],J=[":","https:","http:"],K={a:["href","target","rel"]},Z=(t,e,n)=>{const r=[];t.forEach(t=>{if(t.nodeType!==Node.ELEMENT_NODE)return;const o=t.nodeName.toLowerCase();Q.includes(o)?t.remove():(Z(t.childNodes,e,n),e.includes(o)?((t,e)=>{t.getAttributeNames().forEach(n=>{e.includes(n)?"href"===n&&"a"===t.nodeName.toLowerCase()&&(J.includes(t.protocol)||t.removeAttribute(n)):t.removeAttribute(n)})})(t,n[o]||K[o]||[]):r.push(t))}),r.forEach(t=>t.replaceWith(...t.childNodes))},tt=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=new DOMParser,o=r.parseFromString(t,"text/html");return Z(o.body.childNodes,e,n),o.body.innerHTML};function et(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";return t.filter(Boolean).join(e)}var nt=n(4);const rt=j.a.span`
border: 0;
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute !important;
width: 1px;
word-wrap: normal !important;
// Safari+VoiceOver bug see PR 308 and My Yoast issues 445, 712 and PR 715.
transform: translateY(1em);
`,ot=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"a";class e extends _.a.Component{constructor(t){super(t),this.isYoastLink=this.isYoastLink.bind(this)}isYoastLink(t){return/yoast\.com|yoast\.test|yoa\.st/.test(t)}render(){if(!this.props.href)return null;const e=this.isYoastLink(this.props.href),n=Object.assign({},this.props,{target:"_blank",rel:e?this.props.rel:"noopener"});return _.a.createElement(t,n,this.props.children,_.a.createElement(rt,null,Object(nt.__)("(Opens in a new browser tab)","wordpress-seo")))}}return e.propTypes={children:T.a.oneOfType([T.a.node]),href:T.a.string,rel:T.a.string},e.defaultProps={children:null,href:null,rel:null},e};var it=t=>e=>t.map(t=>t(e)).filter(t=>!0!==t),at=it([t=>{const{width:e,height:n}=t,r=Object(nt.sprintf)(
/* Translators: %d expands to the minimum width, %d expands to the minimum hight */
Object(nt.__)("Your image dimensions are not suitable. The minimum dimensions are %dx%d pixels.","wordpress-seo"),200,200);return!(e<200||n<200)||r},t=>{const{type:e}=t,n=Object(nt.sprintf)(
/* Translators: %s expands to the jpg format, %s expands to the png format, %s expands to the gif format. */
Object(nt.__)("The format of the uploaded image is not supported. The supported formats are: %s, %s, %s and %s.","wordpress-seo"),"JPG","PNG","WEBP","GIF");return!!["jpg","png","gif","jpeg","webp"].includes(e)||n}]),st=it([(t,e)=>{const{width:n,height:r}=t,o=Object(nt.__)("Your image dimensions are not suitable. The minimum dimensions are %dx%d pixels. The maximum dimensions are %dx%d pixels.","wordpress-seo"),i=n>4096||r>4096;
/* Translators: %d expands to the minimum width, %d expands to the minimum height,
%d expands to the maximum width, %d expands to the maximum height. */return e&&(n<300||r<157||i)?Object(nt.sprintf)(o,300,157,4096,4096):!(n<200||r<200||i)||Object(nt.sprintf)(o,200,200,4096,4096)},t=>{const{type:e}=t,n=Object(nt.sprintf)(
/* Translators: %s expands to the gif format, %s expands to the gif format. */
Object(nt.__)("You have uploaded a %s. Please note that, if its an animated %s, only the first frame will be used.","wordpress-seo"),"GIF","GIF"),r=Object(nt.sprintf)(
/* Translators: %s expands to the jpg format, %s expands to the png format, %s expands to the gif format. */
Object(nt.__)("The format of the uploaded image is not supported. The supported formats are: %s, %s, %s and %s.","wordpress-seo"),"JPG","PNG","WEBP","GIF");return!!["jpg","jpeg","png","webp"].includes(e)||("gif"===e?n:r)},t=>{const{bytes:e}=t,n=Object(nt.sprintf)(
/* Translators: %s expands to Twitter, %s expands to the 5MB size. */
Object(nt.__)("The file size of the uploaded image is too large for %s. File size must be less than %s.","wordpress-seo"),"Twitter","5MB");return!(e>=5)||n}]);const ut=t=>document.querySelector(t),ct=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return n=>{const r=ut(t);if(r){const t=Array.isArray(n)?n.join(","):n;r.value=t}e&&e(n)}},lt=t=>{const e=ut(t);return e?e.value:null}},5:function(t,e){t.exports=window.yoast.styledComponents},50:function(t,e){var n=function(t,e){var n;for(n=0;n<t.length;n++)if(t[n].regex.test(e))return t[n]},r=function(t,e){var r,o,i;for(r=0;r<e.length;r++)if(o=n(t,e.substring(0,r+1)))i=o;else if(i)return{max_index:r,rule:i};return i?{max_index:e.length,rule:i}:void 0};t.exports=function(t){var e="",o=[],i=1,a=1,s=function(e,n){t({type:n,src:e,line:i,col:a});var r=e.split("\n");i+=r.length-1,a=(r.length>1?1:a)+r[r.length-1].length};return{addRule:function(t,e){o.push({regex:t,type:e})},onText:function(t){for(var n=e+t,i=r(o,n);i&&i.max_index!==n.length;)s(n.substring(0,i.max_index),i.rule.type),n=n.substring(i.max_index),i=r(o,n);e=n},end:function(){if(0!==e.length){var t=n(o,e);if(!t){var r=new Error("unable to tokenize");throw r.tokenizer2={buffer:e,line:i,col:a},r}s(e,t.type)}}}}}});