3 lines
293 KiB
JavaScript
3 lines
293 KiB
JavaScript
|
/*! For license information please see index.browser.min.js.LICENSE.txt */
|
||
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.BeeJs=t():e.BeeJs=t()}(this,(()=>(()=>{var e={6174:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodeCid=t.decodeManifestCid=t.decodeFeedCid=t.encodeManifestReference=t.encodeFeedReference=t.encodeReference=t.ReferenceType=t.REFERENCE_HEX_LENGTH=t.SWARM_FEED_CODEC=t.SWARM_MANIFEST_CODEC=t.SWARM_NS_CODEC=t.KECCAK_256_CODEC=void 0;const n=r(5151),i=r(8335);var o;t.KECCAK_256_CODEC=27,t.SWARM_NS_CODEC=228,t.SWARM_MANIFEST_CODEC=250,t.SWARM_FEED_CODEC=251,t.REFERENCE_HEX_LENGTH=64,function(e){e.FEED="feed",e.MANIFEST="manifest"}(o=t.ReferenceType||(t.ReferenceType={}));const a={[t.SWARM_FEED_CODEC]:o.FEED,[t.SWARM_MANIFEST_CODEC]:o.MANIFEST};function s(e){return"string"==typeof e&&(e=n.CID.parse(e)),{reference:d(e.multihash.digest),type:a[e.code]}}function f(e,r){!function(e){if(c(e),e.length!==t.REFERENCE_HEX_LENGTH)throw new TypeError("Reference does not have expected length 64 characters. Encrypted references are not supported.")}(e);const o=function(e){c(e);const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const n=e.substr(2*r,2);t[r]=parseInt(n,16)}return t}(e);return n.CID.createV1(r,(0,i.create)(t.KECCAK_256_CODEC,o))}function d(e,t){const r=Array.from(e,(e=>e.toString(16).padStart(2,"0"))).join("");if(t&&r.length!==t)throw new TypeError(`Resulting HexString does not have expected length ${t}: ${r}`);return r}function c(e,t,r="value"){if(!function(e,t){return"string"==typeof e&&/^[0-9a-f]+$/i.test(e)&&(!t||e.length===t)}(e,t)){throw new TypeError(`${r} not valid hex string${t?` of length ${t}`:""}: ${e}`)}}t.encodeReference=function(e,r){switch(r){case o.FEED:return f(e,t.SWARM_FEED_CODEC);case o.MANIFEST:return f(e,t.SWARM_MANIFEST_CODEC);default:throw new Error("Unknown reference type.")}},t.encodeFeedReference=function(e){return f(e,t.SWARM_FEED_CODEC)},t.encodeManifestReference=function(e){return f(e,t.SWARM_MANIFEST_CODEC)},t.decodeFeedCid=function(e){const t=s(e);if(t.type!==o.FEED)throw new Error("CID did not have Swarm Feed codec!");return t.reference},t.decodeManifestCid=function(e){const t=s(e);if(t.type!==o.MANIFEST)throw new Error("CID did not have Swarm Manifest codec!");return t.reference},t.decodeCid=function(e){return s(e)}},9919:function(e,t,r){!function(e,t){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(6601).Buffer}catch(A){}function s(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function f(e,t,r){var n=s(e,r);return r-1>=t&&(n|=s(e,r-1)<<4),n}function d(e,t,r,n){for(var i=0,o=Math.min(e.length,r),a=t;a<o;a++){var s=e.charCodeAt(a)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},o.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&
|
||
|
//# sourceMappingURL=index.browser.min.js.map
|