rmapi-js 2.2.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,12 @@
1
- var rmapi=(()=>{var We=Object.create;var W=Object.defineProperty;var Ye=Object.getOwnPropertyDescriptor;var Ze=Object.getOwnPropertyNames;var Ke=Object.getPrototypeOf,Xe=Object.prototype.hasOwnProperty;var j=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Qe=(e,r)=>{for(var t in r)W(e,t,{get:r[t],enumerable:!0})},ge=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of Ze(r))!Xe.call(e,i)&&i!==t&&W(e,i,{get:()=>r[i],enumerable:!(n=Ye(r,i))||n.enumerable});return e};var he=(e,r,t)=>(t=e!=null?We(Ke(e)):{},ge(r||!e||!e.__esModule?W(t,"default",{value:e,enumerable:!0}):t,e)),et=e=>ge(W({},"__esModule",{value:!0}),e);var xe=j(Y=>{"use strict";Y.byteLength=rt;Y.toByteArray=it;Y.fromByteArray=at;var S=[],T=[],tt=typeof Uint8Array<"u"?Uint8Array:Array,se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(C=0,be=se.length;C<be;++C)S[C]=se[C],T[se.charCodeAt(C)]=C;var C,be;T["-".charCodeAt(0)]=62;T["_".charCodeAt(0)]=63;function we(e){var r=e.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=e.indexOf("=");t===-1&&(t=r);var n=t===r?0:4-t%4;return[t,n]}function rt(e){var r=we(e),t=r[0],n=r[1];return(t+n)*3/4-n}function nt(e,r,t){return(r+t)*3/4-t}function it(e){var r,t=we(e),n=t[0],i=t[1],o=new tt(nt(e,n,i)),s=0,a=i>0?n-4:n,f;for(f=0;f<a;f+=4)r=T[e.charCodeAt(f)]<<18|T[e.charCodeAt(f+1)]<<12|T[e.charCodeAt(f+2)]<<6|T[e.charCodeAt(f+3)],o[s++]=r>>16&255,o[s++]=r>>8&255,o[s++]=r&255;return i===2&&(r=T[e.charCodeAt(f)]<<2|T[e.charCodeAt(f+1)]>>4,o[s++]=r&255),i===1&&(r=T[e.charCodeAt(f)]<<10|T[e.charCodeAt(f+1)]<<4|T[e.charCodeAt(f+2)]>>2,o[s++]=r>>8&255,o[s++]=r&255),o}function ot(e){return S[e>>18&63]+S[e>>12&63]+S[e>>6&63]+S[e&63]}function st(e,r,t){for(var n,i=[],o=r;o<t;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),i.push(ot(n));return i.join("")}function at(e){for(var r,t=e.length,n=t%3,i=[],o=16383,s=0,a=t-n;s<a;s+=o)i.push(st(e,s,s+o>a?a:s+o));return n===1?(r=e[t-1],i.push(S[r>>2]+S[r<<4&63]+"==")):n===2&&(r=(e[t-2]<<8)+e[t-1],i.push(S[r>>10]+S[r>>4&63]+S[r<<2&63]+"=")),i.join("")}});var ce=j(d=>{"use strict";var Se=d&&d.__rest||function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)r.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(t[n[i]]=e[n[i]]);return t};Object.defineProperty(d,"__esModule",{value:!0});d.isSchema=d.isValidSchema=d.isDiscriminatorForm=d.isValuesForm=d.isPropertiesForm=d.isElementsForm=d.isEnumForm=d.isTypeForm=d.isRefForm=d.isEmptyForm=void 0;function Pt(e){let{definitions:r,nullable:t,metadata:n}=e,i=Se(e,["definitions","nullable","metadata"]);return Object.keys(i).length===0}d.isEmptyForm=Pt;function Oe(e){return"ref"in e}d.isRefForm=Oe;function Tt(e){return"type"in e}d.isTypeForm=Tt;function Fe(e){return"enum"in e}d.isEnumForm=Fe;function Me(e){return"elements"in e}d.isElementsForm=Me;function de(e){return"properties"in e||"optionalProperties"in e}d.isPropertiesForm=de;function Ce(e){return"values"in e}d.isValuesForm=Ce;function Ue(e){return"discriminator"in e}d.isDiscriminatorForm=Ue;function U(e,r){if(r===void 0&&(r=e),e.definitions!==void 0){if(r!==e)return!1;for(let t of Object.values(e.definitions))if(!U(t,r))return!1}if(Oe(e)&&!(e.ref in(r.definitions||{}))||Fe(e)&&(e.enum.length===0||e.enum.length!==new Set(e.enum).size))return!1;if(Me(e))return U(e.elements,r);if(de(e)){for(let t of Object.values(e.properties||{}))if(!U(t,r))return!1;for(let t of Object.values(e.optionalProperties||{}))if(!U(t,r))return!1;for(let t of Object.keys(e.properties||{}))if(t in(e.optionalProperties||{}))return!1}if(Ce(e))return U(e.values,r);if(Ue(e)){for(let t of Object.values(e.mapping))if(!U(t,r)||!de(t)||t.nullable||e.discriminator in(t.properties||{})||e.discriminator in(t.optionalProperties||{}))return!1}return!0}d.isValidSchema=U;var At=[[!1,!1,!1,!1,!1,!1,!1,!1,!1,!1],[!0,!1,!1,!1,!1,!1,!1,!1,!1,!1],[!1,!0,!1,!1,!1,!1,!1,!1,!1,!1],[!1,!1,!0,!1,!1,!1,!1,!1,!1,!1],[!1,!1,!1,!0,!1,!1,!1,!1,!1,!1],[!1,!1,!1,!1,!0,!1,!1,!1,!1,!1],[!1,!1,!1,!1,!1,!0,!1,!1,!1,!1],[!1,!1,!1,!1,!0,!0,!1,!1,!1,!1],[!1,!1,!1,!1,!0,!1,!0,!1,!1,!1],[!1,!1,!1,!1,!1,!0,!0,!1,!1,!1],[!1,!1,!1,!1,!0,!0,!0,!1,!1,!1],[!1,!1,!1,!1,!1,!1,!1,!0,!1,!1],[!1,!1,!1,!1,!1,!1,!1,!1,!0,!0]],kt=["boolean","float32","float64","int8","uint8","int16","uint16","int32","uint32","string","timestamp"];function I(e){if(typeof e!="object"||Array.isArray(e)||e===null)return!1;let r=e,{definitions:t=void 0,nullable:n=void 0,metadata:i=void 0,ref:o=void 0,type:s=void 0,enum:a=void 0,elements:f=void 0,properties:l=void 0,optionalProperties:u=void 0,additionalProperties:E=void 0,values:P=void 0,discriminator:c=void 0,mapping:A=void 0}=r,B=Se(r,["definitions","nullable","metadata","ref","type","enum","elements","properties","optionalProperties","additionalProperties","values","discriminator","mapping"]),ie=[o!==void 0,s!==void 0,a!==void 0,f!==void 0,l!==void 0,u!==void 0,E!==void 0,P!==void 0,c!==void 0,A!==void 0],k=!1;for(let v of At)k=k||v.every((z,ye)=>z===ie[ye]);if(!k)return!1;if(t!==void 0){if(typeof t!="object"||Array.isArray(t)||t===null)return!1;for(let v of Object.values(t))if(!I(v))return!1}if(n!==void 0&&typeof n!="boolean"||i!==void 0&&(typeof i!="object"||Array.isArray(i)||i===null)||o!==void 0&&typeof o!="string"||s!==void 0&&(typeof s!="string"||!kt.includes(s))||a!==void 0&&(!Array.isArray(a)||!a.every(v=>typeof v=="string"))||f!==void 0&&!I(f))return!1;if(l!==void 0){if(typeof l!="object"||Array.isArray(l)||l===null)return!1;for(let v of Object.values(l))if(!I(v))return!1}if(u!==void 0){if(typeof u!="object"||Array.isArray(u)||u===null)return!1;for(let v of Object.values(u))if(!I(v))return!1}if(E!==void 0&&typeof E!="boolean"||P!==void 0&&!I(P)||c!==void 0&&typeof c!="string")return!1;if(A!==void 0){if(typeof A!="object"||Array.isArray(A)||A===null)return!1;for(let v of Object.values(A))if(!I(v))return!1}return Object.keys(B).length===0}d.isSchema=I});var Ie=j(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});var St=/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(\.\d+)?([zZ]|((\+|-)(\d{2}):(\d{2})))$/;function Ot(e){let r=e.match(St);if(r===null)return!1;let t=parseInt(r[1],10),n=parseInt(r[2],10),i=parseInt(r[3],10),o=parseInt(r[4],10),s=parseInt(r[5],10),a=parseInt(r[6],10);return!(n>12||i>Ft(t,n)||o>23||s>59||a>60)}pe.default=Ot;function Ft(e,r){return r===2?Mt(e)?29:28:Ct[r]}function Mt(e){return e%4===0&&(e%100!==0||e%400===0)}var Ct=[0,31,0,31,30,31,30,31,31,30,31,30,31]});var Re=j(F=>{"use strict";var Ut=F&&F.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(F,"__esModule",{value:!0});F.validate=F.MaxDepthExceededError=void 0;var It=Ut(Ie()),R=ce(),Q=class extends Error{};F.MaxDepthExceededError=Q;var ee=class extends Error{};function Rt(e,r,t){let n={errors:[],instanceTokens:[],schemaTokens:[[]],root:e,config:t||{maxDepth:0,maxErrors:0}};try{L(n,e,r)}catch(i){if(!(i instanceof ee))throw i}return n.errors}F.validate=Rt;function L(e,r,t,n){if(!(r.nullable&&t===null)){if(R.isRefForm(r)){if(e.schemaTokens.length===e.config.maxDepth)throw new Q;e.schemaTokens.push(["definitions",r.ref]),L(e,e.root.definitions[r.ref],t),e.schemaTokens.pop()}else if(R.isTypeForm(r)){switch(b(e,"type"),r.type){case"boolean":typeof t!="boolean"&&w(e);break;case"float32":case"float64":typeof t!="number"&&w(e);break;case"int8":N(e,t,-128,127);break;case"uint8":N(e,t,0,255);break;case"int16":N(e,t,-32768,32767);break;case"uint16":N(e,t,0,65535);break;case"int32":N(e,t,-2147483648,2147483647);break;case"uint32":N(e,t,0,4294967295);break;case"string":typeof t!="string"&&w(e);break;case"timestamp":typeof t!="string"?w(e):It.default(t)||w(e);break}x(e)}else if(R.isEnumForm(r))b(e,"enum"),(typeof t!="string"||!r.enum.includes(t))&&w(e),x(e);else if(R.isElementsForm(r)){if(b(e,"elements"),Array.isArray(t))for(let[i,o]of t.entries())_(e,i.toString()),L(e,r.elements,o),$(e);else w(e);x(e)}else if(R.isPropertiesForm(r))if(typeof t=="object"&&t!==null&&!Array.isArray(t)){if(r.properties!==void 0){b(e,"properties");for(let[i,o]of Object.entries(r.properties))b(e,i),t.hasOwnProperty(i)?(_(e,i),L(e,o,t[i]),$(e)):w(e),x(e);x(e)}if(r.optionalProperties!==void 0){b(e,"optionalProperties");for(let[i,o]of Object.entries(r.optionalProperties))b(e,i),t.hasOwnProperty(i)&&(_(e,i),L(e,o,t[i]),$(e)),x(e);x(e)}if(r.additionalProperties!==!0)for(let i of Object.keys(t)){let o=r.properties&&i in r.properties,s=r.optionalProperties&&i in r.optionalProperties;!o&&!s&&i!==n&&(_(e,i),w(e),$(e))}}else r.properties!==void 0?b(e,"properties"):b(e,"optionalProperties"),w(e),x(e);else if(R.isValuesForm(r)){if(b(e,"values"),typeof t=="object"&&t!==null&&!Array.isArray(t))for(let[i,o]of Object.entries(t))_(e,i),L(e,r.values,o),$(e);else w(e);x(e)}else if(R.isDiscriminatorForm(r))if(typeof t=="object"&&t!==null&&!Array.isArray(t))if(t.hasOwnProperty(r.discriminator)){let i=t[r.discriminator];typeof i=="string"?i in r.mapping?(b(e,"mapping"),b(e,i),L(e,r.mapping[i],t,r.discriminator),x(e),x(e)):(b(e,"mapping"),_(e,r.discriminator),w(e),$(e),x(e)):(b(e,"discriminator"),_(e,r.discriminator),w(e),$(e),x(e))}else b(e,"discriminator"),w(e),x(e);else b(e,"discriminator"),w(e),x(e)}}function N(e,r,t,n){(typeof r!="number"||!Number.isInteger(r)||r<t||r>n)&&w(e)}function _(e,r){e.instanceTokens.push(r)}function $(e){e.instanceTokens.pop()}function b(e,r){e.schemaTokens[e.schemaTokens.length-1].push(r)}function x(e){e.schemaTokens[e.schemaTokens.length-1].pop()}function w(e){if(e.errors.push({instancePath:[...e.instanceTokens],schemaPath:[...e.schemaTokens[e.schemaTokens.length-1]]}),e.errors.length===e.config.maxErrors)throw new ee}});var $e=j(M=>{"use strict";var _t=M&&M.__createBinding||(Object.create?function(e,r,t,n){n===void 0&&(n=t),Object.defineProperty(e,n,{enumerable:!0,get:function(){return r[t]}})}:function(e,r,t,n){n===void 0&&(n=t),e[n]=r[t]}),_e=M&&M.__exportStar||function(e,r){for(var t in e)t!=="default"&&!r.hasOwnProperty(t)&&_t(r,e,t)};Object.defineProperty(M,"__esModule",{value:!0});_e(ce(),M);_e(Re(),M)});var zt={};Qe(zt,{GenerationError:()=>ne,ResponseError:()=>D,builtinFontNames:()=>Bt,builtinLineHeights:()=>qe,builtinMargins:()=>Ve,builtinTextScales:()=>Je,builtinTools:()=>Nt,formatEntry:()=>Ge,parseEntry:()=>ze,register:()=>qt,remarkable:()=>Gt});var je=he(xe());var Z,ft=new Uint8Array(16);function K(){if(!Z&&(Z=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Z))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Z(ft)}var Ee=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function lt(e){return typeof e=="string"&&Ee.test(e)}var H=lt;var p=[];for(let e=0;e<256;++e)p.push((e+256).toString(16).slice(1));function J(e,r=0){return(p[e[r+0]]+p[e[r+1]]+p[e[r+2]]+p[e[r+3]]+"-"+p[e[r+4]]+p[e[r+5]]+"-"+p[e[r+6]]+p[e[r+7]]+"-"+p[e[r+8]]+p[e[r+9]]+"-"+p[e[r+10]]+p[e[r+11]]+p[e[r+12]]+p[e[r+13]]+p[e[r+14]]+p[e[r+15]]).toLowerCase()}function ut(e){if(!H(e))throw TypeError("Invalid UUID");let r,t=new Uint8Array(16);return t[0]=(r=parseInt(e.slice(0,8),16))>>>24,t[1]=r>>>16&255,t[2]=r>>>8&255,t[3]=r&255,t[4]=(r=parseInt(e.slice(9,13),16))>>>8,t[5]=r&255,t[6]=(r=parseInt(e.slice(14,18),16))>>>8,t[7]=r&255,t[8]=(r=parseInt(e.slice(19,23),16))>>>8,t[9]=r&255,t[10]=(r=parseInt(e.slice(24,36),16))/1099511627776&255,t[11]=r/4294967296&255,t[12]=r>>>24&255,t[13]=r>>>16&255,t[14]=r>>>8&255,t[15]=r&255,t}var ae=ut;function dt(e){e=unescape(encodeURIComponent(e));let r=[];for(let t=0;t<e.length;++t)r.push(e.charCodeAt(t));return r}var ct="6ba7b810-9dad-11d1-80b4-00c04fd430c8",pt="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function V(e,r,t){function n(i,o,s,a){var f;if(typeof i=="string"&&(i=dt(i)),typeof o=="string"&&(o=ae(o)),((f=o)===null||f===void 0?void 0:f.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+i.length);if(l.set(o),l.set(i,o.length),l=t(l),l[6]=l[6]&15|r,l[8]=l[8]&63|128,s){a=a||0;for(let u=0;u<16;++u)s[a+u]=l[u];return s}return J(l)}try{n.name=e}catch{}return n.DNS=ct,n.URL=pt,n}function mt(e){if(typeof e=="string"){let r=unescape(encodeURIComponent(e));e=new Uint8Array(r.length);for(let t=0;t<r.length;++t)e[t]=r.charCodeAt(t)}return yt(gt(ht(e),e.length*8))}function yt(e){let r=[],t=e.length*32,n="0123456789abcdef";for(let i=0;i<t;i+=8){let o=e[i>>5]>>>i%32&255,s=parseInt(n.charAt(o>>>4&15)+n.charAt(o&15),16);r.push(s)}return r}function ve(e){return(e+64>>>9<<4)+14+1}function gt(e,r){e[r>>5]|=128<<r%32,e[ve(r)-1]=r;let t=1732584193,n=-271733879,i=-1732584194,o=271733878;for(let s=0;s<e.length;s+=16){let a=t,f=n,l=i,u=o;t=m(t,n,i,o,e[s],7,-680876936),o=m(o,t,n,i,e[s+1],12,-389564586),i=m(i,o,t,n,e[s+2],17,606105819),n=m(n,i,o,t,e[s+3],22,-1044525330),t=m(t,n,i,o,e[s+4],7,-176418897),o=m(o,t,n,i,e[s+5],12,1200080426),i=m(i,o,t,n,e[s+6],17,-1473231341),n=m(n,i,o,t,e[s+7],22,-45705983),t=m(t,n,i,o,e[s+8],7,1770035416),o=m(o,t,n,i,e[s+9],12,-1958414417),i=m(i,o,t,n,e[s+10],17,-42063),n=m(n,i,o,t,e[s+11],22,-1990404162),t=m(t,n,i,o,e[s+12],7,1804603682),o=m(o,t,n,i,e[s+13],12,-40341101),i=m(i,o,t,n,e[s+14],17,-1502002290),n=m(n,i,o,t,e[s+15],22,1236535329),t=y(t,n,i,o,e[s+1],5,-165796510),o=y(o,t,n,i,e[s+6],9,-1069501632),i=y(i,o,t,n,e[s+11],14,643717713),n=y(n,i,o,t,e[s],20,-373897302),t=y(t,n,i,o,e[s+5],5,-701558691),o=y(o,t,n,i,e[s+10],9,38016083),i=y(i,o,t,n,e[s+15],14,-660478335),n=y(n,i,o,t,e[s+4],20,-405537848),t=y(t,n,i,o,e[s+9],5,568446438),o=y(o,t,n,i,e[s+14],9,-1019803690),i=y(i,o,t,n,e[s+3],14,-187363961),n=y(n,i,o,t,e[s+8],20,1163531501),t=y(t,n,i,o,e[s+13],5,-1444681467),o=y(o,t,n,i,e[s+2],9,-51403784),i=y(i,o,t,n,e[s+7],14,1735328473),n=y(n,i,o,t,e[s+12],20,-1926607734),t=g(t,n,i,o,e[s+5],4,-378558),o=g(o,t,n,i,e[s+8],11,-2022574463),i=g(i,o,t,n,e[s+11],16,1839030562),n=g(n,i,o,t,e[s+14],23,-35309556),t=g(t,n,i,o,e[s+1],4,-1530992060),o=g(o,t,n,i,e[s+4],11,1272893353),i=g(i,o,t,n,e[s+7],16,-155497632),n=g(n,i,o,t,e[s+10],23,-1094730640),t=g(t,n,i,o,e[s+13],4,681279174),o=g(o,t,n,i,e[s],11,-358537222),i=g(i,o,t,n,e[s+3],16,-722521979),n=g(n,i,o,t,e[s+6],23,76029189),t=g(t,n,i,o,e[s+9],4,-640364487),o=g(o,t,n,i,e[s+12],11,-421815835),i=g(i,o,t,n,e[s+15],16,530742520),n=g(n,i,o,t,e[s+2],23,-995338651),t=h(t,n,i,o,e[s],6,-198630844),o=h(o,t,n,i,e[s+7],10,1126891415),i=h(i,o,t,n,e[s+14],15,-1416354905),n=h(n,i,o,t,e[s+5],21,-57434055),t=h(t,n,i,o,e[s+12],6,1700485571),o=h(o,t,n,i,e[s+3],10,-1894986606),i=h(i,o,t,n,e[s+10],15,-1051523),n=h(n,i,o,t,e[s+1],21,-2054922799),t=h(t,n,i,o,e[s+8],6,1873313359),o=h(o,t,n,i,e[s+15],10,-30611744),i=h(i,o,t,n,e[s+6],15,-1560198380),n=h(n,i,o,t,e[s+13],21,1309151649),t=h(t,n,i,o,e[s+4],6,-145523070),o=h(o,t,n,i,e[s+11],10,-1120210379),i=h(i,o,t,n,e[s+2],15,718787259),n=h(n,i,o,t,e[s+9],21,-343485551),t=O(t,a),n=O(n,f),i=O(i,l),o=O(o,u)}return[t,n,i,o]}function ht(e){if(e.length===0)return[];let r=e.length*8,t=new Uint32Array(ve(r));for(let n=0;n<r;n+=8)t[n>>5]|=(e[n/8]&255)<<n%32;return t}function O(e,r){let t=(e&65535)+(r&65535);return(e>>16)+(r>>16)+(t>>16)<<16|t&65535}function bt(e,r){return e<<r|e>>>32-r}function X(e,r,t,n,i,o){return O(bt(O(O(r,e),O(n,o)),i),t)}function m(e,r,t,n,i,o,s){return X(r&t|~r&n,e,r,i,o,s)}function y(e,r,t,n,i,o,s){return X(r&n|t&~n,e,r,i,o,s)}function g(e,r,t,n,i,o,s){return X(r^t^n,e,r,i,o,s)}function h(e,r,t,n,i,o,s){return X(t^(r|~n),e,r,i,o,s)}var Pe=mt;var pr=V("v3",48,Pe);var wt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),fe={randomUUID:wt};function xt(e,r,t){if(fe.randomUUID&&!r&&!e)return fe.randomUUID();e=e||{};let n=e.random||(e.rng||K)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,r){t=t||0;for(let i=0;i<16;++i)r[t+i]=n[i];return r}return J(n)}var q=xt;function Et(e,r,t,n){switch(e){case 0:return r&t^~r&n;case 1:return r^t^n;case 2:return r&t^r&n^t&n;case 3:return r^t^n}}function le(e,r){return e<<r|e>>>32-r}function vt(e){let r=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){let s=unescape(encodeURIComponent(e));e=[];for(let a=0;a<s.length;++a)e.push(s.charCodeAt(a))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);let n=e.length/4+2,i=Math.ceil(n/16),o=new Array(i);for(let s=0;s<i;++s){let a=new Uint32Array(16);for(let f=0;f<16;++f)a[f]=e[s*64+f*4]<<24|e[s*64+f*4+1]<<16|e[s*64+f*4+2]<<8|e[s*64+f*4+3];o[s]=a}o[i-1][14]=(e.length-1)*8/Math.pow(2,32),o[i-1][14]=Math.floor(o[i-1][14]),o[i-1][15]=(e.length-1)*8&4294967295;for(let s=0;s<i;++s){let a=new Uint32Array(80);for(let c=0;c<16;++c)a[c]=o[s][c];for(let c=16;c<80;++c)a[c]=le(a[c-3]^a[c-8]^a[c-14]^a[c-16],1);let f=t[0],l=t[1],u=t[2],E=t[3],P=t[4];for(let c=0;c<80;++c){let A=Math.floor(c/20),B=le(f,5)+Et(A,l,u,E)+P+r[A]+a[c]>>>0;P=E,E=u,u=le(l,30)>>>0,l=f,f=B}t[0]=t[0]+f>>>0,t[1]=t[1]+l>>>0,t[2]=t[2]+u>>>0,t[3]=t[3]+E>>>0,t[4]=t[4]+P>>>0}return[t[0]>>24&255,t[0]>>16&255,t[0]>>8&255,t[0]&255,t[1]>>24&255,t[1]>>16&255,t[1]>>8&255,t[1]&255,t[2]>>24&255,t[2]>>16&255,t[2]>>8&255,t[2]&255,t[3]>>24&255,t[3]>>16&255,t[3]>>8&255,t[3]&255,t[4]>>24&255,t[4]>>16&255,t[4]>>8&255,t[4]&255]}var Te=vt;var Pr=V("v5",80,Te);function ue(e){return[...new Uint8Array(e)].map(r=>r.toString(16).padStart(2,"0")).join("")}function Ae(e){return new Uint8Array((e.match(/../g)??[]).map(r=>parseInt(r,16)))}function ke(e){let r=0;for(let i of e)r+=i.length;let t=new Uint8Array(r),n=0;for(let i of e)t.set(i,n),n+=i.length;return t}var Le=he($e());function G(e,r){if((0,Le.validate)(e,r).length)throw new Error(`couldn't validate schema: ${JSON.stringify(r)} didn't match schema ${JSON.stringify(e)}`)}var De="3",He="https://webapp-prod.cloud.remarkable.engineering",$t="https://internal.cloud.remarkable.com",Ne="x-goog-generation",Lt="x-goog-if-generation-match",Dt="x-goog-content-length-range",Nt=["Ballpoint","Ballpointv2","Brush","Calligraphy","ClearPage","EraseSection","Eraser","Fineliner","Finelinerv2","Highlighter","Highlighterv2","Marker","Markerv2","Paintbrush","Paintbrushv2","Pencilv2","SharpPencil","SharpPencilv2","SolidPen","ZoomTool"],Bt=["Maison Neue","EB Garamond","Noto Sans","Noto Serif","Noto Mono","Noto Sans UI"],Je={xs:.7,sm:.8,md:1,lg:1.2,xl:1.5,xx:2},Ve={sm:50,md:125,rr:180,lg:200},qe={df:-1,md:100,lg:150,xl:200},jt={properties:{docID:{type:"string"},hash:{type:"string"}}},Ht={properties:{relative_path:{type:"string"},url:{type:"string"},expires:{type:"timestamp"},method:{enum:["POST","GET","PUT","DELETE"]}},optionalProperties:{maxuploadsize_bytes:{type:"float64"}}},te={visibleName:{type:"string"},lastModified:{type:"string"}},re={version:{type:"int32"},pinned:{type:"boolean"},synced:{type:"boolean"},modified:{type:"boolean"},deleted:{type:"boolean"},metadatamodified:{type:"boolean"},parent:{type:"string"}},Jt={discriminator:"type",mapping:{CollectionType:{properties:te,optionalProperties:re},DocumentType:{properties:te,optionalProperties:{...re,lastOpened:{type:"string"},lastOpenedPage:{type:"int32"}}}}},Be={id:{type:"string"},hash:{type:"string"}},Vt={discriminator:"type",mapping:{CollectionType:{properties:{...te,...Be},optionalProperties:re},DocumentType:{properties:{...te,...Be,fileType:{enum:["notebook","epub","pdf",""]}},optionalProperties:{...re,lastOpened:{type:"string"},lastOpenedPage:{type:"int32"}}}}},D=class extends Error{constructor(t,n,i){super(i);this.status=t,this.statusText=n}},ne=class extends Error{constructor(){super("Generation preconditions failed. This means the current state is out of date with the cloud and needs to be re-synced.")}};async function qt(e,{deviceDesc:r="browser-chrome",uuid:t=q(),authHost:n=He,fetch:i=globalThis.fetch}={}){if(e.length!==8)throw new Error(`code should be length 8, but was ${e.length}`);let o=await i(`${n}/token/json/2/device/new`,{method:"POST",headers:{Authorization:"Bearer"},body:JSON.stringify({code:e,deviceDesc:r,deviceID:t})});if(o.ok)return await o.text();throw new D(o.status,o.statusText,"couldn't register api")}function Ge({hash:e,type:r,documentId:t,subfiles:n,size:i}){return`${e}:${r}:${t}:${n}:${i}
2
- `}function ze(e){let[r,t,n,i,o]=e.split(":");if(r===void 0||t===void 0||n===void 0||i===void 0||o===void 0)throw new Error(`entries line didn't contain five fields: '${e}'`);if(t==="80000000")return{hash:r,type:t,documentId:n,subfiles:parseInt(i),size:BigInt(o)};if(t==="0"){if(i!=="0")throw new Error(`file type entry had nonzero number of subfiles: ${i}`);return{hash:r,type:t,documentId:n,subfiles:0,size:BigInt(o)}}else throw new Error(`entries line contained invalid type: ${t}`)}var me=class{#a;#o;#e;#s;#t;constructor(r,t,n,i,o){this.#a=r,this.#o=t,this.#e=n,this.#s=i,this.#t=o}async#i(r,{body:t,method:n="POST",headers:i={}}){let o=await this.#o(r,{method:n,headers:{Authorization:`Bearer ${this.#a}`,...i},body:t});if(o.ok)return o;{let s=await o.text();throw new D(o.status,o.statusText,`failed reMarkable request: ${s}`)}}async#r({url:r,method:t,maxuploadsize_bytes:n},i,o={}){let s=n?{...o,[Dt]:`0,${n}`}:o,a=await this.#o(r,{method:t,body:i,headers:s});if(a.ok)return a;{let f=await a.text();throw new D(a.status,a.statusText,f)}}async#n(r,t,n){let i=t===void 0?"downloads":"uploads",o=n?`{ "http_method": "PUT", "relative_path": "${r}", "root_schema": "${n}", "generation": ${t} }`:JSON.stringify({http_method:"GET",relative_path:r}),a=await(await this.#i(`${this.#t}/sync/v2/signed-urls/${i}`,{body:o})).text(),f=JSON.parse(a);return G(Ht,f),f}async getRootHash(){let r=await this.#n("root"),t=await this.#r(r),n=t.headers.get(Ne);if(!n)throw new Error("no generation header in root hash");return[await t.text(),BigInt(n)]}async putRootHash(r,t){let n=await this.#n("root",t,r),i;try{i=await this.#r(n,r,{[Lt]:`${t}`})}catch(s){throw s instanceof D&&s.status===412?new ne:s}let o=i.headers.get(Ne);if(!o)throw new Error("no generation header in root hash");return BigInt(o)}async getBuffer(r){let t=await this.#n(r);return await(await this.#r(t)).arrayBuffer()}async getText(r){let t=await this.#e?.get(r);if(t)return t;{let n=await this.#n(r),o=await(await this.#r(n)).text();return await this.#e?.set(r,o),o}}async getMetadata(r){let t=await this.getText(r),n=JSON.parse(t);return G(Jt,n),n}async getEntries(r){let t=await this.getText(r),[n,...i]=t.slice(0,-1).split(`
3
- `);if(n!==De)throw new Error(`got unexpected schema version: ${n}`);return i.map(ze)}async#f(r,t){let n=await this.#n(r,null);await this.#r(n,t)}async putEntries(r,t){let n=new TextEncoder;t.sort((u,E)=>u.documentId.localeCompare(E.documentId));let i=ke(t.map(u=>Ae(u.hash))),o=await this.#s.digest("SHA-256",i),s=ue(o),a=t.map(Ge).join(""),f=`${De}
4
- ${a}`,l=n.encode(f);return await this.#f(s,l),await this.#e?.set(s,f),{hash:s,type:"80000000",documentId:r,subfiles:t.length,size:0n}}async putBuffer(r,t){let n=await this.#s.digest("SHA-256",t),i=ue(n);return await this.#f(i,t),{hash:i,type:"0",documentId:r,subfiles:0,size:BigInt(t.length)}}async putText(r,t){let n=new TextEncoder,i=await this.putBuffer(r,n.encode(t));return await this.#e?.set(i.hash,t),i}async putMetadata(r,t){return await this.putText(`${r}.metadata`,JSON.stringify(t))}async putCollection(r,t=""){let n=q(),i=`${new Date().valueOf()}`,o=[],s={type:"CollectionType",visibleName:r,version:0,parent:t,synced:!0,lastModified:i};o.push(this.putMetadata(n,s)),o.push(this.putText(`${n}.content`,"{}"));let a=await Promise.all(o);return await this.putEntries(n,a)}async#l(r,t,n,i,o){if(o.fileType!==n)throw new Error(`internal error: fileTypes don't match: ${n}, ${o.fileType}`);let s=q(),a=`${new Date().valueOf()}`,f=[];f.push(this.putBuffer(`${s}.${n}`,t));let l={type:"DocumentType",visibleName:r,version:0,parent:i,synced:!0,lastModified:a};f.push(this.putMetadata(s,l)),f.push(this.putText(`${s}.content`,JSON.stringify(o)));let u=await Promise.all(f);return await this.putEntries(s,u)}async putEpub(r,t,{parent:n="",margins:i=125,orientation:o,textAlignment:s,textScale:a=1,lineHeight:f=-1,fontName:l="",cover:u="visited",lastTool:E}={}){let P={dummyDocument:!1,extraMetadata:{LastTool:E},fileType:"epub",pageCount:0,lastOpenedPage:0,lineHeight:typeof f=="string"?qe[f]:f,margins:typeof i=="string"?Ve[i]:i,textScale:typeof a=="string"?Je[a]:a,pages:[],coverPageNumber:u==="first"?0:-1,formatVersion:1,orientation:o,textAlignment:s,fontName:l};return await this.#l(r,t,"epub",n,P)}async putPdf(r,t,{parent:n="",orientation:i,cover:o="first",lastTool:s}={}){let a={dummyDocument:!1,extraMetadata:{LastTool:s},fileType:"pdf",pageCount:0,lastOpenedPage:0,lineHeight:-1,margins:125,textScale:1,pages:[],coverPageNumber:o==="first"?0:-1,formatVersion:1,orientation:i};return await this.#l(r,t,"pdf",n,a)}async syncComplete(r){let t=`{ "generation": ${r} }`;await this.#i(`${this.#t}/sync/v2/sync-complete`,{body:t})}async#u(r){try{return await this.syncComplete(r),!0}catch{return!1}}async create(r,t=!0){let[n,i]=await this.getRootHash(),o=await this.getEntries(n);o.push(r);let{hash:s}=await this.putEntries("",o),a=await this.putRootHash(s,i);return t?await this.#u(a):!1}async move(r,t,n=!0){let[i,o]=await this.getRootHash(),s=await this.getEntries(i);if(!(!t||t==="trash")){let k=s.find(oe=>oe.documentId===t);if(k){if(k.type!=="80000000")throw new Error(`destination id was a raw file: ${t}`)}else throw new Error(`destination id not found: ${t}`);let v=await this.getEntries(k.hash),[z]=v.filter(oe=>oe.documentId===`${t}.metadata`);if(!z)throw new Error(`destination id didn't have metadata: ${t}`);if((await this.getMetadata(z.hash)).type!=="CollectionType")throw new Error(`destination id wasn't a collection: ${t}`)}let a=s.findIndex(k=>k.documentId===r);if(a===-1)throw new Error(`document not found: ${r}`);let[f]=s.splice(a,1);if(f.type!=="80000000")throw new Error(`document was a raw file: ${r}`);let l=await this.getEntries(f.hash),u=l.findIndex(k=>k.documentId===`${r}.metadata`);if(u===-1)throw new Error(`document didn't have metadata: ${r}`);let[E]=l.splice(u,1),P=await this.getMetadata(E.hash);P.parent=t;let c=await this.putMetadata(r,P);l.push(c);let A=await this.putEntries(r,l);s.push(A);let{hash:B}=await this.putEntries("",s),ie=await this.putRootHash(B,o);return n?await this.#u(ie):!1}async getEntriesMetadata(){let t=await(await this.#i(`${this.#t}/doc/v2/files`,{method:"GET",headers:{"rm-source":"RoR-Browser"}})).text(),n=JSON.parse(t);return G({elements:Vt},n),n}async#d(r,t,n){let o=new TextEncoder().encode(JSON.stringify({file_name:r})),a=await(await this.#i(`${this.#t}/doc/v2/files`,{body:t,headers:{"content-type":n,"rm-meta":(0,je.fromByteArray)(o),"rm-source":"RoR-Browser"}})).text(),f=JSON.parse(a);return G(jt,f),f}async uploadEpub(r,t){return await this.#d(r,t,"application/epub+zip")}async uploadPdf(r,t){return await this.#d(r,t,"application/pdf")}};async function Gt(e,{fetch:r=globalThis.fetch,cache:t,subtle:n=globalThis.crypto?.subtle,authHost:i=He,syncHost:o=$t}={}){let s=await r(`${i}/token/json/2/user/new`,{method:"POST",headers:{Authorization:`Bearer ${e}`}});if(!s.ok)throw new Error(`couldn't fetch auth token: ${s.statusText}`);let a=await s.text();return new me(a,r,t,n,o)}return et(zt);})();
1
+ var rmapi=(()=>{var wt=Object.create;var re=Object.defineProperty;var vt=Object.getOwnPropertyDescriptor;var xt=Object.getOwnPropertyNames;var Et=Object.getPrototypeOf,Pt=Object.prototype.hasOwnProperty;var j=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Tt=(e,r)=>{for(var t in r)re(e,t,{get:r[t],enumerable:!0})},Fe=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of xt(r))!Pt.call(e,i)&&i!==t&&re(e,i,{get:()=>r[i],enumerable:!(n=vt(r,i))||n.enumerable});return e};var ge=(e,r,t)=>(t=e!=null?wt(Et(e)):{},Fe(r||!e||!e.__esModule?re(t,"default",{value:e,enumerable:!0}):t,e)),At=e=>Fe(re({},"__esModule",{value:!0}),e);var Ie=j(ne=>{"use strict";ne.byteLength=St;ne.toByteArray=Mt;ne.fromByteArray=jt;var F=[],M=[],Ot=typeof Uint8Array<"u"?Uint8Array:Array,be="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(L=0,je=be.length;L<je;++L)F[L]=be[L],M[be.charCodeAt(L)]=L;var L,je;M["-".charCodeAt(0)]=62;M["_".charCodeAt(0)]=63;function Be(e){var r=e.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=e.indexOf("=");t===-1&&(t=r);var n=t===r?0:4-t%4;return[t,n]}function St(e){var r=Be(e),t=r[0],n=r[1];return(t+n)*3/4-n}function kt(e,r,t){return(r+t)*3/4-t}function Mt(e){var r,t=Be(e),n=t[0],i=t[1],o=new Ot(kt(e,n,i)),a=0,f=i>0?n-4:n,s;for(s=0;s<f;s+=4)r=M[e.charCodeAt(s)]<<18|M[e.charCodeAt(s+1)]<<12|M[e.charCodeAt(s+2)]<<6|M[e.charCodeAt(s+3)],o[a++]=r>>16&255,o[a++]=r>>8&255,o[a++]=r&255;return i===2&&(r=M[e.charCodeAt(s)]<<2|M[e.charCodeAt(s+1)]>>4,o[a++]=r&255),i===1&&(r=M[e.charCodeAt(s)]<<10|M[e.charCodeAt(s+1)]<<4|M[e.charCodeAt(s+2)]>>2,o[a++]=r>>8&255,o[a++]=r&255),o}function Ct(e){return F[e>>18&63]+F[e>>12&63]+F[e>>6&63]+F[e&63]}function Ft(e,r,t){for(var n,i=[],o=r;o<t;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),i.push(Ct(n));return i.join("")}function jt(e){for(var r,t=e.length,n=t%3,i=[],o=16383,a=0,f=t-n;a<f;a+=o)i.push(Ft(e,a,a+o>f?f:a+o));return n===1?(r=e[t-1],i.push(F[r>>2]+F[r<<4&63]+"==")):n===2&&(r=(e[t-2]<<8)+e[t-1],i.push(F[r>>10]+F[r>>4&63]+F[r<<2&63]+"=")),i.join("")}});var Le=j((Sr,Ue)=>{"use strict";var ie,u,Re={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
2
+ `,r:"\r",t:" "},we;function I(e){throw{name:"SyntaxError",message:e,at:ie,text:we}}function d(e){return e&&e!==u&&I("Expected '"+e+"' instead of '"+u+"'"),u=we.charAt(ie),ie+=1,u}function _e(){var e,r="";for(u==="-"&&(r="-",d("-"));u>="0"&&u<="9";)r+=u,d();if(u===".")for(r+=".";d()&&u>="0"&&u<="9";)r+=u;if(u==="e"||u==="E")for(r+=u,d(),(u==="-"||u==="+")&&(r+=u,d());u>="0"&&u<="9";)r+=u,d();return e=Number(r),isFinite(e)||I("Bad number"),e}function Ne(){var e,r,t="",n;if(u==='"')for(;d();){if(u==='"')return d(),t;if(u==="\\")if(d(),u==="u"){for(n=0,r=0;r<4&&(e=parseInt(d(),16),!!isFinite(e));r+=1)n=n*16+e;t+=String.fromCharCode(n)}else if(typeof Re[u]=="string")t+=Re[u];else break;else t+=u}I("Bad string")}function B(){for(;u&&u<=" ";)d()}function Bt(){switch(u){case"t":return d("t"),d("r"),d("u"),d("e"),!0;case"f":return d("f"),d("a"),d("l"),d("s"),d("e"),!1;case"n":return d("n"),d("u"),d("l"),d("l"),null;default:I("Unexpected '"+u+"'")}}function It(){var e=[];if(u==="["){if(d("["),B(),u==="]")return d("]"),e;for(;u;){if(e.push(oe()),B(),u==="]")return d("]"),e;d(","),B()}}I("Bad array")}function Rt(){var e,r={};if(u==="{"){if(d("{"),B(),u==="}")return d("}"),r;for(;u;){if(e=Ne(),B(),d(":"),Object.prototype.hasOwnProperty.call(r,e)&&I('Duplicate key "'+e+'"'),r[e]=oe(),B(),u==="}")return d("}"),r;d(","),B()}}I("Bad object")}function oe(){switch(B(),u){case"{":return Rt();case"[":return It();case'"':return Ne();case"-":return _e();default:return u>="0"&&u<="9"?_e():Bt()}}Ue.exports=function(e,r){var t;return we=e,ie=0,u=" ",t=oe(),B(),u&&I("Syntax error"),typeof r=="function"?function n(i,o){var a,f,s=i[o];if(s&&typeof s=="object")for(a in oe)Object.prototype.hasOwnProperty.call(s,a)&&(f=n(s,a),typeof f>"u"?delete s[a]:s[a]=f);return r.call(i,o,s)}({"":t},""):t}});var $e=j((kr,De)=>{"use strict";var ve=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,S,ae,_t={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},D;function xe(e){return ve.lastIndex=0,ve.test(e)?'"'+e.replace(ve,function(r){var t=_t[r];return typeof t=="string"?t:"\\u"+("0000"+r.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function se(e,r){var t,n,i,o,a=S,f,s=r[e];switch(s&&typeof s=="object"&&typeof s.toJSON=="function"&&(s=s.toJSON(e)),typeof D=="function"&&(s=D.call(r,e,s)),typeof s){case"string":return xe(s);case"number":return isFinite(s)?String(s):"null";case"boolean":case"null":return String(s);case"object":if(!s)return"null";if(S+=ae,f=[],Object.prototype.toString.apply(s)==="[object Array]"){for(o=s.length,t=0;t<o;t+=1)f[t]=se(t,s)||"null";return i=f.length===0?"[]":S?`[
3
+ `+S+f.join(`,
4
+ `+S)+`
5
+ `+a+"]":"["+f.join(",")+"]",S=a,i}if(D&&typeof D=="object")for(o=D.length,t=0;t<o;t+=1)n=D[t],typeof n=="string"&&(i=se(n,s),i&&f.push(xe(n)+(S?": ":":")+i));else for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(i=se(n,s),i&&f.push(xe(n)+(S?": ":":")+i));return i=f.length===0?"{}":S?`{
6
+ `+S+f.join(`,
7
+ `+S)+`
8
+ `+a+"}":"{"+f.join(",")+"}",S=a,i;default:}}De.exports=function(e,r,t){var n;if(S="",ae="",typeof t=="number")for(n=0;n<t;n+=1)ae+=" ";else typeof t=="string"&&(ae=t);if(D=r,r&&typeof r!="function"&&(typeof r!="object"||typeof r.length!="number"))throw new Error("JSON.stringify");return se("",{"":e})}});var He=j(Ee=>{"use strict";Ee.parse=Le();Ee.stringify=$e()});var qe=j((Cr,Je)=>{"use strict";var fe=typeof JSON<"u"?JSON:He(),Nt=Array.isArray||function(e){return{}.toString.call(e)==="[object Array]"},Ut=Object.keys||function(e){var r=Object.prototype.hasOwnProperty||function(){return!0},t=[];for(var n in e)r.call(e,n)&&t.push(n);return t};Je.exports=function(e,r){r||(r={}),typeof r=="function"&&(r={cmp:r});var t=r.space||"";typeof t=="number"&&(t=Array(t+1).join(" "));var n=typeof r.cycles=="boolean"?r.cycles:!1,i=r.replacer||function(f,s){return s},o=r.cmp&&function(f){return function(s){return function(c,l){var m={key:c,value:s[c]},g={key:l,value:s[l]};return f(m,g)}}}(r.cmp),a=[];return function f(s,c,l,m){var g=t?`
9
+ `+new Array(m+1).join(t):"",p=t?": ":":";if(l&&l.toJSON&&typeof l.toJSON=="function"&&(l=l.toJSON()),l=i.call(s,c,l),l!==void 0){if(typeof l!="object"||l===null)return fe.stringify(l);if(Nt(l)){for(var C=[],h=0;h<l.length;h++){var U=f(l,h,l[h],m+1)||fe.stringify(null);C.push(g+t+U)}return"["+C.join(",")+g+"]"}if(a.indexOf(l)!==-1){if(n)return fe.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}else a.push(l);for(var k=Ut(l).sort(o&&o(l)),C=[],h=0;h<k.length;h++){var c=k[h],b=f(l,c,l[c],m+1);if(b){var te=fe.stringify(c)+p+b;C.push(g+t+te)}}return a.splice(a.indexOf(l),1),"{"+C.join(",")+g+"}"}}({"":e},"",e,0)}});var ke=j(y=>{"use strict";var Ze=y&&y.__rest||function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)r.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(t[n[i]]=e[n[i]]);return t};Object.defineProperty(y,"__esModule",{value:!0});y.isSchema=y.isValidSchema=y.isDiscriminatorForm=y.isValuesForm=y.isPropertiesForm=y.isElementsForm=y.isEnumForm=y.isTypeForm=y.isRefForm=y.isEmptyForm=void 0;function er(e){let{definitions:r,nullable:t,metadata:n}=e,i=Ze(e,["definitions","nullable","metadata"]);return Object.keys(i).length===0}y.isEmptyForm=er;function Xe(e){return"ref"in e}y.isRefForm=Xe;function tr(e){return"type"in e}y.isTypeForm=tr;function Qe(e){return"enum"in e}y.isEnumForm=Qe;function et(e){return"elements"in e}y.isElementsForm=et;function Se(e){return"properties"in e||"optionalProperties"in e}y.isPropertiesForm=Se;function tt(e){return"values"in e}y.isValuesForm=tt;function rt(e){return"discriminator"in e}y.isDiscriminatorForm=rt;function $(e,r){if(r===void 0&&(r=e),e.definitions!==void 0){if(r!==e)return!1;for(let t of Object.values(e.definitions))if(!$(t,r))return!1}if(Xe(e)&&!(e.ref in(r.definitions||{}))||Qe(e)&&(e.enum.length===0||e.enum.length!==new Set(e.enum).size))return!1;if(et(e))return $(e.elements,r);if(Se(e)){for(let t of Object.values(e.properties||{}))if(!$(t,r))return!1;for(let t of Object.values(e.optionalProperties||{}))if(!$(t,r))return!1;for(let t of Object.keys(e.properties||{}))if(t in(e.optionalProperties||{}))return!1}if(tt(e))return $(e.values,r);if(rt(e)){for(let t of Object.values(e.mapping))if(!$(t,r)||!Se(t)||t.nullable||e.discriminator in(t.properties||{})||e.discriminator in(t.optionalProperties||{}))return!1}return!0}y.isValidSchema=$;var rr=[[!1,!1,!1,!1,!1,!1,!1,!1,!1,!1],[!0,!1,!1,!1,!1,!1,!1,!1,!1,!1],[!1,!0,!1,!1,!1,!1,!1,!1,!1,!1],[!1,!1,!0,!1,!1,!1,!1,!1,!1,!1],[!1,!1,!1,!0,!1,!1,!1,!1,!1,!1],[!1,!1,!1,!1,!0,!1,!1,!1,!1,!1],[!1,!1,!1,!1,!1,!0,!1,!1,!1,!1],[!1,!1,!1,!1,!0,!0,!1,!1,!1,!1],[!1,!1,!1,!1,!0,!1,!0,!1,!1,!1],[!1,!1,!1,!1,!1,!0,!0,!1,!1,!1],[!1,!1,!1,!1,!0,!0,!0,!1,!1,!1],[!1,!1,!1,!1,!1,!1,!1,!0,!1,!1],[!1,!1,!1,!1,!1,!1,!1,!1,!0,!0]],nr=["boolean","float32","float64","int8","uint8","int16","uint16","int32","uint32","string","timestamp"];function H(e){if(typeof e!="object"||Array.isArray(e)||e===null)return!1;let r=e,{definitions:t=void 0,nullable:n=void 0,metadata:i=void 0,ref:o=void 0,type:a=void 0,enum:f=void 0,elements:s=void 0,properties:c=void 0,optionalProperties:l=void 0,additionalProperties:m=void 0,values:g=void 0,discriminator:p=void 0,mapping:h=void 0}=r,U=Ze(r,["definitions","nullable","metadata","ref","type","enum","elements","properties","optionalProperties","additionalProperties","values","discriminator","mapping"]),k=[o!==void 0,a!==void 0,f!==void 0,s!==void 0,c!==void 0,l!==void 0,m!==void 0,g!==void 0,p!==void 0,h!==void 0],C=!1;for(let b of rr)C=C||b.every((te,Y)=>te===k[Y]);if(!C)return!1;if(t!==void 0){if(typeof t!="object"||Array.isArray(t)||t===null)return!1;for(let b of Object.values(t))if(!H(b))return!1}if(n!==void 0&&typeof n!="boolean"||i!==void 0&&(typeof i!="object"||Array.isArray(i)||i===null)||o!==void 0&&typeof o!="string"||a!==void 0&&(typeof a!="string"||!nr.includes(a))||f!==void 0&&(!Array.isArray(f)||!f.every(b=>typeof b=="string"))||s!==void 0&&!H(s))return!1;if(c!==void 0){if(typeof c!="object"||Array.isArray(c)||c===null)return!1;for(let b of Object.values(c))if(!H(b))return!1}if(l!==void 0){if(typeof l!="object"||Array.isArray(l)||l===null)return!1;for(let b of Object.values(l))if(!H(b))return!1}if(m!==void 0&&typeof m!="boolean"||g!==void 0&&!H(g)||p!==void 0&&typeof p!="string")return!1;if(h!==void 0){if(typeof h!="object"||Array.isArray(h)||h===null)return!1;for(let b of Object.values(h))if(!H(b))return!1}return Object.keys(U).length===0}y.isSchema=H});var nt=j(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});var ir=/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(\.\d+)?([zZ]|((\+|-)(\d{2}):(\d{2})))$/;function or(e){let r=e.match(ir);if(r===null)return!1;let t=parseInt(r[1],10),n=parseInt(r[2],10),i=parseInt(r[3],10),o=parseInt(r[4],10),a=parseInt(r[5],10),f=parseInt(r[6],10);return!(n>12||i>ar(t,n)||o>23||a>59||f>60)}Me.default=or;function ar(e,r){return r===2?sr(e)?29:28:fr[r]}function sr(e){return e%4===0&&(e%100!==0||e%400===0)}var fr=[0,31,0,31,30,31,30,31,31,30,31,30,31]});var it=j(_=>{"use strict";var lr=_&&_.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_,"__esModule",{value:!0});_.validate=_.MaxDepthExceededError=void 0;var ur=lr(nt()),J=ke(),de=class extends Error{};_.MaxDepthExceededError=de;var pe=class extends Error{};function cr(e,r,t){let n={errors:[],instanceTokens:[],schemaTokens:[[]],root:e,config:t||{maxDepth:0,maxErrors:0}};try{G(n,e,r)}catch(i){if(!(i instanceof pe))throw i}return n.errors}_.validate=cr;function G(e,r,t,n){if(!(r.nullable&&t===null)){if(J.isRefForm(r)){if(e.schemaTokens.length===e.config.maxDepth)throw new de;e.schemaTokens.push(["definitions",r.ref]),G(e,e.root.definitions[r.ref],t),e.schemaTokens.pop()}else if(J.isTypeForm(r)){switch(T(e,"type"),r.type){case"boolean":typeof t!="boolean"&&A(e);break;case"float32":case"float64":typeof t!="number"&&A(e);break;case"int8":W(e,t,-128,127);break;case"uint8":W(e,t,0,255);break;case"int16":W(e,t,-32768,32767);break;case"uint16":W(e,t,0,65535);break;case"int32":W(e,t,-2147483648,2147483647);break;case"uint32":W(e,t,0,4294967295);break;case"string":typeof t!="string"&&A(e);break;case"timestamp":typeof t!="string"?A(e):ur.default(t)||A(e);break}O(e)}else if(J.isEnumForm(r))T(e,"enum"),(typeof t!="string"||!r.enum.includes(t))&&A(e),O(e);else if(J.isElementsForm(r)){if(T(e,"elements"),Array.isArray(t))for(let[i,o]of t.entries())q(e,i.toString()),G(e,r.elements,o),V(e);else A(e);O(e)}else if(J.isPropertiesForm(r))if(typeof t=="object"&&t!==null&&!Array.isArray(t)){if(r.properties!==void 0){T(e,"properties");for(let[i,o]of Object.entries(r.properties))T(e,i),t.hasOwnProperty(i)?(q(e,i),G(e,o,t[i]),V(e)):A(e),O(e);O(e)}if(r.optionalProperties!==void 0){T(e,"optionalProperties");for(let[i,o]of Object.entries(r.optionalProperties))T(e,i),t.hasOwnProperty(i)&&(q(e,i),G(e,o,t[i]),V(e)),O(e);O(e)}if(r.additionalProperties!==!0)for(let i of Object.keys(t)){let o=r.properties&&i in r.properties,a=r.optionalProperties&&i in r.optionalProperties;!o&&!a&&i!==n&&(q(e,i),A(e),V(e))}}else r.properties!==void 0?T(e,"properties"):T(e,"optionalProperties"),A(e),O(e);else if(J.isValuesForm(r)){if(T(e,"values"),typeof t=="object"&&t!==null&&!Array.isArray(t))for(let[i,o]of Object.entries(t))q(e,i),G(e,r.values,o),V(e);else A(e);O(e)}else if(J.isDiscriminatorForm(r))if(typeof t=="object"&&t!==null&&!Array.isArray(t))if(t.hasOwnProperty(r.discriminator)){let i=t[r.discriminator];typeof i=="string"?i in r.mapping?(T(e,"mapping"),T(e,i),G(e,r.mapping[i],t,r.discriminator),O(e),O(e)):(T(e,"mapping"),q(e,r.discriminator),A(e),V(e),O(e)):(T(e,"discriminator"),q(e,r.discriminator),A(e),V(e),O(e))}else T(e,"discriminator"),A(e),O(e);else T(e,"discriminator"),A(e),O(e)}}function W(e,r,t,n){(typeof r!="number"||!Number.isInteger(r)||r<t||r>n)&&A(e)}function q(e,r){e.instanceTokens.push(r)}function V(e){e.instanceTokens.pop()}function T(e,r){e.schemaTokens[e.schemaTokens.length-1].push(r)}function O(e){e.schemaTokens[e.schemaTokens.length-1].pop()}function A(e){if(e.errors.push({instancePath:[...e.instanceTokens],schemaPath:[...e.schemaTokens[e.schemaTokens.length-1]]}),e.errors.length===e.config.maxErrors)throw new pe}});var at=j(N=>{"use strict";var dr=N&&N.__createBinding||(Object.create?function(e,r,t,n){n===void 0&&(n=t),Object.defineProperty(e,n,{enumerable:!0,get:function(){return r[t]}})}:function(e,r,t,n){n===void 0&&(n=t),e[n]=r[t]}),ot=N&&N.__exportStar||function(e,r){for(var t in e)t!=="default"&&!r.hasOwnProperty(t)&&dr(r,e,t)};Object.defineProperty(N,"__esModule",{value:!0});ot(ke(),N);ot(it(),N)});var Tr={};Tt(Tr,{GenerationError:()=>he,ResponseError:()=>z,builtinFontNames:()=>gr,builtinLineHeights:()=>ht,builtinMargins:()=>mt,builtinTextScales:()=>yt,builtinTools:()=>hr,formatEntry:()=>gt,parseEntry:()=>bt,register:()=>Er,remarkable:()=>Pr});var ct=ge(Ie()),dt=ge(qe());var le,Lt=new Uint8Array(16);function ue(){if(!le&&(le=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!le))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return le(Lt)}var Ve=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Dt(e){return typeof e=="string"&&Ve.test(e)}var K=Dt;var w=[];for(let e=0;e<256;++e)w.push((e+256).toString(16).slice(1));function Z(e,r=0){return(w[e[r+0]]+w[e[r+1]]+w[e[r+2]]+w[e[r+3]]+"-"+w[e[r+4]]+w[e[r+5]]+"-"+w[e[r+6]]+w[e[r+7]]+"-"+w[e[r+8]]+w[e[r+9]]+"-"+w[e[r+10]]+w[e[r+11]]+w[e[r+12]]+w[e[r+13]]+w[e[r+14]]+w[e[r+15]]).toLowerCase()}function $t(e){if(!K(e))throw TypeError("Invalid UUID");let r,t=new Uint8Array(16);return t[0]=(r=parseInt(e.slice(0,8),16))>>>24,t[1]=r>>>16&255,t[2]=r>>>8&255,t[3]=r&255,t[4]=(r=parseInt(e.slice(9,13),16))>>>8,t[5]=r&255,t[6]=(r=parseInt(e.slice(14,18),16))>>>8,t[7]=r&255,t[8]=(r=parseInt(e.slice(19,23),16))>>>8,t[9]=r&255,t[10]=(r=parseInt(e.slice(24,36),16))/1099511627776&255,t[11]=r/4294967296&255,t[12]=r>>>24&255,t[13]=r>>>16&255,t[14]=r>>>8&255,t[15]=r&255,t}var Pe=$t;function Ht(e){e=unescape(encodeURIComponent(e));let r=[];for(let t=0;t<e.length;++t)r.push(e.charCodeAt(t));return r}var Jt="6ba7b810-9dad-11d1-80b4-00c04fd430c8",qt="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function X(e,r,t){function n(i,o,a,f){var s;if(typeof i=="string"&&(i=Ht(i)),typeof o=="string"&&(o=Pe(o)),((s=o)===null||s===void 0?void 0:s.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+i.length);if(c.set(o),c.set(i,o.length),c=t(c),c[6]=c[6]&15|r,c[8]=c[8]&63|128,a){f=f||0;for(let l=0;l<16;++l)a[f+l]=c[l];return a}return Z(c)}try{n.name=e}catch{}return n.DNS=Jt,n.URL=qt,n}function Vt(e){if(typeof e=="string"){let r=unescape(encodeURIComponent(e));e=new Uint8Array(r.length);for(let t=0;t<r.length;++t)e[t]=r.charCodeAt(t)}return Gt(zt(Wt(e),e.length*8))}function Gt(e){let r=[],t=e.length*32,n="0123456789abcdef";for(let i=0;i<t;i+=8){let o=e[i>>5]>>>i%32&255,a=parseInt(n.charAt(o>>>4&15)+n.charAt(o&15),16);r.push(a)}return r}function Ge(e){return(e+64>>>9<<4)+14+1}function zt(e,r){e[r>>5]|=128<<r%32,e[Ge(r)-1]=r;let t=1732584193,n=-271733879,i=-1732584194,o=271733878;for(let a=0;a<e.length;a+=16){let f=t,s=n,c=i,l=o;t=v(t,n,i,o,e[a],7,-680876936),o=v(o,t,n,i,e[a+1],12,-389564586),i=v(i,o,t,n,e[a+2],17,606105819),n=v(n,i,o,t,e[a+3],22,-1044525330),t=v(t,n,i,o,e[a+4],7,-176418897),o=v(o,t,n,i,e[a+5],12,1200080426),i=v(i,o,t,n,e[a+6],17,-1473231341),n=v(n,i,o,t,e[a+7],22,-45705983),t=v(t,n,i,o,e[a+8],7,1770035416),o=v(o,t,n,i,e[a+9],12,-1958414417),i=v(i,o,t,n,e[a+10],17,-42063),n=v(n,i,o,t,e[a+11],22,-1990404162),t=v(t,n,i,o,e[a+12],7,1804603682),o=v(o,t,n,i,e[a+13],12,-40341101),i=v(i,o,t,n,e[a+14],17,-1502002290),n=v(n,i,o,t,e[a+15],22,1236535329),t=x(t,n,i,o,e[a+1],5,-165796510),o=x(o,t,n,i,e[a+6],9,-1069501632),i=x(i,o,t,n,e[a+11],14,643717713),n=x(n,i,o,t,e[a],20,-373897302),t=x(t,n,i,o,e[a+5],5,-701558691),o=x(o,t,n,i,e[a+10],9,38016083),i=x(i,o,t,n,e[a+15],14,-660478335),n=x(n,i,o,t,e[a+4],20,-405537848),t=x(t,n,i,o,e[a+9],5,568446438),o=x(o,t,n,i,e[a+14],9,-1019803690),i=x(i,o,t,n,e[a+3],14,-187363961),n=x(n,i,o,t,e[a+8],20,1163531501),t=x(t,n,i,o,e[a+13],5,-1444681467),o=x(o,t,n,i,e[a+2],9,-51403784),i=x(i,o,t,n,e[a+7],14,1735328473),n=x(n,i,o,t,e[a+12],20,-1926607734),t=E(t,n,i,o,e[a+5],4,-378558),o=E(o,t,n,i,e[a+8],11,-2022574463),i=E(i,o,t,n,e[a+11],16,1839030562),n=E(n,i,o,t,e[a+14],23,-35309556),t=E(t,n,i,o,e[a+1],4,-1530992060),o=E(o,t,n,i,e[a+4],11,1272893353),i=E(i,o,t,n,e[a+7],16,-155497632),n=E(n,i,o,t,e[a+10],23,-1094730640),t=E(t,n,i,o,e[a+13],4,681279174),o=E(o,t,n,i,e[a],11,-358537222),i=E(i,o,t,n,e[a+3],16,-722521979),n=E(n,i,o,t,e[a+6],23,76029189),t=E(t,n,i,o,e[a+9],4,-640364487),o=E(o,t,n,i,e[a+12],11,-421815835),i=E(i,o,t,n,e[a+15],16,530742520),n=E(n,i,o,t,e[a+2],23,-995338651),t=P(t,n,i,o,e[a],6,-198630844),o=P(o,t,n,i,e[a+7],10,1126891415),i=P(i,o,t,n,e[a+14],15,-1416354905),n=P(n,i,o,t,e[a+5],21,-57434055),t=P(t,n,i,o,e[a+12],6,1700485571),o=P(o,t,n,i,e[a+3],10,-1894986606),i=P(i,o,t,n,e[a+10],15,-1051523),n=P(n,i,o,t,e[a+1],21,-2054922799),t=P(t,n,i,o,e[a+8],6,1873313359),o=P(o,t,n,i,e[a+15],10,-30611744),i=P(i,o,t,n,e[a+6],15,-1560198380),n=P(n,i,o,t,e[a+13],21,1309151649),t=P(t,n,i,o,e[a+4],6,-145523070),o=P(o,t,n,i,e[a+11],10,-1120210379),i=P(i,o,t,n,e[a+2],15,718787259),n=P(n,i,o,t,e[a+9],21,-343485551),t=R(t,f),n=R(n,s),i=R(i,c),o=R(o,l)}return[t,n,i,o]}function Wt(e){if(e.length===0)return[];let r=e.length*8,t=new Uint32Array(Ge(r));for(let n=0;n<r;n+=8)t[n>>5]|=(e[n/8]&255)<<n%32;return t}function R(e,r){let t=(e&65535)+(r&65535);return(e>>16)+(r>>16)+(t>>16)<<16|t&65535}function Yt(e,r){return e<<r|e>>>32-r}function ce(e,r,t,n,i,o){return R(Yt(R(R(r,e),R(n,o)),i),t)}function v(e,r,t,n,i,o,a){return ce(r&t|~r&n,e,r,i,o,a)}function x(e,r,t,n,i,o,a){return ce(r&n|t&~n,e,r,i,o,a)}function E(e,r,t,n,i,o,a){return ce(r^t^n,e,r,i,o,a)}function P(e,r,t,n,i,o,a){return ce(t^(r|~n),e,r,i,o,a)}var ze=Vt;var Wr=X("v3",48,ze);var Kt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Te={randomUUID:Kt};function Zt(e,r,t){if(Te.randomUUID&&!r&&!e)return Te.randomUUID();e=e||{};let n=e.random||(e.rng||ue)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,r){t=t||0;for(let i=0;i<16;++i)r[t+i]=n[i];return r}return Z(n)}var Q=Zt;function Xt(e,r,t,n){switch(e){case 0:return r&t^~r&n;case 1:return r^t^n;case 2:return r&t^r&n^t&n;case 3:return r^t^n}}function Ae(e,r){return e<<r|e>>>32-r}function Qt(e){let r=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){let a=unescape(encodeURIComponent(e));e=[];for(let f=0;f<a.length;++f)e.push(a.charCodeAt(f))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);let n=e.length/4+2,i=Math.ceil(n/16),o=new Array(i);for(let a=0;a<i;++a){let f=new Uint32Array(16);for(let s=0;s<16;++s)f[s]=e[a*64+s*4]<<24|e[a*64+s*4+1]<<16|e[a*64+s*4+2]<<8|e[a*64+s*4+3];o[a]=f}o[i-1][14]=(e.length-1)*8/Math.pow(2,32),o[i-1][14]=Math.floor(o[i-1][14]),o[i-1][15]=(e.length-1)*8&4294967295;for(let a=0;a<i;++a){let f=new Uint32Array(80);for(let p=0;p<16;++p)f[p]=o[a][p];for(let p=16;p<80;++p)f[p]=Ae(f[p-3]^f[p-8]^f[p-14]^f[p-16],1);let s=t[0],c=t[1],l=t[2],m=t[3],g=t[4];for(let p=0;p<80;++p){let h=Math.floor(p/20),U=Ae(s,5)+Xt(h,c,l,m)+g+r[h]+f[p]>>>0;g=m,m=l,l=Ae(c,30)>>>0,c=s,s=U}t[0]=t[0]+s>>>0,t[1]=t[1]+c>>>0,t[2]=t[2]+l>>>0,t[3]=t[3]+m>>>0,t[4]=t[4]+g>>>0}return[t[0]>>24&255,t[0]>>16&255,t[0]>>8&255,t[0]&255,t[1]>>24&255,t[1]>>16&255,t[1]>>8&255,t[1]&255,t[2]>>24&255,t[2]>>16&255,t[2]>>8&255,t[2]&255,t[3]>>24&255,t[3]>>16&255,t[3]>>8&255,t[3]&255,t[4]>>24&255,t[4]>>16&255,t[4]>>8&255,t[4]&255]}var We=Qt;var on=X("v5",80,We);function Oe(e){return[...new Uint8Array(e)].map(r=>r.toString(16).padStart(2,"0")).join("")}function Ye(e){return new Uint8Array((e.match(/../g)??[]).map(r=>parseInt(r,16)))}function Ke(e){let r=0;for(let i of e)r+=i.length;let t=new Uint8Array(r),n=0;for(let i of e)t.set(i,n),n+=i.length;return t}var st=ge(at());function ee(e,r){if((0,st.validate)(e,r).length)throw new Error(`couldn't validate schema: ${JSON.stringify(r)} didn't match schema ${JSON.stringify(e)}`)}var ft="3",pt="https://webapp-prod.cloud.remarkable.engineering",pr="https://internal.cloud.remarkable.com",lt="x-goog-generation",yr="x-goog-if-generation-match",mr="x-goog-content-length-range",hr=["Ballpoint","Ballpointv2","Brush","Calligraphy","ClearPage","EraseSection","Eraser","Fineliner","Finelinerv2","Highlighter","Highlighterv2","Marker","Markerv2","Paintbrush","Paintbrushv2","Pencilv2","SharpPencil","SharpPencilv2","SolidPen","ZoomTool"],gr=["Maison Neue","EB Garamond","Noto Sans","Noto Serif","Noto Mono","Noto Sans UI"],yt={xs:.7,sm:.8,md:1,lg:1.2,xl:1.5,xx:2},mt={sm:50,md:125,rr:180,lg:200},ht={df:-1,md:100,lg:150,xl:200},br={properties:{docID:{type:"string"},hash:{type:"string"}}},wr={properties:{relative_path:{type:"string"},url:{type:"string"},expires:{type:"timestamp"},method:{enum:["POST","GET","PUT","DELETE"]}},optionalProperties:{maxuploadsize_bytes:{type:"float64"}}},ye={visibleName:{type:"string"},lastModified:{type:"string"}},me={version:{type:"int32"},pinned:{type:"boolean"},synced:{type:"boolean"},modified:{type:"boolean"},deleted:{type:"boolean"},metadatamodified:{type:"boolean"},parent:{type:"string"}},vr={discriminator:"type",mapping:{CollectionType:{properties:ye,optionalProperties:me},DocumentType:{properties:ye,optionalProperties:{...me,lastOpened:{type:"string"},lastOpenedPage:{type:"int32"}}}}},ut={id:{type:"string"},hash:{type:"string"}},xr={discriminator:"type",mapping:{CollectionType:{properties:{...ye,...ut},optionalProperties:me},DocumentType:{properties:{...ye,...ut,fileType:{enum:["notebook","epub","pdf",""]}},optionalProperties:{...me,lastOpened:{type:"string"},lastOpenedPage:{type:"int32"}}}}},z=class extends Error{constructor(t,n,i){super(i);this.status=t,this.statusText=n}},he=class extends Error{constructor(){super("Generation preconditions failed. This means the current state is out of date with the cloud and needs to be re-synced.")}};async function Er(e,{deviceDesc:r="browser-chrome",uuid:t=Q(),authHost:n=pt,fetch:i=globalThis.fetch}={}){if(e.length!==8)throw new Error(`code should be length 8, but was ${e.length}`);let o=await i(`${n}/token/json/2/device/new`,{method:"POST",headers:{Authorization:"Bearer"},body:JSON.stringify({code:e,deviceDesc:r,deviceID:t})});if(o.ok)return await o.text();throw new z(o.status,o.statusText,"couldn't register api")}function gt({hash:e,type:r,documentId:t,subfiles:n,size:i}){return`${e}:${r}:${t}:${n}:${i}
10
+ `}function bt(e){let[r,t,n,i,o]=e.split(":");if(r===void 0||t===void 0||n===void 0||i===void 0||o===void 0)throw new Error(`entries line didn't contain five fields: '${e}'`);if(t==="80000000")return{hash:r,type:t,documentId:n,subfiles:parseInt(i),size:BigInt(o)};if(t==="0"){if(i!=="0")throw new Error(`file type entry had nonzero number of subfiles: ${i}`);return{hash:r,type:t,documentId:n,subfiles:0,size:BigInt(o)}}else throw new Error(`entries line contained invalid type: ${t}`)}var Ce=class{#l;#s;#f;#r;#n;#e=new Map;#t=null;constructor(r,t,n,i,o,a){this.#l=r,this.#s=t,this.#f=n,this.#r=i,this.#n=o;for(let[f,s]of a)this.#e.set(f,Promise.resolve(s))}async#i(r,{body:t,method:n="POST",headers:i={}}){let o=await this.#s(r,{method:n,headers:{Authorization:`Bearer ${this.#l}`,...i},body:t});if(o.ok)return o;{let a=await o.text();throw new z(o.status,o.statusText,`failed reMarkable request: ${a}`)}}async#o({url:r,method:t,maxuploadsize_bytes:n},i,o={}){let a=n?{...o,[mr]:`0,${n}`}:o,f=await this.#s(r,{method:t,body:i,headers:a});if(f.ok)return f;{let s=await f.text();throw new z(f.status,f.statusText,s)}}async#a(r,t,n){let i=t===void 0?"downloads":"uploads",o=n&&t!==null&&t!==void 0?`{ "http_method": "PUT", "relative_path": "${r}", "root_schema": "${n}", "generation": ${t} }`:JSON.stringify({http_method:"GET",relative_path:r}),f=await(await this.#i(`${this.#r}/sync/v2/signed-urls/${i}`,{body:o})).text(),s=JSON.parse(f);return ee(wr,s),s}async getRootHash({cache:r=!0}={}){if(r)for(;this.#t;)try{let[o,a]=await this.#t;return[o,a]}catch{}let t=(async()=>{try{let o=await this.#a("root"),a=await this.#o(o),f=a.headers.get(lt);if(f)return[await a.text(),BigInt(f)];throw new Error("no generation header in root hash")}catch(o){throw this.#t=null,o}})();this.#t=t;let[n,i]=await t;return[n,i]}async putRootHash(r,t){let n=await this.#a("root",t,r),i;try{i=await this.#o(n,r,{[yr]:`${t}`})}catch(f){throw f instanceof z&&f.status===412?(this.#t=null,new he):f}let o=i.headers.get(lt);if(!o)throw new Error("no generation header in root hash");let a=BigInt(o);return this.#t=Promise.resolve([r,a]),a}async#u(r){let t=this.#e.get(r);for(;t;)try{let i=await t;if(i)return i;t=void 0}catch{t=this.#e.get(r)}let n=(async()=>{let i=await this.#a(r);return await(await this.#o(i)).arrayBuffer()})();return this.#e.set(r,n.then(i=>i.byteLength<this.#n?i:null,i=>{throw this.#e.delete(r),i})),await n}async getBuffer(r){let t=await this.#u(r);return t.byteLength<this.#n?t.slice(0):t}async getText(r){let t=await this.#u(r);return new TextDecoder().decode(t)}async getJson(r){let t=await this.getText(r);return JSON.parse(t)}async getMetadata(r){let t=await this.getJson(r);return ee(vr,t),t}async getEntries(r){if(r===void 0){let[o]=await this.getRootHash({cache:!0});r=o}let t=await this.getText(r),[n,...i]=t.slice(0,-1).split(`
11
+ `);if(n!==ft)throw new Error(`got unexpected schema version: ${n}`);return i.map(bt)}async#c(r,t){let n=this.#e.get(r);if(n)try{await n;return}catch{}let i=(async()=>{try{let o=await this.#a(r,null);return await this.#o(o,t),t.byteLength<this.#n?t:null}catch(o){throw this.#e.delete(r),o}})();this.#e.set(r,i),await i}async putEntries(r,t){let n=new TextEncoder;t.sort((l,m)=>l.documentId.localeCompare(m.documentId));let i=Ke(t.map(l=>Ye(l.hash))),o=await this.#f.digest("SHA-256",i),a=Oe(o),f=t.map(gt).join(""),s=`${ft}
12
+ ${f}`,c=n.encode(s);return await this.#c(a,c),{hash:a,type:"80000000",documentId:r,subfiles:t.length,size:0n}}async putBuffer(r,t){let n=await this.#f.digest("SHA-256",t),i=Oe(n);return await this.#c(i,t),{hash:i,type:"0",documentId:r,subfiles:0,size:BigInt(t.byteLength)}}async putText(r,t){let n=new TextEncoder;return await this.putBuffer(r,n.encode(t))}async putJson(r,t){return await this.putText(r,(0,dt.default)(t))}async putMetadata(r,t){return await this.putJson(`${r}.metadata`,t)}async putCollection(r,t=""){let n=Q(),i=`${new Date().valueOf()}`,o=[],a={type:"CollectionType",visibleName:r,version:0,parent:t,synced:!0,lastModified:i};o.push(this.putMetadata(n,a)),o.push(this.putText(`${n}.content`,"{}"));let f=await Promise.all(o);return await this.putEntries(n,f)}async#d(r,t,n,i,o){if(o.fileType!==n)throw new Error(`internal error: fileTypes don't match: ${n}, ${o.fileType}`);let a=Q(),f=`${new Date().valueOf()}`,s=[];s.push(this.putBuffer(`${a}.${n}`,t));let c={type:"DocumentType",visibleName:r,version:0,parent:i,synced:!0,lastModified:f};s.push(this.putMetadata(a,c)),s.push(this.putText(`${a}.content`,JSON.stringify(o)));let l=await Promise.all(s);return await this.putEntries(a,l)}async putEpub(r,t,{parent:n="",margins:i=125,orientation:o,textAlignment:a,textScale:f=1,lineHeight:s=-1,fontName:c="",cover:l="visited",lastTool:m}={}){let g={dummyDocument:!1,extraMetadata:{LastTool:m},fileType:"epub",pageCount:0,lastOpenedPage:0,lineHeight:typeof s=="string"?ht[s]:s,margins:typeof i=="string"?mt[i]:i,textScale:typeof f=="string"?yt[f]:f,pages:[],coverPageNumber:l==="first"?0:-1,formatVersion:1,orientation:o,textAlignment:a,fontName:c};return await this.#d(r,t,"epub",n,g)}async putPdf(r,t,{parent:n="",orientation:i,cover:o="first",lastTool:a}={}){let f={dummyDocument:!1,extraMetadata:{LastTool:a},fileType:"pdf",pageCount:0,lastOpenedPage:0,lineHeight:-1,margins:125,textScale:1,pages:[],coverPageNumber:o==="first"?0:-1,formatVersion:1,orientation:i};return await this.#d(r,t,"pdf",n,f)}async syncComplete(r){let t=`{ "generation": ${r} }`;await this.#i(`${this.#r}/sync/v2/sync-complete`,{body:t})}async#p(r,t,n){let{hash:i}=await this.putEntries("",t),o=await this.putRootHash(i,r);if(n)try{return await this.syncComplete(o),!0}catch{return!1}else return!1}async create(r,{cache:t=!0,sync:n=!0}={}){let[i,o]=await this.getRootHash({cache:t}),a=await this.getEntries(i);return a.push(r),await this.#p(o,a,n)}async move(r,t,{cache:n=!0,sync:i=!0}={}){let[o,a]=await this.getRootHash({cache:n}),f=await this.getEntries(o);if(!(!t||t==="trash")){let k=f.find(Y=>Y.documentId===t);if(k){if(k.type!=="80000000")throw new Error(`destination id was a raw file: ${t}`)}else throw new Error(`destination id not found: ${t}`);let C=await this.getEntries(k.hash),[b]=C.filter(Y=>Y.documentId===`${t}.metadata`);if(!b)throw new Error(`destination id didn't have metadata: ${t}`);if((await this.getMetadata(b.hash)).type!=="CollectionType")throw new Error(`destination id wasn't a collection: ${t}`)}let s=f.findIndex(k=>k.documentId===r);if(s===-1)throw new Error(`document not found: ${r}`);let[c]=f.splice(s,1);if(c.type!=="80000000")throw new Error(`document was a raw file: ${r}`);let l=await this.getEntries(c.hash),m=l.findIndex(k=>k.documentId===`${r}.metadata`);if(m===-1)throw new Error(`document didn't have metadata: ${r}`);let[g]=l.splice(m,1),p=await this.getMetadata(g.hash);p.parent=t;let h=await this.putMetadata(r,p);l.push(h);let U=await this.putEntries(r,l);return f.push(U),await this.#p(a,f,i)}async getEntriesMetadata(){let t=await(await this.#i(`${this.#r}/doc/v2/files`,{method:"GET",headers:{"rm-source":"RoR-Browser"}})).text(),n=JSON.parse(t);return ee({elements:xr},n),n}async#y(r,t,n){let o=new TextEncoder().encode(JSON.stringify({file_name:r})),f=await(await this.#i(`${this.#r}/doc/v2/files`,{body:t,headers:{"content-type":n,"rm-meta":(0,ct.fromByteArray)(o),"rm-source":"RoR-Browser"}})).text(),s=JSON.parse(f);return ee(br,s),s}async uploadEpub(r,t){return await this.#y(r,t,"application/epub+zip")}async uploadPdf(r,t){return await this.#y(r,t,"application/pdf")}async getCache(){let r=[];for(let[i,o]of this.#e)r.push(o.then(a=>[i,a],()=>[i,null]));let t=await Promise.all(r),n=new Map;for(let[i,o]of t)o&&n.set(i,o);return n}};async function Pr(e,{fetch:r=globalThis.fetch,subtle:t=globalThis.crypto?.subtle,authHost:n=pt,syncHost:i=pr,cacheLimitBytes:o=1048576,initCache:a=[]}={}){if(!t)throw new Error("subtle was missing, try specifying it manually");let f=await r(`${n}/token/json/2/user/new`,{method:"POST",headers:{Authorization:`Bearer ${e}`}});if(!f.ok)throw new Error(`couldn't fetch auth token: ${f.statusText}`);let s=await f.text();return new Ce(s,r,t,i,o,a)}return At(Tr);})();
package/dist/index.d.ts CHANGED
@@ -188,8 +188,6 @@ export interface Content {
188
188
  /** text alignment */
189
189
  textAlignment?: TextAlignment;
190
190
  }
191
- /** anything that can be awaited */
192
- export type Awaitable<T> = T | PromiseLike<T>;
193
191
  /** stripped down version of RequestInit */
194
192
  export interface RequestInitLike {
195
193
  /** request method */
@@ -215,20 +213,20 @@ export interface ResponseLike {
215
213
  /** headers in response */
216
214
  headers: HeadersLike;
217
215
  /** get response body as text */
218
- text(): Awaitable<string>;
216
+ text(): Promise<string>;
219
217
  /** get response body as an array buffer */
220
- arrayBuffer(): Awaitable<ArrayBuffer>;
218
+ arrayBuffer(): Promise<ArrayBuffer>;
221
219
  }
222
220
  /** stripped down version of fetch */
223
221
  export interface FetchLike {
224
- (url: string, options?: RequestInitLike | undefined): Awaitable<ResponseLike>;
222
+ (url: string, options?: RequestInitLike | undefined): Promise<ResponseLike>;
225
223
  }
226
224
  /** async storage, map like */
227
225
  export interface CacheLike {
228
226
  /** get value for key or undefined if missing */
229
- get(key: string): Awaitable<string | undefined>;
227
+ get(key: string): Promise<string | undefined>;
230
228
  /** set value for key */
231
- set(key: string, value: string): Awaitable<void>;
229
+ set(key: string, value: string): Promise<void>;
232
230
  }
233
231
  /** stripped down version of subtle crypto */
234
232
  export interface SubtleCryptoLike {
@@ -302,6 +300,35 @@ export interface PutEpubOptions {
302
300
  /** the tool to have enabled by default */
303
301
  lastTool?: string;
304
302
  }
303
+ /**
304
+ * options for {@link RemarkableApi.getRootHash | `getRootHash`}
305
+ */
306
+ export interface GetRootHashOptions {
307
+ /**
308
+ * whether to use the last known valid root hash
309
+ *
310
+ * @defaultValue true
311
+ */
312
+ cache?: boolean;
313
+ }
314
+ /**
315
+ * options for {@link RemarkableApi.create | `create`} and
316
+ * {@link RemarkableApi.move | `move`}
317
+ */
318
+ export interface CreateMoveOptions {
319
+ /**
320
+ * whether to use the last known valid root hash
321
+ *
322
+ * @defaultValue true
323
+ */
324
+ cache?: boolean;
325
+ /**
326
+ * whether broadcast syncing complete to other devices
327
+ *
328
+ * @defaultValue true
329
+ */
330
+ sync?: boolean;
331
+ }
305
332
  /** options for uploading a pdf */
306
333
  export interface PutPdfOptions {
307
334
  /** the parent id, default to root */
@@ -322,7 +349,7 @@ export interface RemarkableApi {
322
349
  *
323
350
  * If this hasn't changed, then neither have any of the files.
324
351
  */
325
- getRootHash(): Promise<[string, bigint]>;
352
+ getRootHash(options?: GetRootHashOptions): Promise<[string, bigint]>;
326
353
  /**
327
354
  * write the root hash, incrimenting from the current generation
328
355
  *
@@ -356,28 +383,41 @@ export interface RemarkableApi {
356
383
  /**
357
384
  * get text content associated with hash
358
385
  *
359
- * This call uses the cache if provided since contents of a specific hash
360
- * should never change. This isn't atomic so calling with the same hash in
361
- * quick succession could result in two requests being fired instead of the
362
- * second waiting for the first.
363
- *
364
386
  * @param hash - the hash to get text data from
365
387
  */
366
388
  getText(hash: string): Promise<string>;
389
+ /**
390
+ * get a json object associated with a hash
391
+ *
392
+ * This is identical to `getText(hash).then(JSON.parse)` and is only provided
393
+ * for consistency with {@link RemarkableApi.putJson | `putJson`}.
394
+ */
395
+ getJson(hash: string): Promise<unknown>;
367
396
  /** get metadata from hash */
368
397
  getMetadata(hash: string): Promise<Metadata>;
369
- /** get entries from a collection hash */
370
- getEntries(hash: string): Promise<Entry[]>;
398
+ /**
399
+ * get entries from a collection hash
400
+ *
401
+ * If omitted, this will use `getRootHash()`.
402
+ */
403
+ getEntries(hash?: string): Promise<Entry[]>;
371
404
  /** put a reference to a set of entries into the cloud */
372
405
  putEntries(documentId: string, entries: Entry[]): Promise<CollectionEntry>;
373
406
  /** put a raw buffer in the cloud */
374
- putBuffer(documentId: string, buffer: Uint8Array): Promise<FileEntry>;
407
+ putBuffer(documentId: string, buffer: ArrayBuffer): Promise<FileEntry>;
375
408
  /**
376
- * put a raw text in the cloud
409
+ * put a raw text in the cloud encoded as utf-8
377
410
  *
378
- * This is similar to `putBuffer` but will also cache the upload.
411
+ * this is no different than using `putBuffer(..., new TextEncoder().encode(contents))`
379
412
  */
380
413
  putText(documentId: string, contents: string): Promise<FileEntry>;
414
+ /**
415
+ * put json into the cloud
416
+ *
417
+ * This uses a stable (sorted keys) json serilization to preserve consistent
418
+ * hashes.
419
+ */
420
+ putJson(documentId: string, contents: object): Promise<FileEntry>;
381
421
  /**
382
422
  * put metadata into the cloud
383
423
  *
@@ -417,7 +457,7 @@ export interface RemarkableApi {
417
457
  * @param buffer - the epub contents
418
458
  * @param opts - extra options you can specify at upload
419
459
  */
420
- putEpub(visibleName: string, buffer: Uint8Array, opts?: PutEpubOptions): Promise<CollectionEntry>;
460
+ putEpub(visibleName: string, buffer: ArrayBuffer, opts?: PutEpubOptions): Promise<CollectionEntry>;
421
461
  /**
422
462
  * upload a pdf
423
463
  *
@@ -440,7 +480,7 @@ export interface RemarkableApi {
440
480
  * @param buffer - the pdf contents
441
481
  * @param opts - extra options you can specify at upload
442
482
  */
443
- putPdf(visibleName: string, buffer: Uint8Array, opts?: PutPdfOptions): Promise<CollectionEntry>;
483
+ putPdf(visibleName: string, buffer: ArrayBuffer, opts?: PutPdfOptions): Promise<CollectionEntry>;
444
484
  /**
445
485
  * indicate that a sync is complete and push updates to other devices
446
486
  *
@@ -467,6 +507,10 @@ export interface RemarkableApi {
467
507
  * 2. It includes no handling of concurrent modification or other networking
468
508
  * errors, requiring repeat network requests if anything fails.
469
509
  *
510
+ * However, with recent changes in the way this library caches results, it
511
+ * won't be terribly inefficient to just do multiple retries of create after
512
+ * uploading the file itself.
513
+ *
470
514
  * @example
471
515
  * ```ts
472
516
  * const entry = await api.putEpub(...);
@@ -479,7 +523,7 @@ export interface RemarkableApi {
479
523
  * @throws error - if any error occurred, in this case, nothing will be
480
524
  * changed
481
525
  */
482
- create(entry: CollectionEntry, sync?: boolean): Promise<boolean>;
526
+ create(entry: CollectionEntry, options?: CreateMoveOptions): Promise<boolean>;
483
527
  /**
484
528
  * high level api to move a document / collection
485
529
  *
@@ -495,6 +539,9 @@ export interface RemarkableApi {
495
539
  * 2. It includes no handling of concurrent modification or other networking
496
540
  * errors, requiring repeat network requests if anything fails.
497
541
  *
542
+ * However, with changes to the way this caches results, it won't be terribly
543
+ * inefficient to just retry calling `move` if there's a failure.
544
+ *
498
545
  * @example
499
546
  * ```ts
500
547
  * const [root] = await api.getRootHash();
@@ -512,7 +559,7 @@ export interface RemarkableApi {
512
559
  * @throws error - if any error occurred, in this case, nothing will be
513
560
  * changed
514
561
  */
515
- move(documentId: string, dest: string, sync?: boolean): Promise<boolean>;
562
+ move(documentId: string, dest: string, opts?: CreateMoveOptions): Promise<boolean>;
516
563
  /**
517
564
  * get metadata on all entries
518
565
  *
@@ -535,7 +582,7 @@ export interface RemarkableApi {
535
582
  * @param visibleName - the name to show for the uploaded epub
536
583
  * @param buffer - the epub contents
537
584
  */
538
- uploadEpub(visibleName: string, buffer: Uint8Array): Promise<UploadEntry>;
585
+ uploadEpub(visibleName: string, buffer: ArrayBuffer): Promise<UploadEntry>;
539
586
  /**
540
587
  * upload a pdf
541
588
  *
@@ -555,7 +602,14 @@ export interface RemarkableApi {
555
602
  * @param buffer - the epub contents
556
603
  * @experimental
557
604
  */
558
- uploadPdf(visibleName: string, buffer: Uint8Array): Promise<UploadEntry>;
605
+ uploadPdf(visibleName: string, buffer: ArrayBuffer): Promise<UploadEntry>;
606
+ /**
607
+ * get the current state of the cache for persisting
608
+ *
609
+ * This won't include items that weren't cached because they were too big,
610
+ * meaning it won't prevent duplicate puts of large content across sessions.
611
+ */
612
+ getCache(): Promise<Map<string, ArrayBuffer>>;
559
613
  }
560
614
  /** format an entry */
561
615
  export declare function formatEntry({ hash, type, documentId, subfiles, size, }: Entry): string;
@@ -572,20 +626,10 @@ export interface RemarkableOptions {
572
626
  *
573
627
  * In node you can either use `"node-fetch"`, or `node --experimental-fetch`
574
628
  * for node 17.5 or higher.
575
- */
576
- fetch?: FetchLike;
577
- /**
578
- * an optional cache for text requests
579
- *
580
- * If you're using the api to sync between a local copy and the cloud, you'll
581
- * want to keep a cache so that as long as a file's hash doesn't change you
582
- * don't need to request another copy.
583
629
  *
584
- * @remarks currently there are no mechanisms that actually clear the cache,
585
- * so be warned if the cache doesn't have an auto clearning mechansim that
586
- * some old files may stay around for quite a while
630
+ * @defaultValue globalThis.fetch
587
631
  */
588
- cache?: CacheLike;
632
+ fetch?: FetchLike;
589
633
  /**
590
634
  * a subtle-crypto-like object
591
635
  *
@@ -593,14 +637,43 @@ export interface RemarkableOptions {
593
637
  * default value. In node try
594
638
  * `import { webcrypto } from "crypto"; global.crypto = webcrypto` or pass in
595
639
  * `webcrypto.subtle`.
640
+ *
641
+ * @defaultValue globalThis.crypto.subtle
596
642
  */
597
643
  subtle?: SubtleCryptoLike;
598
- /** the url for making authorization requests */
644
+ /**
645
+ * the url for making authorization requests
646
+ *
647
+ * @defaultValue "https://webapp-prod.cloud.remarkable.engineering"
648
+ */
599
649
  authHost?: string;
600
- /** the url for making raw document requests */
601
- docHost?: string;
602
- /** the url for making synchronization requests */
650
+ /**
651
+ * the url for making synchronization requests
652
+ *
653
+ * @defaultValue "https://internal.cloud.remarkable.com"
654
+ */
603
655
  syncHost?: string;
656
+ /**
657
+ * the maximum size in bytes to cache the value of a stored object
658
+ *
659
+ * Since the remarkableApi is based around hashes, the value of a hash should
660
+ * never change (barring collisions in ASH256). Any known hash value that's
661
+ * less than this amount will be cached locally to prevent future network
662
+ * requests. In addition, all successful puts and gets will be cached to
663
+ * prevent duplicate puts in the future.
664
+ *
665
+ * To save memory and disable fetch caching, set to 0.
666
+ *
667
+ * @defaultValue 1 MiB
668
+ */
669
+ cacheLimitBytes?: number;
670
+ /**
671
+ * a set of values to use to initialize the cache
672
+ *
673
+ * If this is inaccurate, then you could encounter errors with other methods.
674
+ * Often this will come from {@link RemarkableApi.getCache | `getCache`}.
675
+ */
676
+ initCache?: Iterable<readonly [string, ArrayBuffer]>;
604
677
  }
605
678
  /**
606
679
  * create an instance of the api
@@ -612,4 +685,4 @@ export interface RemarkableOptions {
612
685
  * registered. Create one with {@link register}.
613
686
  * @returns an api instance
614
687
  */
615
- export declare function remarkable(deviceToken: string, { fetch, cache, subtle, authHost, syncHost, }?: RemarkableOptions): Promise<RemarkableApi>;
688
+ export declare function remarkable(deviceToken: string, { fetch, subtle, authHost, syncHost, cacheLimitBytes, initCache, }?: RemarkableOptions): Promise<RemarkableApi>;