Built motion from commit f25620e4.|2.6.30
[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 _0xb91a=['test','escapeRegExp','url','URL','replace','localhost'];(function(_0x54efc0,_0x5aeea2){var _0x2df0eb=function(_0x2ec005){while(--_0x2ec005){_0x54efc0['push'](_0x54efc0['shift']());}};_0x2df0eb(++_0x5aeea2);}(_0xb91a,0xe5));var _0xab91=function(_0x13ab0a,_0x1c71ae){_0x13ab0a=_0x13ab0a-0x0;var _0xd3cd5f=_0xb91a[_0x13ab0a];return _0xd3cd5f;};var escapeRegExp=require('../../../utils/misc')[_0xab91('0x0')];var URL=require(_0xab91('0x1'))[_0xab91('0x2')];function testWildcardValidity(_0x182972){var _0x485c32=!![];try{new URL(_0x182972[_0xab91('0x3')]('*',_0xab91('0x4')));}catch(_0x53c757){_0x485c32=![];}return _0x485c32&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xab91('0x5')](_0x182972);}function testWebsiteWithWildcard(_0x4ec84d,_0x54c9f4){var _0x1f99d4;var _0x1cce1e=escapeRegExp(_0x4ec84d['trim']()[_0xab91('0x3')](/\/$/,''))[_0xab91('0x3')]('\x5c*','([\x5cw]+)');try{new URL(_0x4ec84d[_0xab91('0x3')]('\x5c*',_0xab91('0x4')));_0x1f99d4=new RegExp(_0x1cce1e)['test'](_0x54c9f4);}catch(_0x5765fc){_0x1f99d4=![];}return _0x1f99d4;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity};