rmapi-js 4.0.1 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +0,0 @@
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 Gt=d((si,qt)=>{"use strict";qt.exports=ReferenceError});var Le=d((fi,Ht)=>{"use strict";Ht.exports=SyntaxError});var ie=d((ui,Jt)=>{"use strict";Jt.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,Gn=he();tr.exports=Gn.call(Ln,qn)});var Q=d((gi,sr)=>{"use strict";var y,Hn=_t(),Jn=Nt(),zn=Lt(),Vn=Gt(),Z=Le(),X=ie(),Wn=Vt(),ar=Function,Ge=function(t){try{return ar('"use strict"; return ('+t+").constructor;")()}catch{}},D=Object.getOwnPropertyDescriptor;if(D)try{D({},"")}catch{D=null}var He=function(){throw new X},Yn=D?function(){try{return arguments.callee,He}catch{try{return D(arguments,"callee").get}catch{return He}}}():He,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%":Hn,"%eval%":eval,"%EvalError%":Jn,"%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=Ge("async function () {}");else if(e==="%GeneratorFunction%")r=Ge("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Ge("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 Je=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=Je();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=Je(),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 Gr(t){return"enum"in t}h.isEnumForm=Gr;function Hr(t){return"elements"in t}h.isElementsForm=Hr;function Qe(t){return"properties"in t||"optionalProperties"in t}h.isPropertiesForm=Qe;function Jr(t){return"values"in t}h.isValuesForm=Jr;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||{}))||Gr(t)&&(t.enum.length===0||t.enum.length!==new Set(t.enum).size))return!1;if(Hr(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(Jr(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 G(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(!G(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&&!G(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(!G(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(!G(P))return!1}if(m!==void 0&&typeof m!="boolean"||u!==void 0&&!G(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(!G(P))return!1}return Object.keys(k).length===0}h.isSchema=G});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()),H=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(H.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(H.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(H.isEnumForm(e))A(t,"enum"),(typeof r!="string"||!e.enum.includes(r))&&E(t),O(t);else if(H.isElementsForm(e)){if(A(t,"elements"),Array.isArray(r))for(let[o,i]of r.entries())J(t,o.toString()),V(t,e.elements,i),z(t);else E(t);O(t)}else if(H.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)?(J(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)&&(J(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&&(J(t,o),E(t),z(t))}}else e.properties!==void 0?A(t,"properties"):A(t,"optionalProperties"),E(t),O(t);else if(H.isValuesForm(e)){if(A(t,"values"),typeof r=="object"&&r!==null&&!Array.isArray(r))for(let[o,i]of Object.entries(r))J(t,o),V(t,e.values,i),z(t);else E(t);O(t)}else if(H.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"),J(t,e.discriminator),E(t),z(t),O(t)):(A(t,"discriminator"),J(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 J(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:()=>Ho,remarkable:()=>Jo});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"}},Go={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 Ho(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:Go},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 Jo(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 +0,0 @@
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((Ho,yt)=>{var bn={}.toString;yt.exports=Array.isArray||function(t){return bn.call(t)=="[object Array]"}});var Be=d((Jo,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,Gt)=>{"use strict";Gt.exports=TypeError});var Jt=d((ri,Ht)=>{"use strict";Ht.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=Jt(),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(),Gn=ie.call(Function.call,Array.prototype.concat),Hn=ie.call(Function.apply,Array.prototype.splice),nr=ie.call(Function.call,String.prototype.replace),he=ie.call(Function.call,String.prototype.slice),Jn=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(Jn(/^%?[^%]*%?$/,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],Hn(n,Gn([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 Ge=be(),cr=function(){return!!Ge};cr.hasArrayLengthDefineBug=function(){if(!Ge)return null;try{return Ge([],"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 Je=d((yi,Pe)=>{"use strict";var He=ge(),xe=Z(),ro=br(),no=oe(),xr=xe("%Function.prototype.apply%"),Ar=xe("%Function.prototype.call%"),Er=xe("%Reflect.apply%",!0)||He.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(He,Ar,arguments);return ro(r,1+oo(0,e.length-(arguments.length-1)),!0)};var Pr=function(){return Er(He,xr,arguments)};wr?wr(Pe.exports,"apply",{value:Pr}):Pe.exports.apply=Pr});var Fr=d((di,Tr)=>{"use strict";var Sr=Z(),Or=Je(),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=Je(),$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 G(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(!G(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&&!G(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(!G(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(!G(P))return!1}if(m!==void 0&&typeof m!="boolean"||u!==void 0&&!G(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(!G(P))return!1}return Object.keys(k).length===0}h.isSchema=G});var Gr=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 Hr=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(Gr()),H=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(H.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(H.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(H.isEnumForm(e))A(t,"enum"),(typeof r!="string"||!e.enum.includes(r))&&E(t),O(t);else if(H.isElementsForm(e)){if(A(t,"elements"),Array.isArray(r))for(let[o,i]of r.entries())J(t,o.toString()),z(t,e.elements,i),V(t);else E(t);O(t)}else if(H.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)?(J(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)&&(J(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&&(J(t,o),E(t),V(t))}}else e.properties!==void 0?A(t,"properties"):A(t,"optionalProperties"),E(t),O(t);else if(H.isValuesForm(e)){if(A(t,"values"),typeof r=="object"&&r!==null&&!Array.isArray(r))for(let[o,i]of Object.entries(r))J(t,o),z(t,e.values,i),V(t);else E(t);O(t)}else if(H.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"),J(t,e.discriminator),E(t),V(t),O(t)):(A(t,"discriminator"),J(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 J(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]}),Jr=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});Jr(Xe(),C);Jr(Hr(),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 +0,0 @@
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((Ho,yt)=>{var bn={}.toString;yt.exports=Array.isArray||function(t){return bn.call(t)=="[object Array]"}});var Be=d((Jo,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,Gt)=>{"use strict";Gt.exports=TypeError});var Jt=d((ri,Ht)=>{"use strict";Ht.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=Jt(),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(),Gn=ie.call(Function.call,Array.prototype.concat),Hn=ie.call(Function.apply,Array.prototype.splice),nr=ie.call(Function.call,String.prototype.replace),he=ie.call(Function.call,String.prototype.slice),Jn=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(Jn(/^%?[^%]*%?$/,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],Hn(n,Gn([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 Ge=be(),cr=function(){return!!Ge};cr.hasArrayLengthDefineBug=function(){if(!Ge)return null;try{return Ge([],"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 Je=d((yi,Pe)=>{"use strict";var He=ge(),xe=Z(),ro=br(),no=oe(),xr=xe("%Function.prototype.apply%"),Ar=xe("%Function.prototype.call%"),Er=xe("%Reflect.apply%",!0)||He.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(He,Ar,arguments);return ro(r,1+oo(0,e.length-(arguments.length-1)),!0)};var Pr=function(){return Er(He,xr,arguments)};wr?wr(Pe.exports,"apply",{value:Pr}):Pe.exports.apply=Pr});var Fr=d((di,Tr)=>{"use strict";var Sr=Z(),Or=Je(),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=Je(),$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 G(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(!G(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&&!G(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(!G(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(!G(P))return!1}if(m!==void 0&&typeof m!="boolean"||u!==void 0&&!G(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(!G(P))return!1}return Object.keys(k).length===0}h.isSchema=G});var Gr=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 Hr=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(Gr()),H=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(H.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(H.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(H.isEnumForm(e))A(t,"enum"),(typeof r!="string"||!e.enum.includes(r))&&E(t),O(t);else if(H.isElementsForm(e)){if(A(t,"elements"),Array.isArray(r))for(let[o,i]of r.entries())J(t,o.toString()),z(t,e.elements,i),V(t);else E(t);O(t)}else if(H.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)?(J(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)&&(J(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&&(J(t,o),E(t),V(t))}}else e.properties!==void 0?A(t,"properties"):A(t,"optionalProperties"),E(t),O(t);else if(H.isValuesForm(e)){if(A(t,"values"),typeof r=="object"&&r!==null&&!Array.isArray(r))for(let[o,i]of Object.entries(r))J(t,o),z(t,e.values,i),V(t);else E(t);O(t)}else if(H.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"),J(t,e.discriminator),E(t),V(t),O(t)):(A(t,"discriminator"),J(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 J(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]}),Jr=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});Jr(Xe(),C);Jr(Hr(),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)}})();