8617617c053cb2dad023bacedfa923663eaa6ae3
[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 _0x69d4=['URL','localhost','test','trim','replace','../../../utils/misc','escapeRegExp'];(function(_0x132658,_0x2f14c1){var _0x2fd7ed=function(_0x3964e7){while(--_0x3964e7){_0x132658['push'](_0x132658['shift']());}};_0x2fd7ed(++_0x2f14c1);}(_0x69d4,0x83));var _0x469d=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x69d4[_0x2f1762];return _0x8ab21;};var escapeRegExp=require(_0x469d('0x0'))[_0x469d('0x1')];var URL=require('url')[_0x469d('0x2')];function testWildcardValidity(_0x13e72e){var _0x3011f2=!![];try{new URL(_0x13e72e['replace']('*',_0x469d('0x3')));}catch(_0x4d8b3c){_0x3011f2=![];}return _0x3011f2&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x469d('0x4')](_0x13e72e);}function testWebsiteWithWildcard(_0x29db6b,_0x22cd84){var _0x336101;var _0x3d0ec8=escapeRegExp(_0x29db6b[_0x469d('0x5')]()['replace'](/\/$/,''))[_0x469d('0x6')]('\x5c*','([\x5cw]+)');try{new URL(_0x29db6b[_0x469d('0x6')]('\x5c*',_0x469d('0x3')));_0x336101=new RegExp(_0x3d0ec8)[_0x469d('0x4')](_0x22cd84);}catch(_0x5f05c9){_0x336101=![];}return _0x336101;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity};