cliodot 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +81 -0
- package/dist/AuthAppClient.d.ts +1 -0
- package/dist/AuthAppClient.d.ts.map +1 -1
- package/dist/AuthAppClient.js +199 -1
- package/dist/CommercialAppClient.d.ts +178 -0
- package/dist/CommercialAppClient.d.ts.map +1 -0
- package/dist/CommercialAppClient.js +576 -0
- package/dist/ConnectorBuilder.js +104 -1
- package/dist/Events.d.ts +2 -0
- package/dist/Events.d.ts.map +1 -1
- package/dist/Events.js +325 -1
- package/dist/Flosync.js +296 -1
- package/dist/FlosyncClient.js +429 -1
- package/dist/FunctionBuilder.js +65 -1
- package/dist/IdentityAppClient.d.ts +23 -0
- package/dist/IdentityAppClient.d.ts.map +1 -0
- package/dist/IdentityAppClient.js +197 -0
- package/dist/MemoryAppClient.d.ts +28 -0
- package/dist/MemoryAppClient.d.ts.map +1 -0
- package/dist/MemoryAppClient.js +149 -0
- package/dist/MemoryClient.d.ts +8 -0
- package/dist/MemoryClient.d.ts.map +1 -0
- package/dist/MemoryClient.js +20 -0
- package/dist/OAuthAppClient.d.ts +1 -0
- package/dist/OAuthAppClient.d.ts.map +1 -1
- package/dist/OAuthAppClient.js +269 -1
- package/dist/ProviderServicesClient.d.ts +24 -0
- package/dist/ProviderServicesClient.d.ts.map +1 -0
- package/dist/ProviderServicesClient.js +158 -0
- package/dist/Surface.d.ts +2 -0
- package/dist/Surface.d.ts.map +1 -1
- package/dist/Surface.js +255 -1
- package/dist/ValidatorBuilder.js +24 -1
- package/dist/Webhooks.d.ts +20 -0
- package/dist/Webhooks.d.ts.map +1 -0
- package/dist/Webhooks.js +61 -0
- package/dist/WorkflowBuilder.js +279 -1
- package/dist/__tests__/CommercialAppClient.test.d.ts +2 -0
- package/dist/__tests__/CommercialAppClient.test.d.ts.map +1 -0
- package/dist/__tests__/CommercialAppClient.test.js +217 -0
- package/dist/__tests__/Events.test.js +191 -1
- package/dist/__tests__/IdentityAppClient.test.d.ts +2 -0
- package/dist/__tests__/IdentityAppClient.test.d.ts.map +1 -0
- package/dist/__tests__/IdentityAppClient.test.js +232 -0
- package/dist/__tests__/OAuthAppClient.test.js +300 -1
- package/dist/__tests__/ProviderServicesClient.test.d.ts +2 -0
- package/dist/__tests__/ProviderServicesClient.test.d.ts.map +1 -0
- package/dist/__tests__/ProviderServicesClient.test.js +131 -0
- package/dist/__tests__/Surface.test.js +150 -1
- package/dist/__tests__/errors.test.js +54 -1
- package/dist/__tests__/function.test.js +58 -1
- package/dist/__tests__/helpers.d.ts +5 -0
- package/dist/__tests__/helpers.d.ts.map +1 -0
- package/dist/__tests__/helpers.js +10 -0
- package/dist/__tests__/localhost-lookup.test.d.ts +2 -0
- package/dist/__tests__/localhost-lookup.test.d.ts.map +1 -0
- package/dist/__tests__/localhost-lookup.test.js +26 -0
- package/dist/__tests__/parse-api-error.test.js +26 -1
- package/dist/__tests__/runner.test.js +156 -1
- package/dist/connectors/builtin.js +354 -1
- package/dist/connectors/registry.js +300 -1
- package/dist/decorators/build.js +105 -1
- package/dist/decorators/connector.js +56 -1
- package/dist/decorators/index.js +34 -1
- package/dist/decorators/metadata.js +338 -1
- package/dist/decorators/steps.js +220 -1
- package/dist/decorators/workflow.js +52 -1
- package/dist/errors.js +76 -1
- package/dist/http/__tests__/cliodot-request.environment.test.d.ts +2 -0
- package/dist/http/__tests__/cliodot-request.environment.test.d.ts.map +1 -0
- package/dist/http/__tests__/cliodot-request.environment.test.js +37 -0
- package/dist/http/__tests__/cliodot-result.test.d.ts +2 -0
- package/dist/http/__tests__/cliodot-result.test.d.ts.map +1 -0
- package/dist/http/__tests__/cliodot-result.test.js +57 -0
- package/dist/http/__tests__/events-instance-id.test.d.ts +2 -0
- package/dist/http/__tests__/events-instance-id.test.d.ts.map +1 -0
- package/dist/http/__tests__/events-instance-id.test.js +45 -0
- package/dist/http/cliodot-request.d.ts +35 -0
- package/dist/http/cliodot-request.d.ts.map +1 -0
- package/dist/http/cliodot-request.js +105 -0
- package/dist/http/cliodot-result.d.ts +40 -0
- package/dist/http/cliodot-result.d.ts.map +1 -0
- package/dist/http/cliodot-result.js +139 -0
- package/dist/http/create-client.d.ts +3 -0
- package/dist/http/create-client.d.ts.map +1 -0
- package/dist/http/create-client.js +14 -0
- package/dist/http/events-instance-id.d.ts +11 -0
- package/dist/http/events-instance-id.d.ts.map +1 -0
- package/dist/http/events-instance-id.js +86 -0
- package/dist/http/localhost-lookup.d.ts +12 -0
- package/dist/http/localhost-lookup.d.ts.map +1 -0
- package/dist/http/localhost-lookup.js +67 -0
- package/dist/http/parse-api-error.js +56 -1
- package/dist/http/sanitize-execution-headers.js +79 -1
- package/dist/identity-offline-verify.d.ts +6 -0
- package/dist/identity-offline-verify.d.ts.map +1 -0
- package/dist/identity-offline-verify.js +174 -0
- package/dist/identity-token-cache.d.ts +6 -0
- package/dist/identity-token-cache.d.ts.map +1 -0
- package/dist/identity-token-cache.js +51 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +108 -1
- package/dist/runner/ProcessorEngine.js +1311 -1
- package/dist/runner/connector.executor.js +1786 -1
- package/dist/runner/utilities/math.executor.js +153 -1
- package/dist/runner/utilities/random.executor.js +151 -1
- package/dist/runner/utilities/string.executor.js +825 -1
- package/dist/template.js +127 -1
- package/dist/transformers/StepsToNodesTransformer.js +214 -1
- package/dist/transformers/WorkflowTransformer.js +189 -1
- package/dist/types/auth-app.api.d.ts +2 -0
- package/dist/types/auth-app.api.d.ts.map +1 -1
- package/dist/types/auth-app.api.js +2 -1
- package/dist/types/builtin.js +2 -1
- package/dist/types/client.api.js +2 -1
- package/dist/types/commercial-app.api.d.ts +963 -0
- package/dist/types/commercial-app.api.d.ts.map +1 -0
- package/dist/types/commercial-app.api.js +2 -0
- package/dist/types/connector.js +2 -1
- package/dist/types/context.js +2 -1
- package/dist/types/event-app.api.d.ts +8 -0
- package/dist/types/event-app.api.d.ts.map +1 -1
- package/dist/types/event-app.api.js +2 -1
- package/dist/types/function.js +2 -1
- package/dist/types/identity-app.api.d.ts +99 -0
- package/dist/types/identity-app.api.d.ts.map +1 -0
- package/dist/types/identity-app.api.js +2 -0
- package/dist/types/index.js +23 -1
- package/dist/types/memory-app.api.d.ts +140 -0
- package/dist/types/memory-app.api.d.ts.map +1 -0
- package/dist/types/memory-app.api.js +2 -0
- package/dist/types/oauth-app.api.d.ts +2 -0
- package/dist/types/oauth-app.api.d.ts.map +1 -1
- package/dist/types/oauth-app.api.js +105 -1
- package/dist/types/provider-services.api.d.ts +98 -0
- package/dist/types/provider-services.api.d.ts.map +1 -0
- package/dist/types/provider-services.api.js +2 -0
- package/dist/types/validator.js +2 -1
- package/dist/types/webhook-app.api.d.ts +2 -0
- package/dist/types/webhook-app.api.d.ts.map +1 -0
- package/dist/types/webhook-app.api.js +2 -0
- package/dist/types/workflow.js +33 -1
- package/dist/validators/validators.js +478 -1
- package/dist/variable.js +37 -1
- package/package.json +3 -2
|
@@ -1 +1,825 @@
|
|
|
1
|
-
'use strict';const _0x3d80ed=_0x6f99;(function(_0x26e808,_0x3fce05){const _0x10ae6e=_0x6f99,_0x8822e2=_0x26e808();while(!![]){try{const _0x3f820b=parseInt(_0x10ae6e(0x124))/0x1+parseInt(_0x10ae6e(0xf9))/0x2*(parseInt(_0x10ae6e(0xbd))/0x3)+parseInt(_0x10ae6e(0xd6))/0x4*(-parseInt(_0x10ae6e(0xd4))/0x5)+parseInt(_0x10ae6e(0xcc))/0x6*(-parseInt(_0x10ae6e(0x103))/0x7)+parseInt(_0x10ae6e(0xc5))/0x8+parseInt(_0x10ae6e(0xaa))/0x9*(parseInt(_0x10ae6e(0xa4))/0xa)+parseInt(_0x10ae6e(0xfe))/0xb;if(_0x3f820b===_0x3fce05)break;else _0x8822e2['push'](_0x8822e2['shift']());}catch(_0x3cf868){_0x8822e2['push'](_0x8822e2['shift']());}}}(_0x153f,0xb61d7));Object[_0x3d80ed(0xe5)](exports,_0x3d80ed(0x136),{'value':!![]}),exports[_0x3d80ed(0xec)]=executeString;const crypto_1=require(_0x3d80ed(0x93));function escapeRegex(_0x18c0b7){const _0x1572e2=_0x3d80ed;return _0x18c0b7['replace'](/[.*+?^${}()|[\]\\]/g,_0x1572e2(0xb4));}function str(_0x3e7e96){if(_0x3e7e96===null||_0x3e7e96===undefined)return'';return String(_0x3e7e96);}function _0x6f99(_0x59b7a5,_0x3b65a7){_0x59b7a5=_0x59b7a5-0x8f;const _0x153fa1=_0x153f();let _0x6f9905=_0x153fa1[_0x59b7a5];if(_0x6f99['CJHRrL']===undefined){var _0x1ec962=function(_0x2d5ff2){const _0x2f03e5='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x18c0b7='',_0x3e7e96='';for(let _0x167a0e=0x0,_0xdd707b,_0x27d3fc,_0x1bf069=0x0;_0x27d3fc=_0x2d5ff2['charAt'](_0x1bf069++);~_0x27d3fc&&(_0xdd707b=_0x167a0e%0x4?_0xdd707b*0x40+_0x27d3fc:_0x27d3fc,_0x167a0e++%0x4)?_0x18c0b7+=String['fromCharCode'](0xff&_0xdd707b>>(-0x2*_0x167a0e&0x6)):0x0){_0x27d3fc=_0x2f03e5['indexOf'](_0x27d3fc);}for(let _0x4832f6=0x0,_0x59153a=_0x18c0b7['length'];_0x4832f6<_0x59153a;_0x4832f6++){_0x3e7e96+='%'+('00'+_0x18c0b7['charCodeAt'](_0x4832f6)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3e7e96);};_0x6f99['kzkGMt']=_0x1ec962,_0x6f99['zOMCuN']={},_0x6f99['CJHRrL']=!![];}const _0x3ccdde=_0x153fa1[0x0],_0xba3b4=_0x59b7a5+_0x3ccdde,_0x14790b=_0x6f99['zOMCuN'][_0xba3b4];return!_0x14790b?(_0x6f9905=_0x6f99['kzkGMt'](_0x6f9905),_0x6f99['zOMCuN'][_0xba3b4]=_0x6f9905):_0x6f9905=_0x14790b,_0x6f9905;}function pluralise(_0x167a0e,_0xdd707b=0x2){const _0x17c8fc=_0x3d80ed;if(_0xdd707b===0x1)return _0x167a0e;const _0x27d3fc={'man':_0x17c8fc(0xfa),'woman':'women','child':_0x17c8fc(0x128),'foot':'feet','tooth':'teeth','goose':'geese','mouse':'mice','ox':_0x17c8fc(0xf6),'person':'people','leaf':_0x17c8fc(0x11f),'life':_0x17c8fc(0xe2),'wife':_0x17c8fc(0x104),'knife':'knives','wolf':'wolves','loaf':_0x17c8fc(0x138),'potato':_0x17c8fc(0xd3),'tomato':_0x17c8fc(0xdc),'cactus':'cacti','focus':_0x17c8fc(0x10c),'fungus':_0x17c8fc(0xbe),'nucleus':_0x17c8fc(0x121),'syllabus':'syllabi','analysis':_0x17c8fc(0x151),'thesis':_0x17c8fc(0x92),'crisis':_0x17c8fc(0xc2),'phenomenon':_0x17c8fc(0x133),'criterion':_0x17c8fc(0xac),'datum':_0x17c8fc(0xda)},_0x1bf069=_0x167a0e['toLowerCase']();if(_0x27d3fc[_0x1bf069])return _0x167a0e[0x0]===_0x167a0e[0x0][_0x17c8fc(0xfb)]()?_0x27d3fc[_0x1bf069][_0x17c8fc(0xc1)](0x0)[_0x17c8fc(0xfb)]()+_0x27d3fc[_0x1bf069][_0x17c8fc(0xad)](0x1):_0x27d3fc[_0x1bf069];if(/(?:s|sh|ch|x|z)$/i['test'](_0x167a0e))return _0x167a0e+'es';if(/[^aeiou]y$/i['test'](_0x167a0e))return _0x167a0e[_0x17c8fc(0xad)](0x0,-0x1)+_0x17c8fc(0x9b);if(/(?:fe?)$/i[_0x17c8fc(0xa0)](_0x167a0e))return _0x167a0e['replace'](/fe?$/,'ves');return _0x167a0e+'s';}function singularise(_0x4832f6){const _0x348762=_0x3d80ed,_0x59153a={'men':'man','women':'woman','children':_0x348762(0x120),'feet':_0x348762(0x96),'teeth':_0x348762(0x142),'geese':'goose','mice':'mouse','oxen':'ox','people':_0x348762(0x9a),'leaves':'leaf','lives':'life','wives':_0x348762(0xf0),'knives':_0x348762(0x10d),'wolves':_0x348762(0xe3),'loaves':_0x348762(0x126),'potatoes':'potato','tomatoes':'tomato','cacti':'cactus','foci':_0x348762(0xc8),'fungi':_0x348762(0x139),'nuclei':_0x348762(0xa3),'syllabi':'syllabus','analyses':_0x348762(0xba),'theses':_0x348762(0x113),'crises':_0x348762(0x152),'phenomena':_0x348762(0x13f),'criteria':_0x348762(0xcf),'data':_0x348762(0xab)},_0x4b4a32=_0x4832f6['toLowerCase']();if(_0x59153a[_0x4b4a32])return _0x4832f6[0x0]===_0x4832f6[0x0][_0x348762(0xfb)]()?_0x59153a[_0x4b4a32]['charAt'](0x0)['toUpperCase']()+_0x59153a[_0x4b4a32][_0x348762(0xad)](0x1):_0x59153a[_0x4b4a32];if(/ies$/i[_0x348762(0xa0)](_0x4832f6))return _0x4832f6[_0x348762(0xad)](0x0,-0x3)+'y';if(/ves$/i[_0x348762(0xa0)](_0x4832f6))return _0x4832f6[_0x348762(0xad)](0x0,-0x3)+'fe';if(/ses$/i[_0x348762(0xa0)](_0x4832f6)||/shes$/i['test'](_0x4832f6)||/ches$/i[_0x348762(0xa0)](_0x4832f6)||/xes$/i[_0x348762(0xa0)](_0x4832f6))return _0x4832f6[_0x348762(0xad)](0x0,-0x2);if(/s$/i[_0x348762(0xa0)](_0x4832f6)&&!/ss$/i[_0x348762(0xa0)](_0x4832f6))return _0x4832f6[_0x348762(0xad)](0x0,-0x1);return _0x4832f6;}function wordWrap(_0x509c06,_0x472c9e=0x4b,_0x1b1147='\x0a',_0x443170=![]){const _0x599087=_0x3d80ed,_0x1289c9=_0x509c06[_0x599087(0x100)]('\x20'),_0x2ab8a3=[];let _0x2da71c='';for(const _0x1f3689 of _0x1289c9){if(_0x443170&&_0x1f3689['length']>_0x472c9e){_0x2da71c&&(_0x2ab8a3[_0x599087(0xf1)](_0x2da71c),_0x2da71c='');for(let _0x42c420=0x0;_0x42c420<_0x1f3689[_0x599087(0x127)];_0x42c420+=_0x472c9e){const _0x103d67=_0x1f3689[_0x599087(0xad)](_0x42c420,_0x42c420+_0x472c9e);if(_0x42c420+_0x472c9e<_0x1f3689[_0x599087(0x127)])_0x2ab8a3[_0x599087(0xf1)](_0x103d67);else _0x2da71c=_0x103d67;}}else{if((_0x2da71c+(_0x2da71c?'\x20':'')+_0x1f3689)[_0x599087(0x127)]>_0x472c9e){if(_0x2da71c)_0x2ab8a3[_0x599087(0xf1)](_0x2da71c);_0x2da71c=_0x1f3689;}else _0x2da71c=_0x2da71c?_0x2da71c+'\x20'+_0x1f3689:_0x1f3689;}}if(_0x2da71c)_0x2ab8a3[_0x599087(0xf1)](_0x2da71c);return _0x2ab8a3[_0x599087(0xbf)](_0x1b1147);}function transliterate(_0x2f7896){const _0x4da23a=_0x3d80ed,_0x1a8ff6={'À':'A','Á':'A','Â':'A','Ã':'A','Ä':'A','Å':'A','Æ':'AE','Ç':'C','È':'E','É':'E','Ê':'E','Ë':'E','Ì':'I','Í':'I','Î':'I','Ï':'I','Ð':'D','Ñ':'N','Ò':'O','Ó':'O','Ô':'O','Õ':'O','Ö':'O','Ø':'O','Ù':'U','Ú':'U','Û':'U','Ü':'U','Ý':'Y','Þ':'TH','ß':'ss','à':'a','á':'a','â':'a','ã':'a','ä':'a','å':'a','æ':'ae','ç':'c','è':'e','é':'e','ê':'e','ë':'e','ì':'i','í':'i','î':'i','ï':'i','ð':'d','ñ':'n','ò':'o','ó':'o','ô':'o','õ':'o','ö':'o','ø':'o','ù':'u','ú':'u','û':'u','ü':'u','ý':'y','þ':'th','ÿ':'y'};return _0x2f7896[_0x4da23a(0x100)]('')['map'](_0x408875=>_0x1a8ff6[_0x408875]??_0x408875)[_0x4da23a(0xbf)]('');}const APA_SMALL=new Set(['a','an','the',_0x3d80ed(0xe9),_0x3d80ed(0x146),'or',_0x3d80ed(0x13d),_0x3d80ed(0x98),'as','at','by',_0x3d80ed(0x13d),'in','of','off','on',_0x3d80ed(0xc4),'to','up',_0x3d80ed(0x12b),'with','yet','so']);function executeString(_0x46e5d8,_0x5ab7c8){const _0x3b84f1=_0x3d80ed,_0x172cb0=_0x46e5d8;switch(_0x5ab7c8){case'concat':{const {strings:_0x240b12,separator:separator=''}=_0x172cb0;if(!Array[_0x3b84f1(0xee)](_0x240b12))throw new Error('Strings\x20array\x20is\x20required');return{'value':_0x240b12[_0x3b84f1(0xbf)](separator)};}case _0x3b84f1(0x100):{const {string:_0x5ce62d,delimiter:_0xd83be5,limit:_0x2e086b}=_0x172cb0;if(!_0x5ce62d||!_0xd83be5)throw new Error(_0x3b84f1(0xa5));const _0x749fc=_0x5ce62d[_0x3b84f1(0x100)](_0xd83be5);return{'value':_0x2e086b?_0x749fc[_0x3b84f1(0xad)](0x0,_0x2e086b):_0x749fc};}case'join':{const {array:_0x4eb20b,separator:separator=','}=_0x172cb0;if(!Array['isArray'](_0x4eb20b))throw new Error(_0x3b84f1(0x155));return{'value':_0x4eb20b[_0x3b84f1(0xbf)](separator)};}case _0x3b84f1(0x10f):{const {string:_0x257227,search:_0xc867d3,replace:_0x3dc8e9,case_sensitive:case_sensitive=!![],use_regex:use_regex=![]}=_0x172cb0;if(!_0x257227||_0xc867d3===undefined||_0x3dc8e9===undefined)throw new Error(_0x3b84f1(0x9c));const _0x64e646=case_sensitive?'':'i',_0x34c217=use_regex?new RegExp(_0xc867d3,_0x64e646):new RegExp(escapeRegex(_0xc867d3),_0x64e646);return{'value':_0x257227[_0x3b84f1(0x10f)](_0x34c217,_0x3dc8e9)};}case _0x3b84f1(0x12e):{const {string:_0x559f92,search:_0x43d306,replace:_0x2d0ee6,case_sensitive:case_sensitive=!![],use_regex:use_regex=![]}=_0x172cb0;if(!_0x559f92||_0x43d306===undefined||_0x2d0ee6===undefined)throw new Error(_0x3b84f1(0x9c));const _0x4327a3=case_sensitive?'g':'gi',_0xa5cd9e=use_regex?new RegExp(_0x43d306,_0x4327a3):new RegExp(escapeRegex(_0x43d306),_0x4327a3);return{'value':_0x559f92['replace'](_0xa5cd9e,_0x2d0ee6)};}case _0x3b84f1(0x144):{const {string:_0x3dbfd7,chars:_0x40a5ef}=_0x172cb0;if(_0x3dbfd7===undefined||_0x3dbfd7===null)throw new Error(_0x3b84f1(0x157));if(_0x40a5ef)return{'value':_0x3dbfd7[_0x3b84f1(0x10f)](new RegExp('^['+escapeRegex(_0x40a5ef)+']+|['+escapeRegex(_0x40a5ef)+_0x3b84f1(0x125),'g'),'')};return{'value':_0x3dbfd7['trim']()};}case _0x3b84f1(0xa9):{const {string:_0x38dee5,chars:_0x45673e}=_0x172cb0;if(_0x38dee5===undefined||_0x38dee5===null)throw new Error('String\x20is\x20required');if(_0x45673e)return{'value':_0x38dee5[_0x3b84f1(0x10f)](new RegExp('^['+escapeRegex(_0x45673e)+']+','g'),'')};return{'value':_0x38dee5[_0x3b84f1(0xc7)]()};}case _0x3b84f1(0xaf):{const {string:_0x9036fb,chars:_0x85529c}=_0x172cb0;if(_0x9036fb===undefined||_0x9036fb===null)throw new Error(_0x3b84f1(0x157));if(_0x85529c)return{'value':_0x9036fb[_0x3b84f1(0x10f)](new RegExp('['+escapeRegex(_0x85529c)+_0x3b84f1(0x125),'g'),'')};return{'value':_0x9036fb[_0x3b84f1(0xb2)]()};}case _0x3b84f1(0xe7):case _0x3b84f1(0x94):if(!_0x172cb0[_0x3b84f1(0xfd)])throw new Error(_0x3b84f1(0x157));return{'value':_0x172cb0[_0x3b84f1(0xfd)][_0x3b84f1(0xfb)]()};case _0x3b84f1(0x154):case'lowercase':if(!_0x172cb0['string'])throw new Error('String\x20is\x20required');return{'value':_0x172cb0[_0x3b84f1(0xfd)]['toLowerCase']()};case _0x3b84f1(0x153):{const {string:_0x2a34f1,all_words:all_words=![]}=_0x172cb0;if(!_0x2a34f1)throw new Error('String\x20is\x20required');if(all_words)return{'value':_0x2a34f1[_0x3b84f1(0x100)]('\x20')[_0x3b84f1(0xf8)](_0x327a80=>_0x327a80[_0x3b84f1(0xc1)](0x0)[_0x3b84f1(0xfb)]()+_0x327a80[_0x3b84f1(0xad)](0x1)[_0x3b84f1(0x13b)]())[_0x3b84f1(0xbf)]('\x20')};return{'value':_0x2a34f1['charAt'](0x0)[_0x3b84f1(0xfb)]()+_0x2a34f1[_0x3b84f1(0xad)](0x1)[_0x3b84f1(0x13b)]()};}case _0x3b84f1(0xed):{const {string:_0x279619,start:_0x595bb5,end:_0x3481f8}=_0x172cb0;if(!_0x279619||_0x595bb5===undefined)throw new Error('String\x20and\x20start\x20are\x20required');return{'value':_0x3481f8!==undefined?_0x279619[_0x3b84f1(0xed)](_0x595bb5,_0x3481f8):_0x279619[_0x3b84f1(0xed)](_0x595bb5)};}case _0x3b84f1(0x127):if(_0x172cb0[_0x3b84f1(0xfd)]===undefined||_0x172cb0['string']===null)throw new Error('String\x20is\x20required');return{'value':_0x172cb0['string'][_0x3b84f1(0x127)]};case _0x3b84f1(0xa7):{const {string:_0xd3436d,search:_0x227932,case_sensitive:case_sensitive=!![]}=_0x172cb0;if(!_0xd3436d||_0x227932===undefined)throw new Error('String\x20and\x20search\x20are\x20required');const _0x41ca48=case_sensitive?_0xd3436d:_0xd3436d['toLowerCase'](),_0xcb5404=case_sensitive?_0x227932:_0x227932[_0x3b84f1(0x13b)]();return{'value':_0x41ca48[_0x3b84f1(0x131)](_0xcb5404)};}case _0x3b84f1(0xe8):{const {string:_0x26301c,prefix:_0x2514f5,case_sensitive:case_sensitive=!![]}=_0x172cb0;if(!_0x26301c||_0x2514f5===undefined)throw new Error(_0x3b84f1(0x132));const _0x563de8=case_sensitive?_0x26301c:_0x26301c[_0x3b84f1(0x13b)](),_0x5146d4=case_sensitive?_0x2514f5:_0x2514f5[_0x3b84f1(0x13b)]();return{'value':_0x563de8[_0x3b84f1(0x10e)](_0x5146d4)};}case'ends_with':{const {string:_0x2de963,suffix:_0x33111d,case_sensitive:case_sensitive=!![]}=_0x172cb0;if(!_0x2de963||_0x33111d===undefined)throw new Error('String\x20and\x20suffix\x20are\x20required');const _0x150741=case_sensitive?_0x2de963:_0x2de963[_0x3b84f1(0x13b)](),_0x3a330e=case_sensitive?_0x33111d:_0x33111d['toLowerCase']();return{'value':_0x150741[_0x3b84f1(0x108)](_0x3a330e)};}case _0x3b84f1(0xfc):{const {string:_0x3a9bcf,preserve_spaces:preserve_spaces=![]}=_0x172cb0;if(!_0x3a9bcf)throw new Error('String\x20is\x20required');if(preserve_spaces)return{'value':_0x3a9bcf['trim']()[_0x3b84f1(0x10f)](/\s+/g,'\x20')};return{'value':_0x3a9bcf['replace'](/\s+/g,'')};}case _0x3b84f1(0xe4):{const {string:_0x577adb,separator:separator='-',lowercase:lowercase=!![],preserve_case:preserve_case=![]}=_0x172cb0;if(!_0x577adb)throw new Error(_0x3b84f1(0x157));let _0x5205f0=transliterate(_0x577adb[_0x3b84f1(0x144)]());if(!preserve_case&&lowercase)_0x5205f0=_0x5205f0['toLowerCase']();return _0x5205f0=_0x5205f0[_0x3b84f1(0x10f)](/[^\w\s-]/g,'')[_0x3b84f1(0x10f)](/[\s_-]+/g,separator)['replace'](new RegExp('^'+escapeRegex(separator)+'+|'+escapeRegex(separator)+'+$','g'),''),{'value':_0x5205f0};}case _0x3b84f1(0xae):{const {string:_0x40f346,length:_0x185edb,pad_string:pad_string='\x20'}=_0x172cb0;if(!_0x40f346||_0x185edb===undefined)throw new Error(_0x3b84f1(0xc9));return{'value':_0x40f346[_0x3b84f1(0xd2)](_0x185edb,pad_string)};}case _0x3b84f1(0x115):{const {string:_0x2c55db,length:_0x242c66,pad_string:pad_string='\x20'}=_0x172cb0;if(!_0x2c55db||_0x242c66===undefined)throw new Error(_0x3b84f1(0xc9));return{'value':_0x2c55db[_0x3b84f1(0xdb)](_0x242c66,pad_string)};}case _0x3b84f1(0x137):if(!_0x172cb0['string'])throw new Error(_0x3b84f1(0x157));return{'value':[..._0x172cb0[_0x3b84f1(0xfd)]][_0x3b84f1(0x137)]()['join']('')};case _0x3b84f1(0x14a):{const {string:_0x5cc51f,url_safe:url_safe=![]}=_0x172cb0;if(!_0x5cc51f)throw new Error('String\x20is\x20required');const _0x1e9f5d=Buffer[_0x3b84f1(0x12f)](_0x5cc51f)[_0x3b84f1(0xb1)]('base64');return{'value':url_safe?_0x1e9f5d[_0x3b84f1(0x10f)](/\+/g,'-')[_0x3b84f1(0x10f)](/\//g,'_')[_0x3b84f1(0x10f)](/=/g,''):_0x1e9f5d};}case _0x3b84f1(0x12c):{const {string:_0x4ad982,url_safe:url_safe=![]}=_0x172cb0;if(!_0x4ad982)throw new Error(_0x3b84f1(0x90));let _0x242fdf=_0x4ad982;if(url_safe){_0x242fdf=_0x242fdf[_0x3b84f1(0x10f)](/-/g,'+')['replace'](/_/g,'/');while(_0x242fdf[_0x3b84f1(0x127)]%0x4)_0x242fdf+='=';}return{'value':Buffer[_0x3b84f1(0x12f)](_0x242fdf,_0x3b84f1(0xe6))[_0x3b84f1(0xb1)](_0x3b84f1(0x102))};}case _0x3b84f1(0xeb):{const {string:_0x523e61,component:component=!![]}=_0x172cb0;if(!_0x523e61)throw new Error(_0x3b84f1(0x157));return{'value':component?encodeURIComponent(_0x523e61):encodeURI(_0x523e61)};}case _0x3b84f1(0xd1):{const {string:_0x3cfd26,component:component=!![]}=_0x172cb0;if(!_0x3cfd26)throw new Error(_0x3b84f1(0x140));return{'value':component?decodeURIComponent(_0x3cfd26):decodeURI(_0x3cfd26)};}case'after':{const {string:_0xb85a61,search:_0xcbd3a8}=_0x172cb0;if(!_0xb85a61||!_0xcbd3a8)throw new Error(_0x3b84f1(0x118));const _0x48ceb1=_0xb85a61['indexOf'](_0xcbd3a8);return{'value':_0x48ceb1===-0x1?_0xb85a61:_0xb85a61[_0x3b84f1(0xad)](_0x48ceb1+_0xcbd3a8[_0x3b84f1(0x127)])};}case _0x3b84f1(0x101):{const {string:_0x5abac0,search:_0x4c5cb0}=_0x172cb0;if(!_0x5abac0||!_0x4c5cb0)throw new Error(_0x3b84f1(0x118));const _0x417d51=_0x5abac0['lastIndexOf'](_0x4c5cb0);return{'value':_0x417d51===-0x1?_0x5abac0:_0x5abac0[_0x3b84f1(0xad)](_0x417d51+_0x4c5cb0[_0x3b84f1(0x127)])};}case _0x3b84f1(0xd8):{const {string:_0x4ba92d,search:_0x3d7c4e}=_0x172cb0;if(!_0x4ba92d||!_0x3d7c4e)throw new Error('String\x20and\x20search\x20are\x20required');const _0x5b1655=_0x4ba92d[_0x3b84f1(0x147)](_0x3d7c4e);return{'value':_0x5b1655===-0x1?_0x4ba92d:_0x4ba92d[_0x3b84f1(0xad)](0x0,_0x5b1655)};}case'before_last':{const {string:_0x14d6d7,search:_0x4ceec2}=_0x172cb0;if(!_0x14d6d7||!_0x4ceec2)throw new Error('String\x20and\x20search\x20are\x20required');const _0x2ebbbf=_0x14d6d7[_0x3b84f1(0x129)](_0x4ceec2);return{'value':_0x2ebbbf===-0x1?_0x14d6d7:_0x14d6d7[_0x3b84f1(0xad)](0x0,_0x2ebbbf)};}case _0x3b84f1(0xf7):{const {string:_0x3f76c0,from:_0x5e46a0,to:_0x23acc6}=_0x172cb0;if(!_0x3f76c0||!_0x5e46a0||!_0x23acc6)throw new Error('String,\x20from,\x20and\x20to\x20are\x20required');const _0x130ce5=_0x3f76c0['indexOf'](_0x5e46a0),_0x3a49f7=_0x3f76c0['lastIndexOf'](_0x23acc6);if(_0x130ce5===-0x1||_0x3a49f7===-0x1||_0x3a49f7<=_0x130ce5)return{'value':_0x3f76c0};return{'value':_0x3f76c0[_0x3b84f1(0xad)](_0x130ce5+_0x5e46a0['length'],_0x3a49f7)};}case'between_first':{const {string:_0x694b5a,from:_0x4ceb47,to:_0x156620}=_0x172cb0;if(!_0x694b5a||!_0x4ceb47||!_0x156620)throw new Error('String,\x20from,\x20and\x20to\x20are\x20required');const _0x484b96=_0x694b5a[_0x3b84f1(0x147)](_0x4ceb47);if(_0x484b96===-0x1)return{'value':_0x694b5a};const _0x4f73ea=_0x694b5a['indexOf'](_0x156620,_0x484b96+_0x4ceb47[_0x3b84f1(0x127)]);if(_0x4f73ea===-0x1)return{'value':_0x694b5a};return{'value':_0x694b5a[_0x3b84f1(0xad)](_0x484b96+_0x4ceb47[_0x3b84f1(0x127)],_0x4f73ea)};}case _0x3b84f1(0xa8):{const {string:_0x3f17db}=_0x172cb0;if(!_0x3f17db)throw new Error(_0x3b84f1(0x157));const _0x3dc1a0=_0x3f17db[_0x3b84f1(0x10f)](/[-_\s]+(.)/g,(_0x5952e1,_0x3e6b7d)=>_0x3e6b7d[_0x3b84f1(0xfb)]());return{'value':_0x3dc1a0[_0x3b84f1(0xc1)](0x0)[_0x3b84f1(0x13b)]()+_0x3dc1a0[_0x3b84f1(0xad)](0x1)};}case _0x3b84f1(0xe0):{const {string:_0x217082,index:_0x363688}=_0x172cb0;if(!_0x217082||_0x363688===undefined)throw new Error(_0x3b84f1(0xd9));return{'value':_0x217082[_0x3b84f1(0xc1)](_0x363688)};}case _0x3b84f1(0x9f):{const {string:_0x7308c0,needle:_0x3a5a0c}=_0x172cb0;if(_0x7308c0===undefined||!_0x3a5a0c)throw new Error(_0x3b84f1(0x148));return{'value':_0x7308c0[_0x3b84f1(0x10e)](_0x3a5a0c)?_0x7308c0[_0x3b84f1(0xad)](_0x3a5a0c[_0x3b84f1(0x127)]):_0x7308c0};}case _0x3b84f1(0x150):{const {string:_0x4c3693,needle:_0x161274}=_0x172cb0;if(_0x4c3693===undefined||!_0x161274)throw new Error('String\x20and\x20needle\x20are\x20required');return{'value':_0x4c3693[_0x3b84f1(0x108)](_0x161274)?_0x4c3693[_0x3b84f1(0xad)](0x0,-_0x161274['length']):_0x4c3693};}case'contains_all':{const {string:_0x345fbf,needles:_0x56aa26,case_sensitive:case_sensitive=!![]}=_0x172cb0;if(!_0x345fbf||!Array[_0x3b84f1(0xee)](_0x56aa26))throw new Error(_0x3b84f1(0x105));const _0x1e1faa=case_sensitive?_0x345fbf:_0x345fbf[_0x3b84f1(0x13b)]();return{'value':_0x56aa26[_0x3b84f1(0x11d)](_0x13d25f=>_0x1e1faa[_0x3b84f1(0x131)](case_sensitive?_0x13d25f:_0x13d25f[_0x3b84f1(0x13b)]()))};}case _0x3b84f1(0x149):{const {string:_0x1bf04e,search:_0x60a4c9,case_sensitive:case_sensitive=!![]}=_0x172cb0;if(!_0x1bf04e||_0x60a4c9===undefined)throw new Error(_0x3b84f1(0x118));const _0x537469=case_sensitive?_0x1bf04e:_0x1bf04e[_0x3b84f1(0x13b)](),_0xc886ab=case_sensitive?_0x60a4c9:_0x60a4c9['toLowerCase']();return{'value':!_0x537469[_0x3b84f1(0x131)](_0xc886ab)};}case'doesnt_start_with':{const {string:_0x38f790,prefix:_0x3d43d9,case_sensitive:case_sensitive=!![]}=_0x172cb0;if(!_0x38f790||_0x3d43d9===undefined)throw new Error(_0x3b84f1(0x132));const _0xd0ca41=case_sensitive?_0x38f790:_0x38f790[_0x3b84f1(0x13b)](),_0x4cbe80=case_sensitive?_0x3d43d9:_0x3d43d9[_0x3b84f1(0x13b)]();return{'value':!_0xd0ca41[_0x3b84f1(0x10e)](_0x4cbe80)};}case _0x3b84f1(0x10a):{const {string:_0x26315e,suffix:_0x4ad154,case_sensitive:case_sensitive=!![]}=_0x172cb0;if(!_0x26315e||_0x4ad154===undefined)throw new Error('String\x20and\x20suffix\x20are\x20required');const _0x3163d9=case_sensitive?_0x26315e:_0x26315e[_0x3b84f1(0x13b)](),_0x30239a=case_sensitive?_0x4ad154:_0x4ad154[_0x3b84f1(0x13b)]();return{'value':!_0x3163d9['endsWith'](_0x30239a)};}case _0x3b84f1(0xc6):{const {string:_0x9fda7e,character:character='\x20'}=_0x172cb0;if(_0x9fda7e===undefined||_0x9fda7e===null)throw new Error('String\x20is\x20required');const _0x4f9829=escapeRegex(character);return{'value':_0x9fda7e[_0x3b84f1(0x10f)](new RegExp(_0x4f9829+'{2,}','g'),character)};}case _0x3b84f1(0x14b):{const {string:_0x5ae7f9,phrase:_0x460c97,radius:radius=0x64,omission:omission=_0x3b84f1(0xca)}=_0x172cb0;if(!_0x5ae7f9||!_0x460c97)throw new Error(_0x3b84f1(0x14e));const _0x1888e5=_0x5ae7f9[_0x3b84f1(0x13b)]()[_0x3b84f1(0x147)](_0x460c97[_0x3b84f1(0x13b)]());if(_0x1888e5===-0x1)return{'value':_0x5ae7f9['length']>radius*0x2?omission+_0x5ae7f9[_0x3b84f1(0xad)](0x0,radius)+omission:_0x5ae7f9};const _0x25dfcf=Math[_0x3b84f1(0xb5)](0x0,_0x1888e5-radius),_0x107467=Math[_0x3b84f1(0xcb)](_0x5ae7f9[_0x3b84f1(0x127)],_0x1888e5+_0x460c97[_0x3b84f1(0x127)]+radius),_0x247db6=_0x25dfcf>0x0?omission:'',_0x3b48db=_0x107467<_0x5ae7f9['length']?omission:'';return{'value':_0x247db6+_0x5ae7f9[_0x3b84f1(0xad)](_0x25dfcf,_0x107467)+_0x3b48db};}case _0x3b84f1(0xb8):{const {string:_0x1d78fc,cap:_0xd2c951}=_0x172cb0;if(_0x1d78fc===undefined||!_0xd2c951)throw new Error(_0x3b84f1(0x159));return{'value':_0x1d78fc['endsWith'](_0xd2c951)?_0x1d78fc:_0x1d78fc+_0xd2c951};}case _0x3b84f1(0x12a):{const {string:_0x56ff01,prefix:_0x4c3ce3}=_0x172cb0;if(_0x56ff01===undefined||!_0x4c3ce3)throw new Error(_0x3b84f1(0x132));return{'value':_0x56ff01[_0x3b84f1(0x10e)](_0x4c3ce3)?_0x56ff01:_0x4c3ce3+_0x56ff01};}case _0x3b84f1(0x111):{const {string:_0x9cec2f}=_0x172cb0;if(!_0x9cec2f)throw new Error(_0x3b84f1(0x157));const _0x17334c=_0x9cec2f[_0x3b84f1(0x10f)](/([a-z])([A-Z])/g,_0x3b84f1(0x14c))[_0x3b84f1(0x10f)](/[-_]+/g,'\x20')[_0x3b84f1(0x144)]()['split'](/\s+/);return{'value':_0x17334c['map'](_0x53afc1=>_0x53afc1[_0x3b84f1(0xc1)](0x0)[_0x3b84f1(0xfb)]()+_0x53afc1[_0x3b84f1(0xad)](0x1)[_0x3b84f1(0x13b)]())[_0x3b84f1(0xbf)]('\x20')};}case'is':{const {string:_0x301a67,pattern:_0x10a6c4}=_0x172cb0;if(!_0x301a67||!_0x10a6c4)throw new Error('String\x20and\x20pattern\x20are\x20required');const _0xb826d2=new RegExp('^'+escapeRegex(_0x10a6c4)[_0x3b84f1(0x10f)](/\\\*/g,'.*')+'$');return{'value':_0xb826d2[_0x3b84f1(0xa0)](_0x301a67)};}case _0x3b84f1(0x123):if(_0x172cb0[_0x3b84f1(0xfd)]===undefined||_0x172cb0[_0x3b84f1(0xfd)]===null)throw new Error(_0x3b84f1(0x157));return{'value':/^[\x00-\x7F]*$/['test'](_0x172cb0[_0x3b84f1(0xfd)])};case _0x3b84f1(0x13e):if(_0x172cb0[_0x3b84f1(0xfd)]===undefined||_0x172cb0[_0x3b84f1(0xfd)]===null)throw new Error(_0x3b84f1(0x157));try{return JSON['parse'](_0x172cb0[_0x3b84f1(0xfd)]),{'value':!![]};}catch{return{'value':![]};}case _0x3b84f1(0xa1):if(_0x172cb0[_0x3b84f1(0xfd)]===undefined||_0x172cb0[_0x3b84f1(0xfd)]===null)throw new Error(_0x3b84f1(0x157));return{'value':/^[0-9A-Z]{26}$/i['test'](_0x172cb0[_0x3b84f1(0xfd)])};case'is_url':{const {string:_0x563666,protocols:protocols=[_0x3b84f1(0x141),_0x3b84f1(0xb3)]}=_0x172cb0;if(!_0x563666)throw new Error(_0x3b84f1(0x157));try{const _0x44b23e=new URL(_0x563666),_0x16fabe=_0x44b23e[_0x3b84f1(0x12d)]['replace'](':','');return{'value':protocols[_0x3b84f1(0x131)](_0x16fabe)};}catch{return{'value':![]};}}case _0x3b84f1(0x134):if(_0x172cb0[_0x3b84f1(0xfd)]===undefined||_0x172cb0[_0x3b84f1(0xfd)]===null)throw new Error(_0x3b84f1(0x157));return{'value':/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i[_0x3b84f1(0xa0)](_0x172cb0['string'])};case _0x3b84f1(0x8f):if(_0x172cb0['string']===undefined||_0x172cb0['string']===null)return{'value':!![]};return{'value':str(_0x172cb0[_0x3b84f1(0xfd)])[_0x3b84f1(0x144)]()[_0x3b84f1(0x127)]===0x0};case'is_match':{const {string:_0xcd4409,pattern:_0x5d0f9b,flags:flags=''}=_0x172cb0;if(_0xcd4409===undefined||!_0x5d0f9b)throw new Error(_0x3b84f1(0xbc));return{'value':new RegExp(_0x5d0f9b,flags)['test'](_0xcd4409)};}case'kebab':{const {string:_0x3596c6}=_0x172cb0;if(!_0x3596c6)throw new Error('String\x20is\x20required');return{'value':_0x3596c6[_0x3b84f1(0x10f)](/([a-z])([A-Z])/g,_0x3b84f1(0xa2))[_0x3b84f1(0x10f)](/[\s_]+/g,'-')[_0x3b84f1(0x13b)]()};}case _0x3b84f1(0xd7):{const {string:_0x1f4176,delimiter:delimiter='_'}=_0x172cb0;if(!_0x1f4176)throw new Error(_0x3b84f1(0x157));return{'value':_0x1f4176['replace'](/([a-z])([A-Z])/g,'$1'+delimiter+'$2')[_0x3b84f1(0x10f)](/[\s-]+/g,delimiter)['toLowerCase']()};}case _0x3b84f1(0x122):{const {string:_0x5c42a8}=_0x172cb0;if(!_0x5c42a8)throw new Error(_0x3b84f1(0x157));const _0x20eb64=_0x5c42a8[_0x3b84f1(0x10f)](/[-_\s]+(.)/g,(_0x416ba3,_0x340f23)=>_0x340f23[_0x3b84f1(0xfb)]());return{'value':_0x20eb64['replace'](/^(.)/,_0x370f5c=>_0x370f5c[_0x3b84f1(0xfb)]())};}case _0x3b84f1(0x130):if(!_0x172cb0[_0x3b84f1(0xfd)])throw new Error(_0x3b84f1(0x157));return{'value':_0x172cb0[_0x3b84f1(0xfd)][_0x3b84f1(0x10f)](/\w\S*/g,_0x3fde5c=>_0x3fde5c[_0x3b84f1(0xc1)](0x0)[_0x3b84f1(0xfb)]()+_0x3fde5c[_0x3b84f1(0xad)](0x1)['toLowerCase']())};case'lcfirst':if(!_0x172cb0[_0x3b84f1(0xfd)])throw new Error(_0x3b84f1(0x157));return{'value':_0x172cb0['string'][_0x3b84f1(0xc1)](0x0)[_0x3b84f1(0x13b)]()+_0x172cb0[_0x3b84f1(0xfd)][_0x3b84f1(0xad)](0x1)};case _0x3b84f1(0x110):if(!_0x172cb0[_0x3b84f1(0xfd)])throw new Error('String\x20is\x20required');return{'value':_0x172cb0[_0x3b84f1(0xfd)][_0x3b84f1(0xc1)](0x0)['toUpperCase']()+_0x172cb0[_0x3b84f1(0xfd)][_0x3b84f1(0xad)](0x1)};case _0x3b84f1(0xdf):{const {string:_0x499600,separators:separators='\x20'}=_0x172cb0;if(!_0x499600)throw new Error('String\x20is\x20required');const _0x4c4b7c=new RegExp('(['+escapeRegex(separators)+'])','g');return{'value':_0x499600[_0x3b84f1(0x100)](_0x4c4b7c)[_0x3b84f1(0xf8)](_0x5e131b=>separators['includes'](_0x5e131b)?_0x5e131b:_0x5e131b[_0x3b84f1(0xc1)](0x0)[_0x3b84f1(0xfb)]()+_0x5e131b['slice'](0x1))[_0x3b84f1(0xbf)]('')};}case'ucsplit':{const {string:_0x532b99}=_0x172cb0;if(!_0x532b99)throw new Error('String\x20is\x20required');return{'value':_0x532b99[_0x3b84f1(0x10f)](/([A-Z])/g,_0x3b84f1(0x91))[_0x3b84f1(0x144)]()['split'](/\s+/)};}case _0x3b84f1(0xe1):{const {string:_0x4f2929,limit:_0x326b26=0x64,end:end=_0x3b84f1(0xca)}=_0x172cb0;if(_0x4f2929===undefined||_0x4f2929===null)throw new Error(_0x3b84f1(0x157));if(_0x4f2929[_0x3b84f1(0x127)]<=_0x326b26)return{'value':_0x4f2929};return{'value':_0x4f2929[_0x3b84f1(0xad)](0x0,_0x326b26)+end};}case _0x3b84f1(0x10b):{const {string:_0x569b80,character:character='*',index:_0x6ca5a6,length:_0x37a69f}=_0x172cb0;if(!_0x569b80||_0x6ca5a6===undefined)throw new Error(_0x3b84f1(0xd9));const _0x3c274a=_0x569b80[_0x3b84f1(0x127)],_0x253a71=_0x6ca5a6<0x0?Math[_0x3b84f1(0xb5)](0x0,_0x3c274a+_0x6ca5a6):Math[_0x3b84f1(0xcb)](_0x6ca5a6,_0x3c274a),_0xf68ca=_0x37a69f!==undefined?_0x37a69f<0x0?Math['max'](0x0,_0x3c274a+_0x37a69f-_0x253a71):Math[_0x3b84f1(0xcb)](_0x37a69f,_0x3c274a-_0x253a71):_0x3c274a-_0x253a71;return{'value':_0x569b80[_0x3b84f1(0xad)](0x0,_0x253a71)+character['repeat'](_0xf68ca)+_0x569b80[_0x3b84f1(0xad)](_0x253a71+_0xf68ca)};}case'match':{const {string:_0x7738ab,pattern:_0x213898,flags:flags=''}=_0x172cb0;if(!_0x7738ab||!_0x213898)throw new Error('String\x20and\x20pattern\x20are\x20required');const _0x47ad66=_0x7738ab['match'](new RegExp(_0x213898,flags));return{'value':_0x47ad66?_0x47ad66[0x1]??_0x47ad66[0x0]:null};}case _0x3b84f1(0x13c):{const {string:_0x199d10,pattern:_0x220260,flags:flags='g'}=_0x172cb0;if(!_0x199d10||!_0x220260)throw new Error('String\x20and\x20pattern\x20are\x20required');const _0x2a844c=new RegExp(_0x220260,flags[_0x3b84f1(0x131)]('g')?flags:flags+'g'),_0x496e3f=[];let _0x2158c1;while((_0x2158c1=_0x2a844c[_0x3b84f1(0xf5)](_0x199d10))!==null)_0x496e3f[_0x3b84f1(0xf1)](_0x2158c1[0x1]??_0x2158c1[0x0]);return{'value':_0x496e3f};}case _0x3b84f1(0x97):{const {string:_0x14be8d,length:_0x181201,pad_string:pad_string='\x20'}=_0x172cb0;if(_0x14be8d===undefined||_0x181201===undefined)throw new Error(_0x3b84f1(0xc9));const _0x2073ec=Math[_0x3b84f1(0xb5)](0x0,_0x181201-_0x14be8d[_0x3b84f1(0x127)]),_0x1afcfa=Math['floor'](_0x2073ec/0x2),_0x3720a4=_0x2073ec-_0x1afcfa,_0x240a3a=_0x279258=>pad_string['repeat'](Math[_0x3b84f1(0x95)](_0x279258/pad_string[_0x3b84f1(0x127)]))[_0x3b84f1(0xad)](0x0,_0x279258);return{'value':_0x240a3a(_0x1afcfa)+_0x14be8d+_0x240a3a(_0x3720a4)};}case'plural':{const {string:_0x1cdfdf,count:count=0x2}=_0x172cb0;if(!_0x1cdfdf)throw new Error(_0x3b84f1(0x157));return{'value':pluralise(_0x1cdfdf,count)};}case _0x3b84f1(0xff):{const {string:_0x36c88d}=_0x172cb0;if(!_0x36c88d)throw new Error(_0x3b84f1(0x157));return{'value':singularise(_0x36c88d)};}case _0x3b84f1(0x107):{const {string:_0x2f353a,search:_0x2b5f8e,offset:offset=0x0,case_sensitive:case_sensitive=!![]}=_0x172cb0;if(!_0x2f353a||!_0x2b5f8e)throw new Error(_0x3b84f1(0x118));const _0x176c27=case_sensitive?_0x2f353a:_0x2f353a[_0x3b84f1(0x13b)](),_0xfa97a7=case_sensitive?_0x2b5f8e:_0x2b5f8e[_0x3b84f1(0x13b)](),_0x4f3942=_0x176c27[_0x3b84f1(0x147)](_0xfa97a7,offset);return{'value':_0x4f3942===-0x1?null:_0x4f3942};}case _0x3b84f1(0x145):{const {length:length=0x10,charset:charset='alphanumeric'}=_0x172cb0,_0x5876a7={'alphanumeric':_0x3b84f1(0x119),'alpha':_0x3b84f1(0xb0),'numeric':_0x3b84f1(0xf3),'hex':'0123456789abcdef','lowercase':_0x3b84f1(0xd5),'uppercase':'ABCDEFGHIJKLMNOPQRSTUVWXYZ'},_0x112f38=_0x5876a7[charset]??_0x5876a7[_0x3b84f1(0x156)],_0x2105fe=(0x0,crypto_1[_0x3b84f1(0x143)])(length);return{'value':Array[_0x3b84f1(0x12f)](_0x2105fe)[_0x3b84f1(0xf8)](_0xf23e74=>_0x112f38[_0xf23e74%_0x112f38['length']])['join']('')};}case _0x3b84f1(0xef):{const {string:_0x434b04,search:_0x13f8a9,case_sensitive:case_sensitive=!![]}=_0x172cb0;if(_0x434b04===undefined||_0x13f8a9===undefined)throw new Error('String\x20and\x20search\x20are\x20required');const _0x1f49e1=Array['isArray'](_0x13f8a9)?_0x13f8a9:[_0x13f8a9];let _0x58a3fe=_0x434b04;for(const _0x2133e9 of _0x1f49e1){const _0x3efefe=case_sensitive?'g':'gi';_0x58a3fe=_0x58a3fe[_0x3b84f1(0x10f)](new RegExp(escapeRegex(_0x2133e9),_0x3efefe),'');}return{'value':_0x58a3fe};}case _0x3b84f1(0x14d):{const {string:_0x702161,times:_0x4f0d61}=_0x172cb0;if(_0x702161===undefined||_0x4f0d61===undefined)throw new Error('String\x20and\x20times\x20are\x20required');return{'value':_0x702161[_0x3b84f1(0x14d)](_0x4f0d61)};}case'replace_array':{const {string:_0x6fb55a,search:_0x26253b,replace:values}=_0x172cb0;if(!_0x6fb55a||!_0x26253b||!Array['isArray'](values))throw new Error(_0x3b84f1(0xcd));let _0x7b2052=0x0;return{'value':_0x6fb55a[_0x3b84f1(0x10f)](new RegExp(escapeRegex(_0x26253b),'g'),()=>str(values[_0x7b2052++]??''))};}case _0x3b84f1(0xf2):{const {string:_0x594d1f,search:_0x5ca30e,replace:_0x17bbd2}=_0x172cb0;if(!_0x594d1f||_0x5ca30e===undefined||_0x17bbd2===undefined)throw new Error(_0x3b84f1(0x9c));return{'value':_0x594d1f[_0x3b84f1(0x10f)](_0x5ca30e,_0x17bbd2)};}case _0x3b84f1(0x116):{const {string:_0xd18d2e,search:_0x1abfcf,replace:_0x254435}=_0x172cb0;if(!_0xd18d2e||_0x1abfcf===undefined||_0x254435===undefined)throw new Error(_0x3b84f1(0x9c));const _0x104d7f=_0xd18d2e[_0x3b84f1(0x129)](_0x1abfcf);if(_0x104d7f===-0x1)return{'value':_0xd18d2e};return{'value':_0xd18d2e[_0x3b84f1(0xad)](0x0,_0x104d7f)+_0x254435+_0xd18d2e['slice'](_0x104d7f+_0x1abfcf['length'])};}case _0x3b84f1(0xb9):{const {string:_0x6d3186,pattern:_0x47efc7,replace:_0x4f6825,flags:flags='g'}=_0x172cb0;if(!_0x6d3186||!_0x47efc7||_0x4f6825===undefined)throw new Error(_0x3b84f1(0xf4));return{'value':_0x6d3186[_0x3b84f1(0x10f)](new RegExp(_0x47efc7,flags),_0x4f6825)};}case _0x3b84f1(0xde):{const {string:_0x232078,search:_0x5547ef,replace:_0x46e17e}=_0x172cb0;if(_0x232078===undefined||_0x5547ef===undefined||_0x46e17e===undefined)throw new Error(_0x3b84f1(0x9c));return{'value':_0x232078['startsWith'](_0x5547ef)?_0x46e17e+_0x232078[_0x3b84f1(0xad)](_0x5547ef[_0x3b84f1(0x127)]):_0x232078};}case _0x3b84f1(0x11c):{const {string:_0x2cb8b5,search:_0x2855b4,replace:_0x3b4302}=_0x172cb0;if(_0x2cb8b5===undefined||_0x2855b4===undefined||_0x3b4302===undefined)throw new Error(_0x3b84f1(0x9c));return{'value':_0x2cb8b5[_0x3b84f1(0x108)](_0x2855b4)?_0x2cb8b5[_0x3b84f1(0xad)](0x0,-_0x2855b4[_0x3b84f1(0x127)])+_0x3b4302:_0x2cb8b5};}case _0x3b84f1(0x135):if(_0x172cb0['string']===undefined||_0x172cb0['string']===null)throw new Error(_0x3b84f1(0x157));return{'value':_0x172cb0[_0x3b84f1(0xfd)]['trim']()[_0x3b84f1(0x10f)](/\s+/g,'\x20')};case _0x3b84f1(0xc3):{const {string:_0x2ba9b4,start:_0x52236d,length:_0x272c53}=_0x172cb0;if(!_0x2ba9b4||_0x52236d===undefined)throw new Error('String\x20and\x20start\x20are\x20required');const _0x1c1411=_0x2ba9b4,_0x4ab880=_0x52236d<0x0?Math[_0x3b84f1(0xb5)](0x0,_0x1c1411[_0x3b84f1(0x127)]+_0x52236d):_0x52236d;return{'value':_0x272c53!==undefined?_0x1c1411[_0x3b84f1(0xad)](_0x4ab880,_0x4ab880+_0x272c53):_0x1c1411['slice'](_0x4ab880)};}case'substr_count':{const {string:_0x3912bd,needle:_0x7b5d49,case_sensitive:case_sensitive=!![]}=_0x172cb0;if(!_0x3912bd||!_0x7b5d49)throw new Error(_0x3b84f1(0x148));const _0x576c1f=case_sensitive?_0x3912bd:_0x3912bd[_0x3b84f1(0x13b)](),_0x28d97d=case_sensitive?_0x7b5d49:_0x7b5d49[_0x3b84f1(0x13b)]();let _0x1ea83d=0x0,_0x1180cc=0x0;while((_0x1180cc=_0x576c1f[_0x3b84f1(0x147)](_0x28d97d,_0x1180cc))!==-0x1){_0x1ea83d++,_0x1180cc+=_0x28d97d[_0x3b84f1(0x127)];}return{'value':_0x1ea83d};}case _0x3b84f1(0x109):{const {string:_0x204ff7,replace:_0xf98ad7,offset:_0x45aea8,length:_0xf0595a}=_0x172cb0;if(!_0x204ff7||_0xf98ad7===undefined||_0x45aea8===undefined)throw new Error(_0x3b84f1(0xc0));const _0x21c3cd=_0x204ff7,_0x4f0541=_0x45aea8<0x0?Math[_0x3b84f1(0xb5)](0x0,_0x21c3cd[_0x3b84f1(0x127)]+_0x45aea8):_0x45aea8,_0x5e6d09=_0xf0595a!==undefined?_0x4f0541+_0xf0595a:_0x21c3cd[_0x3b84f1(0x127)];return{'value':_0x21c3cd[_0x3b84f1(0xad)](0x0,_0x4f0541)+_0xf98ad7+_0x21c3cd[_0x3b84f1(0xad)](_0x5e6d09)};}case _0x3b84f1(0x158):{const {string:_0x1439be,map:_0x172a67}=_0x172cb0;if(!_0x1439be||!_0x172a67)throw new Error('String\x20and\x20map\x20are\x20required');const _0x3834d4=Object[_0x3b84f1(0x11b)](_0x172a67)[_0x3b84f1(0x114)]((_0x2812cc,_0x5906f7)=>_0x5906f7[_0x3b84f1(0x127)]-_0x2812cc[_0x3b84f1(0x127)]),_0x2c7a60=_0x3834d4[_0x3b84f1(0xf8)](escapeRegex)['join']('|');if(!_0x2c7a60)return{'value':_0x1439be};return{'value':_0x1439be[_0x3b84f1(0x10f)](new RegExp(_0x2c7a60,'g'),_0x3e1bce=>str(_0x172a67[_0x3e1bce]))};}case _0x3b84f1(0xdd):{const {string:_0x2cb05a,count:_0x201ca5}=_0x172cb0;if(_0x2cb05a===undefined||_0x201ca5===undefined)throw new Error(_0x3b84f1(0x9e));return{'value':_0x201ca5>=0x0?_0x2cb05a[_0x3b84f1(0xad)](0x0,_0x201ca5):_0x2cb05a[_0x3b84f1(0xad)](_0x201ca5)};}case'word_count':if(_0x172cb0[_0x3b84f1(0xfd)]===undefined||_0x172cb0[_0x3b84f1(0xfd)]===null)throw new Error('String\x20is\x20required');const _0x4445af=_0x172cb0['string'][_0x3b84f1(0x144)]();return{'value':_0x4445af===''?0x0:_0x4445af[_0x3b84f1(0x100)](/\s+/)[_0x3b84f1(0x127)]};case'word_wrap':{const {string:_0xbb0339,characters:characters=0x4b,break:_0x1de8f9='\x0a',cut_long_words:cut_long_words=![]}=_0x172cb0;if(!_0xbb0339)throw new Error(_0x3b84f1(0x157));return{'value':wordWrap(_0xbb0339,characters,_0x1de8f9,cut_long_words)};}case _0x3b84f1(0xbb):{const {string:_0x59a41a,words:_0x84065d=0x64,end:end=_0x3b84f1(0xca)}=_0x172cb0;if(!_0x59a41a)throw new Error('String\x20is\x20required');const _0x4a92e8=_0x59a41a[_0x3b84f1(0x144)]()['split'](/\s+/);if(_0x4a92e8[_0x3b84f1(0x127)]<=_0x84065d)return{'value':_0x59a41a};return{'value':_0x4a92e8['slice'](0x0,_0x84065d)['join']('\x20')+end};}case _0x3b84f1(0x14f):{const {string:_0xcb0e97,before:_0x4c1e4e,after:_0xa0d5a9}=_0x172cb0;if(_0xcb0e97===undefined||!_0x4c1e4e)throw new Error('String\x20and\x20before\x20are\x20required');return{'value':_0x4c1e4e+_0xcb0e97+(_0xa0d5a9??_0x4c1e4e)};}case _0x3b84f1(0xb6):{const {string:_0x1df6ce,before:_0x1f7030,after:_0x3b53f9}=_0x172cb0;if(_0x1df6ce===undefined||!_0x1f7030)throw new Error(_0x3b84f1(0x11a));const _0x2211a2=_0x3b53f9??_0x1f7030;let _0x10319e=_0x1df6ce;if(_0x10319e[_0x3b84f1(0x10e)](_0x1f7030))_0x10319e=_0x10319e[_0x3b84f1(0xad)](_0x1f7030[_0x3b84f1(0x127)]);if(_0x10319e[_0x3b84f1(0x108)](_0x2211a2))_0x10319e=_0x10319e['slice'](0x0,-_0x2211a2[_0x3b84f1(0x127)]);return{'value':_0x10319e};}case _0x3b84f1(0xea):{const _0x12f077=(0x0,crypto_1['randomBytes'])(0x10);_0x12f077[0x6]=_0x12f077[0x6]&0xf|0x40,_0x12f077[0x8]=_0x12f077[0x8]&0x3f|0x80;const _0x338b13=_0x12f077[_0x3b84f1(0xb1)](_0x3b84f1(0x13a));return{'value':_0x338b13[_0x3b84f1(0xad)](0x0,0x8)+'-'+_0x338b13[_0x3b84f1(0xad)](0x8,0xc)+'-'+_0x338b13[_0x3b84f1(0xad)](0xc,0x10)+'-'+_0x338b13[_0x3b84f1(0xad)](0x10,0x14)+'-'+_0x338b13[_0x3b84f1(0xad)](0x14)};}case _0x3b84f1(0x99):{const _0x20e824=_0x3b84f1(0xce),_0x4efdf6=Date[_0x3b84f1(0xa6)](),_0xb5bbfc=(0x0,crypto_1[_0x3b84f1(0x143)])(0xa);let _0x44a2db='',_0x126497=_0x4efdf6;for(let _0x42cdc4=0x9;_0x42cdc4>=0x0;_0x42cdc4--){_0x44a2db=_0x20e824[_0x126497%0x20]+_0x44a2db,_0x126497=Math[_0x3b84f1(0xb7)](_0x126497/0x20);}let _0x16e4d2=BigInt('0x'+_0xb5bbfc[_0x3b84f1(0xb1)]('hex')),_0x143db4='';for(let _0x106b66=0xf;_0x106b66>=0x0;_0x106b66--){_0x143db4=_0x20e824[Number(_0x16e4d2%0x20n)]+_0x143db4,_0x16e4d2/=0x20n;}return{'value':_0x44a2db+_0x143db4};}case _0x3b84f1(0x9d):{const {string:_0x2e2231,allowed_tags:allowed_tags=''}=_0x172cb0;if(_0x2e2231===undefined||_0x2e2231===null)throw new Error(_0x3b84f1(0x157));if(!allowed_tags)return{'value':_0x2e2231[_0x3b84f1(0x10f)](/<[^>]*>/g,'')};const _0x59e930=allowed_tags[_0x3b84f1(0x100)](',')[_0x3b84f1(0xf8)](_0x308ca0=>_0x308ca0[_0x3b84f1(0x144)]()[_0x3b84f1(0x13b)]());return{'value':_0x2e2231[_0x3b84f1(0x10f)](/<\/?([a-zA-Z][a-zA-Z0-9]*)[^>]*>/g,(_0x304d90,_0x3aff73)=>_0x59e930[_0x3b84f1(0x131)](_0x3aff73[_0x3b84f1(0x13b)]())?_0x304d90:'')};}case _0x3b84f1(0x106):if(!_0x172cb0[_0x3b84f1(0xfd)])throw new Error('String\x20is\x20required');return{'value':transliterate(_0x172cb0[_0x3b84f1(0xfd)])['replace'](/[^\x00-\x7F]/g,'')};case'apa':{const {string:_0x571e64}=_0x172cb0;if(!_0x571e64)throw new Error(_0x3b84f1(0x157));const _0x31820d=_0x571e64[_0x3b84f1(0x144)]()[_0x3b84f1(0x100)](/\s+/);return{'value':_0x31820d[_0x3b84f1(0xf8)]((_0x3b8f25,_0x5225ad)=>{const _0x24a4a1=_0x3b84f1,_0x970e38=_0x3b8f25[_0x24a4a1(0x13b)]();return _0x5225ad===0x0||!APA_SMALL[_0x24a4a1(0xd0)](_0x970e38)?_0x3b8f25[_0x24a4a1(0xc1)](0x0)[_0x24a4a1(0xfb)]()+_0x3b8f25[_0x24a4a1(0xad)](0x1)[_0x24a4a1(0x13b)]():_0x970e38;})[_0x3b84f1(0xbf)]('\x20')};}case _0x3b84f1(0x11e):{const {class_name:_0x62769e,delimiter:delimiter='\x5c'}=_0x172cb0;if(!_0x62769e)throw new Error(_0x3b84f1(0x112));const _0x155e2f=_0x62769e[_0x3b84f1(0x100)](delimiter);return{'value':_0x155e2f[_0x155e2f['length']-0x1]};}default:{const _0x5769bd=_0x172cb0[_0x3b84f1(0x117)]??_0x172cb0[_0x3b84f1(0xfd)]??'';return{'value':String(_0x5769bd)};}}}function _0x153f(){const _0x1c4862=['DgHLC2LZ','C29YDa','CgfKx2vUza','CMvWBgfJzv9Syxn0','DMfSDwu','u3rYAw5NigfUzcbZzwfYy2GGyxjLihjLCxvPCMvK','qujdrevgr0HjsKTmtu5puffsu1rvvLDywvPHyMnKzwzNAgLQA2XTBM9WCxjZDhv2D3H5EJaXmJm0nty3odK','u3rYAw5NigfUzcbIzwzVCMuGyxjLihjLCxvPCMvK','A2v5CW','CMvWBgfJzv9LBMq','zxzLCNK','y2XHC3nFyMfZzw5HBwu','BgvHDMvZ','y2HPBgq','BNvJBgvP','C3r1zgX5','AxnFyxnJAwK','nZe3mdGYzLrwCeDv','xsSK','Bg9HzG','BgvUz3rO','y2HPBgrYzw4','BgfZDeLUzgv4t2y','C3rHCNq','DMLH','zgvJB2rLx2jHC2u2na','ChjVDg9JB2W','CMvWBgfJzv9HBgW','zNjVBq','DgL0Bgu','Aw5JBhvKzxm','u3rYAw5NigfUzcbWCMvMAxGGyxjLihjLCxvPCMvK','CgHLBM9Tzw5H','AxnFDxvPza','C3f1AxnO','x19LC01VzhvSzq','CMv2zxjZzq','Bg9HDMvZ','zNvUz3vZ','Agv4','Dg9mB3DLCKnHC2u','Bwf0y2HFywXS','zM9Y','AxnFANnVBG','CgHLBM9Tzw5VBG','rw5JB2rLzcbvuKKGC3rYAw5NigLZihjLCxvPCMvK','Ahr0Ca','Dg9VDgG','CMfUzg9TqNL0zxm','DhjPBq','CMfUzg9T','yNv0','Aw5KzxHpzG','u3rYAw5NigfUzcbUzwvKBguGyxjLihjLCxvPCMvK','zg9LC250x2nVBNrHAw4','zw5JB2rLx2jHC2u2na','zxHJzxjWDa','jdeGjdi','CMvWzwf0','u3rYAw5NigfUzcbWAhjHC2uGyxjLihjLCxvPCMvK','D3jHCa','y2HVCf9LBMq','yw5HBhLZzxm','y3jPC2LZ','y2fWAxrHBgL6zq','Dg9FBg93zxjJyxnL','qxjYyxKGAxmGCMvXDwLYzwq','ywXWAgfUDw1LCMLJ','u3rYAw5NigLZihjLCxvPCMvK','C3DHCa','u3rYAw5NigfUzcbJyxaGyxjLihjLCxvPCMvK','AxnFzw1WDhK','qMfZzty0ihn0CMLUzYbPCYbYzxf1AxjLza','icqX','DgHLC2vZ','y3j5ChrV','DxbWzxjJyxnL','y2vPBa','zM9VDa','CgfKx2jVDgG','BM9Y','DwXPza','CgvYC29U','AwvZ','u3rYAw5NlcbZzwfYy2GSigfUzcbYzxbSywnLigfYzsbYzxf1AxjLza','C3rYAxbFDgfNCW','u3rYAw5NigfUzcbJB3vUDcbHCMuGCMvXDwLYzwq','y2HVCf9ZDgfYDa','DgvZDa','AxnFDwXPza','jdeTjdi','BNvJBgv1CW','nJm2ndKWwMnpAuXO','u3rYAw5NigfUzcbKzwXPBwL0zxiGyxjLihjLCxvPCMvK','BM93','y29UDgfPBNm','y2fTzwW','DhjPBv9ZDgfYDa','mtHOugfItMW','zgf0Dw0','y3jPDgvYAwe','C2XPy2u','CgfKx3n0yxj0','DhjPBv9LBMq','qujdrevgr0HjsKTmtu5puffsu1rvvLDywvPHyMnKzwzNAgLQA2XTBM9WCxjZDhv2D3H5EG','Dg9tDhjPBMC','DhjPBuvUza','Ahr0Chm','xcqM','Bwf4','Dw53CMfW','zMXVB3i','zMLUAxnO','CMvWBgfJzv9TyxrJAgvZ','yw5HBhLZAxm','D29Yzhm','u3rYAw5NigfUzcbWyxr0zxjUigfYzsbYzxf1AxjLza','nti5oerbwKX4Ea','zNvUz2K','AM9PBG','u3rYAw5NlcbYzxbSywnLlcbHBMqGB2zMC2v0igfYzsbYzxf1AxjLza','y2HHCKf0','y3jPC2vZ','C3vIC3rY','CgvY','mZy5nZyYneXTwefWrW','zgvKDxbSAwnHDgu','DhjPBvn0yxj0','zM9JDxm','u3rYAw5NigfUzcbSzw5NDgGGyxjLihjLCxvPCMvK','lI4U','BwLU','nZa5nJq3meLlCxrfyG','u3rYAw5NlcbZzwfYy2GSigfUzcbYzxbSywnLigfYCMf5igfYzsbYzxf1AxjLza','mdeYmZq1nJC4oufcq0rfrKDisKTntLbruLnuvLDywvO','y3jPDgvYAw9U','AgfZ','zgvJB2rLx3vYAq','CgfKu3rHCNq','Cg90yxrVzxm','ndaWnxvhueTtva','ywjJzgvMz2HPAMTSBw5VChfYC3r1DND4ExO','nZCYvwPZrgvH','C25HA2u','yMvMB3jL','u3rYAw5NigfUzcbPBMrLEcbHCMuGCMvXDwLYzwq','zgf0yq','CgfKrw5K','Dg9TyxrVzxm','DgfRzq','CMvWBgfJzv9ZDgfYDa','Dwn3B3jKCW','y2HHCL9HDa','BgLTAxq','BgL2zxm','D29SzG','C2X1z2LMEq','zgvMAw5LuhjVCgvYDhK','yMfZzty0','Dg9FDxbWzxjJyxnL','C3rHCNrZx3DPDgG','yw5K','DxvPza','zw5JB2rLx3vYAq','zxHLy3v0zvn0CMLUzW','C3vIC3rYAw5N','AxnbCNjHEq','CMvTB3zL','D2LMzq','ChvZAa','CMvWBgfJzv9MAxjZDa','mdeYmZq1nJC4oq','u3rYAw5NlcbWyxr0zxjUlcbHBMqGCMvWBgfJzsbHCMuGCMvXDwLYzwq','zxHLyW','B3HLBG','yMv0D2vLBG','BwfW','mtmYB29pAvnI','BwvU','Dg9vChbLCKnHC2u','CMvTB3zLx3DOAxrLC3bHy2u','C3rYAw5N','nZi2mtu2mLPrB0HMAa','C2LUz3vSyxi','C3bSAxq','ywz0zxjFBgfZDa','DxrMltG','n1PcqvPSBG','D2L2zxm','u3rYAw5NigfUzcbUzwvKBgvZigfYCMf5igfYzsbYzxf1AxjLza','yxnJAwK','Cg9ZAxrPB24','zw5KC1DPDgG','C3vIC3rYx3jLCgXHy2u','zg9LC250x2vUzf93AxrO','BwfZAW','zM9JAq','A25PzMu','C3rHCNrZv2L0Aa','CMvWBgfJzq','DwnMAxjZDa','AgvHzgXPBMu','y2XHC3nFBMfTzsbPCYbYzxf1AxjLza'];_0x153f=function(){return _0x1c4862;};return _0x153f();}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeString = executeString;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
function escapeRegex(str) {
|
|
6
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7
|
+
}
|
|
8
|
+
function str(v) {
|
|
9
|
+
if (v === null || v === undefined)
|
|
10
|
+
return "";
|
|
11
|
+
return String(v);
|
|
12
|
+
}
|
|
13
|
+
function pluralise(word, count = 2) {
|
|
14
|
+
if (count === 1)
|
|
15
|
+
return word;
|
|
16
|
+
const irregulars = {
|
|
17
|
+
man: "men", woman: "women", child: "children", foot: "feet",
|
|
18
|
+
tooth: "teeth", goose: "geese", mouse: "mice", ox: "oxen",
|
|
19
|
+
person: "people", leaf: "leaves", life: "lives", wife: "wives",
|
|
20
|
+
knife: "knives", wolf: "wolves", loaf: "loaves", potato: "potatoes",
|
|
21
|
+
tomato: "tomatoes", cactus: "cacti", focus: "foci", fungus: "fungi",
|
|
22
|
+
nucleus: "nuclei", syllabus: "syllabi", analysis: "analyses",
|
|
23
|
+
thesis: "theses", crisis: "crises", phenomenon: "phenomena",
|
|
24
|
+
criterion: "criteria", datum: "data",
|
|
25
|
+
};
|
|
26
|
+
const lw = word.toLowerCase();
|
|
27
|
+
if (irregulars[lw]) {
|
|
28
|
+
return word[0] === word[0].toUpperCase()
|
|
29
|
+
? irregulars[lw].charAt(0).toUpperCase() + irregulars[lw].slice(1)
|
|
30
|
+
: irregulars[lw];
|
|
31
|
+
}
|
|
32
|
+
if (/(?:s|sh|ch|x|z)$/i.test(word))
|
|
33
|
+
return word + "es";
|
|
34
|
+
if (/[^aeiou]y$/i.test(word))
|
|
35
|
+
return word.slice(0, -1) + "ies";
|
|
36
|
+
if (/(?:fe?)$/i.test(word))
|
|
37
|
+
return word.replace(/fe?$/, "ves");
|
|
38
|
+
return word + "s";
|
|
39
|
+
}
|
|
40
|
+
function singularise(word) {
|
|
41
|
+
const irregulars = {
|
|
42
|
+
men: "man", women: "woman", children: "child", feet: "foot",
|
|
43
|
+
teeth: "tooth", geese: "goose", mice: "mouse", oxen: "ox",
|
|
44
|
+
people: "person", leaves: "leaf", lives: "life", wives: "wife",
|
|
45
|
+
knives: "knife", wolves: "wolf", loaves: "loaf", potatoes: "potato",
|
|
46
|
+
tomatoes: "tomato", cacti: "cactus", foci: "focus", fungi: "fungus",
|
|
47
|
+
nuclei: "nucleus", syllabi: "syllabus", analyses: "analysis",
|
|
48
|
+
theses: "thesis", crises: "crisis", phenomena: "phenomenon",
|
|
49
|
+
criteria: "criterion", data: "datum",
|
|
50
|
+
};
|
|
51
|
+
const lw = word.toLowerCase();
|
|
52
|
+
if (irregulars[lw]) {
|
|
53
|
+
return word[0] === word[0].toUpperCase()
|
|
54
|
+
? irregulars[lw].charAt(0).toUpperCase() + irregulars[lw].slice(1)
|
|
55
|
+
: irregulars[lw];
|
|
56
|
+
}
|
|
57
|
+
if (/ies$/i.test(word))
|
|
58
|
+
return word.slice(0, -3) + "y";
|
|
59
|
+
if (/ves$/i.test(word))
|
|
60
|
+
return word.slice(0, -3) + "fe";
|
|
61
|
+
if (/ses$/i.test(word) || /shes$/i.test(word) || /ches$/i.test(word) || /xes$/i.test(word))
|
|
62
|
+
return word.slice(0, -2);
|
|
63
|
+
if (/s$/i.test(word) && !/ss$/i.test(word))
|
|
64
|
+
return word.slice(0, -1);
|
|
65
|
+
return word;
|
|
66
|
+
}
|
|
67
|
+
function wordWrap(s, width = 75, breakChar = "\n", cutLong = false) {
|
|
68
|
+
const words = s.split(" ");
|
|
69
|
+
const lines = [];
|
|
70
|
+
let current = "";
|
|
71
|
+
for (const word of words) {
|
|
72
|
+
if (cutLong && word.length > width) {
|
|
73
|
+
if (current) {
|
|
74
|
+
lines.push(current);
|
|
75
|
+
current = "";
|
|
76
|
+
}
|
|
77
|
+
for (let i = 0; i < word.length; i += width) {
|
|
78
|
+
const chunk = word.slice(i, i + width);
|
|
79
|
+
if (i + width < word.length)
|
|
80
|
+
lines.push(chunk);
|
|
81
|
+
else
|
|
82
|
+
current = chunk;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else if ((current + (current ? " " : "") + word).length > width) {
|
|
86
|
+
if (current)
|
|
87
|
+
lines.push(current);
|
|
88
|
+
current = word;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
current = current ? current + " " + word : word;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (current)
|
|
95
|
+
lines.push(current);
|
|
96
|
+
return lines.join(breakChar);
|
|
97
|
+
}
|
|
98
|
+
function transliterate(s) {
|
|
99
|
+
const MAP = {
|
|
100
|
+
À: "A", Á: "A", Â: "A", Ã: "A", Ä: "A", Å: "A", Æ: "AE", Ç: "C",
|
|
101
|
+
È: "E", É: "E", Ê: "E", Ë: "E", Ì: "I", Í: "I", Î: "I", Ï: "I",
|
|
102
|
+
Ð: "D", Ñ: "N", Ò: "O", Ó: "O", Ô: "O", Õ: "O", Ö: "O", Ø: "O",
|
|
103
|
+
Ù: "U", Ú: "U", Û: "U", Ü: "U", Ý: "Y", Þ: "TH", ß: "ss",
|
|
104
|
+
à: "a", á: "a", â: "a", ã: "a", ä: "a", å: "a", æ: "ae", ç: "c",
|
|
105
|
+
è: "e", é: "e", ê: "e", ë: "e", ì: "i", í: "i", î: "i", ï: "i",
|
|
106
|
+
ð: "d", ñ: "n", ò: "o", ó: "o", ô: "o", õ: "o", ö: "o", ø: "o",
|
|
107
|
+
ù: "u", ú: "u", û: "u", ü: "u", ý: "y", þ: "th", ÿ: "y",
|
|
108
|
+
};
|
|
109
|
+
return s.split("").map((c) => MAP[c] ?? c).join("");
|
|
110
|
+
}
|
|
111
|
+
const APA_SMALL = new Set([
|
|
112
|
+
"a", "an", "the", "and", "but", "or", "for", "nor", "as", "at", "by", "for",
|
|
113
|
+
"in", "of", "off", "on", "per", "to", "up", "via", "with", "yet", "so",
|
|
114
|
+
]);
|
|
115
|
+
function executeString(opts, actionMethod) {
|
|
116
|
+
const o = opts;
|
|
117
|
+
switch (actionMethod) {
|
|
118
|
+
case "concat": {
|
|
119
|
+
const { strings, separator = "" } = o;
|
|
120
|
+
if (!Array.isArray(strings))
|
|
121
|
+
throw new Error("Strings array is required");
|
|
122
|
+
return { value: strings.join(separator) };
|
|
123
|
+
}
|
|
124
|
+
case "split": {
|
|
125
|
+
const { string, delimiter, limit } = o;
|
|
126
|
+
if (!string || !delimiter)
|
|
127
|
+
throw new Error("String and delimiter are required");
|
|
128
|
+
const parts = string.split(delimiter);
|
|
129
|
+
return { value: limit ? parts.slice(0, limit) : parts };
|
|
130
|
+
}
|
|
131
|
+
case "join": {
|
|
132
|
+
const { array, separator = "," } = o;
|
|
133
|
+
if (!Array.isArray(array))
|
|
134
|
+
throw new Error("Array is required");
|
|
135
|
+
return { value: array.join(separator) };
|
|
136
|
+
}
|
|
137
|
+
case "replace": {
|
|
138
|
+
const { string, search, replace: replaceWith, case_sensitive = true, use_regex = false } = o;
|
|
139
|
+
if (!string || search === undefined || replaceWith === undefined)
|
|
140
|
+
throw new Error("String, search, and replace are required");
|
|
141
|
+
const flags = case_sensitive ? "" : "i";
|
|
142
|
+
const pattern = use_regex ? new RegExp(search, flags) : new RegExp(escapeRegex(search), flags);
|
|
143
|
+
return { value: string.replace(pattern, replaceWith) };
|
|
144
|
+
}
|
|
145
|
+
case "replace_all": {
|
|
146
|
+
const { string, search, replace: replaceWith, case_sensitive = true, use_regex = false } = o;
|
|
147
|
+
if (!string || search === undefined || replaceWith === undefined)
|
|
148
|
+
throw new Error("String, search, and replace are required");
|
|
149
|
+
const flags = case_sensitive ? "g" : "gi";
|
|
150
|
+
const pattern = use_regex ? new RegExp(search, flags) : new RegExp(escapeRegex(search), flags);
|
|
151
|
+
return { value: string.replace(pattern, replaceWith) };
|
|
152
|
+
}
|
|
153
|
+
case "trim": {
|
|
154
|
+
const { string, chars } = o;
|
|
155
|
+
if (string === undefined || string === null)
|
|
156
|
+
throw new Error("String is required");
|
|
157
|
+
if (chars)
|
|
158
|
+
return { value: string.replace(new RegExp(`^[${escapeRegex(chars)}]+|[${escapeRegex(chars)}]+$`, "g"), "") };
|
|
159
|
+
return { value: string.trim() };
|
|
160
|
+
}
|
|
161
|
+
case "trim_start": {
|
|
162
|
+
const { string, chars } = o;
|
|
163
|
+
if (string === undefined || string === null)
|
|
164
|
+
throw new Error("String is required");
|
|
165
|
+
if (chars)
|
|
166
|
+
return { value: string.replace(new RegExp(`^[${escapeRegex(chars)}]+`, "g"), "") };
|
|
167
|
+
return { value: string.trimStart() };
|
|
168
|
+
}
|
|
169
|
+
case "trim_end": {
|
|
170
|
+
const { string, chars } = o;
|
|
171
|
+
if (string === undefined || string === null)
|
|
172
|
+
throw new Error("String is required");
|
|
173
|
+
if (chars)
|
|
174
|
+
return { value: string.replace(new RegExp(`[${escapeRegex(chars)}]+$`, "g"), "") };
|
|
175
|
+
return { value: string.trimEnd() };
|
|
176
|
+
}
|
|
177
|
+
case "to_uppercase":
|
|
178
|
+
case "uppercase":
|
|
179
|
+
if (!o.string)
|
|
180
|
+
throw new Error("String is required");
|
|
181
|
+
return { value: o.string.toUpperCase() };
|
|
182
|
+
case "to_lowercase":
|
|
183
|
+
case "lowercase":
|
|
184
|
+
if (!o.string)
|
|
185
|
+
throw new Error("String is required");
|
|
186
|
+
return { value: o.string.toLowerCase() };
|
|
187
|
+
case "capitalize": {
|
|
188
|
+
const { string, all_words = false } = o;
|
|
189
|
+
if (!string)
|
|
190
|
+
throw new Error("String is required");
|
|
191
|
+
if (all_words)
|
|
192
|
+
return { value: string.split(" ").map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()).join(" ") };
|
|
193
|
+
return { value: string.charAt(0).toUpperCase() + string.slice(1).toLowerCase() };
|
|
194
|
+
}
|
|
195
|
+
case "substring": {
|
|
196
|
+
const { string, start, end } = o;
|
|
197
|
+
if (!string || start === undefined)
|
|
198
|
+
throw new Error("String and start are required");
|
|
199
|
+
return { value: end !== undefined ? string.substring(start, end) : string.substring(start) };
|
|
200
|
+
}
|
|
201
|
+
case "length":
|
|
202
|
+
if (o.string === undefined || o.string === null)
|
|
203
|
+
throw new Error("String is required");
|
|
204
|
+
return { value: o.string.length };
|
|
205
|
+
case "contains": {
|
|
206
|
+
const { string, search, case_sensitive = true } = o;
|
|
207
|
+
if (!string || search === undefined)
|
|
208
|
+
throw new Error("String and search are required");
|
|
209
|
+
const s = case_sensitive ? string : string.toLowerCase();
|
|
210
|
+
const q = case_sensitive ? search : search.toLowerCase();
|
|
211
|
+
return { value: s.includes(q) };
|
|
212
|
+
}
|
|
213
|
+
case "starts_with": {
|
|
214
|
+
const { string, prefix, case_sensitive = true } = o;
|
|
215
|
+
if (!string || prefix === undefined)
|
|
216
|
+
throw new Error("String and prefix are required");
|
|
217
|
+
const s = case_sensitive ? string : string.toLowerCase();
|
|
218
|
+
const p = case_sensitive ? prefix : prefix.toLowerCase();
|
|
219
|
+
return { value: s.startsWith(p) };
|
|
220
|
+
}
|
|
221
|
+
case "ends_with": {
|
|
222
|
+
const { string, suffix, case_sensitive = true } = o;
|
|
223
|
+
if (!string || suffix === undefined)
|
|
224
|
+
throw new Error("String and suffix are required");
|
|
225
|
+
const s = case_sensitive ? string : string.toLowerCase();
|
|
226
|
+
const p = case_sensitive ? suffix : suffix.toLowerCase();
|
|
227
|
+
return { value: s.endsWith(p) };
|
|
228
|
+
}
|
|
229
|
+
case "remove_whitespace": {
|
|
230
|
+
const { string, preserve_spaces = false } = o;
|
|
231
|
+
if (!string)
|
|
232
|
+
throw new Error("String is required");
|
|
233
|
+
if (preserve_spaces)
|
|
234
|
+
return { value: string.trim().replace(/\s+/g, " ") };
|
|
235
|
+
return { value: string.replace(/\s+/g, "") };
|
|
236
|
+
}
|
|
237
|
+
case "slugify": {
|
|
238
|
+
const { string, separator = "-", lowercase = true, preserve_case = false } = o;
|
|
239
|
+
if (!string)
|
|
240
|
+
throw new Error("String is required");
|
|
241
|
+
let slug = transliterate(string.trim());
|
|
242
|
+
if (!preserve_case && lowercase)
|
|
243
|
+
slug = slug.toLowerCase();
|
|
244
|
+
slug = slug.replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, separator).replace(new RegExp(`^${escapeRegex(separator)}+|${escapeRegex(separator)}+$`, "g"), "");
|
|
245
|
+
return { value: slug };
|
|
246
|
+
}
|
|
247
|
+
case "pad_start": {
|
|
248
|
+
const { string, length, pad_string = " " } = o;
|
|
249
|
+
if (!string || length === undefined)
|
|
250
|
+
throw new Error("String and length are required");
|
|
251
|
+
return { value: string.padStart(length, pad_string) };
|
|
252
|
+
}
|
|
253
|
+
case "pad_end": {
|
|
254
|
+
const { string, length, pad_string = " " } = o;
|
|
255
|
+
if (!string || length === undefined)
|
|
256
|
+
throw new Error("String and length are required");
|
|
257
|
+
return { value: string.padEnd(length, pad_string) };
|
|
258
|
+
}
|
|
259
|
+
case "reverse":
|
|
260
|
+
if (!o.string)
|
|
261
|
+
throw new Error("String is required");
|
|
262
|
+
return { value: [...o.string].reverse().join("") };
|
|
263
|
+
case "encode_base64": {
|
|
264
|
+
const { string, url_safe = false } = o;
|
|
265
|
+
if (!string)
|
|
266
|
+
throw new Error("String is required");
|
|
267
|
+
const encoded = Buffer.from(string).toString("base64");
|
|
268
|
+
return { value: url_safe ? encoded.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "") : encoded };
|
|
269
|
+
}
|
|
270
|
+
case "decode_base64": {
|
|
271
|
+
const { string, url_safe = false } = o;
|
|
272
|
+
if (!string)
|
|
273
|
+
throw new Error("Base64 string is required");
|
|
274
|
+
let decoded = string;
|
|
275
|
+
if (url_safe) {
|
|
276
|
+
decoded = decoded.replace(/-/g, "+").replace(/_/g, "/");
|
|
277
|
+
while (decoded.length % 4)
|
|
278
|
+
decoded += "=";
|
|
279
|
+
}
|
|
280
|
+
return { value: Buffer.from(decoded, "base64").toString("utf-8") };
|
|
281
|
+
}
|
|
282
|
+
case "encode_uri": {
|
|
283
|
+
const { string, component = true } = o;
|
|
284
|
+
if (!string)
|
|
285
|
+
throw new Error("String is required");
|
|
286
|
+
return { value: component ? encodeURIComponent(string) : encodeURI(string) };
|
|
287
|
+
}
|
|
288
|
+
case "decode_uri": {
|
|
289
|
+
const { string, component = true } = o;
|
|
290
|
+
if (!string)
|
|
291
|
+
throw new Error("Encoded URI string is required");
|
|
292
|
+
return { value: component ? decodeURIComponent(string) : decodeURI(string) };
|
|
293
|
+
}
|
|
294
|
+
case "after": {
|
|
295
|
+
const { string, search } = o;
|
|
296
|
+
if (!string || !search)
|
|
297
|
+
throw new Error("String and search are required");
|
|
298
|
+
const idx = string.indexOf(search);
|
|
299
|
+
return { value: idx === -1 ? string : string.slice(idx + search.length) };
|
|
300
|
+
}
|
|
301
|
+
case "after_last": {
|
|
302
|
+
const { string, search } = o;
|
|
303
|
+
if (!string || !search)
|
|
304
|
+
throw new Error("String and search are required");
|
|
305
|
+
const idx = string.lastIndexOf(search);
|
|
306
|
+
return { value: idx === -1 ? string : string.slice(idx + search.length) };
|
|
307
|
+
}
|
|
308
|
+
case "before": {
|
|
309
|
+
const { string, search } = o;
|
|
310
|
+
if (!string || !search)
|
|
311
|
+
throw new Error("String and search are required");
|
|
312
|
+
const idx = string.indexOf(search);
|
|
313
|
+
return { value: idx === -1 ? string : string.slice(0, idx) };
|
|
314
|
+
}
|
|
315
|
+
case "before_last": {
|
|
316
|
+
const { string, search } = o;
|
|
317
|
+
if (!string || !search)
|
|
318
|
+
throw new Error("String and search are required");
|
|
319
|
+
const idx = string.lastIndexOf(search);
|
|
320
|
+
return { value: idx === -1 ? string : string.slice(0, idx) };
|
|
321
|
+
}
|
|
322
|
+
case "between": {
|
|
323
|
+
const { string, from, to } = o;
|
|
324
|
+
if (!string || !from || !to)
|
|
325
|
+
throw new Error("String, from, and to are required");
|
|
326
|
+
const start = string.indexOf(from);
|
|
327
|
+
const end = string.lastIndexOf(to);
|
|
328
|
+
if (start === -1 || end === -1 || end <= start)
|
|
329
|
+
return { value: string };
|
|
330
|
+
return { value: string.slice(start + from.length, end) };
|
|
331
|
+
}
|
|
332
|
+
case "between_first": {
|
|
333
|
+
const { string, from, to } = o;
|
|
334
|
+
if (!string || !from || !to)
|
|
335
|
+
throw new Error("String, from, and to are required");
|
|
336
|
+
const start = string.indexOf(from);
|
|
337
|
+
if (start === -1)
|
|
338
|
+
return { value: string };
|
|
339
|
+
const end = string.indexOf(to, start + from.length);
|
|
340
|
+
if (end === -1)
|
|
341
|
+
return { value: string };
|
|
342
|
+
return { value: string.slice(start + from.length, end) };
|
|
343
|
+
}
|
|
344
|
+
case "camel": {
|
|
345
|
+
const { string } = o;
|
|
346
|
+
if (!string)
|
|
347
|
+
throw new Error("String is required");
|
|
348
|
+
const s = string.replace(/[-_\s]+(.)/g, (_, c) => c.toUpperCase());
|
|
349
|
+
return { value: s.charAt(0).toLowerCase() + s.slice(1) };
|
|
350
|
+
}
|
|
351
|
+
case "char_at": {
|
|
352
|
+
const { string, index } = o;
|
|
353
|
+
if (!string || index === undefined)
|
|
354
|
+
throw new Error("String and index are required");
|
|
355
|
+
return { value: string.charAt(index) };
|
|
356
|
+
}
|
|
357
|
+
case "chop_start": {
|
|
358
|
+
const { string, needle } = o;
|
|
359
|
+
if (string === undefined || !needle)
|
|
360
|
+
throw new Error("String and needle are required");
|
|
361
|
+
return { value: string.startsWith(needle) ? string.slice(needle.length) : string };
|
|
362
|
+
}
|
|
363
|
+
case "chop_end": {
|
|
364
|
+
const { string, needle } = o;
|
|
365
|
+
if (string === undefined || !needle)
|
|
366
|
+
throw new Error("String and needle are required");
|
|
367
|
+
return { value: string.endsWith(needle) ? string.slice(0, -needle.length) : string };
|
|
368
|
+
}
|
|
369
|
+
case "contains_all": {
|
|
370
|
+
const { string, needles, case_sensitive = true } = o;
|
|
371
|
+
if (!string || !Array.isArray(needles))
|
|
372
|
+
throw new Error("String and needles array are required");
|
|
373
|
+
const s = case_sensitive ? string : string.toLowerCase();
|
|
374
|
+
return { value: needles.every((n) => s.includes(case_sensitive ? n : n.toLowerCase())) };
|
|
375
|
+
}
|
|
376
|
+
case "doesnt_contain": {
|
|
377
|
+
const { string, search, case_sensitive = true } = o;
|
|
378
|
+
if (!string || search === undefined)
|
|
379
|
+
throw new Error("String and search are required");
|
|
380
|
+
const s = case_sensitive ? string : string.toLowerCase();
|
|
381
|
+
const q = case_sensitive ? search : search.toLowerCase();
|
|
382
|
+
return { value: !s.includes(q) };
|
|
383
|
+
}
|
|
384
|
+
case "doesnt_start_with": {
|
|
385
|
+
const { string, prefix, case_sensitive = true } = o;
|
|
386
|
+
if (!string || prefix === undefined)
|
|
387
|
+
throw new Error("String and prefix are required");
|
|
388
|
+
const s = case_sensitive ? string : string.toLowerCase();
|
|
389
|
+
const p = case_sensitive ? prefix : prefix.toLowerCase();
|
|
390
|
+
return { value: !s.startsWith(p) };
|
|
391
|
+
}
|
|
392
|
+
case "doesnt_end_with": {
|
|
393
|
+
const { string, suffix, case_sensitive = true } = o;
|
|
394
|
+
if (!string || suffix === undefined)
|
|
395
|
+
throw new Error("String and suffix are required");
|
|
396
|
+
const s = case_sensitive ? string : string.toLowerCase();
|
|
397
|
+
const p = case_sensitive ? suffix : suffix.toLowerCase();
|
|
398
|
+
return { value: !s.endsWith(p) };
|
|
399
|
+
}
|
|
400
|
+
case "deduplicate": {
|
|
401
|
+
const { string, character = " " } = o;
|
|
402
|
+
if (string === undefined || string === null)
|
|
403
|
+
throw new Error("String is required");
|
|
404
|
+
const esc = escapeRegex(character);
|
|
405
|
+
return { value: string.replace(new RegExp(`${esc}{2,}`, "g"), character) };
|
|
406
|
+
}
|
|
407
|
+
case "excerpt": {
|
|
408
|
+
const { string, phrase, radius = 100, omission = "..." } = o;
|
|
409
|
+
if (!string || !phrase)
|
|
410
|
+
throw new Error("String and phrase are required");
|
|
411
|
+
const idx = string.toLowerCase().indexOf(phrase.toLowerCase());
|
|
412
|
+
if (idx === -1)
|
|
413
|
+
return { value: string.length > radius * 2 ? omission + string.slice(0, radius) + omission : string };
|
|
414
|
+
const start = Math.max(0, idx - radius);
|
|
415
|
+
const end = Math.min(string.length, idx + phrase.length + radius);
|
|
416
|
+
const pre = start > 0 ? omission : "";
|
|
417
|
+
const post = end < string.length ? omission : "";
|
|
418
|
+
return { value: pre + string.slice(start, end) + post };
|
|
419
|
+
}
|
|
420
|
+
case "finish": {
|
|
421
|
+
const { string, cap } = o;
|
|
422
|
+
if (string === undefined || !cap)
|
|
423
|
+
throw new Error("String and cap are required");
|
|
424
|
+
return { value: string.endsWith(cap) ? string : string + cap };
|
|
425
|
+
}
|
|
426
|
+
case "start": {
|
|
427
|
+
const { string, prefix } = o;
|
|
428
|
+
if (string === undefined || !prefix)
|
|
429
|
+
throw new Error("String and prefix are required");
|
|
430
|
+
return { value: string.startsWith(prefix) ? string : prefix + string };
|
|
431
|
+
}
|
|
432
|
+
case "headline": {
|
|
433
|
+
const { string } = o;
|
|
434
|
+
if (!string)
|
|
435
|
+
throw new Error("String is required");
|
|
436
|
+
const words = string.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[-_]+/g, " ").trim().split(/\s+/);
|
|
437
|
+
return { value: words.map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()).join(" ") };
|
|
438
|
+
}
|
|
439
|
+
case "is": {
|
|
440
|
+
const { string, pattern } = o;
|
|
441
|
+
if (!string || !pattern)
|
|
442
|
+
throw new Error("String and pattern are required");
|
|
443
|
+
const regex = new RegExp("^" + escapeRegex(pattern).replace(/\\\*/g, ".*") + "$");
|
|
444
|
+
return { value: regex.test(string) };
|
|
445
|
+
}
|
|
446
|
+
case "is_ascii":
|
|
447
|
+
if (o.string === undefined || o.string === null)
|
|
448
|
+
throw new Error("String is required");
|
|
449
|
+
return { value: /^[\x00-\x7F]*$/.test(o.string) };
|
|
450
|
+
case "is_json":
|
|
451
|
+
if (o.string === undefined || o.string === null)
|
|
452
|
+
throw new Error("String is required");
|
|
453
|
+
try {
|
|
454
|
+
JSON.parse(o.string);
|
|
455
|
+
return { value: true };
|
|
456
|
+
}
|
|
457
|
+
catch {
|
|
458
|
+
return { value: false };
|
|
459
|
+
}
|
|
460
|
+
case "is_ulid":
|
|
461
|
+
if (o.string === undefined || o.string === null)
|
|
462
|
+
throw new Error("String is required");
|
|
463
|
+
return { value: /^[0-9A-Z]{26}$/i.test(o.string) };
|
|
464
|
+
case "is_url": {
|
|
465
|
+
const { string, protocols = ["http", "https"] } = o;
|
|
466
|
+
if (!string)
|
|
467
|
+
throw new Error("String is required");
|
|
468
|
+
try {
|
|
469
|
+
const u = new URL(string);
|
|
470
|
+
const proto = u.protocol.replace(":", "");
|
|
471
|
+
return { value: protocols.includes(proto) };
|
|
472
|
+
}
|
|
473
|
+
catch {
|
|
474
|
+
return { value: false };
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
case "is_uuid":
|
|
478
|
+
if (o.string === undefined || o.string === null)
|
|
479
|
+
throw new Error("String is required");
|
|
480
|
+
return { value: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(o.string) };
|
|
481
|
+
case "is_empty":
|
|
482
|
+
if (o.string === undefined || o.string === null)
|
|
483
|
+
return { value: true };
|
|
484
|
+
return { value: str(o.string).trim().length === 0 };
|
|
485
|
+
case "is_match": {
|
|
486
|
+
const { string, pattern, flags = "" } = o;
|
|
487
|
+
if (string === undefined || !pattern)
|
|
488
|
+
throw new Error("String and pattern are required");
|
|
489
|
+
return { value: new RegExp(pattern, flags).test(string) };
|
|
490
|
+
}
|
|
491
|
+
case "kebab": {
|
|
492
|
+
const { string } = o;
|
|
493
|
+
if (!string)
|
|
494
|
+
throw new Error("String is required");
|
|
495
|
+
return { value: string.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase() };
|
|
496
|
+
}
|
|
497
|
+
case "snake": {
|
|
498
|
+
const { string, delimiter = "_" } = o;
|
|
499
|
+
if (!string)
|
|
500
|
+
throw new Error("String is required");
|
|
501
|
+
return { value: string.replace(/([a-z])([A-Z])/g, `$1${delimiter}$2`).replace(/[\s-]+/g, delimiter).toLowerCase() };
|
|
502
|
+
}
|
|
503
|
+
case "studly": {
|
|
504
|
+
const { string } = o;
|
|
505
|
+
if (!string)
|
|
506
|
+
throw new Error("String is required");
|
|
507
|
+
const s = string.replace(/[-_\s]+(.)/g, (_, c) => c.toUpperCase());
|
|
508
|
+
return { value: s.replace(/^(.)/, (c) => c.toUpperCase()) };
|
|
509
|
+
}
|
|
510
|
+
case "title":
|
|
511
|
+
if (!o.string)
|
|
512
|
+
throw new Error("String is required");
|
|
513
|
+
return { value: o.string.replace(/\w\S*/g, (w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()) };
|
|
514
|
+
case "lcfirst":
|
|
515
|
+
if (!o.string)
|
|
516
|
+
throw new Error("String is required");
|
|
517
|
+
return { value: o.string.charAt(0).toLowerCase() + o.string.slice(1) };
|
|
518
|
+
case "ucfirst":
|
|
519
|
+
if (!o.string)
|
|
520
|
+
throw new Error("String is required");
|
|
521
|
+
return { value: o.string.charAt(0).toUpperCase() + o.string.slice(1) };
|
|
522
|
+
case "ucwords": {
|
|
523
|
+
const { string, separators = " " } = o;
|
|
524
|
+
if (!string)
|
|
525
|
+
throw new Error("String is required");
|
|
526
|
+
const sepRe = new RegExp(`([${escapeRegex(separators)}])`, "g");
|
|
527
|
+
return { value: string.split(sepRe).map((part) => separators.includes(part) ? part : part.charAt(0).toUpperCase() + part.slice(1)).join("") };
|
|
528
|
+
}
|
|
529
|
+
case "ucsplit": {
|
|
530
|
+
const { string } = o;
|
|
531
|
+
if (!string)
|
|
532
|
+
throw new Error("String is required");
|
|
533
|
+
return { value: string.replace(/([A-Z])/g, " $1").trim().split(/\s+/) };
|
|
534
|
+
}
|
|
535
|
+
case "limit": {
|
|
536
|
+
const { string, limit: lim = 100, end = "..." } = o;
|
|
537
|
+
if (string === undefined || string === null)
|
|
538
|
+
throw new Error("String is required");
|
|
539
|
+
if (string.length <= lim)
|
|
540
|
+
return { value: string };
|
|
541
|
+
return { value: string.slice(0, lim) + end };
|
|
542
|
+
}
|
|
543
|
+
case "mask": {
|
|
544
|
+
const { string, character = "*", index, length } = o;
|
|
545
|
+
if (!string || index === undefined)
|
|
546
|
+
throw new Error("String and index are required");
|
|
547
|
+
const len = string.length;
|
|
548
|
+
const start = index < 0 ? Math.max(0, len + index) : Math.min(index, len);
|
|
549
|
+
const maskLen = length !== undefined
|
|
550
|
+
? (length < 0 ? Math.max(0, len + length - start) : Math.min(length, len - start))
|
|
551
|
+
: len - start;
|
|
552
|
+
return { value: string.slice(0, start) + character.repeat(maskLen) + string.slice(start + maskLen) };
|
|
553
|
+
}
|
|
554
|
+
case "match": {
|
|
555
|
+
const { string, pattern, flags = "" } = o;
|
|
556
|
+
if (!string || !pattern)
|
|
557
|
+
throw new Error("String and pattern are required");
|
|
558
|
+
const m = string.match(new RegExp(pattern, flags));
|
|
559
|
+
return { value: m ? (m[1] ?? m[0]) : null };
|
|
560
|
+
}
|
|
561
|
+
case "match_all": {
|
|
562
|
+
const { string, pattern, flags = "g" } = o;
|
|
563
|
+
if (!string || !pattern)
|
|
564
|
+
throw new Error("String and pattern are required");
|
|
565
|
+
const re = new RegExp(pattern, flags.includes("g") ? flags : flags + "g");
|
|
566
|
+
const results = [];
|
|
567
|
+
let m;
|
|
568
|
+
while ((m = re.exec(string)) !== null)
|
|
569
|
+
results.push(m[1] ?? m[0]);
|
|
570
|
+
return { value: results };
|
|
571
|
+
}
|
|
572
|
+
case "pad_both": {
|
|
573
|
+
const { string, length, pad_string = " " } = o;
|
|
574
|
+
if (string === undefined || length === undefined)
|
|
575
|
+
throw new Error("String and length are required");
|
|
576
|
+
const totalPad = Math.max(0, length - string.length);
|
|
577
|
+
const leftPad = Math.floor(totalPad / 2);
|
|
578
|
+
const rightPad = totalPad - leftPad;
|
|
579
|
+
const pad = (n) => pad_string.repeat(Math.ceil(n / pad_string.length)).slice(0, n);
|
|
580
|
+
return { value: pad(leftPad) + string + pad(rightPad) };
|
|
581
|
+
}
|
|
582
|
+
case "plural": {
|
|
583
|
+
const { string, count = 2 } = o;
|
|
584
|
+
if (!string)
|
|
585
|
+
throw new Error("String is required");
|
|
586
|
+
return { value: pluralise(string, count) };
|
|
587
|
+
}
|
|
588
|
+
case "singular": {
|
|
589
|
+
const { string } = o;
|
|
590
|
+
if (!string)
|
|
591
|
+
throw new Error("String is required");
|
|
592
|
+
return { value: singularise(string) };
|
|
593
|
+
}
|
|
594
|
+
case "position": {
|
|
595
|
+
const { string, search, offset = 0, case_sensitive = true } = o;
|
|
596
|
+
if (!string || !search)
|
|
597
|
+
throw new Error("String and search are required");
|
|
598
|
+
const s = case_sensitive ? string : string.toLowerCase();
|
|
599
|
+
const q = case_sensitive ? search : search.toLowerCase();
|
|
600
|
+
const idx = s.indexOf(q, offset);
|
|
601
|
+
return { value: idx === -1 ? null : idx };
|
|
602
|
+
}
|
|
603
|
+
case "random": {
|
|
604
|
+
const { length = 16, charset = "alphanumeric" } = o;
|
|
605
|
+
const chars = {
|
|
606
|
+
alphanumeric: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
|
|
607
|
+
alpha: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
608
|
+
numeric: "0123456789",
|
|
609
|
+
hex: "0123456789abcdef",
|
|
610
|
+
lowercase: "abcdefghijklmnopqrstuvwxyz",
|
|
611
|
+
uppercase: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
|
612
|
+
};
|
|
613
|
+
const pool = chars[charset] ?? chars.alphanumeric;
|
|
614
|
+
const bytes = (0, crypto_1.randomBytes)(length);
|
|
615
|
+
return { value: Array.from(bytes).map((b) => pool[b % pool.length]).join("") };
|
|
616
|
+
}
|
|
617
|
+
case "remove": {
|
|
618
|
+
const { string, search, case_sensitive = true } = o;
|
|
619
|
+
if (string === undefined || search === undefined)
|
|
620
|
+
throw new Error("String and search are required");
|
|
621
|
+
const needles = Array.isArray(search) ? search : [search];
|
|
622
|
+
let result = string;
|
|
623
|
+
for (const needle of needles) {
|
|
624
|
+
const flags = case_sensitive ? "g" : "gi";
|
|
625
|
+
result = result.replace(new RegExp(escapeRegex(needle), flags), "");
|
|
626
|
+
}
|
|
627
|
+
return { value: result };
|
|
628
|
+
}
|
|
629
|
+
case "repeat": {
|
|
630
|
+
const { string, times } = o;
|
|
631
|
+
if (string === undefined || times === undefined)
|
|
632
|
+
throw new Error("String and times are required");
|
|
633
|
+
return { value: string.repeat(times) };
|
|
634
|
+
}
|
|
635
|
+
case "replace_array": {
|
|
636
|
+
const { string, search, replace: values } = o;
|
|
637
|
+
if (!string || !search || !Array.isArray(values))
|
|
638
|
+
throw new Error("String, search, and replace array are required");
|
|
639
|
+
let i = 0;
|
|
640
|
+
return { value: string.replace(new RegExp(escapeRegex(search), "g"), () => str(values[i++] ?? "")) };
|
|
641
|
+
}
|
|
642
|
+
case "replace_first": {
|
|
643
|
+
const { string, search, replace: replaceWith } = o;
|
|
644
|
+
if (!string || search === undefined || replaceWith === undefined)
|
|
645
|
+
throw new Error("String, search, and replace are required");
|
|
646
|
+
return { value: string.replace(search, replaceWith) };
|
|
647
|
+
}
|
|
648
|
+
case "replace_last": {
|
|
649
|
+
const { string, search, replace: replaceWith } = o;
|
|
650
|
+
if (!string || search === undefined || replaceWith === undefined)
|
|
651
|
+
throw new Error("String, search, and replace are required");
|
|
652
|
+
const idx = string.lastIndexOf(search);
|
|
653
|
+
if (idx === -1)
|
|
654
|
+
return { value: string };
|
|
655
|
+
return { value: string.slice(0, idx) + replaceWith + string.slice(idx + search.length) };
|
|
656
|
+
}
|
|
657
|
+
case "replace_matches": {
|
|
658
|
+
const { string, pattern, replace: replaceWith, flags = "g" } = o;
|
|
659
|
+
if (!string || !pattern || replaceWith === undefined)
|
|
660
|
+
throw new Error("String, pattern, and replace are required");
|
|
661
|
+
return { value: string.replace(new RegExp(pattern, flags), replaceWith) };
|
|
662
|
+
}
|
|
663
|
+
case "replace_start": {
|
|
664
|
+
const { string, search, replace: replaceWith } = o;
|
|
665
|
+
if (string === undefined || search === undefined || replaceWith === undefined)
|
|
666
|
+
throw new Error("String, search, and replace are required");
|
|
667
|
+
return { value: string.startsWith(search) ? replaceWith + string.slice(search.length) : string };
|
|
668
|
+
}
|
|
669
|
+
case "replace_end": {
|
|
670
|
+
const { string, search, replace: replaceWith } = o;
|
|
671
|
+
if (string === undefined || search === undefined || replaceWith === undefined)
|
|
672
|
+
throw new Error("String, search, and replace are required");
|
|
673
|
+
return { value: string.endsWith(search) ? string.slice(0, -search.length) + replaceWith : string };
|
|
674
|
+
}
|
|
675
|
+
case "squish":
|
|
676
|
+
if (o.string === undefined || o.string === null)
|
|
677
|
+
throw new Error("String is required");
|
|
678
|
+
return { value: o.string.trim().replace(/\s+/g, " ") };
|
|
679
|
+
case "substr": {
|
|
680
|
+
const { string, start, length } = o;
|
|
681
|
+
if (!string || start === undefined)
|
|
682
|
+
throw new Error("String and start are required");
|
|
683
|
+
const s = string;
|
|
684
|
+
const from = start < 0 ? Math.max(0, s.length + start) : start;
|
|
685
|
+
return { value: length !== undefined ? s.slice(from, from + length) : s.slice(from) };
|
|
686
|
+
}
|
|
687
|
+
case "substr_count": {
|
|
688
|
+
const { string, needle, case_sensitive = true } = o;
|
|
689
|
+
if (!string || !needle)
|
|
690
|
+
throw new Error("String and needle are required");
|
|
691
|
+
const s = case_sensitive ? string : string.toLowerCase();
|
|
692
|
+
const n = case_sensitive ? needle : needle.toLowerCase();
|
|
693
|
+
let count = 0, pos = 0;
|
|
694
|
+
while ((pos = s.indexOf(n, pos)) !== -1) {
|
|
695
|
+
count++;
|
|
696
|
+
pos += n.length;
|
|
697
|
+
}
|
|
698
|
+
return { value: count };
|
|
699
|
+
}
|
|
700
|
+
case "substr_replace": {
|
|
701
|
+
const { string, replace: replaceWith, offset, length } = o;
|
|
702
|
+
if (!string || replaceWith === undefined || offset === undefined)
|
|
703
|
+
throw new Error("String, replace, and offset are required");
|
|
704
|
+
const s = string;
|
|
705
|
+
const from = offset < 0 ? Math.max(0, s.length + offset) : offset;
|
|
706
|
+
const end = length !== undefined ? from + length : s.length;
|
|
707
|
+
return { value: s.slice(0, from) + replaceWith + s.slice(end) };
|
|
708
|
+
}
|
|
709
|
+
case "swap": {
|
|
710
|
+
const { string, map } = o;
|
|
711
|
+
if (!string || !map)
|
|
712
|
+
throw new Error("String and map are required");
|
|
713
|
+
const keys = Object.keys(map).sort((a, b) => b.length - a.length);
|
|
714
|
+
const pattern = keys.map(escapeRegex).join("|");
|
|
715
|
+
if (!pattern)
|
|
716
|
+
return { value: string };
|
|
717
|
+
return { value: string.replace(new RegExp(pattern, "g"), (match) => str(map[match])) };
|
|
718
|
+
}
|
|
719
|
+
case "take": {
|
|
720
|
+
const { string, count } = o;
|
|
721
|
+
if (string === undefined || count === undefined)
|
|
722
|
+
throw new Error("String and count are required");
|
|
723
|
+
return { value: count >= 0 ? string.slice(0, count) : string.slice(count) };
|
|
724
|
+
}
|
|
725
|
+
case "word_count":
|
|
726
|
+
if (o.string === undefined || o.string === null)
|
|
727
|
+
throw new Error("String is required");
|
|
728
|
+
const trimmed = o.string.trim();
|
|
729
|
+
return { value: trimmed === "" ? 0 : trimmed.split(/\s+/).length };
|
|
730
|
+
case "word_wrap": {
|
|
731
|
+
const { string, characters = 75, break: breakChar = "\n", cut_long_words = false } = o;
|
|
732
|
+
if (!string)
|
|
733
|
+
throw new Error("String is required");
|
|
734
|
+
return { value: wordWrap(string, characters, breakChar, cut_long_words) };
|
|
735
|
+
}
|
|
736
|
+
case "words": {
|
|
737
|
+
const { string, words: limit = 100, end = "..." } = o;
|
|
738
|
+
if (!string)
|
|
739
|
+
throw new Error("String is required");
|
|
740
|
+
const parts = string.trim().split(/\s+/);
|
|
741
|
+
if (parts.length <= limit)
|
|
742
|
+
return { value: string };
|
|
743
|
+
return { value: parts.slice(0, limit).join(" ") + end };
|
|
744
|
+
}
|
|
745
|
+
case "wrap": {
|
|
746
|
+
const { string, before, after } = o;
|
|
747
|
+
if (string === undefined || !before)
|
|
748
|
+
throw new Error("String and before are required");
|
|
749
|
+
return { value: before + string + (after ?? before) };
|
|
750
|
+
}
|
|
751
|
+
case "unwrap": {
|
|
752
|
+
const { string, before, after } = o;
|
|
753
|
+
if (string === undefined || !before)
|
|
754
|
+
throw new Error("String and before are required");
|
|
755
|
+
const suf = after ?? before;
|
|
756
|
+
let result = string;
|
|
757
|
+
if (result.startsWith(before))
|
|
758
|
+
result = result.slice(before.length);
|
|
759
|
+
if (result.endsWith(suf))
|
|
760
|
+
result = result.slice(0, -suf.length);
|
|
761
|
+
return { value: result };
|
|
762
|
+
}
|
|
763
|
+
case "uuid": {
|
|
764
|
+
const bytes = (0, crypto_1.randomBytes)(16);
|
|
765
|
+
bytes[6] = (bytes[6] & 0x0f) | 0x40;
|
|
766
|
+
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
767
|
+
const hex = bytes.toString("hex");
|
|
768
|
+
return { value: `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}` };
|
|
769
|
+
}
|
|
770
|
+
case "ulid": {
|
|
771
|
+
const ENCODING = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
772
|
+
const ts = Date.now();
|
|
773
|
+
const rand = (0, crypto_1.randomBytes)(10);
|
|
774
|
+
let result = "";
|
|
775
|
+
let t = ts;
|
|
776
|
+
for (let i = 9; i >= 0; i--) {
|
|
777
|
+
result = ENCODING[t % 32] + result;
|
|
778
|
+
t = Math.floor(t / 32);
|
|
779
|
+
}
|
|
780
|
+
let rVal = BigInt("0x" + rand.toString("hex"));
|
|
781
|
+
let rStr = "";
|
|
782
|
+
for (let i = 15; i >= 0; i--) {
|
|
783
|
+
rStr = ENCODING[Number(rVal % 32n)] + rStr;
|
|
784
|
+
rVal /= 32n;
|
|
785
|
+
}
|
|
786
|
+
return { value: result + rStr };
|
|
787
|
+
}
|
|
788
|
+
case "strip_tags": {
|
|
789
|
+
const { string, allowed_tags = "" } = o;
|
|
790
|
+
if (string === undefined || string === null)
|
|
791
|
+
throw new Error("String is required");
|
|
792
|
+
if (!allowed_tags)
|
|
793
|
+
return { value: string.replace(/<[^>]*>/g, "") };
|
|
794
|
+
const allowed = allowed_tags.split(",").map((t) => t.trim().toLowerCase());
|
|
795
|
+
return { value: string.replace(/<\/?([a-zA-Z][a-zA-Z0-9]*)[^>]*>/g, (match, tag) => allowed.includes(tag.toLowerCase()) ? match : "") };
|
|
796
|
+
}
|
|
797
|
+
case "ascii":
|
|
798
|
+
if (!o.string)
|
|
799
|
+
throw new Error("String is required");
|
|
800
|
+
return { value: transliterate(o.string).replace(/[^\x00-\x7F]/g, "") };
|
|
801
|
+
case "apa": {
|
|
802
|
+
const { string } = o;
|
|
803
|
+
if (!string)
|
|
804
|
+
throw new Error("String is required");
|
|
805
|
+
const words = string.trim().split(/\s+/);
|
|
806
|
+
return { value: words.map((w, i) => {
|
|
807
|
+
const low = w.toLowerCase();
|
|
808
|
+
return (i === 0 || !APA_SMALL.has(low))
|
|
809
|
+
? w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()
|
|
810
|
+
: low;
|
|
811
|
+
}).join(" ") };
|
|
812
|
+
}
|
|
813
|
+
case "class_basename": {
|
|
814
|
+
const { class_name, delimiter = "\\" } = o;
|
|
815
|
+
if (!class_name)
|
|
816
|
+
throw new Error("class_name is required");
|
|
817
|
+
const parts = class_name.split(delimiter);
|
|
818
|
+
return { value: parts[parts.length - 1] };
|
|
819
|
+
}
|
|
820
|
+
default: {
|
|
821
|
+
const val = o.value ?? o.string ?? "";
|
|
822
|
+
return { value: String(val) };
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
}
|