Built motion from commit 10af8726.|2.6.34
[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 _0x1fa9=['localhost','exports','../../../utils/misc','url','replace','test','trim'];(function(_0x144a56,_0x25e273){var _0x26f1d4=function(_0x3e5223){while(--_0x3e5223){_0x144a56['push'](_0x144a56['shift']());}};_0x26f1d4(++_0x25e273);}(_0x1fa9,0x136));var _0x91fa=function(_0x39ff05,_0x44ce6a){_0x39ff05=_0x39ff05-0x0;var _0x594fc6=_0x1fa9[_0x39ff05];return _0x594fc6;};var escapeRegExp=require(_0x91fa('0x0'))['escapeRegExp'];var URL=require(_0x91fa('0x1'))['URL'];function testWildcardValidity(_0x34ad95){var _0x22523d=!![];try{new URL(_0x34ad95[_0x91fa('0x2')]('*','localhost'));}catch(_0x191166){_0x22523d=![];}return _0x22523d&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x91fa('0x3')](_0x34ad95);}function testWebsiteWithWildcard(_0x4779be,_0x3e7461){var _0xd050dc;var _0x50f800=escapeRegExp(_0x4779be[_0x91fa('0x4')]()[_0x91fa('0x2')](/\/$/,''))['replace']('\x5c*','([\x5cw]+)');try{new URL(_0x4779be[_0x91fa('0x2')]('\x5c*',_0x91fa('0x5')));_0xd050dc=new RegExp(_0x50f800)[_0x91fa('0x3')](_0x3e7461);}catch(_0x34472a){_0xd050dc=![];}return _0xd050dc;}module[_0x91fa('0x6')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity};