@iebh/tera-fy 2.2.11 → 2.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/dist/lib/syncro/entities.d.ts +1 -1
- package/dist/lib/syncro/entities.js +20 -1
- package/dist/lib/syncro/entities.js.map +1 -1
- package/dist/lib/syncro/keyed.js +1 -0
- package/dist/lib/syncro/keyed.js.map +1 -1
- package/dist/lib/syncro/syncro.js +36 -26
- package/dist/lib/syncro/syncro.js.map +1 -1
- package/dist/lib/terafy.client.d.ts +1 -1
- package/dist/lib/terafy.client.js +5 -4
- package/dist/lib/terafy.client.js.map +1 -1
- package/dist/lib/terafy.server.d.ts +18 -3
- package/dist/lib/terafy.server.js +10 -1
- package/dist/lib/terafy.server.js.map +1 -1
- package/dist/plugin.vue2.es2019.js +13 -13
- package/dist/terafy.es2019.js +1 -1
- package/dist/terafy.js +1 -1
- package/eslint.config.js +29 -5
- package/lib/syncro/entities.ts +25 -2
- package/lib/syncro/keyed.ts +1 -0
- package/lib/syncro/syncro.ts +39 -28
- package/lib/terafy.client.ts +15 -14
- package/lib/terafy.server.ts +22 -3
- package/package.json +11 -10
package/dist/terafy.es2019.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var vo=typeof global=="object"&&global&&global.Object===Object&&global,dt=vo;var wo=typeof self=="object"&&self&&self.Object===Object&&self,To=dt||wo||Function("return this")(),d=To;var Po=d.Symbol,g=Po;var te=Object.prototype,jo=te.hasOwnProperty,Oo=te.toString,nt=g?g.toStringTag:void 0;function Ao(t){var e=jo.call(t,nt),r=t[nt];try{t[nt]=void 0;var o=!0}catch{}var a=Oo.call(t);return o&&(e?t[nt]=r:delete t[nt]),a}var ee=Ao;var So=Object.prototype,Io=So.toString;function _o(t){return Io.call(t)}var re=_o;var Eo="[object Null]",Fo="[object Undefined]",oe=g?g.toStringTag:void 0;function Co(t){return t==null?t===void 0?Fo:Eo:oe&&oe in Object(t)?ee(t):re(t)}var w=Co;function No(t){return t!=null&&typeof t=="object"}var y=No;var Mo="[object Symbol]";function Ro(t){return typeof t=="symbol"||y(t)&&w(t)==Mo}var k=Ro;function Lo(t,e){for(var r=-1,o=t==null?0:t.length,a=Array(o);++r<o;)a[r]=e(t[r],r,t);return a}var ct=Lo;var Bo=Array.isArray,x=Bo;var ko=1/0,ae=g?g.prototype:void 0,ie=ae?ae.toString:void 0;function ne(t){if(typeof t=="string")return t;if(x(t))return ct(t,ne)+"";if(k(t))return ie?ie.call(t):"";var e=t+"";return e=="0"&&1/t==-ko?"-0":e}var se=ne;function Do(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var T=Do;function Uo(t){return t}var fe=Uo;var Go="[object AsyncFunction]",zo="[object Function]",Ko="[object GeneratorFunction]",Wo="[object Proxy]";function $o(t){if(!T(t))return!1;var e=w(t);return e==zo||e==Ko||e==Go||e==Wo}var ht=$o;var Ho=d["__core-js_shared__"],xt=Ho;var pe=function(){var t=/[^.]+$/.exec(xt&&xt.keys&&xt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Vo(t){return!!pe&&pe in t}var le=Vo;var Yo=Function.prototype,qo=Yo.toString;function Zo(t){if(t!=null){try{return qo.call(t)}catch{}try{return t+""}catch{}}return""}var A=Zo;var Jo=/[\\^$.*+?()[\]{}|]/g,Xo=/^\[object .+?Constructor\]$/,Qo=Function.prototype,ta=Object.prototype,ea=Qo.toString,ra=ta.hasOwnProperty,oa=RegExp("^"+ea.call(ra).replace(Jo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function aa(t){if(!T(t)||le(t))return!1;var e=ht(t)?oa:Xo;return e.test(A(t))}var me=aa;function ia(t,e){return t==null?void 0:t[e]}var ue=ia;function na(t,e){var r=ue(t,e);return me(r)?r:void 0}var b=na;var sa=b(d,"WeakMap"),gt=sa;var de=Object.create,fa=function(){function t(){}return function(e){if(!T(e))return{};if(de)return de(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),ce=fa;function pa(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var he=pa;function la(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var xe=la;var ma=800,ua=16,da=Date.now;function ca(t){var e=0,r=0;return function(){var o=da(),a=ua-(o-r);if(r=o,a>0){if(++e>=ma)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var ge=ca;function ha(t){return function(){return t}}var ye=ha;var xa=function(){try{var t=b(Object,"defineProperty");return t({},"",{}),t}catch{}}(),D=xa;var ga=D?function(t,e){return D(t,"toString",{configurable:!0,enumerable:!1,value:ye(e),writable:!0})}:fe,be=ga;var ya=ge(be),ve=ya;function ba(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var we=ba;var va=9007199254740991,wa=/^(?:0|[1-9]\d*)$/;function Ta(t,e){var r=typeof t;return e=e==null?va:e,!!e&&(r=="number"||r!="symbol"&&wa.test(t))&&t>-1&&t%1==0&&t<e}var U=Ta;function Pa(t,e,r){e=="__proto__"&&D?D(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var yt=Pa;function ja(t,e){return t===e||t!==t&&e!==e}var bt=ja;var Oa=Object.prototype,Aa=Oa.hasOwnProperty;function Sa(t,e,r){var o=t[e];(!(Aa.call(t,e)&&bt(o,r))||r===void 0&&!(e in t))&&yt(t,e,r)}var G=Sa;function Ia(t,e,r,o){var a=!r;r||(r={});for(var n=-1,i=e.length;++n<i;){var s=e[n],u=o?o(r[s],t[s],s,r,t):void 0;u===void 0&&(u=t[s]),a?yt(r,s,u):G(r,s,u)}return r}var O=Ia;var Te=Math.max;function _a(t,e,r){return e=Te(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,n=Te(o.length-e,0),i=Array(n);++a<n;)i[a]=o[e+a];a=-1;for(var s=Array(e+1);++a<e;)s[a]=o[a];return s[e]=r(i),he(t,this,s)}}var Pe=_a;var Ea=9007199254740991;function Fa(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Ea}var z=Fa;function Ca(t){return t!=null&&z(t.length)&&!ht(t)}var vt=Ca;var Na=Object.prototype;function Ma(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Na;return t===r}var K=Ma;function Ra(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var je=Ra;var La="[object Arguments]";function Ba(t){return y(t)&&w(t)==La}var Bt=Ba;var Oe=Object.prototype,ka=Oe.hasOwnProperty,Da=Oe.propertyIsEnumerable,Ua=Bt(function(){return arguments}())?Bt:function(t){return y(t)&&ka.call(t,"callee")&&!Da.call(t,"callee")},W=Ua;function Ga(){return!1}var Ae=Ga;var _e=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Se=_e&&typeof module=="object"&&module&&!module.nodeType&&module,za=Se&&Se.exports===_e,Ie=za?d.Buffer:void 0,Ka=Ie?Ie.isBuffer:void 0,Wa=Ka||Ae,wt=Wa;var $a="[object Arguments]",Ha="[object Array]",Va="[object Boolean]",Ya="[object Date]",qa="[object Error]",Za="[object Function]",Ja="[object Map]",Xa="[object Number]",Qa="[object Object]",ti="[object RegExp]",ei="[object Set]",ri="[object String]",oi="[object WeakMap]",ai="[object ArrayBuffer]",ii="[object DataView]",ni="[object Float32Array]",si="[object Float64Array]",fi="[object Int8Array]",pi="[object Int16Array]",li="[object Int32Array]",mi="[object Uint8Array]",ui="[object Uint8ClampedArray]",di="[object Uint16Array]",ci="[object Uint32Array]",m={};m[ni]=m[si]=m[fi]=m[pi]=m[li]=m[mi]=m[ui]=m[di]=m[ci]=!0;m[$a]=m[Ha]=m[ai]=m[Va]=m[ii]=m[Ya]=m[qa]=m[Za]=m[Ja]=m[Xa]=m[Qa]=m[ti]=m[ei]=m[ri]=m[oi]=!1;function hi(t){return y(t)&&z(t.length)&&!!m[w(t)]}var Ee=hi;function xi(t){return function(e){return t(e)}}var $=xi;var Fe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,st=Fe&&typeof module=="object"&&module&&!module.nodeType&&module,gi=st&&st.exports===Fe,kt=gi&&dt.process,yi=function(){try{var t=st&&st.require&&st.require("util").types;return t||kt&&kt.binding&&kt.binding("util")}catch{}}(),S=yi;var Ce=S&&S.isTypedArray,bi=Ce?$(Ce):Ee,Ne=bi;var vi=Object.prototype,wi=vi.hasOwnProperty;function Ti(t,e){var r=x(t),o=!r&&W(t),a=!r&&!o&&wt(t),n=!r&&!o&&!a&&Ne(t),i=r||o||a||n,s=i?je(t.length,String):[],u=s.length;for(var c in t)(e||wi.call(t,c))&&!(i&&(c=="length"||a&&(c=="offset"||c=="parent")||n&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||U(c,u)))&&s.push(c);return s}var Tt=Ti;function Pi(t,e){return function(r){return t(e(r))}}var Pt=Pi;var ji=Pt(Object.keys,Object),Me=ji;var Oi=Object.prototype,Ai=Oi.hasOwnProperty;function Si(t){if(!K(t))return Me(t);var e=[];for(var r in Object(t))Ai.call(t,r)&&r!="constructor"&&e.push(r);return e}var Re=Si;function Ii(t){return vt(t)?Tt(t):Re(t)}var H=Ii;function _i(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Le=_i;var Ei=Object.prototype,Fi=Ei.hasOwnProperty;function Ci(t){if(!T(t))return Le(t);var e=K(t),r=[];for(var o in t)o=="constructor"&&(e||!Fi.call(t,o))||r.push(o);return r}var Be=Ci;function Ni(t){return vt(t)?Tt(t,!0):Be(t)}var V=Ni;var Mi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ri=/^\w*$/;function Li(t,e){if(x(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||k(t)?!0:Ri.test(t)||!Mi.test(t)||e!=null&&t in Object(e)}var ke=Li;var Bi=b(Object,"create"),I=Bi;function ki(){this.__data__=I?I(null):{},this.size=0}var De=ki;function Di(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Ue=Di;var Ui="__lodash_hash_undefined__",Gi=Object.prototype,zi=Gi.hasOwnProperty;function Ki(t){var e=this.__data__;if(I){var r=e[t];return r===Ui?void 0:r}return zi.call(e,t)?e[t]:void 0}var Ge=Ki;var Wi=Object.prototype,$i=Wi.hasOwnProperty;function Hi(t){var e=this.__data__;return I?e[t]!==void 0:$i.call(e,t)}var ze=Hi;var Vi="__lodash_hash_undefined__";function Yi(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=I&&e===void 0?Vi:e,this}var Ke=Yi;function Y(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Y.prototype.clear=De;Y.prototype.delete=Ue;Y.prototype.get=Ge;Y.prototype.has=ze;Y.prototype.set=Ke;var Dt=Y;function qi(){this.__data__=[],this.size=0}var We=qi;function Zi(t,e){for(var r=t.length;r--;)if(bt(t[r][0],e))return r;return-1}var E=Zi;var Ji=Array.prototype,Xi=Ji.splice;function Qi(t){var e=this.__data__,r=E(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Xi.call(e,r,1),--this.size,!0}var $e=Qi;function tn(t){var e=this.__data__,r=E(e,t);return r<0?void 0:e[r][1]}var He=tn;function en(t){return E(this.__data__,t)>-1}var Ve=en;function rn(t,e){var r=this.__data__,o=E(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Ye=rn;function q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}q.prototype.clear=We;q.prototype.delete=$e;q.prototype.get=He;q.prototype.has=Ve;q.prototype.set=Ye;var F=q;var on=b(d,"Map"),C=on;function an(){this.size=0,this.__data__={hash:new Dt,map:new(C||F),string:new Dt}}var qe=an;function nn(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Ze=nn;function sn(t,e){var r=t.__data__;return Ze(e)?r[typeof e=="string"?"string":"hash"]:r.map}var N=sn;function fn(t){var e=N(this,t).delete(t);return this.size-=e?1:0,e}var Je=fn;function pn(t){return N(this,t).get(t)}var Xe=pn;function ln(t){return N(this,t).has(t)}var Qe=ln;function mn(t,e){var r=N(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var tr=mn;function Z(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Z.prototype.clear=qe;Z.prototype.delete=Je;Z.prototype.get=Xe;Z.prototype.has=Qe;Z.prototype.set=tr;var ft=Z;var un="Expected a function";function Ut(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(un);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],n=r.cache;if(n.has(a))return n.get(a);var i=t.apply(this,o);return r.cache=n.set(a,i)||n,i};return r.cache=new(Ut.Cache||ft),r}Ut.Cache=ft;var er=Ut;var dn=500;function cn(t){var e=er(t,function(o){return r.size===dn&&r.clear(),o}),r=e.cache;return e}var rr=cn;var hn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xn=/\\(\\)?/g,gn=rr(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(hn,function(r,o,a,n){e.push(a?n.replace(xn,"$1"):o||r)}),e}),or=gn;function yn(t){return t==null?"":se(t)}var ar=yn;function bn(t,e){return x(t)?t:ke(t,e)?[t]:or(ar(t))}var P=bn;var vn=1/0;function wn(t){if(typeof t=="string"||k(t))return t;var e=t+"";return e=="0"&&1/t==-vn?"-0":e}var M=wn;function Tn(t,e){e=P(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[M(e[r++])];return r&&r==o?t:void 0}var jt=Tn;function Pn(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var J=Pn;var ir=g?g.isConcatSpreadable:void 0;function jn(t){return x(t)||W(t)||!!(ir&&t&&t[ir])}var nr=jn;function sr(t,e,r,o,a){var n=-1,i=t.length;for(r||(r=nr),a||(a=[]);++n<i;){var s=t[n];e>0&&r(s)?e>1?sr(s,e-1,r,o,a):J(a,s):o||(a[a.length]=s)}return a}var fr=sr;function On(t){var e=t==null?0:t.length;return e?fr(t,1):[]}var pr=On;function An(t){return ve(Pe(t,void 0,pr),t+"")}var Ot=An;var Sn=Pt(Object.getPrototypeOf,Object),X=Sn;var In="[object Object]",_n=Function.prototype,En=Object.prototype,lr=_n.toString,Fn=En.hasOwnProperty,Cn=lr.call(Object);function Nn(t){if(!y(t)||w(t)!=In)return!1;var e=X(t);if(e===null)return!0;var r=Fn.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&lr.call(r)==Cn}var mr=Nn;function Mn(t,e,r){var o=-1,a=t.length;e<0&&(e=-e>a?0:a+e),r=r>a?a:r,r<0&&(r+=a),a=e>r?0:r-e>>>0,e>>>=0;for(var n=Array(a);++o<a;)n[o]=t[o+e];return n}var ur=Mn;function Rn(){this.__data__=new F,this.size=0}var dr=Rn;function Ln(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var cr=Ln;function Bn(t){return this.__data__.get(t)}var hr=Bn;function kn(t){return this.__data__.has(t)}var xr=kn;var Dn=200;function Un(t,e){var r=this.__data__;if(r instanceof F){var o=r.__data__;if(!C||o.length<Dn-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new ft(o)}return r.set(t,e),this.size=r.size,this}var gr=Un;function Q(t){var e=this.__data__=new F(t);this.size=e.size}Q.prototype.clear=dr;Q.prototype.delete=cr;Q.prototype.get=hr;Q.prototype.has=xr;Q.prototype.set=gr;var yr=Q;function Gn(t,e){return t&&O(e,H(e),t)}var br=Gn;function zn(t,e){return t&&O(e,V(e),t)}var vr=zn;var jr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,wr=jr&&typeof module=="object"&&module&&!module.nodeType&&module,Kn=wr&&wr.exports===jr,Tr=Kn?d.Buffer:void 0,Pr=Tr?Tr.allocUnsafe:void 0;function Wn(t,e){if(e)return t.slice();var r=t.length,o=Pr?Pr(r):new t.constructor(r);return t.copy(o),o}var Or=Wn;function $n(t,e){for(var r=-1,o=t==null?0:t.length,a=0,n=[];++r<o;){var i=t[r];e(i,r,t)&&(n[a++]=i)}return n}var Ar=$n;function Hn(){return[]}var At=Hn;var Vn=Object.prototype,Yn=Vn.propertyIsEnumerable,Sr=Object.getOwnPropertySymbols,qn=Sr?function(t){return t==null?[]:(t=Object(t),Ar(Sr(t),function(e){return Yn.call(t,e)}))}:At,tt=qn;function Zn(t,e){return O(t,tt(t),e)}var Ir=Zn;var Jn=Object.getOwnPropertySymbols,Xn=Jn?function(t){for(var e=[];t;)J(e,tt(t)),t=X(t);return e}:At,St=Xn;function Qn(t,e){return O(t,St(t),e)}var _r=Qn;function ts(t,e,r){var o=e(t);return x(t)?o:J(o,r(t))}var It=ts;function es(t){return It(t,H,tt)}var Er=es;function rs(t){return It(t,V,St)}var _t=rs;var os=b(d,"DataView"),Et=os;var as=b(d,"Promise"),Ft=as;var is=b(d,"Set"),Ct=is;var Fr="[object Map]",ns="[object Object]",Cr="[object Promise]",Nr="[object Set]",Mr="[object WeakMap]",Rr="[object DataView]",ss=A(Et),fs=A(C),ps=A(Ft),ls=A(Ct),ms=A(gt),L=w;(Et&&L(new Et(new ArrayBuffer(1)))!=Rr||C&&L(new C)!=Fr||Ft&&L(Ft.resolve())!=Cr||Ct&&L(new Ct)!=Nr||gt&&L(new gt)!=Mr)&&(L=function(t){var e=w(t),r=e==ns?t.constructor:void 0,o=r?A(r):"";if(o)switch(o){case ss:return Rr;case fs:return Fr;case ps:return Cr;case ls:return Nr;case ms:return Mr}return e});var et=L;var us=Object.prototype,ds=us.hasOwnProperty;function cs(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&ds.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Lr=cs;var hs=d.Uint8Array,Gt=hs;function xs(t){var e=new t.constructor(t.byteLength);return new Gt(e).set(new Gt(t)),e}var rt=xs;function gs(t,e){var r=e?rt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Br=gs;var ys=/\w*$/;function bs(t){var e=new t.constructor(t.source,ys.exec(t));return e.lastIndex=t.lastIndex,e}var kr=bs;var Dr=g?g.prototype:void 0,Ur=Dr?Dr.valueOf:void 0;function vs(t){return Ur?Object(Ur.call(t)):{}}var Gr=vs;function ws(t,e){var r=e?rt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var zr=ws;var Ts="[object Boolean]",Ps="[object Date]",js="[object Map]",Os="[object Number]",As="[object RegExp]",Ss="[object Set]",Is="[object String]",_s="[object Symbol]",Es="[object ArrayBuffer]",Fs="[object DataView]",Cs="[object Float32Array]",Ns="[object Float64Array]",Ms="[object Int8Array]",Rs="[object Int16Array]",Ls="[object Int32Array]",Bs="[object Uint8Array]",ks="[object Uint8ClampedArray]",Ds="[object Uint16Array]",Us="[object Uint32Array]";function Gs(t,e,r){var o=t.constructor;switch(e){case Es:return rt(t);case Ts:case Ps:return new o(+t);case Fs:return Br(t,r);case Cs:case Ns:case Ms:case Rs:case Ls:case Bs:case ks:case Ds:case Us:return zr(t,r);case js:return new o;case Os:case Is:return new o(t);case As:return kr(t);case Ss:return new o;case _s:return Gr(t)}}var Kr=Gs;function zs(t){return typeof t.constructor=="function"&&!K(t)?ce(X(t)):{}}var Wr=zs;var Ks="[object Map]";function Ws(t){return y(t)&&et(t)==Ks}var $r=Ws;var Hr=S&&S.isMap,$s=Hr?$(Hr):$r,Vr=$s;var Hs="[object Set]";function Vs(t){return y(t)&&et(t)==Hs}var Yr=Vs;var qr=S&&S.isSet,Ys=qr?$(qr):Yr,Zr=Ys;var qs=1,Zs=2,Js=4,Jr="[object Arguments]",Xs="[object Array]",Qs="[object Boolean]",tf="[object Date]",ef="[object Error]",Xr="[object Function]",rf="[object GeneratorFunction]",of="[object Map]",af="[object Number]",Qr="[object Object]",nf="[object RegExp]",sf="[object Set]",ff="[object String]",pf="[object Symbol]",lf="[object WeakMap]",mf="[object ArrayBuffer]",uf="[object DataView]",df="[object Float32Array]",cf="[object Float64Array]",hf="[object Int8Array]",xf="[object Int16Array]",gf="[object Int32Array]",yf="[object Uint8Array]",bf="[object Uint8ClampedArray]",vf="[object Uint16Array]",wf="[object Uint32Array]",l={};l[Jr]=l[Xs]=l[mf]=l[uf]=l[Qs]=l[tf]=l[df]=l[cf]=l[hf]=l[xf]=l[gf]=l[of]=l[af]=l[Qr]=l[nf]=l[sf]=l[ff]=l[pf]=l[yf]=l[bf]=l[vf]=l[wf]=!0;l[ef]=l[Xr]=l[lf]=!1;function Nt(t,e,r,o,a,n){var i,s=e&qs,u=e&Zs,c=e&Js;if(r&&(i=a?r(t,o,a,n):r(t)),i!==void 0)return i;if(!T(t))return t;var h=x(t);if(h){if(i=Lr(t),!s)return xe(t,i)}else{var j=et(t),pt=j==Xr||j==rf;if(wt(t))return Or(t,s);if(j==Qr||j==Jr||pt&&!a){if(i=u||pt?{}:Wr(t),!s)return u?_r(t,vr(i,t)):Ir(t,br(i,t))}else{if(!l[j])return a?t:{};i=Kr(t,j,s)}}n||(n=new yr);var at=n.get(t);if(at)return at;n.set(t,i),Zr(t)?t.forEach(function(v){i.add(Nt(v,e,r,v,t,n))}):Vr(t)&&t.forEach(function(v,f){i.set(f,Nt(v,e,r,f,t,n))});var lt=c?u?_t:Er:u?V:H,mt=h?void 0:lt(t);return we(mt||t,function(v,f){mt&&(f=v,v=t[f]),G(i,f,Nt(v,e,r,f,t,n))}),i}var Mt=Nt;var Tf=1,Pf=4;function jf(t){return Mt(t,Tf|Pf)}var zt=jf;function Of(t,e){return t!=null&&e in Object(t)}var to=Of;function Af(t,e,r){e=P(e,t);for(var o=-1,a=e.length,n=!1;++o<a;){var i=M(e[o]);if(!(n=t!=null&&r(t,i)))break;t=t[i]}return n||++o!=a?n:(a=t==null?0:t.length,!!a&&z(a)&&U(i,a)&&(x(t)||W(t)))}var eo=Af;function Sf(t,e){return t!=null&&eo(t,e,to)}var ro=Sf;function If(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var oo=If;function _f(t,e){return e.length<2?t:jt(t,ur(e,0,-1))}var ao=_f;function Ef(t,e){return e=P(e,t),t=ao(t,e),t==null||delete t[M(oo(e))]}var io=Ef;function Ff(t){return mr(t)?void 0:t}var no=Ff;var Cf=1,Nf=2,Mf=4,Rf=Ot(function(t,e){var r={};if(t==null)return r;var o=!1;e=ct(e,function(n){return n=P(n,t),o||(o=n.length>1),n}),O(t,_t(t),r),o&&(r=Mt(r,Cf|Nf|Mf,no));for(var a=e.length;a--;)io(r,e[a]);return r}),Kt=Rf;function Lf(t,e,r,o){if(!T(t))return t;e=P(e,t);for(var a=-1,n=e.length,i=n-1,s=t;s!=null&&++a<n;){var u=M(e[a]),c=r;if(u==="__proto__"||u==="constructor"||u==="prototype")return t;if(a!=i){var h=s[u];c=o?o(h,u,s):void 0,c===void 0&&(c=T(h)?h:U(e[a+1])?[]:{})}G(s,u,c),s=s[u]}return t}var so=Lf;function Bf(t,e,r){for(var o=-1,a=e.length,n={};++o<a;){var i=e[o],s=jt(t,i);r(s,i)&&so(n,P(i,t),s)}return n}var fo=Bf;function kf(t,e){return fo(t,e,function(r,o){return ro(t,o)})}var po=kf;var Df=Ot(function(t,e){return t==null?{}:po(t,e)}),Rt=Df;function lo(t){return{all:t=t||new Map,on:function(e,r){var o=t.get(e);o?o.push(r):t.set(e,[r])},off:function(e,r){var o=t.get(e);o&&(r?o.splice(o.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var o=t.get(e);o&&o.slice().map(function(a){a(r)}),(o=t.get("*"))&&o.slice().map(function(a){a(e,r)})}}}var mo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Wt=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=mo[r[t]&63];return e};var Uf="array",Gf="bit",uo="bits",zf="byte",co="bytes",ot="",Kf="exponent",Wf="function",ho="iec",$f="Invalid number",Hf="Invalid rounding method",$t="jedec",Vf="object",xo=".",Yf="round",qf="s",Zf="si",Jf="kbit",Xf="kB",Qf=" ",tp="string",ep="0",Ht={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function go(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:n=ot,localeOptions:i={},separator:s=ot,spacer:u=Qf,symbols:c={},standard:h=ot,output:j=tp,fullform:pt=!1,fullforms:at=[],exponent:lt=-1,roundingMethod:mt=Yf,precision:v=0}={}){let f=lt,B=Number(t),p=[],R=0,Lt=ot;h===Zf?(o=10,h=$t):h===ho||h===$t?o=2:o===2?h=ho:(o=10,h=$t);let ut=o===10?1e3:1024,yo=pt===!0,Yt=B<0,qt=Math[mt];if(typeof t!="bigint"&&isNaN(t))throw new TypeError($f);if(typeof qt!==Wf)throw new TypeError(Hf);if(Yt&&(B=-B),(f===-1||isNaN(f))&&(f=Math.floor(Math.log(B)/Math.log(ut)),f<0&&(f=0)),f>8&&(v>0&&(v+=8-f),f=8),j===Kf)return f;if(B===0)p[0]=0,Lt=p[1]=Ht.symbol[h][e?uo:co][f];else{R=B/(o===2?Math.pow(2,f*10):Math.pow(1e3,f)),e&&(R=R*8,R>=ut&&f<8&&(R=R/ut,f++));let it=Math.pow(10,f>0?a:0);p[0]=qt(R*it)/it,p[0]===ut&&f<8&<===-1&&(p[0]=1,f++),Lt=p[1]=o===10&&f===1?e?Jf:Xf:Ht.symbol[h][e?uo:co][f]}if(Yt&&(p[0]=-p[0]),v>0&&(p[0]=p[0].toPrecision(v)),p[1]=c[p[1]]||p[1],n===!0?p[0]=p[0].toLocaleString():n.length>0?p[0]=p[0].toLocaleString(n,i):s.length>0&&(p[0]=p[0].toString().replace(xo,s)),r&&a>0){let it=p[0].toString(),Zt=s||(it.match(/(\D)/g)||[]).pop()||xo,Jt=it.toString().split(Zt),Xt=Jt[1]||ot,Qt=Xt.length,bo=a-Qt;p[0]=`${Jt[0]}${Zt}${Xt.padEnd(Qt+bo,ep)}`}return yo&&(p[1]=at[f]?at[f]:Ht.fullform[h][f]+(e?Gf:zf)+(p[0]===1?ot:qf)),j===Uf?p:j===Vf?{value:p[0],symbol:p[1],exponent:f,unit:Lt}:p.join(u)}var _=class t{constructor(e){this.meta={};var o;if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,Kt(e,"encodeIdFunction")),e.encodeIdFunction&&typeof e.encodeIdFunction=="function"&&(this.id=e.encodeIdFunction(this.id));let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.created&&typeof this.created=="string"&&(this.created=new Date(this.created)),this.modified&&typeof this.modified=="string"&&(this.modified=new Date(this.modified)),this.accessed&&typeof this.accessed=="string"&&(this.accessed=new Date(this.accessed)),this.isFolder&&(this.files=(o=this.files)==null?void 0:o.map(a=>{let n=a.path.split(/\//).slice(3).join("/"),i=this.url+"/"+a.name;return a.meta.reflib&&(i=i.replace(/\/project\/download\//,"/project/library/")),new t({tera:this._tera,...a,sbId:a.id,id:a.path,encodeIdFunction:e.encodeIdFunction,path:n,url:i})})),this.teraUrl=this.url.replace(/^https?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=go(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(e){return this._tera.getProjectFileContents(this.id,e)}setContents(e){return this._tera.setProjectFileContents(this.id,e,{})}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Rt(this,["id","sbId","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){let r=Rt(e,["tera","id","sbId","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]);return new t(r)}};var Vt=class{constructor(e){this.settings={session:null,devMode:!1,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child(e){e.siteUrl=="https://tera-tools.com/embed"&&(e.siteUrl="https://dev.tera-tools.com/embed")}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"*",frameSandbox:["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation"],handshakeInterval:1e3,handshakeTimeout:1e4,debugPaths:null};this.events=lo();this.dom={el:null,iframe:null,popup:null,stylesheet:null};this.methods=["handshake","setServerVerbosity","getUser","requireUser","getCredentials","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getNamespace","setNamespace","listNamespaces","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateRefresh","getProjectFileContents","deleteProjectFile","setProjectFileContents","createProjectFolder","deleteProjectFolder","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiPanic","uiProgress","uiPrompt","uiThrow","uiSplat","uiWindow"];this.plugins=[];this.namespaces={};this.acceptPostboxes={};this.initPromise=null;e&&this.set(e)}send(e){let r=Wt();return this.acceptPostboxes[r]={},this.acceptPostboxes[r].promise=new Promise((o,a)=>{Object.assign(this.acceptPostboxes[r],{resolve:o,reject:a}),this.sendRaw({id:r,...e})}),this.acceptPostboxes[r].promise}sendRaw(e){let r;try{if(r={TERA:1,id:e.id||Wt(),...zt(e)},this.settings.mode=="parent")window.parent.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="child")this.dom.iframe.contentWindow.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="popup")this.dom.popup.postMessage(r,this.settings.restrictOrigin);else throw this.settings.mode=="detect"?new Error("Call init() or detectMode() before trying to send data to determine the mode"):new Error(`Unknown TERA communication mode "${this.settings.mode}"`)}catch(o){throw this.debug("ERROR",1,"Message compose client->server:",o),this.debug("ERROR",1,"Attempted to dispatch payload client->server",r),o}}rpc(e,...r){return this.send({action:"rpc",method:e,args:r})}acceptMessage(e){if(e.origin==window.location.origin)return Promise.resolve();let r=e.data;return!r.TERA||!r.id?Promise.resolve():(this.debug("INFO",3,"Recieved message",r),(r==null?void 0:r.action)=="response"&&this.acceptPostboxes[r.id]?(r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response),Promise.resolve()):(r==null?void 0:r.action)=="rpc"?Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})}):(r==null?void 0:r.action)=="event"?Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o}):r!=null&&r.id?(this.debug("INFO",3,`Ignoring message ID ${r.id} - was meant for someone else?`),Promise.resolve()):(this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r}),Promise.resolve()))}mountNamespace(e){if(!/^[\w-]+$/.test(e))throw new Error("Namespaces must be alphanumeric + hyphens + underscores");return this.namespaces[e]?Promise.resolve(this.namespaces[e]):Promise.resolve().then(()=>this._mountNamespace(e)).then(()=>this.namespaces[e]||Promise.reject(`teraFy.mountNamespace('${e}') resolved but no namespace has been mounted`))}_mountNamespace(e){throw console.warn("teraFy._mountNamespace() has not been overriden by a TERA-fy plugin, load one to add this functionality for your preferred framework"),new Error("teraFy._mountNamespace() is not supported")}unmountNamespace(e){return this.namespaces[e]?this._unmountNamespace(e):Promise.resolve()}_unmountNamespace(e){console.warn("teraFy.unbindNamespace() has not been overriden by a TERA-fy plugin, load one to add this functionality for your preferred framework")}init(e){if(e&&this.set(e),this.initPromise)return this.initPromise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.initPromise=Promise.resolve().then(()=>{var o;return(o=this.settings).session||(o.session="tfy-"+this.getEntropicString(16))}).then(()=>this.debug("INFO",4,"[0/6] Init","Session",this.settings.session,"against",this.settings.siteUrl)).then(()=>{this.settings.devMode&&(this.settings.debugPaths?this.settings.debugPaths=this.settings.debugPaths.map(o=>Array.isArray(o)?o.join("."):typeof o=="string"?o:(()=>{throw new Error("Unknown path type - should be an array or string in dotted notation")})()):this.settings.debugPaths=null,this.debug("INFO",0,"Watching state paths",this.settings.debugPaths))}).then(()=>this.detectMode()).then(o=>{if(this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o,this.settings.modeOverrides[o])return this.debug("INFO",4,"[1/6] Applying specific config overrides for mode",o),this.settings.modeOverrides[o](this.settings)}).then(()=>this.debug("INFO",4,"[2/6] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>{if(this.settings.verbosity<=1){this.debug("INFO",4,"[3/6] Skip - Server verbosity is already at 1");return}else return this.debug("INFO",4,`[3/6] Set server verbosity to ${this.settings.verbosity}`),this.rpc("setServerVerbosity",this.settings.verbosity)}).then(()=>this.debug("INFO",4,`[4/6] Set server mode to "${this.settings.mode}"`)).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw`Unknown server mode "${this.settings.mode}"`})())).then(()=>this.debug("INFO",4,"[5/6] Run client plugins")).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings)))).then(()=>(this.debug("INFO",4,"[6/6] Init complete"),r)).catch(o=>{throw this.debug("WARN",0,"Init process fault",o),o}),this.initPromise}detectMode(){return this.settings.mode!="detect"?Promise.resolve(this.settings.mode):window.self===window.parent?Promise.resolve(this.settings.modeFallback):Promise.resolve().then(()=>this.settings.mode="parent").then(()=>new Promise((e,r)=>{let o=setTimeout(()=>r("TIMEOUT"),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e(void 0)).catch(r)})).then(()=>"parent").catch(()=>this.settings.modeFallback)}injectComms(){switch(this.settings.mode){case"child":return Promise.resolve().then(()=>new Promise(e=>{this.debug("INFO",2,"Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this.dom.el.classList.add("minimized"),document.body.append(this.dom.el),this.dom.el.addEventListener("click",()=>this.dom.el.classList.toggle("minimized")),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("INFO",3,"Embeded iframe ready"),e(void 0)}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe)})).then(()=>this.handshakeLoop());case"parent":return this.debug("INFO",2,"Using TERA window parent"),Promise.resolve();case"popup":return this.debug("INFO",2,"Injecting TERA site as a popup window"),this.dom.popup=window.open(this.settings.siteUrl,"_blank","popup=1, location=0, menubar=0, status=0, scrollbars=0, width=500, height=600"),this.handshakeLoop().then(()=>this.debug("INFO",3,"Popup window accepted handshake"));default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}}handshakeLoop(e){let r={handshakeInterval:this.settings.handshakeInterval,handshakeTimeout:this.settings.handshakeTimeout,...e};return new Promise((o,a)=>{let n=0,i,s=setTimeout(()=>{clearTimeout(i),a("TIMEOUT")},r.handshakeTimeout),u=()=>{this.debug("INFO",4,"Trying handshake",++n),clearTimeout(i),i=setTimeout(u,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(s),clearTimeout(i)}).then(()=>o(void 0)).catch(a)};u()})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","body:not(.tera-fy-focus) &.minimized.dev-mode {","background: var(--TERA-accent) !important;","opacity: 0.5;","right: 0px;","bottom: 0px;","width: 30px;","height: 30px;","transition: opacity 0.2s ease-out;","cursor: pointer;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","display: flex;","justify-content: center;","align-items: center;","&::before {","margin: 2px 0 0 0;",'content: "\u{1F300}";',"color: #FFF;","}","&:hover {","opacity: 1;","}","& > iframe {","display: none;","}","}","body:not(.tera-fy-focus) &:not(.minimized) {","&::before {","display: flex;","align-items: center;","justify-content: center;","cursor: pointer;","background: var(--TERA-accent) !important;","opacity: 0.5;","transition: opacity 0.2s ease-out;","position: absolute;","right: 0px;","bottom: 0px;","width: 20px;","height: 20px;","margin: 2px 0 0 0;",'content: "\u2B68";',"color: #FFF;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","}","&:hover::before {","opacity: 1;","}","}","&.dev-mode {","display: flex;","border: 5px solid var(--TERA-accent);","background: #FFF;","}","& > iframe {","width: 100%;","height: 100%;","}","}","body.tera-fy-focus {","overflow: hidden;","& #tera-fy {","display: flex !important;","position: fixed !important;","top: 0px !important;","width: 100vw !important;","height: 100vh !important;","left: 0px !important;","z-index: 10000 !important;","}","}"].join(`
|
|
1
|
+
var vo=typeof global=="object"&&global&&global.Object===Object&&global,dt=vo;var wo=typeof self=="object"&&self&&self.Object===Object&&self,To=dt||wo||Function("return this")(),d=To;var Po=d.Symbol,g=Po;var te=Object.prototype,jo=te.hasOwnProperty,Oo=te.toString,nt=g?g.toStringTag:void 0;function Ao(t){var e=jo.call(t,nt),r=t[nt];try{t[nt]=void 0;var o=!0}catch{}var a=Oo.call(t);return o&&(e?t[nt]=r:delete t[nt]),a}var ee=Ao;var So=Object.prototype,Io=So.toString;function _o(t){return Io.call(t)}var re=_o;var Eo="[object Null]",Fo="[object Undefined]",oe=g?g.toStringTag:void 0;function Co(t){return t==null?t===void 0?Fo:Eo:oe&&oe in Object(t)?ee(t):re(t)}var w=Co;function No(t){return t!=null&&typeof t=="object"}var y=No;var Mo="[object Symbol]";function Ro(t){return typeof t=="symbol"||y(t)&&w(t)==Mo}var k=Ro;function Lo(t,e){for(var r=-1,o=t==null?0:t.length,a=Array(o);++r<o;)a[r]=e(t[r],r,t);return a}var ct=Lo;var Bo=Array.isArray,x=Bo;var ko=1/0,ae=g?g.prototype:void 0,ie=ae?ae.toString:void 0;function ne(t){if(typeof t=="string")return t;if(x(t))return ct(t,ne)+"";if(k(t))return ie?ie.call(t):"";var e=t+"";return e=="0"&&1/t==-ko?"-0":e}var se=ne;function Do(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var T=Do;function Uo(t){return t}var fe=Uo;var Go="[object AsyncFunction]",zo="[object Function]",Ko="[object GeneratorFunction]",Wo="[object Proxy]";function $o(t){if(!T(t))return!1;var e=w(t);return e==zo||e==Ko||e==Go||e==Wo}var ht=$o;var Ho=d["__core-js_shared__"],xt=Ho;var pe=function(){var t=/[^.]+$/.exec(xt&&xt.keys&&xt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Vo(t){return!!pe&&pe in t}var le=Vo;var Yo=Function.prototype,qo=Yo.toString;function Zo(t){if(t!=null){try{return qo.call(t)}catch{}try{return t+""}catch{}}return""}var A=Zo;var Jo=/[\\^$.*+?()[\]{}|]/g,Xo=/^\[object .+?Constructor\]$/,Qo=Function.prototype,ta=Object.prototype,ea=Qo.toString,ra=ta.hasOwnProperty,oa=RegExp("^"+ea.call(ra).replace(Jo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function aa(t){if(!T(t)||le(t))return!1;var e=ht(t)?oa:Xo;return e.test(A(t))}var me=aa;function ia(t,e){return t==null?void 0:t[e]}var ue=ia;function na(t,e){var r=ue(t,e);return me(r)?r:void 0}var b=na;var sa=b(d,"WeakMap"),gt=sa;var de=Object.create,fa=function(){function t(){}return function(e){if(!T(e))return{};if(de)return de(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),ce=fa;function pa(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var he=pa;function la(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var xe=la;var ma=800,ua=16,da=Date.now;function ca(t){var e=0,r=0;return function(){var o=da(),a=ua-(o-r);if(r=o,a>0){if(++e>=ma)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var ge=ca;function ha(t){return function(){return t}}var ye=ha;var xa=function(){try{var t=b(Object,"defineProperty");return t({},"",{}),t}catch{}}(),D=xa;var ga=D?function(t,e){return D(t,"toString",{configurable:!0,enumerable:!1,value:ye(e),writable:!0})}:fe,be=ga;var ya=ge(be),ve=ya;function ba(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var we=ba;var va=9007199254740991,wa=/^(?:0|[1-9]\d*)$/;function Ta(t,e){var r=typeof t;return e=e==null?va:e,!!e&&(r=="number"||r!="symbol"&&wa.test(t))&&t>-1&&t%1==0&&t<e}var U=Ta;function Pa(t,e,r){e=="__proto__"&&D?D(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var yt=Pa;function ja(t,e){return t===e||t!==t&&e!==e}var bt=ja;var Oa=Object.prototype,Aa=Oa.hasOwnProperty;function Sa(t,e,r){var o=t[e];(!(Aa.call(t,e)&&bt(o,r))||r===void 0&&!(e in t))&&yt(t,e,r)}var G=Sa;function Ia(t,e,r,o){var a=!r;r||(r={});for(var n=-1,i=e.length;++n<i;){var s=e[n],u=o?o(r[s],t[s],s,r,t):void 0;u===void 0&&(u=t[s]),a?yt(r,s,u):G(r,s,u)}return r}var O=Ia;var Te=Math.max;function _a(t,e,r){return e=Te(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,n=Te(o.length-e,0),i=Array(n);++a<n;)i[a]=o[e+a];a=-1;for(var s=Array(e+1);++a<e;)s[a]=o[a];return s[e]=r(i),he(t,this,s)}}var Pe=_a;var Ea=9007199254740991;function Fa(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Ea}var z=Fa;function Ca(t){return t!=null&&z(t.length)&&!ht(t)}var vt=Ca;var Na=Object.prototype;function Ma(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Na;return t===r}var K=Ma;function Ra(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var je=Ra;var La="[object Arguments]";function Ba(t){return y(t)&&w(t)==La}var Bt=Ba;var Oe=Object.prototype,ka=Oe.hasOwnProperty,Da=Oe.propertyIsEnumerable,Ua=Bt(function(){return arguments}())?Bt:function(t){return y(t)&&ka.call(t,"callee")&&!Da.call(t,"callee")},W=Ua;function Ga(){return!1}var Ae=Ga;var _e=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Se=_e&&typeof module=="object"&&module&&!module.nodeType&&module,za=Se&&Se.exports===_e,Ie=za?d.Buffer:void 0,Ka=Ie?Ie.isBuffer:void 0,Wa=Ka||Ae,wt=Wa;var $a="[object Arguments]",Ha="[object Array]",Va="[object Boolean]",Ya="[object Date]",qa="[object Error]",Za="[object Function]",Ja="[object Map]",Xa="[object Number]",Qa="[object Object]",ti="[object RegExp]",ei="[object Set]",ri="[object String]",oi="[object WeakMap]",ai="[object ArrayBuffer]",ii="[object DataView]",ni="[object Float32Array]",si="[object Float64Array]",fi="[object Int8Array]",pi="[object Int16Array]",li="[object Int32Array]",mi="[object Uint8Array]",ui="[object Uint8ClampedArray]",di="[object Uint16Array]",ci="[object Uint32Array]",m={};m[ni]=m[si]=m[fi]=m[pi]=m[li]=m[mi]=m[ui]=m[di]=m[ci]=!0;m[$a]=m[Ha]=m[ai]=m[Va]=m[ii]=m[Ya]=m[qa]=m[Za]=m[Ja]=m[Xa]=m[Qa]=m[ti]=m[ei]=m[ri]=m[oi]=!1;function hi(t){return y(t)&&z(t.length)&&!!m[w(t)]}var Ee=hi;function xi(t){return function(e){return t(e)}}var $=xi;var Fe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,st=Fe&&typeof module=="object"&&module&&!module.nodeType&&module,gi=st&&st.exports===Fe,kt=gi&&dt.process,yi=function(){try{var t=st&&st.require&&st.require("util").types;return t||kt&&kt.binding&&kt.binding("util")}catch{}}(),S=yi;var Ce=S&&S.isTypedArray,bi=Ce?$(Ce):Ee,Ne=bi;var vi=Object.prototype,wi=vi.hasOwnProperty;function Ti(t,e){var r=x(t),o=!r&&W(t),a=!r&&!o&&wt(t),n=!r&&!o&&!a&&Ne(t),i=r||o||a||n,s=i?je(t.length,String):[],u=s.length;for(var c in t)(e||wi.call(t,c))&&!(i&&(c=="length"||a&&(c=="offset"||c=="parent")||n&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||U(c,u)))&&s.push(c);return s}var Tt=Ti;function Pi(t,e){return function(r){return t(e(r))}}var Pt=Pi;var ji=Pt(Object.keys,Object),Me=ji;var Oi=Object.prototype,Ai=Oi.hasOwnProperty;function Si(t){if(!K(t))return Me(t);var e=[];for(var r in Object(t))Ai.call(t,r)&&r!="constructor"&&e.push(r);return e}var Re=Si;function Ii(t){return vt(t)?Tt(t):Re(t)}var H=Ii;function _i(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Le=_i;var Ei=Object.prototype,Fi=Ei.hasOwnProperty;function Ci(t){if(!T(t))return Le(t);var e=K(t),r=[];for(var o in t)o=="constructor"&&(e||!Fi.call(t,o))||r.push(o);return r}var Be=Ci;function Ni(t){return vt(t)?Tt(t,!0):Be(t)}var V=Ni;var Mi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ri=/^\w*$/;function Li(t,e){if(x(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||k(t)?!0:Ri.test(t)||!Mi.test(t)||e!=null&&t in Object(e)}var ke=Li;var Bi=b(Object,"create"),I=Bi;function ki(){this.__data__=I?I(null):{},this.size=0}var De=ki;function Di(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Ue=Di;var Ui="__lodash_hash_undefined__",Gi=Object.prototype,zi=Gi.hasOwnProperty;function Ki(t){var e=this.__data__;if(I){var r=e[t];return r===Ui?void 0:r}return zi.call(e,t)?e[t]:void 0}var Ge=Ki;var Wi=Object.prototype,$i=Wi.hasOwnProperty;function Hi(t){var e=this.__data__;return I?e[t]!==void 0:$i.call(e,t)}var ze=Hi;var Vi="__lodash_hash_undefined__";function Yi(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=I&&e===void 0?Vi:e,this}var Ke=Yi;function Y(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Y.prototype.clear=De;Y.prototype.delete=Ue;Y.prototype.get=Ge;Y.prototype.has=ze;Y.prototype.set=Ke;var Dt=Y;function qi(){this.__data__=[],this.size=0}var We=qi;function Zi(t,e){for(var r=t.length;r--;)if(bt(t[r][0],e))return r;return-1}var E=Zi;var Ji=Array.prototype,Xi=Ji.splice;function Qi(t){var e=this.__data__,r=E(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Xi.call(e,r,1),--this.size,!0}var $e=Qi;function tn(t){var e=this.__data__,r=E(e,t);return r<0?void 0:e[r][1]}var He=tn;function en(t){return E(this.__data__,t)>-1}var Ve=en;function rn(t,e){var r=this.__data__,o=E(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Ye=rn;function q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}q.prototype.clear=We;q.prototype.delete=$e;q.prototype.get=He;q.prototype.has=Ve;q.prototype.set=Ye;var F=q;var on=b(d,"Map"),C=on;function an(){this.size=0,this.__data__={hash:new Dt,map:new(C||F),string:new Dt}}var qe=an;function nn(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Ze=nn;function sn(t,e){var r=t.__data__;return Ze(e)?r[typeof e=="string"?"string":"hash"]:r.map}var N=sn;function fn(t){var e=N(this,t).delete(t);return this.size-=e?1:0,e}var Je=fn;function pn(t){return N(this,t).get(t)}var Xe=pn;function ln(t){return N(this,t).has(t)}var Qe=ln;function mn(t,e){var r=N(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var tr=mn;function Z(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Z.prototype.clear=qe;Z.prototype.delete=Je;Z.prototype.get=Xe;Z.prototype.has=Qe;Z.prototype.set=tr;var ft=Z;var un="Expected a function";function Ut(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(un);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],n=r.cache;if(n.has(a))return n.get(a);var i=t.apply(this,o);return r.cache=n.set(a,i)||n,i};return r.cache=new(Ut.Cache||ft),r}Ut.Cache=ft;var er=Ut;var dn=500;function cn(t){var e=er(t,function(o){return r.size===dn&&r.clear(),o}),r=e.cache;return e}var rr=cn;var hn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xn=/\\(\\)?/g,gn=rr(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(hn,function(r,o,a,n){e.push(a?n.replace(xn,"$1"):o||r)}),e}),or=gn;function yn(t){return t==null?"":se(t)}var ar=yn;function bn(t,e){return x(t)?t:ke(t,e)?[t]:or(ar(t))}var P=bn;var vn=1/0;function wn(t){if(typeof t=="string"||k(t))return t;var e=t+"";return e=="0"&&1/t==-vn?"-0":e}var M=wn;function Tn(t,e){e=P(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[M(e[r++])];return r&&r==o?t:void 0}var jt=Tn;function Pn(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var J=Pn;var ir=g?g.isConcatSpreadable:void 0;function jn(t){return x(t)||W(t)||!!(ir&&t&&t[ir])}var nr=jn;function sr(t,e,r,o,a){var n=-1,i=t.length;for(r||(r=nr),a||(a=[]);++n<i;){var s=t[n];e>0&&r(s)?e>1?sr(s,e-1,r,o,a):J(a,s):o||(a[a.length]=s)}return a}var fr=sr;function On(t){var e=t==null?0:t.length;return e?fr(t,1):[]}var pr=On;function An(t){return ve(Pe(t,void 0,pr),t+"")}var Ot=An;var Sn=Pt(Object.getPrototypeOf,Object),X=Sn;var In="[object Object]",_n=Function.prototype,En=Object.prototype,lr=_n.toString,Fn=En.hasOwnProperty,Cn=lr.call(Object);function Nn(t){if(!y(t)||w(t)!=In)return!1;var e=X(t);if(e===null)return!0;var r=Fn.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&lr.call(r)==Cn}var mr=Nn;function Mn(t,e,r){var o=-1,a=t.length;e<0&&(e=-e>a?0:a+e),r=r>a?a:r,r<0&&(r+=a),a=e>r?0:r-e>>>0,e>>>=0;for(var n=Array(a);++o<a;)n[o]=t[o+e];return n}var ur=Mn;function Rn(){this.__data__=new F,this.size=0}var dr=Rn;function Ln(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var cr=Ln;function Bn(t){return this.__data__.get(t)}var hr=Bn;function kn(t){return this.__data__.has(t)}var xr=kn;var Dn=200;function Un(t,e){var r=this.__data__;if(r instanceof F){var o=r.__data__;if(!C||o.length<Dn-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new ft(o)}return r.set(t,e),this.size=r.size,this}var gr=Un;function Q(t){var e=this.__data__=new F(t);this.size=e.size}Q.prototype.clear=dr;Q.prototype.delete=cr;Q.prototype.get=hr;Q.prototype.has=xr;Q.prototype.set=gr;var yr=Q;function Gn(t,e){return t&&O(e,H(e),t)}var br=Gn;function zn(t,e){return t&&O(e,V(e),t)}var vr=zn;var jr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,wr=jr&&typeof module=="object"&&module&&!module.nodeType&&module,Kn=wr&&wr.exports===jr,Tr=Kn?d.Buffer:void 0,Pr=Tr?Tr.allocUnsafe:void 0;function Wn(t,e){if(e)return t.slice();var r=t.length,o=Pr?Pr(r):new t.constructor(r);return t.copy(o),o}var Or=Wn;function $n(t,e){for(var r=-1,o=t==null?0:t.length,a=0,n=[];++r<o;){var i=t[r];e(i,r,t)&&(n[a++]=i)}return n}var Ar=$n;function Hn(){return[]}var At=Hn;var Vn=Object.prototype,Yn=Vn.propertyIsEnumerable,Sr=Object.getOwnPropertySymbols,qn=Sr?function(t){return t==null?[]:(t=Object(t),Ar(Sr(t),function(e){return Yn.call(t,e)}))}:At,tt=qn;function Zn(t,e){return O(t,tt(t),e)}var Ir=Zn;var Jn=Object.getOwnPropertySymbols,Xn=Jn?function(t){for(var e=[];t;)J(e,tt(t)),t=X(t);return e}:At,St=Xn;function Qn(t,e){return O(t,St(t),e)}var _r=Qn;function ts(t,e,r){var o=e(t);return x(t)?o:J(o,r(t))}var It=ts;function es(t){return It(t,H,tt)}var Er=es;function rs(t){return It(t,V,St)}var _t=rs;var os=b(d,"DataView"),Et=os;var as=b(d,"Promise"),Ft=as;var is=b(d,"Set"),Ct=is;var Fr="[object Map]",ns="[object Object]",Cr="[object Promise]",Nr="[object Set]",Mr="[object WeakMap]",Rr="[object DataView]",ss=A(Et),fs=A(C),ps=A(Ft),ls=A(Ct),ms=A(gt),L=w;(Et&&L(new Et(new ArrayBuffer(1)))!=Rr||C&&L(new C)!=Fr||Ft&&L(Ft.resolve())!=Cr||Ct&&L(new Ct)!=Nr||gt&&L(new gt)!=Mr)&&(L=function(t){var e=w(t),r=e==ns?t.constructor:void 0,o=r?A(r):"";if(o)switch(o){case ss:return Rr;case fs:return Fr;case ps:return Cr;case ls:return Nr;case ms:return Mr}return e});var et=L;var us=Object.prototype,ds=us.hasOwnProperty;function cs(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&ds.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Lr=cs;var hs=d.Uint8Array,Gt=hs;function xs(t){var e=new t.constructor(t.byteLength);return new Gt(e).set(new Gt(t)),e}var rt=xs;function gs(t,e){var r=e?rt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Br=gs;var ys=/\w*$/;function bs(t){var e=new t.constructor(t.source,ys.exec(t));return e.lastIndex=t.lastIndex,e}var kr=bs;var Dr=g?g.prototype:void 0,Ur=Dr?Dr.valueOf:void 0;function vs(t){return Ur?Object(Ur.call(t)):{}}var Gr=vs;function ws(t,e){var r=e?rt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var zr=ws;var Ts="[object Boolean]",Ps="[object Date]",js="[object Map]",Os="[object Number]",As="[object RegExp]",Ss="[object Set]",Is="[object String]",_s="[object Symbol]",Es="[object ArrayBuffer]",Fs="[object DataView]",Cs="[object Float32Array]",Ns="[object Float64Array]",Ms="[object Int8Array]",Rs="[object Int16Array]",Ls="[object Int32Array]",Bs="[object Uint8Array]",ks="[object Uint8ClampedArray]",Ds="[object Uint16Array]",Us="[object Uint32Array]";function Gs(t,e,r){var o=t.constructor;switch(e){case Es:return rt(t);case Ts:case Ps:return new o(+t);case Fs:return Br(t,r);case Cs:case Ns:case Ms:case Rs:case Ls:case Bs:case ks:case Ds:case Us:return zr(t,r);case js:return new o;case Os:case Is:return new o(t);case As:return kr(t);case Ss:return new o;case _s:return Gr(t)}}var Kr=Gs;function zs(t){return typeof t.constructor=="function"&&!K(t)?ce(X(t)):{}}var Wr=zs;var Ks="[object Map]";function Ws(t){return y(t)&&et(t)==Ks}var $r=Ws;var Hr=S&&S.isMap,$s=Hr?$(Hr):$r,Vr=$s;var Hs="[object Set]";function Vs(t){return y(t)&&et(t)==Hs}var Yr=Vs;var qr=S&&S.isSet,Ys=qr?$(qr):Yr,Zr=Ys;var qs=1,Zs=2,Js=4,Jr="[object Arguments]",Xs="[object Array]",Qs="[object Boolean]",tf="[object Date]",ef="[object Error]",Xr="[object Function]",rf="[object GeneratorFunction]",of="[object Map]",af="[object Number]",Qr="[object Object]",nf="[object RegExp]",sf="[object Set]",ff="[object String]",pf="[object Symbol]",lf="[object WeakMap]",mf="[object ArrayBuffer]",uf="[object DataView]",df="[object Float32Array]",cf="[object Float64Array]",hf="[object Int8Array]",xf="[object Int16Array]",gf="[object Int32Array]",yf="[object Uint8Array]",bf="[object Uint8ClampedArray]",vf="[object Uint16Array]",wf="[object Uint32Array]",l={};l[Jr]=l[Xs]=l[mf]=l[uf]=l[Qs]=l[tf]=l[df]=l[cf]=l[hf]=l[xf]=l[gf]=l[of]=l[af]=l[Qr]=l[nf]=l[sf]=l[ff]=l[pf]=l[yf]=l[bf]=l[vf]=l[wf]=!0;l[ef]=l[Xr]=l[lf]=!1;function Nt(t,e,r,o,a,n){var i,s=e&qs,u=e&Zs,c=e&Js;if(r&&(i=a?r(t,o,a,n):r(t)),i!==void 0)return i;if(!T(t))return t;var h=x(t);if(h){if(i=Lr(t),!s)return xe(t,i)}else{var j=et(t),pt=j==Xr||j==rf;if(wt(t))return Or(t,s);if(j==Qr||j==Jr||pt&&!a){if(i=u||pt?{}:Wr(t),!s)return u?_r(t,vr(i,t)):Ir(t,br(i,t))}else{if(!l[j])return a?t:{};i=Kr(t,j,s)}}n||(n=new yr);var at=n.get(t);if(at)return at;n.set(t,i),Zr(t)?t.forEach(function(v){i.add(Nt(v,e,r,v,t,n))}):Vr(t)&&t.forEach(function(v,f){i.set(f,Nt(v,e,r,f,t,n))});var lt=c?u?_t:Er:u?V:H,mt=h?void 0:lt(t);return we(mt||t,function(v,f){mt&&(f=v,v=t[f]),G(i,f,Nt(v,e,r,f,t,n))}),i}var Mt=Nt;var Tf=1,Pf=4;function jf(t){return Mt(t,Tf|Pf)}var zt=jf;function Of(t,e){return t!=null&&e in Object(t)}var to=Of;function Af(t,e,r){e=P(e,t);for(var o=-1,a=e.length,n=!1;++o<a;){var i=M(e[o]);if(!(n=t!=null&&r(t,i)))break;t=t[i]}return n||++o!=a?n:(a=t==null?0:t.length,!!a&&z(a)&&U(i,a)&&(x(t)||W(t)))}var eo=Af;function Sf(t,e){return t!=null&&eo(t,e,to)}var ro=Sf;function If(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var oo=If;function _f(t,e){return e.length<2?t:jt(t,ur(e,0,-1))}var ao=_f;function Ef(t,e){return e=P(e,t),t=ao(t,e),t==null||delete t[M(oo(e))]}var io=Ef;function Ff(t){return mr(t)?void 0:t}var no=Ff;var Cf=1,Nf=2,Mf=4,Rf=Ot(function(t,e){var r={};if(t==null)return r;var o=!1;e=ct(e,function(n){return n=P(n,t),o||(o=n.length>1),n}),O(t,_t(t),r),o&&(r=Mt(r,Cf|Nf|Mf,no));for(var a=e.length;a--;)io(r,e[a]);return r}),Kt=Rf;function Lf(t,e,r,o){if(!T(t))return t;e=P(e,t);for(var a=-1,n=e.length,i=n-1,s=t;s!=null&&++a<n;){var u=M(e[a]),c=r;if(u==="__proto__"||u==="constructor"||u==="prototype")return t;if(a!=i){var h=s[u];c=o?o(h,u,s):void 0,c===void 0&&(c=T(h)?h:U(e[a+1])?[]:{})}G(s,u,c),s=s[u]}return t}var so=Lf;function Bf(t,e,r){for(var o=-1,a=e.length,n={};++o<a;){var i=e[o],s=jt(t,i);r(s,i)&&so(n,P(i,t),s)}return n}var fo=Bf;function kf(t,e){return fo(t,e,function(r,o){return ro(t,o)})}var po=kf;var Df=Ot(function(t,e){return t==null?{}:po(t,e)}),Rt=Df;function lo(t){return{all:t=t||new Map,on:function(e,r){var o=t.get(e);o?o.push(r):t.set(e,[r])},off:function(e,r){var o=t.get(e);o&&(r?o.splice(o.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var o=t.get(e);o&&o.slice().map(function(a){a(r)}),(o=t.get("*"))&&o.slice().map(function(a){a(e,r)})}}}var mo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Wt=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=mo[r[t]&63];return e};var Uf="array",Gf="bit",uo="bits",zf="byte",co="bytes",ot="",Kf="exponent",Wf="function",ho="iec",$f="Invalid number",Hf="Invalid rounding method",$t="jedec",Vf="object",xo=".",Yf="round",qf="s",Zf="si",Jf="kbit",Xf="kB",Qf=" ",tp="string",ep="0",Ht={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function go(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:n=ot,localeOptions:i={},separator:s=ot,spacer:u=Qf,symbols:c={},standard:h=ot,output:j=tp,fullform:pt=!1,fullforms:at=[],exponent:lt=-1,roundingMethod:mt=Yf,precision:v=0}={}){let f=lt,B=Number(t),p=[],R=0,Lt=ot;h===Zf?(o=10,h=$t):h===ho||h===$t?o=2:o===2?h=ho:(o=10,h=$t);let ut=o===10?1e3:1024,yo=pt===!0,Yt=B<0,qt=Math[mt];if(typeof t!="bigint"&&isNaN(t))throw new TypeError($f);if(typeof qt!==Wf)throw new TypeError(Hf);if(Yt&&(B=-B),(f===-1||isNaN(f))&&(f=Math.floor(Math.log(B)/Math.log(ut)),f<0&&(f=0)),f>8&&(v>0&&(v+=8-f),f=8),j===Kf)return f;if(B===0)p[0]=0,Lt=p[1]=Ht.symbol[h][e?uo:co][f];else{R=B/(o===2?Math.pow(2,f*10):Math.pow(1e3,f)),e&&(R=R*8,R>=ut&&f<8&&(R=R/ut,f++));let it=Math.pow(10,f>0?a:0);p[0]=qt(R*it)/it,p[0]===ut&&f<8&<===-1&&(p[0]=1,f++),Lt=p[1]=o===10&&f===1?e?Jf:Xf:Ht.symbol[h][e?uo:co][f]}if(Yt&&(p[0]=-p[0]),v>0&&(p[0]=p[0].toPrecision(v)),p[1]=c[p[1]]||p[1],n===!0?p[0]=p[0].toLocaleString():n.length>0?p[0]=p[0].toLocaleString(n,i):s.length>0&&(p[0]=p[0].toString().replace(xo,s)),r&&a>0){let it=p[0].toString(),Zt=s||(it.match(/(\D)/g)||[]).pop()||xo,Jt=it.toString().split(Zt),Xt=Jt[1]||ot,Qt=Xt.length,bo=a-Qt;p[0]=`${Jt[0]}${Zt}${Xt.padEnd(Qt+bo,ep)}`}return yo&&(p[1]=at[f]?at[f]:Ht.fullform[h][f]+(e?Gf:zf)+(p[0]===1?ot:qf)),j===Uf?p:j===Vf?{value:p[0],symbol:p[1],exponent:f,unit:Lt}:p.join(u)}var _=class t{constructor(e){this.meta={};var o;if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,Kt(e,"encodeIdFunction")),e.encodeIdFunction&&typeof e.encodeIdFunction=="function"&&(this.id=e.encodeIdFunction(this.id));let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.created&&typeof this.created=="string"&&(this.created=new Date(this.created)),this.modified&&typeof this.modified=="string"&&(this.modified=new Date(this.modified)),this.accessed&&typeof this.accessed=="string"&&(this.accessed=new Date(this.accessed)),this.isFolder&&(this.files=(o=this.files)==null?void 0:o.map(a=>{let n=a.path.split(/\//).slice(3).join("/"),i=this.url+"/"+a.name;return a.meta.reflib&&(i=i.replace(/\/project\/download\//,"/project/library/")),new t({tera:this._tera,...a,sbId:a.id,id:a.path,encodeIdFunction:e.encodeIdFunction,path:n,url:i})})),this.teraUrl=this.url.replace(/^https?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=go(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(e){return this._tera.getProjectFileContents(this.id,e)}setContents(e){return this._tera.setProjectFileContents(this.id,e,{})}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Rt(this,["id","sbId","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){let r=Rt(e,["tera","id","sbId","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]);return new t(r)}};var Vt=class{constructor(e){this.settings={session:null,devMode:!1,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child(e){e.siteUrl=="https://tera-tools.com/embed"&&(e.siteUrl="https://dev.tera-tools.com/embed")}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"*",frameSandbox:["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation"],handshakeInterval:1e3,handshakeTimeout:1e4,debugPaths:null};this.events=lo();this.dom={el:null,iframe:null,popup:null,stylesheet:null};this.methods=["handshake","setServerVerbosity","getUser","requireUser","getCredentials","getKindeToken","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getNamespace","setNamespace","listNamespaces","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateRefresh","getProjectFileContents","deleteProjectFile","setProjectFileContents","createProjectFolder","deleteProjectFolder","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiPanic","uiProgress","uiPrompt","uiThrow","uiSplat","uiWindow"];this.plugins=[];this.namespaces={};this.acceptPostboxes={};this.initPromise=null;e&&this.set(e)}send(e){let r=Wt();return this.acceptPostboxes[r]={},this.acceptPostboxes[r].promise=new Promise((o,a)=>{Object.assign(this.acceptPostboxes[r],{resolve:o,reject:a}),this.sendRaw({id:r,...e})}),this.acceptPostboxes[r].promise}sendRaw(e){let r;try{if(r={TERA:1,id:e.id||Wt(),...zt(e)},this.settings.mode=="parent")window.parent.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="child")this.dom.iframe.contentWindow.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="popup")this.dom.popup.postMessage(r,this.settings.restrictOrigin);else throw this.settings.mode=="detect"?new Error("Call init() or detectMode() before trying to send data to determine the mode"):new Error(`Unknown TERA communication mode "${this.settings.mode}"`)}catch(o){throw this.debug("ERROR",1,"Message compose client->server:",o),this.debug("ERROR",1,"Attempted to dispatch payload client->server",r),o}}rpc(e,...r){return this.send({action:"rpc",method:e,args:r})}acceptMessage(e){if(e.origin==window.location.origin)return Promise.resolve();let r=e.data;return!r.TERA||!r.id?Promise.resolve():(this.debug("INFO",3,"Recieved message",r),(r==null?void 0:r.action)=="response"&&this.acceptPostboxes[r.id]?(r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response),Promise.resolve()):(r==null?void 0:r.action)=="rpc"?Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})}):(r==null?void 0:r.action)=="event"?Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o}):r!=null&&r.id?(this.debug("INFO",3,`Ignoring message ID ${r.id} - was meant for someone else?`),Promise.resolve()):(this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r}),Promise.resolve()))}mountNamespace(e){if(!/^[\w-]+$/.test(e))throw new Error("Namespaces must be alphanumeric + hyphens + underscores");return this.namespaces[e]?Promise.resolve(this.namespaces[e]):Promise.resolve().then(()=>this._mountNamespace(e)).then(()=>this.namespaces[e]||Promise.reject(`teraFy.mountNamespace('${e}') resolved but no namespace has been mounted`))}_mountNamespace(e){throw console.warn("teraFy._mountNamespace() has not been overriden by a TERA-fy plugin, load one to add this functionality for your preferred framework"),new Error("teraFy._mountNamespace() is not supported")}unmountNamespace(e){return this.namespaces[e]?this._unmountNamespace(e):Promise.resolve()}_unmountNamespace(e){console.warn("teraFy.unbindNamespace() has not been overriden by a TERA-fy plugin, load one to add this functionality for your preferred framework")}init(e){if(e&&this.set(e),this.initPromise)return this.initPromise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.initPromise=Promise.resolve().then(()=>{var o;return(o=this.settings).session||(o.session="tfy-"+this.getEntropicString(16))}).then(()=>this.debug("INFO",4,"[0/6] Init","Session",this.settings.session,"against",this.settings.siteUrl)).then(()=>{this.settings.devMode&&(this.settings.debugPaths?this.settings.debugPaths=this.settings.debugPaths.map(o=>Array.isArray(o)?o.join("."):typeof o=="string"?o:(()=>{throw new Error("Unknown path type - should be an array or string in dotted notation")})()):this.settings.debugPaths=null,this.debug("INFO",0,"Watching state paths",this.settings.debugPaths))}).then(()=>this.detectMode()).then(o=>{if(this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o,this.settings.modeOverrides[o])return this.debug("INFO",4,"[1/6] Applying specific config overrides for mode",o),this.settings.modeOverrides[o](this.settings)}).then(()=>this.debug("INFO",4,"[2/6] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>{if(this.settings.verbosity<=1){this.debug("INFO",4,"[3/6] Skip - Server verbosity is already at 1");return}else return this.debug("INFO",4,`[3/6] Set server verbosity to ${this.settings.verbosity}`),this.rpc("setServerVerbosity",this.settings.verbosity)}).then(()=>this.debug("INFO",4,`[4/6] Set server mode to "${this.settings.mode}"`)).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw`Unknown server mode "${this.settings.mode}"`})())).then(()=>this.debug("INFO",4,"[5/6] Run client plugins")).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings)))).then(()=>(this.debug("INFO",4,"[6/6] Init complete"),r)).catch(o=>{throw this.debug("WARN",0,"Init process fault",o),o}),this.initPromise}detectMode(){return this.settings.mode!="detect"?Promise.resolve(this.settings.mode):window.self===window.parent?Promise.resolve(this.settings.modeFallback):Promise.resolve().then(()=>this.settings.mode="parent").then(()=>new Promise((e,r)=>{let o=setTimeout(()=>r("TIMEOUT"),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e()).catch(r)})).then(()=>"parent").catch(()=>this.settings.modeFallback)}injectComms(){switch(this.settings.mode){case"child":return Promise.resolve().then(()=>new Promise(e=>{this.debug("INFO",2,"Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this.dom.el.classList.add("minimized"),document.body.append(this.dom.el),this.dom.el.addEventListener("click",()=>this.dom.el.classList.toggle("minimized")),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("INFO",3,"Embeded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe)})).then(()=>this.handshakeLoop());case"parent":return this.debug("INFO",2,"Using TERA window parent"),Promise.resolve();case"popup":return this.debug("INFO",2,"Injecting TERA site as a popup window"),this.dom.popup=window.open(this.settings.siteUrl,"_blank","popup=1, location=0, menubar=0, status=0, scrollbars=0, width=500, height=600"),this.handshakeLoop().then(()=>this.debug("INFO",3,"Popup window accepted handshake"));default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}}handshakeLoop(e){let r={handshakeInterval:this.settings.handshakeInterval,handshakeTimeout:this.settings.handshakeTimeout,...e};return new Promise((o,a)=>{let n=0,i,s=setTimeout(()=>{clearTimeout(i),a("TIMEOUT")},r.handshakeTimeout),u=()=>{this.debug("INFO",4,"Trying handshake",++n),clearTimeout(i),i=setTimeout(u,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(s),clearTimeout(i)}).then(()=>o()).catch(a)};u()})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","body:not(.tera-fy-focus) &.minimized.dev-mode {","background: var(--TERA-accent) !important;","opacity: 0.5;","right: 0px;","bottom: 0px;","width: 30px;","height: 30px;","transition: opacity 0.2s ease-out;","cursor: pointer;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","display: flex;","justify-content: center;","align-items: center;","&::before {","margin: 2px 0 0 0;",'content: "\u{1F300}";',"color: #FFF;","}","&:hover {","opacity: 1;","}","& > iframe {","display: none;","}","}","body:not(.tera-fy-focus) &:not(.minimized) {","&::before {","display: flex;","align-items: center;","justify-content: center;","cursor: pointer;","background: var(--TERA-accent) !important;","opacity: 0.5;","transition: opacity 0.2s ease-out;","position: absolute;","right: 0px;","bottom: 0px;","width: 20px;","height: 20px;","margin: 2px 0 0 0;",'content: "\u2B68";',"color: #FFF;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","}","&:hover::before {","opacity: 1;","}","}","&.dev-mode {","display: flex;","border: 5px solid var(--TERA-accent);","background: #FFF;","}","& > iframe {","width: 100%;","height: 100%;","}","}","body.tera-fy-focus {","overflow: hidden;","& #tera-fy {","display: flex !important;","position: fixed !important;","top: 0px !important;","width: 100vw !important;","height: 100vh !important;","left: 0px !important;","z-index: 10000 !important;","}","}"].join(`
|
|
2
2
|
`),document.head.appendChild(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){this.methods.forEach(e=>this[e]=this.rpc.bind(this,e))}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r,o){let a={ignoreNullish:!0,...o};return typeof e=="string"?(!a.ignoreNullish||r!=null)&&(this.settings[e]=r):Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r,o){return!this.settings.devMode||r===void 0?this:this.set(e,r,o)}use(e,r){let o=typeof e=="function"?new e(this,r):typeof e=="object"?e:typeof e=="string"?(()=>{throw new Error("use(String) is not yet supported")})():(()=>{throw new Error("Expected use() call to be provided with a class initalizer")})();return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){let o=[],a=r;do o.unshift(a);while(a=Object.getPrototypeOf(a));o.forEach(n=>Object.getOwnPropertyNames(n).filter(i=>!["constructor","init","prototype","name"].includes(i)&&!i.startsWith("__")).forEach(i=>{typeof r[i]=="function"?Object.defineProperty(e,i,{enumerable:!1,value:r[i].bind(e)}):e[i]=r[i]}))}toggleDevMode(e="toggle"){var r;return e==="toggle"?this.settings.devMode=!this.settings.devMode:e==="proxy"?Object.assign(this.settings,{devMode:!0,siteUrl:"http://localhost:7334/embed",mode:"child"}):this.settings.devMode=!!e,this.settings.devMode&&(this.settings.restrictOrigin="*"),(r=this.dom)!=null&&r.el&&this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this}toggleFocus(e="toggle"){this.debug("INFO",2,"Request focus",{isFocused:e}),globalThis.document.body.classList.toggle("tera-fy-focus",e==="toggle"?void 0:e)}getEntropicString(e=32){let r=new Uint32Array(4);return window.crypto.getRandomValues(r),btoa(String.fromCharCode(...new Uint8Array(r.buffer))).replace(/[+/]/g,"").slice(0,e)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new _({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new _({tera:this,...o})))}getProjectFile(e,r){return this.rpc("getProjectFile",e,r).then(o=>o&&new _({tera:this,...o}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new _({tera:this,...r}))}moveProjectFile(e,r,o){return this.rpc("moveProjectFile",e,r,o).then(a=>a?new _({tera:this,...a}):null)}};export{Vt as default};
|
|
3
3
|
/*! Bundled license information:
|
|
4
4
|
|
package/dist/terafy.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var vo=typeof global=="object"&&global&&global.Object===Object&&global,dt=vo;var wo=typeof self=="object"&&self&&self.Object===Object&&self,To=dt||wo||Function("return this")(),d=To;var Po=d.Symbol,x=Po;var te=Object.prototype,jo=te.hasOwnProperty,Oo=te.toString,st=x?x.toStringTag:void 0;function Ao(t){var e=jo.call(t,st),r=t[st];try{t[st]=void 0;var o=!0}catch{}var a=Oo.call(t);return o&&(e?t[st]=r:delete t[st]),a}var ee=Ao;var So=Object.prototype,Io=So.toString;function _o(t){return Io.call(t)}var re=_o;var Eo="[object Null]",Fo="[object Undefined]",oe=x?x.toStringTag:void 0;function Co(t){return t==null?t===void 0?Fo:Eo:oe&&oe in Object(t)?ee(t):re(t)}var w=Co;function No(t){return t!=null&&typeof t=="object"}var y=No;var Mo="[object Symbol]";function Ro(t){return typeof t=="symbol"||y(t)&&w(t)==Mo}var k=Ro;function Lo(t,e){for(var r=-1,o=t==null?0:t.length,a=Array(o);++r<o;)a[r]=e(t[r],r,t);return a}var ct=Lo;var Bo=Array.isArray,g=Bo;var ko=1/0,ae=x?x.prototype:void 0,ie=ae?ae.toString:void 0;function se(t){if(typeof t=="string")return t;if(g(t))return ct(t,se)+"";if(k(t))return ie?ie.call(t):"";var e=t+"";return e=="0"&&1/t==-ko?"-0":e}var ne=se;function Do(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var T=Do;function Uo(t){return t}var fe=Uo;var Go="[object AsyncFunction]",zo="[object Function]",Ko="[object GeneratorFunction]",Wo="[object Proxy]";function $o(t){if(!T(t))return!1;var e=w(t);return e==zo||e==Ko||e==Go||e==Wo}var ht=$o;var Ho=d["__core-js_shared__"],gt=Ho;var pe=function(){var t=/[^.]+$/.exec(gt&>.keys&>.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Vo(t){return!!pe&&pe in t}var le=Vo;var Yo=Function.prototype,qo=Yo.toString;function Zo(t){if(t!=null){try{return qo.call(t)}catch{}try{return t+""}catch{}}return""}var A=Zo;var Jo=/[\\^$.*+?()[\]{}|]/g,Xo=/^\[object .+?Constructor\]$/,Qo=Function.prototype,ta=Object.prototype,ea=Qo.toString,ra=ta.hasOwnProperty,oa=RegExp("^"+ea.call(ra).replace(Jo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function aa(t){if(!T(t)||le(t))return!1;var e=ht(t)?oa:Xo;return e.test(A(t))}var me=aa;function ia(t,e){return t?.[e]}var ue=ia;function sa(t,e){var r=ue(t,e);return me(r)?r:void 0}var b=sa;var na=b(d,"WeakMap"),xt=na;var de=Object.create,fa=function(){function t(){}return function(e){if(!T(e))return{};if(de)return de(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),ce=fa;function pa(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var he=pa;function la(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var ge=la;var ma=800,ua=16,da=Date.now;function ca(t){var e=0,r=0;return function(){var o=da(),a=ua-(o-r);if(r=o,a>0){if(++e>=ma)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var xe=ca;function ha(t){return function(){return t}}var ye=ha;var ga=function(){try{var t=b(Object,"defineProperty");return t({},"",{}),t}catch{}}(),D=ga;var xa=D?function(t,e){return D(t,"toString",{configurable:!0,enumerable:!1,value:ye(e),writable:!0})}:fe,be=xa;var ya=xe(be),ve=ya;function ba(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var we=ba;var va=9007199254740991,wa=/^(?:0|[1-9]\d*)$/;function Ta(t,e){var r=typeof t;return e=e??va,!!e&&(r=="number"||r!="symbol"&&wa.test(t))&&t>-1&&t%1==0&&t<e}var U=Ta;function Pa(t,e,r){e=="__proto__"&&D?D(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var yt=Pa;function ja(t,e){return t===e||t!==t&&e!==e}var bt=ja;var Oa=Object.prototype,Aa=Oa.hasOwnProperty;function Sa(t,e,r){var o=t[e];(!(Aa.call(t,e)&&bt(o,r))||r===void 0&&!(e in t))&&yt(t,e,r)}var G=Sa;function Ia(t,e,r,o){var a=!r;r||(r={});for(var i=-1,s=e.length;++i<s;){var n=e[i],u=o?o(r[n],t[n],n,r,t):void 0;u===void 0&&(u=t[n]),a?yt(r,n,u):G(r,n,u)}return r}var O=Ia;var Te=Math.max;function _a(t,e,r){return e=Te(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,i=Te(o.length-e,0),s=Array(i);++a<i;)s[a]=o[e+a];a=-1;for(var n=Array(e+1);++a<e;)n[a]=o[a];return n[e]=r(s),he(t,this,n)}}var Pe=_a;var Ea=9007199254740991;function Fa(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Ea}var z=Fa;function Ca(t){return t!=null&&z(t.length)&&!ht(t)}var vt=Ca;var Na=Object.prototype;function Ma(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Na;return t===r}var K=Ma;function Ra(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var je=Ra;var La="[object Arguments]";function Ba(t){return y(t)&&w(t)==La}var Bt=Ba;var Oe=Object.prototype,ka=Oe.hasOwnProperty,Da=Oe.propertyIsEnumerable,Ua=Bt(function(){return arguments}())?Bt:function(t){return y(t)&&ka.call(t,"callee")&&!Da.call(t,"callee")},W=Ua;function Ga(){return!1}var Ae=Ga;var _e=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Se=_e&&typeof module=="object"&&module&&!module.nodeType&&module,za=Se&&Se.exports===_e,Ie=za?d.Buffer:void 0,Ka=Ie?Ie.isBuffer:void 0,Wa=Ka||Ae,wt=Wa;var $a="[object Arguments]",Ha="[object Array]",Va="[object Boolean]",Ya="[object Date]",qa="[object Error]",Za="[object Function]",Ja="[object Map]",Xa="[object Number]",Qa="[object Object]",ti="[object RegExp]",ei="[object Set]",ri="[object String]",oi="[object WeakMap]",ai="[object ArrayBuffer]",ii="[object DataView]",si="[object Float32Array]",ni="[object Float64Array]",fi="[object Int8Array]",pi="[object Int16Array]",li="[object Int32Array]",mi="[object Uint8Array]",ui="[object Uint8ClampedArray]",di="[object Uint16Array]",ci="[object Uint32Array]",m={};m[si]=m[ni]=m[fi]=m[pi]=m[li]=m[mi]=m[ui]=m[di]=m[ci]=!0;m[$a]=m[Ha]=m[ai]=m[Va]=m[ii]=m[Ya]=m[qa]=m[Za]=m[Ja]=m[Xa]=m[Qa]=m[ti]=m[ei]=m[ri]=m[oi]=!1;function hi(t){return y(t)&&z(t.length)&&!!m[w(t)]}var Ee=hi;function gi(t){return function(e){return t(e)}}var $=gi;var Fe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,nt=Fe&&typeof module=="object"&&module&&!module.nodeType&&module,xi=nt&&nt.exports===Fe,kt=xi&&dt.process,yi=function(){try{var t=nt&&nt.require&&nt.require("util").types;return t||kt&&kt.binding&&kt.binding("util")}catch{}}(),S=yi;var Ce=S&&S.isTypedArray,bi=Ce?$(Ce):Ee,Ne=bi;var vi=Object.prototype,wi=vi.hasOwnProperty;function Ti(t,e){var r=g(t),o=!r&&W(t),a=!r&&!o&&wt(t),i=!r&&!o&&!a&&Ne(t),s=r||o||a||i,n=s?je(t.length,String):[],u=n.length;for(var c in t)(e||wi.call(t,c))&&!(s&&(c=="length"||a&&(c=="offset"||c=="parent")||i&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||U(c,u)))&&n.push(c);return n}var Tt=Ti;function Pi(t,e){return function(r){return t(e(r))}}var Pt=Pi;var ji=Pt(Object.keys,Object),Me=ji;var Oi=Object.prototype,Ai=Oi.hasOwnProperty;function Si(t){if(!K(t))return Me(t);var e=[];for(var r in Object(t))Ai.call(t,r)&&r!="constructor"&&e.push(r);return e}var Re=Si;function Ii(t){return vt(t)?Tt(t):Re(t)}var H=Ii;function _i(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Le=_i;var Ei=Object.prototype,Fi=Ei.hasOwnProperty;function Ci(t){if(!T(t))return Le(t);var e=K(t),r=[];for(var o in t)o=="constructor"&&(e||!Fi.call(t,o))||r.push(o);return r}var Be=Ci;function Ni(t){return vt(t)?Tt(t,!0):Be(t)}var V=Ni;var Mi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ri=/^\w*$/;function Li(t,e){if(g(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||k(t)?!0:Ri.test(t)||!Mi.test(t)||e!=null&&t in Object(e)}var ke=Li;var Bi=b(Object,"create"),I=Bi;function ki(){this.__data__=I?I(null):{},this.size=0}var De=ki;function Di(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Ue=Di;var Ui="__lodash_hash_undefined__",Gi=Object.prototype,zi=Gi.hasOwnProperty;function Ki(t){var e=this.__data__;if(I){var r=e[t];return r===Ui?void 0:r}return zi.call(e,t)?e[t]:void 0}var Ge=Ki;var Wi=Object.prototype,$i=Wi.hasOwnProperty;function Hi(t){var e=this.__data__;return I?e[t]!==void 0:$i.call(e,t)}var ze=Hi;var Vi="__lodash_hash_undefined__";function Yi(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=I&&e===void 0?Vi:e,this}var Ke=Yi;function Y(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Y.prototype.clear=De;Y.prototype.delete=Ue;Y.prototype.get=Ge;Y.prototype.has=ze;Y.prototype.set=Ke;var Dt=Y;function qi(){this.__data__=[],this.size=0}var We=qi;function Zi(t,e){for(var r=t.length;r--;)if(bt(t[r][0],e))return r;return-1}var E=Zi;var Ji=Array.prototype,Xi=Ji.splice;function Qi(t){var e=this.__data__,r=E(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Xi.call(e,r,1),--this.size,!0}var $e=Qi;function ts(t){var e=this.__data__,r=E(e,t);return r<0?void 0:e[r][1]}var He=ts;function es(t){return E(this.__data__,t)>-1}var Ve=es;function rs(t,e){var r=this.__data__,o=E(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Ye=rs;function q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}q.prototype.clear=We;q.prototype.delete=$e;q.prototype.get=He;q.prototype.has=Ve;q.prototype.set=Ye;var F=q;var os=b(d,"Map"),C=os;function as(){this.size=0,this.__data__={hash:new Dt,map:new(C||F),string:new Dt}}var qe=as;function is(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Ze=is;function ss(t,e){var r=t.__data__;return Ze(e)?r[typeof e=="string"?"string":"hash"]:r.map}var N=ss;function ns(t){var e=N(this,t).delete(t);return this.size-=e?1:0,e}var Je=ns;function fs(t){return N(this,t).get(t)}var Xe=fs;function ps(t){return N(this,t).has(t)}var Qe=ps;function ls(t,e){var r=N(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var tr=ls;function Z(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Z.prototype.clear=qe;Z.prototype.delete=Je;Z.prototype.get=Xe;Z.prototype.has=Qe;Z.prototype.set=tr;var ft=Z;var ms="Expected a function";function Ut(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(ms);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],i=r.cache;if(i.has(a))return i.get(a);var s=t.apply(this,o);return r.cache=i.set(a,s)||i,s};return r.cache=new(Ut.Cache||ft),r}Ut.Cache=ft;var er=Ut;var us=500;function ds(t){var e=er(t,function(o){return r.size===us&&r.clear(),o}),r=e.cache;return e}var rr=ds;var cs=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,hs=/\\(\\)?/g,gs=rr(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(cs,function(r,o,a,i){e.push(a?i.replace(hs,"$1"):o||r)}),e}),or=gs;function xs(t){return t==null?"":ne(t)}var ar=xs;function ys(t,e){return g(t)?t:ke(t,e)?[t]:or(ar(t))}var P=ys;var bs=1/0;function vs(t){if(typeof t=="string"||k(t))return t;var e=t+"";return e=="0"&&1/t==-bs?"-0":e}var M=vs;function ws(t,e){e=P(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[M(e[r++])];return r&&r==o?t:void 0}var jt=ws;function Ts(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var J=Ts;var ir=x?x.isConcatSpreadable:void 0;function Ps(t){return g(t)||W(t)||!!(ir&&t&&t[ir])}var sr=Ps;function nr(t,e,r,o,a){var i=-1,s=t.length;for(r||(r=sr),a||(a=[]);++i<s;){var n=t[i];e>0&&r(n)?e>1?nr(n,e-1,r,o,a):J(a,n):o||(a[a.length]=n)}return a}var fr=nr;function js(t){var e=t==null?0:t.length;return e?fr(t,1):[]}var pr=js;function Os(t){return ve(Pe(t,void 0,pr),t+"")}var Ot=Os;var As=Pt(Object.getPrototypeOf,Object),X=As;var Ss="[object Object]",Is=Function.prototype,_s=Object.prototype,lr=Is.toString,Es=_s.hasOwnProperty,Fs=lr.call(Object);function Cs(t){if(!y(t)||w(t)!=Ss)return!1;var e=X(t);if(e===null)return!0;var r=Es.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&lr.call(r)==Fs}var mr=Cs;function Ns(t,e,r){var o=-1,a=t.length;e<0&&(e=-e>a?0:a+e),r=r>a?a:r,r<0&&(r+=a),a=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(a);++o<a;)i[o]=t[o+e];return i}var ur=Ns;function Ms(){this.__data__=new F,this.size=0}var dr=Ms;function Rs(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var cr=Rs;function Ls(t){return this.__data__.get(t)}var hr=Ls;function Bs(t){return this.__data__.has(t)}var gr=Bs;var ks=200;function Ds(t,e){var r=this.__data__;if(r instanceof F){var o=r.__data__;if(!C||o.length<ks-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new ft(o)}return r.set(t,e),this.size=r.size,this}var xr=Ds;function Q(t){var e=this.__data__=new F(t);this.size=e.size}Q.prototype.clear=dr;Q.prototype.delete=cr;Q.prototype.get=hr;Q.prototype.has=gr;Q.prototype.set=xr;var yr=Q;function Us(t,e){return t&&O(e,H(e),t)}var br=Us;function Gs(t,e){return t&&O(e,V(e),t)}var vr=Gs;var jr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,wr=jr&&typeof module=="object"&&module&&!module.nodeType&&module,zs=wr&&wr.exports===jr,Tr=zs?d.Buffer:void 0,Pr=Tr?Tr.allocUnsafe:void 0;function Ks(t,e){if(e)return t.slice();var r=t.length,o=Pr?Pr(r):new t.constructor(r);return t.copy(o),o}var Or=Ks;function Ws(t,e){for(var r=-1,o=t==null?0:t.length,a=0,i=[];++r<o;){var s=t[r];e(s,r,t)&&(i[a++]=s)}return i}var Ar=Ws;function $s(){return[]}var At=$s;var Hs=Object.prototype,Vs=Hs.propertyIsEnumerable,Sr=Object.getOwnPropertySymbols,Ys=Sr?function(t){return t==null?[]:(t=Object(t),Ar(Sr(t),function(e){return Vs.call(t,e)}))}:At,tt=Ys;function qs(t,e){return O(t,tt(t),e)}var Ir=qs;var Zs=Object.getOwnPropertySymbols,Js=Zs?function(t){for(var e=[];t;)J(e,tt(t)),t=X(t);return e}:At,St=Js;function Xs(t,e){return O(t,St(t),e)}var _r=Xs;function Qs(t,e,r){var o=e(t);return g(t)?o:J(o,r(t))}var It=Qs;function tn(t){return It(t,H,tt)}var Er=tn;function en(t){return It(t,V,St)}var _t=en;var rn=b(d,"DataView"),Et=rn;var on=b(d,"Promise"),Ft=on;var an=b(d,"Set"),Ct=an;var Fr="[object Map]",sn="[object Object]",Cr="[object Promise]",Nr="[object Set]",Mr="[object WeakMap]",Rr="[object DataView]",nn=A(Et),fn=A(C),pn=A(Ft),ln=A(Ct),mn=A(xt),L=w;(Et&&L(new Et(new ArrayBuffer(1)))!=Rr||C&&L(new C)!=Fr||Ft&&L(Ft.resolve())!=Cr||Ct&&L(new Ct)!=Nr||xt&&L(new xt)!=Mr)&&(L=function(t){var e=w(t),r=e==sn?t.constructor:void 0,o=r?A(r):"";if(o)switch(o){case nn:return Rr;case fn:return Fr;case pn:return Cr;case ln:return Nr;case mn:return Mr}return e});var et=L;var un=Object.prototype,dn=un.hasOwnProperty;function cn(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&dn.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Lr=cn;var hn=d.Uint8Array,Gt=hn;function gn(t){var e=new t.constructor(t.byteLength);return new Gt(e).set(new Gt(t)),e}var rt=gn;function xn(t,e){var r=e?rt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Br=xn;var yn=/\w*$/;function bn(t){var e=new t.constructor(t.source,yn.exec(t));return e.lastIndex=t.lastIndex,e}var kr=bn;var Dr=x?x.prototype:void 0,Ur=Dr?Dr.valueOf:void 0;function vn(t){return Ur?Object(Ur.call(t)):{}}var Gr=vn;function wn(t,e){var r=e?rt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var zr=wn;var Tn="[object Boolean]",Pn="[object Date]",jn="[object Map]",On="[object Number]",An="[object RegExp]",Sn="[object Set]",In="[object String]",_n="[object Symbol]",En="[object ArrayBuffer]",Fn="[object DataView]",Cn="[object Float32Array]",Nn="[object Float64Array]",Mn="[object Int8Array]",Rn="[object Int16Array]",Ln="[object Int32Array]",Bn="[object Uint8Array]",kn="[object Uint8ClampedArray]",Dn="[object Uint16Array]",Un="[object Uint32Array]";function Gn(t,e,r){var o=t.constructor;switch(e){case En:return rt(t);case Tn:case Pn:return new o(+t);case Fn:return Br(t,r);case Cn:case Nn:case Mn:case Rn:case Ln:case Bn:case kn:case Dn:case Un:return zr(t,r);case jn:return new o;case On:case In:return new o(t);case An:return kr(t);case Sn:return new o;case _n:return Gr(t)}}var Kr=Gn;function zn(t){return typeof t.constructor=="function"&&!K(t)?ce(X(t)):{}}var Wr=zn;var Kn="[object Map]";function Wn(t){return y(t)&&et(t)==Kn}var $r=Wn;var Hr=S&&S.isMap,$n=Hr?$(Hr):$r,Vr=$n;var Hn="[object Set]";function Vn(t){return y(t)&&et(t)==Hn}var Yr=Vn;var qr=S&&S.isSet,Yn=qr?$(qr):Yr,Zr=Yn;var qn=1,Zn=2,Jn=4,Jr="[object Arguments]",Xn="[object Array]",Qn="[object Boolean]",tf="[object Date]",ef="[object Error]",Xr="[object Function]",rf="[object GeneratorFunction]",of="[object Map]",af="[object Number]",Qr="[object Object]",sf="[object RegExp]",nf="[object Set]",ff="[object String]",pf="[object Symbol]",lf="[object WeakMap]",mf="[object ArrayBuffer]",uf="[object DataView]",df="[object Float32Array]",cf="[object Float64Array]",hf="[object Int8Array]",gf="[object Int16Array]",xf="[object Int32Array]",yf="[object Uint8Array]",bf="[object Uint8ClampedArray]",vf="[object Uint16Array]",wf="[object Uint32Array]",l={};l[Jr]=l[Xn]=l[mf]=l[uf]=l[Qn]=l[tf]=l[df]=l[cf]=l[hf]=l[gf]=l[xf]=l[of]=l[af]=l[Qr]=l[sf]=l[nf]=l[ff]=l[pf]=l[yf]=l[bf]=l[vf]=l[wf]=!0;l[ef]=l[Xr]=l[lf]=!1;function Nt(t,e,r,o,a,i){var s,n=e&qn,u=e&Zn,c=e&Jn;if(r&&(s=a?r(t,o,a,i):r(t)),s!==void 0)return s;if(!T(t))return t;var h=g(t);if(h){if(s=Lr(t),!n)return ge(t,s)}else{var j=et(t),pt=j==Xr||j==rf;if(wt(t))return Or(t,n);if(j==Qr||j==Jr||pt&&!a){if(s=u||pt?{}:Wr(t),!n)return u?_r(t,vr(s,t)):Ir(t,br(s,t))}else{if(!l[j])return a?t:{};s=Kr(t,j,n)}}i||(i=new yr);var at=i.get(t);if(at)return at;i.set(t,s),Zr(t)?t.forEach(function(v){s.add(Nt(v,e,r,v,t,i))}):Vr(t)&&t.forEach(function(v,f){s.set(f,Nt(v,e,r,f,t,i))});var lt=c?u?_t:Er:u?V:H,mt=h?void 0:lt(t);return we(mt||t,function(v,f){mt&&(f=v,v=t[f]),G(s,f,Nt(v,e,r,f,t,i))}),s}var Mt=Nt;var Tf=1,Pf=4;function jf(t){return Mt(t,Tf|Pf)}var zt=jf;function Of(t,e){return t!=null&&e in Object(t)}var to=Of;function Af(t,e,r){e=P(e,t);for(var o=-1,a=e.length,i=!1;++o<a;){var s=M(e[o]);if(!(i=t!=null&&r(t,s)))break;t=t[s]}return i||++o!=a?i:(a=t==null?0:t.length,!!a&&z(a)&&U(s,a)&&(g(t)||W(t)))}var eo=Af;function Sf(t,e){return t!=null&&eo(t,e,to)}var ro=Sf;function If(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var oo=If;function _f(t,e){return e.length<2?t:jt(t,ur(e,0,-1))}var ao=_f;function Ef(t,e){return e=P(e,t),t=ao(t,e),t==null||delete t[M(oo(e))]}var io=Ef;function Ff(t){return mr(t)?void 0:t}var so=Ff;var Cf=1,Nf=2,Mf=4,Rf=Ot(function(t,e){var r={};if(t==null)return r;var o=!1;e=ct(e,function(i){return i=P(i,t),o||(o=i.length>1),i}),O(t,_t(t),r),o&&(r=Mt(r,Cf|Nf|Mf,so));for(var a=e.length;a--;)io(r,e[a]);return r}),Kt=Rf;function Lf(t,e,r,o){if(!T(t))return t;e=P(e,t);for(var a=-1,i=e.length,s=i-1,n=t;n!=null&&++a<i;){var u=M(e[a]),c=r;if(u==="__proto__"||u==="constructor"||u==="prototype")return t;if(a!=s){var h=n[u];c=o?o(h,u,n):void 0,c===void 0&&(c=T(h)?h:U(e[a+1])?[]:{})}G(n,u,c),n=n[u]}return t}var no=Lf;function Bf(t,e,r){for(var o=-1,a=e.length,i={};++o<a;){var s=e[o],n=jt(t,s);r(n,s)&&no(i,P(s,t),n)}return i}var fo=Bf;function kf(t,e){return fo(t,e,function(r,o){return ro(t,o)})}var po=kf;var Df=Ot(function(t,e){return t==null?{}:po(t,e)}),Rt=Df;function lo(t){return{all:t=t||new Map,on:function(e,r){var o=t.get(e);o?o.push(r):t.set(e,[r])},off:function(e,r){var o=t.get(e);o&&(r?o.splice(o.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var o=t.get(e);o&&o.slice().map(function(a){a(r)}),(o=t.get("*"))&&o.slice().map(function(a){a(e,r)})}}}var mo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Wt=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=mo[r[t]&63];return e};var Uf="array",Gf="bit",uo="bits",zf="byte",co="bytes",ot="",Kf="exponent",Wf="function",ho="iec",$f="Invalid number",Hf="Invalid rounding method",$t="jedec",Vf="object",go=".",Yf="round",qf="s",Zf="si",Jf="kbit",Xf="kB",Qf=" ",tp="string",ep="0",Ht={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function xo(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:i=ot,localeOptions:s={},separator:n=ot,spacer:u=Qf,symbols:c={},standard:h=ot,output:j=tp,fullform:pt=!1,fullforms:at=[],exponent:lt=-1,roundingMethod:mt=Yf,precision:v=0}={}){let f=lt,B=Number(t),p=[],R=0,Lt=ot;h===Zf?(o=10,h=$t):h===ho||h===$t?o=2:o===2?h=ho:(o=10,h=$t);let ut=o===10?1e3:1024,yo=pt===!0,Yt=B<0,qt=Math[mt];if(typeof t!="bigint"&&isNaN(t))throw new TypeError($f);if(typeof qt!==Wf)throw new TypeError(Hf);if(Yt&&(B=-B),(f===-1||isNaN(f))&&(f=Math.floor(Math.log(B)/Math.log(ut)),f<0&&(f=0)),f>8&&(v>0&&(v+=8-f),f=8),j===Kf)return f;if(B===0)p[0]=0,Lt=p[1]=Ht.symbol[h][e?uo:co][f];else{R=B/(o===2?Math.pow(2,f*10):Math.pow(1e3,f)),e&&(R=R*8,R>=ut&&f<8&&(R=R/ut,f++));let it=Math.pow(10,f>0?a:0);p[0]=qt(R*it)/it,p[0]===ut&&f<8&<===-1&&(p[0]=1,f++),Lt=p[1]=o===10&&f===1?e?Jf:Xf:Ht.symbol[h][e?uo:co][f]}if(Yt&&(p[0]=-p[0]),v>0&&(p[0]=p[0].toPrecision(v)),p[1]=c[p[1]]||p[1],i===!0?p[0]=p[0].toLocaleString():i.length>0?p[0]=p[0].toLocaleString(i,s):n.length>0&&(p[0]=p[0].toString().replace(go,n)),r&&a>0){let it=p[0].toString(),Zt=n||(it.match(/(\D)/g)||[]).pop()||go,Jt=it.toString().split(Zt),Xt=Jt[1]||ot,Qt=Xt.length,bo=a-Qt;p[0]=`${Jt[0]}${Zt}${Xt.padEnd(Qt+bo,ep)}`}return yo&&(p[1]=at[f]?at[f]:Ht.fullform[h][f]+(e?Gf:zf)+(p[0]===1?ot:qf)),j===Uf?p:j===Vf?{value:p[0],symbol:p[1],exponent:f,unit:Lt}:p.join(u)}var _=class t{constructor(e){this.meta={};if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,Kt(e,"encodeIdFunction")),e.encodeIdFunction&&typeof e.encodeIdFunction=="function"&&(this.id=e.encodeIdFunction(this.id));let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.created&&typeof this.created=="string"&&(this.created=new Date(this.created)),this.modified&&typeof this.modified=="string"&&(this.modified=new Date(this.modified)),this.accessed&&typeof this.accessed=="string"&&(this.accessed=new Date(this.accessed)),this.isFolder&&(this.files=this.files?.map(o=>{let a=o.path.split(/\//).slice(3).join("/"),i=this.url+"/"+o.name;return o.meta.reflib&&(i=i.replace(/\/project\/download\//,"/project/library/")),new t({tera:this._tera,...o,sbId:o.id,id:o.path,encodeIdFunction:e.encodeIdFunction,path:a,url:i})})),this.teraUrl=this.url.replace(/^https?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=xo(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(e){return this._tera.getProjectFileContents(this.id,e)}setContents(e){return this._tera.setProjectFileContents(this.id,e,{})}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Rt(this,["id","sbId","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){let r=Rt(e,["tera","id","sbId","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]);return new t(r)}};var Vt=class{constructor(e){this.settings={session:null,devMode:!1,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child(e){e.siteUrl=="https://tera-tools.com/embed"&&(e.siteUrl="https://dev.tera-tools.com/embed")}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"*",frameSandbox:["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation"],handshakeInterval:1e3,handshakeTimeout:1e4,debugPaths:null};this.events=lo();this.dom={el:null,iframe:null,popup:null,stylesheet:null};this.methods=["handshake","setServerVerbosity","getUser","requireUser","getCredentials","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getNamespace","setNamespace","listNamespaces","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateRefresh","getProjectFileContents","deleteProjectFile","setProjectFileContents","createProjectFolder","deleteProjectFolder","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiPanic","uiProgress","uiPrompt","uiThrow","uiSplat","uiWindow"];this.plugins=[];this.namespaces={};this.acceptPostboxes={};this.initPromise=null;e&&this.set(e)}send(e){let r=Wt();return this.acceptPostboxes[r]={},this.acceptPostboxes[r].promise=new Promise((o,a)=>{Object.assign(this.acceptPostboxes[r],{resolve:o,reject:a}),this.sendRaw({id:r,...e})}),this.acceptPostboxes[r].promise}sendRaw(e){let r;try{if(r={TERA:1,id:e.id||Wt(),...zt(e)},this.settings.mode=="parent")window.parent.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="child")this.dom.iframe.contentWindow.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="popup")this.dom.popup.postMessage(r,this.settings.restrictOrigin);else throw this.settings.mode=="detect"?new Error("Call init() or detectMode() before trying to send data to determine the mode"):new Error(`Unknown TERA communication mode "${this.settings.mode}"`)}catch(o){throw this.debug("ERROR",1,"Message compose client->server:",o),this.debug("ERROR",1,"Attempted to dispatch payload client->server",r),o}}rpc(e,...r){return this.send({action:"rpc",method:e,args:r})}acceptMessage(e){if(e.origin==window.location.origin)return Promise.resolve();let r=e.data;return!r.TERA||!r.id?Promise.resolve():(this.debug("INFO",3,"Recieved message",r),r?.action=="response"&&this.acceptPostboxes[r.id]?(r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response),Promise.resolve()):r?.action=="rpc"?Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})}):r?.action=="event"?Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o}):r?.id?(this.debug("INFO",3,`Ignoring message ID ${r.id} - was meant for someone else?`),Promise.resolve()):(this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r}),Promise.resolve()))}mountNamespace(e){if(!/^[\w-]+$/.test(e))throw new Error("Namespaces must be alphanumeric + hyphens + underscores");return this.namespaces[e]?Promise.resolve(this.namespaces[e]):Promise.resolve().then(()=>this._mountNamespace(e)).then(()=>this.namespaces[e]||Promise.reject(`teraFy.mountNamespace('${e}') resolved but no namespace has been mounted`))}_mountNamespace(e){throw console.warn("teraFy._mountNamespace() has not been overriden by a TERA-fy plugin, load one to add this functionality for your preferred framework"),new Error("teraFy._mountNamespace() is not supported")}unmountNamespace(e){return this.namespaces[e]?this._unmountNamespace(e):Promise.resolve()}_unmountNamespace(e){console.warn("teraFy.unbindNamespace() has not been overriden by a TERA-fy plugin, load one to add this functionality for your preferred framework")}init(e){if(e&&this.set(e),this.initPromise)return this.initPromise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.initPromise=Promise.resolve().then(()=>this.settings.session||="tfy-"+this.getEntropicString(16)).then(()=>this.debug("INFO",4,"[0/6] Init","Session",this.settings.session,"against",this.settings.siteUrl)).then(()=>{this.settings.devMode&&(this.settings.debugPaths?this.settings.debugPaths=this.settings.debugPaths.map(o=>Array.isArray(o)?o.join("."):typeof o=="string"?o:(()=>{throw new Error("Unknown path type - should be an array or string in dotted notation")})()):this.settings.debugPaths=null,this.debug("INFO",0,"Watching state paths",this.settings.debugPaths))}).then(()=>this.detectMode()).then(o=>{if(this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o,this.settings.modeOverrides[o])return this.debug("INFO",4,"[1/6] Applying specific config overrides for mode",o),this.settings.modeOverrides[o](this.settings)}).then(()=>this.debug("INFO",4,"[2/6] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>{if(this.settings.verbosity<=1){this.debug("INFO",4,"[3/6] Skip - Server verbosity is already at 1");return}else return this.debug("INFO",4,`[3/6] Set server verbosity to ${this.settings.verbosity}`),this.rpc("setServerVerbosity",this.settings.verbosity)}).then(()=>this.debug("INFO",4,`[4/6] Set server mode to "${this.settings.mode}"`)).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw`Unknown server mode "${this.settings.mode}"`})())).then(()=>this.debug("INFO",4,"[5/6] Run client plugins")).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings)))).then(()=>(this.debug("INFO",4,"[6/6] Init complete"),r)).catch(o=>{throw this.debug("WARN",0,"Init process fault",o),o}),this.initPromise}detectMode(){return this.settings.mode!="detect"?Promise.resolve(this.settings.mode):window.self===window.parent?Promise.resolve(this.settings.modeFallback):Promise.resolve().then(()=>this.settings.mode="parent").then(()=>new Promise((e,r)=>{let o=setTimeout(()=>r("TIMEOUT"),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e(void 0)).catch(r)})).then(()=>"parent").catch(()=>this.settings.modeFallback)}injectComms(){switch(this.settings.mode){case"child":return Promise.resolve().then(()=>new Promise(e=>{this.debug("INFO",2,"Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this.dom.el.classList.add("minimized"),document.body.append(this.dom.el),this.dom.el.addEventListener("click",()=>this.dom.el.classList.toggle("minimized")),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("INFO",3,"Embeded iframe ready"),e(void 0)}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe)})).then(()=>this.handshakeLoop());case"parent":return this.debug("INFO",2,"Using TERA window parent"),Promise.resolve();case"popup":return this.debug("INFO",2,"Injecting TERA site as a popup window"),this.dom.popup=window.open(this.settings.siteUrl,"_blank","popup=1, location=0, menubar=0, status=0, scrollbars=0, width=500, height=600"),this.handshakeLoop().then(()=>this.debug("INFO",3,"Popup window accepted handshake"));default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}}handshakeLoop(e){let r={handshakeInterval:this.settings.handshakeInterval,handshakeTimeout:this.settings.handshakeTimeout,...e};return new Promise((o,a)=>{let i=0,s,n=setTimeout(()=>{clearTimeout(s),a("TIMEOUT")},r.handshakeTimeout),u=()=>{this.debug("INFO",4,"Trying handshake",++i),clearTimeout(s),s=setTimeout(u,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(n),clearTimeout(s)}).then(()=>o(void 0)).catch(a)};u()})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","body:not(.tera-fy-focus) &.minimized.dev-mode {","background: var(--TERA-accent) !important;","opacity: 0.5;","right: 0px;","bottom: 0px;","width: 30px;","height: 30px;","transition: opacity 0.2s ease-out;","cursor: pointer;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","display: flex;","justify-content: center;","align-items: center;","&::before {","margin: 2px 0 0 0;",'content: "\u{1F300}";',"color: #FFF;","}","&:hover {","opacity: 1;","}","& > iframe {","display: none;","}","}","body:not(.tera-fy-focus) &:not(.minimized) {","&::before {","display: flex;","align-items: center;","justify-content: center;","cursor: pointer;","background: var(--TERA-accent) !important;","opacity: 0.5;","transition: opacity 0.2s ease-out;","position: absolute;","right: 0px;","bottom: 0px;","width: 20px;","height: 20px;","margin: 2px 0 0 0;",'content: "\u2B68";',"color: #FFF;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","}","&:hover::before {","opacity: 1;","}","}","&.dev-mode {","display: flex;","border: 5px solid var(--TERA-accent);","background: #FFF;","}","& > iframe {","width: 100%;","height: 100%;","}","}","body.tera-fy-focus {","overflow: hidden;","& #tera-fy {","display: flex !important;","position: fixed !important;","top: 0px !important;","width: 100vw !important;","height: 100vh !important;","left: 0px !important;","z-index: 10000 !important;","}","}"].join(`
|
|
1
|
+
var vo=typeof global=="object"&&global&&global.Object===Object&&global,dt=vo;var wo=typeof self=="object"&&self&&self.Object===Object&&self,To=dt||wo||Function("return this")(),d=To;var Po=d.Symbol,x=Po;var te=Object.prototype,jo=te.hasOwnProperty,Oo=te.toString,st=x?x.toStringTag:void 0;function Ao(t){var e=jo.call(t,st),r=t[st];try{t[st]=void 0;var o=!0}catch{}var a=Oo.call(t);return o&&(e?t[st]=r:delete t[st]),a}var ee=Ao;var So=Object.prototype,Io=So.toString;function _o(t){return Io.call(t)}var re=_o;var Eo="[object Null]",Fo="[object Undefined]",oe=x?x.toStringTag:void 0;function Co(t){return t==null?t===void 0?Fo:Eo:oe&&oe in Object(t)?ee(t):re(t)}var w=Co;function No(t){return t!=null&&typeof t=="object"}var y=No;var Mo="[object Symbol]";function Ro(t){return typeof t=="symbol"||y(t)&&w(t)==Mo}var k=Ro;function Lo(t,e){for(var r=-1,o=t==null?0:t.length,a=Array(o);++r<o;)a[r]=e(t[r],r,t);return a}var ct=Lo;var Bo=Array.isArray,g=Bo;var ko=1/0,ae=x?x.prototype:void 0,ie=ae?ae.toString:void 0;function se(t){if(typeof t=="string")return t;if(g(t))return ct(t,se)+"";if(k(t))return ie?ie.call(t):"";var e=t+"";return e=="0"&&1/t==-ko?"-0":e}var ne=se;function Do(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var T=Do;function Uo(t){return t}var fe=Uo;var Go="[object AsyncFunction]",zo="[object Function]",Ko="[object GeneratorFunction]",Wo="[object Proxy]";function $o(t){if(!T(t))return!1;var e=w(t);return e==zo||e==Ko||e==Go||e==Wo}var ht=$o;var Ho=d["__core-js_shared__"],gt=Ho;var pe=function(){var t=/[^.]+$/.exec(gt&>.keys&>.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Vo(t){return!!pe&&pe in t}var le=Vo;var Yo=Function.prototype,qo=Yo.toString;function Zo(t){if(t!=null){try{return qo.call(t)}catch{}try{return t+""}catch{}}return""}var A=Zo;var Jo=/[\\^$.*+?()[\]{}|]/g,Xo=/^\[object .+?Constructor\]$/,Qo=Function.prototype,ta=Object.prototype,ea=Qo.toString,ra=ta.hasOwnProperty,oa=RegExp("^"+ea.call(ra).replace(Jo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function aa(t){if(!T(t)||le(t))return!1;var e=ht(t)?oa:Xo;return e.test(A(t))}var me=aa;function ia(t,e){return t?.[e]}var ue=ia;function sa(t,e){var r=ue(t,e);return me(r)?r:void 0}var b=sa;var na=b(d,"WeakMap"),xt=na;var de=Object.create,fa=function(){function t(){}return function(e){if(!T(e))return{};if(de)return de(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),ce=fa;function pa(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var he=pa;function la(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var ge=la;var ma=800,ua=16,da=Date.now;function ca(t){var e=0,r=0;return function(){var o=da(),a=ua-(o-r);if(r=o,a>0){if(++e>=ma)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var xe=ca;function ha(t){return function(){return t}}var ye=ha;var ga=function(){try{var t=b(Object,"defineProperty");return t({},"",{}),t}catch{}}(),D=ga;var xa=D?function(t,e){return D(t,"toString",{configurable:!0,enumerable:!1,value:ye(e),writable:!0})}:fe,be=xa;var ya=xe(be),ve=ya;function ba(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var we=ba;var va=9007199254740991,wa=/^(?:0|[1-9]\d*)$/;function Ta(t,e){var r=typeof t;return e=e??va,!!e&&(r=="number"||r!="symbol"&&wa.test(t))&&t>-1&&t%1==0&&t<e}var U=Ta;function Pa(t,e,r){e=="__proto__"&&D?D(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var yt=Pa;function ja(t,e){return t===e||t!==t&&e!==e}var bt=ja;var Oa=Object.prototype,Aa=Oa.hasOwnProperty;function Sa(t,e,r){var o=t[e];(!(Aa.call(t,e)&&bt(o,r))||r===void 0&&!(e in t))&&yt(t,e,r)}var G=Sa;function Ia(t,e,r,o){var a=!r;r||(r={});for(var i=-1,s=e.length;++i<s;){var n=e[i],u=o?o(r[n],t[n],n,r,t):void 0;u===void 0&&(u=t[n]),a?yt(r,n,u):G(r,n,u)}return r}var O=Ia;var Te=Math.max;function _a(t,e,r){return e=Te(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,i=Te(o.length-e,0),s=Array(i);++a<i;)s[a]=o[e+a];a=-1;for(var n=Array(e+1);++a<e;)n[a]=o[a];return n[e]=r(s),he(t,this,n)}}var Pe=_a;var Ea=9007199254740991;function Fa(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Ea}var z=Fa;function Ca(t){return t!=null&&z(t.length)&&!ht(t)}var vt=Ca;var Na=Object.prototype;function Ma(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Na;return t===r}var K=Ma;function Ra(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var je=Ra;var La="[object Arguments]";function Ba(t){return y(t)&&w(t)==La}var Bt=Ba;var Oe=Object.prototype,ka=Oe.hasOwnProperty,Da=Oe.propertyIsEnumerable,Ua=Bt(function(){return arguments}())?Bt:function(t){return y(t)&&ka.call(t,"callee")&&!Da.call(t,"callee")},W=Ua;function Ga(){return!1}var Ae=Ga;var _e=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Se=_e&&typeof module=="object"&&module&&!module.nodeType&&module,za=Se&&Se.exports===_e,Ie=za?d.Buffer:void 0,Ka=Ie?Ie.isBuffer:void 0,Wa=Ka||Ae,wt=Wa;var $a="[object Arguments]",Ha="[object Array]",Va="[object Boolean]",Ya="[object Date]",qa="[object Error]",Za="[object Function]",Ja="[object Map]",Xa="[object Number]",Qa="[object Object]",ti="[object RegExp]",ei="[object Set]",ri="[object String]",oi="[object WeakMap]",ai="[object ArrayBuffer]",ii="[object DataView]",si="[object Float32Array]",ni="[object Float64Array]",fi="[object Int8Array]",pi="[object Int16Array]",li="[object Int32Array]",mi="[object Uint8Array]",ui="[object Uint8ClampedArray]",di="[object Uint16Array]",ci="[object Uint32Array]",m={};m[si]=m[ni]=m[fi]=m[pi]=m[li]=m[mi]=m[ui]=m[di]=m[ci]=!0;m[$a]=m[Ha]=m[ai]=m[Va]=m[ii]=m[Ya]=m[qa]=m[Za]=m[Ja]=m[Xa]=m[Qa]=m[ti]=m[ei]=m[ri]=m[oi]=!1;function hi(t){return y(t)&&z(t.length)&&!!m[w(t)]}var Ee=hi;function gi(t){return function(e){return t(e)}}var $=gi;var Fe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,nt=Fe&&typeof module=="object"&&module&&!module.nodeType&&module,xi=nt&&nt.exports===Fe,kt=xi&&dt.process,yi=function(){try{var t=nt&&nt.require&&nt.require("util").types;return t||kt&&kt.binding&&kt.binding("util")}catch{}}(),S=yi;var Ce=S&&S.isTypedArray,bi=Ce?$(Ce):Ee,Ne=bi;var vi=Object.prototype,wi=vi.hasOwnProperty;function Ti(t,e){var r=g(t),o=!r&&W(t),a=!r&&!o&&wt(t),i=!r&&!o&&!a&&Ne(t),s=r||o||a||i,n=s?je(t.length,String):[],u=n.length;for(var c in t)(e||wi.call(t,c))&&!(s&&(c=="length"||a&&(c=="offset"||c=="parent")||i&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||U(c,u)))&&n.push(c);return n}var Tt=Ti;function Pi(t,e){return function(r){return t(e(r))}}var Pt=Pi;var ji=Pt(Object.keys,Object),Me=ji;var Oi=Object.prototype,Ai=Oi.hasOwnProperty;function Si(t){if(!K(t))return Me(t);var e=[];for(var r in Object(t))Ai.call(t,r)&&r!="constructor"&&e.push(r);return e}var Re=Si;function Ii(t){return vt(t)?Tt(t):Re(t)}var H=Ii;function _i(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Le=_i;var Ei=Object.prototype,Fi=Ei.hasOwnProperty;function Ci(t){if(!T(t))return Le(t);var e=K(t),r=[];for(var o in t)o=="constructor"&&(e||!Fi.call(t,o))||r.push(o);return r}var Be=Ci;function Ni(t){return vt(t)?Tt(t,!0):Be(t)}var V=Ni;var Mi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ri=/^\w*$/;function Li(t,e){if(g(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||k(t)?!0:Ri.test(t)||!Mi.test(t)||e!=null&&t in Object(e)}var ke=Li;var Bi=b(Object,"create"),I=Bi;function ki(){this.__data__=I?I(null):{},this.size=0}var De=ki;function Di(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Ue=Di;var Ui="__lodash_hash_undefined__",Gi=Object.prototype,zi=Gi.hasOwnProperty;function Ki(t){var e=this.__data__;if(I){var r=e[t];return r===Ui?void 0:r}return zi.call(e,t)?e[t]:void 0}var Ge=Ki;var Wi=Object.prototype,$i=Wi.hasOwnProperty;function Hi(t){var e=this.__data__;return I?e[t]!==void 0:$i.call(e,t)}var ze=Hi;var Vi="__lodash_hash_undefined__";function Yi(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=I&&e===void 0?Vi:e,this}var Ke=Yi;function Y(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Y.prototype.clear=De;Y.prototype.delete=Ue;Y.prototype.get=Ge;Y.prototype.has=ze;Y.prototype.set=Ke;var Dt=Y;function qi(){this.__data__=[],this.size=0}var We=qi;function Zi(t,e){for(var r=t.length;r--;)if(bt(t[r][0],e))return r;return-1}var E=Zi;var Ji=Array.prototype,Xi=Ji.splice;function Qi(t){var e=this.__data__,r=E(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Xi.call(e,r,1),--this.size,!0}var $e=Qi;function ts(t){var e=this.__data__,r=E(e,t);return r<0?void 0:e[r][1]}var He=ts;function es(t){return E(this.__data__,t)>-1}var Ve=es;function rs(t,e){var r=this.__data__,o=E(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Ye=rs;function q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}q.prototype.clear=We;q.prototype.delete=$e;q.prototype.get=He;q.prototype.has=Ve;q.prototype.set=Ye;var F=q;var os=b(d,"Map"),C=os;function as(){this.size=0,this.__data__={hash:new Dt,map:new(C||F),string:new Dt}}var qe=as;function is(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Ze=is;function ss(t,e){var r=t.__data__;return Ze(e)?r[typeof e=="string"?"string":"hash"]:r.map}var N=ss;function ns(t){var e=N(this,t).delete(t);return this.size-=e?1:0,e}var Je=ns;function fs(t){return N(this,t).get(t)}var Xe=fs;function ps(t){return N(this,t).has(t)}var Qe=ps;function ls(t,e){var r=N(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var tr=ls;function Z(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Z.prototype.clear=qe;Z.prototype.delete=Je;Z.prototype.get=Xe;Z.prototype.has=Qe;Z.prototype.set=tr;var ft=Z;var ms="Expected a function";function Ut(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(ms);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],i=r.cache;if(i.has(a))return i.get(a);var s=t.apply(this,o);return r.cache=i.set(a,s)||i,s};return r.cache=new(Ut.Cache||ft),r}Ut.Cache=ft;var er=Ut;var us=500;function ds(t){var e=er(t,function(o){return r.size===us&&r.clear(),o}),r=e.cache;return e}var rr=ds;var cs=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,hs=/\\(\\)?/g,gs=rr(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(cs,function(r,o,a,i){e.push(a?i.replace(hs,"$1"):o||r)}),e}),or=gs;function xs(t){return t==null?"":ne(t)}var ar=xs;function ys(t,e){return g(t)?t:ke(t,e)?[t]:or(ar(t))}var P=ys;var bs=1/0;function vs(t){if(typeof t=="string"||k(t))return t;var e=t+"";return e=="0"&&1/t==-bs?"-0":e}var M=vs;function ws(t,e){e=P(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[M(e[r++])];return r&&r==o?t:void 0}var jt=ws;function Ts(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var J=Ts;var ir=x?x.isConcatSpreadable:void 0;function Ps(t){return g(t)||W(t)||!!(ir&&t&&t[ir])}var sr=Ps;function nr(t,e,r,o,a){var i=-1,s=t.length;for(r||(r=sr),a||(a=[]);++i<s;){var n=t[i];e>0&&r(n)?e>1?nr(n,e-1,r,o,a):J(a,n):o||(a[a.length]=n)}return a}var fr=nr;function js(t){var e=t==null?0:t.length;return e?fr(t,1):[]}var pr=js;function Os(t){return ve(Pe(t,void 0,pr),t+"")}var Ot=Os;var As=Pt(Object.getPrototypeOf,Object),X=As;var Ss="[object Object]",Is=Function.prototype,_s=Object.prototype,lr=Is.toString,Es=_s.hasOwnProperty,Fs=lr.call(Object);function Cs(t){if(!y(t)||w(t)!=Ss)return!1;var e=X(t);if(e===null)return!0;var r=Es.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&lr.call(r)==Fs}var mr=Cs;function Ns(t,e,r){var o=-1,a=t.length;e<0&&(e=-e>a?0:a+e),r=r>a?a:r,r<0&&(r+=a),a=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(a);++o<a;)i[o]=t[o+e];return i}var ur=Ns;function Ms(){this.__data__=new F,this.size=0}var dr=Ms;function Rs(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var cr=Rs;function Ls(t){return this.__data__.get(t)}var hr=Ls;function Bs(t){return this.__data__.has(t)}var gr=Bs;var ks=200;function Ds(t,e){var r=this.__data__;if(r instanceof F){var o=r.__data__;if(!C||o.length<ks-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new ft(o)}return r.set(t,e),this.size=r.size,this}var xr=Ds;function Q(t){var e=this.__data__=new F(t);this.size=e.size}Q.prototype.clear=dr;Q.prototype.delete=cr;Q.prototype.get=hr;Q.prototype.has=gr;Q.prototype.set=xr;var yr=Q;function Us(t,e){return t&&O(e,H(e),t)}var br=Us;function Gs(t,e){return t&&O(e,V(e),t)}var vr=Gs;var jr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,wr=jr&&typeof module=="object"&&module&&!module.nodeType&&module,zs=wr&&wr.exports===jr,Tr=zs?d.Buffer:void 0,Pr=Tr?Tr.allocUnsafe:void 0;function Ks(t,e){if(e)return t.slice();var r=t.length,o=Pr?Pr(r):new t.constructor(r);return t.copy(o),o}var Or=Ks;function Ws(t,e){for(var r=-1,o=t==null?0:t.length,a=0,i=[];++r<o;){var s=t[r];e(s,r,t)&&(i[a++]=s)}return i}var Ar=Ws;function $s(){return[]}var At=$s;var Hs=Object.prototype,Vs=Hs.propertyIsEnumerable,Sr=Object.getOwnPropertySymbols,Ys=Sr?function(t){return t==null?[]:(t=Object(t),Ar(Sr(t),function(e){return Vs.call(t,e)}))}:At,tt=Ys;function qs(t,e){return O(t,tt(t),e)}var Ir=qs;var Zs=Object.getOwnPropertySymbols,Js=Zs?function(t){for(var e=[];t;)J(e,tt(t)),t=X(t);return e}:At,St=Js;function Xs(t,e){return O(t,St(t),e)}var _r=Xs;function Qs(t,e,r){var o=e(t);return g(t)?o:J(o,r(t))}var It=Qs;function tn(t){return It(t,H,tt)}var Er=tn;function en(t){return It(t,V,St)}var _t=en;var rn=b(d,"DataView"),Et=rn;var on=b(d,"Promise"),Ft=on;var an=b(d,"Set"),Ct=an;var Fr="[object Map]",sn="[object Object]",Cr="[object Promise]",Nr="[object Set]",Mr="[object WeakMap]",Rr="[object DataView]",nn=A(Et),fn=A(C),pn=A(Ft),ln=A(Ct),mn=A(xt),L=w;(Et&&L(new Et(new ArrayBuffer(1)))!=Rr||C&&L(new C)!=Fr||Ft&&L(Ft.resolve())!=Cr||Ct&&L(new Ct)!=Nr||xt&&L(new xt)!=Mr)&&(L=function(t){var e=w(t),r=e==sn?t.constructor:void 0,o=r?A(r):"";if(o)switch(o){case nn:return Rr;case fn:return Fr;case pn:return Cr;case ln:return Nr;case mn:return Mr}return e});var et=L;var un=Object.prototype,dn=un.hasOwnProperty;function cn(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&dn.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Lr=cn;var hn=d.Uint8Array,Gt=hn;function gn(t){var e=new t.constructor(t.byteLength);return new Gt(e).set(new Gt(t)),e}var rt=gn;function xn(t,e){var r=e?rt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Br=xn;var yn=/\w*$/;function bn(t){var e=new t.constructor(t.source,yn.exec(t));return e.lastIndex=t.lastIndex,e}var kr=bn;var Dr=x?x.prototype:void 0,Ur=Dr?Dr.valueOf:void 0;function vn(t){return Ur?Object(Ur.call(t)):{}}var Gr=vn;function wn(t,e){var r=e?rt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var zr=wn;var Tn="[object Boolean]",Pn="[object Date]",jn="[object Map]",On="[object Number]",An="[object RegExp]",Sn="[object Set]",In="[object String]",_n="[object Symbol]",En="[object ArrayBuffer]",Fn="[object DataView]",Cn="[object Float32Array]",Nn="[object Float64Array]",Mn="[object Int8Array]",Rn="[object Int16Array]",Ln="[object Int32Array]",Bn="[object Uint8Array]",kn="[object Uint8ClampedArray]",Dn="[object Uint16Array]",Un="[object Uint32Array]";function Gn(t,e,r){var o=t.constructor;switch(e){case En:return rt(t);case Tn:case Pn:return new o(+t);case Fn:return Br(t,r);case Cn:case Nn:case Mn:case Rn:case Ln:case Bn:case kn:case Dn:case Un:return zr(t,r);case jn:return new o;case On:case In:return new o(t);case An:return kr(t);case Sn:return new o;case _n:return Gr(t)}}var Kr=Gn;function zn(t){return typeof t.constructor=="function"&&!K(t)?ce(X(t)):{}}var Wr=zn;var Kn="[object Map]";function Wn(t){return y(t)&&et(t)==Kn}var $r=Wn;var Hr=S&&S.isMap,$n=Hr?$(Hr):$r,Vr=$n;var Hn="[object Set]";function Vn(t){return y(t)&&et(t)==Hn}var Yr=Vn;var qr=S&&S.isSet,Yn=qr?$(qr):Yr,Zr=Yn;var qn=1,Zn=2,Jn=4,Jr="[object Arguments]",Xn="[object Array]",Qn="[object Boolean]",tf="[object Date]",ef="[object Error]",Xr="[object Function]",rf="[object GeneratorFunction]",of="[object Map]",af="[object Number]",Qr="[object Object]",sf="[object RegExp]",nf="[object Set]",ff="[object String]",pf="[object Symbol]",lf="[object WeakMap]",mf="[object ArrayBuffer]",uf="[object DataView]",df="[object Float32Array]",cf="[object Float64Array]",hf="[object Int8Array]",gf="[object Int16Array]",xf="[object Int32Array]",yf="[object Uint8Array]",bf="[object Uint8ClampedArray]",vf="[object Uint16Array]",wf="[object Uint32Array]",l={};l[Jr]=l[Xn]=l[mf]=l[uf]=l[Qn]=l[tf]=l[df]=l[cf]=l[hf]=l[gf]=l[xf]=l[of]=l[af]=l[Qr]=l[sf]=l[nf]=l[ff]=l[pf]=l[yf]=l[bf]=l[vf]=l[wf]=!0;l[ef]=l[Xr]=l[lf]=!1;function Nt(t,e,r,o,a,i){var s,n=e&qn,u=e&Zn,c=e&Jn;if(r&&(s=a?r(t,o,a,i):r(t)),s!==void 0)return s;if(!T(t))return t;var h=g(t);if(h){if(s=Lr(t),!n)return ge(t,s)}else{var j=et(t),pt=j==Xr||j==rf;if(wt(t))return Or(t,n);if(j==Qr||j==Jr||pt&&!a){if(s=u||pt?{}:Wr(t),!n)return u?_r(t,vr(s,t)):Ir(t,br(s,t))}else{if(!l[j])return a?t:{};s=Kr(t,j,n)}}i||(i=new yr);var at=i.get(t);if(at)return at;i.set(t,s),Zr(t)?t.forEach(function(v){s.add(Nt(v,e,r,v,t,i))}):Vr(t)&&t.forEach(function(v,f){s.set(f,Nt(v,e,r,f,t,i))});var lt=c?u?_t:Er:u?V:H,mt=h?void 0:lt(t);return we(mt||t,function(v,f){mt&&(f=v,v=t[f]),G(s,f,Nt(v,e,r,f,t,i))}),s}var Mt=Nt;var Tf=1,Pf=4;function jf(t){return Mt(t,Tf|Pf)}var zt=jf;function Of(t,e){return t!=null&&e in Object(t)}var to=Of;function Af(t,e,r){e=P(e,t);for(var o=-1,a=e.length,i=!1;++o<a;){var s=M(e[o]);if(!(i=t!=null&&r(t,s)))break;t=t[s]}return i||++o!=a?i:(a=t==null?0:t.length,!!a&&z(a)&&U(s,a)&&(g(t)||W(t)))}var eo=Af;function Sf(t,e){return t!=null&&eo(t,e,to)}var ro=Sf;function If(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var oo=If;function _f(t,e){return e.length<2?t:jt(t,ur(e,0,-1))}var ao=_f;function Ef(t,e){return e=P(e,t),t=ao(t,e),t==null||delete t[M(oo(e))]}var io=Ef;function Ff(t){return mr(t)?void 0:t}var so=Ff;var Cf=1,Nf=2,Mf=4,Rf=Ot(function(t,e){var r={};if(t==null)return r;var o=!1;e=ct(e,function(i){return i=P(i,t),o||(o=i.length>1),i}),O(t,_t(t),r),o&&(r=Mt(r,Cf|Nf|Mf,so));for(var a=e.length;a--;)io(r,e[a]);return r}),Kt=Rf;function Lf(t,e,r,o){if(!T(t))return t;e=P(e,t);for(var a=-1,i=e.length,s=i-1,n=t;n!=null&&++a<i;){var u=M(e[a]),c=r;if(u==="__proto__"||u==="constructor"||u==="prototype")return t;if(a!=s){var h=n[u];c=o?o(h,u,n):void 0,c===void 0&&(c=T(h)?h:U(e[a+1])?[]:{})}G(n,u,c),n=n[u]}return t}var no=Lf;function Bf(t,e,r){for(var o=-1,a=e.length,i={};++o<a;){var s=e[o],n=jt(t,s);r(n,s)&&no(i,P(s,t),n)}return i}var fo=Bf;function kf(t,e){return fo(t,e,function(r,o){return ro(t,o)})}var po=kf;var Df=Ot(function(t,e){return t==null?{}:po(t,e)}),Rt=Df;function lo(t){return{all:t=t||new Map,on:function(e,r){var o=t.get(e);o?o.push(r):t.set(e,[r])},off:function(e,r){var o=t.get(e);o&&(r?o.splice(o.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var o=t.get(e);o&&o.slice().map(function(a){a(r)}),(o=t.get("*"))&&o.slice().map(function(a){a(e,r)})}}}var mo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Wt=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=mo[r[t]&63];return e};var Uf="array",Gf="bit",uo="bits",zf="byte",co="bytes",ot="",Kf="exponent",Wf="function",ho="iec",$f="Invalid number",Hf="Invalid rounding method",$t="jedec",Vf="object",go=".",Yf="round",qf="s",Zf="si",Jf="kbit",Xf="kB",Qf=" ",tp="string",ep="0",Ht={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function xo(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:i=ot,localeOptions:s={},separator:n=ot,spacer:u=Qf,symbols:c={},standard:h=ot,output:j=tp,fullform:pt=!1,fullforms:at=[],exponent:lt=-1,roundingMethod:mt=Yf,precision:v=0}={}){let f=lt,B=Number(t),p=[],R=0,Lt=ot;h===Zf?(o=10,h=$t):h===ho||h===$t?o=2:o===2?h=ho:(o=10,h=$t);let ut=o===10?1e3:1024,yo=pt===!0,Yt=B<0,qt=Math[mt];if(typeof t!="bigint"&&isNaN(t))throw new TypeError($f);if(typeof qt!==Wf)throw new TypeError(Hf);if(Yt&&(B=-B),(f===-1||isNaN(f))&&(f=Math.floor(Math.log(B)/Math.log(ut)),f<0&&(f=0)),f>8&&(v>0&&(v+=8-f),f=8),j===Kf)return f;if(B===0)p[0]=0,Lt=p[1]=Ht.symbol[h][e?uo:co][f];else{R=B/(o===2?Math.pow(2,f*10):Math.pow(1e3,f)),e&&(R=R*8,R>=ut&&f<8&&(R=R/ut,f++));let it=Math.pow(10,f>0?a:0);p[0]=qt(R*it)/it,p[0]===ut&&f<8&<===-1&&(p[0]=1,f++),Lt=p[1]=o===10&&f===1?e?Jf:Xf:Ht.symbol[h][e?uo:co][f]}if(Yt&&(p[0]=-p[0]),v>0&&(p[0]=p[0].toPrecision(v)),p[1]=c[p[1]]||p[1],i===!0?p[0]=p[0].toLocaleString():i.length>0?p[0]=p[0].toLocaleString(i,s):n.length>0&&(p[0]=p[0].toString().replace(go,n)),r&&a>0){let it=p[0].toString(),Zt=n||(it.match(/(\D)/g)||[]).pop()||go,Jt=it.toString().split(Zt),Xt=Jt[1]||ot,Qt=Xt.length,bo=a-Qt;p[0]=`${Jt[0]}${Zt}${Xt.padEnd(Qt+bo,ep)}`}return yo&&(p[1]=at[f]?at[f]:Ht.fullform[h][f]+(e?Gf:zf)+(p[0]===1?ot:qf)),j===Uf?p:j===Vf?{value:p[0],symbol:p[1],exponent:f,unit:Lt}:p.join(u)}var _=class t{constructor(e){this.meta={};if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,Kt(e,"encodeIdFunction")),e.encodeIdFunction&&typeof e.encodeIdFunction=="function"&&(this.id=e.encodeIdFunction(this.id));let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.created&&typeof this.created=="string"&&(this.created=new Date(this.created)),this.modified&&typeof this.modified=="string"&&(this.modified=new Date(this.modified)),this.accessed&&typeof this.accessed=="string"&&(this.accessed=new Date(this.accessed)),this.isFolder&&(this.files=this.files?.map(o=>{let a=o.path.split(/\//).slice(3).join("/"),i=this.url+"/"+o.name;return o.meta.reflib&&(i=i.replace(/\/project\/download\//,"/project/library/")),new t({tera:this._tera,...o,sbId:o.id,id:o.path,encodeIdFunction:e.encodeIdFunction,path:a,url:i})})),this.teraUrl=this.url.replace(/^https?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=xo(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(e){return this._tera.getProjectFileContents(this.id,e)}setContents(e){return this._tera.setProjectFileContents(this.id,e,{})}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Rt(this,["id","sbId","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){let r=Rt(e,["tera","id","sbId","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]);return new t(r)}};var Vt=class{constructor(e){this.settings={session:null,devMode:!1,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child(e){e.siteUrl=="https://tera-tools.com/embed"&&(e.siteUrl="https://dev.tera-tools.com/embed")}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"*",frameSandbox:["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation"],handshakeInterval:1e3,handshakeTimeout:1e4,debugPaths:null};this.events=lo();this.dom={el:null,iframe:null,popup:null,stylesheet:null};this.methods=["handshake","setServerVerbosity","getUser","requireUser","getCredentials","getKindeToken","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getNamespace","setNamespace","listNamespaces","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateRefresh","getProjectFileContents","deleteProjectFile","setProjectFileContents","createProjectFolder","deleteProjectFolder","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiPanic","uiProgress","uiPrompt","uiThrow","uiSplat","uiWindow"];this.plugins=[];this.namespaces={};this.acceptPostboxes={};this.initPromise=null;e&&this.set(e)}send(e){let r=Wt();return this.acceptPostboxes[r]={},this.acceptPostboxes[r].promise=new Promise((o,a)=>{Object.assign(this.acceptPostboxes[r],{resolve:o,reject:a}),this.sendRaw({id:r,...e})}),this.acceptPostboxes[r].promise}sendRaw(e){let r;try{if(r={TERA:1,id:e.id||Wt(),...zt(e)},this.settings.mode=="parent")window.parent.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="child")this.dom.iframe.contentWindow.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="popup")this.dom.popup.postMessage(r,this.settings.restrictOrigin);else throw this.settings.mode=="detect"?new Error("Call init() or detectMode() before trying to send data to determine the mode"):new Error(`Unknown TERA communication mode "${this.settings.mode}"`)}catch(o){throw this.debug("ERROR",1,"Message compose client->server:",o),this.debug("ERROR",1,"Attempted to dispatch payload client->server",r),o}}rpc(e,...r){return this.send({action:"rpc",method:e,args:r})}acceptMessage(e){if(e.origin==window.location.origin)return Promise.resolve();let r=e.data;return!r.TERA||!r.id?Promise.resolve():(this.debug("INFO",3,"Recieved message",r),r?.action=="response"&&this.acceptPostboxes[r.id]?(r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response),Promise.resolve()):r?.action=="rpc"?Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})}):r?.action=="event"?Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o}):r?.id?(this.debug("INFO",3,`Ignoring message ID ${r.id} - was meant for someone else?`),Promise.resolve()):(this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r}),Promise.resolve()))}mountNamespace(e){if(!/^[\w-]+$/.test(e))throw new Error("Namespaces must be alphanumeric + hyphens + underscores");return this.namespaces[e]?Promise.resolve(this.namespaces[e]):Promise.resolve().then(()=>this._mountNamespace(e)).then(()=>this.namespaces[e]||Promise.reject(`teraFy.mountNamespace('${e}') resolved but no namespace has been mounted`))}_mountNamespace(e){throw console.warn("teraFy._mountNamespace() has not been overriden by a TERA-fy plugin, load one to add this functionality for your preferred framework"),new Error("teraFy._mountNamespace() is not supported")}unmountNamespace(e){return this.namespaces[e]?this._unmountNamespace(e):Promise.resolve()}_unmountNamespace(e){console.warn("teraFy.unbindNamespace() has not been overriden by a TERA-fy plugin, load one to add this functionality for your preferred framework")}init(e){if(e&&this.set(e),this.initPromise)return this.initPromise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.initPromise=Promise.resolve().then(()=>this.settings.session||="tfy-"+this.getEntropicString(16)).then(()=>this.debug("INFO",4,"[0/6] Init","Session",this.settings.session,"against",this.settings.siteUrl)).then(()=>{this.settings.devMode&&(this.settings.debugPaths?this.settings.debugPaths=this.settings.debugPaths.map(o=>Array.isArray(o)?o.join("."):typeof o=="string"?o:(()=>{throw new Error("Unknown path type - should be an array or string in dotted notation")})()):this.settings.debugPaths=null,this.debug("INFO",0,"Watching state paths",this.settings.debugPaths))}).then(()=>this.detectMode()).then(o=>{if(this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o,this.settings.modeOverrides[o])return this.debug("INFO",4,"[1/6] Applying specific config overrides for mode",o),this.settings.modeOverrides[o](this.settings)}).then(()=>this.debug("INFO",4,"[2/6] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>{if(this.settings.verbosity<=1){this.debug("INFO",4,"[3/6] Skip - Server verbosity is already at 1");return}else return this.debug("INFO",4,`[3/6] Set server verbosity to ${this.settings.verbosity}`),this.rpc("setServerVerbosity",this.settings.verbosity)}).then(()=>this.debug("INFO",4,`[4/6] Set server mode to "${this.settings.mode}"`)).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw`Unknown server mode "${this.settings.mode}"`})())).then(()=>this.debug("INFO",4,"[5/6] Run client plugins")).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings)))).then(()=>(this.debug("INFO",4,"[6/6] Init complete"),r)).catch(o=>{throw this.debug("WARN",0,"Init process fault",o),o}),this.initPromise}detectMode(){return this.settings.mode!="detect"?Promise.resolve(this.settings.mode):window.self===window.parent?Promise.resolve(this.settings.modeFallback):Promise.resolve().then(()=>this.settings.mode="parent").then(()=>new Promise((e,r)=>{let o=setTimeout(()=>r("TIMEOUT"),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e()).catch(r)})).then(()=>"parent").catch(()=>this.settings.modeFallback)}injectComms(){switch(this.settings.mode){case"child":return Promise.resolve().then(()=>new Promise(e=>{this.debug("INFO",2,"Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this.dom.el.classList.add("minimized"),document.body.append(this.dom.el),this.dom.el.addEventListener("click",()=>this.dom.el.classList.toggle("minimized")),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("INFO",3,"Embeded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe)})).then(()=>this.handshakeLoop());case"parent":return this.debug("INFO",2,"Using TERA window parent"),Promise.resolve();case"popup":return this.debug("INFO",2,"Injecting TERA site as a popup window"),this.dom.popup=window.open(this.settings.siteUrl,"_blank","popup=1, location=0, menubar=0, status=0, scrollbars=0, width=500, height=600"),this.handshakeLoop().then(()=>this.debug("INFO",3,"Popup window accepted handshake"));default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}}handshakeLoop(e){let r={handshakeInterval:this.settings.handshakeInterval,handshakeTimeout:this.settings.handshakeTimeout,...e};return new Promise((o,a)=>{let i=0,s,n=setTimeout(()=>{clearTimeout(s),a("TIMEOUT")},r.handshakeTimeout),u=()=>{this.debug("INFO",4,"Trying handshake",++i),clearTimeout(s),s=setTimeout(u,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(n),clearTimeout(s)}).then(()=>o()).catch(a)};u()})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","body:not(.tera-fy-focus) &.minimized.dev-mode {","background: var(--TERA-accent) !important;","opacity: 0.5;","right: 0px;","bottom: 0px;","width: 30px;","height: 30px;","transition: opacity 0.2s ease-out;","cursor: pointer;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","display: flex;","justify-content: center;","align-items: center;","&::before {","margin: 2px 0 0 0;",'content: "\u{1F300}";',"color: #FFF;","}","&:hover {","opacity: 1;","}","& > iframe {","display: none;","}","}","body:not(.tera-fy-focus) &:not(.minimized) {","&::before {","display: flex;","align-items: center;","justify-content: center;","cursor: pointer;","background: var(--TERA-accent) !important;","opacity: 0.5;","transition: opacity 0.2s ease-out;","position: absolute;","right: 0px;","bottom: 0px;","width: 20px;","height: 20px;","margin: 2px 0 0 0;",'content: "\u2B68";',"color: #FFF;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","}","&:hover::before {","opacity: 1;","}","}","&.dev-mode {","display: flex;","border: 5px solid var(--TERA-accent);","background: #FFF;","}","& > iframe {","width: 100%;","height: 100%;","}","}","body.tera-fy-focus {","overflow: hidden;","& #tera-fy {","display: flex !important;","position: fixed !important;","top: 0px !important;","width: 100vw !important;","height: 100vh !important;","left: 0px !important;","z-index: 10000 !important;","}","}"].join(`
|
|
2
2
|
`),document.head.appendChild(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){this.methods.forEach(e=>this[e]=this.rpc.bind(this,e))}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r,o){let a={ignoreNullish:!0,...o};return typeof e=="string"?(!a.ignoreNullish||r!=null)&&(this.settings[e]=r):Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r,o){return!this.settings.devMode||r===void 0?this:this.set(e,r,o)}use(e,r){let o=typeof e=="function"?new e(this,r):typeof e=="object"?e:typeof e=="string"?(()=>{throw new Error("use(String) is not yet supported")})():(()=>{throw new Error("Expected use() call to be provided with a class initalizer")})();return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){let o=[],a=r;do o.unshift(a);while(a=Object.getPrototypeOf(a));o.forEach(i=>Object.getOwnPropertyNames(i).filter(s=>!["constructor","init","prototype","name"].includes(s)&&!s.startsWith("__")).forEach(s=>{typeof r[s]=="function"?Object.defineProperty(e,s,{enumerable:!1,value:r[s].bind(e)}):e[s]=r[s]}))}toggleDevMode(e="toggle"){return e==="toggle"?this.settings.devMode=!this.settings.devMode:e==="proxy"?Object.assign(this.settings,{devMode:!0,siteUrl:"http://localhost:7334/embed",mode:"child"}):this.settings.devMode=!!e,this.settings.devMode&&(this.settings.restrictOrigin="*"),this.dom?.el&&this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this}toggleFocus(e="toggle"){this.debug("INFO",2,"Request focus",{isFocused:e}),globalThis.document.body.classList.toggle("tera-fy-focus",e==="toggle"?void 0:e)}getEntropicString(e=32){let r=new Uint32Array(4);return window.crypto.getRandomValues(r),btoa(String.fromCharCode(...new Uint8Array(r.buffer))).replace(/[+/]/g,"").slice(0,e)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new _({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new _({tera:this,...o})))}getProjectFile(e,r){return this.rpc("getProjectFile",e,r).then(o=>o&&new _({tera:this,...o}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new _({tera:this,...r}))}moveProjectFile(e,r,o){return this.rpc("moveProjectFile",e,r,o).then(a=>a?new _({tera:this,...a}):null)}};export{Vt as default};
|
|
3
3
|
/*! Bundled license information:
|
|
4
4
|
|
package/eslint.config.js
CHANGED
|
@@ -41,10 +41,15 @@ export default tseslint.config(
|
|
|
41
41
|
},
|
|
42
42
|
},
|
|
43
43
|
rules: {
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
//
|
|
47
|
-
|
|
44
|
+
// Not needed with TS
|
|
45
|
+
'jsdoc/require-returns-type': 'off',
|
|
46
|
+
// Loosen rules until proper TS annotation
|
|
47
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
48
|
+
'@typescript-eslint/no-unsafe-return': 'warn',
|
|
49
|
+
'@typescript-eslint/no-unsafe-call': 'warn',
|
|
50
|
+
'@typescript-eslint/no-unsafe-assignment': 'warn',
|
|
51
|
+
'@typescript-eslint/no-unsafe-argument': 'warn',
|
|
52
|
+
'@typescript-eslint/no-unsafe-member-access': 'warn',
|
|
48
53
|
...JSCommon,
|
|
49
54
|
},
|
|
50
55
|
},
|
|
@@ -53,7 +58,26 @@ export default tseslint.config(
|
|
|
53
58
|
// If you only want this for JS, you could add `files: ['**/*.js']` here.
|
|
54
59
|
{
|
|
55
60
|
rules: {
|
|
56
|
-
'unicorn/prefer-global-this': 'off',
|
|
61
|
+
'unicorn/prefer-global-this': 'off',
|
|
57
62
|
},
|
|
58
63
|
},
|
|
64
|
+
|
|
65
|
+
// MC overrides so the TypeScript linter can STFU
|
|
66
|
+
...(['rhino', 'slab', 'snow'].includes(process.env.NODE_ENV) ? [{
|
|
67
|
+
rules: {
|
|
68
|
+
'no-undef': 'warn',
|
|
69
|
+
'no-unused-vars': 'off', // Dupe of '@typescript-eslint/no-unused-vars'
|
|
70
|
+
'prefer-const': 'off',
|
|
71
|
+
'@typescript-eslint/ban-ts-comment': 'off', // Allow `// @ts-ignore`
|
|
72
|
+
'@typescript-eslint/no-explicit-any': 'off', // Stop complaining about `:any` definitions
|
|
73
|
+
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
74
|
+
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
75
|
+
'@typescript-eslint/no-unsafe-call': 'off',
|
|
76
|
+
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
77
|
+
'@typescript-eslint/no-unsafe-return': 'off',
|
|
78
|
+
'@typescript-eslint/no-unused-vars': 'warn',
|
|
79
|
+
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
|
|
80
|
+
'unicorn/numeric-separators-style': 'warn',
|
|
81
|
+
},
|
|
82
|
+
}] : []),
|
|
59
83
|
);
|
package/lib/syncro/entities.ts
CHANGED
|
@@ -13,6 +13,10 @@ interface ProjectRow {
|
|
|
13
13
|
// TODO: Define other columns in project table
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
interface InstituteRow {
|
|
17
|
+
data: any;
|
|
18
|
+
}
|
|
19
|
+
|
|
16
20
|
interface UserRow {
|
|
17
21
|
id: string;
|
|
18
22
|
data: {
|
|
@@ -61,10 +65,29 @@ type SyncroConfig = Record<string, SyncroEntityConfig>;
|
|
|
61
65
|
* @type {Object} An object lookup of entities
|
|
62
66
|
*
|
|
63
67
|
* @property {String} singular The singular noun for the item
|
|
64
|
-
* @property {Function} initState Function called to initialize state when Firestore has no existing document. Called as `({supabase:BoundSupabaseyFunction, entity:String, id:String, relation?:string})` and expected to return the initial data object state
|
|
68
|
+
* @property {Function} initState Function called to initialize state when Firestore has no existing document. Called as `({supabase:BoundSupabaseyFunction, db:BoundHyperdriveInstance, entity:String, id:String, relation?:string})` and expected to return the initial data object state
|
|
65
69
|
* @property {Function} flushState Function called to flush state from Firebase to Supabase. Called the same as `initState` + `{state:Object}`
|
|
66
70
|
*/
|
|
67
71
|
const syncroConfig: SyncroConfig = {
|
|
72
|
+
institutes: { // {{{
|
|
73
|
+
singular: 'institute',
|
|
74
|
+
async initState({supabasey, id}: {supabasey: BoundSupabaseyFunction, id: string}) {
|
|
75
|
+
let institute = await supabasey((supabase) => supabase
|
|
76
|
+
.from('institutes')
|
|
77
|
+
.select('data')
|
|
78
|
+
.eq('id', id)
|
|
79
|
+
.maybeSingle<InstituteRow>()
|
|
80
|
+
);
|
|
81
|
+
if (institute) return institute.data; // institute is valid and already exists
|
|
82
|
+
},
|
|
83
|
+
flushState({supabasey, state, fsId}) {
|
|
84
|
+
return supabasey(supabase => supabase.rpc('syncro_merge_data', {
|
|
85
|
+
table_name: 'institutes',
|
|
86
|
+
entity_id: fsId,
|
|
87
|
+
new_data: state,
|
|
88
|
+
}));
|
|
89
|
+
},
|
|
90
|
+
}, // }}}
|
|
68
91
|
projects: { // {{{
|
|
69
92
|
singular: 'project',
|
|
70
93
|
async initState({supabasey, id}) {
|
|
@@ -285,4 +308,4 @@ const syncroConfig: SyncroConfig = {
|
|
|
285
308
|
}, // }}}
|
|
286
309
|
};
|
|
287
310
|
|
|
288
|
-
export default syncroConfig;
|
|
311
|
+
export default syncroConfig;
|
package/lib/syncro/keyed.ts
CHANGED
|
@@ -249,6 +249,7 @@ export default class SyncroKeyed extends Syncro {
|
|
|
249
249
|
await this.keyedMembersExpand(); // Call without index to append
|
|
250
250
|
|
|
251
251
|
// Get the newly added member
|
|
252
|
+
// @ts-ignore
|
|
252
253
|
let newMember = this.members.at(-1);
|
|
253
254
|
if (!newMember || !newMember.value) {
|
|
254
255
|
throw new Error('Failed to expand members or new member has no value object');
|
package/lib/syncro/syncro.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
isEmpty,
|
|
3
5
|
cloneDeep,
|
|
@@ -311,12 +313,7 @@ export default class Syncro {
|
|
|
311
313
|
*/
|
|
312
314
|
static toFirestore(snapshot: any = {}): any {
|
|
313
315
|
return marshal.serialize(snapshot, {
|
|
314
|
-
|
|
315
|
-
clone: true, // Clone away from the original Vue Reactive so we dont mangle it while traversing
|
|
316
|
-
modules: [
|
|
317
|
-
marshalFlattenArrays,
|
|
318
|
-
...marshal.settings.modules,
|
|
319
|
-
],
|
|
316
|
+
...marshalBaseConfig,
|
|
320
317
|
stringify: false,
|
|
321
318
|
});
|
|
322
319
|
}
|
|
@@ -331,12 +328,7 @@ export default class Syncro {
|
|
|
331
328
|
*/
|
|
332
329
|
static fromFirestore(snapshot: any = {}): any {
|
|
333
330
|
return marshal.deserialize(snapshot, {
|
|
334
|
-
|
|
335
|
-
clone: true, // Clone away from original so we don't trigger a loop within Firebase
|
|
336
|
-
modules: [
|
|
337
|
-
marshalFlattenArrays,
|
|
338
|
-
...marshal.settings.modules,
|
|
339
|
-
],
|
|
331
|
+
...marshalBaseConfig,
|
|
340
332
|
destringify: false,
|
|
341
333
|
});
|
|
342
334
|
}
|
|
@@ -824,21 +816,40 @@ export function randomBranch(depth: number = 0): any {
|
|
|
824
816
|
|
|
825
817
|
|
|
826
818
|
/**
|
|
827
|
-
* NPM:@momsfriendlydevco/marshal
|
|
828
|
-
*
|
|
819
|
+
* Syncro specific version of the base NPM:@momsfriendlydevco/marshal config
|
|
820
|
+
* Designed to be used when calling marshal.serialize() + marshal.deserialize()
|
|
829
821
|
*/
|
|
830
|
-
const
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
822
|
+
const marshalBaseConfig = {
|
|
823
|
+
circular: false,
|
|
824
|
+
clone: true, // Clone away from original so we don't trigger a loop within Firebase
|
|
825
|
+
modules: [
|
|
826
|
+
{ // Flatten arrays into something Firebase can handle
|
|
827
|
+
id: `~array`,
|
|
828
|
+
recursive: true,
|
|
829
|
+
test: v => Array.isArray(v),
|
|
830
|
+
serialize: v => ({_: '~array', ...v}),
|
|
831
|
+
deserialize: v => {
|
|
832
|
+
let arr = Array.from({length: Object.keys(v).length - 1});
|
|
833
|
+
|
|
834
|
+
Object.entries(v)
|
|
835
|
+
.filter(([k]) => k !== '_')
|
|
836
|
+
.forEach(([k, val]) => arr[+k] = val); // Changed v to val to avoid shadowing
|
|
837
|
+
|
|
838
|
+
return arr;
|
|
839
|
+
},
|
|
840
|
+
},
|
|
841
|
+
{ // Strip Functions during {,de-}serialization
|
|
842
|
+
id: '~function',
|
|
843
|
+
test: v => typeof v == 'function',
|
|
844
|
+
serialize: (v, path) => {
|
|
845
|
+
console.warn('Marshal Warning: Stripping function from path', path.join('.'));
|
|
846
|
+
throw new Error('Function serializing is forbidden');
|
|
847
|
+
},
|
|
848
|
+
deserialize: (v, path) => {
|
|
849
|
+
console.warn('Marshal Warning: Stripping function from path', path.join('.'));
|
|
850
|
+
},
|
|
851
|
+
},
|
|
852
|
+
...marshal.settings.modules // Use default Marshal modules excepting...
|
|
853
|
+
.filter(mod => mod.id != '~function') // Remove the Marshal function module as this upsets Cloudflare workers by using the `eval` built-in
|
|
854
|
+
],
|
|
844
855
|
};
|