WordPress/wp-includes/js/dist/url.min.js
gziolo 2ec4c366e6 Build: Update webpack to v5.x
Update webpack version to latest version https://www.npmjs.com/package/webpack. This aligns closer with how the Gutenberg plugin handles WordPress packages. Related update in Gutenberg from August 2021: https://github.com/WordPress/gutenberg/pull/33818.

Props walbo, desrosj, mukesh27.
Fixes #51750.



Built from https://develop.svn.wordpress.org/trunk@53135


git-svn-id: http://core.svn.wordpress.org/trunk@52724 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-11 12:04:30 +00:00

2 lines
4.6 KiB
JavaScript

/*! This file is auto-generated */
!function(){"use strict";var t={d:function(n,e){for(var r in e)t.o(e,r)&&!t.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:e[r]})},o:function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},n={};function e(t){try{return new URL(t),!0}catch{return!1}}t.r(n),t.d(n,{addQueryArgs:function(){return b},buildQueryString:function(){return g},cleanForSlug:function(){return U},filterURLForDisplay:function(){return P},getAuthority:function(){return c},getFilename:function(){return x},getFragment:function(){return h},getPath:function(){return f},getPathAndQueryString:function(){return d},getProtocol:function(){return u},getQueryArg:function(){return w},getQueryArgs:function(){return m},getQueryString:function(){return a},hasQueryArg:function(){return A},isEmail:function(){return o},isURL:function(){return e},isValidAuthority:function(){return s},isValidFragment:function(){return y},isValidPath:function(){return l},isValidProtocol:function(){return i},isValidQueryString:function(){return p},normalizePath:function(){return Q},prependHTTP:function(){return S},removeQueryArgs:function(){return j},safeDecodeURI:function(){return O},safeDecodeURIComponent:function(){return $}});const r=/^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i;function o(t){return r.test(t)}function u(t){const n=/^([^\s:]+:)/.exec(t);if(n)return n[1]}function i(t){return!!t&&/^[a-z\-.\+]+[0-9]*:$/i.test(t)}function c(t){const n=/^[^\/\s:]+:(?:\/\/)?\/?([^\/\s#?]+)[\/#?]{0,1}\S*$/.exec(t);if(n)return n[1]}function s(t){return!!t&&/^[^\s#?]+$/.test(t)}function f(t){const n=/^[^\/\s:]+:(?:\/\/)?[^\/\s#?]+[\/]([^\s#?]+)[#?]{0,1}\S*$/.exec(t);if(n)return n[1]}function l(t){return!!t&&/^[^\s#?]+$/.test(t)}function a(t){let n;try{n=new URL(t,"http://example.com").search.substring(1)}catch(t){}if(n)return n}function g(t){let n="";const e=Object.entries(t);let r;for(;r=e.shift();){let[t,o]=r;if(Array.isArray(o)||o&&o.constructor===Object){const n=Object.entries(o).reverse();for(const[r,o]of n)e.unshift([`${t}[${r}]`,o])}else void 0!==o&&(null===o&&(o=""),n+="&"+[t,o].map(encodeURIComponent).join("="))}return n.substr(1)}function p(t){return!!t&&/^[^\s#?\/]+$/.test(t)}function d(t){const n=f(t),e=a(t);let r="/";return n&&(r+=n),e&&(r+=`?${e}`),r}function h(t){const n=/^\S+?(#[^\s\?]*)/.exec(t);if(n)return n[1]}function y(t){return!!t&&/^#[^\s#?\/]*$/.test(t)}function m(t){return(a(t)||"").replace(/\+/g,"%20").split("&").reduce(((t,n)=>{const[e,r=""]=n.split("=").filter(Boolean).map(decodeURIComponent);if(e){!function(t,n,e){const r=n.length,o=r-1;for(let u=0;u<r;u++){let r=n[u];!r&&Array.isArray(t)&&(r=t.length.toString());const i=!isNaN(Number(n[u+1]));t[r]=u===o?e:t[r]||(i?[]:{}),Array.isArray(t[r])&&!i&&(t[r]={...t[r]}),t=t[r]}}(t,e.replace(/\]/g,"").split("["),r)}return t}),{})}function b(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0;if(!n||!Object.keys(n).length)return t;let e=t;const r=t.indexOf("?");return-1!==r&&(n=Object.assign(m(t),n),e=e.substr(0,r)),e+"?"+g(n)}function w(t,n){return m(t)[n]}function A(t,n){return void 0!==w(t,n)}function j(t){const n=t.indexOf("?");if(-1===n)return t;const e=m(t),r=t.substr(0,n);for(var o=arguments.length,u=new Array(o>1?o-1:0),i=1;i<o;i++)u[i-1]=arguments[i];u.forEach((t=>delete e[t]));const c=g(e);return c?r+"?"+c:r}const v=/^(?:[a-z]+:|#|\?|\.|\/)/i;function S(t){return t?(t=t.trim(),v.test(t)||o(t)?t:"http://"+t):t}function O(t){try{return decodeURI(t)}catch(n){return t}}function $(t){try{return decodeURIComponent(t)}catch(n){return t}}function P(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=t.replace(/^(?:https?:)\/\/(?:www\.)?/,"");e.match(/^[^\/]+\/$/)&&(e=e.replace("/",""));const r=/([\w|:])*\.(?:jpg|jpeg|gif|png|svg)/;if(!n||e.length<=n||!e.match(r))return e;e=e.split("?")[0];const o=e.split("/"),u=o[o.length-1];if(u.length<=n)return"…"+e.slice(-n);const i=u.lastIndexOf("."),[c,s]=[u.slice(0,i),u.slice(i+1)],f=c.slice(-3)+"."+s;return u.slice(0,n-f.length-1)+"…"+f}var R=window.lodash;function U(t){return t?(0,R.trim)((0,R.deburr)(t).replace(/[\s\./]+/g,"-").replace(/[^\w-]+/g,"").toLowerCase(),"-"):""}function x(t){let n;try{n=new URL(t,"http://example.com").pathname.split("/").pop()}catch(t){}if(n)return n}function Q(t){const n=t.split("?"),e=n[1],r=n[0];return e?r+"?"+e.split("&").map((t=>t.split("="))).sort(((t,n)=>t[0].localeCompare(n[0]))).map((t=>t.join("="))).join("&"):r}(window.wp=window.wp||{}).url=n}();