doipjs/dist/doip.core.min.js

21 lines
176 KiB
JavaScript
Raw Normal View History

2023-10-09 08:28:23 -06:00
var doip=function(e,t,r){"use strict";function i(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var A=i(doipFetchers);const o={ADAPTIVE:"adaptive",ALWAYS:"always",NEVER:"never"},n={ACTIVITYPUB:"activitypub",DNS:"dns",GRAPHQL:"graphql",HTTP:"http",IRC:"irc",MATRIX:"matrix",TELEGRAM:"telegram",XMPP:"xmpp"},a={PLAIN:"plain",HTML:"html",XML:"xml"},s={NONE:"none",NOCORS:"nocors",GRANTED:"granted",SERVER:"server"},c={JSON:"json",TEXT:"text"},g={URI:"uri",FINGERPRINT:"fingerprint"},I={CONTAINS:"contains",EQUALS:"equals",ONEOF:"oneof"},h={INIT:100,MATCHED:101,VERIFIED:200,VERIFIED_VIA_PROXY:201,MATCHING_ERROR:300,NO_MATCHES:301,VERIFICATION_ERROR:400,NO_PROOF_FOUND:401},l={ASP:"asp",OPENPGP:"openpgp"},u={EDDSA:"eddsa",ES256:"es256",OPENPGP:"openpgp",UNKNOWN:"unknown",NONE:"none"},p={PEM:"pem",JWK:"jwk",ARMORED_PGP:"armored_pgp",NONE:"none"},f={ASPE:"aspe",HKP:"hkp",WKD:"wkd",HTTP:"http",NONE:"none"};var B=Object.freeze({__proto__:null,ClaimFormat:g,ClaimRelation:I,ClaimStatus:h,EntityEncodingFormat:a,Fetcher:n,ProfileType:l,ProofAccessRestriction:s,ProofFormat:c,ProxyPolicy:o,PublicKeyEncoding:p,PublicKeyFetchMethod:f,PublicKeyType:u}),d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function C(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function E(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){if(this instanceof e){var r=[null];return r.push.apply(r,arguments),new(Function.bind.apply(t,r))}return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})})),r}var Q={},w={exports:{}};!function(e,t){function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t="string"==typeof e||e instanceof String;if(!t){var i=r(e);throw null===e?i="null":"object"===i&&(i=e.constructor.name),new TypeError("Expected a string but received a ".concat(i))}},e.exports=t.default,e.exports.default=t.default}(w,w.exports);var m=w.exports,y={};Object.defineProperty(y,"__esModule",{value:!0}),y.commaDecimal=y.dotDecimal=y.bengaliLocales=y.farsiLocales=y.arabicLocales=y.englishLocales=y.decimal=y.alphanumeric=y.alpha=void 0;var k={"en-US":/^[A-Z]+$/i,"az-AZ":/^[A-VXYZÇƏĞİıÖŞÜ]+$/i,"bg-BG":/^[А-Я]+$/i,"cs-CZ":/^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,"da-DK":/^[A-ZÆØÅ]+$/i,"de-DE":/^[A-ZÄÖÜß]+$/i,"el-GR":/^[Α-ώ]+$/i,"es-ES":/^[A-ZÁÉÍÑÓÚÜ]+$/i,"fa-IR":/^[ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهی]+$/i,"fi-FI":/^[A-ZÅÄÖ]+$/i,"fr-FR":/^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,"it-IT":/^[A-ZÀÉÈÌÎÓÒÙ]+$/i,"ja-JP":/^[ぁ-んァ-ヶヲ-゚一-龠ー・。、]+$/i,"nb-NO":/^[A-ZÆØÅ]+$/i,"nl-NL":/^[A-ZÁÉËÏÓÖÜÚ]+$/i,"nn-NO":/^[A-ZÆØÅ]+$/i,"hu-HU":/^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i,"pl-PL":/^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,"pt-PT":/^[A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,"ru-RU":/^[А-ЯЁ]+$/i,"sl-SI":/^[A-ZČĆĐŠŽ]+$/i,"sk-SK":/^[A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,"sr-RS@latin":/^[A-ZČĆŽŠĐ]+$/i,"sr-RS":/^[А-ЯЂЈЉЊЋЏ]+$/i,"sv-SE":/^[A-ZÅÄÖ]+$/i,"th-TH":/^[ก-\s]+$/i,"tr-TR":/^[A-ZÇĞİıÖŞÜ]+$/i,"uk-UA":/^[АЬЮЯЄIЇҐі]+$/i,"vi-VN":/^[A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,"ko-KR":/^
2023-07-08 00:36:57 -06:00
/*!
2023-07-09 04:05:21 -06:00
* hash-wasm (https://www.npmjs.com/package/hash-wasm)
* (c) Dani Biro
* @license MIT
*/
2023-07-08 00:36:57 -06:00
/*! *****************************************************************************
2023-07-09 04:05:21 -06:00
Copyright (c) Microsoft Corporation.
2023-07-08 00:36:57 -06:00
2023-07-09 04:05:21 -06:00
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
2023-07-08 00:36:57 -06:00
2023-07-09 04:05:21 -06:00
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
2023-10-09 08:28:23 -06:00
***************************************************************************** */function it(e,t,r,i){return new(r||(r=Promise))((function(A,o){function n(e){try{s(i.next(e))}catch(e){o(e)}}function a(e){try{s(i.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?A(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(n,a)}s((i=i.apply(e,t||[])).next())}))}class At{constructor(){this.mutex=Promise.resolve()}lock(){let e=()=>{};return this.mutex=this.mutex.then((()=>new Promise(e))),new Promise((t=>{e=t}))}dispatch(e){return it(this,void 0,void 0,(function*(){const t=yield this.lock();try{return yield Promise.resolve(e())}finally{t()}}))}}const ot="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:ge,nt=null!==(tt=ot.Buffer)&&void 0!==tt?tt:null,at=ot.TextEncoder?new ot.TextEncoder:null;function st(e,t){return(15&e)+(e>>6|e>>3&8)<<4|(15&t)+(t>>6|t>>3&8)}function ct(e,t){const r=t.length>>1;for(let i=0;i<r;i++){const r=i<<1;e[i]=st(t.charCodeAt(r),t.charCodeAt(r+1))}}const gt="a".charCodeAt(0)-10,It="0".charCodeAt(0);function ht(e,t,r){let i=0;for(let A=0;A<r;A++){let r=t[A]>>>4;e[i++]=r>9?r+gt:r+It,r=15&t[A],e[i++]=r>9?r+gt:r+It}return String.fromCharCode.apply(null,e)}const lt=null!==nt?e=>{if("string"==typeof e){const t=nt.from(e,"utf8");return new Uint8Array(t.buffer,t.byteOffset,t.length)}if(nt.isBuffer(e))return new Uint8Array(e.buffer,e.byteOffset,e.length);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Invalid data type!")}:e=>{if("string"==typeof e)return at.encode(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Invalid data type!")},ut="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pt=new Uint8Array(256);for(let e=0;e<ut.length;e++)pt[ut.charCodeAt(e)]=e;function ft(e,t=!0){const r=e.length,i=r%3,A=[],o=r-i;for(let t=0;t<o;t+=3){const r=(e[t]<<16&16711680)+(e[t+1]<<8&65280)+(255&e[t+2]),i=ut.charAt(r>>18&63)+ut.charAt(r>>12&63)+ut.charAt(r>>6&63)+ut.charAt(63&r);A.push(i)}if(1===i){const i=e[r-1],o=ut.charAt(i>>2),n=ut.charAt(i<<4&63);A.push(`${o}${n}`),t&&A.push("==")}else if(2===i){const i=(e[r-2]<<8)+e[r-1],o=ut.charAt(i>>10),n=ut.charAt(i>>4&63),a=ut.charAt(i<<2&63);A.push(`${o}${n}${a}`),t&&A.push("=")}return A.join("")}function Bt(e){let t=Math.floor(.75*e.length);const r=e.length;return"="===e[r-1]&&(t-=1,"="===e[r-2]&&(t-=1)),t}function dt(e){const t=Bt(e),r=e.length,i=new Uint8Array(t);let A=0;for(let t=0;t<r;t+=4){const r=pt[e.charCodeAt(t)],o=pt[e.charCodeAt(t+1)],n=pt[e.charCodeAt(t+2)],a=pt[e.charCodeAt(t+3)];i[A]=r<<2|o>>4,A+=1,i[A]=(15&o)<<4|n>>2,A+=1,i[A]=(3&n)<<6|63&a,A+=1}return i}const Ct=16384,Et=4,Qt=new At,wt=new Map;function mt(e,t){return it(this,void 0,void 0,(function*(){let r=null,i=null,A=!1;if("undefined"==typeof WebAssembly)throw new Error("WebAssembly is not supported in this environment!");const o=()=>new DataView(r.exports.memory.buffer).getUint32(r.exports.STATE_SIZE,!0),n=Qt.dispatch((()=>it(this,void 0,void 0,(function*(){if(!wt.has(e.name)){const t=dt(e.data),r=WebAssembly.compile(t);wt.set(e.name,r)}const t=yield wt.get(e.name);r=yield WebAssembly.instantiate(t,{})})))),a=(e=null)=>{A=!0,r.exports.Hash_Init(e)},s=e=>{if(!A)throw new Error("update() called before init()");(e=>{let t=0;for(;t<e.length;){const A=e.subarray(t,t+Ct);t+=A.length,i.set(A),r.exports.Hash_Update(A.length)}})(lt(e))},c=new Uint8Array(2*t),g=(e,o=null)=>{if(!A)throw new Error("digest() called before init()");return A=!1,r.exports.Hash_Final(o),"binary"===e?i.slice(0,t):ht(c,i,t)},I=e=>"string"==typeof e?e.length<Ct/4:e.byteLength<Ct;let h=I;switch(e.name){case"argon2":case"scrypt":h=()=>!0;break;case"blake2b":case"blake2s":h=(e,t)=>t<=512&&I(e);break;case"blake3":h=(e,t)=>0===t&&I(e);break;case"xxhash64":case"xxhash3":case"xxhash128":h=()=>!1}return yield(()=>it(this,void 0,void 0,(function*(){r||(yield n);const e=r.exports.Hash_GetBuffer(),t=r.exports.memory.buffer;i=new Uint8Array(t,e,Ct)})))(),{getMemor