@iebh/tera-fy 1.11.3 → 1.11.4
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 +10 -0
- package/dist/terafy.es2019.js +2 -2
- package/dist/terafy.js +2 -2
- package/lib/terafy.client.js +75 -1
- package/package.json +1 -1
- package/plugins/vue3.js +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.11.4](https://github.com/IEBH/TERA-fy/compare/v1.11.0...v1.11.4) (2024-07-02)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* Attempting to apply defaults to a path that doesnt exist resulted in a dangling-pointer ([b98aec8](https://github.com/IEBH/TERA-fy/commit/b98aec8f91d0f14899184d05fe7248d35e2b631b))
|
|
9
|
+
* Typo ([cfbdc08](https://github.com/IEBH/TERA-fy/commit/cfbdc087267626d4ef70f0d976c9b4338d732d23))
|
|
10
|
+
* **vite:** Dont boot the proxy system when in build mode ([c6af764](https://github.com/IEBH/TERA-fy/commit/c6af7640db9d9bba587f60ee57508d8ea848a28d))
|
|
11
|
+
* **Vue3:** Fix for Vue@3 watchers not providing the old state when constructing patches ([d702d4e](https://github.com/IEBH/TERA-fy/commit/d702d4e44ea82f8a40a6c645b91b4f6ceca13264))
|
|
12
|
+
|
|
3
13
|
# [1.11.0](https://github.com/IEBH/TERA-fy/compare/v1.10.0...v1.11.0) (2024-06-25)
|
|
4
14
|
|
|
5
15
|
|
package/dist/terafy.es2019.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var co=Object.defineProperty;var ho=(t,e,r)=>e in t?co(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var d=(t,e,r)=>(ho(t,typeof e!="symbol"?e+"":e,r),r);function Vt(t,e,r){if(!t||typeof t!="object"||!e||typeof e!="object")throw new Error("both arguments must be objects or arrays");r||(r=function(i){return i});function o({obj1:i,obj2:f,basePath:m,basePathForRemoves:x,diffs:v}){var j=Object.keys(i),O=j.length,y=Object.keys(f),_=y.length,b,p=i.length-f.length;if(go(i,f)){for(var u=0;u<O;u++){var l=Array.isArray(i)?Number(j[u]):j[u];l in f||(b=x.concat(l),v.remove.push({op:"remove",path:r(b)}))}for(var u=0;u<_;u++){var l=Array.isArray(f)?Number(y[u]):y[u];s({key:l,obj1:i,obj2:f,path:m.concat(l),pathForRemoves:m.concat(l),diffs:v})}}else{for(var u=0;u<p;u++)b=x.concat(u),v.remove.push({op:"remove",path:r(b)});for(var E=i.slice(p),u=0;u<_;u++)s({key:u,obj1:E,obj2:f,path:m.concat(u),pathForRemoves:m.concat(u+p),diffs:v})}}var a={remove:[],replace:[],add:[]};return o({obj1:t,obj2:e,basePath:[],basePathForRemoves:[],diffs:a}),a.remove.reverse().concat(a.replace).concat(a.add);function s({key:i,obj1:f,obj2:m,path:x,pathForRemoves:v,diffs:j}){var O=f[i],y=m[i];if(!(i in f)&&i in m){var _=y;j.add.push({op:"add",path:r(x),value:_})}else O!==y&&(Object(O)!==O||Object(y)!==y||xo(O,y)||!Object.keys(O).length&&!Object.keys(y).length&&String(O)!=String(y)?n(x,j,y):o({obj1:f[i],obj2:m[i],basePath:x,basePathForRemoves:v,diffs:j}))}function n(i,f,m){f.replace.push({op:"replace",path:r(i),value:m})}}function Yt(t){return[""].concat(t).join("/")}function xo(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function go(t,e){var r=t.length-e.length;if(Array.isArray(t)&&Array.isArray(e)&&r>0){for(var o=0,a=0,s=0;s<e.length&&String(t[s])===String(e[s]);s++)o++;for(var n=e.length;n>0&&String(t[n+r])===String(e[n]);n--)a++;return o>=a}return!0}var yo=typeof global=="object"&&global&&global.Object===Object&&global,dt=yo;var bo=typeof self=="object"&&self&&self.Object===Object&&self,vo=dt||bo||Function("return this")(),g=vo;var wo=g.Symbol,T=wo;var Zt=Object.prototype,To=Zt.hasOwnProperty,Oo=Zt.toString,pt=T?T.toStringTag:void 0;function Po(t){var e=To.call(t,pt),r=t[pt];try{t[pt]=void 0;var o=!0}catch{}var a=Oo.call(t);return o&&(e?t[pt]=r:delete t[pt]),a}var Jt=Po;var jo=Object.prototype,So=jo.toString;function Ao(t){return So.call(t)}var Xt=Ao;var Io="[object Null]",_o="[object Undefined]",Qt=T?T.toStringTag:void 0;function Eo(t){return t==null?t===void 0?_o:Io:Qt&&Qt in Object(t)?Jt(t):Xt(t)}var I=Eo;function Co(t){return t!=null&&typeof t=="object"}var A=Co;var Fo="[object Symbol]";function Mo(t){return typeof t=="symbol"||A(t)&&I(t)==Fo}var z=Mo;function No(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 te=No;var Ro=Array.isArray,w=Ro;var Lo=1/0,ee=T?T.prototype:void 0,re=ee?ee.toString:void 0;function oe(t){if(typeof t=="string")return t;if(w(t))return te(t,oe)+"";if(z(t))return re?re.call(t):"";var e=t+"";return e=="0"&&1/t==-Lo?"-0":e}var ae=oe;function Bo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var S=Bo;function ko(t){return t}var ie=ko;var Do="[object AsyncFunction]",Uo="[object Function]",Ko="[object GeneratorFunction]",zo="[object Proxy]";function Go(t){if(!S(t))return!1;var e=I(t);return e==Uo||e==Ko||e==Do||e==zo}var ct=Go;var Wo=g["__core-js_shared__"],ht=Wo;var se=function(){var t=/[^.]+$/.exec(ht&&ht.keys&&ht.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function $o(t){return!!se&&se in t}var ne=$o;var Ho=Function.prototype,qo=Ho.toString;function Vo(t){if(t!=null){try{return qo.call(t)}catch{}try{return t+""}catch{}}return""}var C=Vo;var Yo=/[\\^$.*+?()[\]{}|]/g,Zo=/^\[object .+?Constructor\]$/,Jo=Function.prototype,Xo=Object.prototype,Qo=Jo.toString,ta=Xo.hasOwnProperty,ea=RegExp("^"+Qo.call(ta).replace(Yo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ra(t){if(!S(t)||ne(t))return!1;var e=ct(t)?ea:Zo;return e.test(C(t))}var fe=ra;function oa(t,e){return t==null?void 0:t[e]}var pe=oa;function aa(t,e){var r=pe(t,e);return fe(r)?r:void 0}var P=aa;var ia=P(g,"WeakMap"),xt=ia;var le=Object.create,sa=function(){function t(){}return function(e){if(!S(e))return{};if(le)return le(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),me=sa;function na(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 ue=na;function fa(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var de=fa;var pa=800,la=16,ma=Date.now;function ua(t){var e=0,r=0;return function(){var o=ma(),a=la-(o-r);if(r=o,a>0){if(++e>=pa)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var ce=ua;function da(t){return function(){return t}}var he=da;var ca=function(){try{var t=P(Object,"defineProperty");return t({},"",{}),t}catch{}}(),G=ca;var ha=G?function(t,e){return G(t,"toString",{configurable:!0,enumerable:!1,value:he(e),writable:!0})}:ie,xe=ha;var xa=ce(xe),ge=xa;function ga(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var ye=ga;var ya=9007199254740991,ba=/^(?:0|[1-9]\d*)$/;function va(t,e){var r=typeof t;return e=e==null?ya:e,!!e&&(r=="number"||r!="symbol"&&ba.test(t))&&t>-1&&t%1==0&&t<e}var W=va;function wa(t,e,r){e=="__proto__"&&G?G(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var gt=wa;function Ta(t,e){return t===e||t!==t&&e!==e}var yt=Ta;var Oa=Object.prototype,Pa=Oa.hasOwnProperty;function ja(t,e,r){var o=t[e];(!(Pa.call(t,e)&&yt(o,r))||r===void 0&&!(e in t))&>(t,e,r)}var $=ja;function Sa(t,e,r,o){var a=!r;r||(r={});for(var s=-1,n=e.length;++s<n;){var i=e[s],f=o?o(r[i],t[i],i,r,t):void 0;f===void 0&&(f=t[i]),a?gt(r,i,f):$(r,i,f)}return r}var N=Sa;var be=Math.max;function Aa(t,e,r){return e=be(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=be(o.length-e,0),n=Array(s);++a<s;)n[a]=o[e+a];a=-1;for(var i=Array(e+1);++a<e;)i[a]=o[a];return i[e]=r(n),ue(t,this,i)}}var ve=Aa;var Ia=9007199254740991;function _a(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Ia}var H=_a;function Ea(t){return t!=null&&H(t.length)&&!ct(t)}var bt=Ea;var Ca=Object.prototype;function Fa(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Ca;return t===r}var q=Fa;function Ma(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var we=Ma;var Na="[object Arguments]";function Ra(t){return A(t)&&I(t)==Na}var Mt=Ra;var Te=Object.prototype,La=Te.hasOwnProperty,Ba=Te.propertyIsEnumerable,ka=Mt(function(){return arguments}())?Mt:function(t){return A(t)&&La.call(t,"callee")&&!Ba.call(t,"callee")},V=ka;function Da(){return!1}var Oe=Da;var Se=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pe=Se&&typeof module=="object"&&module&&!module.nodeType&&module,Ua=Pe&&Pe.exports===Se,je=Ua?g.Buffer:void 0,Ka=je?je.isBuffer:void 0,za=Ka||Oe,vt=za;var Ga="[object Arguments]",Wa="[object Array]",$a="[object Boolean]",Ha="[object Date]",qa="[object Error]",Va="[object Function]",Ya="[object Map]",Za="[object Number]",Ja="[object Object]",Xa="[object RegExp]",Qa="[object Set]",ti="[object String]",ei="[object WeakMap]",ri="[object ArrayBuffer]",oi="[object DataView]",ai="[object Float32Array]",ii="[object Float64Array]",si="[object Int8Array]",ni="[object Int16Array]",fi="[object Int32Array]",pi="[object Uint8Array]",li="[object Uint8ClampedArray]",mi="[object Uint16Array]",ui="[object Uint32Array]",h={};h[ai]=h[ii]=h[si]=h[ni]=h[fi]=h[pi]=h[li]=h[mi]=h[ui]=!0;h[Ga]=h[Wa]=h[ri]=h[$a]=h[oi]=h[Ha]=h[qa]=h[Va]=h[Ya]=h[Za]=h[Ja]=h[Xa]=h[Qa]=h[ti]=h[ei]=!1;function di(t){return A(t)&&H(t.length)&&!!h[I(t)]}var Ae=di;function ci(t){return function(e){return t(e)}}var Y=ci;var Ie=typeof exports=="object"&&exports&&!exports.nodeType&&exports,lt=Ie&&typeof module=="object"&&module&&!module.nodeType&&module,hi=lt&<.exports===Ie,Nt=hi&&dt.process,xi=function(){try{var t=lt&<.require&<.require("util").types;return t||Nt&&Nt.binding&&Nt.binding("util")}catch{}}(),F=xi;var _e=F&&F.isTypedArray,gi=_e?Y(_e):Ae,Ee=gi;var yi=Object.prototype,bi=yi.hasOwnProperty;function vi(t,e){var r=w(t),o=!r&&V(t),a=!r&&!o&&vt(t),s=!r&&!o&&!a&&Ee(t),n=r||o||a||s,i=n?we(t.length,String):[],f=i.length;for(var m in t)(e||bi.call(t,m))&&!(n&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||W(m,f)))&&i.push(m);return i}var wt=vi;function wi(t,e){return function(r){return t(e(r))}}var Tt=wi;var Ti=Tt(Object.keys,Object),Ce=Ti;var Oi=Object.prototype,Pi=Oi.hasOwnProperty;function ji(t){if(!q(t))return Ce(t);var e=[];for(var r in Object(t))Pi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Fe=ji;function Si(t){return bt(t)?wt(t):Fe(t)}var Z=Si;function Ai(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Me=Ai;var Ii=Object.prototype,_i=Ii.hasOwnProperty;function Ei(t){if(!S(t))return Me(t);var e=q(t),r=[];for(var o in t)o=="constructor"&&(e||!_i.call(t,o))||r.push(o);return r}var Ne=Ei;function Ci(t){return bt(t)?wt(t,!0):Ne(t)}var J=Ci;var Fi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Mi=/^\w*$/;function Ni(t,e){if(w(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||z(t)?!0:Mi.test(t)||!Fi.test(t)||e!=null&&t in Object(e)}var Re=Ni;var Ri=P(Object,"create"),M=Ri;function Li(){this.__data__=M?M(null):{},this.size=0}var Le=Li;function Bi(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Be=Bi;var ki="__lodash_hash_undefined__",Di=Object.prototype,Ui=Di.hasOwnProperty;function Ki(t){var e=this.__data__;if(M){var r=e[t];return r===ki?void 0:r}return Ui.call(e,t)?e[t]:void 0}var ke=Ki;var zi=Object.prototype,Gi=zi.hasOwnProperty;function Wi(t){var e=this.__data__;return M?e[t]!==void 0:Gi.call(e,t)}var De=Wi;var $i="__lodash_hash_undefined__";function Hi(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=M&&e===void 0?$i:e,this}var Ue=Hi;function X(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])}}X.prototype.clear=Le;X.prototype.delete=Be;X.prototype.get=ke;X.prototype.has=De;X.prototype.set=Ue;var Rt=X;function qi(){this.__data__=[],this.size=0}var Ke=qi;function Vi(t,e){for(var r=t.length;r--;)if(yt(t[r][0],e))return r;return-1}var R=Vi;var Yi=Array.prototype,Zi=Yi.splice;function Ji(t){var e=this.__data__,r=R(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Zi.call(e,r,1),--this.size,!0}var ze=Ji;function Xi(t){var e=this.__data__,r=R(e,t);return r<0?void 0:e[r][1]}var Ge=Xi;function Qi(t){return R(this.__data__,t)>-1}var We=Qi;function ts(t,e){var r=this.__data__,o=R(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var $e=ts;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=Ke;Q.prototype.delete=ze;Q.prototype.get=Ge;Q.prototype.has=We;Q.prototype.set=$e;var L=Q;var es=P(g,"Map"),B=es;function rs(){this.size=0,this.__data__={hash:new Rt,map:new(B||L),string:new Rt}}var He=rs;function os(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var qe=os;function as(t,e){var r=t.__data__;return qe(e)?r[typeof e=="string"?"string":"hash"]:r.map}var k=as;function is(t){var e=k(this,t).delete(t);return this.size-=e?1:0,e}var Ve=is;function ss(t){return k(this,t).get(t)}var Ye=ss;function ns(t){return k(this,t).has(t)}var Ze=ns;function fs(t,e){var r=k(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Je=fs;function tt(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])}}tt.prototype.clear=He;tt.prototype.delete=Ve;tt.prototype.get=Ye;tt.prototype.has=Ze;tt.prototype.set=Je;var mt=tt;var ps="Expected a function";function Lt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(ps);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],s=r.cache;if(s.has(a))return s.get(a);var n=t.apply(this,o);return r.cache=s.set(a,n)||s,n};return r.cache=new(Lt.Cache||mt),r}Lt.Cache=mt;var Xe=Lt;var ls=500;function ms(t){var e=Xe(t,function(o){return r.size===ls&&r.clear(),o}),r=e.cache;return e}var Qe=ms;var us=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ds=/\\(\\)?/g,cs=Qe(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(us,function(r,o,a,s){e.push(a?s.replace(ds,"$1"):o||r)}),e}),tr=cs;function hs(t){return t==null?"":ae(t)}var er=hs;function xs(t,e){return w(t)?t:Re(t,e)?[t]:tr(er(t))}var D=xs;var gs=1/0;function ys(t){if(typeof t=="string"||z(t))return t;var e=t+"";return e=="0"&&1/t==-gs?"-0":e}var et=ys;function bs(t,e){e=D(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[et(e[r++])];return r&&r==o?t:void 0}var rr=bs;function vs(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var rt=vs;var or=T?T.isConcatSpreadable:void 0;function ws(t){return w(t)||V(t)||!!(or&&t&&t[or])}var ar=ws;function ir(t,e,r,o,a){var s=-1,n=t.length;for(r||(r=ar),a||(a=[]);++s<n;){var i=t[s];e>0&&r(i)?e>1?ir(i,e-1,r,o,a):rt(a,i):o||(a[a.length]=i)}return a}var sr=ir;function Ts(t){var e=t==null?0:t.length;return e?sr(t,1):[]}var nr=Ts;function Os(t){return ge(ve(t,void 0,nr),t+"")}var fr=Os;var Ps=Tt(Object.getPrototypeOf,Object),Ot=Ps;function js(){this.__data__=new L,this.size=0}var pr=js;function Ss(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var lr=Ss;function As(t){return this.__data__.get(t)}var mr=As;function Is(t){return this.__data__.has(t)}var ur=Is;var _s=200;function Es(t,e){var r=this.__data__;if(r instanceof L){var o=r.__data__;if(!B||o.length<_s-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new mt(o)}return r.set(t,e),this.size=r.size,this}var dr=Es;function ot(t){var e=this.__data__=new L(t);this.size=e.size}ot.prototype.clear=pr;ot.prototype.delete=lr;ot.prototype.get=mr;ot.prototype.has=ur;ot.prototype.set=dr;var cr=ot;function Cs(t,e){return t&&N(e,Z(e),t)}var hr=Cs;function Fs(t,e){return t&&N(e,J(e),t)}var xr=Fs;var vr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,gr=vr&&typeof module=="object"&&module&&!module.nodeType&&module,Ms=gr&&gr.exports===vr,yr=Ms?g.Buffer:void 0,br=yr?yr.allocUnsafe:void 0;function Ns(t,e){if(e)return t.slice();var r=t.length,o=br?br(r):new t.constructor(r);return t.copy(o),o}var wr=Ns;function Rs(t,e){for(var r=-1,o=t==null?0:t.length,a=0,s=[];++r<o;){var n=t[r];e(n,r,t)&&(s[a++]=n)}return s}var Tr=Rs;function Ls(){return[]}var Pt=Ls;var Bs=Object.prototype,ks=Bs.propertyIsEnumerable,Or=Object.getOwnPropertySymbols,Ds=Or?function(t){return t==null?[]:(t=Object(t),Tr(Or(t),function(e){return ks.call(t,e)}))}:Pt,at=Ds;function Us(t,e){return N(t,at(t),e)}var Pr=Us;var Ks=Object.getOwnPropertySymbols,zs=Ks?function(t){for(var e=[];t;)rt(e,at(t)),t=Ot(t);return e}:Pt,jt=zs;function Gs(t,e){return N(t,jt(t),e)}var jr=Gs;function Ws(t,e,r){var o=e(t);return w(t)?o:rt(o,r(t))}var St=Ws;function $s(t){return St(t,Z,at)}var Sr=$s;function Hs(t){return St(t,J,jt)}var Ar=Hs;var qs=P(g,"DataView"),At=qs;var Vs=P(g,"Promise"),It=Vs;var Ys=P(g,"Set"),_t=Ys;var Ir="[object Map]",Zs="[object Object]",_r="[object Promise]",Er="[object Set]",Cr="[object WeakMap]",Fr="[object DataView]",Js=C(At),Xs=C(B),Qs=C(It),tn=C(_t),en=C(xt),K=I;(At&&K(new At(new ArrayBuffer(1)))!=Fr||B&&K(new B)!=Ir||It&&K(It.resolve())!=_r||_t&&K(new _t)!=Er||xt&&K(new xt)!=Cr)&&(K=function(t){var e=I(t),r=e==Zs?t.constructor:void 0,o=r?C(r):"";if(o)switch(o){case Js:return Fr;case Xs:return Ir;case Qs:return _r;case tn:return Er;case en:return Cr}return e});var it=K;var rn=Object.prototype,on=rn.hasOwnProperty;function an(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&on.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Mr=an;var sn=g.Uint8Array,Bt=sn;function nn(t){var e=new t.constructor(t.byteLength);return new Bt(e).set(new Bt(t)),e}var st=nn;function fn(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Nr=fn;var pn=/\w*$/;function ln(t){var e=new t.constructor(t.source,pn.exec(t));return e.lastIndex=t.lastIndex,e}var Rr=ln;var Lr=T?T.prototype:void 0,Br=Lr?Lr.valueOf:void 0;function mn(t){return Br?Object(Br.call(t)):{}}var kr=mn;function un(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Dr=un;var dn="[object Boolean]",cn="[object Date]",hn="[object Map]",xn="[object Number]",gn="[object RegExp]",yn="[object Set]",bn="[object String]",vn="[object Symbol]",wn="[object ArrayBuffer]",Tn="[object DataView]",On="[object Float32Array]",Pn="[object Float64Array]",jn="[object Int8Array]",Sn="[object Int16Array]",An="[object Int32Array]",In="[object Uint8Array]",_n="[object Uint8ClampedArray]",En="[object Uint16Array]",Cn="[object Uint32Array]";function Fn(t,e,r){var o=t.constructor;switch(e){case wn:return st(t);case dn:case cn:return new o(+t);case Tn:return Nr(t,r);case On:case Pn:case jn:case Sn:case An:case In:case _n:case En:case Cn:return Dr(t,r);case hn:return new o;case xn:case bn:return new o(t);case gn:return Rr(t);case yn:return new o;case vn:return kr(t)}}var Ur=Fn;function Mn(t){return typeof t.constructor=="function"&&!q(t)?me(Ot(t)):{}}var Kr=Mn;var Nn="[object Map]";function Rn(t){return A(t)&&it(t)==Nn}var zr=Rn;var Gr=F&&F.isMap,Ln=Gr?Y(Gr):zr,Wr=Ln;var Bn="[object Set]";function kn(t){return A(t)&&it(t)==Bn}var $r=kn;var Hr=F&&F.isSet,Dn=Hr?Y(Hr):$r,qr=Dn;var Un=1,Kn=2,zn=4,Vr="[object Arguments]",Gn="[object Array]",Wn="[object Boolean]",$n="[object Date]",Hn="[object Error]",Yr="[object Function]",qn="[object GeneratorFunction]",Vn="[object Map]",Yn="[object Number]",Zr="[object Object]",Zn="[object RegExp]",Jn="[object Set]",Xn="[object String]",Qn="[object Symbol]",tf="[object WeakMap]",ef="[object ArrayBuffer]",rf="[object DataView]",of="[object Float32Array]",af="[object Float64Array]",sf="[object Int8Array]",nf="[object Int16Array]",ff="[object Int32Array]",pf="[object Uint8Array]",lf="[object Uint8ClampedArray]",mf="[object Uint16Array]",uf="[object Uint32Array]",c={};c[Vr]=c[Gn]=c[ef]=c[rf]=c[Wn]=c[$n]=c[of]=c[af]=c[sf]=c[nf]=c[ff]=c[Vn]=c[Yn]=c[Zr]=c[Zn]=c[Jn]=c[Xn]=c[Qn]=c[pf]=c[lf]=c[mf]=c[uf]=!0;c[Hn]=c[Yr]=c[tf]=!1;function Et(t,e,r,o,a,s){var n,i=e&Un,f=e&Kn,m=e&zn;if(r&&(n=a?r(t,o,a,s):r(t)),n!==void 0)return n;if(!S(t))return t;var x=w(t);if(x){if(n=Mr(t),!i)return de(t,n)}else{var v=it(t),j=v==Yr||v==qn;if(vt(t))return wr(t,i);if(v==Zr||v==Vr||j&&!a){if(n=f||j?{}:Kr(t),!i)return f?jr(t,xr(n,t)):Pr(t,hr(n,t))}else{if(!c[v])return a?t:{};n=Ur(t,v,i)}}s||(s=new cr);var O=s.get(t);if(O)return O;s.set(t,n),qr(t)?t.forEach(function(b){n.add(Et(b,e,r,b,t,s))}):Wr(t)&&t.forEach(function(b,p){n.set(p,Et(b,e,r,p,t,s))});var y=m?f?Ar:Sr:f?J:Z,_=x?void 0:y(t);return ye(_||t,function(b,p){_&&(p=b,b=t[p]),$(n,p,Et(b,e,r,p,t,s))}),n}var Jr=Et;var df=1,cf=4;function hf(t){return Jr(t,df|cf)}var kt=hf;function xf(t,e){return t!=null&&e in Object(t)}var Xr=xf;function gf(t,e,r){e=D(e,t);for(var o=-1,a=e.length,s=!1;++o<a;){var n=et(e[o]);if(!(s=t!=null&&r(t,n)))break;t=t[n]}return s||++o!=a?s:(a=t==null?0:t.length,!!a&&H(a)&&W(n,a)&&(w(t)||V(t)))}var Qr=gf;function yf(t,e){return t!=null&&Qr(t,e,Xr)}var to=yf;function bf(t,e,r,o){if(!S(t))return t;e=D(e,t);for(var a=-1,s=e.length,n=s-1,i=t;i!=null&&++a<s;){var f=et(e[a]),m=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return t;if(a!=n){var x=i[f];m=o?o(x,f,i):void 0,m===void 0&&(m=S(x)?x:W(e[a+1])?[]:{})}$(i,f,m),i=i[f]}return t}var eo=bf;function vf(t,e,r){for(var o=-1,a=e.length,s={};++o<a;){var n=e[o],i=rr(t,n);r(i,n)&&eo(s,D(n,t),i)}return s}var ro=vf;function wf(t,e){return ro(t,e,function(r,o){return to(t,o)})}var oo=wf;var Tf=fr(function(t,e){return t==null?{}:oo(t,e)}),Ct=Tf;function ao(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 io="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Dt=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=io[r[t]&63];return e};var Of="array",Pf="bit",so="bits",jf="byte",no="bytes",nt="",Sf="exponent",Af="function",fo="iec",If="Invalid number",_f="Invalid rounding method",Ut="jedec",Ef="object",po=".",Cf="round",Ff="s",Mf="si",Nf="kbit",Rf="kB",Lf=" ",Bf="string",kf="0",Kt={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 lo(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:s=nt,localeOptions:n={},separator:i=nt,spacer:f=Lf,symbols:m={},standard:x=nt,output:v=Bf,fullform:j=!1,fullforms:O=[],exponent:y=-1,roundingMethod:_=Cf,precision:b=0}={}){let p=y,u=Number(t),l=[],E=0,Ft=nt;x===Mf?(o=10,x=Ut):x===fo||x===Ut?o=2:o===2?x=fo:(o=10,x=Ut);let ut=o===10?1e3:1024,mo=j===!0,Gt=u<0,Wt=Math[_];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(If);if(typeof Wt!==Af)throw new TypeError(_f);if(Gt&&(u=-u),(p===-1||isNaN(p))&&(p=Math.floor(Math.log(u)/Math.log(ut)),p<0&&(p=0)),p>8&&(b>0&&(b+=8-p),p=8),v===Sf)return p;if(u===0)l[0]=0,Ft=l[1]=Kt.symbol[x][e?so:no][p];else{E=u/(o===2?Math.pow(2,p*10):Math.pow(1e3,p)),e&&(E=E*8,E>=ut&&p<8&&(E=E/ut,p++));let ft=Math.pow(10,p>0?a:0);l[0]=Wt(E*ft)/ft,l[0]===ut&&p<8&&y===-1&&(l[0]=1,p++),Ft=l[1]=o===10&&p===1?e?Nf:Rf:Kt.symbol[x][e?so:no][p]}if(Gt&&(l[0]=-l[0]),b>0&&(l[0]=l[0].toPrecision(b)),l[1]=m[l[1]]||l[1],s===!0?l[0]=l[0].toLocaleString():s.length>0?l[0]=l[0].toLocaleString(s,n):i.length>0&&(l[0]=l[0].toString().replace(po,i)),r&&Number.isInteger(l[0])===!1&&a>0){let ft=i||po,$t=l[0].toString().split(ft),Ht=$t[1]||nt,qt=Ht.length,uo=a-qt;l[0]=`${$t[0]}${ft}${Ht.padEnd(qt+uo,kf)}`}return mo&&(l[1]=O[p]?O[p]:Kt.fullform[x][p]+(e?Pf:jf)+(l[0]===1?nt:Ff)),v===Of?l:v===Ef?{value:l[0],symbol:l[1],exponent:p,unit:Ft}:l.join(f)}var U=class t{constructor(e){d(this,"_tera");d(this,"id");d(this,"name");d(this,"icon");d(this,"path");d(this,"url");d(this,"teraUrl");d(this,"parsedName");d(this,"created");d(this,"createdFormatted");d(this,"modified");d(this,"modifiedFormatted");d(this,"accessed");d(this,"accessedFormatted");d(this,"size");d(this,"sizeFormatted");d(this,"mime");d(this,"meta",{});if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,e);let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.teraUrl=this.url.replace(/^https:\/\/tera-tools.com\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=lo(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.setProjectFile(this.id,e)}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Ct(this,["id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new t(Ct(e,["tera","id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]))}};var zt=class{constructor(e){d(this,"settings",{devMode:!0,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",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});d(this,"events",ao());d(this,"dom",{el:null,iframe:null,popup:null,stylesheet:null});d(this,"methods",["handshake","setServerVerbosity","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateFlush","setProjectStateRefresh","saveProjectState","replaceProjectState","applyProjectStatePatch","getProjectFileContents","deleteProjectFile","setProjectFile","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPageUrl","setPageTitle","uiAlert","uiProgress","uiSplat","uiWindow"]);d(this,"plugins",[]);d(this,"acceptPostboxes",{});e&&this.set(e)}send(e){let r=Dt();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||Dt(),...kt(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;let r=e.data;if(!(!r.TERA||!r.id))if(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);else{if((r==null?void 0:r.action)=="rpc")return 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()})});if((r==null?void 0:r.action)=="event")return 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?`):this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r})}}createProjectStatePatch(e,r){let o=Vt(r,e,Yt);return this.debug("INFO",3,"Created project patch",{newState:e,oldState:r}),this.applyProjectStatePatch(o)}applyProjectStatePatchLocal(e){throw new Error("applyProjectStatePatchLocal() has not been sub-classed by a plugin")}init(e){if(e&&this.set(e),this.init.promise)return this.init.promise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.init.promise=Promise.resolve().then(()=>this.debug("INFO",4,"[0/6] Init using server",this.settings.siteUrl)).then(()=>this.detectMode()).then(o=>{this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o}).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")).catch(o=>this.debug("WARN",0,"Init process fault",o))}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(),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e())})).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),document.body.append(this.dom.el),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":this.debug("INFO",2,"Using TERA window parent");break;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 s=0,n,i=setTimeout(()=>a("TIMEOUT"),r.handshakeTimeout),f=()=>{this.debug("INFO",4,"Trying handshake",++s),clearTimeout(n),n=setTimeout(f,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(i),clearTimeout(n)}).then(()=>o()).catch(a)};f()})}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;","&.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
|
-
`),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){if(typeof e!="function")throw new Error("Expected use() call to be provided with a class initalizer");let o=new e(this,r);return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(o=>!["constructor","prototype","name"].includes(o)).filter(o=>o!="init").forEach(o=>{Object.defineProperty(e,o,{value:r[o].bind(e),enumerable:!1})})}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.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)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new U({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new U({tera:this,...o})))}getProjectFile(e){return this.rpc("getProjectFile",e).then(r=>r&&new U({tera:this,...r}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new U({tera:this,...r}))}};export{
|
|
1
|
+
var co=Object.defineProperty;var ho=(t,e,r)=>e in t?co(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var d=(t,e,r)=>(ho(t,typeof e!="symbol"?e+"":e,r),r);function Vt(t,e,r){if(!t||typeof t!="object"||!e||typeof e!="object")throw new Error("both arguments must be objects or arrays");r||(r=function(i){return i});function o({obj1:i,obj2:f,basePath:m,basePathForRemoves:x,diffs:v}){var j=Object.keys(i),O=j.length,y=Object.keys(f),_=y.length,b,p=i.length-f.length;if(go(i,f)){for(var u=0;u<O;u++){var l=Array.isArray(i)?Number(j[u]):j[u];l in f||(b=x.concat(l),v.remove.push({op:"remove",path:r(b)}))}for(var u=0;u<_;u++){var l=Array.isArray(f)?Number(y[u]):y[u];s({key:l,obj1:i,obj2:f,path:m.concat(l),pathForRemoves:m.concat(l),diffs:v})}}else{for(var u=0;u<p;u++)b=x.concat(u),v.remove.push({op:"remove",path:r(b)});for(var E=i.slice(p),u=0;u<_;u++)s({key:u,obj1:E,obj2:f,path:m.concat(u),pathForRemoves:m.concat(u+p),diffs:v})}}var a={remove:[],replace:[],add:[]};return o({obj1:t,obj2:e,basePath:[],basePathForRemoves:[],diffs:a}),a.remove.reverse().concat(a.replace).concat(a.add);function s({key:i,obj1:f,obj2:m,path:x,pathForRemoves:v,diffs:j}){var O=f[i],y=m[i];if(!(i in f)&&i in m){var _=y;j.add.push({op:"add",path:r(x),value:_})}else O!==y&&(Object(O)!==O||Object(y)!==y||xo(O,y)||!Object.keys(O).length&&!Object.keys(y).length&&String(O)!=String(y)?n(x,j,y):o({obj1:f[i],obj2:m[i],basePath:x,basePathForRemoves:v,diffs:j}))}function n(i,f,m){f.replace.push({op:"replace",path:r(i),value:m})}}function Yt(t){return[""].concat(t).join("/")}function xo(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function go(t,e){var r=t.length-e.length;if(Array.isArray(t)&&Array.isArray(e)&&r>0){for(var o=0,a=0,s=0;s<e.length&&String(t[s])===String(e[s]);s++)o++;for(var n=e.length;n>0&&String(t[n+r])===String(e[n]);n--)a++;return o>=a}return!0}var yo=typeof global=="object"&&global&&global.Object===Object&&global,dt=yo;var bo=typeof self=="object"&&self&&self.Object===Object&&self,vo=dt||bo||Function("return this")(),g=vo;var To=g.Symbol,w=To;var Zt=Object.prototype,wo=Zt.hasOwnProperty,Oo=Zt.toString,pt=w?w.toStringTag:void 0;function Ao(t){var e=wo.call(t,pt),r=t[pt];try{t[pt]=void 0;var o=!0}catch{}var a=Oo.call(t);return o&&(e?t[pt]=r:delete t[pt]),a}var Jt=Ao;var jo=Object.prototype,Po=jo.toString;function So(t){return Po.call(t)}var Xt=So;var Io="[object Null]",_o="[object Undefined]",Qt=w?w.toStringTag:void 0;function Eo(t){return t==null?t===void 0?_o:Io:Qt&&Qt in Object(t)?Jt(t):Xt(t)}var I=Eo;function Co(t){return t!=null&&typeof t=="object"}var S=Co;var Fo="[object Symbol]";function Ro(t){return typeof t=="symbol"||S(t)&&I(t)==Fo}var K=Ro;function Mo(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 te=Mo;var No=Array.isArray,T=No;var Lo=1/0,ee=w?w.prototype:void 0,re=ee?ee.toString:void 0;function oe(t){if(typeof t=="string")return t;if(T(t))return te(t,oe)+"";if(K(t))return re?re.call(t):"";var e=t+"";return e=="0"&&1/t==-Lo?"-0":e}var ae=oe;function Bo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var P=Bo;function ko(t){return t}var ie=ko;var Do="[object AsyncFunction]",Uo="[object Function]",zo="[object GeneratorFunction]",Ko="[object Proxy]";function Go(t){if(!P(t))return!1;var e=I(t);return e==Uo||e==zo||e==Do||e==Ko}var ct=Go;var Wo=g["__core-js_shared__"],ht=Wo;var se=function(){var t=/[^.]+$/.exec(ht&&ht.keys&&ht.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function $o(t){return!!se&&se in t}var ne=$o;var Ho=Function.prototype,qo=Ho.toString;function Vo(t){if(t!=null){try{return qo.call(t)}catch{}try{return t+""}catch{}}return""}var C=Vo;var Yo=/[\\^$.*+?()[\]{}|]/g,Zo=/^\[object .+?Constructor\]$/,Jo=Function.prototype,Xo=Object.prototype,Qo=Jo.toString,ta=Xo.hasOwnProperty,ea=RegExp("^"+Qo.call(ta).replace(Yo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ra(t){if(!P(t)||ne(t))return!1;var e=ct(t)?ea:Zo;return e.test(C(t))}var fe=ra;function oa(t,e){return t==null?void 0:t[e]}var pe=oa;function aa(t,e){var r=pe(t,e);return fe(r)?r:void 0}var A=aa;var ia=A(g,"WeakMap"),xt=ia;var le=Object.create,sa=function(){function t(){}return function(e){if(!P(e))return{};if(le)return le(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),me=sa;function na(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 ue=na;function fa(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var de=fa;var pa=800,la=16,ma=Date.now;function ua(t){var e=0,r=0;return function(){var o=ma(),a=la-(o-r);if(r=o,a>0){if(++e>=pa)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var ce=ua;function da(t){return function(){return t}}var he=da;var ca=function(){try{var t=A(Object,"defineProperty");return t({},"",{}),t}catch{}}(),G=ca;var ha=G?function(t,e){return G(t,"toString",{configurable:!0,enumerable:!1,value:he(e),writable:!0})}:ie,xe=ha;var xa=ce(xe),ge=xa;function ga(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var ye=ga;var ya=9007199254740991,ba=/^(?:0|[1-9]\d*)$/;function va(t,e){var r=typeof t;return e=e==null?ya:e,!!e&&(r=="number"||r!="symbol"&&ba.test(t))&&t>-1&&t%1==0&&t<e}var W=va;function Ta(t,e,r){e=="__proto__"&&G?G(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var gt=Ta;function wa(t,e){return t===e||t!==t&&e!==e}var yt=wa;var Oa=Object.prototype,Aa=Oa.hasOwnProperty;function ja(t,e,r){var o=t[e];(!(Aa.call(t,e)&&yt(o,r))||r===void 0&&!(e in t))&>(t,e,r)}var $=ja;function Pa(t,e,r,o){var a=!r;r||(r={});for(var s=-1,n=e.length;++s<n;){var i=e[s],f=o?o(r[i],t[i],i,r,t):void 0;f===void 0&&(f=t[i]),a?gt(r,i,f):$(r,i,f)}return r}var M=Pa;var be=Math.max;function Sa(t,e,r){return e=be(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=be(o.length-e,0),n=Array(s);++a<s;)n[a]=o[e+a];a=-1;for(var i=Array(e+1);++a<e;)i[a]=o[a];return i[e]=r(n),ue(t,this,i)}}var ve=Sa;var Ia=9007199254740991;function _a(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Ia}var H=_a;function Ea(t){return t!=null&&H(t.length)&&!ct(t)}var bt=Ea;var Ca=Object.prototype;function Fa(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Ca;return t===r}var q=Fa;function Ra(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var Te=Ra;var Ma="[object Arguments]";function Na(t){return S(t)&&I(t)==Ma}var Rt=Na;var we=Object.prototype,La=we.hasOwnProperty,Ba=we.propertyIsEnumerable,ka=Rt(function(){return arguments}())?Rt:function(t){return S(t)&&La.call(t,"callee")&&!Ba.call(t,"callee")},V=ka;function Da(){return!1}var Oe=Da;var Pe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ae=Pe&&typeof module=="object"&&module&&!module.nodeType&&module,Ua=Ae&&Ae.exports===Pe,je=Ua?g.Buffer:void 0,za=je?je.isBuffer:void 0,Ka=za||Oe,vt=Ka;var Ga="[object Arguments]",Wa="[object Array]",$a="[object Boolean]",Ha="[object Date]",qa="[object Error]",Va="[object Function]",Ya="[object Map]",Za="[object Number]",Ja="[object Object]",Xa="[object RegExp]",Qa="[object Set]",ti="[object String]",ei="[object WeakMap]",ri="[object ArrayBuffer]",oi="[object DataView]",ai="[object Float32Array]",ii="[object Float64Array]",si="[object Int8Array]",ni="[object Int16Array]",fi="[object Int32Array]",pi="[object Uint8Array]",li="[object Uint8ClampedArray]",mi="[object Uint16Array]",ui="[object Uint32Array]",h={};h[ai]=h[ii]=h[si]=h[ni]=h[fi]=h[pi]=h[li]=h[mi]=h[ui]=!0;h[Ga]=h[Wa]=h[ri]=h[$a]=h[oi]=h[Ha]=h[qa]=h[Va]=h[Ya]=h[Za]=h[Ja]=h[Xa]=h[Qa]=h[ti]=h[ei]=!1;function di(t){return S(t)&&H(t.length)&&!!h[I(t)]}var Se=di;function ci(t){return function(e){return t(e)}}var Y=ci;var Ie=typeof exports=="object"&&exports&&!exports.nodeType&&exports,lt=Ie&&typeof module=="object"&&module&&!module.nodeType&&module,hi=lt&<.exports===Ie,Mt=hi&&dt.process,xi=function(){try{var t=lt&<.require&<.require("util").types;return t||Mt&&Mt.binding&&Mt.binding("util")}catch{}}(),F=xi;var _e=F&&F.isTypedArray,gi=_e?Y(_e):Se,Ee=gi;var yi=Object.prototype,bi=yi.hasOwnProperty;function vi(t,e){var r=T(t),o=!r&&V(t),a=!r&&!o&&vt(t),s=!r&&!o&&!a&&Ee(t),n=r||o||a||s,i=n?Te(t.length,String):[],f=i.length;for(var m in t)(e||bi.call(t,m))&&!(n&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||W(m,f)))&&i.push(m);return i}var Tt=vi;function Ti(t,e){return function(r){return t(e(r))}}var wt=Ti;var wi=wt(Object.keys,Object),Ce=wi;var Oi=Object.prototype,Ai=Oi.hasOwnProperty;function ji(t){if(!q(t))return Ce(t);var e=[];for(var r in Object(t))Ai.call(t,r)&&r!="constructor"&&e.push(r);return e}var Fe=ji;function Pi(t){return bt(t)?Tt(t):Fe(t)}var Z=Pi;function Si(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Re=Si;var Ii=Object.prototype,_i=Ii.hasOwnProperty;function Ei(t){if(!P(t))return Re(t);var e=q(t),r=[];for(var o in t)o=="constructor"&&(e||!_i.call(t,o))||r.push(o);return r}var Me=Ei;function Ci(t){return bt(t)?Tt(t,!0):Me(t)}var J=Ci;var Fi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ri=/^\w*$/;function Mi(t,e){if(T(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||K(t)?!0:Ri.test(t)||!Fi.test(t)||e!=null&&t in Object(e)}var Ne=Mi;var Ni=A(Object,"create"),R=Ni;function Li(){this.__data__=R?R(null):{},this.size=0}var Le=Li;function Bi(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Be=Bi;var ki="__lodash_hash_undefined__",Di=Object.prototype,Ui=Di.hasOwnProperty;function zi(t){var e=this.__data__;if(R){var r=e[t];return r===ki?void 0:r}return Ui.call(e,t)?e[t]:void 0}var ke=zi;var Ki=Object.prototype,Gi=Ki.hasOwnProperty;function Wi(t){var e=this.__data__;return R?e[t]!==void 0:Gi.call(e,t)}var De=Wi;var $i="__lodash_hash_undefined__";function Hi(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=R&&e===void 0?$i:e,this}var Ue=Hi;function X(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])}}X.prototype.clear=Le;X.prototype.delete=Be;X.prototype.get=ke;X.prototype.has=De;X.prototype.set=Ue;var Nt=X;function qi(){this.__data__=[],this.size=0}var ze=qi;function Vi(t,e){for(var r=t.length;r--;)if(yt(t[r][0],e))return r;return-1}var N=Vi;var Yi=Array.prototype,Zi=Yi.splice;function Ji(t){var e=this.__data__,r=N(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Zi.call(e,r,1),--this.size,!0}var Ke=Ji;function Xi(t){var e=this.__data__,r=N(e,t);return r<0?void 0:e[r][1]}var Ge=Xi;function Qi(t){return N(this.__data__,t)>-1}var We=Qi;function ts(t,e){var r=this.__data__,o=N(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var $e=ts;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=ze;Q.prototype.delete=Ke;Q.prototype.get=Ge;Q.prototype.has=We;Q.prototype.set=$e;var L=Q;var es=A(g,"Map"),B=es;function rs(){this.size=0,this.__data__={hash:new Nt,map:new(B||L),string:new Nt}}var He=rs;function os(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var qe=os;function as(t,e){var r=t.__data__;return qe(e)?r[typeof e=="string"?"string":"hash"]:r.map}var k=as;function is(t){var e=k(this,t).delete(t);return this.size-=e?1:0,e}var Ve=is;function ss(t){return k(this,t).get(t)}var Ye=ss;function ns(t){return k(this,t).has(t)}var Ze=ns;function fs(t,e){var r=k(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Je=fs;function tt(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])}}tt.prototype.clear=He;tt.prototype.delete=Ve;tt.prototype.get=Ye;tt.prototype.has=Ze;tt.prototype.set=Je;var mt=tt;var ps="Expected a function";function Lt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(ps);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],s=r.cache;if(s.has(a))return s.get(a);var n=t.apply(this,o);return r.cache=s.set(a,n)||s,n};return r.cache=new(Lt.Cache||mt),r}Lt.Cache=mt;var Xe=Lt;var ls=500;function ms(t){var e=Xe(t,function(o){return r.size===ls&&r.clear(),o}),r=e.cache;return e}var Qe=ms;var us=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ds=/\\(\\)?/g,cs=Qe(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(us,function(r,o,a,s){e.push(a?s.replace(ds,"$1"):o||r)}),e}),tr=cs;function hs(t){return t==null?"":ae(t)}var er=hs;function xs(t,e){return T(t)?t:Ne(t,e)?[t]:tr(er(t))}var D=xs;var gs=1/0;function ys(t){if(typeof t=="string"||K(t))return t;var e=t+"";return e=="0"&&1/t==-gs?"-0":e}var et=ys;function bs(t,e){e=D(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[et(e[r++])];return r&&r==o?t:void 0}var rr=bs;function vs(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var rt=vs;var or=w?w.isConcatSpreadable:void 0;function Ts(t){return T(t)||V(t)||!!(or&&t&&t[or])}var ar=Ts;function ir(t,e,r,o,a){var s=-1,n=t.length;for(r||(r=ar),a||(a=[]);++s<n;){var i=t[s];e>0&&r(i)?e>1?ir(i,e-1,r,o,a):rt(a,i):o||(a[a.length]=i)}return a}var sr=ir;function ws(t){var e=t==null?0:t.length;return e?sr(t,1):[]}var nr=ws;function Os(t){return ge(ve(t,void 0,nr),t+"")}var fr=Os;var As=wt(Object.getPrototypeOf,Object),Ot=As;function js(){this.__data__=new L,this.size=0}var pr=js;function Ps(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var lr=Ps;function Ss(t){return this.__data__.get(t)}var mr=Ss;function Is(t){return this.__data__.has(t)}var ur=Is;var _s=200;function Es(t,e){var r=this.__data__;if(r instanceof L){var o=r.__data__;if(!B||o.length<_s-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new mt(o)}return r.set(t,e),this.size=r.size,this}var dr=Es;function ot(t){var e=this.__data__=new L(t);this.size=e.size}ot.prototype.clear=pr;ot.prototype.delete=lr;ot.prototype.get=mr;ot.prototype.has=ur;ot.prototype.set=dr;var cr=ot;function Cs(t,e){return t&&M(e,Z(e),t)}var hr=Cs;function Fs(t,e){return t&&M(e,J(e),t)}var xr=Fs;var vr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,gr=vr&&typeof module=="object"&&module&&!module.nodeType&&module,Rs=gr&&gr.exports===vr,yr=Rs?g.Buffer:void 0,br=yr?yr.allocUnsafe:void 0;function Ms(t,e){if(e)return t.slice();var r=t.length,o=br?br(r):new t.constructor(r);return t.copy(o),o}var Tr=Ms;function Ns(t,e){for(var r=-1,o=t==null?0:t.length,a=0,s=[];++r<o;){var n=t[r];e(n,r,t)&&(s[a++]=n)}return s}var wr=Ns;function Ls(){return[]}var At=Ls;var Bs=Object.prototype,ks=Bs.propertyIsEnumerable,Or=Object.getOwnPropertySymbols,Ds=Or?function(t){return t==null?[]:(t=Object(t),wr(Or(t),function(e){return ks.call(t,e)}))}:At,at=Ds;function Us(t,e){return M(t,at(t),e)}var Ar=Us;var zs=Object.getOwnPropertySymbols,Ks=zs?function(t){for(var e=[];t;)rt(e,at(t)),t=Ot(t);return e}:At,jt=Ks;function Gs(t,e){return M(t,jt(t),e)}var jr=Gs;function Ws(t,e,r){var o=e(t);return T(t)?o:rt(o,r(t))}var Pt=Ws;function $s(t){return Pt(t,Z,at)}var Pr=$s;function Hs(t){return Pt(t,J,jt)}var Sr=Hs;var qs=A(g,"DataView"),St=qs;var Vs=A(g,"Promise"),It=Vs;var Ys=A(g,"Set"),_t=Ys;var Ir="[object Map]",Zs="[object Object]",_r="[object Promise]",Er="[object Set]",Cr="[object WeakMap]",Fr="[object DataView]",Js=C(St),Xs=C(B),Qs=C(It),tn=C(_t),en=C(xt),z=I;(St&&z(new St(new ArrayBuffer(1)))!=Fr||B&&z(new B)!=Ir||It&&z(It.resolve())!=_r||_t&&z(new _t)!=Er||xt&&z(new xt)!=Cr)&&(z=function(t){var e=I(t),r=e==Zs?t.constructor:void 0,o=r?C(r):"";if(o)switch(o){case Js:return Fr;case Xs:return Ir;case Qs:return _r;case tn:return Er;case en:return Cr}return e});var it=z;var rn=Object.prototype,on=rn.hasOwnProperty;function an(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&on.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Rr=an;var sn=g.Uint8Array,Bt=sn;function nn(t){var e=new t.constructor(t.byteLength);return new Bt(e).set(new Bt(t)),e}var st=nn;function fn(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Mr=fn;var pn=/\w*$/;function ln(t){var e=new t.constructor(t.source,pn.exec(t));return e.lastIndex=t.lastIndex,e}var Nr=ln;var Lr=w?w.prototype:void 0,Br=Lr?Lr.valueOf:void 0;function mn(t){return Br?Object(Br.call(t)):{}}var kr=mn;function un(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Dr=un;var dn="[object Boolean]",cn="[object Date]",hn="[object Map]",xn="[object Number]",gn="[object RegExp]",yn="[object Set]",bn="[object String]",vn="[object Symbol]",Tn="[object ArrayBuffer]",wn="[object DataView]",On="[object Float32Array]",An="[object Float64Array]",jn="[object Int8Array]",Pn="[object Int16Array]",Sn="[object Int32Array]",In="[object Uint8Array]",_n="[object Uint8ClampedArray]",En="[object Uint16Array]",Cn="[object Uint32Array]";function Fn(t,e,r){var o=t.constructor;switch(e){case Tn:return st(t);case dn:case cn:return new o(+t);case wn:return Mr(t,r);case On:case An:case jn:case Pn:case Sn:case In:case _n:case En:case Cn:return Dr(t,r);case hn:return new o;case xn:case bn:return new o(t);case gn:return Nr(t);case yn:return new o;case vn:return kr(t)}}var Ur=Fn;function Rn(t){return typeof t.constructor=="function"&&!q(t)?me(Ot(t)):{}}var zr=Rn;var Mn="[object Map]";function Nn(t){return S(t)&&it(t)==Mn}var Kr=Nn;var Gr=F&&F.isMap,Ln=Gr?Y(Gr):Kr,Wr=Ln;var Bn="[object Set]";function kn(t){return S(t)&&it(t)==Bn}var $r=kn;var Hr=F&&F.isSet,Dn=Hr?Y(Hr):$r,qr=Dn;var Un=1,zn=2,Kn=4,Vr="[object Arguments]",Gn="[object Array]",Wn="[object Boolean]",$n="[object Date]",Hn="[object Error]",Yr="[object Function]",qn="[object GeneratorFunction]",Vn="[object Map]",Yn="[object Number]",Zr="[object Object]",Zn="[object RegExp]",Jn="[object Set]",Xn="[object String]",Qn="[object Symbol]",tf="[object WeakMap]",ef="[object ArrayBuffer]",rf="[object DataView]",of="[object Float32Array]",af="[object Float64Array]",sf="[object Int8Array]",nf="[object Int16Array]",ff="[object Int32Array]",pf="[object Uint8Array]",lf="[object Uint8ClampedArray]",mf="[object Uint16Array]",uf="[object Uint32Array]",c={};c[Vr]=c[Gn]=c[ef]=c[rf]=c[Wn]=c[$n]=c[of]=c[af]=c[sf]=c[nf]=c[ff]=c[Vn]=c[Yn]=c[Zr]=c[Zn]=c[Jn]=c[Xn]=c[Qn]=c[pf]=c[lf]=c[mf]=c[uf]=!0;c[Hn]=c[Yr]=c[tf]=!1;function Et(t,e,r,o,a,s){var n,i=e&Un,f=e&zn,m=e&Kn;if(r&&(n=a?r(t,o,a,s):r(t)),n!==void 0)return n;if(!P(t))return t;var x=T(t);if(x){if(n=Rr(t),!i)return de(t,n)}else{var v=it(t),j=v==Yr||v==qn;if(vt(t))return Tr(t,i);if(v==Zr||v==Vr||j&&!a){if(n=f||j?{}:zr(t),!i)return f?jr(t,xr(n,t)):Ar(t,hr(n,t))}else{if(!c[v])return a?t:{};n=Ur(t,v,i)}}s||(s=new cr);var O=s.get(t);if(O)return O;s.set(t,n),qr(t)?t.forEach(function(b){n.add(Et(b,e,r,b,t,s))}):Wr(t)&&t.forEach(function(b,p){n.set(p,Et(b,e,r,p,t,s))});var y=m?f?Sr:Pr:f?J:Z,_=x?void 0:y(t);return ye(_||t,function(b,p){_&&(p=b,b=t[p]),$(n,p,Et(b,e,r,p,t,s))}),n}var Jr=Et;var df=1,cf=4;function hf(t){return Jr(t,df|cf)}var kt=hf;function xf(t,e){return t!=null&&e in Object(t)}var Xr=xf;function gf(t,e,r){e=D(e,t);for(var o=-1,a=e.length,s=!1;++o<a;){var n=et(e[o]);if(!(s=t!=null&&r(t,n)))break;t=t[n]}return s||++o!=a?s:(a=t==null?0:t.length,!!a&&H(a)&&W(n,a)&&(T(t)||V(t)))}var Qr=gf;function yf(t,e){return t!=null&&Qr(t,e,Xr)}var to=yf;function bf(t,e,r,o){if(!P(t))return t;e=D(e,t);for(var a=-1,s=e.length,n=s-1,i=t;i!=null&&++a<s;){var f=et(e[a]),m=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return t;if(a!=n){var x=i[f];m=o?o(x,f,i):void 0,m===void 0&&(m=P(x)?x:W(e[a+1])?[]:{})}$(i,f,m),i=i[f]}return t}var eo=bf;function vf(t,e,r){for(var o=-1,a=e.length,s={};++o<a;){var n=e[o],i=rr(t,n);r(i,n)&&eo(s,D(n,t),i)}return s}var ro=vf;function Tf(t,e){return ro(t,e,function(r,o){return to(t,o)})}var oo=Tf;var wf=fr(function(t,e){return t==null?{}:oo(t,e)}),Ct=wf;function ao(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 io="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Dt=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=io[r[t]&63];return e};var Of="array",Af="bit",so="bits",jf="byte",no="bytes",nt="",Pf="exponent",Sf="function",fo="iec",If="Invalid number",_f="Invalid rounding method",Ut="jedec",Ef="object",po=".",Cf="round",Ff="s",Rf="si",Mf="kbit",Nf="kB",Lf=" ",Bf="string",kf="0",zt={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 lo(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:s=nt,localeOptions:n={},separator:i=nt,spacer:f=Lf,symbols:m={},standard:x=nt,output:v=Bf,fullform:j=!1,fullforms:O=[],exponent:y=-1,roundingMethod:_=Cf,precision:b=0}={}){let p=y,u=Number(t),l=[],E=0,Ft=nt;x===Rf?(o=10,x=Ut):x===fo||x===Ut?o=2:o===2?x=fo:(o=10,x=Ut);let ut=o===10?1e3:1024,mo=j===!0,Gt=u<0,Wt=Math[_];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(If);if(typeof Wt!==Sf)throw new TypeError(_f);if(Gt&&(u=-u),(p===-1||isNaN(p))&&(p=Math.floor(Math.log(u)/Math.log(ut)),p<0&&(p=0)),p>8&&(b>0&&(b+=8-p),p=8),v===Pf)return p;if(u===0)l[0]=0,Ft=l[1]=zt.symbol[x][e?so:no][p];else{E=u/(o===2?Math.pow(2,p*10):Math.pow(1e3,p)),e&&(E=E*8,E>=ut&&p<8&&(E=E/ut,p++));let ft=Math.pow(10,p>0?a:0);l[0]=Wt(E*ft)/ft,l[0]===ut&&p<8&&y===-1&&(l[0]=1,p++),Ft=l[1]=o===10&&p===1?e?Mf:Nf:zt.symbol[x][e?so:no][p]}if(Gt&&(l[0]=-l[0]),b>0&&(l[0]=l[0].toPrecision(b)),l[1]=m[l[1]]||l[1],s===!0?l[0]=l[0].toLocaleString():s.length>0?l[0]=l[0].toLocaleString(s,n):i.length>0&&(l[0]=l[0].toString().replace(po,i)),r&&Number.isInteger(l[0])===!1&&a>0){let ft=i||po,$t=l[0].toString().split(ft),Ht=$t[1]||nt,qt=Ht.length,uo=a-qt;l[0]=`${$t[0]}${ft}${Ht.padEnd(qt+uo,kf)}`}return mo&&(l[1]=O[p]?O[p]:zt.fullform[x][p]+(e?Af:jf)+(l[0]===1?nt:Ff)),v===Of?l:v===Ef?{value:l[0],symbol:l[1],exponent:p,unit:Ft}:l.join(f)}var U=class t{constructor(e){d(this,"_tera");d(this,"id");d(this,"name");d(this,"icon");d(this,"path");d(this,"url");d(this,"teraUrl");d(this,"parsedName");d(this,"created");d(this,"createdFormatted");d(this,"modified");d(this,"modifiedFormatted");d(this,"accessed");d(this,"accessedFormatted");d(this,"size");d(this,"sizeFormatted");d(this,"mime");d(this,"meta",{});if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,e);let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.teraUrl=this.url.replace(/^https:\/\/tera-tools.com\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=lo(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.setProjectFile(this.id,e)}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Ct(this,["id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new t(Ct(e,["tera","id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]))}};var Kt=class{constructor(e){d(this,"settings",{devMode:!0,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",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});d(this,"events",ao());d(this,"dom",{el:null,iframe:null,popup:null,stylesheet:null});d(this,"methods",["handshake","setServerVerbosity","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateFlush","setProjectStateRefresh","saveProjectState","replaceProjectState","applyProjectStatePatch","getProjectFileContents","deleteProjectFile","setProjectFile","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPageUrl","setPageTitle","uiAlert","uiProgress","uiSplat","uiWindow"]);d(this,"plugins",[]);d(this,"acceptPostboxes",{});e&&this.set(e)}send(e){let r=Dt();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||Dt(),...kt(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;let r=e.data;if(!(!r.TERA||!r.id))if(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);else{if((r==null?void 0:r.action)=="rpc")return 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()})});if((r==null?void 0:r.action)=="event")return 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?`):this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r})}}createProjectStatePatch(e,r){let o=Vt(r,e,Yt);return this.debug("INFO",3,"Created project patch",{patch:o,newState:e,oldState:r}),this.applyProjectStatePatch(o)}applyProjectStatePatchLocal(e){throw new Error("applyProjectStatePatchLocal() has not been sub-classed by a plugin")}init(e){if(e&&this.set(e),this.init.promise)return this.init.promise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.init.promise=Promise.resolve().then(()=>this.debug("INFO",4,"[0/6] Init using server",this.settings.siteUrl)).then(()=>this.detectMode()).then(o=>{this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o}).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")).catch(o=>this.debug("WARN",0,"Init process fault",o))}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(),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e())})).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":this.debug("INFO",2,"Using TERA window parent");break;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 s=0,n,i=setTimeout(()=>a("TIMEOUT"),r.handshakeTimeout),f=()=>{this.debug("INFO",4,"Trying handshake",++s),clearTimeout(n),n=setTimeout(f,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(i),clearTimeout(n)}).then(()=>o()).catch(a)};f()})}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;","&.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;","}","}","&: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
|
+
`),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){if(typeof e!="function")throw new Error("Expected use() call to be provided with a class initalizer");let o=new e(this,r);return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(o=>!["constructor","prototype","name"].includes(o)).filter(o=>o!="init").forEach(o=>{Object.defineProperty(e,o,{value:r[o].bind(e),enumerable:!1})})}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.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)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new U({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new U({tera:this,...o})))}getProjectFile(e){return this.rpc("getProjectFile",e).then(r=>r&&new U({tera:this,...r}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new U({tera:this,...r}))}};export{Kt as default};
|
|
3
3
|
/*! Bundled license information:
|
|
4
4
|
|
|
5
5
|
lodash-es/lodash.js:
|
package/dist/terafy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
function qt(t,e,r){if(!t||typeof t!="object"||!e||typeof e!="object")throw new Error("both arguments must be objects or arrays");r||(r=function(i){return i});function o({obj1:i,obj2:f,basePath:m,basePathForRemoves:h,diffs:b}){var P=Object.keys(i),T=P.length,g=Object.keys(f),I=g.length,y,p=i.length-f.length;if(co(i,f)){for(var u=0;u<T;u++){var l=Array.isArray(i)?Number(P[u]):P[u];l in f||(y=h.concat(l),b.remove.push({op:"remove",path:r(y)}))}for(var u=0;u<I;u++){var l=Array.isArray(f)?Number(g[u]):g[u];s({key:l,obj1:i,obj2:f,path:m.concat(l),pathForRemoves:m.concat(l),diffs:b})}}else{for(var u=0;u<p;u++)y=h.concat(u),b.remove.push({op:"remove",path:r(y)});for(var _=i.slice(p),u=0;u<I;u++)s({key:u,obj1:_,obj2:f,path:m.concat(u),pathForRemoves:m.concat(u+p),diffs:b})}}var a={remove:[],replace:[],add:[]};return o({obj1:t,obj2:e,basePath:[],basePathForRemoves:[],diffs:a}),a.remove.reverse().concat(a.replace).concat(a.add);function s({key:i,obj1:f,obj2:m,path:h,pathForRemoves:b,diffs:P}){var T=f[i],g=m[i];if(!(i in f)&&i in m){var I=g;P.add.push({op:"add",path:r(h),value:I})}else T!==g&&(Object(T)!==T||Object(g)!==g||uo(T,g)||!Object.keys(T).length&&!Object.keys(g).length&&String(T)!=String(g)?n(h,P,g):o({obj1:f[i],obj2:m[i],basePath:h,basePathForRemoves:b,diffs:P}))}function n(i,f,m){f.replace.push({op:"replace",path:r(i),value:m})}}function Vt(t){return[""].concat(t).join("/")}function uo(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function co(t,e){var r=t.length-e.length;if(Array.isArray(t)&&Array.isArray(e)&&r>0){for(var o=0,a=0,s=0;s<e.length&&String(t[s])===String(e[s]);s++)o++;for(var n=e.length;n>0&&String(t[n+r])===String(e[n]);n--)a++;return o>=a}return!0}var ho=typeof global=="object"&&global&&global.Object===Object&&global,ut=ho;var xo=typeof self=="object"&&self&&self.Object===Object&&self,go=ut||xo||Function("return this")(),x=go;var yo=x.Symbol,w=yo;var Yt=Object.prototype,bo=Yt.hasOwnProperty,vo=Yt.toString,ft=w?w.toStringTag:void 0;function wo(t){var e=bo.call(t,ft),r=t[ft];try{t[ft]=void 0;var o=!0}catch{}var a=vo.call(t);return o&&(e?t[ft]=r:delete t[ft]),a}var Zt=wo;var To=Object.prototype,Oo=To.toString;function Po(t){return Oo.call(t)}var Jt=Po;var jo="[object Null]",So="[object Undefined]",Xt=w?w.toStringTag:void 0;function Ao(t){return t==null?t===void 0?So:jo:Xt&&Xt in Object(t)?Zt(t):Jt(t)}var A=Ao;function Io(t){return t!=null&&typeof t=="object"}var S=Io;var _o="[object Symbol]";function Eo(t){return typeof t=="symbol"||S(t)&&A(t)==_o}var K=Eo;function Co(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 Qt=Co;var Fo=Array.isArray,v=Fo;var Mo=1/0,te=w?w.prototype:void 0,ee=te?te.toString:void 0;function re(t){if(typeof t=="string")return t;if(v(t))return Qt(t,re)+"";if(K(t))return ee?ee.call(t):"";var e=t+"";return e=="0"&&1/t==-Mo?"-0":e}var oe=re;function No(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var j=No;function Ro(t){return t}var ae=Ro;var Lo="[object AsyncFunction]",Bo="[object Function]",ko="[object GeneratorFunction]",Do="[object Proxy]";function Uo(t){if(!j(t))return!1;var e=A(t);return e==Bo||e==ko||e==Lo||e==Do}var dt=Uo;var Ko=x["__core-js_shared__"],ct=Ko;var ie=function(){var t=/[^.]+$/.exec(ct&&ct.keys&&ct.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function zo(t){return!!ie&&ie in t}var se=zo;var Go=Function.prototype,Wo=Go.toString;function $o(t){if(t!=null){try{return Wo.call(t)}catch{}try{return t+""}catch{}}return""}var E=$o;var Ho=/[\\^$.*+?()[\]{}|]/g,qo=/^\[object .+?Constructor\]$/,Vo=Function.prototype,Yo=Object.prototype,Zo=Vo.toString,Jo=Yo.hasOwnProperty,Xo=RegExp("^"+Zo.call(Jo).replace(Ho,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Qo(t){if(!j(t)||se(t))return!1;var e=dt(t)?Xo:qo;return e.test(E(t))}var ne=Qo;function ta(t,e){return t?.[e]}var fe=ta;function ea(t,e){var r=fe(t,e);return ne(r)?r:void 0}var O=ea;var ra=O(x,"WeakMap"),ht=ra;var pe=Object.create,oa=function(){function t(){}return function(e){if(!j(e))return{};if(pe)return pe(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),le=oa;function aa(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 me=aa;function ia(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var ue=ia;var sa=800,na=16,fa=Date.now;function pa(t){var e=0,r=0;return function(){var o=fa(),a=na-(o-r);if(r=o,a>0){if(++e>=sa)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var de=pa;function la(t){return function(){return t}}var ce=la;var ma=function(){try{var t=O(Object,"defineProperty");return t({},"",{}),t}catch{}}(),z=ma;var ua=z?function(t,e){return z(t,"toString",{configurable:!0,enumerable:!1,value:ce(e),writable:!0})}:ae,he=ua;var da=de(he),xe=da;function ca(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var ge=ca;var ha=9007199254740991,xa=/^(?:0|[1-9]\d*)$/;function ga(t,e){var r=typeof t;return e=e??ha,!!e&&(r=="number"||r!="symbol"&&xa.test(t))&&t>-1&&t%1==0&&t<e}var G=ga;function ya(t,e,r){e=="__proto__"&&z?z(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var xt=ya;function ba(t,e){return t===e||t!==t&&e!==e}var gt=ba;var va=Object.prototype,wa=va.hasOwnProperty;function Ta(t,e,r){var o=t[e];(!(wa.call(t,e)&>(o,r))||r===void 0&&!(e in t))&&xt(t,e,r)}var W=Ta;function Oa(t,e,r,o){var a=!r;r||(r={});for(var s=-1,n=e.length;++s<n;){var i=e[s],f=o?o(r[i],t[i],i,r,t):void 0;f===void 0&&(f=t[i]),a?xt(r,i,f):W(r,i,f)}return r}var M=Oa;var ye=Math.max;function Pa(t,e,r){return e=ye(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=ye(o.length-e,0),n=Array(s);++a<s;)n[a]=o[e+a];a=-1;for(var i=Array(e+1);++a<e;)i[a]=o[a];return i[e]=r(n),me(t,this,i)}}var be=Pa;var ja=9007199254740991;function Sa(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=ja}var $=Sa;function Aa(t){return t!=null&&$(t.length)&&!dt(t)}var yt=Aa;var Ia=Object.prototype;function _a(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Ia;return t===r}var H=_a;function Ea(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var ve=Ea;var Ca="[object Arguments]";function Fa(t){return S(t)&&A(t)==Ca}var Ft=Fa;var we=Object.prototype,Ma=we.hasOwnProperty,Na=we.propertyIsEnumerable,Ra=Ft(function(){return arguments}())?Ft:function(t){return S(t)&&Ma.call(t,"callee")&&!Na.call(t,"callee")},q=Ra;function La(){return!1}var Te=La;var je=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Oe=je&&typeof module=="object"&&module&&!module.nodeType&&module,Ba=Oe&&Oe.exports===je,Pe=Ba?x.Buffer:void 0,ka=Pe?Pe.isBuffer:void 0,Da=ka||Te,bt=Da;var Ua="[object Arguments]",Ka="[object Array]",za="[object Boolean]",Ga="[object Date]",Wa="[object Error]",$a="[object Function]",Ha="[object Map]",qa="[object Number]",Va="[object Object]",Ya="[object RegExp]",Za="[object Set]",Ja="[object String]",Xa="[object WeakMap]",Qa="[object ArrayBuffer]",ti="[object DataView]",ei="[object Float32Array]",ri="[object Float64Array]",oi="[object Int8Array]",ai="[object Int16Array]",ii="[object Int32Array]",si="[object Uint8Array]",ni="[object Uint8ClampedArray]",fi="[object Uint16Array]",pi="[object Uint32Array]",c={};c[ei]=c[ri]=c[oi]=c[ai]=c[ii]=c[si]=c[ni]=c[fi]=c[pi]=!0;c[Ua]=c[Ka]=c[Qa]=c[za]=c[ti]=c[Ga]=c[Wa]=c[$a]=c[Ha]=c[qa]=c[Va]=c[Ya]=c[Za]=c[Ja]=c[Xa]=!1;function li(t){return S(t)&&$(t.length)&&!!c[A(t)]}var Se=li;function mi(t){return function(e){return t(e)}}var V=mi;var Ae=typeof exports=="object"&&exports&&!exports.nodeType&&exports,pt=Ae&&typeof module=="object"&&module&&!module.nodeType&&module,ui=pt&&pt.exports===Ae,Mt=ui&&ut.process,di=function(){try{var t=pt&&pt.require&&pt.require("util").types;return t||Mt&&Mt.binding&&Mt.binding("util")}catch{}}(),C=di;var Ie=C&&C.isTypedArray,ci=Ie?V(Ie):Se,_e=ci;var hi=Object.prototype,xi=hi.hasOwnProperty;function gi(t,e){var r=v(t),o=!r&&q(t),a=!r&&!o&&bt(t),s=!r&&!o&&!a&&_e(t),n=r||o||a||s,i=n?ve(t.length,String):[],f=i.length;for(var m in t)(e||xi.call(t,m))&&!(n&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||G(m,f)))&&i.push(m);return i}var vt=gi;function yi(t,e){return function(r){return t(e(r))}}var wt=yi;var bi=wt(Object.keys,Object),Ee=bi;var vi=Object.prototype,wi=vi.hasOwnProperty;function Ti(t){if(!H(t))return Ee(t);var e=[];for(var r in Object(t))wi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ce=Ti;function Oi(t){return yt(t)?vt(t):Ce(t)}var Y=Oi;function Pi(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Fe=Pi;var ji=Object.prototype,Si=ji.hasOwnProperty;function Ai(t){if(!j(t))return Fe(t);var e=H(t),r=[];for(var o in t)o=="constructor"&&(e||!Si.call(t,o))||r.push(o);return r}var Me=Ai;function Ii(t){return yt(t)?vt(t,!0):Me(t)}var Z=Ii;var _i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ei=/^\w*$/;function Ci(t,e){if(v(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||K(t)?!0:Ei.test(t)||!_i.test(t)||e!=null&&t in Object(e)}var Ne=Ci;var Fi=O(Object,"create"),F=Fi;function Mi(){this.__data__=F?F(null):{},this.size=0}var Re=Mi;function Ni(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Le=Ni;var Ri="__lodash_hash_undefined__",Li=Object.prototype,Bi=Li.hasOwnProperty;function ki(t){var e=this.__data__;if(F){var r=e[t];return r===Ri?void 0:r}return Bi.call(e,t)?e[t]:void 0}var Be=ki;var Di=Object.prototype,Ui=Di.hasOwnProperty;function Ki(t){var e=this.__data__;return F?e[t]!==void 0:Ui.call(e,t)}var ke=Ki;var zi="__lodash_hash_undefined__";function Gi(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=F&&e===void 0?zi:e,this}var De=Gi;function J(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])}}J.prototype.clear=Re;J.prototype.delete=Le;J.prototype.get=Be;J.prototype.has=ke;J.prototype.set=De;var Nt=J;function Wi(){this.__data__=[],this.size=0}var Ue=Wi;function $i(t,e){for(var r=t.length;r--;)if(gt(t[r][0],e))return r;return-1}var N=$i;var Hi=Array.prototype,qi=Hi.splice;function Vi(t){var e=this.__data__,r=N(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():qi.call(e,r,1),--this.size,!0}var Ke=Vi;function Yi(t){var e=this.__data__,r=N(e,t);return r<0?void 0:e[r][1]}var ze=Yi;function Zi(t){return N(this.__data__,t)>-1}var Ge=Zi;function Ji(t,e){var r=this.__data__,o=N(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var We=Ji;function X(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])}}X.prototype.clear=Ue;X.prototype.delete=Ke;X.prototype.get=ze;X.prototype.has=Ge;X.prototype.set=We;var R=X;var Xi=O(x,"Map"),L=Xi;function Qi(){this.size=0,this.__data__={hash:new Nt,map:new(L||R),string:new Nt}}var $e=Qi;function ts(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var He=ts;function es(t,e){var r=t.__data__;return He(e)?r[typeof e=="string"?"string":"hash"]:r.map}var B=es;function rs(t){var e=B(this,t).delete(t);return this.size-=e?1:0,e}var qe=rs;function os(t){return B(this,t).get(t)}var Ve=os;function as(t){return B(this,t).has(t)}var Ye=as;function is(t,e){var r=B(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ze=is;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=$e;Q.prototype.delete=qe;Q.prototype.get=Ve;Q.prototype.has=Ye;Q.prototype.set=Ze;var lt=Q;var ss="Expected a function";function Rt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(ss);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],s=r.cache;if(s.has(a))return s.get(a);var n=t.apply(this,o);return r.cache=s.set(a,n)||s,n};return r.cache=new(Rt.Cache||lt),r}Rt.Cache=lt;var Je=Rt;var ns=500;function fs(t){var e=Je(t,function(o){return r.size===ns&&r.clear(),o}),r=e.cache;return e}var Xe=fs;var ps=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ls=/\\(\\)?/g,ms=Xe(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(ps,function(r,o,a,s){e.push(a?s.replace(ls,"$1"):o||r)}),e}),Qe=ms;function us(t){return t==null?"":oe(t)}var tr=us;function ds(t,e){return v(t)?t:Ne(t,e)?[t]:Qe(tr(t))}var k=ds;var cs=1/0;function hs(t){if(typeof t=="string"||K(t))return t;var e=t+"";return e=="0"&&1/t==-cs?"-0":e}var tt=hs;function xs(t,e){e=k(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[tt(e[r++])];return r&&r==o?t:void 0}var er=xs;function gs(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var et=gs;var rr=w?w.isConcatSpreadable:void 0;function ys(t){return v(t)||q(t)||!!(rr&&t&&t[rr])}var or=ys;function ar(t,e,r,o,a){var s=-1,n=t.length;for(r||(r=or),a||(a=[]);++s<n;){var i=t[s];e>0&&r(i)?e>1?ar(i,e-1,r,o,a):et(a,i):o||(a[a.length]=i)}return a}var ir=ar;function bs(t){var e=t==null?0:t.length;return e?ir(t,1):[]}var sr=bs;function vs(t){return xe(be(t,void 0,sr),t+"")}var nr=vs;var ws=wt(Object.getPrototypeOf,Object),Tt=ws;function Ts(){this.__data__=new R,this.size=0}var fr=Ts;function Os(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var pr=Os;function Ps(t){return this.__data__.get(t)}var lr=Ps;function js(t){return this.__data__.has(t)}var mr=js;var Ss=200;function As(t,e){var r=this.__data__;if(r instanceof R){var o=r.__data__;if(!L||o.length<Ss-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new lt(o)}return r.set(t,e),this.size=r.size,this}var ur=As;function rt(t){var e=this.__data__=new R(t);this.size=e.size}rt.prototype.clear=fr;rt.prototype.delete=pr;rt.prototype.get=lr;rt.prototype.has=mr;rt.prototype.set=ur;var dr=rt;function Is(t,e){return t&&M(e,Y(e),t)}var cr=Is;function _s(t,e){return t&&M(e,Z(e),t)}var hr=_s;var br=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xr=br&&typeof module=="object"&&module&&!module.nodeType&&module,Es=xr&&xr.exports===br,gr=Es?x.Buffer:void 0,yr=gr?gr.allocUnsafe:void 0;function Cs(t,e){if(e)return t.slice();var r=t.length,o=yr?yr(r):new t.constructor(r);return t.copy(o),o}var vr=Cs;function Fs(t,e){for(var r=-1,o=t==null?0:t.length,a=0,s=[];++r<o;){var n=t[r];e(n,r,t)&&(s[a++]=n)}return s}var wr=Fs;function Ms(){return[]}var Ot=Ms;var Ns=Object.prototype,Rs=Ns.propertyIsEnumerable,Tr=Object.getOwnPropertySymbols,Ls=Tr?function(t){return t==null?[]:(t=Object(t),wr(Tr(t),function(e){return Rs.call(t,e)}))}:Ot,ot=Ls;function Bs(t,e){return M(t,ot(t),e)}var Or=Bs;var ks=Object.getOwnPropertySymbols,Ds=ks?function(t){for(var e=[];t;)et(e,ot(t)),t=Tt(t);return e}:Ot,Pt=Ds;function Us(t,e){return M(t,Pt(t),e)}var Pr=Us;function Ks(t,e,r){var o=e(t);return v(t)?o:et(o,r(t))}var jt=Ks;function zs(t){return jt(t,Y,ot)}var jr=zs;function Gs(t){return jt(t,Z,Pt)}var Sr=Gs;var Ws=O(x,"DataView"),St=Ws;var $s=O(x,"Promise"),At=$s;var Hs=O(x,"Set"),It=Hs;var Ar="[object Map]",qs="[object Object]",Ir="[object Promise]",_r="[object Set]",Er="[object WeakMap]",Cr="[object DataView]",Vs=E(St),Ys=E(L),Zs=E(At),Js=E(It),Xs=E(ht),U=A;(St&&U(new St(new ArrayBuffer(1)))!=Cr||L&&U(new L)!=Ar||At&&U(At.resolve())!=Ir||It&&U(new It)!=_r||ht&&U(new ht)!=Er)&&(U=function(t){var e=A(t),r=e==qs?t.constructor:void 0,o=r?E(r):"";if(o)switch(o){case Vs:return Cr;case Ys:return Ar;case Zs:return Ir;case Js:return _r;case Xs:return Er}return e});var at=U;var Qs=Object.prototype,tn=Qs.hasOwnProperty;function en(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&tn.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Fr=en;var rn=x.Uint8Array,Lt=rn;function on(t){var e=new t.constructor(t.byteLength);return new Lt(e).set(new Lt(t)),e}var it=on;function an(t,e){var r=e?it(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Mr=an;var sn=/\w*$/;function nn(t){var e=new t.constructor(t.source,sn.exec(t));return e.lastIndex=t.lastIndex,e}var Nr=nn;var Rr=w?w.prototype:void 0,Lr=Rr?Rr.valueOf:void 0;function fn(t){return Lr?Object(Lr.call(t)):{}}var Br=fn;function pn(t,e){var r=e?it(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var kr=pn;var ln="[object Boolean]",mn="[object Date]",un="[object Map]",dn="[object Number]",cn="[object RegExp]",hn="[object Set]",xn="[object String]",gn="[object Symbol]",yn="[object ArrayBuffer]",bn="[object DataView]",vn="[object Float32Array]",wn="[object Float64Array]",Tn="[object Int8Array]",On="[object Int16Array]",Pn="[object Int32Array]",jn="[object Uint8Array]",Sn="[object Uint8ClampedArray]",An="[object Uint16Array]",In="[object Uint32Array]";function _n(t,e,r){var o=t.constructor;switch(e){case yn:return it(t);case ln:case mn:return new o(+t);case bn:return Mr(t,r);case vn:case wn:case Tn:case On:case Pn:case jn:case Sn:case An:case In:return kr(t,r);case un:return new o;case dn:case xn:return new o(t);case cn:return Nr(t);case hn:return new o;case gn:return Br(t)}}var Dr=_n;function En(t){return typeof t.constructor=="function"&&!H(t)?le(Tt(t)):{}}var Ur=En;var Cn="[object Map]";function Fn(t){return S(t)&&at(t)==Cn}var Kr=Fn;var zr=C&&C.isMap,Mn=zr?V(zr):Kr,Gr=Mn;var Nn="[object Set]";function Rn(t){return S(t)&&at(t)==Nn}var Wr=Rn;var $r=C&&C.isSet,Ln=$r?V($r):Wr,Hr=Ln;var Bn=1,kn=2,Dn=4,qr="[object Arguments]",Un="[object Array]",Kn="[object Boolean]",zn="[object Date]",Gn="[object Error]",Vr="[object Function]",Wn="[object GeneratorFunction]",$n="[object Map]",Hn="[object Number]",Yr="[object Object]",qn="[object RegExp]",Vn="[object Set]",Yn="[object String]",Zn="[object Symbol]",Jn="[object WeakMap]",Xn="[object ArrayBuffer]",Qn="[object DataView]",tf="[object Float32Array]",ef="[object Float64Array]",rf="[object Int8Array]",of="[object Int16Array]",af="[object Int32Array]",sf="[object Uint8Array]",nf="[object Uint8ClampedArray]",ff="[object Uint16Array]",pf="[object Uint32Array]",d={};d[qr]=d[Un]=d[Xn]=d[Qn]=d[Kn]=d[zn]=d[tf]=d[ef]=d[rf]=d[of]=d[af]=d[$n]=d[Hn]=d[Yr]=d[qn]=d[Vn]=d[Yn]=d[Zn]=d[sf]=d[nf]=d[ff]=d[pf]=!0;d[Gn]=d[Vr]=d[Jn]=!1;function _t(t,e,r,o,a,s){var n,i=e&Bn,f=e&kn,m=e&Dn;if(r&&(n=a?r(t,o,a,s):r(t)),n!==void 0)return n;if(!j(t))return t;var h=v(t);if(h){if(n=Fr(t),!i)return ue(t,n)}else{var b=at(t),P=b==Vr||b==Wn;if(bt(t))return vr(t,i);if(b==Yr||b==qr||P&&!a){if(n=f||P?{}:Ur(t),!i)return f?Pr(t,hr(n,t)):Or(t,cr(n,t))}else{if(!d[b])return a?t:{};n=Dr(t,b,i)}}s||(s=new dr);var T=s.get(t);if(T)return T;s.set(t,n),Hr(t)?t.forEach(function(y){n.add(_t(y,e,r,y,t,s))}):Gr(t)&&t.forEach(function(y,p){n.set(p,_t(y,e,r,p,t,s))});var g=m?f?Sr:jr:f?Z:Y,I=h?void 0:g(t);return ge(I||t,function(y,p){I&&(p=y,y=t[p]),W(n,p,_t(y,e,r,p,t,s))}),n}var Zr=_t;var lf=1,mf=4;function uf(t){return Zr(t,lf|mf)}var Bt=uf;function df(t,e){return t!=null&&e in Object(t)}var Jr=df;function cf(t,e,r){e=k(e,t);for(var o=-1,a=e.length,s=!1;++o<a;){var n=tt(e[o]);if(!(s=t!=null&&r(t,n)))break;t=t[n]}return s||++o!=a?s:(a=t==null?0:t.length,!!a&&$(a)&&G(n,a)&&(v(t)||q(t)))}var Xr=cf;function hf(t,e){return t!=null&&Xr(t,e,Jr)}var Qr=hf;function xf(t,e,r,o){if(!j(t))return t;e=k(e,t);for(var a=-1,s=e.length,n=s-1,i=t;i!=null&&++a<s;){var f=tt(e[a]),m=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return t;if(a!=n){var h=i[f];m=o?o(h,f,i):void 0,m===void 0&&(m=j(h)?h:G(e[a+1])?[]:{})}W(i,f,m),i=i[f]}return t}var to=xf;function gf(t,e,r){for(var o=-1,a=e.length,s={};++o<a;){var n=e[o],i=er(t,n);r(i,n)&&to(s,k(n,t),i)}return s}var eo=gf;function yf(t,e){return eo(t,e,function(r,o){return Qr(t,o)})}var ro=yf;var bf=nr(function(t,e){return t==null?{}:ro(t,e)}),Et=bf;function oo(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 ao="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var kt=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=ao[r[t]&63];return e};var vf="array",wf="bit",io="bits",Tf="byte",so="bytes",st="",Of="exponent",Pf="function",no="iec",jf="Invalid number",Sf="Invalid rounding method",Dt="jedec",Af="object",fo=".",If="round",_f="s",Ef="si",Cf="kbit",Ff="kB",Mf=" ",Nf="string",Rf="0",Ut={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 po(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:s=st,localeOptions:n={},separator:i=st,spacer:f=Mf,symbols:m={},standard:h=st,output:b=Nf,fullform:P=!1,fullforms:T=[],exponent:g=-1,roundingMethod:I=If,precision:y=0}={}){let p=g,u=Number(t),l=[],_=0,Ct=st;h===Ef?(o=10,h=Dt):h===no||h===Dt?o=2:o===2?h=no:(o=10,h=Dt);let mt=o===10?1e3:1024,lo=P===!0,zt=u<0,Gt=Math[I];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(jf);if(typeof Gt!==Pf)throw new TypeError(Sf);if(zt&&(u=-u),(p===-1||isNaN(p))&&(p=Math.floor(Math.log(u)/Math.log(mt)),p<0&&(p=0)),p>8&&(y>0&&(y+=8-p),p=8),b===Of)return p;if(u===0)l[0]=0,Ct=l[1]=Ut.symbol[h][e?io:so][p];else{_=u/(o===2?Math.pow(2,p*10):Math.pow(1e3,p)),e&&(_=_*8,_>=mt&&p<8&&(_=_/mt,p++));let nt=Math.pow(10,p>0?a:0);l[0]=Gt(_*nt)/nt,l[0]===mt&&p<8&&g===-1&&(l[0]=1,p++),Ct=l[1]=o===10&&p===1?e?Cf:Ff:Ut.symbol[h][e?io:so][p]}if(zt&&(l[0]=-l[0]),y>0&&(l[0]=l[0].toPrecision(y)),l[1]=m[l[1]]||l[1],s===!0?l[0]=l[0].toLocaleString():s.length>0?l[0]=l[0].toLocaleString(s,n):i.length>0&&(l[0]=l[0].toString().replace(fo,i)),r&&Number.isInteger(l[0])===!1&&a>0){let nt=i||fo,Wt=l[0].toString().split(nt),$t=Wt[1]||st,Ht=$t.length,mo=a-Ht;l[0]=`${Wt[0]}${nt}${$t.padEnd(Ht+mo,Rf)}`}return lo&&(l[1]=T[p]?T[p]:Ut.fullform[h][p]+(e?wf:Tf)+(l[0]===1?st:_f)),b===vf?l:b===Af?{value:l[0],symbol:l[1],exponent:p,unit:Ct}:l.join(f)}var D=class t{_tera;id;name;icon;path;url;teraUrl;parsedName;created;createdFormatted;modified;modifiedFormatted;accessed;accessedFormatted;size;sizeFormatted;mime;meta={};constructor(e){if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,e);let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.teraUrl=this.url.replace(/^https:\/\/tera-tools.com\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=po(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.setProjectFile(this.id,e)}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Et(this,["id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new t(Et(e,["tera","id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]))}};var Kt=class{settings={devMode:!0,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",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};events=oo();dom={el:null,iframe:null,popup:null,stylesheet:null};methods=["handshake","setServerVerbosity","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateFlush","setProjectStateRefresh","saveProjectState","replaceProjectState","applyProjectStatePatch","getProjectFileContents","deleteProjectFile","setProjectFile","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPageUrl","setPageTitle","uiAlert","uiProgress","uiSplat","uiWindow"];plugins=[];send(e){let r=kt();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||kt(),...Bt(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;let r=e.data;if(!(!r.TERA||!r.id))if(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);else{if(r?.action=="rpc")return 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()})});if(r?.action=="event")return 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?`):this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r})}}acceptPostboxes={};createProjectStatePatch(e,r){let o=qt(r,e,Vt);return this.debug("INFO",3,"Created project patch",{newState:e,oldState:r}),this.applyProjectStatePatch(o)}applyProjectStatePatchLocal(e){throw new Error("applyProjectStatePatchLocal() has not been sub-classed by a plugin")}constructor(e){e&&this.set(e)}init(e){if(e&&this.set(e),this.init.promise)return this.init.promise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.init.promise=Promise.resolve().then(()=>this.debug("INFO",4,"[0/6] Init using server",this.settings.siteUrl)).then(()=>this.detectMode()).then(o=>{this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o}).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")).catch(o=>this.debug("WARN",0,"Init process fault",o))}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(),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e())})).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),document.body.append(this.dom.el),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":this.debug("INFO",2,"Using TERA window parent");break;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 s=0,n,i=setTimeout(()=>a("TIMEOUT"),r.handshakeTimeout),f=()=>{this.debug("INFO",4,"Trying handshake",++s),clearTimeout(n),n=setTimeout(f,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(i),clearTimeout(n)}).then(()=>o()).catch(a)};f()})}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;","&.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
|
-
`),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){if(typeof e!="function")throw new Error("Expected use() call to be provided with a class initalizer");let o=new e(this,r);return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(o=>!["constructor","prototype","name"].includes(o)).filter(o=>o!="init").forEach(o=>{Object.defineProperty(e,o,{value:r[o].bind(e),enumerable:!1})})}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.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)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new D({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new D({tera:this,...o})))}getProjectFile(e){return this.rpc("getProjectFile",e).then(r=>r&&new D({tera:this,...r}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new D({tera:this,...r}))}};export{
|
|
1
|
+
function qt(t,e,r){if(!t||typeof t!="object"||!e||typeof e!="object")throw new Error("both arguments must be objects or arrays");r||(r=function(i){return i});function o({obj1:i,obj2:f,basePath:m,basePathForRemoves:h,diffs:b}){var A=Object.keys(i),w=A.length,g=Object.keys(f),I=g.length,y,p=i.length-f.length;if(co(i,f)){for(var u=0;u<w;u++){var l=Array.isArray(i)?Number(A[u]):A[u];l in f||(y=h.concat(l),b.remove.push({op:"remove",path:r(y)}))}for(var u=0;u<I;u++){var l=Array.isArray(f)?Number(g[u]):g[u];s({key:l,obj1:i,obj2:f,path:m.concat(l),pathForRemoves:m.concat(l),diffs:b})}}else{for(var u=0;u<p;u++)y=h.concat(u),b.remove.push({op:"remove",path:r(y)});for(var _=i.slice(p),u=0;u<I;u++)s({key:u,obj1:_,obj2:f,path:m.concat(u),pathForRemoves:m.concat(u+p),diffs:b})}}var a={remove:[],replace:[],add:[]};return o({obj1:t,obj2:e,basePath:[],basePathForRemoves:[],diffs:a}),a.remove.reverse().concat(a.replace).concat(a.add);function s({key:i,obj1:f,obj2:m,path:h,pathForRemoves:b,diffs:A}){var w=f[i],g=m[i];if(!(i in f)&&i in m){var I=g;A.add.push({op:"add",path:r(h),value:I})}else w!==g&&(Object(w)!==w||Object(g)!==g||uo(w,g)||!Object.keys(w).length&&!Object.keys(g).length&&String(w)!=String(g)?n(h,A,g):o({obj1:f[i],obj2:m[i],basePath:h,basePathForRemoves:b,diffs:A}))}function n(i,f,m){f.replace.push({op:"replace",path:r(i),value:m})}}function Vt(t){return[""].concat(t).join("/")}function uo(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function co(t,e){var r=t.length-e.length;if(Array.isArray(t)&&Array.isArray(e)&&r>0){for(var o=0,a=0,s=0;s<e.length&&String(t[s])===String(e[s]);s++)o++;for(var n=e.length;n>0&&String(t[n+r])===String(e[n]);n--)a++;return o>=a}return!0}var ho=typeof global=="object"&&global&&global.Object===Object&&global,ut=ho;var xo=typeof self=="object"&&self&&self.Object===Object&&self,go=ut||xo||Function("return this")(),x=go;var yo=x.Symbol,T=yo;var Yt=Object.prototype,bo=Yt.hasOwnProperty,vo=Yt.toString,ft=T?T.toStringTag:void 0;function To(t){var e=bo.call(t,ft),r=t[ft];try{t[ft]=void 0;var o=!0}catch{}var a=vo.call(t);return o&&(e?t[ft]=r:delete t[ft]),a}var Zt=To;var wo=Object.prototype,Oo=wo.toString;function Ao(t){return Oo.call(t)}var Jt=Ao;var jo="[object Null]",Po="[object Undefined]",Xt=T?T.toStringTag:void 0;function So(t){return t==null?t===void 0?Po:jo:Xt&&Xt in Object(t)?Zt(t):Jt(t)}var S=So;function Io(t){return t!=null&&typeof t=="object"}var P=Io;var _o="[object Symbol]";function Eo(t){return typeof t=="symbol"||P(t)&&S(t)==_o}var z=Eo;function Co(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 Qt=Co;var Fo=Array.isArray,v=Fo;var Ro=1/0,te=T?T.prototype:void 0,ee=te?te.toString:void 0;function re(t){if(typeof t=="string")return t;if(v(t))return Qt(t,re)+"";if(z(t))return ee?ee.call(t):"";var e=t+"";return e=="0"&&1/t==-Ro?"-0":e}var oe=re;function Mo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var j=Mo;function No(t){return t}var ae=No;var Lo="[object AsyncFunction]",Bo="[object Function]",ko="[object GeneratorFunction]",Do="[object Proxy]";function Uo(t){if(!j(t))return!1;var e=S(t);return e==Bo||e==ko||e==Lo||e==Do}var dt=Uo;var zo=x["__core-js_shared__"],ct=zo;var ie=function(){var t=/[^.]+$/.exec(ct&&ct.keys&&ct.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Ko(t){return!!ie&&ie in t}var se=Ko;var Go=Function.prototype,Wo=Go.toString;function $o(t){if(t!=null){try{return Wo.call(t)}catch{}try{return t+""}catch{}}return""}var E=$o;var Ho=/[\\^$.*+?()[\]{}|]/g,qo=/^\[object .+?Constructor\]$/,Vo=Function.prototype,Yo=Object.prototype,Zo=Vo.toString,Jo=Yo.hasOwnProperty,Xo=RegExp("^"+Zo.call(Jo).replace(Ho,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Qo(t){if(!j(t)||se(t))return!1;var e=dt(t)?Xo:qo;return e.test(E(t))}var ne=Qo;function ta(t,e){return t?.[e]}var fe=ta;function ea(t,e){var r=fe(t,e);return ne(r)?r:void 0}var O=ea;var ra=O(x,"WeakMap"),ht=ra;var pe=Object.create,oa=function(){function t(){}return function(e){if(!j(e))return{};if(pe)return pe(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),le=oa;function aa(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 me=aa;function ia(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var ue=ia;var sa=800,na=16,fa=Date.now;function pa(t){var e=0,r=0;return function(){var o=fa(),a=na-(o-r);if(r=o,a>0){if(++e>=sa)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var de=pa;function la(t){return function(){return t}}var ce=la;var ma=function(){try{var t=O(Object,"defineProperty");return t({},"",{}),t}catch{}}(),K=ma;var ua=K?function(t,e){return K(t,"toString",{configurable:!0,enumerable:!1,value:ce(e),writable:!0})}:ae,he=ua;var da=de(he),xe=da;function ca(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var ge=ca;var ha=9007199254740991,xa=/^(?:0|[1-9]\d*)$/;function ga(t,e){var r=typeof t;return e=e??ha,!!e&&(r=="number"||r!="symbol"&&xa.test(t))&&t>-1&&t%1==0&&t<e}var G=ga;function ya(t,e,r){e=="__proto__"&&K?K(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var xt=ya;function ba(t,e){return t===e||t!==t&&e!==e}var gt=ba;var va=Object.prototype,Ta=va.hasOwnProperty;function wa(t,e,r){var o=t[e];(!(Ta.call(t,e)&>(o,r))||r===void 0&&!(e in t))&&xt(t,e,r)}var W=wa;function Oa(t,e,r,o){var a=!r;r||(r={});for(var s=-1,n=e.length;++s<n;){var i=e[s],f=o?o(r[i],t[i],i,r,t):void 0;f===void 0&&(f=t[i]),a?xt(r,i,f):W(r,i,f)}return r}var R=Oa;var ye=Math.max;function Aa(t,e,r){return e=ye(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=ye(o.length-e,0),n=Array(s);++a<s;)n[a]=o[e+a];a=-1;for(var i=Array(e+1);++a<e;)i[a]=o[a];return i[e]=r(n),me(t,this,i)}}var be=Aa;var ja=9007199254740991;function Pa(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=ja}var $=Pa;function Sa(t){return t!=null&&$(t.length)&&!dt(t)}var yt=Sa;var Ia=Object.prototype;function _a(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Ia;return t===r}var H=_a;function Ea(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var ve=Ea;var Ca="[object Arguments]";function Fa(t){return P(t)&&S(t)==Ca}var Ft=Fa;var Te=Object.prototype,Ra=Te.hasOwnProperty,Ma=Te.propertyIsEnumerable,Na=Ft(function(){return arguments}())?Ft:function(t){return P(t)&&Ra.call(t,"callee")&&!Ma.call(t,"callee")},q=Na;function La(){return!1}var we=La;var je=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Oe=je&&typeof module=="object"&&module&&!module.nodeType&&module,Ba=Oe&&Oe.exports===je,Ae=Ba?x.Buffer:void 0,ka=Ae?Ae.isBuffer:void 0,Da=ka||we,bt=Da;var Ua="[object Arguments]",za="[object Array]",Ka="[object Boolean]",Ga="[object Date]",Wa="[object Error]",$a="[object Function]",Ha="[object Map]",qa="[object Number]",Va="[object Object]",Ya="[object RegExp]",Za="[object Set]",Ja="[object String]",Xa="[object WeakMap]",Qa="[object ArrayBuffer]",ti="[object DataView]",ei="[object Float32Array]",ri="[object Float64Array]",oi="[object Int8Array]",ai="[object Int16Array]",ii="[object Int32Array]",si="[object Uint8Array]",ni="[object Uint8ClampedArray]",fi="[object Uint16Array]",pi="[object Uint32Array]",c={};c[ei]=c[ri]=c[oi]=c[ai]=c[ii]=c[si]=c[ni]=c[fi]=c[pi]=!0;c[Ua]=c[za]=c[Qa]=c[Ka]=c[ti]=c[Ga]=c[Wa]=c[$a]=c[Ha]=c[qa]=c[Va]=c[Ya]=c[Za]=c[Ja]=c[Xa]=!1;function li(t){return P(t)&&$(t.length)&&!!c[S(t)]}var Pe=li;function mi(t){return function(e){return t(e)}}var V=mi;var Se=typeof exports=="object"&&exports&&!exports.nodeType&&exports,pt=Se&&typeof module=="object"&&module&&!module.nodeType&&module,ui=pt&&pt.exports===Se,Rt=ui&&ut.process,di=function(){try{var t=pt&&pt.require&&pt.require("util").types;return t||Rt&&Rt.binding&&Rt.binding("util")}catch{}}(),C=di;var Ie=C&&C.isTypedArray,ci=Ie?V(Ie):Pe,_e=ci;var hi=Object.prototype,xi=hi.hasOwnProperty;function gi(t,e){var r=v(t),o=!r&&q(t),a=!r&&!o&&bt(t),s=!r&&!o&&!a&&_e(t),n=r||o||a||s,i=n?ve(t.length,String):[],f=i.length;for(var m in t)(e||xi.call(t,m))&&!(n&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||G(m,f)))&&i.push(m);return i}var vt=gi;function yi(t,e){return function(r){return t(e(r))}}var Tt=yi;var bi=Tt(Object.keys,Object),Ee=bi;var vi=Object.prototype,Ti=vi.hasOwnProperty;function wi(t){if(!H(t))return Ee(t);var e=[];for(var r in Object(t))Ti.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ce=wi;function Oi(t){return yt(t)?vt(t):Ce(t)}var Y=Oi;function Ai(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Fe=Ai;var ji=Object.prototype,Pi=ji.hasOwnProperty;function Si(t){if(!j(t))return Fe(t);var e=H(t),r=[];for(var o in t)o=="constructor"&&(e||!Pi.call(t,o))||r.push(o);return r}var Re=Si;function Ii(t){return yt(t)?vt(t,!0):Re(t)}var Z=Ii;var _i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ei=/^\w*$/;function Ci(t,e){if(v(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||z(t)?!0:Ei.test(t)||!_i.test(t)||e!=null&&t in Object(e)}var Me=Ci;var Fi=O(Object,"create"),F=Fi;function Ri(){this.__data__=F?F(null):{},this.size=0}var Ne=Ri;function Mi(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Le=Mi;var Ni="__lodash_hash_undefined__",Li=Object.prototype,Bi=Li.hasOwnProperty;function ki(t){var e=this.__data__;if(F){var r=e[t];return r===Ni?void 0:r}return Bi.call(e,t)?e[t]:void 0}var Be=ki;var Di=Object.prototype,Ui=Di.hasOwnProperty;function zi(t){var e=this.__data__;return F?e[t]!==void 0:Ui.call(e,t)}var ke=zi;var Ki="__lodash_hash_undefined__";function Gi(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=F&&e===void 0?Ki:e,this}var De=Gi;function J(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])}}J.prototype.clear=Ne;J.prototype.delete=Le;J.prototype.get=Be;J.prototype.has=ke;J.prototype.set=De;var Mt=J;function Wi(){this.__data__=[],this.size=0}var Ue=Wi;function $i(t,e){for(var r=t.length;r--;)if(gt(t[r][0],e))return r;return-1}var M=$i;var Hi=Array.prototype,qi=Hi.splice;function Vi(t){var e=this.__data__,r=M(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():qi.call(e,r,1),--this.size,!0}var ze=Vi;function Yi(t){var e=this.__data__,r=M(e,t);return r<0?void 0:e[r][1]}var Ke=Yi;function Zi(t){return M(this.__data__,t)>-1}var Ge=Zi;function Ji(t,e){var r=this.__data__,o=M(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var We=Ji;function X(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])}}X.prototype.clear=Ue;X.prototype.delete=ze;X.prototype.get=Ke;X.prototype.has=Ge;X.prototype.set=We;var N=X;var Xi=O(x,"Map"),L=Xi;function Qi(){this.size=0,this.__data__={hash:new Mt,map:new(L||N),string:new Mt}}var $e=Qi;function ts(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var He=ts;function es(t,e){var r=t.__data__;return He(e)?r[typeof e=="string"?"string":"hash"]:r.map}var B=es;function rs(t){var e=B(this,t).delete(t);return this.size-=e?1:0,e}var qe=rs;function os(t){return B(this,t).get(t)}var Ve=os;function as(t){return B(this,t).has(t)}var Ye=as;function is(t,e){var r=B(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ze=is;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=$e;Q.prototype.delete=qe;Q.prototype.get=Ve;Q.prototype.has=Ye;Q.prototype.set=Ze;var lt=Q;var ss="Expected a function";function Nt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(ss);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],s=r.cache;if(s.has(a))return s.get(a);var n=t.apply(this,o);return r.cache=s.set(a,n)||s,n};return r.cache=new(Nt.Cache||lt),r}Nt.Cache=lt;var Je=Nt;var ns=500;function fs(t){var e=Je(t,function(o){return r.size===ns&&r.clear(),o}),r=e.cache;return e}var Xe=fs;var ps=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ls=/\\(\\)?/g,ms=Xe(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(ps,function(r,o,a,s){e.push(a?s.replace(ls,"$1"):o||r)}),e}),Qe=ms;function us(t){return t==null?"":oe(t)}var tr=us;function ds(t,e){return v(t)?t:Me(t,e)?[t]:Qe(tr(t))}var k=ds;var cs=1/0;function hs(t){if(typeof t=="string"||z(t))return t;var e=t+"";return e=="0"&&1/t==-cs?"-0":e}var tt=hs;function xs(t,e){e=k(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[tt(e[r++])];return r&&r==o?t:void 0}var er=xs;function gs(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var et=gs;var rr=T?T.isConcatSpreadable:void 0;function ys(t){return v(t)||q(t)||!!(rr&&t&&t[rr])}var or=ys;function ar(t,e,r,o,a){var s=-1,n=t.length;for(r||(r=or),a||(a=[]);++s<n;){var i=t[s];e>0&&r(i)?e>1?ar(i,e-1,r,o,a):et(a,i):o||(a[a.length]=i)}return a}var ir=ar;function bs(t){var e=t==null?0:t.length;return e?ir(t,1):[]}var sr=bs;function vs(t){return xe(be(t,void 0,sr),t+"")}var nr=vs;var Ts=Tt(Object.getPrototypeOf,Object),wt=Ts;function ws(){this.__data__=new N,this.size=0}var fr=ws;function Os(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var pr=Os;function As(t){return this.__data__.get(t)}var lr=As;function js(t){return this.__data__.has(t)}var mr=js;var Ps=200;function Ss(t,e){var r=this.__data__;if(r instanceof N){var o=r.__data__;if(!L||o.length<Ps-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new lt(o)}return r.set(t,e),this.size=r.size,this}var ur=Ss;function rt(t){var e=this.__data__=new N(t);this.size=e.size}rt.prototype.clear=fr;rt.prototype.delete=pr;rt.prototype.get=lr;rt.prototype.has=mr;rt.prototype.set=ur;var dr=rt;function Is(t,e){return t&&R(e,Y(e),t)}var cr=Is;function _s(t,e){return t&&R(e,Z(e),t)}var hr=_s;var br=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xr=br&&typeof module=="object"&&module&&!module.nodeType&&module,Es=xr&&xr.exports===br,gr=Es?x.Buffer:void 0,yr=gr?gr.allocUnsafe:void 0;function Cs(t,e){if(e)return t.slice();var r=t.length,o=yr?yr(r):new t.constructor(r);return t.copy(o),o}var vr=Cs;function Fs(t,e){for(var r=-1,o=t==null?0:t.length,a=0,s=[];++r<o;){var n=t[r];e(n,r,t)&&(s[a++]=n)}return s}var Tr=Fs;function Rs(){return[]}var Ot=Rs;var Ms=Object.prototype,Ns=Ms.propertyIsEnumerable,wr=Object.getOwnPropertySymbols,Ls=wr?function(t){return t==null?[]:(t=Object(t),Tr(wr(t),function(e){return Ns.call(t,e)}))}:Ot,ot=Ls;function Bs(t,e){return R(t,ot(t),e)}var Or=Bs;var ks=Object.getOwnPropertySymbols,Ds=ks?function(t){for(var e=[];t;)et(e,ot(t)),t=wt(t);return e}:Ot,At=Ds;function Us(t,e){return R(t,At(t),e)}var Ar=Us;function zs(t,e,r){var o=e(t);return v(t)?o:et(o,r(t))}var jt=zs;function Ks(t){return jt(t,Y,ot)}var jr=Ks;function Gs(t){return jt(t,Z,At)}var Pr=Gs;var Ws=O(x,"DataView"),Pt=Ws;var $s=O(x,"Promise"),St=$s;var Hs=O(x,"Set"),It=Hs;var Sr="[object Map]",qs="[object Object]",Ir="[object Promise]",_r="[object Set]",Er="[object WeakMap]",Cr="[object DataView]",Vs=E(Pt),Ys=E(L),Zs=E(St),Js=E(It),Xs=E(ht),U=S;(Pt&&U(new Pt(new ArrayBuffer(1)))!=Cr||L&&U(new L)!=Sr||St&&U(St.resolve())!=Ir||It&&U(new It)!=_r||ht&&U(new ht)!=Er)&&(U=function(t){var e=S(t),r=e==qs?t.constructor:void 0,o=r?E(r):"";if(o)switch(o){case Vs:return Cr;case Ys:return Sr;case Zs:return Ir;case Js:return _r;case Xs:return Er}return e});var at=U;var Qs=Object.prototype,tn=Qs.hasOwnProperty;function en(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&tn.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Fr=en;var rn=x.Uint8Array,Lt=rn;function on(t){var e=new t.constructor(t.byteLength);return new Lt(e).set(new Lt(t)),e}var it=on;function an(t,e){var r=e?it(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Rr=an;var sn=/\w*$/;function nn(t){var e=new t.constructor(t.source,sn.exec(t));return e.lastIndex=t.lastIndex,e}var Mr=nn;var Nr=T?T.prototype:void 0,Lr=Nr?Nr.valueOf:void 0;function fn(t){return Lr?Object(Lr.call(t)):{}}var Br=fn;function pn(t,e){var r=e?it(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var kr=pn;var ln="[object Boolean]",mn="[object Date]",un="[object Map]",dn="[object Number]",cn="[object RegExp]",hn="[object Set]",xn="[object String]",gn="[object Symbol]",yn="[object ArrayBuffer]",bn="[object DataView]",vn="[object Float32Array]",Tn="[object Float64Array]",wn="[object Int8Array]",On="[object Int16Array]",An="[object Int32Array]",jn="[object Uint8Array]",Pn="[object Uint8ClampedArray]",Sn="[object Uint16Array]",In="[object Uint32Array]";function _n(t,e,r){var o=t.constructor;switch(e){case yn:return it(t);case ln:case mn:return new o(+t);case bn:return Rr(t,r);case vn:case Tn:case wn:case On:case An:case jn:case Pn:case Sn:case In:return kr(t,r);case un:return new o;case dn:case xn:return new o(t);case cn:return Mr(t);case hn:return new o;case gn:return Br(t)}}var Dr=_n;function En(t){return typeof t.constructor=="function"&&!H(t)?le(wt(t)):{}}var Ur=En;var Cn="[object Map]";function Fn(t){return P(t)&&at(t)==Cn}var zr=Fn;var Kr=C&&C.isMap,Rn=Kr?V(Kr):zr,Gr=Rn;var Mn="[object Set]";function Nn(t){return P(t)&&at(t)==Mn}var Wr=Nn;var $r=C&&C.isSet,Ln=$r?V($r):Wr,Hr=Ln;var Bn=1,kn=2,Dn=4,qr="[object Arguments]",Un="[object Array]",zn="[object Boolean]",Kn="[object Date]",Gn="[object Error]",Vr="[object Function]",Wn="[object GeneratorFunction]",$n="[object Map]",Hn="[object Number]",Yr="[object Object]",qn="[object RegExp]",Vn="[object Set]",Yn="[object String]",Zn="[object Symbol]",Jn="[object WeakMap]",Xn="[object ArrayBuffer]",Qn="[object DataView]",tf="[object Float32Array]",ef="[object Float64Array]",rf="[object Int8Array]",of="[object Int16Array]",af="[object Int32Array]",sf="[object Uint8Array]",nf="[object Uint8ClampedArray]",ff="[object Uint16Array]",pf="[object Uint32Array]",d={};d[qr]=d[Un]=d[Xn]=d[Qn]=d[zn]=d[Kn]=d[tf]=d[ef]=d[rf]=d[of]=d[af]=d[$n]=d[Hn]=d[Yr]=d[qn]=d[Vn]=d[Yn]=d[Zn]=d[sf]=d[nf]=d[ff]=d[pf]=!0;d[Gn]=d[Vr]=d[Jn]=!1;function _t(t,e,r,o,a,s){var n,i=e&Bn,f=e&kn,m=e&Dn;if(r&&(n=a?r(t,o,a,s):r(t)),n!==void 0)return n;if(!j(t))return t;var h=v(t);if(h){if(n=Fr(t),!i)return ue(t,n)}else{var b=at(t),A=b==Vr||b==Wn;if(bt(t))return vr(t,i);if(b==Yr||b==qr||A&&!a){if(n=f||A?{}:Ur(t),!i)return f?Ar(t,hr(n,t)):Or(t,cr(n,t))}else{if(!d[b])return a?t:{};n=Dr(t,b,i)}}s||(s=new dr);var w=s.get(t);if(w)return w;s.set(t,n),Hr(t)?t.forEach(function(y){n.add(_t(y,e,r,y,t,s))}):Gr(t)&&t.forEach(function(y,p){n.set(p,_t(y,e,r,p,t,s))});var g=m?f?Pr:jr:f?Z:Y,I=h?void 0:g(t);return ge(I||t,function(y,p){I&&(p=y,y=t[p]),W(n,p,_t(y,e,r,p,t,s))}),n}var Zr=_t;var lf=1,mf=4;function uf(t){return Zr(t,lf|mf)}var Bt=uf;function df(t,e){return t!=null&&e in Object(t)}var Jr=df;function cf(t,e,r){e=k(e,t);for(var o=-1,a=e.length,s=!1;++o<a;){var n=tt(e[o]);if(!(s=t!=null&&r(t,n)))break;t=t[n]}return s||++o!=a?s:(a=t==null?0:t.length,!!a&&$(a)&&G(n,a)&&(v(t)||q(t)))}var Xr=cf;function hf(t,e){return t!=null&&Xr(t,e,Jr)}var Qr=hf;function xf(t,e,r,o){if(!j(t))return t;e=k(e,t);for(var a=-1,s=e.length,n=s-1,i=t;i!=null&&++a<s;){var f=tt(e[a]),m=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return t;if(a!=n){var h=i[f];m=o?o(h,f,i):void 0,m===void 0&&(m=j(h)?h:G(e[a+1])?[]:{})}W(i,f,m),i=i[f]}return t}var to=xf;function gf(t,e,r){for(var o=-1,a=e.length,s={};++o<a;){var n=e[o],i=er(t,n);r(i,n)&&to(s,k(n,t),i)}return s}var eo=gf;function yf(t,e){return eo(t,e,function(r,o){return Qr(t,o)})}var ro=yf;var bf=nr(function(t,e){return t==null?{}:ro(t,e)}),Et=bf;function oo(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 ao="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var kt=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=ao[r[t]&63];return e};var vf="array",Tf="bit",io="bits",wf="byte",so="bytes",st="",Of="exponent",Af="function",no="iec",jf="Invalid number",Pf="Invalid rounding method",Dt="jedec",Sf="object",fo=".",If="round",_f="s",Ef="si",Cf="kbit",Ff="kB",Rf=" ",Mf="string",Nf="0",Ut={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 po(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:s=st,localeOptions:n={},separator:i=st,spacer:f=Rf,symbols:m={},standard:h=st,output:b=Mf,fullform:A=!1,fullforms:w=[],exponent:g=-1,roundingMethod:I=If,precision:y=0}={}){let p=g,u=Number(t),l=[],_=0,Ct=st;h===Ef?(o=10,h=Dt):h===no||h===Dt?o=2:o===2?h=no:(o=10,h=Dt);let mt=o===10?1e3:1024,lo=A===!0,Kt=u<0,Gt=Math[I];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(jf);if(typeof Gt!==Af)throw new TypeError(Pf);if(Kt&&(u=-u),(p===-1||isNaN(p))&&(p=Math.floor(Math.log(u)/Math.log(mt)),p<0&&(p=0)),p>8&&(y>0&&(y+=8-p),p=8),b===Of)return p;if(u===0)l[0]=0,Ct=l[1]=Ut.symbol[h][e?io:so][p];else{_=u/(o===2?Math.pow(2,p*10):Math.pow(1e3,p)),e&&(_=_*8,_>=mt&&p<8&&(_=_/mt,p++));let nt=Math.pow(10,p>0?a:0);l[0]=Gt(_*nt)/nt,l[0]===mt&&p<8&&g===-1&&(l[0]=1,p++),Ct=l[1]=o===10&&p===1?e?Cf:Ff:Ut.symbol[h][e?io:so][p]}if(Kt&&(l[0]=-l[0]),y>0&&(l[0]=l[0].toPrecision(y)),l[1]=m[l[1]]||l[1],s===!0?l[0]=l[0].toLocaleString():s.length>0?l[0]=l[0].toLocaleString(s,n):i.length>0&&(l[0]=l[0].toString().replace(fo,i)),r&&Number.isInteger(l[0])===!1&&a>0){let nt=i||fo,Wt=l[0].toString().split(nt),$t=Wt[1]||st,Ht=$t.length,mo=a-Ht;l[0]=`${Wt[0]}${nt}${$t.padEnd(Ht+mo,Nf)}`}return lo&&(l[1]=w[p]?w[p]:Ut.fullform[h][p]+(e?Tf:wf)+(l[0]===1?st:_f)),b===vf?l:b===Sf?{value:l[0],symbol:l[1],exponent:p,unit:Ct}:l.join(f)}var D=class t{_tera;id;name;icon;path;url;teraUrl;parsedName;created;createdFormatted;modified;modifiedFormatted;accessed;accessedFormatted;size;sizeFormatted;mime;meta={};constructor(e){if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,e);let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.teraUrl=this.url.replace(/^https:\/\/tera-tools.com\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=po(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.setProjectFile(this.id,e)}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Et(this,["id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new t(Et(e,["tera","id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]))}};var zt=class{settings={devMode:!0,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",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};events=oo();dom={el:null,iframe:null,popup:null,stylesheet:null};methods=["handshake","setServerVerbosity","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateFlush","setProjectStateRefresh","saveProjectState","replaceProjectState","applyProjectStatePatch","getProjectFileContents","deleteProjectFile","setProjectFile","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPageUrl","setPageTitle","uiAlert","uiProgress","uiSplat","uiWindow"];plugins=[];send(e){let r=kt();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||kt(),...Bt(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;let r=e.data;if(!(!r.TERA||!r.id))if(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);else{if(r?.action=="rpc")return 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()})});if(r?.action=="event")return 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?`):this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r})}}acceptPostboxes={};createProjectStatePatch(e,r){let o=qt(r,e,Vt);return this.debug("INFO",3,"Created project patch",{patch:o,newState:e,oldState:r}),this.applyProjectStatePatch(o)}applyProjectStatePatchLocal(e){throw new Error("applyProjectStatePatchLocal() has not been sub-classed by a plugin")}constructor(e){e&&this.set(e)}init(e){if(e&&this.set(e),this.init.promise)return this.init.promise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.init.promise=Promise.resolve().then(()=>this.debug("INFO",4,"[0/6] Init using server",this.settings.siteUrl)).then(()=>this.detectMode()).then(o=>{this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o}).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")).catch(o=>this.debug("WARN",0,"Init process fault",o))}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(),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e())})).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":this.debug("INFO",2,"Using TERA window parent");break;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 s=0,n,i=setTimeout(()=>a("TIMEOUT"),r.handshakeTimeout),f=()=>{this.debug("INFO",4,"Trying handshake",++s),clearTimeout(n),n=setTimeout(f,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(i),clearTimeout(n)}).then(()=>o()).catch(a)};f()})}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;","&.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;","}","}","&: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
|
+
`),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){if(typeof e!="function")throw new Error("Expected use() call to be provided with a class initalizer");let o=new e(this,r);return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(o=>!["constructor","prototype","name"].includes(o)).filter(o=>o!="init").forEach(o=>{Object.defineProperty(e,o,{value:r[o].bind(e),enumerable:!1})})}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.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)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new D({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new D({tera:this,...o})))}getProjectFile(e){return this.rpc("getProjectFile",e).then(r=>r&&new D({tera:this,...r}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new D({tera:this,...r}))}};export{zt as default};
|
|
3
3
|
/*! Bundled license information:
|
|
4
4
|
|
|
5
5
|
lodash-es/lodash.js:
|
package/lib/terafy.client.js
CHANGED
|
@@ -294,7 +294,7 @@ export default class TeraFy {
|
|
|
294
294
|
*/
|
|
295
295
|
createProjectStatePatch(newState, oldState) {
|
|
296
296
|
let patch = diff(oldState, newState, jsPatchConverter);
|
|
297
|
-
this.debug('INFO', 3, 'Created project patch', {newState, oldState});
|
|
297
|
+
this.debug('INFO', 3, 'Created project patch', {patch, newState, oldState});
|
|
298
298
|
return this.applyProjectStatePatch(patch);
|
|
299
299
|
}
|
|
300
300
|
|
|
@@ -422,8 +422,11 @@ export default class TeraFy {
|
|
|
422
422
|
this.dom.el = document.createElement('div')
|
|
423
423
|
this.dom.el.id = 'tera-fy';
|
|
424
424
|
this.dom.el.classList.toggle('dev-mode', this.settings.devMode);
|
|
425
|
+
this.dom.el.classList.add('minimized');
|
|
425
426
|
document.body.append(this.dom.el);
|
|
426
427
|
|
|
428
|
+
this.dom.el.addEventListener('click', ()=> this.dom.el.classList.toggle('minimized'));
|
|
429
|
+
|
|
427
430
|
this.dom.iframe = document.createElement('iframe')
|
|
428
431
|
|
|
429
432
|
// Queue up event chain when document loads
|
|
@@ -521,6 +524,77 @@ export default class TeraFy {
|
|
|
521
524
|
'height: 150px;',
|
|
522
525
|
'background: transparent;',
|
|
523
526
|
|
|
527
|
+
// Minimize / deminimize functionality {{{
|
|
528
|
+
'&.minimized.dev-mode {',
|
|
529
|
+
'background: var(--TERA-accent) !important;',
|
|
530
|
+
'opacity: 0.5;',
|
|
531
|
+
'right: 0px;',
|
|
532
|
+
'bottom: 0px;',
|
|
533
|
+
'width: 30px;',
|
|
534
|
+
'height: 30px;',
|
|
535
|
+
'transition: opacity 0.2s ease-out;',
|
|
536
|
+
|
|
537
|
+
'cursor: pointer;',
|
|
538
|
+
|
|
539
|
+
'border: none;',
|
|
540
|
+
'border-top-left-radius: 30px;',
|
|
541
|
+
'border-top: 2px solid var(--TERA-accent);',
|
|
542
|
+
'border-left: 2px solid var(--TERA-accent);',
|
|
543
|
+
|
|
544
|
+
'display: flex;',
|
|
545
|
+
'justify-content: center;',
|
|
546
|
+
'align-items: center;',
|
|
547
|
+
|
|
548
|
+
'&::before {',
|
|
549
|
+
'margin: 2px 0 0 0;',
|
|
550
|
+
'content: "🌀";',
|
|
551
|
+
'color: #FFF;',
|
|
552
|
+
'}',
|
|
553
|
+
|
|
554
|
+
'&:hover {',
|
|
555
|
+
'opacity: 1;',
|
|
556
|
+
'}',
|
|
557
|
+
|
|
558
|
+
'& > iframe {',
|
|
559
|
+
'display: none;',
|
|
560
|
+
'}',
|
|
561
|
+
'}',
|
|
562
|
+
|
|
563
|
+
'&:not(.minimized) {',
|
|
564
|
+
'&::before {',
|
|
565
|
+
'display: flex;',
|
|
566
|
+
'align-items: center;',
|
|
567
|
+
'justify-content: center;',
|
|
568
|
+
|
|
569
|
+
'cursor: pointer;',
|
|
570
|
+
|
|
571
|
+
'background: var(--TERA-accent) !important;',
|
|
572
|
+
'opacity: 0.5;',
|
|
573
|
+
'transition: opacity 0.2s ease-out;',
|
|
574
|
+
|
|
575
|
+
'position: absolute;',
|
|
576
|
+
'right: 0px;',
|
|
577
|
+
'bottom: 0px;',
|
|
578
|
+
'width: 20px;',
|
|
579
|
+
'height: 20px;',
|
|
580
|
+
|
|
581
|
+
'margin: 2px 0 0 0;',
|
|
582
|
+
'content: "⭨";',
|
|
583
|
+
'color: #FFF;',
|
|
584
|
+
|
|
585
|
+
'border: none;',
|
|
586
|
+
'border-top-left-radius: 30px;',
|
|
587
|
+
'border-top: 2px solid var(--TERA-accent);',
|
|
588
|
+
'border-left: 2px solid var(--TERA-accent);',
|
|
589
|
+
'}',
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
'&:hover::before {',
|
|
593
|
+
'opacity: 1;',
|
|
594
|
+
'}',
|
|
595
|
+
'}',
|
|
596
|
+
// }}}
|
|
597
|
+
|
|
524
598
|
'&.dev-mode {',
|
|
525
599
|
'display: flex;',
|
|
526
600
|
'border: 5px solid var(--TERA-accent);',
|
package/package.json
CHANGED
package/plugins/vue3.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {cloneDeep} from 'lodash-es';
|
|
1
2
|
import TeraFyPluginBase from './base.js';
|
|
2
3
|
import {reactive, watch} from 'vue';
|
|
3
4
|
|
|
@@ -62,15 +63,22 @@ export default class TeraFyPluginVue extends TeraFyPluginBase {
|
|
|
62
63
|
|
|
63
64
|
// Watch for local writes and react
|
|
64
65
|
if (settings.write) {
|
|
66
|
+
|
|
67
|
+
// NOTE: The below watch function returns two copies of the new value of the observed
|
|
68
|
+
// so we have to keep track of what changed ourselves by initalizing against the
|
|
69
|
+
// snapshot
|
|
70
|
+
let oldVal = cloneDeep(snapshot);
|
|
71
|
+
|
|
65
72
|
watch(
|
|
66
73
|
stateReactive,
|
|
67
|
-
|
|
74
|
+
newVal => {
|
|
68
75
|
if (skipUpdate > 0) {
|
|
69
76
|
skipUpdate--;
|
|
70
77
|
return;
|
|
71
78
|
}
|
|
72
79
|
|
|
73
80
|
this.createProjectStatePatch(newVal, oldVal);
|
|
81
|
+
oldVal = cloneDeep(snapshot);
|
|
74
82
|
},
|
|
75
83
|
{
|
|
76
84
|
deep: true,
|