@iebh/tera-fy 1.11.4 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/dist/terafy.es2019.js +1 -1
- package/dist/terafy.js +1 -1
- package/lib/terafy.client.js +2 -2
- package/lib/terafy.server.js +7 -5
- package/package.json +1 -1
- package/plugins/vue3.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
# [1.12.0](https://github.com/IEBH/TERA-fy/compare/v1.11.5...v1.12.0) (2024-07-04)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* Better handling of TERA-fy server running in top-level mode and no iframes being present on the page ([31d2785](https://github.com/IEBH/TERA-fy/commit/31d2785344e525f4dd561cbc3e0b6b9696058f70))
|
|
9
|
+
* Dead code ([6c84c51](https://github.com/IEBH/TERA-fy/commit/6c84c51292ee55d6896d5eb61809332f1924b08f))
|
|
10
|
+
* Dont use the faulty jsonpatch.com standard as object keys dont get correctly escaped ([949cb14](https://github.com/IEBH/TERA-fy/commit/949cb14c01039c9c1e33baf9fd8742a14ee18a74))
|
|
11
|
+
|
|
12
|
+
## [1.11.6](https://github.com/IEBH/TERA-fy/compare/v1.11.5...v1.11.6) (2024-07-04)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* Better handling of TERA-fy server running in top-level mode and no iframes being present on the page ([31d2785](https://github.com/IEBH/TERA-fy/commit/31d2785344e525f4dd561cbc3e0b6b9696058f70))
|
|
18
|
+
* Dead code ([6c84c51](https://github.com/IEBH/TERA-fy/commit/6c84c51292ee55d6896d5eb61809332f1924b08f))
|
|
19
|
+
* Dont use the faulty jsonpatch.com standard as object keys dont get correctly escaped ([949cb14](https://github.com/IEBH/TERA-fy/commit/949cb14c01039c9c1e33baf9fd8742a14ee18a74))
|
|
20
|
+
|
|
21
|
+
## [1.11.5](https://github.com/IEBH/TERA-fy/compare/v1.11.4...v1.11.5) (2024-07-03)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* Idiot level typo caused state to always revert back to baseline for Vue@3 plugins ([e237a68](https://github.com/IEBH/TERA-fy/commit/e237a680ade686efd0e1bdee930ce9e5d77690d6))
|
|
27
|
+
|
|
3
28
|
## [1.11.4](https://github.com/IEBH/TERA-fy/compare/v1.11.0...v1.11.4) (2024-07-02)
|
|
4
29
|
|
|
5
30
|
|
package/dist/terafy.es2019.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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(`
|
|
1
|
+
var uo=Object.defineProperty;var co=(t,e,r)=>e in t?uo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var d=(t,e,r)=>(co(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(xo(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||ho(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 ho(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function xo(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 go=typeof global=="object"&&global&&global.Object===Object&&global,dt=go;var yo=typeof self=="object"&&self&&self.Object===Object&&self,bo=dt||yo||Function("return this")(),g=bo;var vo=g.Symbol,w=vo;var Yt=Object.prototype,To=Yt.hasOwnProperty,wo=Yt.toString,pt=w?w.toStringTag:void 0;function Oo(t){var e=To.call(t,pt),r=t[pt];try{t[pt]=void 0;var o=!0}catch{}var a=wo.call(t);return o&&(e?t[pt]=r:delete t[pt]),a}var Zt=Oo;var Ao=Object.prototype,jo=Ao.toString;function Po(t){return jo.call(t)}var Jt=Po;var So="[object Null]",Io="[object Undefined]",Xt=w?w.toStringTag:void 0;function _o(t){return t==null?t===void 0?Io:So:Xt&&Xt in Object(t)?Zt(t):Jt(t)}var I=_o;function Eo(t){return t!=null&&typeof t=="object"}var S=Eo;var Fo="[object Symbol]";function Co(t){return typeof t=="symbol"||S(t)&&I(t)==Fo}var K=Co;function Ro(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=Ro;var Mo=Array.isArray,T=Mo;var No=1/0,te=w?w.prototype:void 0,ee=te?te.toString:void 0;function re(t){if(typeof t=="string")return t;if(T(t))return Qt(t,re)+"";if(K(t))return ee?ee.call(t):"";var e=t+"";return e=="0"&&1/t==-No?"-0":e}var oe=re;function Lo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var P=Lo;function Bo(t){return t}var ae=Bo;var ko="[object AsyncFunction]",Do="[object Function]",Uo="[object GeneratorFunction]",zo="[object Proxy]";function Ko(t){if(!P(t))return!1;var e=I(t);return e==Do||e==Uo||e==ko||e==zo}var ct=Ko;var Go=g["__core-js_shared__"],ht=Go;var ie=function(){var t=/[^.]+$/.exec(ht&&ht.keys&&ht.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Wo(t){return!!ie&&ie in t}var se=Wo;var $o=Function.prototype,Ho=$o.toString;function qo(t){if(t!=null){try{return Ho.call(t)}catch{}try{return t+""}catch{}}return""}var F=qo;var Vo=/[\\^$.*+?()[\]{}|]/g,Yo=/^\[object .+?Constructor\]$/,Zo=Function.prototype,Jo=Object.prototype,Xo=Zo.toString,Qo=Jo.hasOwnProperty,ta=RegExp("^"+Xo.call(Qo).replace(Vo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ea(t){if(!P(t)||se(t))return!1;var e=ct(t)?ta:Yo;return e.test(F(t))}var ne=ea;function ra(t,e){return t==null?void 0:t[e]}var fe=ra;function oa(t,e){var r=fe(t,e);return ne(r)?r:void 0}var A=oa;var aa=A(g,"WeakMap"),xt=aa;var pe=Object.create,ia=function(){function t(){}return function(e){if(!P(e))return{};if(pe)return pe(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),le=ia;function sa(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=sa;function na(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var ue=na;var fa=800,pa=16,la=Date.now;function ma(t){var e=0,r=0;return function(){var o=la(),a=pa-(o-r);if(r=o,a>0){if(++e>=fa)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var de=ma;function ua(t){return function(){return t}}var ce=ua;var da=function(){try{var t=A(Object,"defineProperty");return t({},"",{}),t}catch{}}(),G=da;var ca=G?function(t,e){return G(t,"toString",{configurable:!0,enumerable:!1,value:ce(e),writable:!0})}:ae,he=ca;var ha=de(he),xe=ha;function xa(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var ge=xa;var ga=9007199254740991,ya=/^(?:0|[1-9]\d*)$/;function ba(t,e){var r=typeof t;return e=e==null?ga:e,!!e&&(r=="number"||r!="symbol"&&ya.test(t))&&t>-1&&t%1==0&&t<e}var W=ba;function va(t,e,r){e=="__proto__"&&G?G(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var gt=va;function Ta(t,e){return t===e||t!==t&&e!==e}var yt=Ta;var wa=Object.prototype,Oa=wa.hasOwnProperty;function Aa(t,e,r){var o=t[e];(!(Oa.call(t,e)&&yt(o,r))||r===void 0&&!(e in t))&>(t,e,r)}var $=Aa;function ja(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=ja;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 Sa=9007199254740991;function Ia(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Sa}var H=Ia;function _a(t){return t!=null&&H(t.length)&&!ct(t)}var bt=_a;var Ea=Object.prototype;function Fa(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Ea;return t===r}var q=Fa;function Ca(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var ve=Ca;var Ra="[object Arguments]";function Ma(t){return S(t)&&I(t)==Ra}var Rt=Ma;var Te=Object.prototype,Na=Te.hasOwnProperty,La=Te.propertyIsEnumerable,Ba=Rt(function(){return arguments}())?Rt:function(t){return S(t)&&Na.call(t,"callee")&&!La.call(t,"callee")},V=Ba;function ka(){return!1}var we=ka;var je=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Oe=je&&typeof module=="object"&&module&&!module.nodeType&&module,Da=Oe&&Oe.exports===je,Ae=Da?g.Buffer:void 0,Ua=Ae?Ae.isBuffer:void 0,za=Ua||we,vt=za;var Ka="[object Arguments]",Ga="[object Array]",Wa="[object Boolean]",$a="[object Date]",Ha="[object Error]",qa="[object Function]",Va="[object Map]",Ya="[object Number]",Za="[object Object]",Ja="[object RegExp]",Xa="[object Set]",Qa="[object String]",ti="[object WeakMap]",ei="[object ArrayBuffer]",ri="[object DataView]",oi="[object Float32Array]",ai="[object Float64Array]",ii="[object Int8Array]",si="[object Int16Array]",ni="[object Int32Array]",fi="[object Uint8Array]",pi="[object Uint8ClampedArray]",li="[object Uint16Array]",mi="[object Uint32Array]",h={};h[oi]=h[ai]=h[ii]=h[si]=h[ni]=h[fi]=h[pi]=h[li]=h[mi]=!0;h[Ka]=h[Ga]=h[ei]=h[Wa]=h[ri]=h[$a]=h[Ha]=h[qa]=h[Va]=h[Ya]=h[Za]=h[Ja]=h[Xa]=h[Qa]=h[ti]=!1;function ui(t){return S(t)&&H(t.length)&&!!h[I(t)]}var Pe=ui;function di(t){return function(e){return t(e)}}var Y=di;var Se=typeof exports=="object"&&exports&&!exports.nodeType&&exports,lt=Se&&typeof module=="object"&&module&&!module.nodeType&&module,ci=lt&<.exports===Se,Mt=ci&&dt.process,hi=function(){try{var t=lt&<.require&<.require("util").types;return t||Mt&&Mt.binding&&Mt.binding("util")}catch{}}(),C=hi;var Ie=C&&C.isTypedArray,xi=Ie?Y(Ie):Pe,_e=xi;var gi=Object.prototype,yi=gi.hasOwnProperty;function bi(t,e){var r=T(t),o=!r&&V(t),a=!r&&!o&&vt(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||yi.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=bi;function vi(t,e){return function(r){return t(e(r))}}var wt=vi;var Ti=wt(Object.keys,Object),Ee=Ti;var wi=Object.prototype,Oi=wi.hasOwnProperty;function Ai(t){if(!q(t))return Ee(t);var e=[];for(var r in Object(t))Oi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Fe=Ai;function ji(t){return bt(t)?Tt(t):Fe(t)}var Z=ji;function Pi(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Ce=Pi;var Si=Object.prototype,Ii=Si.hasOwnProperty;function _i(t){if(!P(t))return Ce(t);var e=q(t),r=[];for(var o in t)o=="constructor"&&(e||!Ii.call(t,o))||r.push(o);return r}var Re=_i;function Ei(t){return bt(t)?Tt(t,!0):Re(t)}var J=Ei;var Fi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ci=/^\w*$/;function Ri(t,e){if(T(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||K(t)?!0:Ci.test(t)||!Fi.test(t)||e!=null&&t in Object(e)}var Me=Ri;var Mi=A(Object,"create"),R=Mi;function Ni(){this.__data__=R?R(null):{},this.size=0}var Ne=Ni;function Li(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Le=Li;var Bi="__lodash_hash_undefined__",ki=Object.prototype,Di=ki.hasOwnProperty;function Ui(t){var e=this.__data__;if(R){var r=e[t];return r===Bi?void 0:r}return Di.call(e,t)?e[t]:void 0}var Be=Ui;var zi=Object.prototype,Ki=zi.hasOwnProperty;function Gi(t){var e=this.__data__;return R?e[t]!==void 0:Ki.call(e,t)}var ke=Gi;var Wi="__lodash_hash_undefined__";function $i(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=R&&e===void 0?Wi:e,this}var De=$i;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=Ne;X.prototype.delete=Le;X.prototype.get=Be;X.prototype.has=ke;X.prototype.set=De;var Nt=X;function Hi(){this.__data__=[],this.size=0}var Ue=Hi;function qi(t,e){for(var r=t.length;r--;)if(yt(t[r][0],e))return r;return-1}var N=qi;var Vi=Array.prototype,Yi=Vi.splice;function Zi(t){var e=this.__data__,r=N(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Yi.call(e,r,1),--this.size,!0}var ze=Zi;function Ji(t){var e=this.__data__,r=N(e,t);return r<0?void 0:e[r][1]}var Ke=Ji;function Xi(t){return N(this.__data__,t)>-1}var Ge=Xi;function Qi(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=Qi;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=Ue;Q.prototype.delete=ze;Q.prototype.get=Ke;Q.prototype.has=Ge;Q.prototype.set=We;var L=Q;var ts=A(g,"Map"),B=ts;function es(){this.size=0,this.__data__={hash:new Nt,map:new(B||L),string:new Nt}}var $e=es;function rs(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var He=rs;function os(t,e){var r=t.__data__;return He(e)?r[typeof e=="string"?"string":"hash"]:r.map}var k=os;function as(t){var e=k(this,t).delete(t);return this.size-=e?1:0,e}var qe=as;function is(t){return k(this,t).get(t)}var Ve=is;function ss(t){return k(this,t).has(t)}var Ye=ss;function ns(t,e){var r=k(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ze=ns;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=$e;tt.prototype.delete=qe;tt.prototype.get=Ve;tt.prototype.has=Ye;tt.prototype.set=Ze;var mt=tt;var fs="Expected a function";function Lt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(fs);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 Je=Lt;var ps=500;function ls(t){var e=Je(t,function(o){return r.size===ps&&r.clear(),o}),r=e.cache;return e}var Xe=ls;var ms=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,us=/\\(\\)?/g,ds=Xe(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(ms,function(r,o,a,s){e.push(a?s.replace(us,"$1"):o||r)}),e}),Qe=ds;function cs(t){return t==null?"":oe(t)}var tr=cs;function hs(t,e){return T(t)?t:Me(t,e)?[t]:Qe(tr(t))}var D=hs;var xs=1/0;function gs(t){if(typeof t=="string"||K(t))return t;var e=t+"";return e=="0"&&1/t==-xs?"-0":e}var et=gs;function ys(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 er=ys;function bs(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var rt=bs;var rr=w?w.isConcatSpreadable:void 0;function vs(t){return T(t)||V(t)||!!(rr&&t&&t[rr])}var or=vs;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):rt(a,i):o||(a[a.length]=i)}return a}var ir=ar;function Ts(t){var e=t==null?0:t.length;return e?ir(t,1):[]}var sr=Ts;function ws(t){return xe(be(t,void 0,sr),t+"")}var nr=ws;var Os=wt(Object.getPrototypeOf,Object),Ot=Os;function As(){this.__data__=new L,this.size=0}var fr=As;function js(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var pr=js;function Ps(t){return this.__data__.get(t)}var lr=Ps;function Ss(t){return this.__data__.has(t)}var mr=Ss;var Is=200;function _s(t,e){var r=this.__data__;if(r instanceof L){var o=r.__data__;if(!B||o.length<Is-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 ur=_s;function ot(t){var e=this.__data__=new L(t);this.size=e.size}ot.prototype.clear=fr;ot.prototype.delete=pr;ot.prototype.get=lr;ot.prototype.has=mr;ot.prototype.set=ur;var dr=ot;function Es(t,e){return t&&M(e,Z(e),t)}var cr=Es;function Fs(t,e){return t&&M(e,J(e),t)}var hr=Fs;var br=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xr=br&&typeof module=="object"&&module&&!module.nodeType&&module,Cs=xr&&xr.exports===br,gr=Cs?g.Buffer:void 0,yr=gr?gr.allocUnsafe:void 0;function Rs(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=Rs;function Ms(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=Ms;function Ns(){return[]}var At=Ns;var Ls=Object.prototype,Bs=Ls.propertyIsEnumerable,wr=Object.getOwnPropertySymbols,ks=wr?function(t){return t==null?[]:(t=Object(t),Tr(wr(t),function(e){return Bs.call(t,e)}))}:At,at=ks;function Ds(t,e){return M(t,at(t),e)}var Or=Ds;var Us=Object.getOwnPropertySymbols,zs=Us?function(t){for(var e=[];t;)rt(e,at(t)),t=Ot(t);return e}:At,jt=zs;function Ks(t,e){return M(t,jt(t),e)}var Ar=Ks;function Gs(t,e,r){var o=e(t);return T(t)?o:rt(o,r(t))}var Pt=Gs;function Ws(t){return Pt(t,Z,at)}var jr=Ws;function $s(t){return Pt(t,J,jt)}var Pr=$s;var Hs=A(g,"DataView"),St=Hs;var qs=A(g,"Promise"),It=qs;var Vs=A(g,"Set"),_t=Vs;var Sr="[object Map]",Ys="[object Object]",Ir="[object Promise]",_r="[object Set]",Er="[object WeakMap]",Fr="[object DataView]",Zs=F(St),Js=F(B),Xs=F(It),Qs=F(_t),tn=F(xt),z=I;(St&&z(new St(new ArrayBuffer(1)))!=Fr||B&&z(new B)!=Sr||It&&z(It.resolve())!=Ir||_t&&z(new _t)!=_r||xt&&z(new xt)!=Er)&&(z=function(t){var e=I(t),r=e==Ys?t.constructor:void 0,o=r?F(r):"";if(o)switch(o){case Zs:return Fr;case Js:return Sr;case Xs:return Ir;case Qs:return _r;case tn:return Er}return e});var it=z;var en=Object.prototype,rn=en.hasOwnProperty;function on(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&rn.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Cr=on;var an=g.Uint8Array,Bt=an;function sn(t){var e=new t.constructor(t.byteLength);return new Bt(e).set(new Bt(t)),e}var st=sn;function nn(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Rr=nn;var fn=/\w*$/;function pn(t){var e=new t.constructor(t.source,fn.exec(t));return e.lastIndex=t.lastIndex,e}var Mr=pn;var Nr=w?w.prototype:void 0,Lr=Nr?Nr.valueOf:void 0;function ln(t){return Lr?Object(Lr.call(t)):{}}var Br=ln;function mn(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var kr=mn;var un="[object Boolean]",dn="[object Date]",cn="[object Map]",hn="[object Number]",xn="[object RegExp]",gn="[object Set]",yn="[object String]",bn="[object Symbol]",vn="[object ArrayBuffer]",Tn="[object DataView]",wn="[object Float32Array]",On="[object Float64Array]",An="[object Int8Array]",jn="[object Int16Array]",Pn="[object Int32Array]",Sn="[object Uint8Array]",In="[object Uint8ClampedArray]",_n="[object Uint16Array]",En="[object Uint32Array]";function Fn(t,e,r){var o=t.constructor;switch(e){case vn:return st(t);case un:case dn:return new o(+t);case Tn:return Rr(t,r);case wn:case On:case An:case jn:case Pn:case Sn:case In:case _n:case En:return kr(t,r);case cn:return new o;case hn:case yn:return new o(t);case xn:return Mr(t);case gn:return new o;case bn:return Br(t)}}var Dr=Fn;function Cn(t){return typeof t.constructor=="function"&&!q(t)?le(Ot(t)):{}}var Ur=Cn;var Rn="[object Map]";function Mn(t){return S(t)&&it(t)==Rn}var zr=Mn;var Kr=C&&C.isMap,Nn=Kr?Y(Kr):zr,Gr=Nn;var Ln="[object Set]";function Bn(t){return S(t)&&it(t)==Ln}var Wr=Bn;var $r=C&&C.isSet,kn=$r?Y($r):Wr,Hr=kn;var Dn=1,Un=2,zn=4,qr="[object Arguments]",Kn="[object Array]",Gn="[object Boolean]",Wn="[object Date]",$n="[object Error]",Vr="[object Function]",Hn="[object GeneratorFunction]",qn="[object Map]",Vn="[object Number]",Yr="[object Object]",Yn="[object RegExp]",Zn="[object Set]",Jn="[object String]",Xn="[object Symbol]",Qn="[object WeakMap]",tf="[object ArrayBuffer]",ef="[object DataView]",rf="[object Float32Array]",of="[object Float64Array]",af="[object Int8Array]",sf="[object Int16Array]",nf="[object Int32Array]",ff="[object Uint8Array]",pf="[object Uint8ClampedArray]",lf="[object Uint16Array]",mf="[object Uint32Array]",c={};c[qr]=c[Kn]=c[tf]=c[ef]=c[Gn]=c[Wn]=c[rf]=c[of]=c[af]=c[sf]=c[nf]=c[qn]=c[Vn]=c[Yr]=c[Yn]=c[Zn]=c[Jn]=c[Xn]=c[ff]=c[pf]=c[lf]=c[mf]=!0;c[$n]=c[Vr]=c[Qn]=!1;function Et(t,e,r,o,a,s){var n,i=e&Dn,f=e&Un,m=e&zn;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=Cr(t),!i)return ue(t,n)}else{var v=it(t),j=v==Vr||v==Hn;if(vt(t))return vr(t,i);if(v==Yr||v==qr||j&&!a){if(n=f||j?{}:Ur(t),!i)return f?Ar(t,hr(n,t)):Or(t,cr(n,t))}else{if(!c[v])return a?t:{};n=Dr(t,v,i)}}s||(s=new dr);var O=s.get(t);if(O)return O;s.set(t,n),Hr(t)?t.forEach(function(b){n.add(Et(b,e,r,b,t,s))}):Gr(t)&&t.forEach(function(b,p){n.set(p,Et(b,e,r,p,t,s))});var y=m?f?Pr:jr:f?J:Z,_=x?void 0:y(t);return ge(_||t,function(b,p){_&&(p=b,b=t[p]),$(n,p,Et(b,e,r,p,t,s))}),n}var Zr=Et;var uf=1,df=4;function cf(t){return Zr(t,uf|df)}var kt=cf;function hf(t,e){return t!=null&&e in Object(t)}var Jr=hf;function xf(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 Xr=xf;function gf(t,e){return t!=null&&Xr(t,e,Jr)}var Qr=gf;function yf(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 to=yf;function bf(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,D(n,t),i)}return s}var eo=bf;function vf(t,e){return eo(t,e,function(r,o){return Qr(t,o)})}var ro=vf;var Tf=nr(function(t,e){return t==null?{}:ro(t,e)}),Ft=Tf;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 Dt=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=ao[r[t]&63];return e};var wf="array",Of="bit",io="bits",Af="byte",so="bytes",nt="",jf="exponent",Pf="function",no="iec",Sf="Invalid number",If="Invalid rounding method",Ut="jedec",_f="object",fo=".",Ef="round",Ff="s",Cf="si",Rf="kbit",Mf="kB",Nf=" ",Lf="string",Bf="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 po(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:s=nt,localeOptions:n={},separator:i=nt,spacer:f=Nf,symbols:m={},standard:x=nt,output:v=Lf,fullform:j=!1,fullforms:O=[],exponent:y=-1,roundingMethod:_=Ef,precision:b=0}={}){let p=y,u=Number(t),l=[],E=0,Ct=nt;x===Cf?(o=10,x=Ut):x===no||x===Ut?o=2:o===2?x=no:(o=10,x=Ut);let ut=o===10?1e3:1024,lo=j===!0,Gt=u<0,Wt=Math[_];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(Sf);if(typeof Wt!==Pf)throw new TypeError(If);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===jf)return p;if(u===0)l[0]=0,Ct=l[1]=zt.symbol[x][e?io:so][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++),Ct=l[1]=o===10&&p===1?e?Rf:Mf:zt.symbol[x][e?io:so][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(fo,i)),r&&Number.isInteger(l[0])===!1&&a>0){let ft=i||fo,$t=l[0].toString().split(ft),Ht=$t[1]||nt,qt=Ht.length,mo=a-qt;l[0]=`${$t[0]}${ft}${Ht.padEnd(qt+mo,Bf)}`}return lo&&(l[1]=O[p]?O[p]:zt.fullform[x][p]+(e?Of:Af)+(l[0]===1?nt:Ff)),v===wf?l:v===_f?{value:l[0],symbol:l[1],exponent:p,unit:Ct}: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=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 Ft(this,["id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new t(Ft(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",oo());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);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
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
|
|
package/dist/terafy.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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(`
|
|
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(uo(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||mo(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 mo(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function uo(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 co=typeof global=="object"&&global&&global.Object===Object&&global,ut=co;var ho=typeof self=="object"&&self&&self.Object===Object&&self,xo=ut||ho||Function("return this")(),x=xo;var go=x.Symbol,T=go;var Vt=Object.prototype,yo=Vt.hasOwnProperty,bo=Vt.toString,ft=T?T.toStringTag:void 0;function vo(t){var e=yo.call(t,ft),r=t[ft];try{t[ft]=void 0;var o=!0}catch{}var a=bo.call(t);return o&&(e?t[ft]=r:delete t[ft]),a}var Yt=vo;var To=Object.prototype,wo=To.toString;function Oo(t){return wo.call(t)}var Zt=Oo;var Ao="[object Null]",jo="[object Undefined]",Jt=T?T.toStringTag:void 0;function Po(t){return t==null?t===void 0?jo:Ao:Jt&&Jt in Object(t)?Yt(t):Zt(t)}var S=Po;function So(t){return t!=null&&typeof t=="object"}var P=So;var Io="[object Symbol]";function _o(t){return typeof t=="symbol"||P(t)&&S(t)==Io}var z=_o;function Eo(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 Xt=Eo;var Fo=Array.isArray,v=Fo;var Co=1/0,Qt=T?T.prototype:void 0,te=Qt?Qt.toString:void 0;function ee(t){if(typeof t=="string")return t;if(v(t))return Xt(t,ee)+"";if(z(t))return te?te.call(t):"";var e=t+"";return e=="0"&&1/t==-Co?"-0":e}var re=ee;function Ro(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var j=Ro;function Mo(t){return t}var oe=Mo;var No="[object AsyncFunction]",Lo="[object Function]",Bo="[object GeneratorFunction]",ko="[object Proxy]";function Do(t){if(!j(t))return!1;var e=S(t);return e==Lo||e==Bo||e==No||e==ko}var dt=Do;var Uo=x["__core-js_shared__"],ct=Uo;var ae=function(){var t=/[^.]+$/.exec(ct&&ct.keys&&ct.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function zo(t){return!!ae&&ae in t}var ie=zo;var Ko=Function.prototype,Go=Ko.toString;function Wo(t){if(t!=null){try{return Go.call(t)}catch{}try{return t+""}catch{}}return""}var E=Wo;var $o=/[\\^$.*+?()[\]{}|]/g,Ho=/^\[object .+?Constructor\]$/,qo=Function.prototype,Vo=Object.prototype,Yo=qo.toString,Zo=Vo.hasOwnProperty,Jo=RegExp("^"+Yo.call(Zo).replace($o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Xo(t){if(!j(t)||ie(t))return!1;var e=dt(t)?Jo:Ho;return e.test(E(t))}var se=Xo;function Qo(t,e){return t?.[e]}var ne=Qo;function ta(t,e){var r=ne(t,e);return se(r)?r:void 0}var O=ta;var ea=O(x,"WeakMap"),ht=ea;var fe=Object.create,ra=function(){function t(){}return function(e){if(!j(e))return{};if(fe)return fe(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),pe=ra;function oa(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 le=oa;function aa(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var me=aa;var ia=800,sa=16,na=Date.now;function fa(t){var e=0,r=0;return function(){var o=na(),a=sa-(o-r);if(r=o,a>0){if(++e>=ia)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var ue=fa;function pa(t){return function(){return t}}var de=pa;var la=function(){try{var t=O(Object,"defineProperty");return t({},"",{}),t}catch{}}(),K=la;var ma=K?function(t,e){return K(t,"toString",{configurable:!0,enumerable:!1,value:de(e),writable:!0})}:oe,ce=ma;var ua=ue(ce),he=ua;function da(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var xe=da;var ca=9007199254740991,ha=/^(?:0|[1-9]\d*)$/;function xa(t,e){var r=typeof t;return e=e??ca,!!e&&(r=="number"||r!="symbol"&&ha.test(t))&&t>-1&&t%1==0&&t<e}var G=xa;function ga(t,e,r){e=="__proto__"&&K?K(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var xt=ga;function ya(t,e){return t===e||t!==t&&e!==e}var gt=ya;var ba=Object.prototype,va=ba.hasOwnProperty;function Ta(t,e,r){var o=t[e];(!(va.call(t,e)&>(o,r))||r===void 0&&!(e in t))&&xt(t,e,r)}var W=Ta;function wa(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=wa;var ge=Math.max;function Oa(t,e,r){return e=ge(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=ge(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),le(t,this,i)}}var ye=Oa;var Aa=9007199254740991;function ja(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Aa}var $=ja;function Pa(t){return t!=null&&$(t.length)&&!dt(t)}var yt=Pa;var Sa=Object.prototype;function Ia(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Sa;return t===r}var H=Ia;function _a(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var be=_a;var Ea="[object Arguments]";function Fa(t){return P(t)&&S(t)==Ea}var Ct=Fa;var ve=Object.prototype,Ca=ve.hasOwnProperty,Ra=ve.propertyIsEnumerable,Ma=Ct(function(){return arguments}())?Ct:function(t){return P(t)&&Ca.call(t,"callee")&&!Ra.call(t,"callee")},q=Ma;function Na(){return!1}var Te=Na;var Ae=typeof exports=="object"&&exports&&!exports.nodeType&&exports,we=Ae&&typeof module=="object"&&module&&!module.nodeType&&module,La=we&&we.exports===Ae,Oe=La?x.Buffer:void 0,Ba=Oe?Oe.isBuffer:void 0,ka=Ba||Te,bt=ka;var Da="[object Arguments]",Ua="[object Array]",za="[object Boolean]",Ka="[object Date]",Ga="[object Error]",Wa="[object Function]",$a="[object Map]",Ha="[object Number]",qa="[object Object]",Va="[object RegExp]",Ya="[object Set]",Za="[object String]",Ja="[object WeakMap]",Xa="[object ArrayBuffer]",Qa="[object DataView]",ti="[object Float32Array]",ei="[object Float64Array]",ri="[object Int8Array]",oi="[object Int16Array]",ai="[object Int32Array]",ii="[object Uint8Array]",si="[object Uint8ClampedArray]",ni="[object Uint16Array]",fi="[object Uint32Array]",c={};c[ti]=c[ei]=c[ri]=c[oi]=c[ai]=c[ii]=c[si]=c[ni]=c[fi]=!0;c[Da]=c[Ua]=c[Xa]=c[za]=c[Qa]=c[Ka]=c[Ga]=c[Wa]=c[$a]=c[Ha]=c[qa]=c[Va]=c[Ya]=c[Za]=c[Ja]=!1;function pi(t){return P(t)&&$(t.length)&&!!c[S(t)]}var je=pi;function li(t){return function(e){return t(e)}}var V=li;var Pe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,pt=Pe&&typeof module=="object"&&module&&!module.nodeType&&module,mi=pt&&pt.exports===Pe,Rt=mi&&ut.process,ui=function(){try{var t=pt&&pt.require&&pt.require("util").types;return t||Rt&&Rt.binding&&Rt.binding("util")}catch{}}(),F=ui;var Se=F&&F.isTypedArray,di=Se?V(Se):je,Ie=di;var ci=Object.prototype,hi=ci.hasOwnProperty;function xi(t,e){var r=v(t),o=!r&&q(t),a=!r&&!o&&bt(t),s=!r&&!o&&!a&&Ie(t),n=r||o||a||s,i=n?be(t.length,String):[],f=i.length;for(var m in t)(e||hi.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=xi;function gi(t,e){return function(r){return t(e(r))}}var Tt=gi;var yi=Tt(Object.keys,Object),_e=yi;var bi=Object.prototype,vi=bi.hasOwnProperty;function Ti(t){if(!H(t))return _e(t);var e=[];for(var r in Object(t))vi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ee=Ti;function wi(t){return yt(t)?vt(t):Ee(t)}var Y=wi;function Oi(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Fe=Oi;var Ai=Object.prototype,ji=Ai.hasOwnProperty;function Pi(t){if(!j(t))return Fe(t);var e=H(t),r=[];for(var o in t)o=="constructor"&&(e||!ji.call(t,o))||r.push(o);return r}var Ce=Pi;function Si(t){return yt(t)?vt(t,!0):Ce(t)}var Z=Si;var Ii=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_i=/^\w*$/;function Ei(t,e){if(v(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||z(t)?!0:_i.test(t)||!Ii.test(t)||e!=null&&t in Object(e)}var Re=Ei;var Fi=O(Object,"create"),C=Fi;function Ci(){this.__data__=C?C(null):{},this.size=0}var Me=Ci;function Ri(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Ne=Ri;var Mi="__lodash_hash_undefined__",Ni=Object.prototype,Li=Ni.hasOwnProperty;function Bi(t){var e=this.__data__;if(C){var r=e[t];return r===Mi?void 0:r}return Li.call(e,t)?e[t]:void 0}var Le=Bi;var ki=Object.prototype,Di=ki.hasOwnProperty;function Ui(t){var e=this.__data__;return C?e[t]!==void 0:Di.call(e,t)}var Be=Ui;var zi="__lodash_hash_undefined__";function Ki(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=C&&e===void 0?zi:e,this}var ke=Ki;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=Me;J.prototype.delete=Ne;J.prototype.get=Le;J.prototype.has=Be;J.prototype.set=ke;var Mt=J;function Gi(){this.__data__=[],this.size=0}var De=Gi;function Wi(t,e){for(var r=t.length;r--;)if(gt(t[r][0],e))return r;return-1}var M=Wi;var $i=Array.prototype,Hi=$i.splice;function qi(t){var e=this.__data__,r=M(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Hi.call(e,r,1),--this.size,!0}var Ue=qi;function Vi(t){var e=this.__data__,r=M(e,t);return r<0?void 0:e[r][1]}var ze=Vi;function Yi(t){return M(this.__data__,t)>-1}var Ke=Yi;function Zi(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 Ge=Zi;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=De;X.prototype.delete=Ue;X.prototype.get=ze;X.prototype.has=Ke;X.prototype.set=Ge;var N=X;var Ji=O(x,"Map"),L=Ji;function Xi(){this.size=0,this.__data__={hash:new Mt,map:new(L||N),string:new Mt}}var We=Xi;function Qi(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var $e=Qi;function ts(t,e){var r=t.__data__;return $e(e)?r[typeof e=="string"?"string":"hash"]:r.map}var B=ts;function es(t){var e=B(this,t).delete(t);return this.size-=e?1:0,e}var He=es;function rs(t){return B(this,t).get(t)}var qe=rs;function os(t){return B(this,t).has(t)}var Ve=os;function as(t,e){var r=B(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ye=as;function Q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Q.prototype.clear=We;Q.prototype.delete=He;Q.prototype.get=qe;Q.prototype.has=Ve;Q.prototype.set=Ye;var lt=Q;var is="Expected a function";function Nt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(is);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 Ze=Nt;var ss=500;function ns(t){var e=Ze(t,function(o){return r.size===ss&&r.clear(),o}),r=e.cache;return e}var Je=ns;var fs=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ps=/\\(\\)?/g,ls=Je(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(fs,function(r,o,a,s){e.push(a?s.replace(ps,"$1"):o||r)}),e}),Xe=ls;function ms(t){return t==null?"":re(t)}var Qe=ms;function us(t,e){return v(t)?t:Re(t,e)?[t]:Xe(Qe(t))}var k=us;var ds=1/0;function cs(t){if(typeof t=="string"||z(t))return t;var e=t+"";return e=="0"&&1/t==-ds?"-0":e}var tt=cs;function hs(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 tr=hs;function xs(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var et=xs;var er=T?T.isConcatSpreadable:void 0;function gs(t){return v(t)||q(t)||!!(er&&t&&t[er])}var rr=gs;function or(t,e,r,o,a){var s=-1,n=t.length;for(r||(r=rr),a||(a=[]);++s<n;){var i=t[s];e>0&&r(i)?e>1?or(i,e-1,r,o,a):et(a,i):o||(a[a.length]=i)}return a}var ar=or;function ys(t){var e=t==null?0:t.length;return e?ar(t,1):[]}var ir=ys;function bs(t){return he(ye(t,void 0,ir),t+"")}var sr=bs;var vs=Tt(Object.getPrototypeOf,Object),wt=vs;function Ts(){this.__data__=new N,this.size=0}var nr=Ts;function ws(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var fr=ws;function Os(t){return this.__data__.get(t)}var pr=Os;function As(t){return this.__data__.has(t)}var lr=As;var js=200;function Ps(t,e){var r=this.__data__;if(r instanceof N){var o=r.__data__;if(!L||o.length<js-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 mr=Ps;function rt(t){var e=this.__data__=new N(t);this.size=e.size}rt.prototype.clear=nr;rt.prototype.delete=fr;rt.prototype.get=pr;rt.prototype.has=lr;rt.prototype.set=mr;var ur=rt;function Ss(t,e){return t&&R(e,Y(e),t)}var dr=Ss;function Is(t,e){return t&&R(e,Z(e),t)}var cr=Is;var yr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,hr=yr&&typeof module=="object"&&module&&!module.nodeType&&module,_s=hr&&hr.exports===yr,xr=_s?x.Buffer:void 0,gr=xr?xr.allocUnsafe:void 0;function Es(t,e){if(e)return t.slice();var r=t.length,o=gr?gr(r):new t.constructor(r);return t.copy(o),o}var br=Es;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 vr=Fs;function Cs(){return[]}var Ot=Cs;var Rs=Object.prototype,Ms=Rs.propertyIsEnumerable,Tr=Object.getOwnPropertySymbols,Ns=Tr?function(t){return t==null?[]:(t=Object(t),vr(Tr(t),function(e){return Ms.call(t,e)}))}:Ot,ot=Ns;function Ls(t,e){return R(t,ot(t),e)}var wr=Ls;var Bs=Object.getOwnPropertySymbols,ks=Bs?function(t){for(var e=[];t;)et(e,ot(t)),t=wt(t);return e}:Ot,At=ks;function Ds(t,e){return R(t,At(t),e)}var Or=Ds;function Us(t,e,r){var o=e(t);return v(t)?o:et(o,r(t))}var jt=Us;function zs(t){return jt(t,Y,ot)}var Ar=zs;function Ks(t){return jt(t,Z,At)}var jr=Ks;var Gs=O(x,"DataView"),Pt=Gs;var Ws=O(x,"Promise"),St=Ws;var $s=O(x,"Set"),It=$s;var Pr="[object Map]",Hs="[object Object]",Sr="[object Promise]",Ir="[object Set]",_r="[object WeakMap]",Er="[object DataView]",qs=E(Pt),Vs=E(L),Ys=E(St),Zs=E(It),Js=E(ht),U=S;(Pt&&U(new Pt(new ArrayBuffer(1)))!=Er||L&&U(new L)!=Pr||St&&U(St.resolve())!=Sr||It&&U(new It)!=Ir||ht&&U(new ht)!=_r)&&(U=function(t){var e=S(t),r=e==Hs?t.constructor:void 0,o=r?E(r):"";if(o)switch(o){case qs:return Er;case Vs:return Pr;case Ys:return Sr;case Zs:return Ir;case Js:return _r}return e});var at=U;var Xs=Object.prototype,Qs=Xs.hasOwnProperty;function tn(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Qs.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Fr=tn;var en=x.Uint8Array,Lt=en;function rn(t){var e=new t.constructor(t.byteLength);return new Lt(e).set(new Lt(t)),e}var it=rn;function on(t,e){var r=e?it(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Cr=on;var an=/\w*$/;function sn(t){var e=new t.constructor(t.source,an.exec(t));return e.lastIndex=t.lastIndex,e}var Rr=sn;var Mr=T?T.prototype:void 0,Nr=Mr?Mr.valueOf:void 0;function nn(t){return Nr?Object(Nr.call(t)):{}}var Lr=nn;function fn(t,e){var r=e?it(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Br=fn;var pn="[object Boolean]",ln="[object Date]",mn="[object Map]",un="[object Number]",dn="[object RegExp]",cn="[object Set]",hn="[object String]",xn="[object Symbol]",gn="[object ArrayBuffer]",yn="[object DataView]",bn="[object Float32Array]",vn="[object Float64Array]",Tn="[object Int8Array]",wn="[object Int16Array]",On="[object Int32Array]",An="[object Uint8Array]",jn="[object Uint8ClampedArray]",Pn="[object Uint16Array]",Sn="[object Uint32Array]";function In(t,e,r){var o=t.constructor;switch(e){case gn:return it(t);case pn:case ln:return new o(+t);case yn:return Cr(t,r);case bn:case vn:case Tn:case wn:case On:case An:case jn:case Pn:case Sn:return Br(t,r);case mn:return new o;case un:case hn:return new o(t);case dn:return Rr(t);case cn:return new o;case xn:return Lr(t)}}var kr=In;function _n(t){return typeof t.constructor=="function"&&!H(t)?pe(wt(t)):{}}var Dr=_n;var En="[object Map]";function Fn(t){return P(t)&&at(t)==En}var Ur=Fn;var zr=F&&F.isMap,Cn=zr?V(zr):Ur,Kr=Cn;var Rn="[object Set]";function Mn(t){return P(t)&&at(t)==Rn}var Gr=Mn;var Wr=F&&F.isSet,Nn=Wr?V(Wr):Gr,$r=Nn;var Ln=1,Bn=2,kn=4,Hr="[object Arguments]",Dn="[object Array]",Un="[object Boolean]",zn="[object Date]",Kn="[object Error]",qr="[object Function]",Gn="[object GeneratorFunction]",Wn="[object Map]",$n="[object Number]",Vr="[object Object]",Hn="[object RegExp]",qn="[object Set]",Vn="[object String]",Yn="[object Symbol]",Zn="[object WeakMap]",Jn="[object ArrayBuffer]",Xn="[object DataView]",Qn="[object Float32Array]",tf="[object Float64Array]",ef="[object Int8Array]",rf="[object Int16Array]",of="[object Int32Array]",af="[object Uint8Array]",sf="[object Uint8ClampedArray]",nf="[object Uint16Array]",ff="[object Uint32Array]",d={};d[Hr]=d[Dn]=d[Jn]=d[Xn]=d[Un]=d[zn]=d[Qn]=d[tf]=d[ef]=d[rf]=d[of]=d[Wn]=d[$n]=d[Vr]=d[Hn]=d[qn]=d[Vn]=d[Yn]=d[af]=d[sf]=d[nf]=d[ff]=!0;d[Kn]=d[qr]=d[Zn]=!1;function _t(t,e,r,o,a,s){var n,i=e&Ln,f=e&Bn,m=e&kn;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 me(t,n)}else{var b=at(t),A=b==qr||b==Gn;if(bt(t))return br(t,i);if(b==Vr||b==Hr||A&&!a){if(n=f||A?{}:Dr(t),!i)return f?Or(t,cr(n,t)):wr(t,dr(n,t))}else{if(!d[b])return a?t:{};n=kr(t,b,i)}}s||(s=new ur);var w=s.get(t);if(w)return w;s.set(t,n),$r(t)?t.forEach(function(y){n.add(_t(y,e,r,y,t,s))}):Kr(t)&&t.forEach(function(y,p){n.set(p,_t(y,e,r,p,t,s))});var g=m?f?jr:Ar:f?Z:Y,I=h?void 0:g(t);return xe(I||t,function(y,p){I&&(p=y,y=t[p]),W(n,p,_t(y,e,r,p,t,s))}),n}var Yr=_t;var pf=1,lf=4;function mf(t){return Yr(t,pf|lf)}var Bt=mf;function uf(t,e){return t!=null&&e in Object(t)}var Zr=uf;function df(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 Jr=df;function cf(t,e){return t!=null&&Jr(t,e,Zr)}var Xr=cf;function hf(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 Qr=hf;function xf(t,e,r){for(var o=-1,a=e.length,s={};++o<a;){var n=e[o],i=tr(t,n);r(i,n)&&Qr(s,k(n,t),i)}return s}var to=xf;function gf(t,e){return to(t,e,function(r,o){return Xr(t,o)})}var eo=gf;var yf=sr(function(t,e){return t==null?{}:eo(t,e)}),Et=yf;function ro(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 oo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var kt=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=oo[r[t]&63];return e};var bf="array",vf="bit",ao="bits",Tf="byte",io="bytes",st="",wf="exponent",Of="function",so="iec",Af="Invalid number",jf="Invalid rounding method",Dt="jedec",Pf="object",no=".",Sf="round",If="s",_f="si",Ef="kbit",Ff="kB",Cf=" ",Rf="string",Mf="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 fo(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:s=st,localeOptions:n={},separator:i=st,spacer:f=Cf,symbols:m={},standard:h=st,output:b=Rf,fullform:A=!1,fullforms:w=[],exponent:g=-1,roundingMethod:I=Sf,precision:y=0}={}){let p=g,u=Number(t),l=[],_=0,Ft=st;h===_f?(o=10,h=Dt):h===so||h===Dt?o=2:o===2?h=so:(o=10,h=Dt);let mt=o===10?1e3:1024,po=A===!0,Kt=u<0,Gt=Math[I];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(Af);if(typeof Gt!==Of)throw new TypeError(jf);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===wf)return p;if(u===0)l[0]=0,Ft=l[1]=Ut.symbol[h][e?ao:io][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++),Ft=l[1]=o===10&&p===1?e?Ef:Ff:Ut.symbol[h][e?ao:io][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(no,i)),r&&Number.isInteger(l[0])===!1&&a>0){let nt=i||no,Wt=l[0].toString().split(nt),$t=Wt[1]||st,Ht=$t.length,lo=a-Ht;l[0]=`${Wt[0]}${nt}${$t.padEnd(Ht+lo,Mf)}`}return po&&(l[1]=w[p]?w[p]:Ut.fullform[h][p]+(e?vf:Tf)+(l[0]===1?st:If)),b===bf?l:b===Pf?{value:l[0],symbol:l[1],exponent:p,unit:Ft}: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=fo(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=ro();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);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
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
|
|
package/lib/terafy.client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {diff
|
|
1
|
+
import {diff} from 'just-diff';
|
|
2
2
|
import {cloneDeep} from 'lodash-es';
|
|
3
3
|
import Mitt from 'mitt';
|
|
4
4
|
import {nanoid} from 'nanoid';
|
|
@@ -293,7 +293,7 @@ export default class TeraFy {
|
|
|
293
293
|
* @returns {Promise} A promise which will resolve when the operation has completed
|
|
294
294
|
*/
|
|
295
295
|
createProjectStatePatch(newState, oldState) {
|
|
296
|
-
let patch = diff(oldState, newState
|
|
296
|
+
let patch = diff(oldState, newState);
|
|
297
297
|
this.debug('INFO', 3, 'Created project patch', {patch, newState, oldState});
|
|
298
298
|
return this.applyProjectStatePatch(patch);
|
|
299
299
|
}
|
package/lib/terafy.server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {cloneDeep} from 'lodash-es';
|
|
2
|
-
import {diffApply
|
|
2
|
+
import {diffApply} from 'just-diff-apply';
|
|
3
3
|
import mixin from '#utils/mixin';
|
|
4
4
|
import {nanoid} from 'nanoid';
|
|
5
5
|
import pathTools from '#utils/pathTools';
|
|
@@ -104,10 +104,11 @@ export default class TeraFyServer {
|
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
});
|
|
107
|
-
case TeraFyServer.
|
|
107
|
+
case TeraFyServer.SERVERMODE_TERA:
|
|
108
|
+
case TeraFyServer.SERVERMODE_FRAME: {
|
|
108
109
|
// Server is the top-level window so we need to send messages to an embedded iFrame
|
|
109
|
-
|
|
110
|
-
if (!iFrame)
|
|
110
|
+
let iFrame = document.querySelector('iframe#external');
|
|
111
|
+
if (!iFrame) return console.warn('Cannot locate TERA-FY top-level->iFrame#external - maybe there is none');
|
|
111
112
|
|
|
112
113
|
return mixin(this, {
|
|
113
114
|
sendRaw(message) {
|
|
@@ -124,6 +125,7 @@ export default class TeraFyServer {
|
|
|
124
125
|
}
|
|
125
126
|
},
|
|
126
127
|
});
|
|
128
|
+
}
|
|
127
129
|
case TeraFyServer.SERVERMODE_POPUP:
|
|
128
130
|
}
|
|
129
131
|
}
|
|
@@ -874,7 +876,7 @@ export default class TeraFyServer {
|
|
|
874
876
|
applyProjectStatePatch(patch) {
|
|
875
877
|
if (!app.service('$projects').active) throw new Error('No active project to patch');
|
|
876
878
|
this.debug('INFO', 1, 'Applying', patch.length, 'project state patch', patch);
|
|
877
|
-
diffApply(app.service('$projects').active, patch
|
|
879
|
+
diffApply(app.service('$projects').active, patch);
|
|
878
880
|
|
|
879
881
|
return Promise.resolve();
|
|
880
882
|
}
|
package/package.json
CHANGED
package/plugins/vue3.js
CHANGED