"use strict";const D=require("./Env-a6f11491.js"),E=require("@accelbyte/sdk"),y=require("./merge-a4eeca79.js");var x={},T={get exports(){return x},set exports(e){x=e}},A={},N={get exports(){return A},set exports(e){A=e}};(function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=p;var u=g(y.assertStringExports),m=g(y.mergeExports);function g(r){return r&&r.__esModule?r:{default:r}}var o={require_tld:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_numeric_tld:!1,allow_wildcard:!1};function p(r,d){(0,u.default)(r),d=(0,m.default)(d,o),d.allow_trailing_dot&&r[r.length-1]==="."&&(r=r.substring(0,r.length-1)),d.allow_wildcard===!0&&r.indexOf("*.")===0&&(r=r.substring(2));var h=r.split("."),s=h[h.length-1];return d.require_tld&&(h.length<2||!/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test(s)||/\s/.test(s))||!d.allow_numeric_tld&&/^\d+$/.test(s)?!1:h.every(function(c){return!(c.length>63||!/^[a-z_\u00a1-\uffff0-9-]+$/i.test(c)||/[\uff01-\uff5e]/.test(c)||/^-|-$/.test(c)||!d.allow_underscores&&/_/.test(c))})}e.exports=n.default,e.exports.default=n.default})(N,A);var L={},j={get exports(){return L},set exports(e){L=e}};(function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=h;var u=m(y.assertStringExports);function m(s){return s&&s.__esModule?s:{default:s}}var g="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",o="(".concat(g,"[.]){3}").concat(g),p=new RegExp("^".concat(o,"$")),r="(?:[0-9a-fA-F]{1,4})",d=new RegExp("^("+"(?:".concat(r,":){7}(?:").concat(r,"|:)|")+"(?:".concat(r,":){6}(?:").concat(o,"|:").concat(r,"|:)|")+"(?:".concat(r,":){5}(?::").concat(o,"|(:").concat(r,"){1,2}|:)|")+"(?:".concat(r,":){4}(?:(:").concat(r,"){0,1}:").concat(o,"|(:").concat(r,"){1,3}|:)|")+"(?:".concat(r,":){3}(?:(:").concat(r,"){0,2}:").concat(o,"|(:").concat(r,"){1,4}|:)|")+"(?:".concat(r,":){2}(?:(:").concat(r,"){0,3}:").concat(o,"|(:").concat(r,"){1,5}|:)|")+"(?:".concat(r,":){1}(?:(:").concat(r,"){0,4}:").concat(o,"|(:").concat(r,"){1,6}|:)|")+"(?::((?::".concat(r,"){0,5}:").concat(o,"|(?::").concat(r,"){1,7}|:))")+")(%[0-9a-zA-Z-.:]{1,})?$");function h(s){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if((0,u.default)(s),c=String(c),!c)return h(s,4)||h(s,6);if(c==="4"){if(!p.test(s))return!1;var q=s.split(".").sort(function(F,P){return F-P});return q[3]<=255}return c==="6"?!!d.test(s):!1}e.exports=n.default,e.exports.default=n.default})(j,L);(function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=M;var u=p(y.assertStringExports),m=p(A),g=p(L),o=p(y.mergeExports);function p(t){return t&&t.__esModule?t:{default:t}}function r(t,a){return q(t)||c(t,a)||h(t,a)||d()}function d(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function h(t,a){if(t){if(typeof t=="string")return s(t,a);var i=Object.prototype.toString.call(t).slice(8,-1);if(i==="Object"&&t.constructor&&(i=t.constructor.name),i==="Map"||i==="Set")return Array.from(t);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return s(t,a)}}function s(t,a){(a==null||a>t.length)&&(a=t.length);for(var i=0,f=new Array(a);i<a;i++)f[i]=t[i];return f}function c(t,a){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(t)))){var i=[],f=!0,_=!1,U=void 0;try{for(var w=t[Symbol.iterator](),v;!(f=(v=w.next()).done)&&(i.push(v.value),!(a&&i.length===a));f=!0);}catch(l){_=!0,U=l}finally{try{!f&&w.return!=null&&w.return()}finally{if(_)throw U}}return i}}function q(t){if(Array.isArray(t))return t}var F={protocols:["http","https","ftp"],require_tld:!0,require_protocol:!1,require_host:!0,require_port:!1,require_valid_protocol:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_protocol_relative_urls:!1,allow_fragments:!0,allow_query_components:!0,validate_length:!0},P=/^\[([^\]]+)\](?::([0-9]+))?$/;function k(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function I(t,a){for(var i=0;i<a.length;i++){var f=a[i];if(t===f||k(f)&&f.test(t))return!0}return!1}function M(t,a){if((0,u.default)(t),!t||/[\s<>]/.test(t)||t.indexOf("mailto:")===0||(a=(0,o.default)(a,F),a.validate_length&&t.length>=2083)||!a.allow_fragments&&t.includes("#")||!a.allow_query_components&&(t.includes("?")||t.includes("&")))return!1;var i,f,_,U,w,v,l,S;if(l=t.split("#"),t=l.shift(),l=t.split("?"),t=l.shift(),l=t.split("://"),l.length>1){if(i=l.shift().toLowerCase(),a.require_valid_protocol&&a.protocols.indexOf(i)===-1)return!1}else{if(a.require_protocol)return!1;if(t.substr(0,2)==="//"){if(!a.allow_protocol_relative_urls)return!1;l[0]=t.substr(2)}}if(t=l.join("://"),t==="")return!1;if(l=t.split("/"),t=l.shift(),t===""&&!a.require_host)return!0;if(l=t.split("@"),l.length>1){if(a.disallow_auth||l[0]===""||(f=l.shift(),f.indexOf(":")>=0&&f.split(":").length>2))return!1;var V=f.split(":"),O=r(V,2),B=O[0],C=O[1];if(B===""&&C==="")return!1}U=l.join("@"),v=null,S=null;var b=U.match(P);if(b?(_="",S=b[1],v=b[2]||null):(l=U.split(":"),_=l.shift(),l.length&&(v=l.join(":"))),v!==null&&v.length>0){if(w=parseInt(v,10),!/^[0-9]+$/.test(v)||w<=0||w>65535)return!1}else if(a.require_port)return!1;return a.host_whitelist?I(_,a.host_whitelist):!(!(0,g.default)(_)&&!(0,m.default)(_,a)&&(!S||!(0,g.default)(S,6))||(_=_||S,a.host_blacklist&&I(_,a.host_blacklist)))}e.exports=n.default,e.exports.default=n.default})(T,x);const H=y.getDefaultExportFromCjs(x),$=class{static silentUrlBuilder(e){try{return new URL(e)}catch{return null}}static silentSearchParamsBuilder(e){try{return new URLSearchParams(e)}catch{return new URLSearchParams("")}}static makeAbsolutePath(e){return`/${E.UrlHelper.trimSlashFromStringStart(e)}`}static transformToValidURLOrUndefined(e){try{if(e)return new URL(e)}catch{}}static isValidUrl(e){return typeof e!="string"?!1:H(e,{protocols:["http","https"],require_tld:!1})&&e}static isImageURL(e){return!!this.isValidUrl(e)&&e.match(/\.(jpeg|jpg|gif|png)$/)!=null}static getCurrentPathWithNoBaseName(){return window.location.pathname.slice(D.Env.PLAYER_PORTAL_BASE_URL.length)}static getRedirectUrl(e,n){return E.DesktopChecker.isDesktopApp()?`${e}${E.UrlHelper.trimSlashFromStringStart(n)}`:`${E.UrlHelper.combineURLPaths(e,n)}`}static getRouterRedirection(e,n){const u=new URL(e),m=new URL(n),g=u.origin===window.location.origin,o=u.origin===m.origin;return g||D.Env.IS_DEV_MODE&&o?`${u.pathname}${u.search}`:null}};let R=$;R.stripColonFromProtocol=e=>e[e.length-1]===":"?e.slice(0,e.length-1):e;R.checkUrlValidity=(e,n=!0)=>$.isValidUrl2(e,n)?null:`${e} is not a valid URL.`;R.isValidUrl2=(e,n=!0)=>{try{return Boolean(new URL(e))}catch(u){return n&&console.error(u),!1}};R.fixUrl=e=>$.isValidUrl2(e,!1)?e:`https://${e}`;R.buildURLSearchParamsFromObject=e=>{const n={};for(const u in e)e[u]&&(n[u]=`${e[u]}`);return new URLSearchParams(n)};exports.UrlUtils=R;
