"use strict";function toBase64(e){if("undefined"!=typeof Buffer)return Buffer.from(e).toString("base64");const r=String.fromCharCode(...e);return btoa(r)}function fromBase64(e){if("undefined"!=typeof Buffer)return new Uint8Array(Buffer.from(e,"base64"));const r=atob(e),t=new Uint8Array(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}function toBase64Url(e){return toBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function fromBase64Url(e){let r=e.replace(/-/g,"+").replace(/_/g,"/");for(;r.length%4;)r+="=";return fromBase64(r)}function generateUUID(){if("undefined"!=typeof crypto&&crypto.randomUUID)return crypto.randomUUID();const e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=15&e[6]|64,e[8]=63&e[8]|128;const r=Array.from(e).map(e=>e.toString(16).padStart(2,"0")).join("");return`${r.substring(0,8)}-${r.substring(8,12)}-${r.substring(12,16)}-${r.substring(16,20)}-${r.substring(20)}`}Object.defineProperty(exports,"__esModule",{value:!0}),exports.verifyHMAC=exports.generateHMAC=exports.pkcs7Unpad=exports.pkcs7Pad=exports.nextOddPrime=exports.reconstructXorIDA=exports.splitXorIDA=void 0,exports.toBase64=toBase64,exports.fromBase64=fromBase64,exports.toBase64Url=toBase64Url,exports.fromBase64Url=fromBase64Url,exports.generateUUID=generateUUID,exports.formatShareHeader=formatShareHeader,exports.parseShareHeader=parseShareHeader,exports.hasShareHeader=hasShareHeader;const START_MARKER="Encrypted://",END_MARKER="=> Generated by Xecret (TM)",BRAND_PREFIX="Xecret (TM) -> PRIVATE .ME (R) -> IDA5 -> ";function formatShareHeader(e){return`${BRAND_PREFIX}${START_MARKER} ${e} ${END_MARKER}`}function parseShareHeader(e){const r=e.indexOf(START_MARKER);if(r<0)return e.trim();const t=r+START_MARKER.length,n=e.indexOf(END_MARKER,t);return n<0?e.trim():e.substring(t,n).trim()}function hasShareHeader(e){return e.includes(START_MARKER)&&e.includes(END_MARKER)}const index_js_1=require("./_deps/crypto/index.js");exports.splitXorIDA=index_js_1.splitXorIDA,exports.reconstructXorIDA=index_js_1.reconstructXorIDA,exports.nextOddPrime=index_js_1.nextOddPrime,exports.pkcs7Pad=index_js_1.pkcs7Pad,exports.pkcs7Unpad=index_js_1.pkcs7Unpad,exports.generateHMAC=index_js_1.generateHMAC,exports.verifyHMAC=index_js_1.verifyHMAC;