Built motion from commit 1fa89557.|2.6.10
[motion2.git] / server / utils / safe-template.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 _0x0b0e=['safeTemplate','lodash','{\x20{\x20','string','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x4ddb38,_0xb79bfc){var _0x1d7484=function(_0x520514){while(--_0x520514){_0x4ddb38['push'](_0x4ddb38['shift']());}};_0x1d7484(++_0xb79bfc);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2e58c7,_0x23d092){_0x2e58c7=_0x2e58c7-0x0;var _0x26eb00=_0x0b0e[_0x2e58c7];return _0x26eb00;};var _=require(_0xe0b0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x503596){return _0x503596==='{{'?_0xe0b0('0x1'):'\x20}\x20}';}function safeTemplate(_0x7e5a8a){var _0xdf715e=_0x7e5a8a;if(typeof _0x7e5a8a===_0xe0b0('0x2')){_0xdf715e=_0x7e5a8a[_0xe0b0('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xe0b0('0x4')](_0x7e5a8a)){_0xdf715e=_0x7e5a8a[_0xe0b0('0x5')](function(_0x399e67){return safeTemplate(_0x399e67);});}else if(_[_0xe0b0('0x6')](_0x7e5a8a)){_0xdf715e=Object[_0xe0b0('0x7')](_0x7e5a8a)[_0xe0b0('0x8')](function(_0x219b1c,_0x5cf9cc){_0x219b1c[_0x5cf9cc]=safeTemplate(_0x7e5a8a[_0x5cf9cc]);return _0x219b1c;},{});}return _0xdf715e;}module['exports'][_0xe0b0('0x9')]=safeTemplate;