{"version":3,"file":"crypto.mjs","sources":["../../../../../src/axios/types/crypto.ts"],"sourcesContent":["import type { FastAxiosRequestConfig } from \"./options\";\nimport type { AxiosResponse, InternalAxiosRequestConfig } from \"axios\";\n\ntype CryptoEncryptHandle = <Input>(config: InternalAxiosRequestConfig<Input>, timestamp: number) => void;\ntype CryptoEncryptUseHandle = { use: (fn: CryptoEncryptHandle) => void };\ntype CryptoDecryptHandle = <Output = any, Input = any>(response: AxiosResponse<Output, Input>, options: FastAxiosRequestConfig<Input>) => any | void;\ntype CryptoDecryptUseHandle = { use: (fn: CryptoDecryptHandle) => void };\n\nexport class CryptoManage {\n\tprivate _handle: {\n\t\tencrypt: CryptoEncryptHandle;\n\t\tdecrypt: CryptoDecryptHandle;\n\t};\n\n\t/** 加密 */\n\treadonly encrypt: CryptoEncryptHandle & CryptoEncryptUseHandle;\n\t/** 解密 */\n\treadonly decrypt: CryptoDecryptHandle & CryptoDecryptUseHandle;\n\n\tconstructor() {\n\t\tthis._handle = {\n\t\t\tencrypt: <Input>(config: InternalAxiosRequestConfig<Input>, timestamp: number): void => {\n\t\t\t\treturn;\n\t\t\t},\n\t\t\tdecrypt: <Output = any, Input = any>(response: AxiosResponse<Output, Input>, options: FastAxiosRequestConfig<Input>): any | void => {\n\t\t\t\treturn null;\n\t\t\t},\n\t\t};\n\n\t\tconst encryptProxy: CryptoEncryptHandle & CryptoEncryptUseHandle = <Input>(\n\t\t\tconfig: InternalAxiosRequestConfig<Input>,\n\t\t\ttimestamp: number\n\t\t): void => {\n\t\t\tthis._handle.encrypt<Input>(config, timestamp);\n\t\t};\n\t\tencryptProxy.use = (fn: CryptoEncryptHandle): void => {\n\t\t\tthis._handle.encrypt = fn;\n\t\t};\n\t\tthis.encrypt = encryptProxy;\n\n\t\tconst decryptProxy: CryptoDecryptHandle & CryptoDecryptUseHandle = <Output = any, Input = any>(\n\t\t\tresponse: AxiosResponse<Output, Input>,\n\t\t\toptions: FastAxiosRequestConfig<Input>\n\t\t): any | void => {\n\t\t\treturn this._handle.decrypt<Output, Input>(response, options);\n\t\t};\n\t\tdecryptProxy.use = (fn: CryptoDecryptHandle): void => {\n\t\t\tthis._handle.decrypt = fn;\n\t\t};\n\t\tthis.decrypt = decryptProxy;\n\t}\n}\n"],"names":["CryptoManage","_handle","encrypt","decrypt","constructor","this","config","timestamp","response","options","encryptProxy","use","fn","decryptProxy"],"mappings":"AAQO,MAAMA,EACJC,QAMCC,QAEAC,QAET,WAAAC,GACCC,KAAKJ,QAAU,CACdC,QAAS,CAAQI,EAA2CC,OAG5DJ,QAAS,CAA4BK,EAAwCC,IACrE,MAIT,MAAMC,EAA6D,CAClEJ,EACAC,KAEAF,KAAKJ,QAAQC,QAAeI,EAAQC,IAErCG,EAAaC,IAAOC,IACnBP,KAAKJ,QAAQC,QAAUU,GAExBP,KAAKH,QAAUQ,EAEf,MAAMG,EAA6D,CAClEL,EACAC,IAEOJ,KAAKJ,QAAQE,QAAuBK,EAAUC,GAEtDI,EAAaF,IAAOC,IACnBP,KAAKJ,QAAQE,QAAUS,GAExBP,KAAKF,QAAUU,CAChB"}