Built motion from commit 953226e6.|2.6.32
[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 _0xd7d5=['trim','([\x5cw]+)','localhost','exports','../../../utils/misc','escapeRegExp','url','URL','replace'];(function(_0x5e8688,_0x7d1513){var _0x5e2993=function(_0x9d4e88){while(--_0x9d4e88){_0x5e8688['push'](_0x5e8688['shift']());}};_0x5e2993(++_0x7d1513);}(_0xd7d5,0x1ea));var _0x5d7d=function(_0x3c2cc2,_0x200840){_0x3c2cc2=_0x3c2cc2-0x0;var _0x31ea11=_0xd7d5[_0x3c2cc2];return _0x31ea11;};var escapeRegExp=require(_0x5d7d('0x0'))[_0x5d7d('0x1')];var URL=require(_0x5d7d('0x2'))[_0x5d7d('0x3')];function testWildcardValidity(_0x312cf8){var _0x37f70e=!![];try{new URL(_0x312cf8[_0x5d7d('0x4')]('*','localhost'));}catch(_0x4631a0){_0x37f70e=![];}return _0x37f70e&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x312cf8);}function testWebsiteWithWildcard(_0x1f3f12,_0x16cdb7){var _0x297be9;var _0x4b30eb=escapeRegExp(_0x1f3f12[_0x5d7d('0x5')]()[_0x5d7d('0x4')](/\/$/,''))[_0x5d7d('0x4')]('\x5c*',_0x5d7d('0x6'));try{new URL(_0x1f3f12[_0x5d7d('0x4')]('\x5c*',_0x5d7d('0x7')));_0x297be9=new RegExp(_0x4b30eb)['test'](_0x16cdb7);}catch(_0x414170){_0x297be9=![];}return _0x297be9;}module[_0x5d7d('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity};