b2f1a178b62d1d98214cc8f22d01d1fb1b79dc76
[motion2.git] / server / api / chatWebsite / helpers / wildcard-expressions.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x24bb=['test','exports','../../../utils/misc','url','localhost','replace','([\x5cw]+)'];(function(_0x1dece9,_0x2cd405){var _0x449378=function(_0x13b0ec){while(--_0x13b0ec){_0x1dece9['push'](_0x1dece9['shift']());}};_0x449378(++_0x2cd405);}(_0x24bb,0x19f));var _0xb24b=function(_0x35d182,_0x546ed3){_0x35d182=_0x35d182-0x0;var _0x4eb48a=_0x24bb[_0x35d182];return _0x4eb48a;};var escapeRegExp=require(_0xb24b('0x0'))['escapeRegExp'];var URL=require(_0xb24b('0x1'))['URL'];function testWildcardValidity(_0x2f062f){var _0x10f8ed=!![];try{new URL(_0x2f062f['replace']('*',_0xb24b('0x2')));}catch(_0x48ff68){_0x10f8ed=![];}return _0x10f8ed&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x2f062f);}function testWebsiteWithWildcard(_0x2af39f,_0x4062b5){var _0x45588a;var _0x51e19e=escapeRegExp(_0x2af39f['trim']()[_0xb24b('0x3')](/\/$/,''))[_0xb24b('0x3')]('\x5c*',_0xb24b('0x4'));try{new URL(_0x2af39f[_0xb24b('0x3')]('\x5c*',_0xb24b('0x2')));_0x45588a=new RegExp(_0x51e19e)[_0xb24b('0x5')](_0x4062b5);}catch(_0x268f76){_0x45588a=![];}return _0x45588a;}module[_0xb24b('0x6')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity};