"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.BaseSMSProvider=void 0;const console_1=require("@b/utils/console");class BaseSMSProvider{constructor(e,r){this.name=e;this.config=r||this.loadConfigFromEnv()}validatePhoneNumber(e){return/^\+[1-9]\d{1,14}$/.test(e)}formatPhoneNumber(e,r="+1"){let o=e.replace(/[^\d+]/g,"");o.startsWith("+")||(o=r+o);return o}truncateMessage(e,r=160){return e.length<=r?e:e.substring(0,r-3)+"..."}calculateSMSParts(e){return e.length<=160?1:Math.ceil(e.length/153)}formatEmail(e,r){return`${e}@${r}`}log(e,r){void 0!==r?console_1.logger.info(`SMS:${this.name}`,e,r):console_1.logger.info(`SMS:${this.name}`,e)}logError(e,r){console_1.logger.error(`SMS:${this.name}`,e,r instanceof Error?r:new Error(JSON.stringify(r)))}}exports.BaseSMSProvider=BaseSMSProvider;