Built motion from commit 3c2ce842.|2.6.31
[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 _0xa76e=['replace','exports','escapeRegExp','url','localhost','test'];(function(_0x137d0c,_0x133d7e){var _0x51f5ea=function(_0x28b1e6){while(--_0x28b1e6){_0x137d0c['push'](_0x137d0c['shift']());}};_0x51f5ea(++_0x133d7e);}(_0xa76e,0xfe));var _0xea76=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xa76e[_0x4fde08];return _0x12e725;};var escapeRegExp=require('../../../utils/misc')[_0xea76('0x0')];var URL=require(_0xea76('0x1'))['URL'];function testWildcardValidity(_0x5d448a){var _0x3bfa22=!![];try{new URL(_0x5d448a['replace']('*',_0xea76('0x2')));}catch(_0x368f89){_0x3bfa22=![];}return _0x3bfa22&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xea76('0x3')](_0x5d448a);}function testWebsiteWithWildcard(_0x4ed094,_0x273c1b){var _0x48ff4f;var _0x337097=escapeRegExp(_0x4ed094['trim']()[_0xea76('0x4')](/\/$/,''))[_0xea76('0x4')]('\x5c*','([\x5cw]+)');try{new URL(_0x4ed094['replace']('\x5c*',_0xea76('0x2')));_0x48ff4f=new RegExp(_0x337097)[_0xea76('0x3')](_0x273c1b);}catch(_0x1c6723){_0x48ff4f=![];}return _0x48ff4f;}module[_0xea76('0x5')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity};