rmapi-js 3.0.2 → 4.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.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [4.0.0] - 2024-04-03
12
+
13
+ ### Added
14
+
15
+ - `verify` option to some calls to disable verifying that requests follow the
16
+ expected format. Note that disabling verification will break typescripts
17
+ guarantees, and so it's only recommend if you know what you're doing.
18
+
19
+ ### Modified
20
+
21
+ - `lastModified` is now optional. This might break some code that replied on it
22
+ to be present.
23
+
24
+ ## [3.1.0] - 2023-12-05
25
+
26
+ ### Added
27
+
28
+ - `createdTime` to `DocumentType` metadata, and permissive parsing of metadata
29
+ going forward.
30
+
11
31
  ## [3.0.0] - 2023-01-03
12
32
 
13
33
  ### Added
@@ -1,12 +1,12 @@
1
- "use strict";var ft=Object.create;var Z=Object.defineProperty;var ut=Object.getOwnPropertyDescriptor;var lt=Object.getOwnPropertyNames;var ct=Object.getPrototypeOf,pt=Object.prototype.hasOwnProperty;var S=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),dt=(e,t)=>{for(var r in t)Z(e,r,{get:t[r],enumerable:!0})},xe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of lt(t))!pt.call(e,i)&&i!==r&&Z(e,i,{get:()=>t[i],enumerable:!(n=ut(t,i))||n.enumerable});return e};var z=(e,t,r)=>(r=e!=null?ft(ct(e)):{},xe(t||!e||!e.__esModule?Z(r,"default",{value:e,enumerable:!0}):r,e)),yt=e=>xe(Z({},"__esModule",{value:!0}),e);var Te=S(K=>{"use strict";K.byteLength=ht;K.toByteArray=bt;K.fromByteArray=xt;var O=[],T=[],mt=typeof Uint8Array<"u"?Uint8Array:Array,ue="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(B=0,Ee=ue.length;B<Ee;++B)O[B]=ue[B],T[ue.charCodeAt(B)]=B;var B,Ee;T["-".charCodeAt(0)]=62;T["_".charCodeAt(0)]=63;function Pe(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function ht(e){var t=Pe(e),r=t[0],n=t[1];return(r+n)*3/4-n}function gt(e,t,r){return(t+r)*3/4-r}function bt(e){var t,r=Pe(e),n=r[0],i=r[1],o=new mt(gt(e,n,i)),a=0,f=i>0?n-4:n,s;for(s=0;s<f;s+=4)t=T[e.charCodeAt(s)]<<18|T[e.charCodeAt(s+1)]<<12|T[e.charCodeAt(s+2)]<<6|T[e.charCodeAt(s+3)],o[a++]=t>>16&255,o[a++]=t>>8&255,o[a++]=t&255;return i===2&&(t=T[e.charCodeAt(s)]<<2|T[e.charCodeAt(s+1)]>>4,o[a++]=t&255),i===1&&(t=T[e.charCodeAt(s)]<<10|T[e.charCodeAt(s+1)]<<4|T[e.charCodeAt(s+2)]>>2,o[a++]=t>>8&255,o[a++]=t&255),o}function vt(e){return O[e>>18&63]+O[e>>12&63]+O[e>>6&63]+O[e&63]}function wt(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),i.push(vt(n));return i.join("")}function xt(e){for(var t,r=e.length,n=r%3,i=[],o=16383,a=0,f=r-n;a<f;a+=o)i.push(wt(e,a,a+o>f?f:a+o));return n===1?(t=e[r-1],i.push(O[t>>2]+O[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(O[t>>10]+O[t>>4&63]+O[t<<2&63]+"=")),i.join("")}});var Fe=S((rr,ke)=>{"use strict";var W,l,Ae={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
2
- `,r:"\r",t:" "},le;function M(e){throw{name:"SyntaxError",message:e,at:W,text:le}}function c(e){return e&&e!==l&&M("Expected '"+e+"' instead of '"+l+"'"),l=le.charAt(W),W+=1,l}function Oe(){var e,t="";for(l==="-"&&(t="-",c("-"));l>="0"&&l<="9";)t+=l,c();if(l===".")for(t+=".";c()&&l>="0"&&l<="9";)t+=l;if(l==="e"||l==="E")for(t+=l,c(),(l==="-"||l==="+")&&(t+=l,c());l>="0"&&l<="9";)t+=l,c();return e=Number(t),isFinite(e)||M("Bad number"),e}function Se(){var e,t,r="",n;if(l==='"')for(;c();){if(l==='"')return c(),r;if(l==="\\")if(c(),l==="u"){for(n=0,t=0;t<4&&(e=parseInt(c(),16),!!isFinite(e));t+=1)n=n*16+e;r+=String.fromCharCode(n)}else if(typeof Ae[l]=="string")r+=Ae[l];else break;else r+=l}M("Bad string")}function k(){for(;l&&l<=" ";)c()}function Et(){switch(l){case"t":return c("t"),c("r"),c("u"),c("e"),!0;case"f":return c("f"),c("a"),c("l"),c("s"),c("e"),!1;case"n":return c("n"),c("u"),c("l"),c("l"),null;default:M("Unexpected '"+l+"'")}}function Pt(){var e=[];if(l==="["){if(c("["),k(),l==="]")return c("]"),e;for(;l;){if(e.push(Q()),k(),l==="]")return c("]"),e;c(","),k()}}M("Bad array")}function Tt(){var e,t={};if(l==="{"){if(c("{"),k(),l==="}")return c("}"),t;for(;l;){if(e=Se(),k(),c(":"),Object.prototype.hasOwnProperty.call(t,e)&&M('Duplicate key "'+e+'"'),t[e]=Q(),k(),l==="}")return c("}"),t;c(","),k()}}M("Bad object")}function Q(){switch(k(),l){case"{":return Tt();case"[":return Pt();case'"':return Se();case"-":return Oe();default:return l>="0"&&l<="9"?Oe():Et()}}ke.exports=function(e,t){var r;return le=e,W=0,l=" ",r=Q(),k(),l&&M("Syntax error"),typeof t=="function"?function n(i,o){var a,f,s=i[o];if(s&&typeof s=="object")for(a in Q)Object.prototype.hasOwnProperty.call(s,a)&&(f=n(s,a),typeof f>"u"?delete s[a]:s[a]=f);return t.call(i,o,s)}({"":r},""):r}});var Ce=S((nr,Me)=>{"use strict";var ce=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,E,X,At={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},I;function pe(e){return ce.lastIndex=0,ce.test(e)?'"'+e.replace(ce,function(t){var r=At[t];return typeof r=="string"?r:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function ee(e,t){var r,n,i,o,a=E,f,s=t[e];switch(s&&typeof s=="object"&&typeof s.toJSON=="function"&&(s=s.toJSON(e)),typeof I=="function"&&(s=I.call(t,e,s)),typeof s){case"string":return pe(s);case"number":return isFinite(s)?String(s):"null";case"boolean":case"null":return String(s);case"object":if(!s)return"null";if(E+=X,f=[],Object.prototype.toString.apply(s)==="[object Array]"){for(o=s.length,r=0;r<o;r+=1)f[r]=ee(r,s)||"null";return i=f.length===0?"[]":E?`[
3
- `+E+f.join(`,
4
- `+E)+`
5
- `+a+"]":"["+f.join(",")+"]",E=a,i}if(I&&typeof I=="object")for(o=I.length,r=0;r<o;r+=1)n=I[r],typeof n=="string"&&(i=ee(n,s),i&&f.push(pe(n)+(E?": ":":")+i));else for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(i=ee(n,s),i&&f.push(pe(n)+(E?": ":":")+i));return i=f.length===0?"{}":E?`{
6
- `+E+f.join(`,
7
- `+E)+`
8
- `+a+"}":"{"+f.join(",")+"}",E=a,i;default:}}Me.exports=function(e,t,r){var n;if(E="",X="",typeof r=="number")for(n=0;n<r;n+=1)X+=" ";else typeof r=="string"&&(X=r);if(I=t,t&&typeof t!="function"&&(typeof t!="object"||typeof t.length!="number"))throw new Error("JSON.stringify");return ee("",{"":e})}});var je=S(de=>{"use strict";de.parse=Fe();de.stringify=Ce()});var Ie=S((or,Be)=>{"use strict";var te=typeof JSON<"u"?JSON:je(),Ot=Array.isArray||function(e){return{}.toString.call(e)==="[object Array]"},St=Object.keys||function(e){var t=Object.prototype.hasOwnProperty||function(){return!0},r=[];for(var n in e)t.call(e,n)&&r.push(n);return r};Be.exports=function(e,t){t||(t={}),typeof t=="function"&&(t={cmp:t});var r=t.space||"";typeof r=="number"&&(r=Array(r+1).join(" "));var n=typeof t.cycles=="boolean"?t.cycles:!1,i=t.replacer||function(f,s){return s},o=t.cmp&&function(f){return function(s){return function(p,u){var g={key:p,value:s[p]},x={key:u,value:s[u]};return f(g,x)}}}(t.cmp),a=[];return function f(s,p,u,g){var x=r?`
9
- `+new Array(g+1).join(r):"",F=r?": ":":";if(u&&u.toJSON&&typeof u.toJSON=="function"&&(u=u.toJSON()),u=i.call(s,p,u),u!==void 0){if(typeof u!="object"||u===null)return te.stringify(u);if(Ot(u)){for(var A=[],y=0;y<u.length;y++){var J=f(u,y,u[y],g+1)||te.stringify(null);A.push(x+r+J)}return"["+A.join(",")+x+"]"}if(a.indexOf(u)!==-1){if(n)return te.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}else a.push(u);for(var P=St(u).sort(o&&o(u)),A=[],y=0;y<P.length;y++){var p=P[y],m=f(u,p,u[p],g+1);if(m){var Y=te.stringify(p)+F+m;A.push(x+r+Y)}}return a.splice(a.indexOf(u),1),"{"+A.join(",")+x+"}"}}({"":e},"",e,0)}});var be=S(d=>{"use strict";var De=d&&d.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};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 Ft(e){let{definitions:t,nullable:r,metadata:n}=e,i=De(e,["definitions","nullable","metadata"]);return Object.keys(i).length===0}d.isEmptyForm=Ft;function He(e){return"ref"in e}d.isRefForm=He;function Mt(e){return"type"in e}d.isTypeForm=Mt;function Ue(e){return"enum"in e}d.isEnumForm=Ue;function Je(e){return"elements"in e}d.isElementsForm=Je;function ge(e){return"properties"in e||"optionalProperties"in e}d.isPropertiesForm=ge;function qe(e){return"values"in e}d.isValuesForm=qe;function ze(e){return"discriminator"in e}d.isDiscriminatorForm=ze;function R(e,t){if(t===void 0&&(t=e),e.definitions!==void 0){if(t!==e)return!1;for(let r of Object.values(e.definitions))if(!R(r,t))return!1}if(He(e)&&!(e.ref in(t.definitions||{}))||Ue(e)&&(e.enum.length===0||e.enum.length!==new Set(e.enum).size))return!1;if(Je(e))return R(e.elements,t);if(ge(e)){for(let r of Object.values(e.properties||{}))if(!R(r,t))return!1;for(let r of Object.values(e.optionalProperties||{}))if(!R(r,t))return!1;for(let r of Object.keys(e.properties||{}))if(r in(e.optionalProperties||{}))return!1}if(qe(e))return R(e.values,t);if(ze(e)){for(let r of Object.values(e.mapping))if(!R(r,t)||!ge(r)||r.nullable||e.discriminator in(r.properties||{})||e.discriminator in(r.optionalProperties||{}))return!1}return!0}d.isValidSchema=R;var Ct=[[!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]],jt=["boolean","float32","float64","int8","uint8","int16","uint16","int32","uint32","string","timestamp"];function _(e){if(typeof e!="object"||Array.isArray(e)||e===null)return!1;let t=e,{definitions:r=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:p=void 0,optionalProperties:u=void 0,additionalProperties:g=void 0,values:x=void 0,discriminator:F=void 0,mapping:y=void 0}=t,J=De(t,["definitions","nullable","metadata","ref","type","enum","elements","properties","optionalProperties","additionalProperties","values","discriminator","mapping"]),P=[o!==void 0,a!==void 0,f!==void 0,s!==void 0,p!==void 0,u!==void 0,g!==void 0,x!==void 0,F!==void 0,y!==void 0],A=!1;for(let m of Ct)A=A||m.every((Y,q)=>Y===P[q]);if(!A)return!1;if(r!==void 0){if(typeof r!="object"||Array.isArray(r)||r===null)return!1;for(let m of Object.values(r))if(!_(m))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"||!jt.includes(a))||f!==void 0&&(!Array.isArray(f)||!f.every(m=>typeof m=="string"))||s!==void 0&&!_(s))return!1;if(p!==void 0){if(typeof p!="object"||Array.isArray(p)||p===null)return!1;for(let m of Object.values(p))if(!_(m))return!1}if(u!==void 0){if(typeof u!="object"||Array.isArray(u)||u===null)return!1;for(let m of Object.values(u))if(!_(m))return!1}if(g!==void 0&&typeof g!="boolean"||x!==void 0&&!_(x)||F!==void 0&&typeof F!="string")return!1;if(y!==void 0){if(typeof y!="object"||Array.isArray(y)||y===null)return!1;for(let m of Object.values(y))if(!_(m))return!1}return Object.keys(J).length===0}d.isSchema=_});var Ge=S(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});var Bt=/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(\.\d+)?([zZ]|((\+|-)(\d{2}):(\d{2})))$/;function It(e){let t=e.match(Bt);if(t===null)return!1;let r=parseInt(t[1],10),n=parseInt(t[2],10),i=parseInt(t[3],10),o=parseInt(t[4],10),a=parseInt(t[5],10),f=parseInt(t[6],10);return!(n>12||i>Rt(r,n)||o>23||a>59||f>60)}ve.default=It;function Rt(e,t){return t===2?_t(e)?29:28:Nt[t]}function _t(e){return e%4===0&&(e%100!==0||e%400===0)}var Nt=[0,31,0,31,30,31,30,31,31,30,31,30,31]});var Ve=S(C=>{"use strict";var $t=C&&C.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(C,"__esModule",{value:!0});C.validate=C.MaxDepthExceededError=void 0;var Lt=$t(Ge()),N=be(),ie=class extends Error{};C.MaxDepthExceededError=ie;var oe=class extends Error{};function Dt(e,t,r){let n={errors:[],instanceTokens:[],schemaTokens:[[]],root:e,config:r||{maxDepth:0,maxErrors:0}};try{D(n,e,t)}catch(i){if(!(i instanceof oe))throw i}return n.errors}C.validate=Dt;function D(e,t,r,n){if(!(t.nullable&&r===null)){if(N.isRefForm(t)){if(e.schemaTokens.length===e.config.maxDepth)throw new ie;e.schemaTokens.push(["definitions",t.ref]),D(e,e.root.definitions[t.ref],r),e.schemaTokens.pop()}else if(N.isTypeForm(t)){switch(b(e,"type"),t.type){case"boolean":typeof r!="boolean"&&v(e);break;case"float32":case"float64":typeof r!="number"&&v(e);break;case"int8":U(e,r,-128,127);break;case"uint8":U(e,r,0,255);break;case"int16":U(e,r,-32768,32767);break;case"uint16":U(e,r,0,65535);break;case"int32":U(e,r,-2147483648,2147483647);break;case"uint32":U(e,r,0,4294967295);break;case"string":typeof r!="string"&&v(e);break;case"timestamp":typeof r!="string"?v(e):Lt.default(r)||v(e);break}w(e)}else if(N.isEnumForm(t))b(e,"enum"),(typeof r!="string"||!t.enum.includes(r))&&v(e),w(e);else if(N.isElementsForm(t)){if(b(e,"elements"),Array.isArray(r))for(let[i,o]of r.entries())$(e,i.toString()),D(e,t.elements,o),L(e);else v(e);w(e)}else if(N.isPropertiesForm(t))if(typeof r=="object"&&r!==null&&!Array.isArray(r)){if(t.properties!==void 0){b(e,"properties");for(let[i,o]of Object.entries(t.properties))b(e,i),r.hasOwnProperty(i)?($(e,i),D(e,o,r[i]),L(e)):v(e),w(e);w(e)}if(t.optionalProperties!==void 0){b(e,"optionalProperties");for(let[i,o]of Object.entries(t.optionalProperties))b(e,i),r.hasOwnProperty(i)&&($(e,i),D(e,o,r[i]),L(e)),w(e);w(e)}if(t.additionalProperties!==!0)for(let i of Object.keys(r)){let o=t.properties&&i in t.properties,a=t.optionalProperties&&i in t.optionalProperties;!o&&!a&&i!==n&&($(e,i),v(e),L(e))}}else t.properties!==void 0?b(e,"properties"):b(e,"optionalProperties"),v(e),w(e);else if(N.isValuesForm(t)){if(b(e,"values"),typeof r=="object"&&r!==null&&!Array.isArray(r))for(let[i,o]of Object.entries(r))$(e,i),D(e,t.values,o),L(e);else v(e);w(e)}else if(N.isDiscriminatorForm(t))if(typeof r=="object"&&r!==null&&!Array.isArray(r))if(r.hasOwnProperty(t.discriminator)){let i=r[t.discriminator];typeof i=="string"?i in t.mapping?(b(e,"mapping"),b(e,i),D(e,t.mapping[i],r,t.discriminator),w(e),w(e)):(b(e,"mapping"),$(e,t.discriminator),v(e),L(e),w(e)):(b(e,"discriminator"),$(e,t.discriminator),v(e),L(e),w(e))}else b(e,"discriminator"),v(e),w(e);else b(e,"discriminator"),v(e),w(e)}}function U(e,t,r,n){(typeof t!="number"||!Number.isInteger(t)||t<r||t>n)&&v(e)}function $(e,t){e.instanceTokens.push(t)}function L(e){e.instanceTokens.pop()}function b(e,t){e.schemaTokens[e.schemaTokens.length-1].push(t)}function w(e){e.schemaTokens[e.schemaTokens.length-1].pop()}function v(e){if(e.errors.push({instancePath:[...e.instanceTokens],schemaPath:[...e.schemaTokens[e.schemaTokens.length-1]]}),e.errors.length===e.config.maxErrors)throw new oe}});var Ze=S(j=>{"use strict";var Ht=j&&j.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Ye=j&&j.__exportStar||function(e,t){for(var r in e)r!=="default"&&!t.hasOwnProperty(r)&&Ht(t,e,r)};Object.defineProperty(j,"__esModule",{value:!0});Ye(be(),j);Ye(Ve(),j)});var Xt={};dt(Xt,{GenerationError:()=>fe,ResponseError:()=>H,builtinFontNames:()=>Gt,builtinLineHeights:()=>ot,builtinMargins:()=>it,builtinTextScales:()=>nt,builtinTools:()=>zt,formatEntry:()=>st,parseEntry:()=>at,register:()=>Wt,remarkable:()=>Qt});module.exports=yt(Xt);var et=z(Te()),tt=z(Ie());var Re=z(require("crypto")),ne=new Uint8Array(256),re=ne.length;function ye(){return re>ne.length-16&&(Re.default.randomFillSync(ne),re=0),ne.slice(re,re+=16)}var h=[];for(let e=0;e<256;++e)h.push((e+256).toString(16).slice(1));function _e(e,t=0){return(h[e[t+0]]+h[e[t+1]]+h[e[t+2]]+h[e[t+3]]+"-"+h[e[t+4]]+h[e[t+5]]+"-"+h[e[t+6]]+h[e[t+7]]+"-"+h[e[t+8]]+h[e[t+9]]+"-"+h[e[t+10]]+h[e[t+11]]+h[e[t+12]]+h[e[t+13]]+h[e[t+14]]+h[e[t+15]]).toLowerCase()}var Ne=z(require("crypto")),me={randomUUID:Ne.default.randomUUID};function kt(e,t,r){if(me.randomUUID&&!t&&!e)return me.randomUUID();e=e||{};let n=e.random||(e.rng||ye)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return _e(n)}var G=kt;function he(e){return[...new Uint8Array(e)].map(t=>t.toString(16).padStart(2,"0")).join("")}function $e(e){return new Uint8Array((e.match(/../g)??[]).map(t=>parseInt(t,16)))}function Le(e){let t=0;for(let i of e)t+=i.length;let r=new Uint8Array(t),n=0;for(let i of e)r.set(i,n),n+=i.length;return r}var Ke=z(Ze());function V(e,t){if((0,Ke.validate)(e,t).length)throw new Error(`couldn't validate schema: ${JSON.stringify(t)} didn't match schema ${JSON.stringify(e)}`)}var We="3",rt="https://webapp-prod.cloud.remarkable.engineering",Ut="https://internal.cloud.remarkable.com",Qe="x-goog-generation",Jt="x-goog-if-generation-match",qt="x-goog-content-length-range",zt=["Ballpoint","Ballpointv2","Brush","Calligraphy","ClearPage","EraseSection","Eraser","Fineliner","Finelinerv2","Highlighter","Highlighterv2","Marker","Markerv2","Paintbrush","Paintbrushv2","Pencilv2","SharpPencil","SharpPencilv2","SolidPen","ZoomTool"],Gt=["Maison Neue","EB Garamond","Noto Sans","Noto Serif","Noto Mono","Noto Sans UI"],nt={xs:.7,sm:.8,md:1,lg:1.2,xl:1.5,xx:2},it={sm:50,md:125,rr:180,lg:200},ot={df:-1,md:100,lg:150,xl:200},Vt={properties:{docID:{type:"string"},hash:{type:"string"}}},Yt={properties:{relative_path:{type:"string"},url:{type:"string"},expires:{type:"timestamp"},method:{enum:["POST","GET","PUT","DELETE"]}},optionalProperties:{maxuploadsize_bytes:{type:"float64"}}},se={visibleName:{type:"string"},lastModified:{type:"string"}},ae={version:{type:"int32"},pinned:{type:"boolean"},synced:{type:"boolean"},modified:{type:"boolean"},deleted:{type:"boolean"},metadatamodified:{type:"boolean"},parent:{type:"string"}},Zt={discriminator:"type",mapping:{CollectionType:{properties:se,optionalProperties:ae},DocumentType:{properties:se,optionalProperties:{...ae,lastOpened:{type:"string"},lastOpenedPage:{type:"int32"}}}}},Xe={id:{type:"string"},hash:{type:"string"}},Kt={discriminator:"type",mapping:{CollectionType:{properties:{...se,...Xe},optionalProperties:ae},DocumentType:{properties:{...se,...Xe,fileType:{enum:["notebook","epub","pdf",""]}},optionalProperties:{...ae,lastOpened:{type:"string"},lastOpenedPage:{type:"int32"}}}}},H=class extends Error{status;statusText;constructor(t,r,n){super(n),this.status=t,this.statusText=r}},fe=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 Wt(e,{deviceDesc:t="browser-chrome",uuid:r=G(),authHost:n=rt,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:t,deviceID:r})});if(o.ok)return await o.text();throw new H(o.status,o.statusText,"couldn't register api")}function st({hash:e,type:t,documentId:r,subfiles:n,size:i}){return`${e}:${t}:${r}:${n}:${i}
10
- `}function at(e){let[t,r,n,i,o]=e.split(":");if(t===void 0||r===void 0||n===void 0||i===void 0||o===void 0)throw new Error(`entries line didn't contain five fields: '${e}'`);if(r==="80000000")return{hash:t,type:r,documentId:n,subfiles:parseInt(i),size:BigInt(o)};if(r==="0"){if(i!=="0")throw new Error(`file type entry had nonzero number of subfiles: ${i}`);return{hash:t,type:r,documentId:n,subfiles:0,size:BigInt(o)}}else throw new Error(`entries line contained invalid type: ${r}`)}var we=class{#u;#a;#f;#r;#n;#e=new Map;#t=null;constructor(t,r,n,i,o,a){this.#u=t,this.#a=r,this.#f=n,this.#r=i,this.#n=o;for(let[f,s]of a)this.#e.set(f,Promise.resolve(s))}async#i(t,{body:r,method:n="POST",headers:i={}}){let o=await this.#a(t,{method:n,headers:{Authorization:`Bearer ${this.#u}`,...i},body:r});if(o.ok)return o;{let a=await o.text();throw new H(o.status,o.statusText,`failed reMarkable request: ${a}`)}}async#o({url:t,method:r,maxuploadsize_bytes:n},i,o={}){let a=n?{...o,[qt]:`0,${n}`}:o,f=await this.#a(t,{method:r,body:i,headers:a});if(f.ok)return f;{let s=await f.text();throw new H(f.status,f.statusText,s)}}async#s(t,r,n){let i=r===void 0?"downloads":"uploads",o=n&&r!==null&&r!==void 0?`{ "http_method": "PUT", "relative_path": "${t}", "root_schema": "${n}", "generation": ${r} }`:JSON.stringify({http_method:"GET",relative_path:t}),f=await(await this.#i(`${this.#r}/sync/v2/signed-urls/${i}`,{body:o})).text(),s=JSON.parse(f);return V(Yt,s),s}async getRootHash({cache:t=!0}={}){if(t)for(;this.#t;)try{let[o,a]=await this.#t;return[o,a]}catch{}let r=(async()=>{try{let o=await this.#s("root"),a=await this.#o(o),f=a.headers.get(Qe);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=r;let[n,i]=await r;return[n,i]}async putRootHash(t,r){let n=await this.#s("root",r,t),i;try{i=await this.#o(n,t,{[Jt]:`${r}`})}catch(f){throw f instanceof H&&f.status===412?(this.#t=null,new fe):f}let o=i.headers.get(Qe);if(!o)throw new Error("no generation header in root hash");let a=BigInt(o);return this.#t=Promise.resolve([t,a]),a}async#l(t){let r=this.#e.get(t);for(;r;)try{let i=await r;if(i)return i;r=void 0}catch{r=this.#e.get(t)}let n=(async()=>{let i=await this.#s(t);return await(await this.#o(i)).arrayBuffer()})();return this.#e.set(t,n.then(i=>i.byteLength<this.#n?i:null,i=>{throw this.#e.delete(t),i})),await n}async getBuffer(t){let r=await this.#l(t);return r.byteLength<this.#n?r.slice(0):r}async getText(t){let r=await this.#l(t);return new TextDecoder().decode(r)}async getJson(t){let r=await this.getText(t);return JSON.parse(r)}async getMetadata(t){let r=await this.getJson(t);return V(Zt,r),r}async getEntries(t){if(t===void 0){let[o]=await this.getRootHash({cache:!0});t=o}let r=await this.getText(t),[n,...i]=r.slice(0,-1).split(`
11
- `);if(n!==We)throw new Error(`got unexpected schema version: ${n}`);return i.map(at)}async#c(t,r){let n=this.#e.get(t);if(n)try{await n;return}catch{}let i=(async()=>{try{let o=await this.#s(t,null);return await this.#o(o,r),r.byteLength<this.#n?r:null}catch(o){throw this.#e.delete(t),o}})();this.#e.set(t,i),await i}async putEntries(t,r){let n=new TextEncoder;r.sort((u,g)=>u.documentId.localeCompare(g.documentId));let i=Le(r.map(u=>$e(u.hash))),o=await this.#f.digest("SHA-256",i),a=he(o),f=r.map(st).join(""),s=`${We}
12
- ${f}`,p=n.encode(s);return await this.#c(a,p),{hash:a,type:"80000000",documentId:t,subfiles:r.length,size:0n}}async putBuffer(t,r){let n=await this.#f.digest("SHA-256",r),i=he(n);return await this.#c(i,r),{hash:i,type:"0",documentId:t,subfiles:0,size:BigInt(r.byteLength)}}async putText(t,r){let n=new TextEncoder;return await this.putBuffer(t,n.encode(r))}async putJson(t,r){return await this.putText(t,(0,tt.default)(r))}async putMetadata(t,r){return await this.putJson(`${t}.metadata`,r)}async putCollection(t,r=""){let n=G(),i=`${new Date().valueOf()}`,o=[],a={type:"CollectionType",visibleName:t,version:0,parent:r,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#p(t,r,n,i,o){if(o.fileType!==n)throw new Error(`internal error: fileTypes don't match: ${n}, ${o.fileType}`);let a=G(),f=`${new Date().valueOf()}`,s=[];s.push(this.putBuffer(`${a}.${n}`,r));let p={type:"DocumentType",visibleName:t,version:0,parent:i,synced:!0,lastModified:f};s.push(this.putMetadata(a,p)),s.push(this.putText(`${a}.content`,JSON.stringify(o)));let u=await Promise.all(s);return await this.putEntries(a,u)}async putEpub(t,r,{parent:n="",margins:i=125,orientation:o,textAlignment:a,textScale:f=1,lineHeight:s=-1,fontName:p="",cover:u="visited",lastTool:g}={}){let x={dummyDocument:!1,extraMetadata:{LastTool:g},fileType:"epub",pageCount:0,lastOpenedPage:0,lineHeight:typeof s=="string"?ot[s]:s,margins:typeof i=="string"?it[i]:i,textScale:typeof f=="string"?nt[f]:f,pages:[],coverPageNumber:u==="first"?0:-1,formatVersion:1,orientation:o,textAlignment:a,fontName:p};return await this.#p(t,r,"epub",n,x)}async putPdf(t,r,{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.#p(t,r,"pdf",n,f)}async syncComplete(t){let r=`{ "generation": ${t} }`;await this.#i(`${this.#r}/sync/v2/sync-complete`,{body:r})}async#d(t,r,n){let{hash:i}=await this.putEntries("",r),o=await this.putRootHash(i,t);if(n)try{return await this.syncComplete(o),!0}catch{return!1}else return!1}async create(t,{cache:r=!0,sync:n=!0}={}){let[i,o]=await this.getRootHash({cache:r}),a=await this.getEntries(i);return a.push(t),await this.#d(o,a,n)}async move(t,r,{cache:n=!0,sync:i=!0}={}){let[o,a]=await this.getRootHash({cache:n}),f=await this.getEntries(o);if(!(!r||r==="trash")){let P=f.find(q=>q.documentId===r);if(P){if(P.type!=="80000000")throw new Error(`destination id was a raw file: ${r}`)}else throw new Error(`destination id not found: ${r}`);let A=await this.getEntries(P.hash),[m]=A.filter(q=>q.documentId===`${r}.metadata`);if(!m)throw new Error(`destination id didn't have metadata: ${r}`);if((await this.getMetadata(m.hash)).type!=="CollectionType")throw new Error(`destination id wasn't a collection: ${r}`)}let s=f.findIndex(P=>P.documentId===t);if(s===-1)throw new Error(`document not found: ${t}`);let[p]=f.splice(s,1);if(p.type!=="80000000")throw new Error(`document was a raw file: ${t}`);let u=await this.getEntries(p.hash),g=u.findIndex(P=>P.documentId===`${t}.metadata`);if(g===-1)throw new Error(`document didn't have metadata: ${t}`);let[x]=u.splice(g,1),F=await this.getMetadata(x.hash);F.parent=r;let y=await this.putMetadata(t,F);u.push(y);let J=await this.putEntries(t,u);return f.push(J),await this.#d(a,f,i)}async getEntriesMetadata(){let r=await(await this.#i(`${this.#r}/doc/v2/files`,{method:"GET",headers:{"rm-source":"RoR-Browser"}})).text(),n=JSON.parse(r);return V({elements:Kt},n),n}async#y(t,r,n){let o=new TextEncoder().encode(JSON.stringify({file_name:t})),f=await(await this.#i(`${this.#r}/doc/v2/files`,{body:r,headers:{"content-type":n,"rm-meta":(0,et.fromByteArray)(o),"rm-source":"RoR-Browser"}})).text(),s=JSON.parse(f);return V(Vt,s),s}async uploadEpub(t,r){return await this.#y(t,r,"application/epub+zip")}async uploadPdf(t,r){return await this.#y(t,r,"application/pdf")}async getCache(){let t=[];for(let[i,o]of this.#e)t.push(o.then(a=>[i,a],()=>[i,null]));let r=await Promise.all(t),n=new Map;for(let[i,o]of r)o&&n.set(i,o);return n}};async function Qt(e,{fetch:t=globalThis.fetch,subtle:r=globalThis.crypto?.subtle,authHost:n=rt,syncHost:i=Ut,cacheLimitBytes:o=1048576,initCache:a=[]}={}){if(!r)throw new Error("subtle was missing, try specifying it manually");let f=await t(`${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 we(s,t,r,i,o,a)}0&&(module.exports={GenerationError,ResponseError,builtinFontNames,builtinLineHeights,builtinMargins,builtinTextScales,builtinTools,formatEntry,parseEntry,register,remarkable});
1
+ "use strict";var pn=Object.create;var ue=Object.defineProperty;var cn=Object.getOwnPropertyDescriptor;var yn=Object.getOwnPropertyNames;var dn=Object.getPrototypeOf,gn=Object.prototype.hasOwnProperty;var d=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),mn=(t,e)=>{for(var r in e)ue(t,r,{get:e[r],enumerable:!0})},nt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of yn(e))!gn.call(t,o)&&o!==r&&ue(t,o,{get:()=>e[o],enumerable:!(n=cn(e,o))||n.enumerable});return t};var re=(t,e,r)=>(r=t!=null?pn(dn(t)):{},nt(e||!t||!t.__esModule?ue(r,"default",{value:t,enumerable:!0}):r,t)),hn=t=>nt(ue({},"__esModule",{value:!0}),t);var at=d(le=>{"use strict";le.byteLength=bn;le.toByteArray=Pn;le.fromByteArray=En;var I=[],F=[],vn=typeof Uint8Array<"u"?Uint8Array:Array,Me="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(U=0,ot=Me.length;U<ot;++U)I[U]=Me[U],F[Me.charCodeAt(U)]=U;var U,ot;F[45]=62;F[95]=63;function it(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function bn(t){var e=it(t),r=e[0],n=e[1];return(r+n)*3/4-n}function wn(t,e,r){return(e+r)*3/4-r}function Pn(t){var e,r=it(t),n=r[0],o=r[1],i=new vn(wn(t,n,o)),a=0,f=o>0?n-4:n,s;for(s=0;s<f;s+=4)e=F[t.charCodeAt(s)]<<18|F[t.charCodeAt(s+1)]<<12|F[t.charCodeAt(s+2)]<<6|F[t.charCodeAt(s+3)],i[a++]=e>>16&255,i[a++]=e>>8&255,i[a++]=e&255;return o===2&&(e=F[t.charCodeAt(s)]<<2|F[t.charCodeAt(s+1)]>>4,i[a++]=e&255),o===1&&(e=F[t.charCodeAt(s)]<<10|F[t.charCodeAt(s+1)]<<4|F[t.charCodeAt(s+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function xn(t){return I[t>>18&63]+I[t>>12&63]+I[t>>6&63]+I[t&63]}function An(t,e,r){for(var n,o=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(t[i+2]&255),o.push(xn(n));return o.join("")}function En(t){for(var e,r=t.length,n=r%3,o=[],i=16383,a=0,f=r-n;a<f;a+=i)o.push(An(t,a,a+i>f?f:a+i));return n===1?(e=t[r-1],o.push(I[e>>2]+I[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(I[e>>10]+I[e>>4&63]+I[e<<2&63]+"=")),o.join("")}});var pt=d((Yo,lt)=>{"use strict";var pe,l,st={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
2
+ `,r:"\r",t:" "},Re;function R(t){throw{name:"SyntaxError",message:t,at:pe,text:Re}}function g(t){return t&&t!==l&&R("Expected '"+t+"' instead of '"+l+"'"),l=Re.charAt(pe),pe+=1,l}function ft(){var t,e="";for(l==="-"&&(e="-",g("-"));l>="0"&&l<="9";)e+=l,g();if(l===".")for(e+=".";g()&&l>="0"&&l<="9";)e+=l;if(l==="e"||l==="E")for(e+=l,g(),(l==="-"||l==="+")&&(e+=l,g());l>="0"&&l<="9";)e+=l,g();return t=Number(e),isFinite(t)||R("Bad number"),t}function ut(){var t,e,r="",n;if(l==='"')for(;g();){if(l==='"')return g(),r;if(l==="\\")if(g(),l==="u"){for(n=0,e=0;e<4&&(t=parseInt(g(),16),!!isFinite(t));e+=1)n=n*16+t;r+=String.fromCharCode(n)}else if(typeof st[l]=="string")r+=st[l];else break;else r+=l}R("Bad string")}function $(){for(;l&&l<=" ";)g()}function Sn(){switch(l){case"t":return g("t"),g("r"),g("u"),g("e"),!0;case"f":return g("f"),g("a"),g("l"),g("s"),g("e"),!1;case"n":return g("n"),g("u"),g("l"),g("l"),null;default:R("Unexpected '"+l+"'")}}function On(){var t=[];if(l==="["){if(g("["),$(),l==="]")return g("]"),t;for(;l;){if(t.push(ce()),$(),l==="]")return g("]"),t;g(","),$()}}R("Bad array")}function Tn(){var t,e={};if(l==="{"){if(g("{"),$(),l==="}")return g("}"),e;for(;l;){if(t=ut(),$(),g(":"),Object.prototype.hasOwnProperty.call(e,t)&&R('Duplicate key "'+t+'"'),e[t]=ce(),$(),l==="}")return g("}"),e;g(","),$()}}R("Bad object")}function ce(){switch($(),l){case"{":return Tn();case"[":return On();case'"':return ut();case"-":return ft();default:return l>="0"&&l<="9"?ft():Sn()}}lt.exports=function(t,e){var r;return Re=t,pe=0,l=" ",r=ce(),$(),l&&R("Syntax error"),typeof e=="function"?function n(o,i){var a,f,s=o[i];if(s&&typeof s=="object")for(a in ce)Object.prototype.hasOwnProperty.call(s,a)&&(f=n(s,a),typeof f>"u"?delete s[a]:s[a]=f);return e.call(o,i,s)}({"":r},""):r}});var yt=d((Ko,ct)=>{"use strict";var Be=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,T,ye,Fn={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},N;function Ce(t){return Be.lastIndex=0,Be.test(t)?'"'+t.replace(Be,function(e){var r=Fn[e];return typeof r=="string"?r:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function de(t,e){var r,n,o,i,a=T,f,s=e[t];switch(s&&typeof s=="object"&&typeof s.toJSON=="function"&&(s=s.toJSON(t)),typeof N=="function"&&(s=N.call(e,t,s)),typeof s){case"string":return Ce(s);case"number":return isFinite(s)?String(s):"null";case"boolean":case"null":return String(s);case"object":if(!s)return"null";if(T+=ye,f=[],Object.prototype.toString.apply(s)==="[object Array]"){for(i=s.length,r=0;r<i;r+=1)f[r]=de(r,s)||"null";return o=f.length===0?"[]":T?`[
3
+ `+T+f.join(`,
4
+ `+T)+`
5
+ `+a+"]":"["+f.join(",")+"]",T=a,o}if(N&&typeof N=="object")for(i=N.length,r=0;r<i;r+=1)n=N[r],typeof n=="string"&&(o=de(n,s),o&&f.push(Ce(n)+(T?": ":":")+o));else for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(o=de(n,s),o&&f.push(Ce(n)+(T?": ":":")+o));return o=f.length===0?"{}":T?`{
6
+ `+T+f.join(`,
7
+ `+T)+`
8
+ `+a+"}":"{"+f.join(",")+"}",T=a,o;default:}}ct.exports=function(t,e,r){var n;if(T="",ye="",typeof r=="number")for(n=0;n<r;n+=1)ye+=" ";else typeof r=="string"&&(ye=r);if(N=e,e&&typeof e!="function"&&(typeof e!="object"||typeof e.length!="number"))throw new Error("JSON.stringify");return de("",{"":t})}});var dt=d(_e=>{"use strict";_e.parse=pt();_e.stringify=yt()});var mt=d((Zo,gt)=>{var kn={}.toString;gt.exports=Array.isArray||function(t){return kn.call(t)=="[object Array]"}});var Ue=d((Qo,vt)=>{"use strict";var ht=Object.prototype.toString;vt.exports=function(e){var r=ht.call(e),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&ht.call(e.callee)==="[object Function]"),n}});var Tt=d((ei,Ot)=>{"use strict";var St;Object.keys||(ne=Object.prototype.hasOwnProperty,Ne=Object.prototype.toString,bt=Ue(),De=Object.prototype.propertyIsEnumerable,wt=!De.call({toString:null},"toString"),Pt=De.call(function(){},"prototype"),oe=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],ge=function(t){var e=t.constructor;return e&&e.prototype===t},xt={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},At=function(){if(typeof window>"u")return!1;for(var t in window)try{if(!xt["$"+t]&&ne.call(window,t)&&window[t]!==null&&typeof window[t]=="object")try{ge(window[t])}catch{return!0}}catch{return!0}return!1}(),Et=function(t){if(typeof window>"u"||!At)return ge(t);try{return ge(t)}catch{return!1}},St=function(e){var r=e!==null&&typeof e=="object",n=Ne.call(e)==="[object Function]",o=bt(e),i=r&&Ne.call(e)==="[object String]",a=[];if(!r&&!n&&!o)throw new TypeError("Object.keys called on a non-object");var f=Pt&&n;if(i&&e.length>0&&!ne.call(e,0))for(var s=0;s<e.length;++s)a.push(String(s));if(o&&e.length>0)for(var c=0;c<e.length;++c)a.push(String(c));else for(var p in e)!(f&&p==="prototype")&&ne.call(e,p)&&a.push(String(p));if(wt)for(var m=Et(e),u=0;u<oe.length;++u)!(m&&oe[u]==="constructor")&&ne.call(e,oe[u])&&a.push(oe[u]);return a});var ne,Ne,bt,De,wt,Pt,oe,ge,xt,At,Et;Ot.exports=St});var $t=d((ti,It)=>{"use strict";var In=Array.prototype.slice,$n=Ue(),Ft=Object.keys,me=Ft?function(e){return Ft(e)}:Tt(),kt=Object.keys;me.shim=function(){if(Object.keys){var e=function(){var r=Object.keys(arguments);return r&&r.length===arguments.length}(1,2);e||(Object.keys=function(n){return $n(n)?kt(In.call(n)):kt(n)})}else Object.keys=me;return Object.keys||me};It.exports=me});var Rt=d((ri,Mt)=>{"use strict";var jn="Function.prototype.bind called on incompatible ",Mn=Object.prototype.toString,Rn=Math.max,Bn="[object Function]",jt=function(e,r){for(var n=[],o=0;o<e.length;o+=1)n[o]=e[o];for(var i=0;i<r.length;i+=1)n[i+e.length]=r[i];return n},Cn=function(e,r){for(var n=[],o=r||0,i=0;o<e.length;o+=1,i+=1)n[i]=e[o];return n},_n=function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r};Mt.exports=function(e){var r=this;if(typeof r!="function"||Mn.apply(r)!==Bn)throw new TypeError(jn+r);for(var n=Cn(arguments,1),o,i=function(){if(this instanceof o){var p=r.apply(this,jt(n,arguments));return Object(p)===p?p:this}return r.apply(e,jt(n,arguments))},a=Rn(0,r.length-n.length),f=[],s=0;s<a;s++)f[s]="$"+s;if(o=Function("binder","return function ("+_n(f,",")+"){ return binder.apply(this,arguments); }")(i),r.prototype){var c=function(){};c.prototype=r.prototype,o.prototype=new c,c.prototype=null}return o}});var he=d((ni,Bt)=>{"use strict";var Un=Rt();Bt.exports=Function.prototype.bind||Un});var _t=d((oi,Ct)=>{"use strict";Ct.exports=Error});var Nt=d((ii,Ut)=>{"use strict";Ut.exports=EvalError});var Lt=d((ai,Dt)=>{"use strict";Dt.exports=RangeError});var Ht=d((si,qt)=>{"use strict";qt.exports=ReferenceError});var Le=d((fi,Jt)=>{"use strict";Jt.exports=SyntaxError});var ie=d((ui,Gt)=>{"use strict";Gt.exports=TypeError});var Vt=d((li,zt)=>{"use strict";zt.exports=URIError});var Yt=d((pi,Wt)=>{"use strict";Wt.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var o=42;e[r]=o;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var i=Object.getOwnPropertySymbols(e);if(i.length!==1||i[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,r);if(a.value!==o||a.enumerable!==!0)return!1}return!0}});var Zt=d((ci,Xt)=>{"use strict";var Kt=typeof Symbol<"u"&&Symbol,Nn=Yt();Xt.exports=function(){return typeof Kt!="function"||typeof Symbol!="function"||typeof Kt("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Nn()}});var er=d((yi,Qt)=>{"use strict";var qe={__proto__:null,foo:{}},Dn=Object;Qt.exports=function(){return{__proto__:qe}.foo===qe.foo&&!(qe instanceof Dn)}});var rr=d((di,tr)=>{"use strict";var Ln=Function.prototype.call,qn=Object.prototype.hasOwnProperty,Hn=he();tr.exports=Hn.call(Ln,qn)});var Q=d((gi,sr)=>{"use strict";var y,Jn=_t(),Gn=Nt(),zn=Lt(),Vn=Ht(),Z=Le(),X=ie(),Wn=Vt(),ar=Function,He=function(t){try{return ar('"use strict"; return ('+t+").constructor;")()}catch{}},D=Object.getOwnPropertyDescriptor;if(D)try{D({},"")}catch{D=null}var Je=function(){throw new X},Yn=D?function(){try{return arguments.callee,Je}catch{try{return D(arguments,"callee").get}catch{return Je}}}():Je,Y=Zt()(),Kn=er()(),w=Object.getPrototypeOf||(Kn?function(t){return t.__proto__}:null),K={},Xn=typeof Uint8Array>"u"||!w?y:w(Uint8Array),L={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?y:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?y:ArrayBuffer,"%ArrayIteratorPrototype%":Y&&w?w([][Symbol.iterator]()):y,"%AsyncFromSyncIteratorPrototype%":y,"%AsyncFunction%":K,"%AsyncGenerator%":K,"%AsyncGeneratorFunction%":K,"%AsyncIteratorPrototype%":K,"%Atomics%":typeof Atomics>"u"?y:Atomics,"%BigInt%":typeof BigInt>"u"?y:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?y:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?y:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?y:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Jn,"%eval%":eval,"%EvalError%":Gn,"%Float32Array%":typeof Float32Array>"u"?y:Float32Array,"%Float64Array%":typeof Float64Array>"u"?y:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?y:FinalizationRegistry,"%Function%":ar,"%GeneratorFunction%":K,"%Int8Array%":typeof Int8Array>"u"?y:Int8Array,"%Int16Array%":typeof Int16Array>"u"?y:Int16Array,"%Int32Array%":typeof Int32Array>"u"?y:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Y&&w?w(w([][Symbol.iterator]())):y,"%JSON%":typeof JSON=="object"?JSON:y,"%Map%":typeof Map>"u"?y:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Y||!w?y:w(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?y:Promise,"%Proxy%":typeof Proxy>"u"?y:Proxy,"%RangeError%":zn,"%ReferenceError%":Vn,"%Reflect%":typeof Reflect>"u"?y:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?y:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Y||!w?y:w(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?y:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Y&&w?w(""[Symbol.iterator]()):y,"%Symbol%":Y?Symbol:y,"%SyntaxError%":Z,"%ThrowTypeError%":Yn,"%TypedArray%":Xn,"%TypeError%":X,"%Uint8Array%":typeof Uint8Array>"u"?y:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?y:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?y:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?y:Uint32Array,"%URIError%":Wn,"%WeakMap%":typeof WeakMap>"u"?y:WeakMap,"%WeakRef%":typeof WeakRef>"u"?y:WeakRef,"%WeakSet%":typeof WeakSet>"u"?y:WeakSet};if(w)try{null.error}catch(t){nr=w(w(t)),L["%Error.prototype%"]=nr}var nr,Zn=function t(e){var r;if(e==="%AsyncFunction%")r=He("async function () {}");else if(e==="%GeneratorFunction%")r=He("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=He("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var o=t("%AsyncGenerator%");o&&w&&(r=w(o.prototype))}return L[e]=r,r},or={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ae=he(),ve=rr(),Qn=ae.call(Function.call,Array.prototype.concat),eo=ae.call(Function.apply,Array.prototype.splice),ir=ae.call(Function.call,String.prototype.replace),be=ae.call(Function.call,String.prototype.slice),to=ae.call(Function.call,RegExp.prototype.exec),ro=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,no=/\\(\\)?/g,oo=function(e){var r=be(e,0,1),n=be(e,-1);if(r==="%"&&n!=="%")throw new Z("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Z("invalid intrinsic syntax, expected opening `%`");var o=[];return ir(e,ro,function(i,a,f,s){o[o.length]=f?ir(s,no,"$1"):a||i}),o},io=function(e,r){var n=e,o;if(ve(or,n)&&(o=or[n],n="%"+o[0]+"%"),ve(L,n)){var i=L[n];if(i===K&&(i=Zn(n)),typeof i>"u"&&!r)throw new X("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:i}}throw new Z("intrinsic "+e+" does not exist!")};sr.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new X("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new X('"allowMissing" argument must be a boolean');if(to(/^%?[^%]*%?$/,e)===null)throw new Z("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=oo(e),o=n.length>0?n[0]:"",i=io("%"+o+"%",r),a=i.name,f=i.value,s=!1,c=i.alias;c&&(o=c[0],eo(n,Qn([0,1],c)));for(var p=1,m=!0;p<n.length;p+=1){var u=n[p],S=be(u,0,1),v=be(u,-1);if((S==='"'||S==="'"||S==="`"||v==='"'||v==="'"||v==="`")&&S!==v)throw new Z("property names with quotes must have matching quotes");if((u==="constructor"||!m)&&(s=!0),o+="."+u,a="%"+o+"%",ve(L,a))f=L[a];else if(f!=null){if(!(u in f)){if(!r)throw new X("base intrinsic for "+e+" exists, but the property is not available.");return}if(D&&p+1>=n.length){var k=D(f,u);m=!!k,m&&"get"in k&&!("originalValue"in k.get)?f=k.get:f=f[u]}else m=ve(f,u),f=f[u];m&&!s&&(L[a]=f)}}return f}});var Pe=d((mi,fr)=>{"use strict";var ao=Q(),we=ao("%Object.defineProperty%",!0)||!1;if(we)try{we({},"a",{value:1})}catch{we=!1}fr.exports=we});var Ge=d((hi,ur)=>{"use strict";var so=Q(),xe=so("%Object.getOwnPropertyDescriptor%",!0);if(xe)try{xe([],"length")}catch{xe=null}ur.exports=xe});var yr=d((vi,cr)=>{"use strict";var lr=Pe(),fo=Le(),ee=ie(),pr=Ge();cr.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new ee("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new ee("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ee("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ee("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ee("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ee("`loose`, if provided, must be a boolean");var o=arguments.length>3?arguments[3]:null,i=arguments.length>4?arguments[4]:null,a=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,s=!!pr&&pr(e,r);if(lr)lr(e,r,{configurable:a===null&&s?s.configurable:!a,enumerable:o===null&&s?s.enumerable:!o,value:n,writable:i===null&&s?s.writable:!i});else if(f||!o&&!i&&!a)e[r]=n;else throw new fo("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var mr=d((bi,gr)=>{"use strict";var ze=Pe(),dr=function(){return!!ze};dr.hasArrayLengthDefineBug=function(){if(!ze)return null;try{return ze([],"length",{value:1}).length!==1}catch{return!0}};gr.exports=dr});var Pr=d((wi,wr)=>{"use strict";var uo=Q(),hr=yr(),lo=mr()(),vr=Ge(),br=ie(),po=uo("%Math.floor%");wr.exports=function(e,r){if(typeof e!="function")throw new br("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||po(r)!==r)throw new br("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],o=!0,i=!0;if("length"in e&&vr){var a=vr(e,"length");a&&!a.configurable&&(o=!1),a&&!a.writable&&(i=!1)}return(o||i||!n)&&(lo?hr(e,"length",r,!0,!0):hr(e,"length",r)),e}});var We=d((Pi,Ae)=>{"use strict";var Ve=he(),Ee=Q(),co=Pr(),yo=ie(),Er=Ee("%Function.prototype.apply%"),Sr=Ee("%Function.prototype.call%"),Or=Ee("%Reflect.apply%",!0)||Ve.call(Sr,Er),xr=Pe(),go=Ee("%Math.max%");Ae.exports=function(e){if(typeof e!="function")throw new yo("a function is required");var r=Or(Ve,Sr,arguments);return co(r,1+go(0,e.length-(arguments.length-1)),!0)};var Ar=function(){return Or(Ve,Er,arguments)};xr?xr(Ae.exports,"apply",{value:Ar}):Ae.exports.apply=Ar});var Ir=d((xi,kr)=>{"use strict";var Tr=Q(),Fr=We(),mo=Fr(Tr("String.prototype.indexOf"));kr.exports=function(e,r){var n=Tr(e,!!r);return typeof n=="function"&&mo(e,".prototype.")>-1?Fr(n):n}});var Br=d((Ai,Rr)=>{"use strict";var Se=(typeof JSON<"u"?JSON:dt()).stringify,ho=mt(),vo=$t(),bo=We(),Mr=Ir(),$r=Mr("Array.prototype.join"),Ye=Mr("Array.prototype.push"),jr=function(e,r){for(var n="",o=0;o<e;o+=1)n+=r;return n},wo=function(t,e,r){return r};Rr.exports=function(e){var r=arguments.length>1?arguments[1]:void 0,n=r&&r.space||"";typeof n=="number"&&(n=jr(n," "));var o=!!r&&typeof r.cycles=="boolean"&&r.cycles,i=r&&r.replacer?bo(r.replacer):wo,a=typeof r=="function"?r:r&&r.cmp,f=a&&function(c){var p=a.length>2&&function(u){return c[u]};return function(m,u){return a({key:m,value:c[m]},{key:u,value:c[u]},p?{__proto__:null,get:p}:void 0)}},s=[];return function c(p,m,u,S){var v=n?`
9
+ `+jr(S,n):"",k=n?": ":":";if(u&&u.toJSON&&typeof u.toJSON=="function"&&(u=u.toJSON()),u=i(p,m,u),u!==void 0){if(typeof u!="object"||u===null)return Se(u);if(ho(u)){for(var j=[],b=0;b<u.length;b++){var _=c(u,b,u[b],S+1)||Se(null);Ye(j,v+n+_)}return"["+$r(j,",")+v+"]"}if(s.indexOf(u)!==-1){if(o)return Se("__cycle__");throw new TypeError("Converting circular structure to JSON")}else Ye(s,u);for(var P=vo(u).sort(f&&f(u)),j=[],b=0;b<P.length;b++){var m=P[b],M=c(u,m,u[m],S+1);if(M){var ln=Se(m)+k+M;Ye(j,v+n+ln)}}return s.splice(s.indexOf(u),1),"{"+$r(j,",")+v+"}"}}({"":e},"",e,0)}});var et=d(h=>{"use strict";var Lr=h&&h.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r};Object.defineProperty(h,"__esModule",{value:!0});h.isSchema=h.isValidSchema=h.isDiscriminatorForm=h.isValuesForm=h.isPropertiesForm=h.isElementsForm=h.isEnumForm=h.isTypeForm=h.isRefForm=h.isEmptyForm=void 0;function xo(t){let{definitions:e,nullable:r,metadata:n}=t,o=Lr(t,["definitions","nullable","metadata"]);return Object.keys(o).length===0}h.isEmptyForm=xo;function qr(t){return"ref"in t}h.isRefForm=qr;function Ao(t){return"type"in t}h.isTypeForm=Ao;function Hr(t){return"enum"in t}h.isEnumForm=Hr;function Jr(t){return"elements"in t}h.isElementsForm=Jr;function Qe(t){return"properties"in t||"optionalProperties"in t}h.isPropertiesForm=Qe;function Gr(t){return"values"in t}h.isValuesForm=Gr;function zr(t){return"discriminator"in t}h.isDiscriminatorForm=zr;function q(t,e){if(e===void 0&&(e=t),t.definitions!==void 0){if(e!==t)return!1;for(let r of Object.values(t.definitions))if(!q(r,e))return!1}if(qr(t)&&!(t.ref in(e.definitions||{}))||Hr(t)&&(t.enum.length===0||t.enum.length!==new Set(t.enum).size))return!1;if(Jr(t))return q(t.elements,e);if(Qe(t)){for(let r of Object.values(t.properties||{}))if(!q(r,e))return!1;for(let r of Object.values(t.optionalProperties||{}))if(!q(r,e))return!1;for(let r of Object.keys(t.properties||{}))if(r in(t.optionalProperties||{}))return!1}if(Gr(t))return q(t.values,e);if(zr(t)){for(let r of Object.values(t.mapping))if(!q(r,e)||!Qe(r)||r.nullable||t.discriminator in(r.properties||{})||t.discriminator in(r.optionalProperties||{}))return!1}return!0}h.isValidSchema=q;var Eo=[[!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]],So=["boolean","float32","float64","int8","uint8","int16","uint16","int32","uint32","string","timestamp"];function H(t){if(typeof t!="object"||Array.isArray(t)||t===null)return!1;let e=t,{definitions:r=void 0,nullable:n=void 0,metadata:o=void 0,ref:i=void 0,type:a=void 0,enum:f=void 0,elements:s=void 0,properties:c=void 0,optionalProperties:p=void 0,additionalProperties:m=void 0,values:u=void 0,discriminator:S=void 0,mapping:v=void 0}=e,k=Lr(e,["definitions","nullable","metadata","ref","type","enum","elements","properties","optionalProperties","additionalProperties","values","discriminator","mapping"]),b=[i!==void 0,a!==void 0,f!==void 0,s!==void 0,c!==void 0,p!==void 0,m!==void 0,u!==void 0,S!==void 0,v!==void 0],_=!1;for(let P of Eo)_=_||P.every((j,M)=>j===b[M]);if(!_)return!1;if(r!==void 0){if(typeof r!="object"||Array.isArray(r)||r===null)return!1;for(let P of Object.values(r))if(!H(P))return!1}if(n!==void 0&&typeof n!="boolean"||o!==void 0&&(typeof o!="object"||Array.isArray(o)||o===null)||i!==void 0&&typeof i!="string"||a!==void 0&&(typeof a!="string"||!So.includes(a))||f!==void 0&&(!Array.isArray(f)||!f.every(P=>typeof P=="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 P of Object.values(c))if(!H(P))return!1}if(p!==void 0){if(typeof p!="object"||Array.isArray(p)||p===null)return!1;for(let P of Object.values(p))if(!H(P))return!1}if(m!==void 0&&typeof m!="boolean"||u!==void 0&&!H(u)||S!==void 0&&typeof S!="string")return!1;if(v!==void 0){if(typeof v!="object"||Array.isArray(v)||v===null)return!1;for(let P of Object.values(v))if(!H(P))return!1}return Object.keys(k).length===0}h.isSchema=H});var Vr=d(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});var Oo=/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(\.\d+)?([zZ]|((\+|-)(\d{2}):(\d{2})))$/;function To(t){let e=t.match(Oo);if(e===null)return!1;let r=parseInt(e[1],10),n=parseInt(e[2],10),o=parseInt(e[3],10),i=parseInt(e[4],10),a=parseInt(e[5],10),f=parseInt(e[6],10);return!(n>12||o>Fo(r,n)||i>23||a>59||f>60)}tt.default=To;function Fo(t,e){return e===2?ko(t)?29:28:Io[e]}function ko(t){return t%4===0&&(t%100!==0||t%400===0)}var Io=[0,31,0,31,30,31,30,31,31,30,31,30,31]});var Wr=d(B=>{"use strict";var $o=B&&B.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(B,"__esModule",{value:!0});B.validate=B.MaxDepthExceededError=void 0;var jo=$o(Vr()),J=et(),Fe=class extends Error{};B.MaxDepthExceededError=Fe;var ke=class extends Error{};function Mo(t,e,r){let n={errors:[],instanceTokens:[],schemaTokens:[[]],root:t,config:r||{maxDepth:0,maxErrors:0}};try{V(n,t,e)}catch(o){if(!(o instanceof ke))throw o}return n.errors}B.validate=Mo;function V(t,e,r,n){if(!(e.nullable&&r===null)){if(J.isRefForm(e)){if(t.schemaTokens.length===t.config.maxDepth)throw new Fe;t.schemaTokens.push(["definitions",e.ref]),V(t,t.root.definitions[e.ref],r),t.schemaTokens.pop()}else if(J.isTypeForm(e)){switch(A(t,"type"),e.type){case"boolean":typeof r!="boolean"&&E(t);break;case"float32":case"float64":typeof r!="number"&&E(t);break;case"int8":te(t,r,-128,127);break;case"uint8":te(t,r,0,255);break;case"int16":te(t,r,-32768,32767);break;case"uint16":te(t,r,0,65535);break;case"int32":te(t,r,-2147483648,2147483647);break;case"uint32":te(t,r,0,4294967295);break;case"string":typeof r!="string"&&E(t);break;case"timestamp":typeof r!="string"?E(t):jo.default(r)||E(t);break}O(t)}else if(J.isEnumForm(e))A(t,"enum"),(typeof r!="string"||!e.enum.includes(r))&&E(t),O(t);else if(J.isElementsForm(e)){if(A(t,"elements"),Array.isArray(r))for(let[o,i]of r.entries())G(t,o.toString()),V(t,e.elements,i),z(t);else E(t);O(t)}else if(J.isPropertiesForm(e))if(typeof r=="object"&&r!==null&&!Array.isArray(r)){if(e.properties!==void 0){A(t,"properties");for(let[o,i]of Object.entries(e.properties))A(t,o),r.hasOwnProperty(o)?(G(t,o),V(t,i,r[o]),z(t)):E(t),O(t);O(t)}if(e.optionalProperties!==void 0){A(t,"optionalProperties");for(let[o,i]of Object.entries(e.optionalProperties))A(t,o),r.hasOwnProperty(o)&&(G(t,o),V(t,i,r[o]),z(t)),O(t);O(t)}if(e.additionalProperties!==!0)for(let o of Object.keys(r)){let i=e.properties&&o in e.properties,a=e.optionalProperties&&o in e.optionalProperties;!i&&!a&&o!==n&&(G(t,o),E(t),z(t))}}else e.properties!==void 0?A(t,"properties"):A(t,"optionalProperties"),E(t),O(t);else if(J.isValuesForm(e)){if(A(t,"values"),typeof r=="object"&&r!==null&&!Array.isArray(r))for(let[o,i]of Object.entries(r))G(t,o),V(t,e.values,i),z(t);else E(t);O(t)}else if(J.isDiscriminatorForm(e))if(typeof r=="object"&&r!==null&&!Array.isArray(r))if(r.hasOwnProperty(e.discriminator)){let o=r[e.discriminator];typeof o=="string"?o in e.mapping?(A(t,"mapping"),A(t,o),V(t,e.mapping[o],r,e.discriminator),O(t),O(t)):(A(t,"mapping"),G(t,e.discriminator),E(t),z(t),O(t)):(A(t,"discriminator"),G(t,e.discriminator),E(t),z(t),O(t))}else A(t,"discriminator"),E(t),O(t);else A(t,"discriminator"),E(t),O(t)}}function te(t,e,r,n){(typeof e!="number"||!Number.isInteger(e)||e<r||e>n)&&E(t)}function G(t,e){t.instanceTokens.push(e)}function z(t){t.instanceTokens.pop()}function A(t,e){t.schemaTokens[t.schemaTokens.length-1].push(e)}function O(t){t.schemaTokens[t.schemaTokens.length-1].pop()}function E(t){if(t.errors.push({instancePath:[...t.instanceTokens],schemaPath:[...t.schemaTokens[t.schemaTokens.length-1]]}),t.errors.length===t.config.maxErrors)throw new ke}});var Kr=d(C=>{"use strict";var Ro=C&&C.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Yr=C&&C.__exportStar||function(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&Ro(e,t,r)};Object.defineProperty(C,"__esModule",{value:!0});Yr(et(),C);Yr(Wr(),C)});var zo={};mn(zo,{GenerationError:()=>je,ResponseError:()=>W,builtinFontNames:()=>No,builtinLineHeights:()=>sn,builtinMargins:()=>an,builtinTextScales:()=>on,builtinTools:()=>Uo,formatEntry:()=>fn,parseEntry:()=>un,register:()=>Jo,remarkable:()=>Go});module.exports=hn(zo);var tn=re(at()),rn=re(Br());var Cr=re(require("crypto")),Te=new Uint8Array(256),Oe=Te.length;function Ke(){return Oe>Te.length-16&&(Cr.default.randomFillSync(Te),Oe=0),Te.slice(Oe,Oe+=16)}var x=[];for(let t=0;t<256;++t)x.push((t+256).toString(16).slice(1));function _r(t,e=0){return x[t[e+0]]+x[t[e+1]]+x[t[e+2]]+x[t[e+3]]+"-"+x[t[e+4]]+x[t[e+5]]+"-"+x[t[e+6]]+x[t[e+7]]+"-"+x[t[e+8]]+x[t[e+9]]+"-"+x[t[e+10]]+x[t[e+11]]+x[t[e+12]]+x[t[e+13]]+x[t[e+14]]+x[t[e+15]]}var Ur=re(require("crypto")),Xe={randomUUID:Ur.default.randomUUID};function Po(t,e,r){if(Xe.randomUUID&&!e&&!t)return Xe.randomUUID();t=t||{};let n=t.random||(t.rng||Ke)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(let o=0;o<16;++o)e[r+o]=n[o];return e}return _r(n)}var se=Po;function Ze(t){return[...new Uint8Array(t)].map(e=>e.toString(16).padStart(2,"0")).join("")}function Nr(t){return new Uint8Array((t.match(/../g)??[]).map(e=>parseInt(e,16)))}function Dr(t){let e=0;for(let o of t)e+=o.length;let r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}var Xr=re(Kr());function fe(t,e,r=!0){if((r?(0,Xr.validate)(t,e):[]).length)throw new Error(`couldn't validate schema: ${JSON.stringify(e)} didn't match schema ${JSON.stringify(t)}`)}var Zr="3",nn="https://webapp-prod.cloud.remarkable.engineering",Bo="https://internal.cloud.remarkable.com",Qr="x-goog-generation",Co="x-goog-if-generation-match",_o="x-goog-content-length-range",Uo=["Ballpoint","Ballpointv2","Brush","Calligraphy","ClearPage","EraseSection","Eraser","Fineliner","Finelinerv2","Highlighter","Highlighterv2","Marker","Markerv2","Paintbrush","Paintbrushv2","Pencilv2","SharpPencil","SharpPencilv2","SolidPen","ZoomTool"],No=["Maison Neue","EB Garamond","Noto Sans","Noto Serif","Noto Mono","Noto Sans UI"],on={xs:.7,sm:.8,md:1,lg:1.2,xl:1.5,xx:2},an={sm:50,md:125,rr:180,lg:200},sn={df:-1,md:100,lg:150,xl:200},Do={properties:{docID:{type:"string"},hash:{type:"string"}}},Lo={properties:{relative_path:{type:"string"},url:{type:"string"},expires:{type:"timestamp"},method:{enum:["POST","GET","PUT","DELETE"]}},optionalProperties:{maxuploadsize_bytes:{type:"float64"}}},Ie={visibleName:{type:"string"}},$e={lastModified:{type:"string"},version:{type:"int32"},pinned:{type:"boolean"},synced:{type:"boolean"},modified:{type:"boolean"},deleted:{type:"boolean"},metadatamodified:{type:"boolean"},parent:{type:"string"}},qo={discriminator:"type",mapping:{CollectionType:{properties:Ie,optionalProperties:$e,additionalProperties:!0},DocumentType:{properties:Ie,optionalProperties:{...$e,lastOpened:{type:"string"},lastOpenedPage:{type:"int32"},createdTime:{type:"string"}},additionalProperties:!0}}},en={id:{type:"string"},hash:{type:"string"}},Ho={discriminator:"type",mapping:{CollectionType:{properties:{...Ie,...en},optionalProperties:$e,additionalProperties:!0},DocumentType:{properties:{...Ie,...en,fileType:{enum:["notebook","epub","pdf",""]}},optionalProperties:{...$e,lastOpened:{type:"string"},lastOpenedPage:{type:"int32"},createdTime:{type:"string"}},additionalProperties:!0}}},W=class extends Error{status;statusText;constructor(e,r,n){super(n),this.status=e,this.statusText=r}},je=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 Jo(t,{deviceDesc:e="browser-chrome",uuid:r=se(),authHost:n=nn,fetch:o=globalThis.fetch}={}){if(t.length!==8)throw new Error(`code should be length 8, but was ${t.length}`);let i=await o(`${n}/token/json/2/device/new`,{method:"POST",headers:{Authorization:"Bearer"},body:JSON.stringify({code:t,deviceDesc:e,deviceID:r})});if(i.ok)return await i.text();throw new W(i.status,i.statusText,"couldn't register api")}function fn({hash:t,type:e,documentId:r,subfiles:n,size:o}){return`${t}:${e}:${r}:${n}:${o}
10
+ `}function un(t){let[e,r,n,o,i]=t.split(":");if(e===void 0||r===void 0||n===void 0||o===void 0||i===void 0)throw new Error(`entries line didn't contain five fields: '${t}'`);if(r==="80000000")return{hash:e,type:r,documentId:n,subfiles:parseInt(o),size:BigInt(i)};if(r==="0"){if(o!=="0")throw new Error(`file type entry had nonzero number of subfiles: ${o}`);return{hash:e,type:r,documentId:n,subfiles:0,size:BigInt(i)}}else throw new Error(`entries line contained invalid type: ${r}`)}var rt=class{#u;#s;#f;#r;#n;#e=new Map;#t=null;constructor(e,r,n,o,i,a){this.#u=e,this.#s=r,this.#f=n,this.#r=o,this.#n=i;for(let[f,s]of a)this.#e.set(f,Promise.resolve(s))}async#o(e,{body:r,method:n="POST",headers:o={}}){let i=await this.#s(e,{method:n,headers:{Authorization:`Bearer ${this.#u}`,...o},body:r});if(i.ok)return i;{let a=await i.text();throw new W(i.status,i.statusText,`failed reMarkable request: ${a}`)}}async#i({url:e,method:r,maxuploadsize_bytes:n},o,i={}){let a=n?{...i,[_o]:`0,${n}`}:i,f=await this.#s(e,{method:r,body:o,headers:a});if(f.ok)return f;{let s=await f.text();throw new W(f.status,f.statusText,s)}}async#a(e,r,n){let o=r===void 0?"downloads":"uploads",i=n&&r!==null&&r!==void 0?`{ "http_method": "PUT", "relative_path": "${e}", "root_schema": "${n}", "generation": ${r} }`:JSON.stringify({http_method:"GET",relative_path:e}),f=await(await this.#o(`${this.#r}/sync/v2/signed-urls/${o}`,{body:i})).text(),s=JSON.parse(f);return fe(Lo,s),s}async getRootHash({cache:e=!0}={}){if(e)for(;this.#t;)try{let[i,a]=await this.#t;return[i,a]}catch{}let r=(async()=>{try{let i=await this.#a("root"),a=await this.#i(i),f=a.headers.get(Qr);if(f)return[await a.text(),BigInt(f)];throw new Error("no generation header in root hash")}catch(i){throw this.#t=null,i}})();this.#t=r;let[n,o]=await r;return[n,o]}async putRootHash(e,r){let n=await this.#a("root",r,e),o;try{o=await this.#i(n,e,{[Co]:`${r}`})}catch(f){throw f instanceof W&&f.status===412?(this.#t=null,new je):f}let i=o.headers.get(Qr);if(!i)throw new Error("no generation header in root hash");let a=BigInt(i);return this.#t=Promise.resolve([e,a]),a}async#l(e){let r=this.#e.get(e);for(;r;)try{let o=await r;if(o)return o;r=void 0}catch{r=this.#e.get(e)}let n=(async()=>{let o=await this.#a(e);return await(await this.#i(o)).arrayBuffer()})();return this.#e.set(e,n.then(o=>o.byteLength<this.#n?o:null,o=>{throw this.#e.delete(e),o})),await n}async getBuffer(e){let r=await this.#l(e);return r.byteLength<this.#n?r.slice(0):r}async getText(e){let r=await this.#l(e);return new TextDecoder().decode(r)}async getJson(e){let r=await this.getText(e);return JSON.parse(r)}async getMetadata(e,{verify:r=!0}={}){let n=await this.getJson(e);return fe(qo,n,r),n}async getEntries(e){if(e===void 0){let[i]=await this.getRootHash({cache:!0});e=i}let r=await this.getText(e),[n,...o]=r.slice(0,-1).split(`
11
+ `);if(n!==Zr)throw new Error(`got unexpected schema version: ${n}`);return o.map(un)}async#p(e,r){let n=this.#e.get(e);if(n)try{await n;return}catch{}let o=(async()=>{try{let i=await this.#a(e,null);return await this.#i(i,r),r.byteLength<this.#n?r:null}catch(i){throw this.#e.delete(e),i}})();this.#e.set(e,o),await o}async putEntries(e,r){let n=new TextEncoder;r.sort((p,m)=>p.documentId.localeCompare(m.documentId));let o=Dr(r.map(p=>Nr(p.hash))),i=await this.#f.digest("SHA-256",o),a=Ze(i),f=r.map(fn).join(""),s=`${Zr}
12
+ ${f}`,c=n.encode(s);return await this.#p(a,c),{hash:a,type:"80000000",documentId:e,subfiles:r.length,size:0n}}async putBuffer(e,r){let n=await this.#f.digest("SHA-256",r),o=Ze(n);return await this.#p(o,r),{hash:o,type:"0",documentId:e,subfiles:0,size:BigInt(r.byteLength)}}async putText(e,r){let n=new TextEncoder;return await this.putBuffer(e,n.encode(r))}async putJson(e,r){return await this.putText(e,(0,rn.default)(r))}async putMetadata(e,r){return await this.putJson(`${e}.metadata`,r)}async putCollection(e,r=""){let n=se(),o=`${new Date().valueOf()}`,i=[],a={type:"CollectionType",visibleName:e,version:0,parent:r,synced:!0,lastModified:o};i.push(this.putMetadata(n,a)),i.push(this.putText(`${n}.content`,"{}"));let f=await Promise.all(i);return await this.putEntries(n,f)}async#c(e,r,n,o,i){if(i.fileType!==n)throw new Error(`internal error: fileTypes don't match: ${n}, ${i.fileType}`);let a=se(),f=`${new Date().valueOf()}`,s=[];s.push(this.putBuffer(`${a}.${n}`,r));let c={type:"DocumentType",visibleName:e,version:0,parent:o,synced:!0,lastModified:f};s.push(this.putMetadata(a,c)),s.push(this.putText(`${a}.content`,JSON.stringify(i)));let p=await Promise.all(s);return await this.putEntries(a,p)}async putEpub(e,r,{parent:n="",margins:o=125,orientation:i,textAlignment:a,textScale:f=1,lineHeight:s=-1,fontName:c="",cover:p="visited",lastTool:m}={}){let u={dummyDocument:!1,extraMetadata:{LastTool:m},fileType:"epub",pageCount:0,lastOpenedPage:0,lineHeight:typeof s=="string"?sn[s]:s,margins:typeof o=="string"?an[o]:o,textScale:typeof f=="string"?on[f]:f,pages:[],coverPageNumber:p==="first"?0:-1,formatVersion:1,orientation:i,textAlignment:a,fontName:c};return await this.#c(e,r,"epub",n,u)}async putPdf(e,r,{parent:n="",orientation:o,cover:i="first",lastTool:a}={}){let f={dummyDocument:!1,extraMetadata:{LastTool:a},fileType:"pdf",pageCount:0,lastOpenedPage:0,lineHeight:-1,margins:125,textScale:1,pages:[],coverPageNumber:i==="first"?0:-1,formatVersion:1,orientation:o};return await this.#c(e,r,"pdf",n,f)}async syncComplete(e){let r=`{ "generation": ${e} }`;await this.#o(`${this.#r}/sync/v2/sync-complete`,{body:r})}async#y(e,r,n){let{hash:o}=await this.putEntries("",r),i=await this.putRootHash(o,e);if(n)try{return await this.syncComplete(i),!0}catch{return!1}else return!1}async create(e,{cache:r=!0,sync:n=!0}={}){let[o,i]=await this.getRootHash({cache:r}),a=await this.getEntries(o);return a.push(e),await this.#y(i,a,n)}async move(e,r,{cache:n=!0,sync:o=!0}={}){let[i,a]=await this.getRootHash({cache:n}),f=await this.getEntries(i);if(!(!r||r==="trash")){let b=f.find(M=>M.documentId===r);if(b){if(b.type!=="80000000")throw new Error(`destination id was a raw file: ${r}`)}else throw new Error(`destination id not found: ${r}`);let _=await this.getEntries(b.hash),[P]=_.filter(M=>M.documentId===`${r}.metadata`);if(!P)throw new Error(`destination id didn't have metadata: ${r}`);if((await this.getMetadata(P.hash)).type!=="CollectionType")throw new Error(`destination id wasn't a collection: ${r}`)}let s=f.findIndex(b=>b.documentId===e);if(s===-1)throw new Error(`document not found: ${e}`);let[c]=f.splice(s,1);if(c.type!=="80000000")throw new Error(`document was a raw file: ${e}`);let p=await this.getEntries(c.hash),m=p.findIndex(b=>b.documentId===`${e}.metadata`);if(m===-1)throw new Error(`document didn't have metadata: ${e}`);let[u]=p.splice(m,1),S=await this.getMetadata(u.hash);S.parent=r;let v=await this.putMetadata(e,S);p.push(v);let k=await this.putEntries(e,p);return f.push(k),await this.#y(a,f,o)}async getEntriesMetadata({verify:e=!0}={}){let n=await(await this.#o(`${this.#r}/doc/v2/files`,{method:"GET",headers:{"rm-source":"RoR-Browser"}})).text(),o=JSON.parse(n);return fe({elements:Ho},o,e),o}async#d(e,r,n,o){let a=new TextEncoder().encode(JSON.stringify({file_name:e})),s=await(await this.#o(`${this.#r}/doc/v2/files`,{body:r,headers:{"content-type":n,"rm-meta":(0,tn.fromByteArray)(a),"rm-source":"RoR-Browser"}})).text(),c=JSON.parse(s);return fe(Do,c,o),c}async uploadEpub(e,r,{verify:n=!0}={}){return await this.#d(e,r,"application/epub+zip",n)}async uploadPdf(e,r,{verify:n=!0}={}){return await this.#d(e,r,"application/pdf",n)}async getCache(){let e=[];for(let[o,i]of this.#e)e.push(i.then(a=>[o,a],()=>[o,null]));let r=await Promise.all(e),n=new Map;for(let[o,i]of r)i&&n.set(o,i);return n}};async function Go(t,{fetch:e=globalThis.fetch,subtle:r=globalThis.crypto?.subtle,authHost:n=nn,syncHost:o=Bo,cacheLimitBytes:i=1048576,initCache:a=[]}={}){if(!r)throw new Error("subtle was missing, try specifying it manually");let f=await e(`${n}/token/json/2/user/new`,{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(!f.ok)throw new Error(`couldn't fetch auth token: ${f.statusText}`);let s=await f.text();return new rt(s,e,r,o,i,a)}0&&(module.exports={GenerationError,ResponseError,builtinFontNames,builtinLineHeights,builtinMargins,builtinTextScales,builtinTools,formatEntry,parseEntry,register,remarkable});
@@ -1,12 +1,12 @@
1
- var Xe=Object.create;var we=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var rt=Object.getPrototypeOf,nt=Object.prototype.hasOwnProperty;var S=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var it=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of tt(t))!nt.call(e,i)&&i!==r&&we(e,i,{get:()=>t[i],enumerable:!(n=et(t,i))||n.enumerable});return e};var oe=(e,t,r)=>(r=e!=null?Xe(rt(e)):{},it(t||!e||!e.__esModule?we(r,"default",{value:e,enumerable:!0}):r,e));var Ee=S(Y=>{"use strict";Y.byteLength=st;Y.toByteArray=ft;Y.fromByteArray=ct;var O=[],T=[],ot=typeof Uint8Array<"u"?Uint8Array:Array,se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(B=0,ve=se.length;B<ve;++B)O[B]=se[B],T[se.charCodeAt(B)]=B;var B,ve;T["-".charCodeAt(0)]=62;T["_".charCodeAt(0)]=63;function xe(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function st(e){var t=xe(e),r=t[0],n=t[1];return(r+n)*3/4-n}function at(e,t,r){return(t+r)*3/4-r}function ft(e){var t,r=xe(e),n=r[0],i=r[1],o=new ot(at(e,n,i)),a=0,f=i>0?n-4:n,s;for(s=0;s<f;s+=4)t=T[e.charCodeAt(s)]<<18|T[e.charCodeAt(s+1)]<<12|T[e.charCodeAt(s+2)]<<6|T[e.charCodeAt(s+3)],o[a++]=t>>16&255,o[a++]=t>>8&255,o[a++]=t&255;return i===2&&(t=T[e.charCodeAt(s)]<<2|T[e.charCodeAt(s+1)]>>4,o[a++]=t&255),i===1&&(t=T[e.charCodeAt(s)]<<10|T[e.charCodeAt(s+1)]<<4|T[e.charCodeAt(s+2)]>>2,o[a++]=t>>8&255,o[a++]=t&255),o}function ut(e){return O[e>>18&63]+O[e>>12&63]+O[e>>6&63]+O[e&63]}function lt(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),i.push(ut(n));return i.join("")}function ct(e){for(var t,r=e.length,n=r%3,i=[],o=16383,a=0,f=r-n;a<f;a+=o)i.push(lt(e,a,a+o>f?f:a+o));return n===1?(t=e[r-1],i.push(O[t>>2]+O[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(O[t>>10]+O[t>>4&63]+O[t<<2&63]+"=")),i.join("")}});var Se=S((Yt,Oe)=>{"use strict";var Z,l,Pe={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
2
- `,r:"\r",t:" "},ae;function M(e){throw{name:"SyntaxError",message:e,at:Z,text:ae}}function c(e){return e&&e!==l&&M("Expected '"+e+"' instead of '"+l+"'"),l=ae.charAt(Z),Z+=1,l}function Te(){var e,t="";for(l==="-"&&(t="-",c("-"));l>="0"&&l<="9";)t+=l,c();if(l===".")for(t+=".";c()&&l>="0"&&l<="9";)t+=l;if(l==="e"||l==="E")for(t+=l,c(),(l==="-"||l==="+")&&(t+=l,c());l>="0"&&l<="9";)t+=l,c();return e=Number(t),isFinite(e)||M("Bad number"),e}function Ae(){var e,t,r="",n;if(l==='"')for(;c();){if(l==='"')return c(),r;if(l==="\\")if(c(),l==="u"){for(n=0,t=0;t<4&&(e=parseInt(c(),16),!!isFinite(e));t+=1)n=n*16+e;r+=String.fromCharCode(n)}else if(typeof Pe[l]=="string")r+=Pe[l];else break;else r+=l}M("Bad string")}function k(){for(;l&&l<=" ";)c()}function pt(){switch(l){case"t":return c("t"),c("r"),c("u"),c("e"),!0;case"f":return c("f"),c("a"),c("l"),c("s"),c("e"),!1;case"n":return c("n"),c("u"),c("l"),c("l"),null;default:M("Unexpected '"+l+"'")}}function dt(){var e=[];if(l==="["){if(c("["),k(),l==="]")return c("]"),e;for(;l;){if(e.push(K()),k(),l==="]")return c("]"),e;c(","),k()}}M("Bad array")}function yt(){var e,t={};if(l==="{"){if(c("{"),k(),l==="}")return c("}"),t;for(;l;){if(e=Ae(),k(),c(":"),Object.prototype.hasOwnProperty.call(t,e)&&M('Duplicate key "'+e+'"'),t[e]=K(),k(),l==="}")return c("}"),t;c(","),k()}}M("Bad object")}function K(){switch(k(),l){case"{":return yt();case"[":return dt();case'"':return Ae();case"-":return Te();default:return l>="0"&&l<="9"?Te():pt()}}Oe.exports=function(e,t){var r;return ae=e,Z=0,l=" ",r=K(),k(),l&&M("Syntax error"),typeof t=="function"?function n(i,o){var a,f,s=i[o];if(s&&typeof s=="object")for(a in K)Object.prototype.hasOwnProperty.call(s,a)&&(f=n(s,a),typeof f>"u"?delete s[a]:s[a]=f);return t.call(i,o,s)}({"":r},""):r}});var Fe=S((Zt,ke)=>{"use strict";var fe=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,E,W,mt={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},R;function ue(e){return fe.lastIndex=0,fe.test(e)?'"'+e.replace(fe,function(t){var r=mt[t];return typeof r=="string"?r:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function Q(e,t){var r,n,i,o,a=E,f,s=t[e];switch(s&&typeof s=="object"&&typeof s.toJSON=="function"&&(s=s.toJSON(e)),typeof R=="function"&&(s=R.call(t,e,s)),typeof s){case"string":return ue(s);case"number":return isFinite(s)?String(s):"null";case"boolean":case"null":return String(s);case"object":if(!s)return"null";if(E+=W,f=[],Object.prototype.toString.apply(s)==="[object Array]"){for(o=s.length,r=0;r<o;r+=1)f[r]=Q(r,s)||"null";return i=f.length===0?"[]":E?`[
3
- `+E+f.join(`,
4
- `+E)+`
5
- `+a+"]":"["+f.join(",")+"]",E=a,i}if(R&&typeof R=="object")for(o=R.length,r=0;r<o;r+=1)n=R[r],typeof n=="string"&&(i=Q(n,s),i&&f.push(ue(n)+(E?": ":":")+i));else for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(i=Q(n,s),i&&f.push(ue(n)+(E?": ":":")+i));return i=f.length===0?"{}":E?`{
6
- `+E+f.join(`,
7
- `+E)+`
8
- `+a+"}":"{"+f.join(",")+"}",E=a,i;default:}}ke.exports=function(e,t,r){var n;if(E="",W="",typeof r=="number")for(n=0;n<r;n+=1)W+=" ";else typeof r=="string"&&(W=r);if(R=t,t&&typeof t!="function"&&(typeof t!="object"||typeof t.length!="number"))throw new Error("JSON.stringify");return Q("",{"":e})}});var Me=S(le=>{"use strict";le.parse=Se();le.stringify=Fe()});var je=S((Wt,Ce)=>{"use strict";var X=typeof JSON<"u"?JSON:Me(),ht=Array.isArray||function(e){return{}.toString.call(e)==="[object Array]"},gt=Object.keys||function(e){var t=Object.prototype.hasOwnProperty||function(){return!0},r=[];for(var n in e)t.call(e,n)&&r.push(n);return r};Ce.exports=function(e,t){t||(t={}),typeof t=="function"&&(t={cmp:t});var r=t.space||"";typeof r=="number"&&(r=Array(r+1).join(" "));var n=typeof t.cycles=="boolean"?t.cycles:!1,i=t.replacer||function(f,s){return s},o=t.cmp&&function(f){return function(s){return function(p,u){var g={key:p,value:s[p]},x={key:u,value:s[u]};return f(g,x)}}}(t.cmp),a=[];return function f(s,p,u,g){var x=r?`
9
- `+new Array(g+1).join(r):"",F=r?": ":":";if(u&&u.toJSON&&typeof u.toJSON=="function"&&(u=u.toJSON()),u=i.call(s,p,u),u!==void 0){if(typeof u!="object"||u===null)return X.stringify(u);if(ht(u)){for(var A=[],y=0;y<u.length;y++){var J=f(u,y,u[y],g+1)||X.stringify(null);A.push(x+r+J)}return"["+A.join(",")+x+"]"}if(a.indexOf(u)!==-1){if(n)return X.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}else a.push(u);for(var P=gt(u).sort(o&&o(u)),A=[],y=0;y<P.length;y++){var p=P[y],m=f(u,p,u[p],g+1);if(m){var G=X.stringify(p)+F+m;A.push(x+r+G)}}return a.splice(a.indexOf(u),1),"{"+A.join(",")+x+"}"}}({"":e},"",e,0)}});var me=S(d=>{"use strict";var _e=d&&d.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};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 xt(e){let{definitions:t,nullable:r,metadata:n}=e,i=_e(e,["definitions","nullable","metadata"]);return Object.keys(i).length===0}d.isEmptyForm=xt;function Ne(e){return"ref"in e}d.isRefForm=Ne;function Et(e){return"type"in e}d.isTypeForm=Et;function $e(e){return"enum"in e}d.isEnumForm=$e;function Le(e){return"elements"in e}d.isElementsForm=Le;function ye(e){return"properties"in e||"optionalProperties"in e}d.isPropertiesForm=ye;function De(e){return"values"in e}d.isValuesForm=De;function He(e){return"discriminator"in e}d.isDiscriminatorForm=He;function I(e,t){if(t===void 0&&(t=e),e.definitions!==void 0){if(t!==e)return!1;for(let r of Object.values(e.definitions))if(!I(r,t))return!1}if(Ne(e)&&!(e.ref in(t.definitions||{}))||$e(e)&&(e.enum.length===0||e.enum.length!==new Set(e.enum).size))return!1;if(Le(e))return I(e.elements,t);if(ye(e)){for(let r of Object.values(e.properties||{}))if(!I(r,t))return!1;for(let r of Object.values(e.optionalProperties||{}))if(!I(r,t))return!1;for(let r of Object.keys(e.properties||{}))if(r in(e.optionalProperties||{}))return!1}if(De(e))return I(e.values,t);if(He(e)){for(let r of Object.values(e.mapping))if(!I(r,t)||!ye(r)||r.nullable||e.discriminator in(r.properties||{})||e.discriminator in(r.optionalProperties||{}))return!1}return!0}d.isValidSchema=I;var Pt=[[!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]],Tt=["boolean","float32","float64","int8","uint8","int16","uint16","int32","uint32","string","timestamp"];function _(e){if(typeof e!="object"||Array.isArray(e)||e===null)return!1;let t=e,{definitions:r=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:p=void 0,optionalProperties:u=void 0,additionalProperties:g=void 0,values:x=void 0,discriminator:F=void 0,mapping:y=void 0}=t,J=_e(t,["definitions","nullable","metadata","ref","type","enum","elements","properties","optionalProperties","additionalProperties","values","discriminator","mapping"]),P=[o!==void 0,a!==void 0,f!==void 0,s!==void 0,p!==void 0,u!==void 0,g!==void 0,x!==void 0,F!==void 0,y!==void 0],A=!1;for(let m of Pt)A=A||m.every((G,V)=>G===P[V]);if(!A)return!1;if(r!==void 0){if(typeof r!="object"||Array.isArray(r)||r===null)return!1;for(let m of Object.values(r))if(!_(m))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"||!Tt.includes(a))||f!==void 0&&(!Array.isArray(f)||!f.every(m=>typeof m=="string"))||s!==void 0&&!_(s))return!1;if(p!==void 0){if(typeof p!="object"||Array.isArray(p)||p===null)return!1;for(let m of Object.values(p))if(!_(m))return!1}if(u!==void 0){if(typeof u!="object"||Array.isArray(u)||u===null)return!1;for(let m of Object.values(u))if(!_(m))return!1}if(g!==void 0&&typeof g!="boolean"||x!==void 0&&!_(x)||F!==void 0&&typeof F!="string")return!1;if(y!==void 0){if(typeof y!="object"||Array.isArray(y)||y===null)return!1;for(let m of Object.values(y))if(!_(m))return!1}return Object.keys(J).length===0}d.isSchema=_});var Ue=S(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});var At=/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(\.\d+)?([zZ]|((\+|-)(\d{2}):(\d{2})))$/;function Ot(e){let t=e.match(At);if(t===null)return!1;let r=parseInt(t[1],10),n=parseInt(t[2],10),i=parseInt(t[3],10),o=parseInt(t[4],10),a=parseInt(t[5],10),f=parseInt(t[6],10);return!(n>12||i>St(r,n)||o>23||a>59||f>60)}he.default=Ot;function St(e,t){return t===2?kt(e)?29:28:Ft[t]}function kt(e){return e%4===0&&(e%100!==0||e%400===0)}var Ft=[0,31,0,31,30,31,30,31,31,30,31,30,31]});var Je=S(C=>{"use strict";var Mt=C&&C.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(C,"__esModule",{value:!0});C.validate=C.MaxDepthExceededError=void 0;var Ct=Mt(Ue()),N=me(),te=class extends Error{};C.MaxDepthExceededError=te;var re=class extends Error{};function jt(e,t,r){let n={errors:[],instanceTokens:[],schemaTokens:[[]],root:e,config:r||{maxDepth:0,maxErrors:0}};try{D(n,e,t)}catch(i){if(!(i instanceof re))throw i}return n.errors}C.validate=jt;function D(e,t,r,n){if(!(t.nullable&&r===null)){if(N.isRefForm(t)){if(e.schemaTokens.length===e.config.maxDepth)throw new te;e.schemaTokens.push(["definitions",t.ref]),D(e,e.root.definitions[t.ref],r),e.schemaTokens.pop()}else if(N.isTypeForm(t)){switch(b(e,"type"),t.type){case"boolean":typeof r!="boolean"&&w(e);break;case"float32":case"float64":typeof r!="number"&&w(e);break;case"int8":H(e,r,-128,127);break;case"uint8":H(e,r,0,255);break;case"int16":H(e,r,-32768,32767);break;case"uint16":H(e,r,0,65535);break;case"int32":H(e,r,-2147483648,2147483647);break;case"uint32":H(e,r,0,4294967295);break;case"string":typeof r!="string"&&w(e);break;case"timestamp":typeof r!="string"?w(e):Ct.default(r)||w(e);break}v(e)}else if(N.isEnumForm(t))b(e,"enum"),(typeof r!="string"||!t.enum.includes(r))&&w(e),v(e);else if(N.isElementsForm(t)){if(b(e,"elements"),Array.isArray(r))for(let[i,o]of r.entries())$(e,i.toString()),D(e,t.elements,o),L(e);else w(e);v(e)}else if(N.isPropertiesForm(t))if(typeof r=="object"&&r!==null&&!Array.isArray(r)){if(t.properties!==void 0){b(e,"properties");for(let[i,o]of Object.entries(t.properties))b(e,i),r.hasOwnProperty(i)?($(e,i),D(e,o,r[i]),L(e)):w(e),v(e);v(e)}if(t.optionalProperties!==void 0){b(e,"optionalProperties");for(let[i,o]of Object.entries(t.optionalProperties))b(e,i),r.hasOwnProperty(i)&&($(e,i),D(e,o,r[i]),L(e)),v(e);v(e)}if(t.additionalProperties!==!0)for(let i of Object.keys(r)){let o=t.properties&&i in t.properties,a=t.optionalProperties&&i in t.optionalProperties;!o&&!a&&i!==n&&($(e,i),w(e),L(e))}}else t.properties!==void 0?b(e,"properties"):b(e,"optionalProperties"),w(e),v(e);else if(N.isValuesForm(t)){if(b(e,"values"),typeof r=="object"&&r!==null&&!Array.isArray(r))for(let[i,o]of Object.entries(r))$(e,i),D(e,t.values,o),L(e);else w(e);v(e)}else if(N.isDiscriminatorForm(t))if(typeof r=="object"&&r!==null&&!Array.isArray(r))if(r.hasOwnProperty(t.discriminator)){let i=r[t.discriminator];typeof i=="string"?i in t.mapping?(b(e,"mapping"),b(e,i),D(e,t.mapping[i],r,t.discriminator),v(e),v(e)):(b(e,"mapping"),$(e,t.discriminator),w(e),L(e),v(e)):(b(e,"discriminator"),$(e,t.discriminator),w(e),L(e),v(e))}else b(e,"discriminator"),w(e),v(e);else b(e,"discriminator"),w(e),v(e)}}function H(e,t,r,n){(typeof t!="number"||!Number.isInteger(t)||t<r||t>n)&&w(e)}function $(e,t){e.instanceTokens.push(t)}function L(e){e.instanceTokens.pop()}function b(e,t){e.schemaTokens[e.schemaTokens.length-1].push(t)}function v(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 re}});var qe=S(j=>{"use strict";var Bt=j&&j.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Ve=j&&j.__exportStar||function(e,t){for(var r in e)r!=="default"&&!t.hasOwnProperty(r)&&Bt(t,e,r)};Object.defineProperty(j,"__esModule",{value:!0});Ve(me(),j);Ve(Je(),j)});var Ke=oe(Ee()),We=oe(je());var ee,bt=new Uint8Array(16);function ce(){if(!ee&&(ee=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ee))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ee(bt)}var h=[];for(let e=0;e<256;++e)h.push((e+256).toString(16).slice(1));function Be(e,t=0){return(h[e[t+0]]+h[e[t+1]]+h[e[t+2]]+h[e[t+3]]+"-"+h[e[t+4]]+h[e[t+5]]+"-"+h[e[t+6]]+h[e[t+7]]+"-"+h[e[t+8]]+h[e[t+9]]+"-"+h[e[t+10]]+h[e[t+11]]+h[e[t+12]]+h[e[t+13]]+h[e[t+14]]+h[e[t+15]]).toLowerCase()}var wt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),pe={randomUUID:wt};function vt(e,t,r){if(pe.randomUUID&&!t&&!e)return pe.randomUUID();e=e||{};let n=e.random||(e.rng||ce)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return Be(n)}var q=vt;function de(e){return[...new Uint8Array(e)].map(t=>t.toString(16).padStart(2,"0")).join("")}function Re(e){return new Uint8Array((e.match(/../g)??[]).map(t=>parseInt(t,16)))}function Ie(e){let t=0;for(let i of e)t+=i.length;let r=new Uint8Array(t),n=0;for(let i of e)r.set(i,n),n+=i.length;return r}var ze=oe(qe());function z(e,t){if((0,ze.validate)(e,t).length)throw new Error(`couldn't validate schema: ${JSON.stringify(t)} didn't match schema ${JSON.stringify(e)}`)}var Ge="3",Qe="https://webapp-prod.cloud.remarkable.engineering",Rt="https://internal.cloud.remarkable.com",Ye="x-goog-generation",It="x-goog-if-generation-match",_t="x-goog-content-length-range",gr=["Ballpoint","Ballpointv2","Brush","Calligraphy","ClearPage","EraseSection","Eraser","Fineliner","Finelinerv2","Highlighter","Highlighterv2","Marker","Markerv2","Paintbrush","Paintbrushv2","Pencilv2","SharpPencil","SharpPencilv2","SolidPen","ZoomTool"],br=["Maison Neue","EB Garamond","Noto Sans","Noto Serif","Noto Mono","Noto Sans UI"],Nt={xs:.7,sm:.8,md:1,lg:1.2,xl:1.5,xx:2},$t={sm:50,md:125,rr:180,lg:200},Lt={df:-1,md:100,lg:150,xl:200},Dt={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"}}},ne={visibleName:{type:"string"},lastModified:{type:"string"}},ie={version:{type:"int32"},pinned:{type:"boolean"},synced:{type:"boolean"},modified:{type:"boolean"},deleted:{type:"boolean"},metadatamodified:{type:"boolean"},parent:{type:"string"}},Ut={discriminator:"type",mapping:{CollectionType:{properties:ne,optionalProperties:ie},DocumentType:{properties:ne,optionalProperties:{...ie,lastOpened:{type:"string"},lastOpenedPage:{type:"int32"}}}}},Ze={id:{type:"string"},hash:{type:"string"}},Jt={discriminator:"type",mapping:{CollectionType:{properties:{...ne,...Ze},optionalProperties:ie},DocumentType:{properties:{...ne,...Ze,fileType:{enum:["notebook","epub","pdf",""]}},optionalProperties:{...ie,lastOpened:{type:"string"},lastOpenedPage:{type:"int32"}}}}},U=class extends Error{status;statusText;constructor(t,r,n){super(n),this.status=t,this.statusText=r}},ge=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 wr(e,{deviceDesc:t="browser-chrome",uuid:r=q(),authHost:n=Qe,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:t,deviceID:r})});if(o.ok)return await o.text();throw new U(o.status,o.statusText,"couldn't register api")}function Vt({hash:e,type:t,documentId:r,subfiles:n,size:i}){return`${e}:${t}:${r}:${n}:${i}
10
- `}function qt(e){let[t,r,n,i,o]=e.split(":");if(t===void 0||r===void 0||n===void 0||i===void 0||o===void 0)throw new Error(`entries line didn't contain five fields: '${e}'`);if(r==="80000000")return{hash:t,type:r,documentId:n,subfiles:parseInt(i),size:BigInt(o)};if(r==="0"){if(i!=="0")throw new Error(`file type entry had nonzero number of subfiles: ${i}`);return{hash:t,type:r,documentId:n,subfiles:0,size:BigInt(o)}}else throw new Error(`entries line contained invalid type: ${r}`)}var be=class{#u;#a;#f;#r;#n;#e=new Map;#t=null;constructor(t,r,n,i,o,a){this.#u=t,this.#a=r,this.#f=n,this.#r=i,this.#n=o;for(let[f,s]of a)this.#e.set(f,Promise.resolve(s))}async#i(t,{body:r,method:n="POST",headers:i={}}){let o=await this.#a(t,{method:n,headers:{Authorization:`Bearer ${this.#u}`,...i},body:r});if(o.ok)return o;{let a=await o.text();throw new U(o.status,o.statusText,`failed reMarkable request: ${a}`)}}async#o({url:t,method:r,maxuploadsize_bytes:n},i,o={}){let a=n?{...o,[_t]:`0,${n}`}:o,f=await this.#a(t,{method:r,body:i,headers:a});if(f.ok)return f;{let s=await f.text();throw new U(f.status,f.statusText,s)}}async#s(t,r,n){let i=r===void 0?"downloads":"uploads",o=n&&r!==null&&r!==void 0?`{ "http_method": "PUT", "relative_path": "${t}", "root_schema": "${n}", "generation": ${r} }`:JSON.stringify({http_method:"GET",relative_path:t}),f=await(await this.#i(`${this.#r}/sync/v2/signed-urls/${i}`,{body:o})).text(),s=JSON.parse(f);return z(Ht,s),s}async getRootHash({cache:t=!0}={}){if(t)for(;this.#t;)try{let[o,a]=await this.#t;return[o,a]}catch{}let r=(async()=>{try{let o=await this.#s("root"),a=await this.#o(o),f=a.headers.get(Ye);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=r;let[n,i]=await r;return[n,i]}async putRootHash(t,r){let n=await this.#s("root",r,t),i;try{i=await this.#o(n,t,{[It]:`${r}`})}catch(f){throw f instanceof U&&f.status===412?(this.#t=null,new ge):f}let o=i.headers.get(Ye);if(!o)throw new Error("no generation header in root hash");let a=BigInt(o);return this.#t=Promise.resolve([t,a]),a}async#l(t){let r=this.#e.get(t);for(;r;)try{let i=await r;if(i)return i;r=void 0}catch{r=this.#e.get(t)}let n=(async()=>{let i=await this.#s(t);return await(await this.#o(i)).arrayBuffer()})();return this.#e.set(t,n.then(i=>i.byteLength<this.#n?i:null,i=>{throw this.#e.delete(t),i})),await n}async getBuffer(t){let r=await this.#l(t);return r.byteLength<this.#n?r.slice(0):r}async getText(t){let r=await this.#l(t);return new TextDecoder().decode(r)}async getJson(t){let r=await this.getText(t);return JSON.parse(r)}async getMetadata(t){let r=await this.getJson(t);return z(Ut,r),r}async getEntries(t){if(t===void 0){let[o]=await this.getRootHash({cache:!0});t=o}let r=await this.getText(t),[n,...i]=r.slice(0,-1).split(`
11
- `);if(n!==Ge)throw new Error(`got unexpected schema version: ${n}`);return i.map(qt)}async#c(t,r){let n=this.#e.get(t);if(n)try{await n;return}catch{}let i=(async()=>{try{let o=await this.#s(t,null);return await this.#o(o,r),r.byteLength<this.#n?r:null}catch(o){throw this.#e.delete(t),o}})();this.#e.set(t,i),await i}async putEntries(t,r){let n=new TextEncoder;r.sort((u,g)=>u.documentId.localeCompare(g.documentId));let i=Ie(r.map(u=>Re(u.hash))),o=await this.#f.digest("SHA-256",i),a=de(o),f=r.map(Vt).join(""),s=`${Ge}
12
- ${f}`,p=n.encode(s);return await this.#c(a,p),{hash:a,type:"80000000",documentId:t,subfiles:r.length,size:0n}}async putBuffer(t,r){let n=await this.#f.digest("SHA-256",r),i=de(n);return await this.#c(i,r),{hash:i,type:"0",documentId:t,subfiles:0,size:BigInt(r.byteLength)}}async putText(t,r){let n=new TextEncoder;return await this.putBuffer(t,n.encode(r))}async putJson(t,r){return await this.putText(t,(0,We.default)(r))}async putMetadata(t,r){return await this.putJson(`${t}.metadata`,r)}async putCollection(t,r=""){let n=q(),i=`${new Date().valueOf()}`,o=[],a={type:"CollectionType",visibleName:t,version:0,parent:r,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#p(t,r,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}`,r));let p={type:"DocumentType",visibleName:t,version:0,parent:i,synced:!0,lastModified:f};s.push(this.putMetadata(a,p)),s.push(this.putText(`${a}.content`,JSON.stringify(o)));let u=await Promise.all(s);return await this.putEntries(a,u)}async putEpub(t,r,{parent:n="",margins:i=125,orientation:o,textAlignment:a,textScale:f=1,lineHeight:s=-1,fontName:p="",cover:u="visited",lastTool:g}={}){let x={dummyDocument:!1,extraMetadata:{LastTool:g},fileType:"epub",pageCount:0,lastOpenedPage:0,lineHeight:typeof s=="string"?Lt[s]:s,margins:typeof i=="string"?$t[i]:i,textScale:typeof f=="string"?Nt[f]:f,pages:[],coverPageNumber:u==="first"?0:-1,formatVersion:1,orientation:o,textAlignment:a,fontName:p};return await this.#p(t,r,"epub",n,x)}async putPdf(t,r,{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.#p(t,r,"pdf",n,f)}async syncComplete(t){let r=`{ "generation": ${t} }`;await this.#i(`${this.#r}/sync/v2/sync-complete`,{body:r})}async#d(t,r,n){let{hash:i}=await this.putEntries("",r),o=await this.putRootHash(i,t);if(n)try{return await this.syncComplete(o),!0}catch{return!1}else return!1}async create(t,{cache:r=!0,sync:n=!0}={}){let[i,o]=await this.getRootHash({cache:r}),a=await this.getEntries(i);return a.push(t),await this.#d(o,a,n)}async move(t,r,{cache:n=!0,sync:i=!0}={}){let[o,a]=await this.getRootHash({cache:n}),f=await this.getEntries(o);if(!(!r||r==="trash")){let P=f.find(V=>V.documentId===r);if(P){if(P.type!=="80000000")throw new Error(`destination id was a raw file: ${r}`)}else throw new Error(`destination id not found: ${r}`);let A=await this.getEntries(P.hash),[m]=A.filter(V=>V.documentId===`${r}.metadata`);if(!m)throw new Error(`destination id didn't have metadata: ${r}`);if((await this.getMetadata(m.hash)).type!=="CollectionType")throw new Error(`destination id wasn't a collection: ${r}`)}let s=f.findIndex(P=>P.documentId===t);if(s===-1)throw new Error(`document not found: ${t}`);let[p]=f.splice(s,1);if(p.type!=="80000000")throw new Error(`document was a raw file: ${t}`);let u=await this.getEntries(p.hash),g=u.findIndex(P=>P.documentId===`${t}.metadata`);if(g===-1)throw new Error(`document didn't have metadata: ${t}`);let[x]=u.splice(g,1),F=await this.getMetadata(x.hash);F.parent=r;let y=await this.putMetadata(t,F);u.push(y);let J=await this.putEntries(t,u);return f.push(J),await this.#d(a,f,i)}async getEntriesMetadata(){let r=await(await this.#i(`${this.#r}/doc/v2/files`,{method:"GET",headers:{"rm-source":"RoR-Browser"}})).text(),n=JSON.parse(r);return z({elements:Jt},n),n}async#y(t,r,n){let o=new TextEncoder().encode(JSON.stringify({file_name:t})),f=await(await this.#i(`${this.#r}/doc/v2/files`,{body:r,headers:{"content-type":n,"rm-meta":(0,Ke.fromByteArray)(o),"rm-source":"RoR-Browser"}})).text(),s=JSON.parse(f);return z(Dt,s),s}async uploadEpub(t,r){return await this.#y(t,r,"application/epub+zip")}async uploadPdf(t,r){return await this.#y(t,r,"application/pdf")}async getCache(){let t=[];for(let[i,o]of this.#e)t.push(o.then(a=>[i,a],()=>[i,null]));let r=await Promise.all(t),n=new Map;for(let[i,o]of r)o&&n.set(i,o);return n}};async function vr(e,{fetch:t=globalThis.fetch,subtle:r=globalThis.crypto?.subtle,authHost:n=Qe,syncHost:i=Rt,cacheLimitBytes:o=1048576,initCache:a=[]}={}){if(!r)throw new Error("subtle was missing, try specifying it manually");let f=await t(`${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 be(s,t,r,i,o,a)}export{ge as GenerationError,U as ResponseError,br as builtinFontNames,Lt as builtinLineHeights,$t as builtinMargins,Nt as builtinTextScales,gr as builtinTools,Vt as formatEntry,qt as parseEntry,wr as register,vr as remarkable};
1
+ var tn=Object.create;var tt=Object.defineProperty;var rn=Object.getOwnPropertyDescriptor;var nn=Object.getOwnPropertyNames;var on=Object.getPrototypeOf,an=Object.prototype.hasOwnProperty;var d=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var sn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of nn(e))!an.call(t,o)&&o!==r&&tt(t,o,{get:()=>e[o],enumerable:!(n=rn(e,o))||n.enumerable});return t};var ke=(t,e,r)=>(r=t!=null?tn(on(t)):{},sn(e||!t||!t.__esModule?tt(r,"default",{value:t,enumerable:!0}):r,t));var ot=d(fe=>{"use strict";fe.byteLength=un;fe.toByteArray=pn;fe.fromByteArray=dn;var I=[],F=[],fn=typeof Uint8Array<"u"?Uint8Array:Array,Ie="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(U=0,rt=Ie.length;U<rt;++U)I[U]=Ie[U],F[Ie.charCodeAt(U)]=U;var U,rt;F[45]=62;F[95]=63;function nt(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function un(t){var e=nt(t),r=e[0],n=e[1];return(r+n)*3/4-n}function ln(t,e,r){return(e+r)*3/4-r}function pn(t){var e,r=nt(t),n=r[0],o=r[1],i=new fn(ln(t,n,o)),a=0,f=o>0?n-4:n,s;for(s=0;s<f;s+=4)e=F[t.charCodeAt(s)]<<18|F[t.charCodeAt(s+1)]<<12|F[t.charCodeAt(s+2)]<<6|F[t.charCodeAt(s+3)],i[a++]=e>>16&255,i[a++]=e>>8&255,i[a++]=e&255;return o===2&&(e=F[t.charCodeAt(s)]<<2|F[t.charCodeAt(s+1)]>>4,i[a++]=e&255),o===1&&(e=F[t.charCodeAt(s)]<<10|F[t.charCodeAt(s+1)]<<4|F[t.charCodeAt(s+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function cn(t){return I[t>>18&63]+I[t>>12&63]+I[t>>6&63]+I[t&63]}function yn(t,e,r){for(var n,o=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(t[i+2]&255),o.push(cn(n));return o.join("")}function dn(t){for(var e,r=t.length,n=r%3,o=[],i=16383,a=0,f=r-n;a<f;a+=i)o.push(yn(t,a,a+i>f?f:a+i));return n===1?(e=t[r-1],o.push(I[e>>2]+I[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(I[e>>10]+I[e>>4&63]+I[e<<2&63]+"=")),o.join("")}});var ut=d((Lo,ft)=>{"use strict";var ue,l,it={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
2
+ `,r:"\r",t:" "},$e;function M(t){throw{name:"SyntaxError",message:t,at:ue,text:$e}}function g(t){return t&&t!==l&&M("Expected '"+t+"' instead of '"+l+"'"),l=$e.charAt(ue),ue+=1,l}function at(){var t,e="";for(l==="-"&&(e="-",g("-"));l>="0"&&l<="9";)e+=l,g();if(l===".")for(e+=".";g()&&l>="0"&&l<="9";)e+=l;if(l==="e"||l==="E")for(e+=l,g(),(l==="-"||l==="+")&&(e+=l,g());l>="0"&&l<="9";)e+=l,g();return t=Number(e),isFinite(t)||M("Bad number"),t}function st(){var t,e,r="",n;if(l==='"')for(;g();){if(l==='"')return g(),r;if(l==="\\")if(g(),l==="u"){for(n=0,e=0;e<4&&(t=parseInt(g(),16),!!isFinite(t));e+=1)n=n*16+t;r+=String.fromCharCode(n)}else if(typeof it[l]=="string")r+=it[l];else break;else r+=l}M("Bad string")}function $(){for(;l&&l<=" ";)g()}function gn(){switch(l){case"t":return g("t"),g("r"),g("u"),g("e"),!0;case"f":return g("f"),g("a"),g("l"),g("s"),g("e"),!1;case"n":return g("n"),g("u"),g("l"),g("l"),null;default:M("Unexpected '"+l+"'")}}function mn(){var t=[];if(l==="["){if(g("["),$(),l==="]")return g("]"),t;for(;l;){if(t.push(le()),$(),l==="]")return g("]"),t;g(","),$()}}M("Bad array")}function hn(){var t,e={};if(l==="{"){if(g("{"),$(),l==="}")return g("}"),e;for(;l;){if(t=st(),$(),g(":"),Object.prototype.hasOwnProperty.call(e,t)&&M('Duplicate key "'+t+'"'),e[t]=le(),$(),l==="}")return g("}"),e;g(","),$()}}M("Bad object")}function le(){switch($(),l){case"{":return hn();case"[":return mn();case'"':return st();case"-":return at();default:return l>="0"&&l<="9"?at():gn()}}ft.exports=function(t,e){var r;return $e=t,ue=0,l=" ",r=le(),$(),l&&M("Syntax error"),typeof e=="function"?function n(o,i){var a,f,s=o[i];if(s&&typeof s=="object")for(a in le)Object.prototype.hasOwnProperty.call(s,a)&&(f=n(s,a),typeof f>"u"?delete s[a]:s[a]=f);return e.call(o,i,s)}({"":r},""):r}});var pt=d((qo,lt)=>{"use strict";var je=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,T,pe,vn={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},N;function Re(t){return je.lastIndex=0,je.test(t)?'"'+t.replace(je,function(e){var r=vn[e];return typeof r=="string"?r:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function ce(t,e){var r,n,o,i,a=T,f,s=e[t];switch(s&&typeof s=="object"&&typeof s.toJSON=="function"&&(s=s.toJSON(t)),typeof N=="function"&&(s=N.call(e,t,s)),typeof s){case"string":return Re(s);case"number":return isFinite(s)?String(s):"null";case"boolean":case"null":return String(s);case"object":if(!s)return"null";if(T+=pe,f=[],Object.prototype.toString.apply(s)==="[object Array]"){for(i=s.length,r=0;r<i;r+=1)f[r]=ce(r,s)||"null";return o=f.length===0?"[]":T?`[
3
+ `+T+f.join(`,
4
+ `+T)+`
5
+ `+a+"]":"["+f.join(",")+"]",T=a,o}if(N&&typeof N=="object")for(i=N.length,r=0;r<i;r+=1)n=N[r],typeof n=="string"&&(o=ce(n,s),o&&f.push(Re(n)+(T?": ":":")+o));else for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(o=ce(n,s),o&&f.push(Re(n)+(T?": ":":")+o));return o=f.length===0?"{}":T?`{
6
+ `+T+f.join(`,
7
+ `+T)+`
8
+ `+a+"}":"{"+f.join(",")+"}",T=a,o;default:}}lt.exports=function(t,e,r){var n;if(T="",pe="",typeof r=="number")for(n=0;n<r;n+=1)pe+=" ";else typeof r=="string"&&(pe=r);if(N=e,e&&typeof e!="function"&&(typeof e!="object"||typeof e.length!="number"))throw new Error("JSON.stringify");return ce("",{"":t})}});var ct=d(Me=>{"use strict";Me.parse=ut();Me.stringify=pt()});var dt=d((Jo,yt)=>{var bn={}.toString;yt.exports=Array.isArray||function(t){return bn.call(t)=="[object Array]"}});var Be=d((Go,mt)=>{"use strict";var gt=Object.prototype.toString;mt.exports=function(e){var r=gt.call(e),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&gt.call(e.callee)==="[object Function]"),n}});var St=d((Vo,Et)=>{"use strict";var At;Object.keys||(re=Object.prototype.hasOwnProperty,Ce=Object.prototype.toString,ht=Be(),_e=Object.prototype.propertyIsEnumerable,vt=!_e.call({toString:null},"toString"),bt=_e.call(function(){},"prototype"),ne=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],ye=function(t){var e=t.constructor;return e&&e.prototype===t},wt={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},Pt=function(){if(typeof window>"u")return!1;for(var t in window)try{if(!wt["$"+t]&&re.call(window,t)&&window[t]!==null&&typeof window[t]=="object")try{ye(window[t])}catch{return!0}}catch{return!0}return!1}(),xt=function(t){if(typeof window>"u"||!Pt)return ye(t);try{return ye(t)}catch{return!1}},At=function(e){var r=e!==null&&typeof e=="object",n=Ce.call(e)==="[object Function]",o=ht(e),i=r&&Ce.call(e)==="[object String]",a=[];if(!r&&!n&&!o)throw new TypeError("Object.keys called on a non-object");var f=bt&&n;if(i&&e.length>0&&!re.call(e,0))for(var s=0;s<e.length;++s)a.push(String(s));if(o&&e.length>0)for(var c=0;c<e.length;++c)a.push(String(c));else for(var p in e)!(f&&p==="prototype")&&re.call(e,p)&&a.push(String(p));if(vt)for(var m=xt(e),u=0;u<ne.length;++u)!(m&&ne[u]==="constructor")&&re.call(e,ne[u])&&a.push(ne[u]);return a});var re,Ce,ht,_e,vt,bt,ne,ye,wt,Pt,xt;Et.exports=At});var kt=d((zo,Ft)=>{"use strict";var wn=Array.prototype.slice,Pn=Be(),Ot=Object.keys,de=Ot?function(e){return Ot(e)}:St(),Tt=Object.keys;de.shim=function(){if(Object.keys){var e=function(){var r=Object.keys(arguments);return r&&r.length===arguments.length}(1,2);e||(Object.keys=function(n){return Pn(n)?Tt(wn.call(n)):Tt(n)})}else Object.keys=de;return Object.keys||de};Ft.exports=de});var jt=d((Wo,$t)=>{"use strict";var xn="Function.prototype.bind called on incompatible ",An=Object.prototype.toString,En=Math.max,Sn="[object Function]",It=function(e,r){for(var n=[],o=0;o<e.length;o+=1)n[o]=e[o];for(var i=0;i<r.length;i+=1)n[i+e.length]=r[i];return n},On=function(e,r){for(var n=[],o=r||0,i=0;o<e.length;o+=1,i+=1)n[i]=e[o];return n},Tn=function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r};$t.exports=function(e){var r=this;if(typeof r!="function"||An.apply(r)!==Sn)throw new TypeError(xn+r);for(var n=On(arguments,1),o,i=function(){if(this instanceof o){var p=r.apply(this,It(n,arguments));return Object(p)===p?p:this}return r.apply(e,It(n,arguments))},a=En(0,r.length-n.length),f=[],s=0;s<a;s++)f[s]="$"+s;if(o=Function("binder","return function ("+Tn(f,",")+"){ return binder.apply(this,arguments); }")(i),r.prototype){var c=function(){};c.prototype=r.prototype,o.prototype=new c,c.prototype=null}return o}});var ge=d((Yo,Rt)=>{"use strict";var Fn=jt();Rt.exports=Function.prototype.bind||Fn});var Bt=d((Ko,Mt)=>{"use strict";Mt.exports=Error});var _t=d((Xo,Ct)=>{"use strict";Ct.exports=EvalError});var Nt=d((Zo,Ut)=>{"use strict";Ut.exports=RangeError});var Lt=d((Qo,Dt)=>{"use strict";Dt.exports=ReferenceError});var Ue=d((ei,qt)=>{"use strict";qt.exports=SyntaxError});var oe=d((ti,Ht)=>{"use strict";Ht.exports=TypeError});var Gt=d((ri,Jt)=>{"use strict";Jt.exports=URIError});var zt=d((ni,Vt)=>{"use strict";Vt.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var o=42;e[r]=o;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var i=Object.getOwnPropertySymbols(e);if(i.length!==1||i[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,r);if(a.value!==o||a.enumerable!==!0)return!1}return!0}});var Kt=d((oi,Yt)=>{"use strict";var Wt=typeof Symbol<"u"&&Symbol,kn=zt();Yt.exports=function(){return typeof Wt!="function"||typeof Symbol!="function"||typeof Wt("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:kn()}});var Zt=d((ii,Xt)=>{"use strict";var Ne={__proto__:null,foo:{}},In=Object;Xt.exports=function(){return{__proto__:Ne}.foo===Ne.foo&&!(Ne instanceof In)}});var er=d((ai,Qt)=>{"use strict";var $n=Function.prototype.call,jn=Object.prototype.hasOwnProperty,Rn=ge();Qt.exports=Rn.call($n,jn)});var Z=d((si,ir)=>{"use strict";var y,Mn=Bt(),Bn=_t(),Cn=Nt(),_n=Lt(),X=Ue(),K=oe(),Un=Gt(),or=Function,De=function(t){try{return or('"use strict"; return ('+t+").constructor;")()}catch{}},D=Object.getOwnPropertyDescriptor;if(D)try{D({},"")}catch{D=null}var Le=function(){throw new K},Nn=D?function(){try{return arguments.callee,Le}catch{try{return D(arguments,"callee").get}catch{return Le}}}():Le,W=Kt()(),Dn=Zt()(),w=Object.getPrototypeOf||(Dn?function(t){return t.__proto__}:null),Y={},Ln=typeof Uint8Array>"u"||!w?y:w(Uint8Array),L={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?y:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?y:ArrayBuffer,"%ArrayIteratorPrototype%":W&&w?w([][Symbol.iterator]()):y,"%AsyncFromSyncIteratorPrototype%":y,"%AsyncFunction%":Y,"%AsyncGenerator%":Y,"%AsyncGeneratorFunction%":Y,"%AsyncIteratorPrototype%":Y,"%Atomics%":typeof Atomics>"u"?y:Atomics,"%BigInt%":typeof BigInt>"u"?y:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?y:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?y:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?y:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Mn,"%eval%":eval,"%EvalError%":Bn,"%Float32Array%":typeof Float32Array>"u"?y:Float32Array,"%Float64Array%":typeof Float64Array>"u"?y:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?y:FinalizationRegistry,"%Function%":or,"%GeneratorFunction%":Y,"%Int8Array%":typeof Int8Array>"u"?y:Int8Array,"%Int16Array%":typeof Int16Array>"u"?y:Int16Array,"%Int32Array%":typeof Int32Array>"u"?y:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":W&&w?w(w([][Symbol.iterator]())):y,"%JSON%":typeof JSON=="object"?JSON:y,"%Map%":typeof Map>"u"?y:Map,"%MapIteratorPrototype%":typeof Map>"u"||!W||!w?y:w(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?y:Promise,"%Proxy%":typeof Proxy>"u"?y:Proxy,"%RangeError%":Cn,"%ReferenceError%":_n,"%Reflect%":typeof Reflect>"u"?y:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?y:Set,"%SetIteratorPrototype%":typeof Set>"u"||!W||!w?y:w(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?y:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":W&&w?w(""[Symbol.iterator]()):y,"%Symbol%":W?Symbol:y,"%SyntaxError%":X,"%ThrowTypeError%":Nn,"%TypedArray%":Ln,"%TypeError%":K,"%Uint8Array%":typeof Uint8Array>"u"?y:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?y:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?y:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?y:Uint32Array,"%URIError%":Un,"%WeakMap%":typeof WeakMap>"u"?y:WeakMap,"%WeakRef%":typeof WeakRef>"u"?y:WeakRef,"%WeakSet%":typeof WeakSet>"u"?y:WeakSet};if(w)try{null.error}catch(t){tr=w(w(t)),L["%Error.prototype%"]=tr}var tr,qn=function t(e){var r;if(e==="%AsyncFunction%")r=De("async function () {}");else if(e==="%GeneratorFunction%")r=De("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=De("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var o=t("%AsyncGenerator%");o&&w&&(r=w(o.prototype))}return L[e]=r,r},rr={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ie=ge(),me=er(),Hn=ie.call(Function.call,Array.prototype.concat),Jn=ie.call(Function.apply,Array.prototype.splice),nr=ie.call(Function.call,String.prototype.replace),he=ie.call(Function.call,String.prototype.slice),Gn=ie.call(Function.call,RegExp.prototype.exec),Vn=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,zn=/\\(\\)?/g,Wn=function(e){var r=he(e,0,1),n=he(e,-1);if(r==="%"&&n!=="%")throw new X("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new X("invalid intrinsic syntax, expected opening `%`");var o=[];return nr(e,Vn,function(i,a,f,s){o[o.length]=f?nr(s,zn,"$1"):a||i}),o},Yn=function(e,r){var n=e,o;if(me(rr,n)&&(o=rr[n],n="%"+o[0]+"%"),me(L,n)){var i=L[n];if(i===Y&&(i=qn(n)),typeof i>"u"&&!r)throw new K("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:i}}throw new X("intrinsic "+e+" does not exist!")};ir.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new K("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new K('"allowMissing" argument must be a boolean');if(Gn(/^%?[^%]*%?$/,e)===null)throw new X("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Wn(e),o=n.length>0?n[0]:"",i=Yn("%"+o+"%",r),a=i.name,f=i.value,s=!1,c=i.alias;c&&(o=c[0],Jn(n,Hn([0,1],c)));for(var p=1,m=!0;p<n.length;p+=1){var u=n[p],S=he(u,0,1),v=he(u,-1);if((S==='"'||S==="'"||S==="`"||v==='"'||v==="'"||v==="`")&&S!==v)throw new X("property names with quotes must have matching quotes");if((u==="constructor"||!m)&&(s=!0),o+="."+u,a="%"+o+"%",me(L,a))f=L[a];else if(f!=null){if(!(u in f)){if(!r)throw new K("base intrinsic for "+e+" exists, but the property is not available.");return}if(D&&p+1>=n.length){var k=D(f,u);m=!!k,m&&"get"in k&&!("originalValue"in k.get)?f=k.get:f=f[u]}else m=me(f,u),f=f[u];m&&!s&&(L[a]=f)}}return f}});var be=d((fi,ar)=>{"use strict";var Kn=Z(),ve=Kn("%Object.defineProperty%",!0)||!1;if(ve)try{ve({},"a",{value:1})}catch{ve=!1}ar.exports=ve});var qe=d((ui,sr)=>{"use strict";var Xn=Z(),we=Xn("%Object.getOwnPropertyDescriptor%",!0);if(we)try{we([],"length")}catch{we=null}sr.exports=we});var pr=d((li,lr)=>{"use strict";var fr=be(),Zn=Ue(),Q=oe(),ur=qe();lr.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new Q("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Q("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Q("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Q("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Q("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Q("`loose`, if provided, must be a boolean");var o=arguments.length>3?arguments[3]:null,i=arguments.length>4?arguments[4]:null,a=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,s=!!ur&&ur(e,r);if(fr)fr(e,r,{configurable:a===null&&s?s.configurable:!a,enumerable:o===null&&s?s.enumerable:!o,value:n,writable:i===null&&s?s.writable:!i});else if(f||!o&&!i&&!a)e[r]=n;else throw new Zn("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var dr=d((pi,yr)=>{"use strict";var He=be(),cr=function(){return!!He};cr.hasArrayLengthDefineBug=function(){if(!He)return null;try{return He([],"length",{value:1}).length!==1}catch{return!0}};yr.exports=cr});var br=d((ci,vr)=>{"use strict";var Qn=Z(),gr=pr(),eo=dr()(),mr=qe(),hr=oe(),to=Qn("%Math.floor%");vr.exports=function(e,r){if(typeof e!="function")throw new hr("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||to(r)!==r)throw new hr("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],o=!0,i=!0;if("length"in e&&mr){var a=mr(e,"length");a&&!a.configurable&&(o=!1),a&&!a.writable&&(i=!1)}return(o||i||!n)&&(eo?gr(e,"length",r,!0,!0):gr(e,"length",r)),e}});var Ge=d((yi,Pe)=>{"use strict";var Je=ge(),xe=Z(),ro=br(),no=oe(),xr=xe("%Function.prototype.apply%"),Ar=xe("%Function.prototype.call%"),Er=xe("%Reflect.apply%",!0)||Je.call(Ar,xr),wr=be(),oo=xe("%Math.max%");Pe.exports=function(e){if(typeof e!="function")throw new no("a function is required");var r=Er(Je,Ar,arguments);return ro(r,1+oo(0,e.length-(arguments.length-1)),!0)};var Pr=function(){return Er(Je,xr,arguments)};wr?wr(Pe.exports,"apply",{value:Pr}):Pe.exports.apply=Pr});var Fr=d((di,Tr)=>{"use strict";var Sr=Z(),Or=Ge(),io=Or(Sr("String.prototype.indexOf"));Tr.exports=function(e,r){var n=Sr(e,!!r);return typeof n=="function"&&io(e,".prototype.")>-1?Or(n):n}});var Rr=d((gi,jr)=>{"use strict";var Ae=(typeof JSON<"u"?JSON:ct()).stringify,ao=dt(),so=kt(),fo=Ge(),$r=Fr(),kr=$r("Array.prototype.join"),Ve=$r("Array.prototype.push"),Ir=function(e,r){for(var n="",o=0;o<e;o+=1)n+=r;return n},uo=function(t,e,r){return r};jr.exports=function(e){var r=arguments.length>1?arguments[1]:void 0,n=r&&r.space||"";typeof n=="number"&&(n=Ir(n," "));var o=!!r&&typeof r.cycles=="boolean"&&r.cycles,i=r&&r.replacer?fo(r.replacer):uo,a=typeof r=="function"?r:r&&r.cmp,f=a&&function(c){var p=a.length>2&&function(u){return c[u]};return function(m,u){return a({key:m,value:c[m]},{key:u,value:c[u]},p?{__proto__:null,get:p}:void 0)}},s=[];return function c(p,m,u,S){var v=n?`
9
+ `+Ir(S,n):"",k=n?": ":":";if(u&&u.toJSON&&typeof u.toJSON=="function"&&(u=u.toJSON()),u=i(p,m,u),u!==void 0){if(typeof u!="object"||u===null)return Ae(u);if(ao(u)){for(var j=[],b=0;b<u.length;b++){var _=c(u,b,u[b],S+1)||Ae(null);Ve(j,v+n+_)}return"["+kr(j,",")+v+"]"}if(s.indexOf(u)!==-1){if(o)return Ae("__cycle__");throw new TypeError("Converting circular structure to JSON")}else Ve(s,u);for(var P=so(u).sort(f&&f(u)),j=[],b=0;b<P.length;b++){var m=P[b],R=c(u,m,u[m],S+1);if(R){var en=Ae(m)+k+R;Ve(j,v+n+en)}}return s.splice(s.indexOf(u),1),"{"+kr(j,",")+v+"}"}}({"":e},"",e,0)}});var Xe=d(h=>{"use strict";var _r=h&&h.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r};Object.defineProperty(h,"__esModule",{value:!0});h.isSchema=h.isValidSchema=h.isDiscriminatorForm=h.isValuesForm=h.isPropertiesForm=h.isElementsForm=h.isEnumForm=h.isTypeForm=h.isRefForm=h.isEmptyForm=void 0;function yo(t){let{definitions:e,nullable:r,metadata:n}=t,o=_r(t,["definitions","nullable","metadata"]);return Object.keys(o).length===0}h.isEmptyForm=yo;function Ur(t){return"ref"in t}h.isRefForm=Ur;function go(t){return"type"in t}h.isTypeForm=go;function Nr(t){return"enum"in t}h.isEnumForm=Nr;function Dr(t){return"elements"in t}h.isElementsForm=Dr;function Ke(t){return"properties"in t||"optionalProperties"in t}h.isPropertiesForm=Ke;function Lr(t){return"values"in t}h.isValuesForm=Lr;function qr(t){return"discriminator"in t}h.isDiscriminatorForm=qr;function q(t,e){if(e===void 0&&(e=t),t.definitions!==void 0){if(e!==t)return!1;for(let r of Object.values(t.definitions))if(!q(r,e))return!1}if(Ur(t)&&!(t.ref in(e.definitions||{}))||Nr(t)&&(t.enum.length===0||t.enum.length!==new Set(t.enum).size))return!1;if(Dr(t))return q(t.elements,e);if(Ke(t)){for(let r of Object.values(t.properties||{}))if(!q(r,e))return!1;for(let r of Object.values(t.optionalProperties||{}))if(!q(r,e))return!1;for(let r of Object.keys(t.properties||{}))if(r in(t.optionalProperties||{}))return!1}if(Lr(t))return q(t.values,e);if(qr(t)){for(let r of Object.values(t.mapping))if(!q(r,e)||!Ke(r)||r.nullable||t.discriminator in(r.properties||{})||t.discriminator in(r.optionalProperties||{}))return!1}return!0}h.isValidSchema=q;var mo=[[!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]],ho=["boolean","float32","float64","int8","uint8","int16","uint16","int32","uint32","string","timestamp"];function H(t){if(typeof t!="object"||Array.isArray(t)||t===null)return!1;let e=t,{definitions:r=void 0,nullable:n=void 0,metadata:o=void 0,ref:i=void 0,type:a=void 0,enum:f=void 0,elements:s=void 0,properties:c=void 0,optionalProperties:p=void 0,additionalProperties:m=void 0,values:u=void 0,discriminator:S=void 0,mapping:v=void 0}=e,k=_r(e,["definitions","nullable","metadata","ref","type","enum","elements","properties","optionalProperties","additionalProperties","values","discriminator","mapping"]),b=[i!==void 0,a!==void 0,f!==void 0,s!==void 0,c!==void 0,p!==void 0,m!==void 0,u!==void 0,S!==void 0,v!==void 0],_=!1;for(let P of mo)_=_||P.every((j,R)=>j===b[R]);if(!_)return!1;if(r!==void 0){if(typeof r!="object"||Array.isArray(r)||r===null)return!1;for(let P of Object.values(r))if(!H(P))return!1}if(n!==void 0&&typeof n!="boolean"||o!==void 0&&(typeof o!="object"||Array.isArray(o)||o===null)||i!==void 0&&typeof i!="string"||a!==void 0&&(typeof a!="string"||!ho.includes(a))||f!==void 0&&(!Array.isArray(f)||!f.every(P=>typeof P=="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 P of Object.values(c))if(!H(P))return!1}if(p!==void 0){if(typeof p!="object"||Array.isArray(p)||p===null)return!1;for(let P of Object.values(p))if(!H(P))return!1}if(m!==void 0&&typeof m!="boolean"||u!==void 0&&!H(u)||S!==void 0&&typeof S!="string")return!1;if(v!==void 0){if(typeof v!="object"||Array.isArray(v)||v===null)return!1;for(let P of Object.values(v))if(!H(P))return!1}return Object.keys(k).length===0}h.isSchema=H});var Hr=d(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});var vo=/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(\.\d+)?([zZ]|((\+|-)(\d{2}):(\d{2})))$/;function bo(t){let e=t.match(vo);if(e===null)return!1;let r=parseInt(e[1],10),n=parseInt(e[2],10),o=parseInt(e[3],10),i=parseInt(e[4],10),a=parseInt(e[5],10),f=parseInt(e[6],10);return!(n>12||o>wo(r,n)||i>23||a>59||f>60)}Ze.default=bo;function wo(t,e){return e===2?Po(t)?29:28:xo[e]}function Po(t){return t%4===0&&(t%100!==0||t%400===0)}var xo=[0,31,0,31,30,31,30,31,31,30,31,30,31]});var Jr=d(B=>{"use strict";var Ao=B&&B.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(B,"__esModule",{value:!0});B.validate=B.MaxDepthExceededError=void 0;var Eo=Ao(Hr()),J=Xe(),Se=class extends Error{};B.MaxDepthExceededError=Se;var Oe=class extends Error{};function So(t,e,r){let n={errors:[],instanceTokens:[],schemaTokens:[[]],root:t,config:r||{maxDepth:0,maxErrors:0}};try{z(n,t,e)}catch(o){if(!(o instanceof Oe))throw o}return n.errors}B.validate=So;function z(t,e,r,n){if(!(e.nullable&&r===null)){if(J.isRefForm(e)){if(t.schemaTokens.length===t.config.maxDepth)throw new Se;t.schemaTokens.push(["definitions",e.ref]),z(t,t.root.definitions[e.ref],r),t.schemaTokens.pop()}else if(J.isTypeForm(e)){switch(A(t,"type"),e.type){case"boolean":typeof r!="boolean"&&E(t);break;case"float32":case"float64":typeof r!="number"&&E(t);break;case"int8":ee(t,r,-128,127);break;case"uint8":ee(t,r,0,255);break;case"int16":ee(t,r,-32768,32767);break;case"uint16":ee(t,r,0,65535);break;case"int32":ee(t,r,-2147483648,2147483647);break;case"uint32":ee(t,r,0,4294967295);break;case"string":typeof r!="string"&&E(t);break;case"timestamp":typeof r!="string"?E(t):Eo.default(r)||E(t);break}O(t)}else if(J.isEnumForm(e))A(t,"enum"),(typeof r!="string"||!e.enum.includes(r))&&E(t),O(t);else if(J.isElementsForm(e)){if(A(t,"elements"),Array.isArray(r))for(let[o,i]of r.entries())G(t,o.toString()),z(t,e.elements,i),V(t);else E(t);O(t)}else if(J.isPropertiesForm(e))if(typeof r=="object"&&r!==null&&!Array.isArray(r)){if(e.properties!==void 0){A(t,"properties");for(let[o,i]of Object.entries(e.properties))A(t,o),r.hasOwnProperty(o)?(G(t,o),z(t,i,r[o]),V(t)):E(t),O(t);O(t)}if(e.optionalProperties!==void 0){A(t,"optionalProperties");for(let[o,i]of Object.entries(e.optionalProperties))A(t,o),r.hasOwnProperty(o)&&(G(t,o),z(t,i,r[o]),V(t)),O(t);O(t)}if(e.additionalProperties!==!0)for(let o of Object.keys(r)){let i=e.properties&&o in e.properties,a=e.optionalProperties&&o in e.optionalProperties;!i&&!a&&o!==n&&(G(t,o),E(t),V(t))}}else e.properties!==void 0?A(t,"properties"):A(t,"optionalProperties"),E(t),O(t);else if(J.isValuesForm(e)){if(A(t,"values"),typeof r=="object"&&r!==null&&!Array.isArray(r))for(let[o,i]of Object.entries(r))G(t,o),z(t,e.values,i),V(t);else E(t);O(t)}else if(J.isDiscriminatorForm(e))if(typeof r=="object"&&r!==null&&!Array.isArray(r))if(r.hasOwnProperty(e.discriminator)){let o=r[e.discriminator];typeof o=="string"?o in e.mapping?(A(t,"mapping"),A(t,o),z(t,e.mapping[o],r,e.discriminator),O(t),O(t)):(A(t,"mapping"),G(t,e.discriminator),E(t),V(t),O(t)):(A(t,"discriminator"),G(t,e.discriminator),E(t),V(t),O(t))}else A(t,"discriminator"),E(t),O(t);else A(t,"discriminator"),E(t),O(t)}}function ee(t,e,r,n){(typeof e!="number"||!Number.isInteger(e)||e<r||e>n)&&E(t)}function G(t,e){t.instanceTokens.push(e)}function V(t){t.instanceTokens.pop()}function A(t,e){t.schemaTokens[t.schemaTokens.length-1].push(e)}function O(t){t.schemaTokens[t.schemaTokens.length-1].pop()}function E(t){if(t.errors.push({instancePath:[...t.instanceTokens],schemaPath:[...t.schemaTokens[t.schemaTokens.length-1]]}),t.errors.length===t.config.maxErrors)throw new Oe}});var Vr=d(C=>{"use strict";var Oo=C&&C.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gr=C&&C.__exportStar||function(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&Oo(e,t,r)};Object.defineProperty(C,"__esModule",{value:!0});Gr(Xe(),C);Gr(Jr(),C)});var Xr=ke(ot()),Zr=ke(Rr());var Ee,lo=new Uint8Array(16);function ze(){if(!Ee&&(Ee=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ee))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ee(lo)}var x=[];for(let t=0;t<256;++t)x.push((t+256).toString(16).slice(1));function Mr(t,e=0){return x[t[e+0]]+x[t[e+1]]+x[t[e+2]]+x[t[e+3]]+"-"+x[t[e+4]]+x[t[e+5]]+"-"+x[t[e+6]]+x[t[e+7]]+"-"+x[t[e+8]]+x[t[e+9]]+"-"+x[t[e+10]]+x[t[e+11]]+x[t[e+12]]+x[t[e+13]]+x[t[e+14]]+x[t[e+15]]}var po=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),We={randomUUID:po};function co(t,e,r){if(We.randomUUID&&!e&&!t)return We.randomUUID();t=t||{};let n=t.random||(t.rng||ze)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(let o=0;o<16;++o)e[r+o]=n[o];return e}return Mr(n)}var ae=co;function Ye(t){return[...new Uint8Array(t)].map(e=>e.toString(16).padStart(2,"0")).join("")}function Br(t){return new Uint8Array((t.match(/../g)??[]).map(e=>parseInt(e,16)))}function Cr(t){let e=0;for(let o of t)e+=o.length;let r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}var zr=ke(Vr());function se(t,e,r=!0){if((r?(0,zr.validate)(t,e):[]).length)throw new Error(`couldn't validate schema: ${JSON.stringify(e)} didn't match schema ${JSON.stringify(t)}`)}var Wr="3",Qr="https://webapp-prod.cloud.remarkable.engineering",To="https://internal.cloud.remarkable.com",Yr="x-goog-generation",Fo="x-goog-if-generation-match",ko="x-goog-content-length-range",Bi=["Ballpoint","Ballpointv2","Brush","Calligraphy","ClearPage","EraseSection","Eraser","Fineliner","Finelinerv2","Highlighter","Highlighterv2","Marker","Markerv2","Paintbrush","Paintbrushv2","Pencilv2","SharpPencil","SharpPencilv2","SolidPen","ZoomTool"],Ci=["Maison Neue","EB Garamond","Noto Sans","Noto Serif","Noto Mono","Noto Sans UI"],Io={xs:.7,sm:.8,md:1,lg:1.2,xl:1.5,xx:2},$o={sm:50,md:125,rr:180,lg:200},jo={df:-1,md:100,lg:150,xl:200},Ro={properties:{docID:{type:"string"},hash:{type:"string"}}},Mo={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"}},Fe={lastModified:{type:"string"},version:{type:"int32"},pinned:{type:"boolean"},synced:{type:"boolean"},modified:{type:"boolean"},deleted:{type:"boolean"},metadatamodified:{type:"boolean"},parent:{type:"string"}},Bo={discriminator:"type",mapping:{CollectionType:{properties:Te,optionalProperties:Fe,additionalProperties:!0},DocumentType:{properties:Te,optionalProperties:{...Fe,lastOpened:{type:"string"},lastOpenedPage:{type:"int32"},createdTime:{type:"string"}},additionalProperties:!0}}},Kr={id:{type:"string"},hash:{type:"string"}},Co={discriminator:"type",mapping:{CollectionType:{properties:{...Te,...Kr},optionalProperties:Fe,additionalProperties:!0},DocumentType:{properties:{...Te,...Kr,fileType:{enum:["notebook","epub","pdf",""]}},optionalProperties:{...Fe,lastOpened:{type:"string"},lastOpenedPage:{type:"int32"},createdTime:{type:"string"}},additionalProperties:!0}}},te=class extends Error{status;statusText;constructor(e,r,n){super(n),this.status=e,this.statusText=r}},Qe=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 _i(t,{deviceDesc:e="browser-chrome",uuid:r=ae(),authHost:n=Qr,fetch:o=globalThis.fetch}={}){if(t.length!==8)throw new Error(`code should be length 8, but was ${t.length}`);let i=await o(`${n}/token/json/2/device/new`,{method:"POST",headers:{Authorization:"Bearer"},body:JSON.stringify({code:t,deviceDesc:e,deviceID:r})});if(i.ok)return await i.text();throw new te(i.status,i.statusText,"couldn't register api")}function _o({hash:t,type:e,documentId:r,subfiles:n,size:o}){return`${t}:${e}:${r}:${n}:${o}
10
+ `}function Uo(t){let[e,r,n,o,i]=t.split(":");if(e===void 0||r===void 0||n===void 0||o===void 0||i===void 0)throw new Error(`entries line didn't contain five fields: '${t}'`);if(r==="80000000")return{hash:e,type:r,documentId:n,subfiles:parseInt(o),size:BigInt(i)};if(r==="0"){if(o!=="0")throw new Error(`file type entry had nonzero number of subfiles: ${o}`);return{hash:e,type:r,documentId:n,subfiles:0,size:BigInt(i)}}else throw new Error(`entries line contained invalid type: ${r}`)}var et=class{#u;#s;#f;#r;#n;#e=new Map;#t=null;constructor(e,r,n,o,i,a){this.#u=e,this.#s=r,this.#f=n,this.#r=o,this.#n=i;for(let[f,s]of a)this.#e.set(f,Promise.resolve(s))}async#o(e,{body:r,method:n="POST",headers:o={}}){let i=await this.#s(e,{method:n,headers:{Authorization:`Bearer ${this.#u}`,...o},body:r});if(i.ok)return i;{let a=await i.text();throw new te(i.status,i.statusText,`failed reMarkable request: ${a}`)}}async#i({url:e,method:r,maxuploadsize_bytes:n},o,i={}){let a=n?{...i,[ko]:`0,${n}`}:i,f=await this.#s(e,{method:r,body:o,headers:a});if(f.ok)return f;{let s=await f.text();throw new te(f.status,f.statusText,s)}}async#a(e,r,n){let o=r===void 0?"downloads":"uploads",i=n&&r!==null&&r!==void 0?`{ "http_method": "PUT", "relative_path": "${e}", "root_schema": "${n}", "generation": ${r} }`:JSON.stringify({http_method:"GET",relative_path:e}),f=await(await this.#o(`${this.#r}/sync/v2/signed-urls/${o}`,{body:i})).text(),s=JSON.parse(f);return se(Mo,s),s}async getRootHash({cache:e=!0}={}){if(e)for(;this.#t;)try{let[i,a]=await this.#t;return[i,a]}catch{}let r=(async()=>{try{let i=await this.#a("root"),a=await this.#i(i),f=a.headers.get(Yr);if(f)return[await a.text(),BigInt(f)];throw new Error("no generation header in root hash")}catch(i){throw this.#t=null,i}})();this.#t=r;let[n,o]=await r;return[n,o]}async putRootHash(e,r){let n=await this.#a("root",r,e),o;try{o=await this.#i(n,e,{[Fo]:`${r}`})}catch(f){throw f instanceof te&&f.status===412?(this.#t=null,new Qe):f}let i=o.headers.get(Yr);if(!i)throw new Error("no generation header in root hash");let a=BigInt(i);return this.#t=Promise.resolve([e,a]),a}async#l(e){let r=this.#e.get(e);for(;r;)try{let o=await r;if(o)return o;r=void 0}catch{r=this.#e.get(e)}let n=(async()=>{let o=await this.#a(e);return await(await this.#i(o)).arrayBuffer()})();return this.#e.set(e,n.then(o=>o.byteLength<this.#n?o:null,o=>{throw this.#e.delete(e),o})),await n}async getBuffer(e){let r=await this.#l(e);return r.byteLength<this.#n?r.slice(0):r}async getText(e){let r=await this.#l(e);return new TextDecoder().decode(r)}async getJson(e){let r=await this.getText(e);return JSON.parse(r)}async getMetadata(e,{verify:r=!0}={}){let n=await this.getJson(e);return se(Bo,n,r),n}async getEntries(e){if(e===void 0){let[i]=await this.getRootHash({cache:!0});e=i}let r=await this.getText(e),[n,...o]=r.slice(0,-1).split(`
11
+ `);if(n!==Wr)throw new Error(`got unexpected schema version: ${n}`);return o.map(Uo)}async#p(e,r){let n=this.#e.get(e);if(n)try{await n;return}catch{}let o=(async()=>{try{let i=await this.#a(e,null);return await this.#i(i,r),r.byteLength<this.#n?r:null}catch(i){throw this.#e.delete(e),i}})();this.#e.set(e,o),await o}async putEntries(e,r){let n=new TextEncoder;r.sort((p,m)=>p.documentId.localeCompare(m.documentId));let o=Cr(r.map(p=>Br(p.hash))),i=await this.#f.digest("SHA-256",o),a=Ye(i),f=r.map(_o).join(""),s=`${Wr}
12
+ ${f}`,c=n.encode(s);return await this.#p(a,c),{hash:a,type:"80000000",documentId:e,subfiles:r.length,size:0n}}async putBuffer(e,r){let n=await this.#f.digest("SHA-256",r),o=Ye(n);return await this.#p(o,r),{hash:o,type:"0",documentId:e,subfiles:0,size:BigInt(r.byteLength)}}async putText(e,r){let n=new TextEncoder;return await this.putBuffer(e,n.encode(r))}async putJson(e,r){return await this.putText(e,(0,Zr.default)(r))}async putMetadata(e,r){return await this.putJson(`${e}.metadata`,r)}async putCollection(e,r=""){let n=ae(),o=`${new Date().valueOf()}`,i=[],a={type:"CollectionType",visibleName:e,version:0,parent:r,synced:!0,lastModified:o};i.push(this.putMetadata(n,a)),i.push(this.putText(`${n}.content`,"{}"));let f=await Promise.all(i);return await this.putEntries(n,f)}async#c(e,r,n,o,i){if(i.fileType!==n)throw new Error(`internal error: fileTypes don't match: ${n}, ${i.fileType}`);let a=ae(),f=`${new Date().valueOf()}`,s=[];s.push(this.putBuffer(`${a}.${n}`,r));let c={type:"DocumentType",visibleName:e,version:0,parent:o,synced:!0,lastModified:f};s.push(this.putMetadata(a,c)),s.push(this.putText(`${a}.content`,JSON.stringify(i)));let p=await Promise.all(s);return await this.putEntries(a,p)}async putEpub(e,r,{parent:n="",margins:o=125,orientation:i,textAlignment:a,textScale:f=1,lineHeight:s=-1,fontName:c="",cover:p="visited",lastTool:m}={}){let u={dummyDocument:!1,extraMetadata:{LastTool:m},fileType:"epub",pageCount:0,lastOpenedPage:0,lineHeight:typeof s=="string"?jo[s]:s,margins:typeof o=="string"?$o[o]:o,textScale:typeof f=="string"?Io[f]:f,pages:[],coverPageNumber:p==="first"?0:-1,formatVersion:1,orientation:i,textAlignment:a,fontName:c};return await this.#c(e,r,"epub",n,u)}async putPdf(e,r,{parent:n="",orientation:o,cover:i="first",lastTool:a}={}){let f={dummyDocument:!1,extraMetadata:{LastTool:a},fileType:"pdf",pageCount:0,lastOpenedPage:0,lineHeight:-1,margins:125,textScale:1,pages:[],coverPageNumber:i==="first"?0:-1,formatVersion:1,orientation:o};return await this.#c(e,r,"pdf",n,f)}async syncComplete(e){let r=`{ "generation": ${e} }`;await this.#o(`${this.#r}/sync/v2/sync-complete`,{body:r})}async#y(e,r,n){let{hash:o}=await this.putEntries("",r),i=await this.putRootHash(o,e);if(n)try{return await this.syncComplete(i),!0}catch{return!1}else return!1}async create(e,{cache:r=!0,sync:n=!0}={}){let[o,i]=await this.getRootHash({cache:r}),a=await this.getEntries(o);return a.push(e),await this.#y(i,a,n)}async move(e,r,{cache:n=!0,sync:o=!0}={}){let[i,a]=await this.getRootHash({cache:n}),f=await this.getEntries(i);if(!(!r||r==="trash")){let b=f.find(R=>R.documentId===r);if(b){if(b.type!=="80000000")throw new Error(`destination id was a raw file: ${r}`)}else throw new Error(`destination id not found: ${r}`);let _=await this.getEntries(b.hash),[P]=_.filter(R=>R.documentId===`${r}.metadata`);if(!P)throw new Error(`destination id didn't have metadata: ${r}`);if((await this.getMetadata(P.hash)).type!=="CollectionType")throw new Error(`destination id wasn't a collection: ${r}`)}let s=f.findIndex(b=>b.documentId===e);if(s===-1)throw new Error(`document not found: ${e}`);let[c]=f.splice(s,1);if(c.type!=="80000000")throw new Error(`document was a raw file: ${e}`);let p=await this.getEntries(c.hash),m=p.findIndex(b=>b.documentId===`${e}.metadata`);if(m===-1)throw new Error(`document didn't have metadata: ${e}`);let[u]=p.splice(m,1),S=await this.getMetadata(u.hash);S.parent=r;let v=await this.putMetadata(e,S);p.push(v);let k=await this.putEntries(e,p);return f.push(k),await this.#y(a,f,o)}async getEntriesMetadata({verify:e=!0}={}){let n=await(await this.#o(`${this.#r}/doc/v2/files`,{method:"GET",headers:{"rm-source":"RoR-Browser"}})).text(),o=JSON.parse(n);return se({elements:Co},o,e),o}async#d(e,r,n,o){let a=new TextEncoder().encode(JSON.stringify({file_name:e})),s=await(await this.#o(`${this.#r}/doc/v2/files`,{body:r,headers:{"content-type":n,"rm-meta":(0,Xr.fromByteArray)(a),"rm-source":"RoR-Browser"}})).text(),c=JSON.parse(s);return se(Ro,c,o),c}async uploadEpub(e,r,{verify:n=!0}={}){return await this.#d(e,r,"application/epub+zip",n)}async uploadPdf(e,r,{verify:n=!0}={}){return await this.#d(e,r,"application/pdf",n)}async getCache(){let e=[];for(let[o,i]of this.#e)e.push(i.then(a=>[o,a],()=>[o,null]));let r=await Promise.all(e),n=new Map;for(let[o,i]of r)i&&n.set(o,i);return n}};async function Ui(t,{fetch:e=globalThis.fetch,subtle:r=globalThis.crypto?.subtle,authHost:n=Qr,syncHost:o=To,cacheLimitBytes:i=1048576,initCache:a=[]}={}){if(!r)throw new Error("subtle was missing, try specifying it manually");let f=await e(`${n}/token/json/2/user/new`,{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(!f.ok)throw new Error(`couldn't fetch auth token: ${f.statusText}`);let s=await f.text();return new et(s,e,r,o,i,a)}export{Qe as GenerationError,te as ResponseError,Ci as builtinFontNames,jo as builtinLineHeights,$o as builtinMargins,Io as builtinTextScales,Bi as builtinTools,_o as formatEntry,Uo as parseEntry,_i as register,Ui as remarkable};
@@ -1,12 +1,12 @@
1
- "use strict";(()=>{var Xe=Object.create;var we=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var rt=Object.getPrototypeOf,nt=Object.prototype.hasOwnProperty;var S=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var it=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of tt(t))!nt.call(e,i)&&i!==r&&we(e,i,{get:()=>t[i],enumerable:!(n=et(t,i))||n.enumerable});return e};var oe=(e,t,r)=>(r=e!=null?Xe(rt(e)):{},it(t||!e||!e.__esModule?we(r,"default",{value:e,enumerable:!0}):r,e));var Ee=S(Y=>{"use strict";Y.byteLength=st;Y.toByteArray=ft;Y.fromByteArray=ct;var O=[],T=[],ot=typeof Uint8Array<"u"?Uint8Array:Array,se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(B=0,ve=se.length;B<ve;++B)O[B]=se[B],T[se.charCodeAt(B)]=B;var B,ve;T["-".charCodeAt(0)]=62;T["_".charCodeAt(0)]=63;function xe(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function st(e){var t=xe(e),r=t[0],n=t[1];return(r+n)*3/4-n}function at(e,t,r){return(t+r)*3/4-r}function ft(e){var t,r=xe(e),n=r[0],i=r[1],o=new ot(at(e,n,i)),a=0,f=i>0?n-4:n,s;for(s=0;s<f;s+=4)t=T[e.charCodeAt(s)]<<18|T[e.charCodeAt(s+1)]<<12|T[e.charCodeAt(s+2)]<<6|T[e.charCodeAt(s+3)],o[a++]=t>>16&255,o[a++]=t>>8&255,o[a++]=t&255;return i===2&&(t=T[e.charCodeAt(s)]<<2|T[e.charCodeAt(s+1)]>>4,o[a++]=t&255),i===1&&(t=T[e.charCodeAt(s)]<<10|T[e.charCodeAt(s+1)]<<4|T[e.charCodeAt(s+2)]>>2,o[a++]=t>>8&255,o[a++]=t&255),o}function ut(e){return O[e>>18&63]+O[e>>12&63]+O[e>>6&63]+O[e&63]}function lt(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),i.push(ut(n));return i.join("")}function ct(e){for(var t,r=e.length,n=r%3,i=[],o=16383,a=0,f=r-n;a<f;a+=o)i.push(lt(e,a,a+o>f?f:a+o));return n===1?(t=e[r-1],i.push(O[t>>2]+O[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(O[t>>10]+O[t>>4&63]+O[t<<2&63]+"=")),i.join("")}});var Se=S((Yt,Oe)=>{"use strict";var Z,l,Pe={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
2
- `,r:"\r",t:" "},ae;function M(e){throw{name:"SyntaxError",message:e,at:Z,text:ae}}function c(e){return e&&e!==l&&M("Expected '"+e+"' instead of '"+l+"'"),l=ae.charAt(Z),Z+=1,l}function Te(){var e,t="";for(l==="-"&&(t="-",c("-"));l>="0"&&l<="9";)t+=l,c();if(l===".")for(t+=".";c()&&l>="0"&&l<="9";)t+=l;if(l==="e"||l==="E")for(t+=l,c(),(l==="-"||l==="+")&&(t+=l,c());l>="0"&&l<="9";)t+=l,c();return e=Number(t),isFinite(e)||M("Bad number"),e}function Ae(){var e,t,r="",n;if(l==='"')for(;c();){if(l==='"')return c(),r;if(l==="\\")if(c(),l==="u"){for(n=0,t=0;t<4&&(e=parseInt(c(),16),!!isFinite(e));t+=1)n=n*16+e;r+=String.fromCharCode(n)}else if(typeof Pe[l]=="string")r+=Pe[l];else break;else r+=l}M("Bad string")}function k(){for(;l&&l<=" ";)c()}function pt(){switch(l){case"t":return c("t"),c("r"),c("u"),c("e"),!0;case"f":return c("f"),c("a"),c("l"),c("s"),c("e"),!1;case"n":return c("n"),c("u"),c("l"),c("l"),null;default:M("Unexpected '"+l+"'")}}function dt(){var e=[];if(l==="["){if(c("["),k(),l==="]")return c("]"),e;for(;l;){if(e.push(K()),k(),l==="]")return c("]"),e;c(","),k()}}M("Bad array")}function yt(){var e,t={};if(l==="{"){if(c("{"),k(),l==="}")return c("}"),t;for(;l;){if(e=Ae(),k(),c(":"),Object.prototype.hasOwnProperty.call(t,e)&&M('Duplicate key "'+e+'"'),t[e]=K(),k(),l==="}")return c("}"),t;c(","),k()}}M("Bad object")}function K(){switch(k(),l){case"{":return yt();case"[":return dt();case'"':return Ae();case"-":return Te();default:return l>="0"&&l<="9"?Te():pt()}}Oe.exports=function(e,t){var r;return ae=e,Z=0,l=" ",r=K(),k(),l&&M("Syntax error"),typeof t=="function"?function n(i,o){var a,f,s=i[o];if(s&&typeof s=="object")for(a in K)Object.prototype.hasOwnProperty.call(s,a)&&(f=n(s,a),typeof f>"u"?delete s[a]:s[a]=f);return t.call(i,o,s)}({"":r},""):r}});var Fe=S((Zt,ke)=>{"use strict";var fe=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,E,W,mt={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},R;function ue(e){return fe.lastIndex=0,fe.test(e)?'"'+e.replace(fe,function(t){var r=mt[t];return typeof r=="string"?r:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function Q(e,t){var r,n,i,o,a=E,f,s=t[e];switch(s&&typeof s=="object"&&typeof s.toJSON=="function"&&(s=s.toJSON(e)),typeof R=="function"&&(s=R.call(t,e,s)),typeof s){case"string":return ue(s);case"number":return isFinite(s)?String(s):"null";case"boolean":case"null":return String(s);case"object":if(!s)return"null";if(E+=W,f=[],Object.prototype.toString.apply(s)==="[object Array]"){for(o=s.length,r=0;r<o;r+=1)f[r]=Q(r,s)||"null";return i=f.length===0?"[]":E?`[
3
- `+E+f.join(`,
4
- `+E)+`
5
- `+a+"]":"["+f.join(",")+"]",E=a,i}if(R&&typeof R=="object")for(o=R.length,r=0;r<o;r+=1)n=R[r],typeof n=="string"&&(i=Q(n,s),i&&f.push(ue(n)+(E?": ":":")+i));else for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(i=Q(n,s),i&&f.push(ue(n)+(E?": ":":")+i));return i=f.length===0?"{}":E?`{
6
- `+E+f.join(`,
7
- `+E)+`
8
- `+a+"}":"{"+f.join(",")+"}",E=a,i;default:}}ke.exports=function(e,t,r){var n;if(E="",W="",typeof r=="number")for(n=0;n<r;n+=1)W+=" ";else typeof r=="string"&&(W=r);if(R=t,t&&typeof t!="function"&&(typeof t!="object"||typeof t.length!="number"))throw new Error("JSON.stringify");return Q("",{"":e})}});var Me=S(le=>{"use strict";le.parse=Se();le.stringify=Fe()});var je=S((Wt,Ce)=>{"use strict";var X=typeof JSON<"u"?JSON:Me(),ht=Array.isArray||function(e){return{}.toString.call(e)==="[object Array]"},gt=Object.keys||function(e){var t=Object.prototype.hasOwnProperty||function(){return!0},r=[];for(var n in e)t.call(e,n)&&r.push(n);return r};Ce.exports=function(e,t){t||(t={}),typeof t=="function"&&(t={cmp:t});var r=t.space||"";typeof r=="number"&&(r=Array(r+1).join(" "));var n=typeof t.cycles=="boolean"?t.cycles:!1,i=t.replacer||function(f,s){return s},o=t.cmp&&function(f){return function(s){return function(p,u){var g={key:p,value:s[p]},x={key:u,value:s[u]};return f(g,x)}}}(t.cmp),a=[];return function f(s,p,u,g){var x=r?`
9
- `+new Array(g+1).join(r):"",F=r?": ":":";if(u&&u.toJSON&&typeof u.toJSON=="function"&&(u=u.toJSON()),u=i.call(s,p,u),u!==void 0){if(typeof u!="object"||u===null)return X.stringify(u);if(ht(u)){for(var A=[],y=0;y<u.length;y++){var J=f(u,y,u[y],g+1)||X.stringify(null);A.push(x+r+J)}return"["+A.join(",")+x+"]"}if(a.indexOf(u)!==-1){if(n)return X.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}else a.push(u);for(var P=gt(u).sort(o&&o(u)),A=[],y=0;y<P.length;y++){var p=P[y],m=f(u,p,u[p],g+1);if(m){var G=X.stringify(p)+F+m;A.push(x+r+G)}}return a.splice(a.indexOf(u),1),"{"+A.join(",")+x+"}"}}({"":e},"",e,0)}});var me=S(d=>{"use strict";var _e=d&&d.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};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 xt(e){let{definitions:t,nullable:r,metadata:n}=e,i=_e(e,["definitions","nullable","metadata"]);return Object.keys(i).length===0}d.isEmptyForm=xt;function Ne(e){return"ref"in e}d.isRefForm=Ne;function Et(e){return"type"in e}d.isTypeForm=Et;function $e(e){return"enum"in e}d.isEnumForm=$e;function Le(e){return"elements"in e}d.isElementsForm=Le;function ye(e){return"properties"in e||"optionalProperties"in e}d.isPropertiesForm=ye;function De(e){return"values"in e}d.isValuesForm=De;function He(e){return"discriminator"in e}d.isDiscriminatorForm=He;function I(e,t){if(t===void 0&&(t=e),e.definitions!==void 0){if(t!==e)return!1;for(let r of Object.values(e.definitions))if(!I(r,t))return!1}if(Ne(e)&&!(e.ref in(t.definitions||{}))||$e(e)&&(e.enum.length===0||e.enum.length!==new Set(e.enum).size))return!1;if(Le(e))return I(e.elements,t);if(ye(e)){for(let r of Object.values(e.properties||{}))if(!I(r,t))return!1;for(let r of Object.values(e.optionalProperties||{}))if(!I(r,t))return!1;for(let r of Object.keys(e.properties||{}))if(r in(e.optionalProperties||{}))return!1}if(De(e))return I(e.values,t);if(He(e)){for(let r of Object.values(e.mapping))if(!I(r,t)||!ye(r)||r.nullable||e.discriminator in(r.properties||{})||e.discriminator in(r.optionalProperties||{}))return!1}return!0}d.isValidSchema=I;var Pt=[[!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]],Tt=["boolean","float32","float64","int8","uint8","int16","uint16","int32","uint32","string","timestamp"];function _(e){if(typeof e!="object"||Array.isArray(e)||e===null)return!1;let t=e,{definitions:r=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:p=void 0,optionalProperties:u=void 0,additionalProperties:g=void 0,values:x=void 0,discriminator:F=void 0,mapping:y=void 0}=t,J=_e(t,["definitions","nullable","metadata","ref","type","enum","elements","properties","optionalProperties","additionalProperties","values","discriminator","mapping"]),P=[o!==void 0,a!==void 0,f!==void 0,s!==void 0,p!==void 0,u!==void 0,g!==void 0,x!==void 0,F!==void 0,y!==void 0],A=!1;for(let m of Pt)A=A||m.every((G,V)=>G===P[V]);if(!A)return!1;if(r!==void 0){if(typeof r!="object"||Array.isArray(r)||r===null)return!1;for(let m of Object.values(r))if(!_(m))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"||!Tt.includes(a))||f!==void 0&&(!Array.isArray(f)||!f.every(m=>typeof m=="string"))||s!==void 0&&!_(s))return!1;if(p!==void 0){if(typeof p!="object"||Array.isArray(p)||p===null)return!1;for(let m of Object.values(p))if(!_(m))return!1}if(u!==void 0){if(typeof u!="object"||Array.isArray(u)||u===null)return!1;for(let m of Object.values(u))if(!_(m))return!1}if(g!==void 0&&typeof g!="boolean"||x!==void 0&&!_(x)||F!==void 0&&typeof F!="string")return!1;if(y!==void 0){if(typeof y!="object"||Array.isArray(y)||y===null)return!1;for(let m of Object.values(y))if(!_(m))return!1}return Object.keys(J).length===0}d.isSchema=_});var Ue=S(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});var At=/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(\.\d+)?([zZ]|((\+|-)(\d{2}):(\d{2})))$/;function Ot(e){let t=e.match(At);if(t===null)return!1;let r=parseInt(t[1],10),n=parseInt(t[2],10),i=parseInt(t[3],10),o=parseInt(t[4],10),a=parseInt(t[5],10),f=parseInt(t[6],10);return!(n>12||i>St(r,n)||o>23||a>59||f>60)}he.default=Ot;function St(e,t){return t===2?kt(e)?29:28:Ft[t]}function kt(e){return e%4===0&&(e%100!==0||e%400===0)}var Ft=[0,31,0,31,30,31,30,31,31,30,31,30,31]});var Je=S(C=>{"use strict";var Mt=C&&C.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(C,"__esModule",{value:!0});C.validate=C.MaxDepthExceededError=void 0;var Ct=Mt(Ue()),N=me(),te=class extends Error{};C.MaxDepthExceededError=te;var re=class extends Error{};function jt(e,t,r){let n={errors:[],instanceTokens:[],schemaTokens:[[]],root:e,config:r||{maxDepth:0,maxErrors:0}};try{D(n,e,t)}catch(i){if(!(i instanceof re))throw i}return n.errors}C.validate=jt;function D(e,t,r,n){if(!(t.nullable&&r===null)){if(N.isRefForm(t)){if(e.schemaTokens.length===e.config.maxDepth)throw new te;e.schemaTokens.push(["definitions",t.ref]),D(e,e.root.definitions[t.ref],r),e.schemaTokens.pop()}else if(N.isTypeForm(t)){switch(b(e,"type"),t.type){case"boolean":typeof r!="boolean"&&w(e);break;case"float32":case"float64":typeof r!="number"&&w(e);break;case"int8":H(e,r,-128,127);break;case"uint8":H(e,r,0,255);break;case"int16":H(e,r,-32768,32767);break;case"uint16":H(e,r,0,65535);break;case"int32":H(e,r,-2147483648,2147483647);break;case"uint32":H(e,r,0,4294967295);break;case"string":typeof r!="string"&&w(e);break;case"timestamp":typeof r!="string"?w(e):Ct.default(r)||w(e);break}v(e)}else if(N.isEnumForm(t))b(e,"enum"),(typeof r!="string"||!t.enum.includes(r))&&w(e),v(e);else if(N.isElementsForm(t)){if(b(e,"elements"),Array.isArray(r))for(let[i,o]of r.entries())$(e,i.toString()),D(e,t.elements,o),L(e);else w(e);v(e)}else if(N.isPropertiesForm(t))if(typeof r=="object"&&r!==null&&!Array.isArray(r)){if(t.properties!==void 0){b(e,"properties");for(let[i,o]of Object.entries(t.properties))b(e,i),r.hasOwnProperty(i)?($(e,i),D(e,o,r[i]),L(e)):w(e),v(e);v(e)}if(t.optionalProperties!==void 0){b(e,"optionalProperties");for(let[i,o]of Object.entries(t.optionalProperties))b(e,i),r.hasOwnProperty(i)&&($(e,i),D(e,o,r[i]),L(e)),v(e);v(e)}if(t.additionalProperties!==!0)for(let i of Object.keys(r)){let o=t.properties&&i in t.properties,a=t.optionalProperties&&i in t.optionalProperties;!o&&!a&&i!==n&&($(e,i),w(e),L(e))}}else t.properties!==void 0?b(e,"properties"):b(e,"optionalProperties"),w(e),v(e);else if(N.isValuesForm(t)){if(b(e,"values"),typeof r=="object"&&r!==null&&!Array.isArray(r))for(let[i,o]of Object.entries(r))$(e,i),D(e,t.values,o),L(e);else w(e);v(e)}else if(N.isDiscriminatorForm(t))if(typeof r=="object"&&r!==null&&!Array.isArray(r))if(r.hasOwnProperty(t.discriminator)){let i=r[t.discriminator];typeof i=="string"?i in t.mapping?(b(e,"mapping"),b(e,i),D(e,t.mapping[i],r,t.discriminator),v(e),v(e)):(b(e,"mapping"),$(e,t.discriminator),w(e),L(e),v(e)):(b(e,"discriminator"),$(e,t.discriminator),w(e),L(e),v(e))}else b(e,"discriminator"),w(e),v(e);else b(e,"discriminator"),w(e),v(e)}}function H(e,t,r,n){(typeof t!="number"||!Number.isInteger(t)||t<r||t>n)&&w(e)}function $(e,t){e.instanceTokens.push(t)}function L(e){e.instanceTokens.pop()}function b(e,t){e.schemaTokens[e.schemaTokens.length-1].push(t)}function v(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 re}});var qe=S(j=>{"use strict";var Bt=j&&j.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Ve=j&&j.__exportStar||function(e,t){for(var r in e)r!=="default"&&!t.hasOwnProperty(r)&&Bt(t,e,r)};Object.defineProperty(j,"__esModule",{value:!0});Ve(me(),j);Ve(Je(),j)});var Ke=oe(Ee()),We=oe(je());var ee,bt=new Uint8Array(16);function ce(){if(!ee&&(ee=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ee))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ee(bt)}var h=[];for(let e=0;e<256;++e)h.push((e+256).toString(16).slice(1));function Be(e,t=0){return(h[e[t+0]]+h[e[t+1]]+h[e[t+2]]+h[e[t+3]]+"-"+h[e[t+4]]+h[e[t+5]]+"-"+h[e[t+6]]+h[e[t+7]]+"-"+h[e[t+8]]+h[e[t+9]]+"-"+h[e[t+10]]+h[e[t+11]]+h[e[t+12]]+h[e[t+13]]+h[e[t+14]]+h[e[t+15]]).toLowerCase()}var wt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),pe={randomUUID:wt};function vt(e,t,r){if(pe.randomUUID&&!t&&!e)return pe.randomUUID();e=e||{};let n=e.random||(e.rng||ce)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return Be(n)}var q=vt;function de(e){return[...new Uint8Array(e)].map(t=>t.toString(16).padStart(2,"0")).join("")}function Re(e){return new Uint8Array((e.match(/../g)??[]).map(t=>parseInt(t,16)))}function Ie(e){let t=0;for(let i of e)t+=i.length;let r=new Uint8Array(t),n=0;for(let i of e)r.set(i,n),n+=i.length;return r}var ze=oe(qe());function z(e,t){if((0,ze.validate)(e,t).length)throw new Error(`couldn't validate schema: ${JSON.stringify(t)} didn't match schema ${JSON.stringify(e)}`)}var Ge="3",Qe="https://webapp-prod.cloud.remarkable.engineering",Rt="https://internal.cloud.remarkable.com",Ye="x-goog-generation",It="x-goog-if-generation-match",_t="x-goog-content-length-range",gr=["Ballpoint","Ballpointv2","Brush","Calligraphy","ClearPage","EraseSection","Eraser","Fineliner","Finelinerv2","Highlighter","Highlighterv2","Marker","Markerv2","Paintbrush","Paintbrushv2","Pencilv2","SharpPencil","SharpPencilv2","SolidPen","ZoomTool"],br=["Maison Neue","EB Garamond","Noto Sans","Noto Serif","Noto Mono","Noto Sans UI"],Nt={xs:.7,sm:.8,md:1,lg:1.2,xl:1.5,xx:2},$t={sm:50,md:125,rr:180,lg:200},Lt={df:-1,md:100,lg:150,xl:200},Dt={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"}}},ne={visibleName:{type:"string"},lastModified:{type:"string"}},ie={version:{type:"int32"},pinned:{type:"boolean"},synced:{type:"boolean"},modified:{type:"boolean"},deleted:{type:"boolean"},metadatamodified:{type:"boolean"},parent:{type:"string"}},Ut={discriminator:"type",mapping:{CollectionType:{properties:ne,optionalProperties:ie},DocumentType:{properties:ne,optionalProperties:{...ie,lastOpened:{type:"string"},lastOpenedPage:{type:"int32"}}}}},Ze={id:{type:"string"},hash:{type:"string"}},Jt={discriminator:"type",mapping:{CollectionType:{properties:{...ne,...Ze},optionalProperties:ie},DocumentType:{properties:{...ne,...Ze,fileType:{enum:["notebook","epub","pdf",""]}},optionalProperties:{...ie,lastOpened:{type:"string"},lastOpenedPage:{type:"int32"}}}}},U=class extends Error{status;statusText;constructor(t,r,n){super(n),this.status=t,this.statusText=r}},ge=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 wr(e,{deviceDesc:t="browser-chrome",uuid:r=q(),authHost:n=Qe,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:t,deviceID:r})});if(o.ok)return await o.text();throw new U(o.status,o.statusText,"couldn't register api")}function Vt({hash:e,type:t,documentId:r,subfiles:n,size:i}){return`${e}:${t}:${r}:${n}:${i}
10
- `}function qt(e){let[t,r,n,i,o]=e.split(":");if(t===void 0||r===void 0||n===void 0||i===void 0||o===void 0)throw new Error(`entries line didn't contain five fields: '${e}'`);if(r==="80000000")return{hash:t,type:r,documentId:n,subfiles:parseInt(i),size:BigInt(o)};if(r==="0"){if(i!=="0")throw new Error(`file type entry had nonzero number of subfiles: ${i}`);return{hash:t,type:r,documentId:n,subfiles:0,size:BigInt(o)}}else throw new Error(`entries line contained invalid type: ${r}`)}var be=class{#u;#a;#f;#r;#n;#e=new Map;#t=null;constructor(t,r,n,i,o,a){this.#u=t,this.#a=r,this.#f=n,this.#r=i,this.#n=o;for(let[f,s]of a)this.#e.set(f,Promise.resolve(s))}async#i(t,{body:r,method:n="POST",headers:i={}}){let o=await this.#a(t,{method:n,headers:{Authorization:`Bearer ${this.#u}`,...i},body:r});if(o.ok)return o;{let a=await o.text();throw new U(o.status,o.statusText,`failed reMarkable request: ${a}`)}}async#o({url:t,method:r,maxuploadsize_bytes:n},i,o={}){let a=n?{...o,[_t]:`0,${n}`}:o,f=await this.#a(t,{method:r,body:i,headers:a});if(f.ok)return f;{let s=await f.text();throw new U(f.status,f.statusText,s)}}async#s(t,r,n){let i=r===void 0?"downloads":"uploads",o=n&&r!==null&&r!==void 0?`{ "http_method": "PUT", "relative_path": "${t}", "root_schema": "${n}", "generation": ${r} }`:JSON.stringify({http_method:"GET",relative_path:t}),f=await(await this.#i(`${this.#r}/sync/v2/signed-urls/${i}`,{body:o})).text(),s=JSON.parse(f);return z(Ht,s),s}async getRootHash({cache:t=!0}={}){if(t)for(;this.#t;)try{let[o,a]=await this.#t;return[o,a]}catch{}let r=(async()=>{try{let o=await this.#s("root"),a=await this.#o(o),f=a.headers.get(Ye);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=r;let[n,i]=await r;return[n,i]}async putRootHash(t,r){let n=await this.#s("root",r,t),i;try{i=await this.#o(n,t,{[It]:`${r}`})}catch(f){throw f instanceof U&&f.status===412?(this.#t=null,new ge):f}let o=i.headers.get(Ye);if(!o)throw new Error("no generation header in root hash");let a=BigInt(o);return this.#t=Promise.resolve([t,a]),a}async#l(t){let r=this.#e.get(t);for(;r;)try{let i=await r;if(i)return i;r=void 0}catch{r=this.#e.get(t)}let n=(async()=>{let i=await this.#s(t);return await(await this.#o(i)).arrayBuffer()})();return this.#e.set(t,n.then(i=>i.byteLength<this.#n?i:null,i=>{throw this.#e.delete(t),i})),await n}async getBuffer(t){let r=await this.#l(t);return r.byteLength<this.#n?r.slice(0):r}async getText(t){let r=await this.#l(t);return new TextDecoder().decode(r)}async getJson(t){let r=await this.getText(t);return JSON.parse(r)}async getMetadata(t){let r=await this.getJson(t);return z(Ut,r),r}async getEntries(t){if(t===void 0){let[o]=await this.getRootHash({cache:!0});t=o}let r=await this.getText(t),[n,...i]=r.slice(0,-1).split(`
11
- `);if(n!==Ge)throw new Error(`got unexpected schema version: ${n}`);return i.map(qt)}async#c(t,r){let n=this.#e.get(t);if(n)try{await n;return}catch{}let i=(async()=>{try{let o=await this.#s(t,null);return await this.#o(o,r),r.byteLength<this.#n?r:null}catch(o){throw this.#e.delete(t),o}})();this.#e.set(t,i),await i}async putEntries(t,r){let n=new TextEncoder;r.sort((u,g)=>u.documentId.localeCompare(g.documentId));let i=Ie(r.map(u=>Re(u.hash))),o=await this.#f.digest("SHA-256",i),a=de(o),f=r.map(Vt).join(""),s=`${Ge}
12
- ${f}`,p=n.encode(s);return await this.#c(a,p),{hash:a,type:"80000000",documentId:t,subfiles:r.length,size:0n}}async putBuffer(t,r){let n=await this.#f.digest("SHA-256",r),i=de(n);return await this.#c(i,r),{hash:i,type:"0",documentId:t,subfiles:0,size:BigInt(r.byteLength)}}async putText(t,r){let n=new TextEncoder;return await this.putBuffer(t,n.encode(r))}async putJson(t,r){return await this.putText(t,(0,We.default)(r))}async putMetadata(t,r){return await this.putJson(`${t}.metadata`,r)}async putCollection(t,r=""){let n=q(),i=`${new Date().valueOf()}`,o=[],a={type:"CollectionType",visibleName:t,version:0,parent:r,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#p(t,r,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}`,r));let p={type:"DocumentType",visibleName:t,version:0,parent:i,synced:!0,lastModified:f};s.push(this.putMetadata(a,p)),s.push(this.putText(`${a}.content`,JSON.stringify(o)));let u=await Promise.all(s);return await this.putEntries(a,u)}async putEpub(t,r,{parent:n="",margins:i=125,orientation:o,textAlignment:a,textScale:f=1,lineHeight:s=-1,fontName:p="",cover:u="visited",lastTool:g}={}){let x={dummyDocument:!1,extraMetadata:{LastTool:g},fileType:"epub",pageCount:0,lastOpenedPage:0,lineHeight:typeof s=="string"?Lt[s]:s,margins:typeof i=="string"?$t[i]:i,textScale:typeof f=="string"?Nt[f]:f,pages:[],coverPageNumber:u==="first"?0:-1,formatVersion:1,orientation:o,textAlignment:a,fontName:p};return await this.#p(t,r,"epub",n,x)}async putPdf(t,r,{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.#p(t,r,"pdf",n,f)}async syncComplete(t){let r=`{ "generation": ${t} }`;await this.#i(`${this.#r}/sync/v2/sync-complete`,{body:r})}async#d(t,r,n){let{hash:i}=await this.putEntries("",r),o=await this.putRootHash(i,t);if(n)try{return await this.syncComplete(o),!0}catch{return!1}else return!1}async create(t,{cache:r=!0,sync:n=!0}={}){let[i,o]=await this.getRootHash({cache:r}),a=await this.getEntries(i);return a.push(t),await this.#d(o,a,n)}async move(t,r,{cache:n=!0,sync:i=!0}={}){let[o,a]=await this.getRootHash({cache:n}),f=await this.getEntries(o);if(!(!r||r==="trash")){let P=f.find(V=>V.documentId===r);if(P){if(P.type!=="80000000")throw new Error(`destination id was a raw file: ${r}`)}else throw new Error(`destination id not found: ${r}`);let A=await this.getEntries(P.hash),[m]=A.filter(V=>V.documentId===`${r}.metadata`);if(!m)throw new Error(`destination id didn't have metadata: ${r}`);if((await this.getMetadata(m.hash)).type!=="CollectionType")throw new Error(`destination id wasn't a collection: ${r}`)}let s=f.findIndex(P=>P.documentId===t);if(s===-1)throw new Error(`document not found: ${t}`);let[p]=f.splice(s,1);if(p.type!=="80000000")throw new Error(`document was a raw file: ${t}`);let u=await this.getEntries(p.hash),g=u.findIndex(P=>P.documentId===`${t}.metadata`);if(g===-1)throw new Error(`document didn't have metadata: ${t}`);let[x]=u.splice(g,1),F=await this.getMetadata(x.hash);F.parent=r;let y=await this.putMetadata(t,F);u.push(y);let J=await this.putEntries(t,u);return f.push(J),await this.#d(a,f,i)}async getEntriesMetadata(){let r=await(await this.#i(`${this.#r}/doc/v2/files`,{method:"GET",headers:{"rm-source":"RoR-Browser"}})).text(),n=JSON.parse(r);return z({elements:Jt},n),n}async#y(t,r,n){let o=new TextEncoder().encode(JSON.stringify({file_name:t})),f=await(await this.#i(`${this.#r}/doc/v2/files`,{body:r,headers:{"content-type":n,"rm-meta":(0,Ke.fromByteArray)(o),"rm-source":"RoR-Browser"}})).text(),s=JSON.parse(f);return z(Dt,s),s}async uploadEpub(t,r){return await this.#y(t,r,"application/epub+zip")}async uploadPdf(t,r){return await this.#y(t,r,"application/pdf")}async getCache(){let t=[];for(let[i,o]of this.#e)t.push(o.then(a=>[i,a],()=>[i,null]));let r=await Promise.all(t),n=new Map;for(let[i,o]of r)o&&n.set(i,o);return n}};async function vr(e,{fetch:t=globalThis.fetch,subtle:r=globalThis.crypto?.subtle,authHost:n=Qe,syncHost:i=Rt,cacheLimitBytes:o=1048576,initCache:a=[]}={}){if(!r)throw new Error("subtle was missing, try specifying it manually");let f=await t(`${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 be(s,t,r,i,o,a)}})();
1
+ "use strict";(()=>{var tn=Object.create;var tt=Object.defineProperty;var rn=Object.getOwnPropertyDescriptor;var nn=Object.getOwnPropertyNames;var on=Object.getPrototypeOf,an=Object.prototype.hasOwnProperty;var d=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var sn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of nn(e))!an.call(t,o)&&o!==r&&tt(t,o,{get:()=>e[o],enumerable:!(n=rn(e,o))||n.enumerable});return t};var ke=(t,e,r)=>(r=t!=null?tn(on(t)):{},sn(e||!t||!t.__esModule?tt(r,"default",{value:t,enumerable:!0}):r,t));var ot=d(fe=>{"use strict";fe.byteLength=un;fe.toByteArray=pn;fe.fromByteArray=dn;var I=[],F=[],fn=typeof Uint8Array<"u"?Uint8Array:Array,Ie="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(U=0,rt=Ie.length;U<rt;++U)I[U]=Ie[U],F[Ie.charCodeAt(U)]=U;var U,rt;F[45]=62;F[95]=63;function nt(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function un(t){var e=nt(t),r=e[0],n=e[1];return(r+n)*3/4-n}function ln(t,e,r){return(e+r)*3/4-r}function pn(t){var e,r=nt(t),n=r[0],o=r[1],i=new fn(ln(t,n,o)),a=0,f=o>0?n-4:n,s;for(s=0;s<f;s+=4)e=F[t.charCodeAt(s)]<<18|F[t.charCodeAt(s+1)]<<12|F[t.charCodeAt(s+2)]<<6|F[t.charCodeAt(s+3)],i[a++]=e>>16&255,i[a++]=e>>8&255,i[a++]=e&255;return o===2&&(e=F[t.charCodeAt(s)]<<2|F[t.charCodeAt(s+1)]>>4,i[a++]=e&255),o===1&&(e=F[t.charCodeAt(s)]<<10|F[t.charCodeAt(s+1)]<<4|F[t.charCodeAt(s+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function cn(t){return I[t>>18&63]+I[t>>12&63]+I[t>>6&63]+I[t&63]}function yn(t,e,r){for(var n,o=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(t[i+2]&255),o.push(cn(n));return o.join("")}function dn(t){for(var e,r=t.length,n=r%3,o=[],i=16383,a=0,f=r-n;a<f;a+=i)o.push(yn(t,a,a+i>f?f:a+i));return n===1?(e=t[r-1],o.push(I[e>>2]+I[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(I[e>>10]+I[e>>4&63]+I[e<<2&63]+"=")),o.join("")}});var ut=d((Lo,ft)=>{"use strict";var ue,l,it={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
2
+ `,r:"\r",t:" "},$e;function M(t){throw{name:"SyntaxError",message:t,at:ue,text:$e}}function g(t){return t&&t!==l&&M("Expected '"+t+"' instead of '"+l+"'"),l=$e.charAt(ue),ue+=1,l}function at(){var t,e="";for(l==="-"&&(e="-",g("-"));l>="0"&&l<="9";)e+=l,g();if(l===".")for(e+=".";g()&&l>="0"&&l<="9";)e+=l;if(l==="e"||l==="E")for(e+=l,g(),(l==="-"||l==="+")&&(e+=l,g());l>="0"&&l<="9";)e+=l,g();return t=Number(e),isFinite(t)||M("Bad number"),t}function st(){var t,e,r="",n;if(l==='"')for(;g();){if(l==='"')return g(),r;if(l==="\\")if(g(),l==="u"){for(n=0,e=0;e<4&&(t=parseInt(g(),16),!!isFinite(t));e+=1)n=n*16+t;r+=String.fromCharCode(n)}else if(typeof it[l]=="string")r+=it[l];else break;else r+=l}M("Bad string")}function $(){for(;l&&l<=" ";)g()}function gn(){switch(l){case"t":return g("t"),g("r"),g("u"),g("e"),!0;case"f":return g("f"),g("a"),g("l"),g("s"),g("e"),!1;case"n":return g("n"),g("u"),g("l"),g("l"),null;default:M("Unexpected '"+l+"'")}}function mn(){var t=[];if(l==="["){if(g("["),$(),l==="]")return g("]"),t;for(;l;){if(t.push(le()),$(),l==="]")return g("]"),t;g(","),$()}}M("Bad array")}function hn(){var t,e={};if(l==="{"){if(g("{"),$(),l==="}")return g("}"),e;for(;l;){if(t=st(),$(),g(":"),Object.prototype.hasOwnProperty.call(e,t)&&M('Duplicate key "'+t+'"'),e[t]=le(),$(),l==="}")return g("}"),e;g(","),$()}}M("Bad object")}function le(){switch($(),l){case"{":return hn();case"[":return mn();case'"':return st();case"-":return at();default:return l>="0"&&l<="9"?at():gn()}}ft.exports=function(t,e){var r;return $e=t,ue=0,l=" ",r=le(),$(),l&&M("Syntax error"),typeof e=="function"?function n(o,i){var a,f,s=o[i];if(s&&typeof s=="object")for(a in le)Object.prototype.hasOwnProperty.call(s,a)&&(f=n(s,a),typeof f>"u"?delete s[a]:s[a]=f);return e.call(o,i,s)}({"":r},""):r}});var pt=d((qo,lt)=>{"use strict";var je=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,T,pe,vn={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},N;function Re(t){return je.lastIndex=0,je.test(t)?'"'+t.replace(je,function(e){var r=vn[e];return typeof r=="string"?r:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function ce(t,e){var r,n,o,i,a=T,f,s=e[t];switch(s&&typeof s=="object"&&typeof s.toJSON=="function"&&(s=s.toJSON(t)),typeof N=="function"&&(s=N.call(e,t,s)),typeof s){case"string":return Re(s);case"number":return isFinite(s)?String(s):"null";case"boolean":case"null":return String(s);case"object":if(!s)return"null";if(T+=pe,f=[],Object.prototype.toString.apply(s)==="[object Array]"){for(i=s.length,r=0;r<i;r+=1)f[r]=ce(r,s)||"null";return o=f.length===0?"[]":T?`[
3
+ `+T+f.join(`,
4
+ `+T)+`
5
+ `+a+"]":"["+f.join(",")+"]",T=a,o}if(N&&typeof N=="object")for(i=N.length,r=0;r<i;r+=1)n=N[r],typeof n=="string"&&(o=ce(n,s),o&&f.push(Re(n)+(T?": ":":")+o));else for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(o=ce(n,s),o&&f.push(Re(n)+(T?": ":":")+o));return o=f.length===0?"{}":T?`{
6
+ `+T+f.join(`,
7
+ `+T)+`
8
+ `+a+"}":"{"+f.join(",")+"}",T=a,o;default:}}lt.exports=function(t,e,r){var n;if(T="",pe="",typeof r=="number")for(n=0;n<r;n+=1)pe+=" ";else typeof r=="string"&&(pe=r);if(N=e,e&&typeof e!="function"&&(typeof e!="object"||typeof e.length!="number"))throw new Error("JSON.stringify");return ce("",{"":t})}});var ct=d(Me=>{"use strict";Me.parse=ut();Me.stringify=pt()});var dt=d((Jo,yt)=>{var bn={}.toString;yt.exports=Array.isArray||function(t){return bn.call(t)=="[object Array]"}});var Be=d((Go,mt)=>{"use strict";var gt=Object.prototype.toString;mt.exports=function(e){var r=gt.call(e),n=r==="[object Arguments]";return n||(n=r!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&gt.call(e.callee)==="[object Function]"),n}});var St=d((Vo,Et)=>{"use strict";var At;Object.keys||(re=Object.prototype.hasOwnProperty,Ce=Object.prototype.toString,ht=Be(),_e=Object.prototype.propertyIsEnumerable,vt=!_e.call({toString:null},"toString"),bt=_e.call(function(){},"prototype"),ne=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],ye=function(t){var e=t.constructor;return e&&e.prototype===t},wt={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},Pt=function(){if(typeof window>"u")return!1;for(var t in window)try{if(!wt["$"+t]&&re.call(window,t)&&window[t]!==null&&typeof window[t]=="object")try{ye(window[t])}catch{return!0}}catch{return!0}return!1}(),xt=function(t){if(typeof window>"u"||!Pt)return ye(t);try{return ye(t)}catch{return!1}},At=function(e){var r=e!==null&&typeof e=="object",n=Ce.call(e)==="[object Function]",o=ht(e),i=r&&Ce.call(e)==="[object String]",a=[];if(!r&&!n&&!o)throw new TypeError("Object.keys called on a non-object");var f=bt&&n;if(i&&e.length>0&&!re.call(e,0))for(var s=0;s<e.length;++s)a.push(String(s));if(o&&e.length>0)for(var c=0;c<e.length;++c)a.push(String(c));else for(var p in e)!(f&&p==="prototype")&&re.call(e,p)&&a.push(String(p));if(vt)for(var m=xt(e),u=0;u<ne.length;++u)!(m&&ne[u]==="constructor")&&re.call(e,ne[u])&&a.push(ne[u]);return a});var re,Ce,ht,_e,vt,bt,ne,ye,wt,Pt,xt;Et.exports=At});var kt=d((zo,Ft)=>{"use strict";var wn=Array.prototype.slice,Pn=Be(),Ot=Object.keys,de=Ot?function(e){return Ot(e)}:St(),Tt=Object.keys;de.shim=function(){if(Object.keys){var e=function(){var r=Object.keys(arguments);return r&&r.length===arguments.length}(1,2);e||(Object.keys=function(n){return Pn(n)?Tt(wn.call(n)):Tt(n)})}else Object.keys=de;return Object.keys||de};Ft.exports=de});var jt=d((Wo,$t)=>{"use strict";var xn="Function.prototype.bind called on incompatible ",An=Object.prototype.toString,En=Math.max,Sn="[object Function]",It=function(e,r){for(var n=[],o=0;o<e.length;o+=1)n[o]=e[o];for(var i=0;i<r.length;i+=1)n[i+e.length]=r[i];return n},On=function(e,r){for(var n=[],o=r||0,i=0;o<e.length;o+=1,i+=1)n[i]=e[o];return n},Tn=function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r};$t.exports=function(e){var r=this;if(typeof r!="function"||An.apply(r)!==Sn)throw new TypeError(xn+r);for(var n=On(arguments,1),o,i=function(){if(this instanceof o){var p=r.apply(this,It(n,arguments));return Object(p)===p?p:this}return r.apply(e,It(n,arguments))},a=En(0,r.length-n.length),f=[],s=0;s<a;s++)f[s]="$"+s;if(o=Function("binder","return function ("+Tn(f,",")+"){ return binder.apply(this,arguments); }")(i),r.prototype){var c=function(){};c.prototype=r.prototype,o.prototype=new c,c.prototype=null}return o}});var ge=d((Yo,Rt)=>{"use strict";var Fn=jt();Rt.exports=Function.prototype.bind||Fn});var Bt=d((Ko,Mt)=>{"use strict";Mt.exports=Error});var _t=d((Xo,Ct)=>{"use strict";Ct.exports=EvalError});var Nt=d((Zo,Ut)=>{"use strict";Ut.exports=RangeError});var Lt=d((Qo,Dt)=>{"use strict";Dt.exports=ReferenceError});var Ue=d((ei,qt)=>{"use strict";qt.exports=SyntaxError});var oe=d((ti,Ht)=>{"use strict";Ht.exports=TypeError});var Gt=d((ri,Jt)=>{"use strict";Jt.exports=URIError});var zt=d((ni,Vt)=>{"use strict";Vt.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var o=42;e[r]=o;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var i=Object.getOwnPropertySymbols(e);if(i.length!==1||i[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,r);if(a.value!==o||a.enumerable!==!0)return!1}return!0}});var Kt=d((oi,Yt)=>{"use strict";var Wt=typeof Symbol<"u"&&Symbol,kn=zt();Yt.exports=function(){return typeof Wt!="function"||typeof Symbol!="function"||typeof Wt("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:kn()}});var Zt=d((ii,Xt)=>{"use strict";var Ne={__proto__:null,foo:{}},In=Object;Xt.exports=function(){return{__proto__:Ne}.foo===Ne.foo&&!(Ne instanceof In)}});var er=d((ai,Qt)=>{"use strict";var $n=Function.prototype.call,jn=Object.prototype.hasOwnProperty,Rn=ge();Qt.exports=Rn.call($n,jn)});var Z=d((si,ir)=>{"use strict";var y,Mn=Bt(),Bn=_t(),Cn=Nt(),_n=Lt(),X=Ue(),K=oe(),Un=Gt(),or=Function,De=function(t){try{return or('"use strict"; return ('+t+").constructor;")()}catch{}},D=Object.getOwnPropertyDescriptor;if(D)try{D({},"")}catch{D=null}var Le=function(){throw new K},Nn=D?function(){try{return arguments.callee,Le}catch{try{return D(arguments,"callee").get}catch{return Le}}}():Le,W=Kt()(),Dn=Zt()(),w=Object.getPrototypeOf||(Dn?function(t){return t.__proto__}:null),Y={},Ln=typeof Uint8Array>"u"||!w?y:w(Uint8Array),L={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?y:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?y:ArrayBuffer,"%ArrayIteratorPrototype%":W&&w?w([][Symbol.iterator]()):y,"%AsyncFromSyncIteratorPrototype%":y,"%AsyncFunction%":Y,"%AsyncGenerator%":Y,"%AsyncGeneratorFunction%":Y,"%AsyncIteratorPrototype%":Y,"%Atomics%":typeof Atomics>"u"?y:Atomics,"%BigInt%":typeof BigInt>"u"?y:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?y:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?y:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?y:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Mn,"%eval%":eval,"%EvalError%":Bn,"%Float32Array%":typeof Float32Array>"u"?y:Float32Array,"%Float64Array%":typeof Float64Array>"u"?y:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?y:FinalizationRegistry,"%Function%":or,"%GeneratorFunction%":Y,"%Int8Array%":typeof Int8Array>"u"?y:Int8Array,"%Int16Array%":typeof Int16Array>"u"?y:Int16Array,"%Int32Array%":typeof Int32Array>"u"?y:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":W&&w?w(w([][Symbol.iterator]())):y,"%JSON%":typeof JSON=="object"?JSON:y,"%Map%":typeof Map>"u"?y:Map,"%MapIteratorPrototype%":typeof Map>"u"||!W||!w?y:w(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?y:Promise,"%Proxy%":typeof Proxy>"u"?y:Proxy,"%RangeError%":Cn,"%ReferenceError%":_n,"%Reflect%":typeof Reflect>"u"?y:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?y:Set,"%SetIteratorPrototype%":typeof Set>"u"||!W||!w?y:w(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?y:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":W&&w?w(""[Symbol.iterator]()):y,"%Symbol%":W?Symbol:y,"%SyntaxError%":X,"%ThrowTypeError%":Nn,"%TypedArray%":Ln,"%TypeError%":K,"%Uint8Array%":typeof Uint8Array>"u"?y:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?y:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?y:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?y:Uint32Array,"%URIError%":Un,"%WeakMap%":typeof WeakMap>"u"?y:WeakMap,"%WeakRef%":typeof WeakRef>"u"?y:WeakRef,"%WeakSet%":typeof WeakSet>"u"?y:WeakSet};if(w)try{null.error}catch(t){tr=w(w(t)),L["%Error.prototype%"]=tr}var tr,qn=function t(e){var r;if(e==="%AsyncFunction%")r=De("async function () {}");else if(e==="%GeneratorFunction%")r=De("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=De("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var o=t("%AsyncGenerator%");o&&w&&(r=w(o.prototype))}return L[e]=r,r},rr={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ie=ge(),me=er(),Hn=ie.call(Function.call,Array.prototype.concat),Jn=ie.call(Function.apply,Array.prototype.splice),nr=ie.call(Function.call,String.prototype.replace),he=ie.call(Function.call,String.prototype.slice),Gn=ie.call(Function.call,RegExp.prototype.exec),Vn=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,zn=/\\(\\)?/g,Wn=function(e){var r=he(e,0,1),n=he(e,-1);if(r==="%"&&n!=="%")throw new X("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new X("invalid intrinsic syntax, expected opening `%`");var o=[];return nr(e,Vn,function(i,a,f,s){o[o.length]=f?nr(s,zn,"$1"):a||i}),o},Yn=function(e,r){var n=e,o;if(me(rr,n)&&(o=rr[n],n="%"+o[0]+"%"),me(L,n)){var i=L[n];if(i===Y&&(i=qn(n)),typeof i>"u"&&!r)throw new K("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:o,name:n,value:i}}throw new X("intrinsic "+e+" does not exist!")};ir.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new K("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new K('"allowMissing" argument must be a boolean');if(Gn(/^%?[^%]*%?$/,e)===null)throw new X("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=Wn(e),o=n.length>0?n[0]:"",i=Yn("%"+o+"%",r),a=i.name,f=i.value,s=!1,c=i.alias;c&&(o=c[0],Jn(n,Hn([0,1],c)));for(var p=1,m=!0;p<n.length;p+=1){var u=n[p],S=he(u,0,1),v=he(u,-1);if((S==='"'||S==="'"||S==="`"||v==='"'||v==="'"||v==="`")&&S!==v)throw new X("property names with quotes must have matching quotes");if((u==="constructor"||!m)&&(s=!0),o+="."+u,a="%"+o+"%",me(L,a))f=L[a];else if(f!=null){if(!(u in f)){if(!r)throw new K("base intrinsic for "+e+" exists, but the property is not available.");return}if(D&&p+1>=n.length){var k=D(f,u);m=!!k,m&&"get"in k&&!("originalValue"in k.get)?f=k.get:f=f[u]}else m=me(f,u),f=f[u];m&&!s&&(L[a]=f)}}return f}});var be=d((fi,ar)=>{"use strict";var Kn=Z(),ve=Kn("%Object.defineProperty%",!0)||!1;if(ve)try{ve({},"a",{value:1})}catch{ve=!1}ar.exports=ve});var qe=d((ui,sr)=>{"use strict";var Xn=Z(),we=Xn("%Object.getOwnPropertyDescriptor%",!0);if(we)try{we([],"length")}catch{we=null}sr.exports=we});var pr=d((li,lr)=>{"use strict";var fr=be(),Zn=Ue(),Q=oe(),ur=qe();lr.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new Q("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Q("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Q("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Q("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Q("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Q("`loose`, if provided, must be a boolean");var o=arguments.length>3?arguments[3]:null,i=arguments.length>4?arguments[4]:null,a=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,s=!!ur&&ur(e,r);if(fr)fr(e,r,{configurable:a===null&&s?s.configurable:!a,enumerable:o===null&&s?s.enumerable:!o,value:n,writable:i===null&&s?s.writable:!i});else if(f||!o&&!i&&!a)e[r]=n;else throw new Zn("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var dr=d((pi,yr)=>{"use strict";var He=be(),cr=function(){return!!He};cr.hasArrayLengthDefineBug=function(){if(!He)return null;try{return He([],"length",{value:1}).length!==1}catch{return!0}};yr.exports=cr});var br=d((ci,vr)=>{"use strict";var Qn=Z(),gr=pr(),eo=dr()(),mr=qe(),hr=oe(),to=Qn("%Math.floor%");vr.exports=function(e,r){if(typeof e!="function")throw new hr("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||to(r)!==r)throw new hr("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],o=!0,i=!0;if("length"in e&&mr){var a=mr(e,"length");a&&!a.configurable&&(o=!1),a&&!a.writable&&(i=!1)}return(o||i||!n)&&(eo?gr(e,"length",r,!0,!0):gr(e,"length",r)),e}});var Ge=d((yi,Pe)=>{"use strict";var Je=ge(),xe=Z(),ro=br(),no=oe(),xr=xe("%Function.prototype.apply%"),Ar=xe("%Function.prototype.call%"),Er=xe("%Reflect.apply%",!0)||Je.call(Ar,xr),wr=be(),oo=xe("%Math.max%");Pe.exports=function(e){if(typeof e!="function")throw new no("a function is required");var r=Er(Je,Ar,arguments);return ro(r,1+oo(0,e.length-(arguments.length-1)),!0)};var Pr=function(){return Er(Je,xr,arguments)};wr?wr(Pe.exports,"apply",{value:Pr}):Pe.exports.apply=Pr});var Fr=d((di,Tr)=>{"use strict";var Sr=Z(),Or=Ge(),io=Or(Sr("String.prototype.indexOf"));Tr.exports=function(e,r){var n=Sr(e,!!r);return typeof n=="function"&&io(e,".prototype.")>-1?Or(n):n}});var Rr=d((gi,jr)=>{"use strict";var Ae=(typeof JSON<"u"?JSON:ct()).stringify,ao=dt(),so=kt(),fo=Ge(),$r=Fr(),kr=$r("Array.prototype.join"),Ve=$r("Array.prototype.push"),Ir=function(e,r){for(var n="",o=0;o<e;o+=1)n+=r;return n},uo=function(t,e,r){return r};jr.exports=function(e){var r=arguments.length>1?arguments[1]:void 0,n=r&&r.space||"";typeof n=="number"&&(n=Ir(n," "));var o=!!r&&typeof r.cycles=="boolean"&&r.cycles,i=r&&r.replacer?fo(r.replacer):uo,a=typeof r=="function"?r:r&&r.cmp,f=a&&function(c){var p=a.length>2&&function(u){return c[u]};return function(m,u){return a({key:m,value:c[m]},{key:u,value:c[u]},p?{__proto__:null,get:p}:void 0)}},s=[];return function c(p,m,u,S){var v=n?`
9
+ `+Ir(S,n):"",k=n?": ":":";if(u&&u.toJSON&&typeof u.toJSON=="function"&&(u=u.toJSON()),u=i(p,m,u),u!==void 0){if(typeof u!="object"||u===null)return Ae(u);if(ao(u)){for(var j=[],b=0;b<u.length;b++){var _=c(u,b,u[b],S+1)||Ae(null);Ve(j,v+n+_)}return"["+kr(j,",")+v+"]"}if(s.indexOf(u)!==-1){if(o)return Ae("__cycle__");throw new TypeError("Converting circular structure to JSON")}else Ve(s,u);for(var P=so(u).sort(f&&f(u)),j=[],b=0;b<P.length;b++){var m=P[b],R=c(u,m,u[m],S+1);if(R){var en=Ae(m)+k+R;Ve(j,v+n+en)}}return s.splice(s.indexOf(u),1),"{"+kr(j,",")+v+"}"}}({"":e},"",e,0)}});var Xe=d(h=>{"use strict";var _r=h&&h.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r};Object.defineProperty(h,"__esModule",{value:!0});h.isSchema=h.isValidSchema=h.isDiscriminatorForm=h.isValuesForm=h.isPropertiesForm=h.isElementsForm=h.isEnumForm=h.isTypeForm=h.isRefForm=h.isEmptyForm=void 0;function yo(t){let{definitions:e,nullable:r,metadata:n}=t,o=_r(t,["definitions","nullable","metadata"]);return Object.keys(o).length===0}h.isEmptyForm=yo;function Ur(t){return"ref"in t}h.isRefForm=Ur;function go(t){return"type"in t}h.isTypeForm=go;function Nr(t){return"enum"in t}h.isEnumForm=Nr;function Dr(t){return"elements"in t}h.isElementsForm=Dr;function Ke(t){return"properties"in t||"optionalProperties"in t}h.isPropertiesForm=Ke;function Lr(t){return"values"in t}h.isValuesForm=Lr;function qr(t){return"discriminator"in t}h.isDiscriminatorForm=qr;function q(t,e){if(e===void 0&&(e=t),t.definitions!==void 0){if(e!==t)return!1;for(let r of Object.values(t.definitions))if(!q(r,e))return!1}if(Ur(t)&&!(t.ref in(e.definitions||{}))||Nr(t)&&(t.enum.length===0||t.enum.length!==new Set(t.enum).size))return!1;if(Dr(t))return q(t.elements,e);if(Ke(t)){for(let r of Object.values(t.properties||{}))if(!q(r,e))return!1;for(let r of Object.values(t.optionalProperties||{}))if(!q(r,e))return!1;for(let r of Object.keys(t.properties||{}))if(r in(t.optionalProperties||{}))return!1}if(Lr(t))return q(t.values,e);if(qr(t)){for(let r of Object.values(t.mapping))if(!q(r,e)||!Ke(r)||r.nullable||t.discriminator in(r.properties||{})||t.discriminator in(r.optionalProperties||{}))return!1}return!0}h.isValidSchema=q;var mo=[[!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]],ho=["boolean","float32","float64","int8","uint8","int16","uint16","int32","uint32","string","timestamp"];function H(t){if(typeof t!="object"||Array.isArray(t)||t===null)return!1;let e=t,{definitions:r=void 0,nullable:n=void 0,metadata:o=void 0,ref:i=void 0,type:a=void 0,enum:f=void 0,elements:s=void 0,properties:c=void 0,optionalProperties:p=void 0,additionalProperties:m=void 0,values:u=void 0,discriminator:S=void 0,mapping:v=void 0}=e,k=_r(e,["definitions","nullable","metadata","ref","type","enum","elements","properties","optionalProperties","additionalProperties","values","discriminator","mapping"]),b=[i!==void 0,a!==void 0,f!==void 0,s!==void 0,c!==void 0,p!==void 0,m!==void 0,u!==void 0,S!==void 0,v!==void 0],_=!1;for(let P of mo)_=_||P.every((j,R)=>j===b[R]);if(!_)return!1;if(r!==void 0){if(typeof r!="object"||Array.isArray(r)||r===null)return!1;for(let P of Object.values(r))if(!H(P))return!1}if(n!==void 0&&typeof n!="boolean"||o!==void 0&&(typeof o!="object"||Array.isArray(o)||o===null)||i!==void 0&&typeof i!="string"||a!==void 0&&(typeof a!="string"||!ho.includes(a))||f!==void 0&&(!Array.isArray(f)||!f.every(P=>typeof P=="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 P of Object.values(c))if(!H(P))return!1}if(p!==void 0){if(typeof p!="object"||Array.isArray(p)||p===null)return!1;for(let P of Object.values(p))if(!H(P))return!1}if(m!==void 0&&typeof m!="boolean"||u!==void 0&&!H(u)||S!==void 0&&typeof S!="string")return!1;if(v!==void 0){if(typeof v!="object"||Array.isArray(v)||v===null)return!1;for(let P of Object.values(v))if(!H(P))return!1}return Object.keys(k).length===0}h.isSchema=H});var Hr=d(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});var vo=/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(\.\d+)?([zZ]|((\+|-)(\d{2}):(\d{2})))$/;function bo(t){let e=t.match(vo);if(e===null)return!1;let r=parseInt(e[1],10),n=parseInt(e[2],10),o=parseInt(e[3],10),i=parseInt(e[4],10),a=parseInt(e[5],10),f=parseInt(e[6],10);return!(n>12||o>wo(r,n)||i>23||a>59||f>60)}Ze.default=bo;function wo(t,e){return e===2?Po(t)?29:28:xo[e]}function Po(t){return t%4===0&&(t%100!==0||t%400===0)}var xo=[0,31,0,31,30,31,30,31,31,30,31,30,31]});var Jr=d(B=>{"use strict";var Ao=B&&B.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(B,"__esModule",{value:!0});B.validate=B.MaxDepthExceededError=void 0;var Eo=Ao(Hr()),J=Xe(),Se=class extends Error{};B.MaxDepthExceededError=Se;var Oe=class extends Error{};function So(t,e,r){let n={errors:[],instanceTokens:[],schemaTokens:[[]],root:t,config:r||{maxDepth:0,maxErrors:0}};try{z(n,t,e)}catch(o){if(!(o instanceof Oe))throw o}return n.errors}B.validate=So;function z(t,e,r,n){if(!(e.nullable&&r===null)){if(J.isRefForm(e)){if(t.schemaTokens.length===t.config.maxDepth)throw new Se;t.schemaTokens.push(["definitions",e.ref]),z(t,t.root.definitions[e.ref],r),t.schemaTokens.pop()}else if(J.isTypeForm(e)){switch(A(t,"type"),e.type){case"boolean":typeof r!="boolean"&&E(t);break;case"float32":case"float64":typeof r!="number"&&E(t);break;case"int8":ee(t,r,-128,127);break;case"uint8":ee(t,r,0,255);break;case"int16":ee(t,r,-32768,32767);break;case"uint16":ee(t,r,0,65535);break;case"int32":ee(t,r,-2147483648,2147483647);break;case"uint32":ee(t,r,0,4294967295);break;case"string":typeof r!="string"&&E(t);break;case"timestamp":typeof r!="string"?E(t):Eo.default(r)||E(t);break}O(t)}else if(J.isEnumForm(e))A(t,"enum"),(typeof r!="string"||!e.enum.includes(r))&&E(t),O(t);else if(J.isElementsForm(e)){if(A(t,"elements"),Array.isArray(r))for(let[o,i]of r.entries())G(t,o.toString()),z(t,e.elements,i),V(t);else E(t);O(t)}else if(J.isPropertiesForm(e))if(typeof r=="object"&&r!==null&&!Array.isArray(r)){if(e.properties!==void 0){A(t,"properties");for(let[o,i]of Object.entries(e.properties))A(t,o),r.hasOwnProperty(o)?(G(t,o),z(t,i,r[o]),V(t)):E(t),O(t);O(t)}if(e.optionalProperties!==void 0){A(t,"optionalProperties");for(let[o,i]of Object.entries(e.optionalProperties))A(t,o),r.hasOwnProperty(o)&&(G(t,o),z(t,i,r[o]),V(t)),O(t);O(t)}if(e.additionalProperties!==!0)for(let o of Object.keys(r)){let i=e.properties&&o in e.properties,a=e.optionalProperties&&o in e.optionalProperties;!i&&!a&&o!==n&&(G(t,o),E(t),V(t))}}else e.properties!==void 0?A(t,"properties"):A(t,"optionalProperties"),E(t),O(t);else if(J.isValuesForm(e)){if(A(t,"values"),typeof r=="object"&&r!==null&&!Array.isArray(r))for(let[o,i]of Object.entries(r))G(t,o),z(t,e.values,i),V(t);else E(t);O(t)}else if(J.isDiscriminatorForm(e))if(typeof r=="object"&&r!==null&&!Array.isArray(r))if(r.hasOwnProperty(e.discriminator)){let o=r[e.discriminator];typeof o=="string"?o in e.mapping?(A(t,"mapping"),A(t,o),z(t,e.mapping[o],r,e.discriminator),O(t),O(t)):(A(t,"mapping"),G(t,e.discriminator),E(t),V(t),O(t)):(A(t,"discriminator"),G(t,e.discriminator),E(t),V(t),O(t))}else A(t,"discriminator"),E(t),O(t);else A(t,"discriminator"),E(t),O(t)}}function ee(t,e,r,n){(typeof e!="number"||!Number.isInteger(e)||e<r||e>n)&&E(t)}function G(t,e){t.instanceTokens.push(e)}function V(t){t.instanceTokens.pop()}function A(t,e){t.schemaTokens[t.schemaTokens.length-1].push(e)}function O(t){t.schemaTokens[t.schemaTokens.length-1].pop()}function E(t){if(t.errors.push({instancePath:[...t.instanceTokens],schemaPath:[...t.schemaTokens[t.schemaTokens.length-1]]}),t.errors.length===t.config.maxErrors)throw new Oe}});var Vr=d(C=>{"use strict";var Oo=C&&C.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Gr=C&&C.__exportStar||function(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&Oo(e,t,r)};Object.defineProperty(C,"__esModule",{value:!0});Gr(Xe(),C);Gr(Jr(),C)});var Xr=ke(ot()),Zr=ke(Rr());var Ee,lo=new Uint8Array(16);function ze(){if(!Ee&&(Ee=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ee))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ee(lo)}var x=[];for(let t=0;t<256;++t)x.push((t+256).toString(16).slice(1));function Mr(t,e=0){return x[t[e+0]]+x[t[e+1]]+x[t[e+2]]+x[t[e+3]]+"-"+x[t[e+4]]+x[t[e+5]]+"-"+x[t[e+6]]+x[t[e+7]]+"-"+x[t[e+8]]+x[t[e+9]]+"-"+x[t[e+10]]+x[t[e+11]]+x[t[e+12]]+x[t[e+13]]+x[t[e+14]]+x[t[e+15]]}var po=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),We={randomUUID:po};function co(t,e,r){if(We.randomUUID&&!e&&!t)return We.randomUUID();t=t||{};let n=t.random||(t.rng||ze)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(let o=0;o<16;++o)e[r+o]=n[o];return e}return Mr(n)}var ae=co;function Ye(t){return[...new Uint8Array(t)].map(e=>e.toString(16).padStart(2,"0")).join("")}function Br(t){return new Uint8Array((t.match(/../g)??[]).map(e=>parseInt(e,16)))}function Cr(t){let e=0;for(let o of t)e+=o.length;let r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}var zr=ke(Vr());function se(t,e,r=!0){if((r?(0,zr.validate)(t,e):[]).length)throw new Error(`couldn't validate schema: ${JSON.stringify(e)} didn't match schema ${JSON.stringify(t)}`)}var Wr="3",Qr="https://webapp-prod.cloud.remarkable.engineering",To="https://internal.cloud.remarkable.com",Yr="x-goog-generation",Fo="x-goog-if-generation-match",ko="x-goog-content-length-range",Bi=["Ballpoint","Ballpointv2","Brush","Calligraphy","ClearPage","EraseSection","Eraser","Fineliner","Finelinerv2","Highlighter","Highlighterv2","Marker","Markerv2","Paintbrush","Paintbrushv2","Pencilv2","SharpPencil","SharpPencilv2","SolidPen","ZoomTool"],Ci=["Maison Neue","EB Garamond","Noto Sans","Noto Serif","Noto Mono","Noto Sans UI"],Io={xs:.7,sm:.8,md:1,lg:1.2,xl:1.5,xx:2},$o={sm:50,md:125,rr:180,lg:200},jo={df:-1,md:100,lg:150,xl:200},Ro={properties:{docID:{type:"string"},hash:{type:"string"}}},Mo={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"}},Fe={lastModified:{type:"string"},version:{type:"int32"},pinned:{type:"boolean"},synced:{type:"boolean"},modified:{type:"boolean"},deleted:{type:"boolean"},metadatamodified:{type:"boolean"},parent:{type:"string"}},Bo={discriminator:"type",mapping:{CollectionType:{properties:Te,optionalProperties:Fe,additionalProperties:!0},DocumentType:{properties:Te,optionalProperties:{...Fe,lastOpened:{type:"string"},lastOpenedPage:{type:"int32"},createdTime:{type:"string"}},additionalProperties:!0}}},Kr={id:{type:"string"},hash:{type:"string"}},Co={discriminator:"type",mapping:{CollectionType:{properties:{...Te,...Kr},optionalProperties:Fe,additionalProperties:!0},DocumentType:{properties:{...Te,...Kr,fileType:{enum:["notebook","epub","pdf",""]}},optionalProperties:{...Fe,lastOpened:{type:"string"},lastOpenedPage:{type:"int32"},createdTime:{type:"string"}},additionalProperties:!0}}},te=class extends Error{status;statusText;constructor(e,r,n){super(n),this.status=e,this.statusText=r}},Qe=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 _i(t,{deviceDesc:e="browser-chrome",uuid:r=ae(),authHost:n=Qr,fetch:o=globalThis.fetch}={}){if(t.length!==8)throw new Error(`code should be length 8, but was ${t.length}`);let i=await o(`${n}/token/json/2/device/new`,{method:"POST",headers:{Authorization:"Bearer"},body:JSON.stringify({code:t,deviceDesc:e,deviceID:r})});if(i.ok)return await i.text();throw new te(i.status,i.statusText,"couldn't register api")}function _o({hash:t,type:e,documentId:r,subfiles:n,size:o}){return`${t}:${e}:${r}:${n}:${o}
10
+ `}function Uo(t){let[e,r,n,o,i]=t.split(":");if(e===void 0||r===void 0||n===void 0||o===void 0||i===void 0)throw new Error(`entries line didn't contain five fields: '${t}'`);if(r==="80000000")return{hash:e,type:r,documentId:n,subfiles:parseInt(o),size:BigInt(i)};if(r==="0"){if(o!=="0")throw new Error(`file type entry had nonzero number of subfiles: ${o}`);return{hash:e,type:r,documentId:n,subfiles:0,size:BigInt(i)}}else throw new Error(`entries line contained invalid type: ${r}`)}var et=class{#u;#s;#f;#r;#n;#e=new Map;#t=null;constructor(e,r,n,o,i,a){this.#u=e,this.#s=r,this.#f=n,this.#r=o,this.#n=i;for(let[f,s]of a)this.#e.set(f,Promise.resolve(s))}async#o(e,{body:r,method:n="POST",headers:o={}}){let i=await this.#s(e,{method:n,headers:{Authorization:`Bearer ${this.#u}`,...o},body:r});if(i.ok)return i;{let a=await i.text();throw new te(i.status,i.statusText,`failed reMarkable request: ${a}`)}}async#i({url:e,method:r,maxuploadsize_bytes:n},o,i={}){let a=n?{...i,[ko]:`0,${n}`}:i,f=await this.#s(e,{method:r,body:o,headers:a});if(f.ok)return f;{let s=await f.text();throw new te(f.status,f.statusText,s)}}async#a(e,r,n){let o=r===void 0?"downloads":"uploads",i=n&&r!==null&&r!==void 0?`{ "http_method": "PUT", "relative_path": "${e}", "root_schema": "${n}", "generation": ${r} }`:JSON.stringify({http_method:"GET",relative_path:e}),f=await(await this.#o(`${this.#r}/sync/v2/signed-urls/${o}`,{body:i})).text(),s=JSON.parse(f);return se(Mo,s),s}async getRootHash({cache:e=!0}={}){if(e)for(;this.#t;)try{let[i,a]=await this.#t;return[i,a]}catch{}let r=(async()=>{try{let i=await this.#a("root"),a=await this.#i(i),f=a.headers.get(Yr);if(f)return[await a.text(),BigInt(f)];throw new Error("no generation header in root hash")}catch(i){throw this.#t=null,i}})();this.#t=r;let[n,o]=await r;return[n,o]}async putRootHash(e,r){let n=await this.#a("root",r,e),o;try{o=await this.#i(n,e,{[Fo]:`${r}`})}catch(f){throw f instanceof te&&f.status===412?(this.#t=null,new Qe):f}let i=o.headers.get(Yr);if(!i)throw new Error("no generation header in root hash");let a=BigInt(i);return this.#t=Promise.resolve([e,a]),a}async#l(e){let r=this.#e.get(e);for(;r;)try{let o=await r;if(o)return o;r=void 0}catch{r=this.#e.get(e)}let n=(async()=>{let o=await this.#a(e);return await(await this.#i(o)).arrayBuffer()})();return this.#e.set(e,n.then(o=>o.byteLength<this.#n?o:null,o=>{throw this.#e.delete(e),o})),await n}async getBuffer(e){let r=await this.#l(e);return r.byteLength<this.#n?r.slice(0):r}async getText(e){let r=await this.#l(e);return new TextDecoder().decode(r)}async getJson(e){let r=await this.getText(e);return JSON.parse(r)}async getMetadata(e,{verify:r=!0}={}){let n=await this.getJson(e);return se(Bo,n,r),n}async getEntries(e){if(e===void 0){let[i]=await this.getRootHash({cache:!0});e=i}let r=await this.getText(e),[n,...o]=r.slice(0,-1).split(`
11
+ `);if(n!==Wr)throw new Error(`got unexpected schema version: ${n}`);return o.map(Uo)}async#p(e,r){let n=this.#e.get(e);if(n)try{await n;return}catch{}let o=(async()=>{try{let i=await this.#a(e,null);return await this.#i(i,r),r.byteLength<this.#n?r:null}catch(i){throw this.#e.delete(e),i}})();this.#e.set(e,o),await o}async putEntries(e,r){let n=new TextEncoder;r.sort((p,m)=>p.documentId.localeCompare(m.documentId));let o=Cr(r.map(p=>Br(p.hash))),i=await this.#f.digest("SHA-256",o),a=Ye(i),f=r.map(_o).join(""),s=`${Wr}
12
+ ${f}`,c=n.encode(s);return await this.#p(a,c),{hash:a,type:"80000000",documentId:e,subfiles:r.length,size:0n}}async putBuffer(e,r){let n=await this.#f.digest("SHA-256",r),o=Ye(n);return await this.#p(o,r),{hash:o,type:"0",documentId:e,subfiles:0,size:BigInt(r.byteLength)}}async putText(e,r){let n=new TextEncoder;return await this.putBuffer(e,n.encode(r))}async putJson(e,r){return await this.putText(e,(0,Zr.default)(r))}async putMetadata(e,r){return await this.putJson(`${e}.metadata`,r)}async putCollection(e,r=""){let n=ae(),o=`${new Date().valueOf()}`,i=[],a={type:"CollectionType",visibleName:e,version:0,parent:r,synced:!0,lastModified:o};i.push(this.putMetadata(n,a)),i.push(this.putText(`${n}.content`,"{}"));let f=await Promise.all(i);return await this.putEntries(n,f)}async#c(e,r,n,o,i){if(i.fileType!==n)throw new Error(`internal error: fileTypes don't match: ${n}, ${i.fileType}`);let a=ae(),f=`${new Date().valueOf()}`,s=[];s.push(this.putBuffer(`${a}.${n}`,r));let c={type:"DocumentType",visibleName:e,version:0,parent:o,synced:!0,lastModified:f};s.push(this.putMetadata(a,c)),s.push(this.putText(`${a}.content`,JSON.stringify(i)));let p=await Promise.all(s);return await this.putEntries(a,p)}async putEpub(e,r,{parent:n="",margins:o=125,orientation:i,textAlignment:a,textScale:f=1,lineHeight:s=-1,fontName:c="",cover:p="visited",lastTool:m}={}){let u={dummyDocument:!1,extraMetadata:{LastTool:m},fileType:"epub",pageCount:0,lastOpenedPage:0,lineHeight:typeof s=="string"?jo[s]:s,margins:typeof o=="string"?$o[o]:o,textScale:typeof f=="string"?Io[f]:f,pages:[],coverPageNumber:p==="first"?0:-1,formatVersion:1,orientation:i,textAlignment:a,fontName:c};return await this.#c(e,r,"epub",n,u)}async putPdf(e,r,{parent:n="",orientation:o,cover:i="first",lastTool:a}={}){let f={dummyDocument:!1,extraMetadata:{LastTool:a},fileType:"pdf",pageCount:0,lastOpenedPage:0,lineHeight:-1,margins:125,textScale:1,pages:[],coverPageNumber:i==="first"?0:-1,formatVersion:1,orientation:o};return await this.#c(e,r,"pdf",n,f)}async syncComplete(e){let r=`{ "generation": ${e} }`;await this.#o(`${this.#r}/sync/v2/sync-complete`,{body:r})}async#y(e,r,n){let{hash:o}=await this.putEntries("",r),i=await this.putRootHash(o,e);if(n)try{return await this.syncComplete(i),!0}catch{return!1}else return!1}async create(e,{cache:r=!0,sync:n=!0}={}){let[o,i]=await this.getRootHash({cache:r}),a=await this.getEntries(o);return a.push(e),await this.#y(i,a,n)}async move(e,r,{cache:n=!0,sync:o=!0}={}){let[i,a]=await this.getRootHash({cache:n}),f=await this.getEntries(i);if(!(!r||r==="trash")){let b=f.find(R=>R.documentId===r);if(b){if(b.type!=="80000000")throw new Error(`destination id was a raw file: ${r}`)}else throw new Error(`destination id not found: ${r}`);let _=await this.getEntries(b.hash),[P]=_.filter(R=>R.documentId===`${r}.metadata`);if(!P)throw new Error(`destination id didn't have metadata: ${r}`);if((await this.getMetadata(P.hash)).type!=="CollectionType")throw new Error(`destination id wasn't a collection: ${r}`)}let s=f.findIndex(b=>b.documentId===e);if(s===-1)throw new Error(`document not found: ${e}`);let[c]=f.splice(s,1);if(c.type!=="80000000")throw new Error(`document was a raw file: ${e}`);let p=await this.getEntries(c.hash),m=p.findIndex(b=>b.documentId===`${e}.metadata`);if(m===-1)throw new Error(`document didn't have metadata: ${e}`);let[u]=p.splice(m,1),S=await this.getMetadata(u.hash);S.parent=r;let v=await this.putMetadata(e,S);p.push(v);let k=await this.putEntries(e,p);return f.push(k),await this.#y(a,f,o)}async getEntriesMetadata({verify:e=!0}={}){let n=await(await this.#o(`${this.#r}/doc/v2/files`,{method:"GET",headers:{"rm-source":"RoR-Browser"}})).text(),o=JSON.parse(n);return se({elements:Co},o,e),o}async#d(e,r,n,o){let a=new TextEncoder().encode(JSON.stringify({file_name:e})),s=await(await this.#o(`${this.#r}/doc/v2/files`,{body:r,headers:{"content-type":n,"rm-meta":(0,Xr.fromByteArray)(a),"rm-source":"RoR-Browser"}})).text(),c=JSON.parse(s);return se(Ro,c,o),c}async uploadEpub(e,r,{verify:n=!0}={}){return await this.#d(e,r,"application/epub+zip",n)}async uploadPdf(e,r,{verify:n=!0}={}){return await this.#d(e,r,"application/pdf",n)}async getCache(){let e=[];for(let[o,i]of this.#e)e.push(i.then(a=>[o,a],()=>[o,null]));let r=await Promise.all(e),n=new Map;for(let[o,i]of r)i&&n.set(o,i);return n}};async function Ui(t,{fetch:e=globalThis.fetch,subtle:r=globalThis.crypto?.subtle,authHost:n=Qr,syncHost:o=To,cacheLimitBytes:i=1048576,initCache:a=[]}={}){if(!r)throw new Error("subtle was missing, try specifying it manually");let f=await e(`${n}/token/json/2/user/new`,{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(!f.ok)throw new Error(`couldn't fetch auth token: ${f.statusText}`);let s=await f.text();return new et(s,e,r,o,i,a)}})();
package/dist/index.d.ts CHANGED
@@ -85,7 +85,7 @@ export interface CommonMetadata {
85
85
  /** parent uuid (documentId) or "" for root or "trash" */
86
86
  parent?: string;
87
87
  /** last modified time */
88
- lastModified: string;
88
+ lastModified?: string;
89
89
  /** unknown significance */
90
90
  version?: number;
91
91
  /** unknown significance */
@@ -112,6 +112,8 @@ export interface DocumentTypeMetadata extends CommonMetadata {
112
112
  lastOpened?: string;
113
113
  /** last opened page for documents */
114
114
  lastOpenedPage?: number;
115
+ /** created time */
116
+ createdTime?: string;
115
117
  }
116
118
  /**
117
119
  * metadata for a document or collection (folder)
@@ -432,7 +434,7 @@ export interface RemarkableApi {
432
434
  /**
433
435
  * create a new collection (folder)
434
436
  *
435
- * @param documentId - the name of the new folder
437
+ * @param visibleName - the name of the new folder
436
438
  * @param parent - the documentId of the parent collection (folder)
437
439
  */
438
440
  putCollection(visibleName: string, parent?: string): Promise<CollectionEntry>;
@@ -519,7 +521,7 @@ export interface RemarkableApi {
519
521
  * ```
520
522
  *
521
523
  * @param entry - and entry, usually created by a `put*` method
522
- * @param sync - whether to notify apps of a change (default: true)
524
+ * @param options - any extra options for creation
523
525
  * @returns synced - if sync was successful
524
526
  * @throws error - if any error occurred, in this case, nothing will be
525
527
  * changed
@@ -555,7 +557,7 @@ export interface RemarkableApi {
555
557
  * @param dest - the new parent of this collection or document; this should
556
558
  * be the document id of an existing collection, an empty string for root,
557
559
  * or the string `"trash"` to move to the trash
558
- * @param sync - whether to notify apps of a change (default: true)
560
+ * @param opts - any extra options for moving
559
561
  * @returns synced - true if synced successfully
560
562
  * @throws error - if any error occurred, in this case, nothing will be
561
563
  * changed
package/dist/index.js CHANGED
@@ -139,9 +139,9 @@ const urlResponseSchema = {
139
139
  };
140
140
  const commonProperties = {
141
141
  visibleName: { type: "string" },
142
- lastModified: { type: "string" },
143
142
  };
144
143
  const commonOptionalProperties = {
144
+ lastModified: { type: "string" },
145
145
  version: { type: "int32" },
146
146
  pinned: { type: "boolean" },
147
147
  synced: { type: "boolean" },
@@ -156,6 +156,7 @@ const metadataSchema = {
156
156
  CollectionType: {
157
157
  properties: commonProperties,
158
158
  optionalProperties: commonOptionalProperties,
159
+ additionalProperties: true,
159
160
  },
160
161
  DocumentType: {
161
162
  properties: commonProperties,
@@ -163,7 +164,9 @@ const metadataSchema = {
163
164
  ...commonOptionalProperties,
164
165
  lastOpened: { type: "string" },
165
166
  lastOpenedPage: { type: "int32" },
167
+ createdTime: { type: "string" },
166
168
  },
169
+ additionalProperties: true,
167
170
  },
168
171
  },
169
172
  };
@@ -180,6 +183,7 @@ const metadataEntrySchema = {
180
183
  ...baseMetadataProperties,
181
184
  },
182
185
  optionalProperties: commonOptionalProperties,
186
+ additionalProperties: true,
183
187
  },
184
188
  DocumentType: {
185
189
  properties: {
@@ -191,7 +195,9 @@ const metadataEntrySchema = {
191
195
  ...commonOptionalProperties,
192
196
  lastOpened: { type: "string" },
193
197
  lastOpenedPage: { type: "int32" },
198
+ createdTime: { type: "string" },
194
199
  },
200
+ additionalProperties: true,
195
201
  },
196
202
  },
197
203
  };
@@ -485,10 +491,12 @@ class Remarkable {
485
491
  }
486
492
  /**
487
493
  * get metadata from hash
494
+ *
495
+ * Call with `verify: false` to disable checking the response.
488
496
  */
489
- async getMetadata(hash) {
497
+ async getMetadata(hash, { verify = true } = {}) {
490
498
  const raw = await this.getJson(hash);
491
- validate(metadataSchema, raw);
499
+ validate(metadataSchema, raw, verify);
492
500
  return raw;
493
501
  }
494
502
  /**
@@ -762,7 +770,7 @@ class Remarkable {
762
770
  return await this.#tryPutRootEntries(gen, rootEntries, sync);
763
771
  }
764
772
  /** get entries and metadata for all files */
765
- async getEntriesMetadata() {
773
+ async getEntriesMetadata({ verify = true, } = {}) {
766
774
  const resp = await this.#authedFetch(`${this.#syncHost}/doc/v2/files`, {
767
775
  method: "GET",
768
776
  headers: {
@@ -774,11 +782,11 @@ class Remarkable {
774
782
  const schema = {
775
783
  elements: metadataEntrySchema,
776
784
  };
777
- validate(schema, res);
785
+ validate(schema, res, verify);
778
786
  return res;
779
787
  }
780
788
  /** upload a file */
781
- async #uploadFile(visibleName, buffer, contentType) {
789
+ async #uploadFile(visibleName, buffer, contentType, verify) {
782
790
  const encoder = new TextEncoder();
783
791
  const meta = encoder.encode(JSON.stringify({ file_name: visibleName }));
784
792
  const resp = await this.#authedFetch(`${this.#syncHost}/doc/v2/files`, {
@@ -791,17 +799,17 @@ class Remarkable {
791
799
  });
792
800
  const raw = await resp.text();
793
801
  const res = JSON.parse(raw);
794
- validate(uploadEntrySchema, res);
802
+ validate(uploadEntrySchema, res, verify);
795
803
  return res;
796
804
  }
797
805
  /** upload an epub */
798
- async uploadEpub(visibleName, buffer) {
799
- return await this.#uploadFile(visibleName, buffer, "application/epub+zip");
806
+ async uploadEpub(visibleName, buffer, { verify = true } = {}) {
807
+ return await this.#uploadFile(visibleName, buffer, "application/epub+zip", verify);
800
808
  }
801
809
  /** upload a pdf */
802
- async uploadPdf(visibleName, buffer) {
810
+ async uploadPdf(visibleName, buffer, { verify = true } = {}) {
803
811
  // TODO why doesn't this work
804
- return await this.#uploadFile(visibleName, buffer, "application/pdf");
812
+ return await this.#uploadFile(visibleName, buffer, "application/pdf", verify);
805
813
  }
806
814
  async getCache() {
807
815
  const promises = [];
@@ -1,3 +1,3 @@
1
1
  import { JTDSchemaType as JtdSchema } from "ajv/dist/jtd";
2
2
  export type { JtdSchema };
3
- export declare function validate<T>(schema: JtdSchema<T>, obj: unknown): asserts obj is T;
3
+ export declare function validate<T>(schema: JtdSchema<T>, obj: unknown, verify?: boolean): asserts obj is T;
package/dist/validate.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { validate as jtdValidate } from "jtd";
2
- export function validate(schema, obj) {
3
- const errors = jtdValidate(schema, obj);
2
+ export function validate(schema, obj, verify = true) {
3
+ const errors = verify ? jtdValidate(schema, obj) : [];
4
4
  if (errors.length) {
5
5
  // TODO better errors
6
6
  throw new Error(`couldn't validate schema: ${JSON.stringify(obj)} didn't match schema ${JSON.stringify(schema)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rmapi-js",
3
- "version": "3.0.2",
3
+ "version": "4.0.0",
4
4
  "description": "JavaScript implementation of the reMarkable 1.5 api",
5
5
  "repository": "git@github.com:erikbrinkman/rmapi-js.git",
6
6
  "author": "Erik Brinkman <erik.brinkman@gmail.com>",
@@ -17,7 +17,7 @@
17
17
  "./dist/**/*.js",
18
18
  "./dist/**/*.d.ts"
19
19
  ],
20
- "packageManager": "yarn@3.3.1",
20
+ "packageManager": "yarn@4.1.1",
21
21
  "scripts": {
22
22
  "doc": "pnpify typedoc",
23
23
  "fmt": "pnpify prettier --cache --write 'src/*.ts' '*.json'",
@@ -31,35 +31,35 @@
31
31
  "dependencies": {
32
32
  "ajv": "^8.12.0",
33
33
  "base64-js": "^1.5.1",
34
- "json-stable-stringify": "^1.0.2",
34
+ "json-stable-stringify": "^1.1.1",
35
35
  "jtd": "^0.1.1",
36
- "uuid": "^9.0.0"
36
+ "uuid": "^9.0.1"
37
37
  },
38
38
  "devDependencies": {
39
- "@babel/core": "^7.22.9",
40
- "@babel/preset-env": "^7.22.9",
41
- "@babel/preset-typescript": "^7.22.5",
42
- "@types/babel__core": "^7.20.1",
43
- "@types/babel__preset-env": "^7.9.2",
44
- "@types/jest": "^29.5.3",
45
- "@types/json-stable-stringify": "^1.0.34",
46
- "@types/node": "^20.4.2",
47
- "@types/uuid": "^9.0.2",
48
- "@typescript-eslint/eslint-plugin": "^6.1.0",
49
- "@typescript-eslint/parser": "^6.1.0",
50
- "@yarnpkg/pnpify": "^4.0.0-rc.48",
51
- "babel-jest": "^29.6.1",
52
- "esbuild": "^0.18.14",
53
- "eslint": "^8.45.0",
54
- "eslint-config-prettier": "^8.8.0",
55
- "eslint-plugin-jest": "^27.2.3",
39
+ "@babel/core": "^7.24.4",
40
+ "@babel/preset-env": "^7.24.4",
41
+ "@babel/preset-typescript": "^7.24.1",
42
+ "@types/babel__core": "^7.20.5",
43
+ "@types/babel__preset-env": "^7.9.6",
44
+ "@types/jest": "^29.5.12",
45
+ "@types/json-stable-stringify": "^1.0.36",
46
+ "@types/node": "^20.12.4",
47
+ "@types/uuid": "^9.0.8",
48
+ "@typescript-eslint/eslint-plugin": "^7.5.0",
49
+ "@typescript-eslint/parser": "^7.5.0",
50
+ "@yarnpkg/pnpify": "^4.0.1",
51
+ "babel-jest": "^29.7.0",
52
+ "esbuild": "^0.20.2",
53
+ "eslint": "^8.57.0",
54
+ "eslint-config-prettier": "^9.1.0",
55
+ "eslint-plugin-jest": "^27.9.0",
56
56
  "eslint-plugin-spellcheck": "^0.0.20",
57
57
  "eslint-plugin-tsdoc": "^0.2.17",
58
- "jest": "^29.6.1",
59
- "prettier": "^3.0.0",
60
- "prettier-plugin-organize-imports": "^3.2.3",
61
- "typedoc": "^0.24.8",
62
- "typescript": "^5.1.6"
58
+ "jest": "^29.7.0",
59
+ "prettier": "^3.2.5",
60
+ "prettier-plugin-organize-imports": "^3.2.4",
61
+ "typedoc": "^0.25.12",
62
+ "typescript": "^5.4.3"
63
63
  },
64
64
  "prettier": {
65
65
  "plugins": [