@iebh/tera-fy 1.5.0 → 1.6.1
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 +21 -0
- package/api.md +457 -417
- package/dist/plugin.vue2.es2019.js +1 -1
- package/dist/terafy.es2019.js +2 -2
- package/dist/terafy.js +1 -1
- package/lib/projectFile.js +25 -4
- package/lib/terafy.client.js +39 -10
- package/lib/terafy.server.js +73 -40
- package/package.json +6 -3
- package/plugins/vue2.js +5 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var fr=Object.defineProperty;var sr=(t,e,r)=>e in t?fr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var q=(t,e,r)=>(sr(t,typeof e!="symbol"?e+"":e,r),r);var pr=typeof global=="object"&&global&&global.Object===Object&&global,k=pr;var ir=typeof self=="object"&&self&&self.Object===Object&&self,nr=k||ir||Function("return this")(),u=nr;var ur=u.Symbol,h=ur;var At=Object.prototype,mr=At.hasOwnProperty,lr=At.toString,W=h?h.toStringTag:void 0;function dr(t){var e=mr.call(t,W),r=t[W];try{t[W]=void 0;var o=!0}catch{}var a=lr.call(t);return o&&(e?t[W]=r:delete t[W]),a}var _t=dr;var cr=Object.prototype,xr=cr.toString;function hr(t){return xr.call(t)}var wt=hr;var gr="[object Null]",yr="[object Undefined]",St=h?h.toStringTag:void 0;function br(t){return t==null?t===void 0?yr:gr:St&&St in Object(t)?_t(t):wt(t)}var g=br;function vr(t){return t!=null&&typeof t=="object"}var c=vr;var jr=Array.isArray,C=jr;function Tr(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var x=Tr;var Or="[object AsyncFunction]",Ar="[object Function]",_r="[object GeneratorFunction]",wr="[object Proxy]";function Sr(t){if(!x(t))return!1;var e=g(t);return e==Ar||e==_r||e==Or||e==wr}var H=Sr;var Ir=u["__core-js_shared__"],$=Ir;var It=function(){var t=/[^.]+$/.exec($&&$.keys&&$.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Pr(t){return!!It&&It in t}var Pt=Pr;var Cr=Function.prototype,Er=Cr.toString;function Br(t){if(t!=null){try{return Er.call(t)}catch{}try{return t+""}catch{}}return""}var y=Br;var Lr=/[\\^$.*+?()[\]{}|]/g,Mr=/^\[object .+?Constructor\]$/,Dr=Function.prototype,Fr=Object.prototype,Nr=Dr.toString,Rr=Fr.hasOwnProperty,Ur=RegExp("^"+Nr.call(Rr).replace(Lr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Gr(t){if(!x(t)||Pt(t))return!1;var e=H(t)?Ur:Mr;return e.test(y(t))}var Ct=Gr;function Vr(t,e){return t==null?void 0:t[e]}var Et=Vr;function Wr(t,e){var r=Et(t,e);return Ct(r)?r:void 0}var m=Wr;var Kr=m(u,"WeakMap"),J=Kr;var Bt=Object.create,zr=function(){function t(){}return function(e){if(!x(e))return{};if(Bt)return Bt(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),Lt=zr;function qr(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var Mt=qr;var kr=function(){try{var t=m(Object,"defineProperty");return t({},"",{}),t}catch{}}(),ct=kr;function Hr(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var Dt=Hr;var $r=9007199254740991,Jr=/^(?:0|[1-9]\d*)$/;function Yr(t,e){var r=typeof t;return e=e==null?$r:e,!!e&&(r=="number"||r!="symbol"&&Jr.test(t))&&t>-1&&t%1==0&&t<e}var Ft=Yr;function Xr(t,e,r){e=="__proto__"&&ct?ct(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Y=Xr;function Zr(t,e){return t===e||t!==t&&e!==e}var X=Zr;var Qr=Object.prototype,to=Qr.hasOwnProperty;function eo(t,e,r){var o=t[e];(!(to.call(t,e)&&X(o,r))||r===void 0&&!(e in t))&&Y(t,e,r)}var Z=eo;function ro(t,e,r,o){var a=!r;r||(r={});for(var f=-1,s=e.length;++f<s;){var n=e[f],l=o?o(r[n],t[n],n,r,t):void 0;l===void 0&&(l=t[n]),a?Y(r,n,l):Z(r,n,l)}return r}var T=ro;var oo=9007199254740991;function ao(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=oo}var Q=ao;function fo(t){return t!=null&&Q(t.length)&&!H(t)}var tt=fo;var so=Object.prototype;function po(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||so;return t===r}var E=po;function io(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var Nt=io;var no="[object Arguments]";function uo(t){return c(t)&&g(t)==no}var xt=uo;var Rt=Object.prototype,mo=Rt.hasOwnProperty,lo=Rt.propertyIsEnumerable,co=xt(function(){return arguments}())?xt:function(t){return c(t)&&mo.call(t,"callee")&&!lo.call(t,"callee")},Ut=co;function xo(){return!1}var Gt=xo;var Kt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Vt=Kt&&typeof module=="object"&&module&&!module.nodeType&&module,ho=Vt&&Vt.exports===Kt,Wt=ho?u.Buffer:void 0,go=Wt?Wt.isBuffer:void 0,yo=go||Gt,et=yo;var bo="[object Arguments]",vo="[object Array]",jo="[object Boolean]",To="[object Date]",Oo="[object Error]",Ao="[object Function]",_o="[object Map]",wo="[object Number]",So="[object Object]",Io="[object RegExp]",Po="[object Set]",Co="[object String]",Eo="[object WeakMap]",Bo="[object ArrayBuffer]",Lo="[object DataView]",Mo="[object Float32Array]",Do="[object Float64Array]",Fo="[object Int8Array]",No="[object Int16Array]",Ro="[object Int32Array]",Uo="[object Uint8Array]",Go="[object Uint8ClampedArray]",Vo="[object Uint16Array]",Wo="[object Uint32Array]",i={};i[Mo]=i[Do]=i[Fo]=i[No]=i[Ro]=i[Uo]=i[Go]=i[Vo]=i[Wo]=!0;i[bo]=i[vo]=i[Bo]=i[jo]=i[Lo]=i[To]=i[Oo]=i[Ao]=i[_o]=i[wo]=i[So]=i[Io]=i[Po]=i[Co]=i[Eo]=!1;function Ko(t){return c(t)&&Q(t.length)&&!!i[g(t)]}var zt=Ko;function zo(t){return function(e){return t(e)}}var B=zo;var qt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,K=qt&&typeof module=="object"&&module&&!module.nodeType&&module,qo=K&&K.exports===qt,ht=qo&&k.process,ko=function(){try{var t=K&&K.require&&K.require("util").types;return t||ht&&ht.binding&&ht.binding("util")}catch{}}(),b=ko;var kt=b&&b.isTypedArray,Ho=kt?B(kt):zt,Ht=Ho;var $o=Object.prototype,Jo=$o.hasOwnProperty;function Yo(t,e){var r=C(t),o=!r&&Ut(t),a=!r&&!o&&et(t),f=!r&&!o&&!a&&Ht(t),s=r||o||a||f,n=s?Nt(t.length,String):[],l=n.length;for(var d in t)(e||Jo.call(t,d))&&!(s&&(d=="length"||a&&(d=="offset"||d=="parent")||f&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||Ft(d,l)))&&n.push(d);return n}var rt=Yo;function Xo(t,e){return function(r){return t(e(r))}}var ot=Xo;var Zo=ot(Object.keys,Object),$t=Zo;var Qo=Object.prototype,ta=Qo.hasOwnProperty;function ea(t){if(!E(t))return $t(t);var e=[];for(var r in Object(t))ta.call(t,r)&&r!="constructor"&&e.push(r);return e}var Jt=ea;function ra(t){return tt(t)?rt(t):Jt(t)}var L=ra;function oa(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Yt=oa;var aa=Object.prototype,fa=aa.hasOwnProperty;function sa(t){if(!x(t))return Yt(t);var e=E(t),r=[];for(var o in t)o=="constructor"&&(e||!fa.call(t,o))||r.push(o);return r}var Xt=sa;function pa(t){return tt(t)?rt(t,!0):Xt(t)}var M=pa;var ia=m(Object,"create"),v=ia;function na(){this.__data__=v?v(null):{},this.size=0}var Zt=na;function ua(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Qt=ua;var ma="__lodash_hash_undefined__",la=Object.prototype,da=la.hasOwnProperty;function ca(t){var e=this.__data__;if(v){var r=e[t];return r===ma?void 0:r}return da.call(e,t)?e[t]:void 0}var te=ca;var xa=Object.prototype,ha=xa.hasOwnProperty;function ga(t){var e=this.__data__;return v?e[t]!==void 0:ha.call(e,t)}var ee=ga;var ya="__lodash_hash_undefined__";function ba(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=v&&e===void 0?ya:e,this}var re=ba;function D(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])}}D.prototype.clear=Zt;D.prototype.delete=Qt;D.prototype.get=te;D.prototype.has=ee;D.prototype.set=re;var gt=D;function va(){this.__data__=[],this.size=0}var oe=va;function ja(t,e){for(var r=t.length;r--;)if(X(t[r][0],e))return r;return-1}var O=ja;var Ta=Array.prototype,Oa=Ta.splice;function Aa(t){var e=this.__data__,r=O(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Oa.call(e,r,1),--this.size,!0}var ae=Aa;function _a(t){var e=this.__data__,r=O(e,t);return r<0?void 0:e[r][1]}var fe=_a;function wa(t){return O(this.__data__,t)>-1}var se=wa;function Sa(t,e){var r=this.__data__,o=O(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var pe=Sa;function F(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])}}F.prototype.clear=oe;F.prototype.delete=ae;F.prototype.get=fe;F.prototype.has=se;F.prototype.set=pe;var A=F;var Ia=m(u,"Map"),_=Ia;function Pa(){this.size=0,this.__data__={hash:new gt,map:new(_||A),string:new gt}}var ie=Pa;function Ca(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var ne=Ca;function Ea(t,e){var r=t.__data__;return ne(e)?r[typeof e=="string"?"string":"hash"]:r.map}var w=Ea;function Ba(t){var e=w(this,t).delete(t);return this.size-=e?1:0,e}var ue=Ba;function La(t){return w(this,t).get(t)}var me=La;function Ma(t){return w(this,t).has(t)}var le=Ma;function Da(t,e){var r=w(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var de=Da;function N(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])}}N.prototype.clear=ie;N.prototype.delete=ue;N.prototype.get=me;N.prototype.has=le;N.prototype.set=de;var ce=N;function Fa(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var at=Fa;var Na=ot(Object.getPrototypeOf,Object),ft=Na;function Ra(){this.__data__=new A,this.size=0}var xe=Ra;function Ua(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var he=Ua;function Ga(t){return this.__data__.get(t)}var ge=Ga;function Va(t){return this.__data__.has(t)}var ye=Va;var Wa=200;function Ka(t,e){var r=this.__data__;if(r instanceof A){var o=r.__data__;if(!_||o.length<Wa-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new ce(o)}return r.set(t,e),this.size=r.size,this}var be=Ka;function R(t){var e=this.__data__=new A(t);this.size=e.size}R.prototype.clear=xe;R.prototype.delete=he;R.prototype.get=ge;R.prototype.has=ye;R.prototype.set=be;var ve=R;function za(t,e){return t&&T(e,L(e),t)}var je=za;function qa(t,e){return t&&T(e,M(e),t)}var Te=qa;var we=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Oe=we&&typeof module=="object"&&module&&!module.nodeType&&module,ka=Oe&&Oe.exports===we,Ae=ka?u.Buffer:void 0,_e=Ae?Ae.allocUnsafe:void 0;function Ha(t,e){if(e)return t.slice();var r=t.length,o=_e?_e(r):new t.constructor(r);return t.copy(o),o}var Se=Ha;function $a(t,e){for(var r=-1,o=t==null?0:t.length,a=0,f=[];++r<o;){var s=t[r];e(s,r,t)&&(f[a++]=s)}return f}var Ie=$a;function Ja(){return[]}var st=Ja;var Ya=Object.prototype,Xa=Ya.propertyIsEnumerable,Pe=Object.getOwnPropertySymbols,Za=Pe?function(t){return t==null?[]:(t=Object(t),Ie(Pe(t),function(e){return Xa.call(t,e)}))}:st,U=Za;function Qa(t,e){return T(t,U(t),e)}var Ce=Qa;var tf=Object.getOwnPropertySymbols,ef=tf?function(t){for(var e=[];t;)at(e,U(t)),t=ft(t);return e}:st,pt=ef;function rf(t,e){return T(t,pt(t),e)}var Ee=rf;function of(t,e,r){var o=e(t);return C(t)?o:at(o,r(t))}var it=of;function af(t){return it(t,L,U)}var Be=af;function ff(t){return it(t,M,pt)}var Le=ff;var sf=m(u,"DataView"),nt=sf;var pf=m(u,"Promise"),ut=pf;var nf=m(u,"Set"),mt=nf;var Me="[object Map]",uf="[object Object]",De="[object Promise]",Fe="[object Set]",Ne="[object WeakMap]",Re="[object DataView]",mf=y(nt),lf=y(_),df=y(ut),cf=y(mt),xf=y(J),I=g;(nt&&I(new nt(new ArrayBuffer(1)))!=Re||_&&I(new _)!=Me||ut&&I(ut.resolve())!=De||mt&&I(new mt)!=Fe||J&&I(new J)!=Ne)&&(I=function(t){var e=g(t),r=e==uf?t.constructor:void 0,o=r?y(r):"";if(o)switch(o){case mf:return Re;case lf:return Me;case df:return De;case cf:return Fe;case xf:return Ne}return e});var G=I;var hf=Object.prototype,gf=hf.hasOwnProperty;function yf(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&gf.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Ue=yf;var bf=u.Uint8Array,yt=bf;function vf(t){var e=new t.constructor(t.byteLength);return new yt(e).set(new yt(t)),e}var V=vf;function jf(t,e){var r=e?V(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Ge=jf;var Tf=/\w*$/;function Of(t){var e=new t.constructor(t.source,Tf.exec(t));return e.lastIndex=t.lastIndex,e}var Ve=Of;var We=h?h.prototype:void 0,Ke=We?We.valueOf:void 0;function Af(t){return Ke?Object(Ke.call(t)):{}}var ze=Af;function _f(t,e){var r=e?V(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var qe=_f;var wf="[object Boolean]",Sf="[object Date]",If="[object Map]",Pf="[object Number]",Cf="[object RegExp]",Ef="[object Set]",Bf="[object String]",Lf="[object Symbol]",Mf="[object ArrayBuffer]",Df="[object DataView]",Ff="[object Float32Array]",Nf="[object Float64Array]",Rf="[object Int8Array]",Uf="[object Int16Array]",Gf="[object Int32Array]",Vf="[object Uint8Array]",Wf="[object Uint8ClampedArray]",Kf="[object Uint16Array]",zf="[object Uint32Array]";function qf(t,e,r){var o=t.constructor;switch(e){case Mf:return V(t);case wf:case Sf:return new o(+t);case Df:return Ge(t,r);case Ff:case Nf:case Rf:case Uf:case Gf:case Vf:case Wf:case Kf:case zf:return qe(t,r);case If:return new o;case Pf:case Bf:return new o(t);case Cf:return Ve(t);case Ef:return new o;case Lf:return ze(t)}}var ke=qf;function kf(t){return typeof t.constructor=="function"&&!E(t)?Lt(ft(t)):{}}var He=kf;var Hf="[object Map]";function $f(t){return c(t)&&G(t)==Hf}var $e=$f;var Je=b&&b.isMap,Jf=Je?B(Je):$e,Ye=Jf;var Yf="[object Set]";function Xf(t){return c(t)&&G(t)==Yf}var Xe=Xf;var Ze=b&&b.isSet,Zf=Ze?B(Ze):Xe,Qe=Zf;var Qf=1,ts=2,es=4,tr="[object Arguments]",rs="[object Array]",os="[object Boolean]",as="[object Date]",fs="[object Error]",er="[object Function]",ss="[object GeneratorFunction]",ps="[object Map]",is="[object Number]",rr="[object Object]",ns="[object RegExp]",us="[object Set]",ms="[object String]",ls="[object Symbol]",ds="[object WeakMap]",cs="[object ArrayBuffer]",xs="[object DataView]",hs="[object Float32Array]",gs="[object Float64Array]",ys="[object Int8Array]",bs="[object Int16Array]",vs="[object Int32Array]",js="[object Uint8Array]",Ts="[object Uint8ClampedArray]",Os="[object Uint16Array]",As="[object Uint32Array]",p={};p[tr]=p[rs]=p[cs]=p[xs]=p[os]=p[as]=p[hs]=p[gs]=p[ys]=p[bs]=p[vs]=p[ps]=p[is]=p[rr]=p[ns]=p[us]=p[ms]=p[ls]=p[js]=p[Ts]=p[Os]=p[As]=!0;p[fs]=p[er]=p[ds]=!1;function lt(t,e,r,o,a,f){var s,n=e&Qf,l=e&ts,d=e&es;if(r&&(s=a?r(t,o,a,f):r(t)),s!==void 0)return s;if(!x(t))return t;var vt=C(t);if(vt){if(s=Ue(t),!n)return Mt(t,s)}else{var P=G(t),jt=P==er||P==ss;if(et(t))return Se(t,n);if(P==rr||P==tr||jt&&!a){if(s=l||jt?{}:He(t),!n)return l?Ee(t,Te(s,t)):Ce(t,je(s,t))}else{if(!p[P])return a?t:{};s=ke(t,P,n)}}f||(f=new ve);var Tt=f.get(t);if(Tt)return Tt;f.set(t,s),Qe(t)?t.forEach(function(j){s.add(lt(j,e,r,j,t,f))}):Ye(t)&&t.forEach(function(j,S){s.set(S,lt(j,e,r,S,t,f))});var ar=d?l?Le:Be:l?M:L,Ot=vt?void 0:ar(t);return Dt(Ot||t,function(j,S){Ot&&(S=j,j=t[S]),Z(s,S,lt(j,e,r,S,t,f))}),s}var or=lt;var _s=1,ws=4;function Ss(t){return or(t,_s|ws)}var dt=Ss;var z=class{init(){}constructor(e,r){}};var bt=class extends z{constructor(){super(...arguments);q(this,"Vue");q(this,"projects");q(this,"state",null)}bindProjectState(r){let o={component:null,componentKey:null,autoRequire:!0,write:!0,...r};return Promise.resolve().then(()=>Promise.all([this.getProjectState({autoRequire:o.autoRequire}),(()=>{if(!o.componentKey){for(let a=0;a<50;a++){let f=`terafy_${a}`;if(!Object.hasOwnProperty(o.component,f)){o.componentKey=f;return}}throw new Error("Unable to find unique key to allocate against Vue2 component")}})()])).then(([a])=>{this.debug("INFO",2,"Got project snapshot",a);let f=this.Vue.observable(a);o.component[o.componentKey]=f;let s=0;if(o.read&&this.events.on(`update:projects/${f.id}`,n=>{s++,this.merge(f,n)}),o.write){if(!o.component)throw new Error("bindProjectState requires a VueComponent specified as `component`");let n=dt(a);o.component.$watch(o.componentKey,l=>{if(s>0){s--;return}this.createProjectStatePatch(l,n),n=dt(a)},{deep:!0})}return f})}merge(r,...o){return o.forEach(a=>Object.keys(a).forEach(f=>{typeof a[f]=="object"?(f in r||this.Vue.set(r,f,Array.isArray(a[f])?[]:{}),this.merge(r[f],a[f])):this.Vue.set(r,f,a[f])})),r}init(r){let o={app:null,Vue:null,globalName:"$tera",requireProject:!0,subscribeState:!0,subscribeProjects:!0,stateOptions:{read:!0,write:!0},...r};if(!o.Vue)throw new Error("Vue instance to use must be specified in init options as `Vue`");if(this.Vue=r.Vue,!this.settings.app)throw new Error("Need to specify the root level Vue2 app during init");return o.stateOptions.app=this.settings.app,this.projects=this.Vue.observable([]),o.globalName&&(this.Vue.prototype[o.globalName]=this),this.state=null,Promise.resolve().then(()=>o.requireProject&&this.requireProject()).then(()=>Promise.all([o.subscribeState&&this.bindProjectState({...o.stateOptions,component:this.settings.app.$root}).then(a=>this.state=a).then(()=>this.debug("INFO",1,"Loaded initial project state",this.state)),o.subscribeProjects&&this.getProjects().then(a=>this.projects=this.Vue.observable(a)).then(()=>this.debug("INFO",2,"Loaded project list",this.projects))])).then(()=>this.debug("INFO",1,"Ready"))}};export{bt as default};
|
|
1
|
+
var pr=Object.defineProperty;var ir=(t,e,r)=>e in t?pr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var k=(t,e,r)=>(ir(t,typeof e!="symbol"?e+"":e,r),r);var nr=typeof global=="object"&&global&&global.Object===Object&&global,H=nr;var ur=typeof self=="object"&&self&&self.Object===Object&&self,mr=H||ur||Function("return this")(),u=mr;var lr=u.Symbol,h=lr;var At=Object.prototype,dr=At.hasOwnProperty,cr=At.toString,K=h?h.toStringTag:void 0;function xr(t){var e=dr.call(t,K),r=t[K];try{t[K]=void 0;var o=!0}catch{}var f=cr.call(t);return o&&(e?t[K]=r:delete t[K]),f}var wt=xr;var gr=Object.prototype,hr=gr.toString;function br(t){return hr.call(t)}var St=br;var yr="[object Null]",jr="[object Undefined]",It=h?h.toStringTag:void 0;function vr(t){return t==null?t===void 0?jr:yr:It&&It in Object(t)?wt(t):St(t)}var x=vr;function Tr(t){return t!=null&&typeof t=="object"}var d=Tr;var Or=Array.isArray,C=Or;function _r(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var g=_r;var Ar="[object AsyncFunction]",wr="[object Function]",Sr="[object GeneratorFunction]",Ir="[object Proxy]";function Pr(t){if(!g(t))return!1;var e=x(t);return e==wr||e==Sr||e==Ar||e==Ir}var $=Pr;var Cr=u["__core-js_shared__"],J=Cr;var Pt=function(){var t=/[^.]+$/.exec(J&&J.keys&&J.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Er(t){return!!Pt&&Pt in t}var Ct=Er;var Lr=Function.prototype,Br=Lr.toString;function Mr(t){if(t!=null){try{return Br.call(t)}catch{}try{return t+""}catch{}}return""}var b=Mr;var Fr=/[\\^$.*+?()[\]{}|]/g,Nr=/^\[object .+?Constructor\]$/,Dr=Function.prototype,Rr=Object.prototype,Ur=Dr.toString,Gr=Rr.hasOwnProperty,Vr=RegExp("^"+Ur.call(Gr).replace(Fr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Wr(t){if(!g(t)||Ct(t))return!1;var e=$(t)?Vr:Nr;return e.test(b(t))}var Et=Wr;function Kr(t,e){return t==null?void 0:t[e]}var Lt=Kr;function zr(t,e){var r=Lt(t,e);return Et(r)?r:void 0}var l=zr;var qr=l(u,"WeakMap"),Y=qr;var Bt=Object.create,kr=function(){function t(){}return function(e){if(!g(e))return{};if(Bt)return Bt(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),Mt=kr;function Hr(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var Ft=Hr;var $r=function(){try{var t=l(Object,"defineProperty");return t({},"",{}),t}catch{}}(),ct=$r;function Jr(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var Nt=Jr;var Yr=9007199254740991,Xr=/^(?:0|[1-9]\d*)$/;function Zr(t,e){var r=typeof t;return e=e==null?Yr:e,!!e&&(r=="number"||r!="symbol"&&Xr.test(t))&&t>-1&&t%1==0&&t<e}var Dt=Zr;function Qr(t,e,r){e=="__proto__"&&ct?ct(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var X=Qr;function to(t,e){return t===e||t!==t&&e!==e}var Z=to;var eo=Object.prototype,ro=eo.hasOwnProperty;function oo(t,e,r){var o=t[e];(!(ro.call(t,e)&&Z(o,r))||r===void 0&&!(e in t))&&X(t,e,r)}var Q=oo;function ao(t,e,r,o){var f=!r;r||(r={});for(var a=-1,s=e.length;++a<s;){var n=e[a],m=o?o(r[n],t[n],n,r,t):void 0;m===void 0&&(m=t[n]),f?X(r,n,m):Q(r,n,m)}return r}var T=ao;var fo=9007199254740991;function so(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=fo}var tt=so;function po(t){return t!=null&&tt(t.length)&&!$(t)}var et=po;var io=Object.prototype;function no(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||io;return t===r}var E=no;function uo(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var Rt=uo;var mo="[object Arguments]";function lo(t){return d(t)&&x(t)==mo}var xt=lo;var Ut=Object.prototype,co=Ut.hasOwnProperty,xo=Ut.propertyIsEnumerable,go=xt(function(){return arguments}())?xt:function(t){return d(t)&&co.call(t,"callee")&&!xo.call(t,"callee")},Gt=go;function ho(){return!1}var Vt=ho;var zt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Wt=zt&&typeof module=="object"&&module&&!module.nodeType&&module,bo=Wt&&Wt.exports===zt,Kt=bo?u.Buffer:void 0,yo=Kt?Kt.isBuffer:void 0,jo=yo||Vt,rt=jo;var vo="[object Arguments]",To="[object Array]",Oo="[object Boolean]",_o="[object Date]",Ao="[object Error]",wo="[object Function]",So="[object Map]",Io="[object Number]",Po="[object Object]",Co="[object RegExp]",Eo="[object Set]",Lo="[object String]",Bo="[object WeakMap]",Mo="[object ArrayBuffer]",Fo="[object DataView]",No="[object Float32Array]",Do="[object Float64Array]",Ro="[object Int8Array]",Uo="[object Int16Array]",Go="[object Int32Array]",Vo="[object Uint8Array]",Wo="[object Uint8ClampedArray]",Ko="[object Uint16Array]",zo="[object Uint32Array]",i={};i[No]=i[Do]=i[Ro]=i[Uo]=i[Go]=i[Vo]=i[Wo]=i[Ko]=i[zo]=!0;i[vo]=i[To]=i[Mo]=i[Oo]=i[Fo]=i[_o]=i[Ao]=i[wo]=i[So]=i[Io]=i[Po]=i[Co]=i[Eo]=i[Lo]=i[Bo]=!1;function qo(t){return d(t)&&tt(t.length)&&!!i[x(t)]}var qt=qo;function ko(t){return function(e){return t(e)}}var L=ko;var kt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,z=kt&&typeof module=="object"&&module&&!module.nodeType&&module,Ho=z&&z.exports===kt,gt=Ho&&H.process,$o=function(){try{var t=z&&z.require&&z.require("util").types;return t||gt&>.binding&>.binding("util")}catch{}}(),y=$o;var Ht=y&&y.isTypedArray,Jo=Ht?L(Ht):qt,$t=Jo;var Yo=Object.prototype,Xo=Yo.hasOwnProperty;function Zo(t,e){var r=C(t),o=!r&&Gt(t),f=!r&&!o&&rt(t),a=!r&&!o&&!f&&$t(t),s=r||o||f||a,n=s?Rt(t.length,String):[],m=n.length;for(var c in t)(e||Xo.call(t,c))&&!(s&&(c=="length"||f&&(c=="offset"||c=="parent")||a&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Dt(c,m)))&&n.push(c);return n}var ot=Zo;function Qo(t,e){return function(r){return t(e(r))}}var at=Qo;var ta=at(Object.keys,Object),Jt=ta;var ea=Object.prototype,ra=ea.hasOwnProperty;function oa(t){if(!E(t))return Jt(t);var e=[];for(var r in Object(t))ra.call(t,r)&&r!="constructor"&&e.push(r);return e}var Yt=oa;function aa(t){return et(t)?ot(t):Yt(t)}var B=aa;function fa(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Xt=fa;var sa=Object.prototype,pa=sa.hasOwnProperty;function ia(t){if(!g(t))return Xt(t);var e=E(t),r=[];for(var o in t)o=="constructor"&&(e||!pa.call(t,o))||r.push(o);return r}var Zt=ia;function na(t){return et(t)?ot(t,!0):Zt(t)}var M=na;var ua=l(Object,"create"),j=ua;function ma(){this.__data__=j?j(null):{},this.size=0}var Qt=ma;function la(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var te=la;var da="__lodash_hash_undefined__",ca=Object.prototype,xa=ca.hasOwnProperty;function ga(t){var e=this.__data__;if(j){var r=e[t];return r===da?void 0:r}return xa.call(e,t)?e[t]:void 0}var ee=ga;var ha=Object.prototype,ba=ha.hasOwnProperty;function ya(t){var e=this.__data__;return j?e[t]!==void 0:ba.call(e,t)}var re=ya;var ja="__lodash_hash_undefined__";function va(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=j&&e===void 0?ja:e,this}var oe=va;function F(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])}}F.prototype.clear=Qt;F.prototype.delete=te;F.prototype.get=ee;F.prototype.has=re;F.prototype.set=oe;var ht=F;function Ta(){this.__data__=[],this.size=0}var ae=Ta;function Oa(t,e){for(var r=t.length;r--;)if(Z(t[r][0],e))return r;return-1}var O=Oa;var _a=Array.prototype,Aa=_a.splice;function wa(t){var e=this.__data__,r=O(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Aa.call(e,r,1),--this.size,!0}var fe=wa;function Sa(t){var e=this.__data__,r=O(e,t);return r<0?void 0:e[r][1]}var se=Sa;function Ia(t){return O(this.__data__,t)>-1}var pe=Ia;function Pa(t,e){var r=this.__data__,o=O(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var ie=Pa;function N(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])}}N.prototype.clear=ae;N.prototype.delete=fe;N.prototype.get=se;N.prototype.has=pe;N.prototype.set=ie;var _=N;var Ca=l(u,"Map"),A=Ca;function Ea(){this.size=0,this.__data__={hash:new ht,map:new(A||_),string:new ht}}var ne=Ea;function La(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var ue=La;function Ba(t,e){var r=t.__data__;return ue(e)?r[typeof e=="string"?"string":"hash"]:r.map}var w=Ba;function Ma(t){var e=w(this,t).delete(t);return this.size-=e?1:0,e}var me=Ma;function Fa(t){return w(this,t).get(t)}var le=Fa;function Na(t){return w(this,t).has(t)}var de=Na;function Da(t,e){var r=w(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var ce=Da;function D(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])}}D.prototype.clear=ne;D.prototype.delete=me;D.prototype.get=le;D.prototype.has=de;D.prototype.set=ce;var xe=D;function Ra(t,e){for(var r=-1,o=e.length,f=t.length;++r<o;)t[f+r]=e[r];return t}var ft=Ra;var Ua=at(Object.getPrototypeOf,Object),R=Ua;var Ga="[object Object]",Va=Function.prototype,Wa=Object.prototype,ge=Va.toString,Ka=Wa.hasOwnProperty,za=ge.call(Object);function qa(t){if(!d(t)||x(t)!=Ga)return!1;var e=R(t);if(e===null)return!0;var r=Ka.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&ge.call(r)==za}var bt=qa;function ka(){this.__data__=new _,this.size=0}var he=ka;function Ha(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var be=Ha;function $a(t){return this.__data__.get(t)}var ye=$a;function Ja(t){return this.__data__.has(t)}var je=Ja;var Ya=200;function Xa(t,e){var r=this.__data__;if(r instanceof _){var o=r.__data__;if(!A||o.length<Ya-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new xe(o)}return r.set(t,e),this.size=r.size,this}var ve=Xa;function U(t){var e=this.__data__=new _(t);this.size=e.size}U.prototype.clear=he;U.prototype.delete=be;U.prototype.get=ye;U.prototype.has=je;U.prototype.set=ve;var Te=U;function Za(t,e){return t&&T(e,B(e),t)}var Oe=Za;function Qa(t,e){return t&&T(e,M(e),t)}var _e=Qa;var Ie=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ae=Ie&&typeof module=="object"&&module&&!module.nodeType&&module,tf=Ae&&Ae.exports===Ie,we=tf?u.Buffer:void 0,Se=we?we.allocUnsafe:void 0;function ef(t,e){if(e)return t.slice();var r=t.length,o=Se?Se(r):new t.constructor(r);return t.copy(o),o}var Pe=ef;function rf(t,e){for(var r=-1,o=t==null?0:t.length,f=0,a=[];++r<o;){var s=t[r];e(s,r,t)&&(a[f++]=s)}return a}var Ce=rf;function of(){return[]}var st=of;var af=Object.prototype,ff=af.propertyIsEnumerable,Ee=Object.getOwnPropertySymbols,sf=Ee?function(t){return t==null?[]:(t=Object(t),Ce(Ee(t),function(e){return ff.call(t,e)}))}:st,G=sf;function pf(t,e){return T(t,G(t),e)}var Le=pf;var nf=Object.getOwnPropertySymbols,uf=nf?function(t){for(var e=[];t;)ft(e,G(t)),t=R(t);return e}:st,pt=uf;function mf(t,e){return T(t,pt(t),e)}var Be=mf;function lf(t,e,r){var o=e(t);return C(t)?o:ft(o,r(t))}var it=lf;function df(t){return it(t,B,G)}var Me=df;function cf(t){return it(t,M,pt)}var Fe=cf;var xf=l(u,"DataView"),nt=xf;var gf=l(u,"Promise"),ut=gf;var hf=l(u,"Set"),mt=hf;var Ne="[object Map]",bf="[object Object]",De="[object Promise]",Re="[object Set]",Ue="[object WeakMap]",Ge="[object DataView]",yf=b(nt),jf=b(A),vf=b(ut),Tf=b(mt),Of=b(Y),I=x;(nt&&I(new nt(new ArrayBuffer(1)))!=Ge||A&&I(new A)!=Ne||ut&&I(ut.resolve())!=De||mt&&I(new mt)!=Re||Y&&I(new Y)!=Ue)&&(I=function(t){var e=x(t),r=e==bf?t.constructor:void 0,o=r?b(r):"";if(o)switch(o){case yf:return Ge;case jf:return Ne;case vf:return De;case Tf:return Re;case Of:return Ue}return e});var V=I;var _f=Object.prototype,Af=_f.hasOwnProperty;function wf(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Af.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Ve=wf;var Sf=u.Uint8Array,yt=Sf;function If(t){var e=new t.constructor(t.byteLength);return new yt(e).set(new yt(t)),e}var W=If;function Pf(t,e){var r=e?W(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var We=Pf;var Cf=/\w*$/;function Ef(t){var e=new t.constructor(t.source,Cf.exec(t));return e.lastIndex=t.lastIndex,e}var Ke=Ef;var ze=h?h.prototype:void 0,qe=ze?ze.valueOf:void 0;function Lf(t){return qe?Object(qe.call(t)):{}}var ke=Lf;function Bf(t,e){var r=e?W(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var He=Bf;var Mf="[object Boolean]",Ff="[object Date]",Nf="[object Map]",Df="[object Number]",Rf="[object RegExp]",Uf="[object Set]",Gf="[object String]",Vf="[object Symbol]",Wf="[object ArrayBuffer]",Kf="[object DataView]",zf="[object Float32Array]",qf="[object Float64Array]",kf="[object Int8Array]",Hf="[object Int16Array]",$f="[object Int32Array]",Jf="[object Uint8Array]",Yf="[object Uint8ClampedArray]",Xf="[object Uint16Array]",Zf="[object Uint32Array]";function Qf(t,e,r){var o=t.constructor;switch(e){case Wf:return W(t);case Mf:case Ff:return new o(+t);case Kf:return We(t,r);case zf:case qf:case kf:case Hf:case $f:case Jf:case Yf:case Xf:case Zf:return He(t,r);case Nf:return new o;case Df:case Gf:return new o(t);case Rf:return Ke(t);case Uf:return new o;case Vf:return ke(t)}}var $e=Qf;function ts(t){return typeof t.constructor=="function"&&!E(t)?Mt(R(t)):{}}var Je=ts;var es="[object Map]";function rs(t){return d(t)&&V(t)==es}var Ye=rs;var Xe=y&&y.isMap,os=Xe?L(Xe):Ye,Ze=os;var as="[object Set]";function fs(t){return d(t)&&V(t)==as}var Qe=fs;var tr=y&&y.isSet,ss=tr?L(tr):Qe,er=ss;var ps=1,is=2,ns=4,rr="[object Arguments]",us="[object Array]",ms="[object Boolean]",ls="[object Date]",ds="[object Error]",or="[object Function]",cs="[object GeneratorFunction]",xs="[object Map]",gs="[object Number]",ar="[object Object]",hs="[object RegExp]",bs="[object Set]",ys="[object String]",js="[object Symbol]",vs="[object WeakMap]",Ts="[object ArrayBuffer]",Os="[object DataView]",_s="[object Float32Array]",As="[object Float64Array]",ws="[object Int8Array]",Ss="[object Int16Array]",Is="[object Int32Array]",Ps="[object Uint8Array]",Cs="[object Uint8ClampedArray]",Es="[object Uint16Array]",Ls="[object Uint32Array]",p={};p[rr]=p[us]=p[Ts]=p[Os]=p[ms]=p[ls]=p[_s]=p[As]=p[ws]=p[Ss]=p[Is]=p[xs]=p[gs]=p[ar]=p[hs]=p[bs]=p[ys]=p[js]=p[Ps]=p[Cs]=p[Es]=p[Ls]=!0;p[ds]=p[or]=p[vs]=!1;function lt(t,e,r,o,f,a){var s,n=e&ps,m=e&is,c=e&ns;if(r&&(s=f?r(t,o,f,a):r(t)),s!==void 0)return s;if(!g(t))return t;var vt=C(t);if(vt){if(s=Ve(t),!n)return Ft(t,s)}else{var P=V(t),Tt=P==or||P==cs;if(rt(t))return Pe(t,n);if(P==ar||P==rr||Tt&&!f){if(s=m||Tt?{}:Je(t),!n)return m?Be(t,_e(s,t)):Le(t,Oe(s,t))}else{if(!p[P])return f?t:{};s=$e(t,P,n)}}a||(a=new Te);var Ot=a.get(t);if(Ot)return Ot;a.set(t,s),er(t)?t.forEach(function(v){s.add(lt(v,e,r,v,t,a))}):Ze(t)&&t.forEach(function(v,S){s.set(S,lt(v,e,r,S,t,a))});var sr=c?m?Fe:Me:m?M:B,_t=vt?void 0:sr(t);return Nt(_t||t,function(v,S){_t&&(S=v,v=t[S]),Q(s,S,lt(v,e,r,S,t,a))}),s}var fr=lt;var Bs=1,Ms=4;function Fs(t){return fr(t,Bs|Ms)}var dt=Fs;var q=class{init(){}constructor(e,r){}};var jt=class extends q{constructor(){super(...arguments);k(this,"Vue");k(this,"projects");k(this,"state",null)}bindProjectState(r){let o={component:null,componentKey:null,autoRequire:!0,write:!0,...r};return Promise.resolve().then(()=>Promise.all([this.getProjectState({autoRequire:o.autoRequire}),(()=>{if(!o.componentKey){for(let f=0;f<50;f++){let a=`terafy_${f}`;if(!Object.hasOwnProperty(o.component,a)){o.componentKey=a;return}}throw new Error("Unable to find unique key to allocate against Vue2 component")}})()])).then(([f])=>{this.debug("INFO",2,"Got project snapshot",f);let a=this.Vue.observable(f);o.component[o.componentKey]=a;let s=0;if(o.read&&this.events.on(`update:projects/${a.id}`,n=>{s++,this.debug("INFO",5,"Update Vue2 Remote->Local",{new:n,old:a}),this.merge(a,n)}),o.write){if(!o.component)throw new Error("bindProjectState requires a VueComponent specified as `component`");let n=dt(f);o.component.$watch(o.componentKey,m=>{if(s>0){s--;return}this.debug("INFO",5,"Update Vue2 Local->Remote",{new:m,old:n}),this.createProjectStatePatch(m,n),n=dt(f)},{deep:!0})}return a})}merge(r,...o){return o.forEach(f=>Object.keys(f).forEach(a=>{bt(f[a])?(a in r||this.Vue.set(r,a,{}),this.merge(r[a],f[a])):this.Vue.set(r,a,f[a])})),r}init(r){let o={app:null,Vue:null,globalName:"$tera",requireProject:!0,subscribeState:!0,subscribeProjects:!0,stateOptions:{read:!0,write:!0},...r};if(!o.Vue)throw new Error("Vue instance to use must be specified in init options as `Vue`");if(this.Vue=r.Vue,!this.settings.app)throw new Error("Need to specify the root level Vue2 app during init");return o.stateOptions.app=this.settings.app,this.projects=this.Vue.observable([]),o.globalName&&(this.Vue.prototype[o.globalName]=this),this.state=null,Promise.resolve().then(()=>o.requireProject&&this.requireProject()).then(()=>Promise.all([o.subscribeState&&this.bindProjectState({...o.stateOptions,component:this.settings.app.$root}).then(f=>this.state=f).then(()=>this.debug("INFO",1,"Loaded initial project state",this.state)),o.subscribeProjects&&this.getProjects().then(f=>this.projects=this.Vue.observable(f)).then(()=>this.debug("INFO",2,"Loaded project list",this.projects))])).then(()=>this.debug("INFO",1,"Ready"))}};export{jt as default};
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
lodash-es/lodash.js:
|
package/dist/terafy.es2019.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var bo=Object.defineProperty;var vo=(t,e,r)=>e in t?bo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var x=(t,e,r)=>(vo(t,typeof e!="symbol"?e+"":e,r),r),Jt=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var lt=(t,e,r)=>(Jt(t,e,"read from private field"),r?r.call(t):e.get(t)),Xt=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},Qt=(t,e,r,o)=>(Jt(t,e,"write to private field"),o?o.call(t,r):e.set(t,r),r);function te(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:n,basePath:m,basePathForRemoves:h,diffs:v}){var P=Object.keys(i),O=P.length,y=Object.keys(n),_=y.length,b,p=i.length-n.length;if(To(i,n)){for(var u=0;u<O;u++){var l=Array.isArray(i)?Number(P[u]):P[u];l in n||(b=h.concat(l),v.remove.push({op:"remove",path:r(b)}))}for(var u=0;u<_;u++){var l=Array.isArray(n)?Number(y[u]):y[u];s({key:l,obj1:i,obj2:n,path:m.concat(l),pathForRemoves:m.concat(l),diffs:v})}}else{for(var u=0;u<p;u++)b=h.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:n,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:n,obj2:m,path:h,pathForRemoves:v,diffs:P}){var O=n[i],y=m[i];if(!(i in n)&&i in m){var _=y;P.add.push({op:"add",path:r(h),value:_})}else O!==y&&(Object(O)!==O||Object(y)!==y||wo(O,y)||!Object.keys(O).length&&!Object.keys(y).length&&String(O)!=String(y)?f(h,P,y):o({obj1:n[i],obj2:m[i],basePath:h,basePathForRemoves:v,diffs:P}))}function f(i,n,m){n.replace.push({op:"replace",path:r(i),value:m})}}function ee(t){return[""].concat(t).join("/")}function wo(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function To(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 f=e.length;f>0&&String(t[f+r])===String(e[f]);f--)a++;return o>=a}return!0}var Oo=typeof global=="object"&&global&&global.Object===Object&&global,ht=Oo;var Ao=typeof self=="object"&&self&&self.Object===Object&&self,Po=ht||Ao||Function("return this")(),g=Po;var So=g.Symbol,T=So;var re=Object.prototype,jo=re.hasOwnProperty,Io=re.toString,mt=T?T.toStringTag:void 0;function _o(t){var e=jo.call(t,mt),r=t[mt];try{t[mt]=void 0;var o=!0}catch{}var a=Io.call(t);return o&&(e?t[mt]=r:delete t[mt]),a}var oe=_o;var Eo=Object.prototype,Co=Eo.toString;function Mo(t){return Co.call(t)}var ae=Mo;var Fo="[object Null]",Ro="[object Undefined]",ie=T?T.toStringTag:void 0;function No(t){return t==null?t===void 0?Ro:Fo:ie&&ie in Object(t)?oe(t):ae(t)}var I=No;function Bo(t){return t!=null&&typeof t=="object"}var j=Bo;var Lo="[object Symbol]";function Do(t){return typeof t=="symbol"||j(t)&&I(t)==Lo}var G=Do;function Uo(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 se=Uo;var ko=Array.isArray,w=ko;var zo=1/0,fe=T?T.prototype:void 0,ne=fe?fe.toString:void 0;function pe(t){if(typeof t=="string")return t;if(w(t))return se(t,pe)+"";if(G(t))return ne?ne.call(t):"";var e=t+"";return e=="0"&&1/t==-zo?"-0":e}var le=pe;function Ko(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var S=Ko;function Go(t){return t}var me=Go;var Wo="[object AsyncFunction]",Ho="[object Function]",$o="[object GeneratorFunction]",qo="[object Proxy]";function Yo(t){if(!S(t))return!1;var e=I(t);return e==Ho||e==$o||e==Wo||e==qo}var xt=Yo;var Vo=g["__core-js_shared__"],gt=Vo;var ue=function(){var t=/[^.]+$/.exec(gt&>.keys&>.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Zo(t){return!!ue&&ue in t}var de=Zo;var Jo=Function.prototype,Xo=Jo.toString;function Qo(t){if(t!=null){try{return Xo.call(t)}catch{}try{return t+""}catch{}}return""}var C=Qo;var ta=/[\\^$.*+?()[\]{}|]/g,ea=/^\[object .+?Constructor\]$/,ra=Function.prototype,oa=Object.prototype,aa=ra.toString,ia=oa.hasOwnProperty,sa=RegExp("^"+aa.call(ia).replace(ta,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function fa(t){if(!S(t)||de(t))return!1;var e=xt(t)?sa:ea;return e.test(C(t))}var ce=fa;function na(t,e){return t==null?void 0:t[e]}var he=na;function pa(t,e){var r=he(t,e);return ce(r)?r:void 0}var A=pa;var la=A(g,"WeakMap"),yt=la;var xe=Object.create,ma=function(){function t(){}return function(e){if(!S(e))return{};if(xe)return xe(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),ge=ma;function ua(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 ye=ua;function da(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var be=da;var ca=800,ha=16,xa=Date.now;function ga(t){var e=0,r=0;return function(){var o=xa(),a=ha-(o-r);if(r=o,a>0){if(++e>=ca)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var ve=ga;function ya(t){return function(){return t}}var we=ya;var ba=function(){try{var t=A(Object,"defineProperty");return t({},"",{}),t}catch{}}(),W=ba;var va=W?function(t,e){return W(t,"toString",{configurable:!0,enumerable:!1,value:we(e),writable:!0})}:me,Te=va;var wa=ve(Te),Oe=wa;function Ta(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var Ae=Ta;var Oa=9007199254740991,Aa=/^(?:0|[1-9]\d*)$/;function Pa(t,e){var r=typeof t;return e=e==null?Oa:e,!!e&&(r=="number"||r!="symbol"&&Aa.test(t))&&t>-1&&t%1==0&&t<e}var H=Pa;function Sa(t,e,r){e=="__proto__"&&W?W(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var bt=Sa;function ja(t,e){return t===e||t!==t&&e!==e}var vt=ja;var Ia=Object.prototype,_a=Ia.hasOwnProperty;function Ea(t,e,r){var o=t[e];(!(_a.call(t,e)&&vt(o,r))||r===void 0&&!(e in t))&&bt(t,e,r)}var $=Ea;function Ca(t,e,r,o){var a=!r;r||(r={});for(var s=-1,f=e.length;++s<f;){var i=e[s],n=o?o(r[i],t[i],i,r,t):void 0;n===void 0&&(n=t[i]),a?bt(r,i,n):$(r,i,n)}return r}var R=Ca;var Pe=Math.max;function Ma(t,e,r){return e=Pe(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=Pe(o.length-e,0),f=Array(s);++a<s;)f[a]=o[e+a];a=-1;for(var i=Array(e+1);++a<e;)i[a]=o[a];return i[e]=r(f),ye(t,this,i)}}var Se=Ma;var Fa=9007199254740991;function Ra(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Fa}var q=Ra;function Na(t){return t!=null&&q(t.length)&&!xt(t)}var wt=Na;var Ba=Object.prototype;function La(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Ba;return t===r}var Y=La;function Da(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var je=Da;var Ua="[object Arguments]";function ka(t){return j(t)&&I(t)==Ua}var Nt=ka;var Ie=Object.prototype,za=Ie.hasOwnProperty,Ka=Ie.propertyIsEnumerable,Ga=Nt(function(){return arguments}())?Nt:function(t){return j(t)&&za.call(t,"callee")&&!Ka.call(t,"callee")},V=Ga;function Wa(){return!1}var _e=Wa;var Me=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ee=Me&&typeof module=="object"&&module&&!module.nodeType&&module,Ha=Ee&&Ee.exports===Me,Ce=Ha?g.Buffer:void 0,$a=Ce?Ce.isBuffer:void 0,qa=$a||_e,Tt=qa;var Ya="[object Arguments]",Va="[object Array]",Za="[object Boolean]",Ja="[object Date]",Xa="[object Error]",Qa="[object Function]",ti="[object Map]",ei="[object Number]",ri="[object Object]",oi="[object RegExp]",ai="[object Set]",ii="[object String]",si="[object WeakMap]",fi="[object ArrayBuffer]",ni="[object DataView]",pi="[object Float32Array]",li="[object Float64Array]",mi="[object Int8Array]",ui="[object Int16Array]",di="[object Int32Array]",ci="[object Uint8Array]",hi="[object Uint8ClampedArray]",xi="[object Uint16Array]",gi="[object Uint32Array]",c={};c[pi]=c[li]=c[mi]=c[ui]=c[di]=c[ci]=c[hi]=c[xi]=c[gi]=!0;c[Ya]=c[Va]=c[fi]=c[Za]=c[ni]=c[Ja]=c[Xa]=c[Qa]=c[ti]=c[ei]=c[ri]=c[oi]=c[ai]=c[ii]=c[si]=!1;function yi(t){return j(t)&&q(t.length)&&!!c[I(t)]}var Fe=yi;function bi(t){return function(e){return t(e)}}var Z=bi;var Re=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ut=Re&&typeof module=="object"&&module&&!module.nodeType&&module,vi=ut&&ut.exports===Re,Bt=vi&&ht.process,wi=function(){try{var t=ut&&ut.require&&ut.require("util").types;return t||Bt&&Bt.binding&&Bt.binding("util")}catch{}}(),M=wi;var Ne=M&&M.isTypedArray,Ti=Ne?Z(Ne):Fe,Be=Ti;var Oi=Object.prototype,Ai=Oi.hasOwnProperty;function Pi(t,e){var r=w(t),o=!r&&V(t),a=!r&&!o&&Tt(t),s=!r&&!o&&!a&&Be(t),f=r||o||a||s,i=f?je(t.length,String):[],n=i.length;for(var m in t)(e||Ai.call(t,m))&&!(f&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||H(m,n)))&&i.push(m);return i}var Ot=Pi;function Si(t,e){return function(r){return t(e(r))}}var At=Si;var ji=At(Object.keys,Object),Le=ji;var Ii=Object.prototype,_i=Ii.hasOwnProperty;function Ei(t){if(!Y(t))return Le(t);var e=[];for(var r in Object(t))_i.call(t,r)&&r!="constructor"&&e.push(r);return e}var De=Ei;function Ci(t){return wt(t)?Ot(t):De(t)}var J=Ci;function Mi(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Ue=Mi;var Fi=Object.prototype,Ri=Fi.hasOwnProperty;function Ni(t){if(!S(t))return Ue(t);var e=Y(t),r=[];for(var o in t)o=="constructor"&&(e||!Ri.call(t,o))||r.push(o);return r}var ke=Ni;function Bi(t){return wt(t)?Ot(t,!0):ke(t)}var X=Bi;var Li=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Di=/^\w*$/;function Ui(t,e){if(w(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||G(t)?!0:Di.test(t)||!Li.test(t)||e!=null&&t in Object(e)}var ze=Ui;var ki=A(Object,"create"),F=ki;function zi(){this.__data__=F?F(null):{},this.size=0}var Ke=zi;function Ki(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Ge=Ki;var Gi="__lodash_hash_undefined__",Wi=Object.prototype,Hi=Wi.hasOwnProperty;function $i(t){var e=this.__data__;if(F){var r=e[t];return r===Gi?void 0:r}return Hi.call(e,t)?e[t]:void 0}var We=$i;var qi=Object.prototype,Yi=qi.hasOwnProperty;function Vi(t){var e=this.__data__;return F?e[t]!==void 0:Yi.call(e,t)}var He=Vi;var Zi="__lodash_hash_undefined__";function Ji(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=F&&e===void 0?Zi:e,this}var $e=Ji;function Q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Q.prototype.clear=Ke;Q.prototype.delete=Ge;Q.prototype.get=We;Q.prototype.has=He;Q.prototype.set=$e;var Lt=Q;function Xi(){this.__data__=[],this.size=0}var qe=Xi;function Qi(t,e){for(var r=t.length;r--;)if(vt(t[r][0],e))return r;return-1}var N=Qi;var ts=Array.prototype,es=ts.splice;function rs(t){var e=this.__data__,r=N(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():es.call(e,r,1),--this.size,!0}var Ye=rs;function os(t){var e=this.__data__,r=N(e,t);return r<0?void 0:e[r][1]}var Ve=os;function as(t){return N(this.__data__,t)>-1}var Ze=as;function is(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 Je=is;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=qe;tt.prototype.delete=Ye;tt.prototype.get=Ve;tt.prototype.has=Ze;tt.prototype.set=Je;var B=tt;var ss=A(g,"Map"),L=ss;function fs(){this.size=0,this.__data__={hash:new Lt,map:new(L||B),string:new Lt}}var Xe=fs;function ns(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Qe=ns;function ps(t,e){var r=t.__data__;return Qe(e)?r[typeof e=="string"?"string":"hash"]:r.map}var D=ps;function ls(t){var e=D(this,t).delete(t);return this.size-=e?1:0,e}var tr=ls;function ms(t){return D(this,t).get(t)}var er=ms;function us(t){return D(this,t).has(t)}var rr=us;function ds(t,e){var r=D(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var or=ds;function et(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])}}et.prototype.clear=Xe;et.prototype.delete=tr;et.prototype.get=er;et.prototype.has=rr;et.prototype.set=or;var dt=et;var cs="Expected a function";function Dt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(cs);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 f=t.apply(this,o);return r.cache=s.set(a,f)||s,f};return r.cache=new(Dt.Cache||dt),r}Dt.Cache=dt;var ar=Dt;var hs=500;function xs(t){var e=ar(t,function(o){return r.size===hs&&r.clear(),o}),r=e.cache;return e}var ir=xs;var gs=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ys=/\\(\\)?/g,bs=ir(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(gs,function(r,o,a,s){e.push(a?s.replace(ys,"$1"):o||r)}),e}),sr=bs;function vs(t){return t==null?"":le(t)}var fr=vs;function ws(t,e){return w(t)?t:ze(t,e)?[t]:sr(fr(t))}var U=ws;var Ts=1/0;function Os(t){if(typeof t=="string"||G(t))return t;var e=t+"";return e=="0"&&1/t==-Ts?"-0":e}var rt=Os;function As(t,e){e=U(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[rt(e[r++])];return r&&r==o?t:void 0}var nr=As;function Ps(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var ot=Ps;var pr=T?T.isConcatSpreadable:void 0;function Ss(t){return w(t)||V(t)||!!(pr&&t&&t[pr])}var lr=Ss;function mr(t,e,r,o,a){var s=-1,f=t.length;for(r||(r=lr),a||(a=[]);++s<f;){var i=t[s];e>0&&r(i)?e>1?mr(i,e-1,r,o,a):ot(a,i):o||(a[a.length]=i)}return a}var ur=mr;function js(t){var e=t==null?0:t.length;return e?ur(t,1):[]}var dr=js;function Is(t){return Oe(Se(t,void 0,dr),t+"")}var cr=Is;var _s=At(Object.getPrototypeOf,Object),Pt=_s;function Es(){this.__data__=new B,this.size=0}var hr=Es;function Cs(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var xr=Cs;function Ms(t){return this.__data__.get(t)}var gr=Ms;function Fs(t){return this.__data__.has(t)}var yr=Fs;var Rs=200;function Ns(t,e){var r=this.__data__;if(r instanceof B){var o=r.__data__;if(!L||o.length<Rs-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new dt(o)}return r.set(t,e),this.size=r.size,this}var br=Ns;function at(t){var e=this.__data__=new B(t);this.size=e.size}at.prototype.clear=hr;at.prototype.delete=xr;at.prototype.get=gr;at.prototype.has=yr;at.prototype.set=br;var vr=at;function Bs(t,e){return t&&R(e,J(e),t)}var wr=Bs;function Ls(t,e){return t&&R(e,X(e),t)}var Tr=Ls;var Sr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Or=Sr&&typeof module=="object"&&module&&!module.nodeType&&module,Ds=Or&&Or.exports===Sr,Ar=Ds?g.Buffer:void 0,Pr=Ar?Ar.allocUnsafe:void 0;function Us(t,e){if(e)return t.slice();var r=t.length,o=Pr?Pr(r):new t.constructor(r);return t.copy(o),o}var jr=Us;function ks(t,e){for(var r=-1,o=t==null?0:t.length,a=0,s=[];++r<o;){var f=t[r];e(f,r,t)&&(s[a++]=f)}return s}var Ir=ks;function zs(){return[]}var St=zs;var Ks=Object.prototype,Gs=Ks.propertyIsEnumerable,_r=Object.getOwnPropertySymbols,Ws=_r?function(t){return t==null?[]:(t=Object(t),Ir(_r(t),function(e){return Gs.call(t,e)}))}:St,it=Ws;function Hs(t,e){return R(t,it(t),e)}var Er=Hs;var $s=Object.getOwnPropertySymbols,qs=$s?function(t){for(var e=[];t;)ot(e,it(t)),t=Pt(t);return e}:St,jt=qs;function Ys(t,e){return R(t,jt(t),e)}var Cr=Ys;function Vs(t,e,r){var o=e(t);return w(t)?o:ot(o,r(t))}var It=Vs;function Zs(t){return It(t,J,it)}var Mr=Zs;function Js(t){return It(t,X,jt)}var Fr=Js;var Xs=A(g,"DataView"),_t=Xs;var Qs=A(g,"Promise"),Et=Qs;var tf=A(g,"Set"),Ct=tf;var Rr="[object Map]",ef="[object Object]",Nr="[object Promise]",Br="[object Set]",Lr="[object WeakMap]",Dr="[object DataView]",rf=C(_t),of=C(L),af=C(Et),sf=C(Ct),ff=C(yt),z=I;(_t&&z(new _t(new ArrayBuffer(1)))!=Dr||L&&z(new L)!=Rr||Et&&z(Et.resolve())!=Nr||Ct&&z(new Ct)!=Br||yt&&z(new yt)!=Lr)&&(z=function(t){var e=I(t),r=e==ef?t.constructor:void 0,o=r?C(r):"";if(o)switch(o){case rf:return Dr;case of:return Rr;case af:return Nr;case sf:return Br;case ff:return Lr}return e});var st=z;var nf=Object.prototype,pf=nf.hasOwnProperty;function lf(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&pf.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Ur=lf;var mf=g.Uint8Array,Ut=mf;function uf(t){var e=new t.constructor(t.byteLength);return new Ut(e).set(new Ut(t)),e}var ft=uf;function df(t,e){var r=e?ft(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var kr=df;var cf=/\w*$/;function hf(t){var e=new t.constructor(t.source,cf.exec(t));return e.lastIndex=t.lastIndex,e}var zr=hf;var Kr=T?T.prototype:void 0,Gr=Kr?Kr.valueOf:void 0;function xf(t){return Gr?Object(Gr.call(t)):{}}var Wr=xf;function gf(t,e){var r=e?ft(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Hr=gf;var yf="[object Boolean]",bf="[object Date]",vf="[object Map]",wf="[object Number]",Tf="[object RegExp]",Of="[object Set]",Af="[object String]",Pf="[object Symbol]",Sf="[object ArrayBuffer]",jf="[object DataView]",If="[object Float32Array]",_f="[object Float64Array]",Ef="[object Int8Array]",Cf="[object Int16Array]",Mf="[object Int32Array]",Ff="[object Uint8Array]",Rf="[object Uint8ClampedArray]",Nf="[object Uint16Array]",Bf="[object Uint32Array]";function Lf(t,e,r){var o=t.constructor;switch(e){case Sf:return ft(t);case yf:case bf:return new o(+t);case jf:return kr(t,r);case If:case _f:case Ef:case Cf:case Mf:case Ff:case Rf:case Nf:case Bf:return Hr(t,r);case vf:return new o;case wf:case Af:return new o(t);case Tf:return zr(t);case Of:return new o;case Pf:return Wr(t)}}var $r=Lf;function Df(t){return typeof t.constructor=="function"&&!Y(t)?ge(Pt(t)):{}}var qr=Df;var Uf="[object Map]";function kf(t){return j(t)&&st(t)==Uf}var Yr=kf;var Vr=M&&M.isMap,zf=Vr?Z(Vr):Yr,Zr=zf;var Kf="[object Set]";function Gf(t){return j(t)&&st(t)==Kf}var Jr=Gf;var Xr=M&&M.isSet,Wf=Xr?Z(Xr):Jr,Qr=Wf;var Hf=1,$f=2,qf=4,to="[object Arguments]",Yf="[object Array]",Vf="[object Boolean]",Zf="[object Date]",Jf="[object Error]",eo="[object Function]",Xf="[object GeneratorFunction]",Qf="[object Map]",tn="[object Number]",ro="[object Object]",en="[object RegExp]",rn="[object Set]",on="[object String]",an="[object Symbol]",sn="[object WeakMap]",fn="[object ArrayBuffer]",nn="[object DataView]",pn="[object Float32Array]",ln="[object Float64Array]",mn="[object Int8Array]",un="[object Int16Array]",dn="[object Int32Array]",cn="[object Uint8Array]",hn="[object Uint8ClampedArray]",xn="[object Uint16Array]",gn="[object Uint32Array]",d={};d[to]=d[Yf]=d[fn]=d[nn]=d[Vf]=d[Zf]=d[pn]=d[ln]=d[mn]=d[un]=d[dn]=d[Qf]=d[tn]=d[ro]=d[en]=d[rn]=d[on]=d[an]=d[cn]=d[hn]=d[xn]=d[gn]=!0;d[Jf]=d[eo]=d[sn]=!1;function Mt(t,e,r,o,a,s){var f,i=e&Hf,n=e&$f,m=e&qf;if(r&&(f=a?r(t,o,a,s):r(t)),f!==void 0)return f;if(!S(t))return t;var h=w(t);if(h){if(f=Ur(t),!i)return be(t,f)}else{var v=st(t),P=v==eo||v==Xf;if(Tt(t))return jr(t,i);if(v==ro||v==to||P&&!a){if(f=n||P?{}:qr(t),!i)return n?Cr(t,Tr(f,t)):Er(t,wr(f,t))}else{if(!d[v])return a?t:{};f=$r(t,v,i)}}s||(s=new vr);var O=s.get(t);if(O)return O;s.set(t,f),Qr(t)?t.forEach(function(b){f.add(Mt(b,e,r,b,t,s))}):Zr(t)&&t.forEach(function(b,p){f.set(p,Mt(b,e,r,p,t,s))});var y=m?n?Fr:Mr:n?X:J,_=h?void 0:y(t);return Ae(_||t,function(b,p){_&&(p=b,b=t[p]),$(f,p,Mt(b,e,r,p,t,s))}),f}var oo=Mt;var yn=1,bn=4;function vn(t){return oo(t,yn|bn)}var kt=vn;function wn(t,e){return t!=null&&e in Object(t)}var ao=wn;function Tn(t,e,r){e=U(e,t);for(var o=-1,a=e.length,s=!1;++o<a;){var f=rt(e[o]);if(!(s=t!=null&&r(t,f)))break;t=t[f]}return s||++o!=a?s:(a=t==null?0:t.length,!!a&&q(a)&&H(f,a)&&(w(t)||V(t)))}var io=Tn;function On(t,e){return t!=null&&io(t,e,ao)}var so=On;function An(t,e,r,o){if(!S(t))return t;e=U(e,t);for(var a=-1,s=e.length,f=s-1,i=t;i!=null&&++a<s;){var n=rt(e[a]),m=r;if(n==="__proto__"||n==="constructor"||n==="prototype")return t;if(a!=f){var h=i[n];m=o?o(h,n,i):void 0,m===void 0&&(m=S(h)?h:H(e[a+1])?[]:{})}$(i,n,m),i=i[n]}return t}var fo=An;function Pn(t,e,r){for(var o=-1,a=e.length,s={};++o<a;){var f=e[o],i=nr(t,f);r(i,f)&&fo(s,U(f,t),i)}return s}var no=Pn;function Sn(t,e){return no(t,e,function(r,o){return so(t,o)})}var po=Sn;var jn=cr(function(t,e){return t==null?{}:po(t,e)}),Ft=jn;function lo(t){return{all:t=t||new Map,on:function(e,r){var o=t.get(e);o?o.push(r):t.set(e,[r])},off:function(e,r){var o=t.get(e);o&&(r?o.splice(o.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var o=t.get(e);o&&o.slice().map(function(a){a(r)}),(o=t.get("*"))&&o.slice().map(function(a){a(e,r)})}}}var zt=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),"");var In="array",_n="bit",mo="bits",En="byte",uo="bytes",nt="",Cn="exponent",Mn="function",co="iec",Fn="Invalid number",Rn="Invalid rounding method",Kt="jedec",Nn="object",ho=".",Bn="round",Ln="s",Dn="si",Un="kbit",kn="kB",zn=" ",Kn="string",Gn="0",Gt={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function xo(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:s=nt,localeOptions:f={},separator:i=nt,spacer:n=zn,symbols:m={},standard:h=nt,output:v=Kn,fullform:P=!1,fullforms:O=[],exponent:y=-1,roundingMethod:_=Bn,precision:b=0}={}){let p=y,u=Number(t),l=[],E=0,Rt=nt;h===Dn?(o=10,h=Kt):h===co||h===Kt?o=2:o===2?h=co:(o=10,h=Kt);let ct=o===10?1e3:1024,go=P===!0,$t=u<0,qt=Math[_];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(Fn);if(typeof qt!==Mn)throw new TypeError(Rn);if($t&&(u=-u),(p===-1||isNaN(p))&&(p=Math.floor(Math.log(u)/Math.log(ct)),p<0&&(p=0)),p>8&&(b>0&&(b+=8-p),p=8),v===Cn)return p;if(u===0)l[0]=0,Rt=l[1]=Gt.symbol[h][e?mo:uo][p];else{E=u/(o===2?Math.pow(2,p*10):Math.pow(1e3,p)),e&&(E=E*8,E>=ct&&p<8&&(E=E/ct,p++));let pt=Math.pow(10,p>0?a:0);l[0]=qt(E*pt)/pt,l[0]===ct&&p<8&&y===-1&&(l[0]=1,p++),Rt=l[1]=o===10&&p===1?e?Un:kn:Gt.symbol[h][e?mo:uo][p]}if($t&&(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,f):i.length>0&&(l[0]=l[0].toString().replace(ho,i)),r&&Number.isInteger(l[0])===!1&&a>0){let pt=i||ho,Yt=l[0].toString().split(pt),Vt=Yt[1]||nt,Zt=Vt.length,yo=a-Zt;l[0]=`${Yt[0]}${pt}${Vt.padEnd(Zt+yo,Gn)}`}return go&&(l[1]=O[p]?O[p]:Gt.fullform[h][p]+(e?_n:En)+(l[0]===1?nt:Ln)),v===In?l:v===Nn?{value:l[0],symbol:l[1],exponent:p,unit:Rt}:l.join(n)}var k,Wt=class Wt{constructor(e){Xt(this,k,void 0);x(this,"id");x(this,"name");x(this,"icon");x(this,"path");x(this,"parsedName");x(this,"created");x(this,"createdFormatted");x(this,"modified");x(this,"modifiedFormatted");x(this,"accessed");x(this,"accessedFormatted");x(this,"size");x(this,"sizeFormatted");x(this,"mime");x(this,"meta",{});if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,e),delete this.tera,Qt(this,k,e.tera),this.sizeFormatted=xo(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(){return lt(this,k).getProjectFile(this.path)}setContents(e){return lt(this,k).setProjectFile(this.path,e)}getRefs(){return lt(this,k).getProjectLibrary(this.path)}setRefs(e){return lt(this,k).setProjectLibrary(this.path,e)}serialize(){return Ft(this,["id","name","icon","path","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new Wt(Ft(e,["tera","id","name","icon","path","parsedName","created","modified","accessed","size","mime","meta"]))}};k=new WeakMap;var K=Wt;var Ht=class{constructor(e){x(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});x(this,"events",lo());x(this,"dom",{el:null,iframe:null,popup:null,stylesheet:null});x(this,"methods",["handshake","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","saveProjectState","replaceProjectState","applyProjectStatePatch","setProjectFile","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPageUrl","setPageTitle","uiAlert","uiSplat","uiWindow"]);x(this,"plugins",[]);x(this,"acceptPostboxes",{});e&&this.set(e)}send(e){let r=zt();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||zt(),...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=te(r,e,ee);return this.debug("INFO",3,"Created project patch",{newState:e,oldState:r}),this.applyProjectStatePatch(o)}applyProjectStatePatchLocal(e){throw new Error("applyProjectStatePatchLocal() has not been sub-classed by a plugin")}init(e){if(e&&this.set(e),this.init.promise)return this.init.promise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.init.promise=Promise.resolve().then(()=>this.detectMode()).then(o=>this.settings.mode=o).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).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(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings))))}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(){return new Promise(e=>{switch(this.settings.mode){case"child":this.debug("INFO",2,"Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),document.body.append(this.dom.el),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("INFO",2,"Embeded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe);break;case"parent":this.debug("INFO",2,"Using TERA window parent"),e();break;case"popup":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"),(()=>{let r=0,o,a=()=>{this.debug("INFO",3,"Trying handshake",++r),clearTimeout(o),o=setTimeout(a,this.settings.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(o),this.debug("INFO",3,"Popup window accepted handshake"),e()})};a()})();break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","&.dev-mode {","display: flex;","border: 5px solid var(--TERA-accent);","background: #FFF;","}","& > iframe {","width: 100%;","height: 100%;","}","}","body.tera-fy-focus {","overflow: hidden;","& #tera-fy {","display: flex !important;","position: fixed !important;","top: 0px !important;","width: 100vw !important;","height: 100vh !important;","left: 0px !important;","z-index: 10000 !important;","}","}"].join(`
|
|
2
|
-
`),document.head.appendChild(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){this.methods.forEach(e=>this[e]=this.rpc.bind(this,e))}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r){return typeof e=="string"?this.settings[e]=r:Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r){return!this.settings.devMode||r===void 0?this:this.set(e,r)}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 this.settings.devMode=e==="toggle"?!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 K({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new K({tera:this,...o})))}getProjectFile(e){return this.rpc("getProjectFile",e).then(r=>r&&new K({tera:this,...r}))}};export{
|
|
1
|
+
var bo=Object.defineProperty;var vo=(t,e,r)=>e in t?bo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var c=(t,e,r)=>(vo(t,typeof e!="symbol"?e+"":e,r),r),Jt=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var lt=(t,e,r)=>(Jt(t,e,"read from private field"),r?r.call(t):e.get(t)),Xt=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},Qt=(t,e,r,o)=>(Jt(t,e,"write to private field"),o?o.call(t,r):e.set(t,r),r);function te(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(To(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||wo(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 ee(t){return[""].concat(t).join("/")}function wo(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function To(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 Oo=typeof global=="object"&&global&&global.Object===Object&&global,ht=Oo;var So=typeof self=="object"&&self&&self.Object===Object&&self,jo=ht||So||Function("return this")(),g=jo;var Ao=g.Symbol,T=Ao;var re=Object.prototype,Po=re.hasOwnProperty,Io=re.toString,mt=T?T.toStringTag:void 0;function _o(t){var e=Po.call(t,mt),r=t[mt];try{t[mt]=void 0;var o=!0}catch{}var a=Io.call(t);return o&&(e?t[mt]=r:delete t[mt]),a}var oe=_o;var Eo=Object.prototype,Co=Eo.toString;function Fo(t){return Co.call(t)}var ae=Fo;var Mo="[object Null]",No="[object Undefined]",ie=T?T.toStringTag:void 0;function Ro(t){return t==null?t===void 0?No:Mo:ie&&ie in Object(t)?oe(t):ae(t)}var I=Ro;function Bo(t){return t!=null&&typeof t=="object"}var P=Bo;var Lo="[object Symbol]";function Do(t){return typeof t=="symbol"||P(t)&&I(t)==Lo}var G=Do;function Uo(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 se=Uo;var ko=Array.isArray,w=ko;var zo=1/0,ne=T?T.prototype:void 0,fe=ne?ne.toString:void 0;function pe(t){if(typeof t=="string")return t;if(w(t))return se(t,pe)+"";if(G(t))return fe?fe.call(t):"";var e=t+"";return e=="0"&&1/t==-zo?"-0":e}var le=pe;function Ko(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var A=Ko;function Go(t){return t}var me=Go;var Wo="[object AsyncFunction]",$o="[object Function]",Ho="[object GeneratorFunction]",qo="[object Proxy]";function Yo(t){if(!A(t))return!1;var e=I(t);return e==$o||e==Ho||e==Wo||e==qo}var xt=Yo;var Vo=g["__core-js_shared__"],gt=Vo;var ue=function(){var t=/[^.]+$/.exec(gt&>.keys&>.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Zo(t){return!!ue&&ue in t}var de=Zo;var Jo=Function.prototype,Xo=Jo.toString;function Qo(t){if(t!=null){try{return Xo.call(t)}catch{}try{return t+""}catch{}}return""}var C=Qo;var ta=/[\\^$.*+?()[\]{}|]/g,ea=/^\[object .+?Constructor\]$/,ra=Function.prototype,oa=Object.prototype,aa=ra.toString,ia=oa.hasOwnProperty,sa=RegExp("^"+aa.call(ia).replace(ta,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function na(t){if(!A(t)||de(t))return!1;var e=xt(t)?sa:ea;return e.test(C(t))}var ce=na;function fa(t,e){return t==null?void 0:t[e]}var he=fa;function pa(t,e){var r=he(t,e);return ce(r)?r:void 0}var S=pa;var la=S(g,"WeakMap"),yt=la;var xe=Object.create,ma=function(){function t(){}return function(e){if(!A(e))return{};if(xe)return xe(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),ge=ma;function ua(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 ye=ua;function da(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var be=da;var ca=800,ha=16,xa=Date.now;function ga(t){var e=0,r=0;return function(){var o=xa(),a=ha-(o-r);if(r=o,a>0){if(++e>=ca)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var ve=ga;function ya(t){return function(){return t}}var we=ya;var ba=function(){try{var t=S(Object,"defineProperty");return t({},"",{}),t}catch{}}(),W=ba;var va=W?function(t,e){return W(t,"toString",{configurable:!0,enumerable:!1,value:we(e),writable:!0})}:me,Te=va;var wa=ve(Te),Oe=wa;function Ta(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var Se=Ta;var Oa=9007199254740991,Sa=/^(?:0|[1-9]\d*)$/;function ja(t,e){var r=typeof t;return e=e==null?Oa:e,!!e&&(r=="number"||r!="symbol"&&Sa.test(t))&&t>-1&&t%1==0&&t<e}var $=ja;function Aa(t,e,r){e=="__proto__"&&W?W(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var bt=Aa;function Pa(t,e){return t===e||t!==t&&e!==e}var vt=Pa;var Ia=Object.prototype,_a=Ia.hasOwnProperty;function Ea(t,e,r){var o=t[e];(!(_a.call(t,e)&&vt(o,r))||r===void 0&&!(e in t))&&bt(t,e,r)}var H=Ea;function Ca(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?bt(r,i,f):H(r,i,f)}return r}var N=Ca;var je=Math.max;function Fa(t,e,r){return e=je(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=je(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),ye(t,this,i)}}var Ae=Fa;var Ma=9007199254740991;function Na(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Ma}var q=Na;function Ra(t){return t!=null&&q(t.length)&&!xt(t)}var wt=Ra;var Ba=Object.prototype;function La(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Ba;return t===r}var Y=La;function Da(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var Pe=Da;var Ua="[object Arguments]";function ka(t){return P(t)&&I(t)==Ua}var Rt=ka;var Ie=Object.prototype,za=Ie.hasOwnProperty,Ka=Ie.propertyIsEnumerable,Ga=Rt(function(){return arguments}())?Rt:function(t){return P(t)&&za.call(t,"callee")&&!Ka.call(t,"callee")},V=Ga;function Wa(){return!1}var _e=Wa;var Fe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ee=Fe&&typeof module=="object"&&module&&!module.nodeType&&module,$a=Ee&&Ee.exports===Fe,Ce=$a?g.Buffer:void 0,Ha=Ce?Ce.isBuffer:void 0,qa=Ha||_e,Tt=qa;var Ya="[object Arguments]",Va="[object Array]",Za="[object Boolean]",Ja="[object Date]",Xa="[object Error]",Qa="[object Function]",ti="[object Map]",ei="[object Number]",ri="[object Object]",oi="[object RegExp]",ai="[object Set]",ii="[object String]",si="[object WeakMap]",ni="[object ArrayBuffer]",fi="[object DataView]",pi="[object Float32Array]",li="[object Float64Array]",mi="[object Int8Array]",ui="[object Int16Array]",di="[object Int32Array]",ci="[object Uint8Array]",hi="[object Uint8ClampedArray]",xi="[object Uint16Array]",gi="[object Uint32Array]",h={};h[pi]=h[li]=h[mi]=h[ui]=h[di]=h[ci]=h[hi]=h[xi]=h[gi]=!0;h[Ya]=h[Va]=h[ni]=h[Za]=h[fi]=h[Ja]=h[Xa]=h[Qa]=h[ti]=h[ei]=h[ri]=h[oi]=h[ai]=h[ii]=h[si]=!1;function yi(t){return P(t)&&q(t.length)&&!!h[I(t)]}var Me=yi;function bi(t){return function(e){return t(e)}}var Z=bi;var Ne=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ut=Ne&&typeof module=="object"&&module&&!module.nodeType&&module,vi=ut&&ut.exports===Ne,Bt=vi&&ht.process,wi=function(){try{var t=ut&&ut.require&&ut.require("util").types;return t||Bt&&Bt.binding&&Bt.binding("util")}catch{}}(),F=wi;var Re=F&&F.isTypedArray,Ti=Re?Z(Re):Me,Be=Ti;var Oi=Object.prototype,Si=Oi.hasOwnProperty;function ji(t,e){var r=w(t),o=!r&&V(t),a=!r&&!o&&Tt(t),s=!r&&!o&&!a&&Be(t),n=r||o||a||s,i=n?Pe(t.length,String):[],f=i.length;for(var m in t)(e||Si.call(t,m))&&!(n&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||$(m,f)))&&i.push(m);return i}var Ot=ji;function Ai(t,e){return function(r){return t(e(r))}}var St=Ai;var Pi=St(Object.keys,Object),Le=Pi;var Ii=Object.prototype,_i=Ii.hasOwnProperty;function Ei(t){if(!Y(t))return Le(t);var e=[];for(var r in Object(t))_i.call(t,r)&&r!="constructor"&&e.push(r);return e}var De=Ei;function Ci(t){return wt(t)?Ot(t):De(t)}var J=Ci;function Fi(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Ue=Fi;var Mi=Object.prototype,Ni=Mi.hasOwnProperty;function Ri(t){if(!A(t))return Ue(t);var e=Y(t),r=[];for(var o in t)o=="constructor"&&(e||!Ni.call(t,o))||r.push(o);return r}var ke=Ri;function Bi(t){return wt(t)?Ot(t,!0):ke(t)}var X=Bi;var Li=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Di=/^\w*$/;function Ui(t,e){if(w(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||G(t)?!0:Di.test(t)||!Li.test(t)||e!=null&&t in Object(e)}var ze=Ui;var ki=S(Object,"create"),M=ki;function zi(){this.__data__=M?M(null):{},this.size=0}var Ke=zi;function Ki(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Ge=Ki;var Gi="__lodash_hash_undefined__",Wi=Object.prototype,$i=Wi.hasOwnProperty;function Hi(t){var e=this.__data__;if(M){var r=e[t];return r===Gi?void 0:r}return $i.call(e,t)?e[t]:void 0}var We=Hi;var qi=Object.prototype,Yi=qi.hasOwnProperty;function Vi(t){var e=this.__data__;return M?e[t]!==void 0:Yi.call(e,t)}var $e=Vi;var Zi="__lodash_hash_undefined__";function Ji(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=M&&e===void 0?Zi:e,this}var He=Ji;function Q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Q.prototype.clear=Ke;Q.prototype.delete=Ge;Q.prototype.get=We;Q.prototype.has=$e;Q.prototype.set=He;var Lt=Q;function Xi(){this.__data__=[],this.size=0}var qe=Xi;function Qi(t,e){for(var r=t.length;r--;)if(vt(t[r][0],e))return r;return-1}var R=Qi;var ts=Array.prototype,es=ts.splice;function rs(t){var e=this.__data__,r=R(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():es.call(e,r,1),--this.size,!0}var Ye=rs;function os(t){var e=this.__data__,r=R(e,t);return r<0?void 0:e[r][1]}var Ve=os;function as(t){return R(this.__data__,t)>-1}var Ze=as;function is(t,e){var r=this.__data__,o=R(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Je=is;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=qe;tt.prototype.delete=Ye;tt.prototype.get=Ve;tt.prototype.has=Ze;tt.prototype.set=Je;var B=tt;var ss=S(g,"Map"),L=ss;function ns(){this.size=0,this.__data__={hash:new Lt,map:new(L||B),string:new Lt}}var Xe=ns;function fs(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Qe=fs;function ps(t,e){var r=t.__data__;return Qe(e)?r[typeof e=="string"?"string":"hash"]:r.map}var D=ps;function ls(t){var e=D(this,t).delete(t);return this.size-=e?1:0,e}var tr=ls;function ms(t){return D(this,t).get(t)}var er=ms;function us(t){return D(this,t).has(t)}var rr=us;function ds(t,e){var r=D(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var or=ds;function et(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])}}et.prototype.clear=Xe;et.prototype.delete=tr;et.prototype.get=er;et.prototype.has=rr;et.prototype.set=or;var dt=et;var cs="Expected a function";function Dt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(cs);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(Dt.Cache||dt),r}Dt.Cache=dt;var ar=Dt;var hs=500;function xs(t){var e=ar(t,function(o){return r.size===hs&&r.clear(),o}),r=e.cache;return e}var ir=xs;var gs=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ys=/\\(\\)?/g,bs=ir(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(gs,function(r,o,a,s){e.push(a?s.replace(ys,"$1"):o||r)}),e}),sr=bs;function vs(t){return t==null?"":le(t)}var nr=vs;function ws(t,e){return w(t)?t:ze(t,e)?[t]:sr(nr(t))}var U=ws;var Ts=1/0;function Os(t){if(typeof t=="string"||G(t))return t;var e=t+"";return e=="0"&&1/t==-Ts?"-0":e}var rt=Os;function Ss(t,e){e=U(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[rt(e[r++])];return r&&r==o?t:void 0}var fr=Ss;function js(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var ot=js;var pr=T?T.isConcatSpreadable:void 0;function As(t){return w(t)||V(t)||!!(pr&&t&&t[pr])}var lr=As;function mr(t,e,r,o,a){var s=-1,n=t.length;for(r||(r=lr),a||(a=[]);++s<n;){var i=t[s];e>0&&r(i)?e>1?mr(i,e-1,r,o,a):ot(a,i):o||(a[a.length]=i)}return a}var ur=mr;function Ps(t){var e=t==null?0:t.length;return e?ur(t,1):[]}var dr=Ps;function Is(t){return Oe(Ae(t,void 0,dr),t+"")}var cr=Is;var _s=St(Object.getPrototypeOf,Object),jt=_s;function Es(){this.__data__=new B,this.size=0}var hr=Es;function Cs(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var xr=Cs;function Fs(t){return this.__data__.get(t)}var gr=Fs;function Ms(t){return this.__data__.has(t)}var yr=Ms;var Ns=200;function Rs(t,e){var r=this.__data__;if(r instanceof B){var o=r.__data__;if(!L||o.length<Ns-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new dt(o)}return r.set(t,e),this.size=r.size,this}var br=Rs;function at(t){var e=this.__data__=new B(t);this.size=e.size}at.prototype.clear=hr;at.prototype.delete=xr;at.prototype.get=gr;at.prototype.has=yr;at.prototype.set=br;var vr=at;function Bs(t,e){return t&&N(e,J(e),t)}var wr=Bs;function Ls(t,e){return t&&N(e,X(e),t)}var Tr=Ls;var Ar=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Or=Ar&&typeof module=="object"&&module&&!module.nodeType&&module,Ds=Or&&Or.exports===Ar,Sr=Ds?g.Buffer:void 0,jr=Sr?Sr.allocUnsafe:void 0;function Us(t,e){if(e)return t.slice();var r=t.length,o=jr?jr(r):new t.constructor(r);return t.copy(o),o}var Pr=Us;function ks(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 Ir=ks;function zs(){return[]}var At=zs;var Ks=Object.prototype,Gs=Ks.propertyIsEnumerable,_r=Object.getOwnPropertySymbols,Ws=_r?function(t){return t==null?[]:(t=Object(t),Ir(_r(t),function(e){return Gs.call(t,e)}))}:At,it=Ws;function $s(t,e){return N(t,it(t),e)}var Er=$s;var Hs=Object.getOwnPropertySymbols,qs=Hs?function(t){for(var e=[];t;)ot(e,it(t)),t=jt(t);return e}:At,Pt=qs;function Ys(t,e){return N(t,Pt(t),e)}var Cr=Ys;function Vs(t,e,r){var o=e(t);return w(t)?o:ot(o,r(t))}var It=Vs;function Zs(t){return It(t,J,it)}var Fr=Zs;function Js(t){return It(t,X,Pt)}var Mr=Js;var Xs=S(g,"DataView"),_t=Xs;var Qs=S(g,"Promise"),Et=Qs;var tn=S(g,"Set"),Ct=tn;var Nr="[object Map]",en="[object Object]",Rr="[object Promise]",Br="[object Set]",Lr="[object WeakMap]",Dr="[object DataView]",rn=C(_t),on=C(L),an=C(Et),sn=C(Ct),nn=C(yt),z=I;(_t&&z(new _t(new ArrayBuffer(1)))!=Dr||L&&z(new L)!=Nr||Et&&z(Et.resolve())!=Rr||Ct&&z(new Ct)!=Br||yt&&z(new yt)!=Lr)&&(z=function(t){var e=I(t),r=e==en?t.constructor:void 0,o=r?C(r):"";if(o)switch(o){case rn:return Dr;case on:return Nr;case an:return Rr;case sn:return Br;case nn:return Lr}return e});var st=z;var fn=Object.prototype,pn=fn.hasOwnProperty;function ln(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&pn.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Ur=ln;var mn=g.Uint8Array,Ut=mn;function un(t){var e=new t.constructor(t.byteLength);return new Ut(e).set(new Ut(t)),e}var nt=un;function dn(t,e){var r=e?nt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var kr=dn;var cn=/\w*$/;function hn(t){var e=new t.constructor(t.source,cn.exec(t));return e.lastIndex=t.lastIndex,e}var zr=hn;var Kr=T?T.prototype:void 0,Gr=Kr?Kr.valueOf:void 0;function xn(t){return Gr?Object(Gr.call(t)):{}}var Wr=xn;function gn(t,e){var r=e?nt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var $r=gn;var yn="[object Boolean]",bn="[object Date]",vn="[object Map]",wn="[object Number]",Tn="[object RegExp]",On="[object Set]",Sn="[object String]",jn="[object Symbol]",An="[object ArrayBuffer]",Pn="[object DataView]",In="[object Float32Array]",_n="[object Float64Array]",En="[object Int8Array]",Cn="[object Int16Array]",Fn="[object Int32Array]",Mn="[object Uint8Array]",Nn="[object Uint8ClampedArray]",Rn="[object Uint16Array]",Bn="[object Uint32Array]";function Ln(t,e,r){var o=t.constructor;switch(e){case An:return nt(t);case yn:case bn:return new o(+t);case Pn:return kr(t,r);case In:case _n:case En:case Cn:case Fn:case Mn:case Nn:case Rn:case Bn:return $r(t,r);case vn:return new o;case wn:case Sn:return new o(t);case Tn:return zr(t);case On:return new o;case jn:return Wr(t)}}var Hr=Ln;function Dn(t){return typeof t.constructor=="function"&&!Y(t)?ge(jt(t)):{}}var qr=Dn;var Un="[object Map]";function kn(t){return P(t)&&st(t)==Un}var Yr=kn;var Vr=F&&F.isMap,zn=Vr?Z(Vr):Yr,Zr=zn;var Kn="[object Set]";function Gn(t){return P(t)&&st(t)==Kn}var Jr=Gn;var Xr=F&&F.isSet,Wn=Xr?Z(Xr):Jr,Qr=Wn;var $n=1,Hn=2,qn=4,to="[object Arguments]",Yn="[object Array]",Vn="[object Boolean]",Zn="[object Date]",Jn="[object Error]",eo="[object Function]",Xn="[object GeneratorFunction]",Qn="[object Map]",tf="[object Number]",ro="[object Object]",ef="[object RegExp]",rf="[object Set]",of="[object String]",af="[object Symbol]",sf="[object WeakMap]",nf="[object ArrayBuffer]",ff="[object DataView]",pf="[object Float32Array]",lf="[object Float64Array]",mf="[object Int8Array]",uf="[object Int16Array]",df="[object Int32Array]",cf="[object Uint8Array]",hf="[object Uint8ClampedArray]",xf="[object Uint16Array]",gf="[object Uint32Array]",d={};d[to]=d[Yn]=d[nf]=d[ff]=d[Vn]=d[Zn]=d[pf]=d[lf]=d[mf]=d[uf]=d[df]=d[Qn]=d[tf]=d[ro]=d[ef]=d[rf]=d[of]=d[af]=d[cf]=d[hf]=d[xf]=d[gf]=!0;d[Jn]=d[eo]=d[sf]=!1;function Ft(t,e,r,o,a,s){var n,i=e&$n,f=e&Hn,m=e&qn;if(r&&(n=a?r(t,o,a,s):r(t)),n!==void 0)return n;if(!A(t))return t;var x=w(t);if(x){if(n=Ur(t),!i)return be(t,n)}else{var v=st(t),j=v==eo||v==Xn;if(Tt(t))return Pr(t,i);if(v==ro||v==to||j&&!a){if(n=f||j?{}:qr(t),!i)return f?Cr(t,Tr(n,t)):Er(t,wr(n,t))}else{if(!d[v])return a?t:{};n=Hr(t,v,i)}}s||(s=new vr);var O=s.get(t);if(O)return O;s.set(t,n),Qr(t)?t.forEach(function(b){n.add(Ft(b,e,r,b,t,s))}):Zr(t)&&t.forEach(function(b,p){n.set(p,Ft(b,e,r,p,t,s))});var y=m?f?Mr:Fr:f?X:J,_=x?void 0:y(t);return Se(_||t,function(b,p){_&&(p=b,b=t[p]),H(n,p,Ft(b,e,r,p,t,s))}),n}var oo=Ft;var yf=1,bf=4;function vf(t){return oo(t,yf|bf)}var kt=vf;function wf(t,e){return t!=null&&e in Object(t)}var ao=wf;function Tf(t,e,r){e=U(e,t);for(var o=-1,a=e.length,s=!1;++o<a;){var n=rt(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&&q(a)&&$(n,a)&&(w(t)||V(t)))}var io=Tf;function Of(t,e){return t!=null&&io(t,e,ao)}var so=Of;function Sf(t,e,r,o){if(!A(t))return t;e=U(e,t);for(var a=-1,s=e.length,n=s-1,i=t;i!=null&&++a<s;){var f=rt(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=A(x)?x:$(e[a+1])?[]:{})}H(i,f,m),i=i[f]}return t}var no=Sf;function jf(t,e,r){for(var o=-1,a=e.length,s={};++o<a;){var n=e[o],i=fr(t,n);r(i,n)&&no(s,U(n,t),i)}return s}var fo=jf;function Af(t,e){return fo(t,e,function(r,o){return so(t,o)})}var po=Af;var Pf=cr(function(t,e){return t==null?{}:po(t,e)}),Mt=Pf;function lo(t){return{all:t=t||new Map,on:function(e,r){var o=t.get(e);o?o.push(r):t.set(e,[r])},off:function(e,r){var o=t.get(e);o&&(r?o.splice(o.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var o=t.get(e);o&&o.slice().map(function(a){a(r)}),(o=t.get("*"))&&o.slice().map(function(a){a(e,r)})}}}var zt=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),"");var If="array",_f="bit",mo="bits",Ef="byte",uo="bytes",ft="",Cf="exponent",Ff="function",co="iec",Mf="Invalid number",Nf="Invalid rounding method",Kt="jedec",Rf="object",ho=".",Bf="round",Lf="s",Df="si",Uf="kbit",kf="kB",zf=" ",Kf="string",Gf="0",Gt={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function xo(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:s=ft,localeOptions:n={},separator:i=ft,spacer:f=zf,symbols:m={},standard:x=ft,output:v=Kf,fullform:j=!1,fullforms:O=[],exponent:y=-1,roundingMethod:_=Bf,precision:b=0}={}){let p=y,u=Number(t),l=[],E=0,Nt=ft;x===Df?(o=10,x=Kt):x===co||x===Kt?o=2:o===2?x=co:(o=10,x=Kt);let ct=o===10?1e3:1024,go=j===!0,Ht=u<0,qt=Math[_];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(Mf);if(typeof qt!==Ff)throw new TypeError(Nf);if(Ht&&(u=-u),(p===-1||isNaN(p))&&(p=Math.floor(Math.log(u)/Math.log(ct)),p<0&&(p=0)),p>8&&(b>0&&(b+=8-p),p=8),v===Cf)return p;if(u===0)l[0]=0,Nt=l[1]=Gt.symbol[x][e?mo:uo][p];else{E=u/(o===2?Math.pow(2,p*10):Math.pow(1e3,p)),e&&(E=E*8,E>=ct&&p<8&&(E=E/ct,p++));let pt=Math.pow(10,p>0?a:0);l[0]=qt(E*pt)/pt,l[0]===ct&&p<8&&y===-1&&(l[0]=1,p++),Nt=l[1]=o===10&&p===1?e?Uf:kf:Gt.symbol[x][e?mo:uo][p]}if(Ht&&(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(ho,i)),r&&Number.isInteger(l[0])===!1&&a>0){let pt=i||ho,Yt=l[0].toString().split(pt),Vt=Yt[1]||ft,Zt=Vt.length,yo=a-Zt;l[0]=`${Yt[0]}${pt}${Vt.padEnd(Zt+yo,Gf)}`}return go&&(l[1]=O[p]?O[p]:Gt.fullform[x][p]+(e?_f:Ef)+(l[0]===1?ft:Lf)),v===If?l:v===Rf?{value:l[0],symbol:l[1],exponent:p,unit:Nt}:l.join(f)}var k,Wt=class Wt{constructor(e){Xt(this,k,void 0);c(this,"id");c(this,"name");c(this,"icon");c(this,"path");c(this,"url");c(this,"teraUrl");c(this,"parsedName");c(this,"created");c(this,"createdFormatted");c(this,"modified");c(this,"modifiedFormatted");c(this,"accessed");c(this,"accessedFormatted");c(this,"size");c(this,"sizeFormatted");c(this,"mime");c(this,"meta",{});if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,e),delete this.tera,Qt(this,k,e.tera),this.teraUrl=this.url.replace(/^https:\/\/tera-tools.com\/projects\/(?:.+?)\/(.+)$/,"/project/$1"),this.sizeFormatted=xo(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(){return lt(this,k).getProjectFile(this.id)}setContents(e){return lt(this,k).setProjectFile(this.id,e)}getRefs(){return lt(this,k).getProjectLibrary(this.id)}setRefs(e){return lt(this,k).setProjectLibrary(this.id,e)}serialize(){return Mt(this,["id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new Wt(Mt(e,["tera","id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]))}};k=new WeakMap;var K=Wt;var $t=class{constructor(e){c(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});c(this,"events",lo());c(this,"dom",{el:null,iframe:null,popup:null,stylesheet:null});c(this,"methods",["handshake","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateFlush","setProjectStateRefresh","saveProjectState","replaceProjectState","applyProjectStatePatch","setProjectFile","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPageUrl","setPageTitle","uiAlert","uiSplat","uiWindow"]);c(this,"plugins",[]);c(this,"acceptPostboxes",{});e&&this.set(e)}send(e){let r=zt();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||zt(),...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=te(r,e,ee);return this.debug("INFO",3,"Created project patch",{newState:e,oldState:r}),this.applyProjectStatePatch(o)}applyProjectStatePatchLocal(e){throw new Error("applyProjectStatePatchLocal() has not been sub-classed by a plugin")}init(e){if(e&&this.set(e),this.init.promise)return this.init.promise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.init.promise=Promise.resolve().then(()=>this.debug("INFO",4,"[0/5] Init using server",this.settings.siteUrl)).then(()=>this.detectMode()).then(o=>{this.debug("INFO",4,"[1/5] Setting client mode to",o),this.settings.mode=o}).then(()=>this.debug("INFO",4,"[2/5] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>this.debug("INFO",4,"[3/5] Set server 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,"[4/5] Run client plugins")).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings)))).then(()=>this.debug("INFO",4,"[5/5] Init complete")).catch(o=>this.debug("WARN",0,"Init caught error",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(){return new Promise(e=>{switch(this.settings.mode){case"child":this.debug("INFO",2,"Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),document.body.append(this.dom.el),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("INFO",2,"Embeded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe);break;case"parent":this.debug("INFO",2,"Using TERA window parent"),e();break;case"popup":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"),(()=>{let r=0,o,a=()=>{this.debug("INFO",3,"Trying handshake",++r),clearTimeout(o),o=setTimeout(a,this.settings.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(o),this.debug("INFO",3,"Popup window accepted handshake"),e()})};a()})();break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","&.dev-mode {","display: flex;","border: 5px solid var(--TERA-accent);","background: #FFF;","}","& > iframe {","width: 100%;","height: 100%;","}","}","body.tera-fy-focus {","overflow: hidden;","& #tera-fy {","display: flex !important;","position: fixed !important;","top: 0px !important;","width: 100vw !important;","height: 100vh !important;","left: 0px !important;","z-index: 10000 !important;","}","}"].join(`
|
|
2
|
+
`),document.head.appendChild(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){this.methods.forEach(e=>this[e]=this.rpc.bind(this,e))}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r){return typeof e=="string"?this.settings[e]=r:Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r){return!this.settings.devMode||r===void 0?this:this.set(e,r)}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 this.settings.devMode=e==="toggle"?!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 K({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new K({tera:this,...o})))}getProjectFile(e){return this.rpc("getProjectFile",e).then(r=>r&&new K({tera:this,...r}))}};export{$t as default};
|
|
3
3
|
/*! Bundled license information:
|
|
4
4
|
|
|
5
5
|
lodash-es/lodash.js:
|
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:n,basePath:m,basePathForRemoves:h,diffs:b}){var A=Object.keys(i),T=A.length,g=Object.keys(n),I=g.length,y,p=i.length-n.length;if(uo(i,n)){for(var u=0;u<T;u++){var l=Array.isArray(i)?Number(A[u]):A[u];l in n||(y=h.concat(l),b.remove.push({op:"remove",path:r(y)}))}for(var u=0;u<I;u++){var l=Array.isArray(n)?Number(g[u]):g[u];s({key:l,obj1:i,obj2:n,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:n,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:n,obj2:m,path:h,pathForRemoves:b,diffs:A}){var T=n[i],g=m[i];if(!(i in n)&&i in m){var I=g;A.add.push({op:"add",path:r(h),value:I})}else T!==g&&(Object(T)!==T||Object(g)!==g||mo(T,g)||!Object.keys(T).length&&!Object.keys(g).length&&String(T)!=String(g)?f(h,A,g):o({obj1:n[i],obj2:m[i],basePath:h,basePathForRemoves:b,diffs:A}))}function f(i,n,m){n.replace.push({op:"replace",path:r(i),value:m})}}function Yt(t){return[""].concat(t).join("/")}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 f=e.length;f>0&&String(t[f+r])===String(e[f]);f--)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,w=go;var Vt=Object.prototype,yo=Vt.hasOwnProperty,bo=Vt.toString,nt=w?w.toStringTag:void 0;function vo(t){var e=yo.call(t,nt),r=t[nt];try{t[nt]=void 0;var o=!0}catch{}var a=bo.call(t);return o&&(e?t[nt]=r:delete t[nt]),a}var Zt=vo;var wo=Object.prototype,To=wo.toString;function Oo(t){return To.call(t)}var Jt=Oo;var Ao="[object Null]",Po="[object Undefined]",Xt=w?w.toStringTag:void 0;function So(t){return t==null?t===void 0?Po:Ao:Xt&&Xt in Object(t)?Zt(t):Jt(t)}var j=So;function jo(t){return t!=null&&typeof t=="object"}var S=jo;var Io="[object Symbol]";function _o(t){return typeof t=="symbol"||S(t)&&j(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 Qt=Eo;var Co=Array.isArray,v=Co;var Mo=1/0,te=w?w.prototype:void 0,ee=te?te.toString:void 0;function re(t){if(typeof t=="string")return t;if(v(t))return Qt(t,re)+"";if(z(t))return ee?ee.call(t):"";var e=t+"";return e=="0"&&1/t==-Mo?"-0":e}var oe=re;function Fo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var P=Fo;function Ro(t){return t}var ae=Ro;var No="[object AsyncFunction]",Bo="[object Function]",Lo="[object GeneratorFunction]",Do="[object Proxy]";function Uo(t){if(!P(t))return!1;var e=j(t);return e==Bo||e==Lo||e==No||e==Do}var dt=Uo;var ko=x["__core-js_shared__"],ct=ko;var ie=function(){var t=/[^.]+$/.exec(ct&&ct.keys&&ct.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function zo(t){return!!ie&&ie in t}var se=zo;var 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 Ho=/[\\^$.*+?()[\]{}|]/g,$o=/^\[object .+?Constructor\]$/,qo=Function.prototype,Yo=Object.prototype,Vo=qo.toString,Zo=Yo.hasOwnProperty,Jo=RegExp("^"+Vo.call(Zo).replace(Ho,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Xo(t){if(!P(t)||se(t))return!1;var e=dt(t)?Jo:$o;return e.test(E(t))}var fe=Xo;function Qo(t,e){return t?.[e]}var ne=Qo;function ta(t,e){var r=ne(t,e);return fe(r)?r:void 0}var O=ta;var ea=O(x,"WeakMap"),ht=ea;var pe=Object.create,ra=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=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 me=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 ue=aa;var ia=800,sa=16,fa=Date.now;function na(t){var e=0,r=0;return function(){var o=fa(),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 de=na;function pa(t){return function(){return t}}var ce=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:ce(e),writable:!0})}:ae,he=ma;var ua=de(he),xe=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 ge=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 wa(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=wa;function Ta(t,e,r,o){var a=!r;r||(r={});for(var s=-1,f=e.length;++s<f;){var i=e[s],n=o?o(r[i],t[i],i,r,t):void 0;n===void 0&&(n=t[i]),a?xt(r,i,n):W(r,i,n)}return r}var F=Ta;var ye=Math.max;function Oa(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),f=Array(s);++a<s;)f[a]=o[e+a];a=-1;for(var i=Array(e+1);++a<e;)i[a]=o[a];return i[e]=r(f),me(t,this,i)}}var be=Oa;var Aa=9007199254740991;function Pa(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Aa}var H=Pa;function Sa(t){return t!=null&&H(t.length)&&!dt(t)}var yt=Sa;var ja=Object.prototype;function Ia(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||ja;return t===r}var $=Ia;function _a(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var ve=_a;var Ea="[object Arguments]";function Ca(t){return S(t)&&j(t)==Ea}var Mt=Ca;var we=Object.prototype,Ma=we.hasOwnProperty,Fa=we.propertyIsEnumerable,Ra=Mt(function(){return arguments}())?Mt:function(t){return S(t)&&Ma.call(t,"callee")&&!Fa.call(t,"callee")},q=Ra;function Na(){return!1}var Te=Na;var Pe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Oe=Pe&&typeof module=="object"&&module&&!module.nodeType&&module,Ba=Oe&&Oe.exports===Pe,Ae=Ba?x.Buffer:void 0,La=Ae?Ae.isBuffer:void 0,Da=La||Te,bt=Da;var Ua="[object Arguments]",ka="[object Array]",za="[object Boolean]",Ka="[object Date]",Ga="[object Error]",Wa="[object Function]",Ha="[object Map]",$a="[object Number]",qa="[object Object]",Ya="[object RegExp]",Va="[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]",fi="[object Uint16Array]",ni="[object Uint32Array]",c={};c[ti]=c[ei]=c[ri]=c[oi]=c[ai]=c[ii]=c[si]=c[fi]=c[ni]=!0;c[Ua]=c[ka]=c[Xa]=c[za]=c[Qa]=c[Ka]=c[Ga]=c[Wa]=c[Ha]=c[$a]=c[qa]=c[Ya]=c[Va]=c[Za]=c[Ja]=!1;function pi(t){return S(t)&&H(t.length)&&!!c[j(t)]}var Se=pi;function li(t){return function(e){return t(e)}}var Y=li;var je=typeof exports=="object"&&exports&&!exports.nodeType&&exports,pt=je&&typeof module=="object"&&module&&!module.nodeType&&module,mi=pt&&pt.exports===je,Ft=mi&&ut.process,ui=function(){try{var t=pt&&pt.require&&pt.require("util").types;return t||Ft&&Ft.binding&&Ft.binding("util")}catch{}}(),C=ui;var Ie=C&&C.isTypedArray,di=Ie?Y(Ie):Se,_e=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&&_e(t),f=r||o||a||s,i=f?ve(t.length,String):[],n=i.length;for(var m in t)(e||hi.call(t,m))&&!(f&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||G(m,n)))&&i.push(m);return i}var vt=xi;function gi(t,e){return function(r){return t(e(r))}}var wt=gi;var yi=wt(Object.keys,Object),Ee=yi;var bi=Object.prototype,vi=bi.hasOwnProperty;function wi(t){if(!$(t))return Ee(t);var e=[];for(var r in Object(t))vi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ce=wi;function Ti(t){return yt(t)?vt(t):Ce(t)}var V=Ti;function Oi(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Me=Oi;var Ai=Object.prototype,Pi=Ai.hasOwnProperty;function Si(t){if(!P(t))return Me(t);var e=$(t),r=[];for(var o in t)o=="constructor"&&(e||!Pi.call(t,o))||r.push(o);return r}var Fe=Si;function ji(t){return yt(t)?vt(t,!0):Fe(t)}var Z=ji;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 Ci=O(Object,"create"),M=Ci;function Mi(){this.__data__=M?M(null):{},this.size=0}var Ne=Mi;function Fi(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Be=Fi;var Ri="__lodash_hash_undefined__",Ni=Object.prototype,Bi=Ni.hasOwnProperty;function Li(t){var e=this.__data__;if(M){var r=e[t];return r===Ri?void 0:r}return Bi.call(e,t)?e[t]:void 0}var Le=Li;var Di=Object.prototype,Ui=Di.hasOwnProperty;function ki(t){var e=this.__data__;return M?e[t]!==void 0:Ui.call(e,t)}var De=ki;var zi="__lodash_hash_undefined__";function Ki(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=M&&e===void 0?zi:e,this}var Ue=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=Ne;J.prototype.delete=Be;J.prototype.get=Le;J.prototype.has=De;J.prototype.set=Ue;var Rt=J;function Gi(){this.__data__=[],this.size=0}var ke=Gi;function Wi(t,e){for(var r=t.length;r--;)if(gt(t[r][0],e))return r;return-1}var R=Wi;var Hi=Array.prototype,$i=Hi.splice;function qi(t){var e=this.__data__,r=R(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():$i.call(e,r,1),--this.size,!0}var ze=qi;function Yi(t){var e=this.__data__,r=R(e,t);return r<0?void 0:e[r][1]}var Ke=Yi;function Vi(t){return R(this.__data__,t)>-1}var Ge=Vi;function Zi(t,e){var r=this.__data__,o=R(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var We=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=ke;X.prototype.delete=ze;X.prototype.get=Ke;X.prototype.has=Ge;X.prototype.set=We;var N=X;var Ji=O(x,"Map"),B=Ji;function Xi(){this.size=0,this.__data__={hash:new Rt,map:new(B||N),string:new Rt}}var He=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 L=ts;function es(t){var e=L(this,t).delete(t);return this.size-=e?1:0,e}var qe=es;function rs(t){return L(this,t).get(t)}var Ye=rs;function os(t){return L(this,t).has(t)}var Ve=os;function as(t,e){var r=L(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ze=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=He;Q.prototype.delete=qe;Q.prototype.get=Ye;Q.prototype.has=Ve;Q.prototype.set=Ze;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 f=t.apply(this,o);return r.cache=s.set(a,f)||s,f};return r.cache=new(Nt.Cache||lt),r}Nt.Cache=lt;var Je=Nt;var ss=500;function fs(t){var e=Je(t,function(o){return r.size===ss&&r.clear(),o}),r=e.cache;return e}var Xe=fs;var ns=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ps=/\\(\\)?/g,ls=Xe(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(ns,function(r,o,a,s){e.push(a?s.replace(ps,"$1"):o||r)}),e}),Qe=ls;function ms(t){return t==null?"":oe(t)}var tr=ms;function us(t,e){return v(t)?t:Re(t,e)?[t]:Qe(tr(t))}var D=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=D(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=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 rr=w?w.isConcatSpreadable:void 0;function gs(t){return v(t)||q(t)||!!(rr&&t&&t[rr])}var or=gs;function ar(t,e,r,o,a){var s=-1,f=t.length;for(r||(r=or),a||(a=[]);++s<f;){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 ys(t){var e=t==null?0:t.length;return e?ir(t,1):[]}var sr=ys;function bs(t){return xe(be(t,void 0,sr),t+"")}var fr=bs;var vs=wt(Object.getPrototypeOf,Object),Tt=vs;function ws(){this.__data__=new N,this.size=0}var nr=ws;function Ts(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var pr=Ts;function Os(t){return this.__data__.get(t)}var lr=Os;function As(t){return this.__data__.has(t)}var mr=As;var Ps=200;function Ss(t,e){var r=this.__data__;if(r instanceof N){var o=r.__data__;if(!B||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=nr;rt.prototype.delete=pr;rt.prototype.get=lr;rt.prototype.has=mr;rt.prototype.set=ur;var dr=rt;function js(t,e){return t&&F(e,V(e),t)}var cr=js;function Is(t,e){return t&&F(e,Z(e),t)}var hr=Is;var br=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xr=br&&typeof module=="object"&&module&&!module.nodeType&&module,_s=xr&&xr.exports===br,gr=_s?x.Buffer:void 0,yr=gr?gr.allocUnsafe:void 0;function Es(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=Es;function Cs(t,e){for(var r=-1,o=t==null?0:t.length,a=0,s=[];++r<o;){var f=t[r];e(f,r,t)&&(s[a++]=f)}return s}var wr=Cs;function Ms(){return[]}var Ot=Ms;var Fs=Object.prototype,Rs=Fs.propertyIsEnumerable,Tr=Object.getOwnPropertySymbols,Ns=Tr?function(t){return t==null?[]:(t=Object(t),wr(Tr(t),function(e){return Rs.call(t,e)}))}:Ot,ot=Ns;function Bs(t,e){return F(t,ot(t),e)}var Or=Bs;var Ls=Object.getOwnPropertySymbols,Ds=Ls?function(t){for(var e=[];t;)et(e,ot(t)),t=Tt(t);return e}:Ot,At=Ds;function Us(t,e){return F(t,At(t),e)}var Ar=Us;function ks(t,e,r){var o=e(t);return v(t)?o:et(o,r(t))}var Pt=ks;function zs(t){return Pt(t,V,ot)}var Pr=zs;function Ks(t){return Pt(t,Z,At)}var Sr=Ks;var Gs=O(x,"DataView"),St=Gs;var Ws=O(x,"Promise"),jt=Ws;var Hs=O(x,"Set"),It=Hs;var jr="[object Map]",$s="[object Object]",Ir="[object Promise]",_r="[object Set]",Er="[object WeakMap]",Cr="[object DataView]",qs=E(St),Ys=E(B),Vs=E(jt),Zs=E(It),Js=E(ht),U=j;(St&&U(new St(new ArrayBuffer(1)))!=Cr||B&&U(new B)!=jr||jt&&U(jt.resolve())!=Ir||It&&U(new It)!=_r||ht&&U(new ht)!=Er)&&(U=function(t){var e=j(t),r=e==$s?t.constructor:void 0,o=r?E(r):"";if(o)switch(o){case qs:return Cr;case Ys:return jr;case Vs:return Ir;case Zs:return _r;case Js:return Er}return e});var at=U;var Xs=Object.prototype,Qs=Xs.hasOwnProperty;function tf(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 Mr=tf;var ef=x.Uint8Array,Bt=ef;function rf(t){var e=new t.constructor(t.byteLength);return new Bt(e).set(new Bt(t)),e}var it=rf;function of(t,e){var r=e?it(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Fr=of;var af=/\w*$/;function sf(t){var e=new t.constructor(t.source,af.exec(t));return e.lastIndex=t.lastIndex,e}var Rr=sf;var Nr=w?w.prototype:void 0,Br=Nr?Nr.valueOf:void 0;function ff(t){return Br?Object(Br.call(t)):{}}var Lr=ff;function nf(t,e){var r=e?it(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Dr=nf;var pf="[object Boolean]",lf="[object Date]",mf="[object Map]",uf="[object Number]",df="[object RegExp]",cf="[object Set]",hf="[object String]",xf="[object Symbol]",gf="[object ArrayBuffer]",yf="[object DataView]",bf="[object Float32Array]",vf="[object Float64Array]",wf="[object Int8Array]",Tf="[object Int16Array]",Of="[object Int32Array]",Af="[object Uint8Array]",Pf="[object Uint8ClampedArray]",Sf="[object Uint16Array]",jf="[object Uint32Array]";function If(t,e,r){var o=t.constructor;switch(e){case gf:return it(t);case pf:case lf:return new o(+t);case yf:return Fr(t,r);case bf:case vf:case wf:case Tf:case Of:case Af:case Pf:case Sf:case jf:return Dr(t,r);case mf:return new o;case uf:case hf:return new o(t);case df:return Rr(t);case cf:return new o;case xf:return Lr(t)}}var Ur=If;function _f(t){return typeof t.constructor=="function"&&!$(t)?le(Tt(t)):{}}var kr=_f;var Ef="[object Map]";function Cf(t){return S(t)&&at(t)==Ef}var zr=Cf;var Kr=C&&C.isMap,Mf=Kr?Y(Kr):zr,Gr=Mf;var Ff="[object Set]";function Rf(t){return S(t)&&at(t)==Ff}var Wr=Rf;var Hr=C&&C.isSet,Nf=Hr?Y(Hr):Wr,$r=Nf;var Bf=1,Lf=2,Df=4,qr="[object Arguments]",Uf="[object Array]",kf="[object Boolean]",zf="[object Date]",Kf="[object Error]",Yr="[object Function]",Gf="[object GeneratorFunction]",Wf="[object Map]",Hf="[object Number]",Vr="[object Object]",$f="[object RegExp]",qf="[object Set]",Yf="[object String]",Vf="[object Symbol]",Zf="[object WeakMap]",Jf="[object ArrayBuffer]",Xf="[object DataView]",Qf="[object Float32Array]",tn="[object Float64Array]",en="[object Int8Array]",rn="[object Int16Array]",on="[object Int32Array]",an="[object Uint8Array]",sn="[object Uint8ClampedArray]",fn="[object Uint16Array]",nn="[object Uint32Array]",d={};d[qr]=d[Uf]=d[Jf]=d[Xf]=d[kf]=d[zf]=d[Qf]=d[tn]=d[en]=d[rn]=d[on]=d[Wf]=d[Hf]=d[Vr]=d[$f]=d[qf]=d[Yf]=d[Vf]=d[an]=d[sn]=d[fn]=d[nn]=!0;d[Kf]=d[Yr]=d[Zf]=!1;function _t(t,e,r,o,a,s){var f,i=e&Bf,n=e&Lf,m=e&Df;if(r&&(f=a?r(t,o,a,s):r(t)),f!==void 0)return f;if(!P(t))return t;var h=v(t);if(h){if(f=Mr(t),!i)return ue(t,f)}else{var b=at(t),A=b==Yr||b==Gf;if(bt(t))return vr(t,i);if(b==Vr||b==qr||A&&!a){if(f=n||A?{}:kr(t),!i)return n?Ar(t,hr(f,t)):Or(t,cr(f,t))}else{if(!d[b])return a?t:{};f=Ur(t,b,i)}}s||(s=new dr);var T=s.get(t);if(T)return T;s.set(t,f),$r(t)?t.forEach(function(y){f.add(_t(y,e,r,y,t,s))}):Gr(t)&&t.forEach(function(y,p){f.set(p,_t(y,e,r,p,t,s))});var g=m?n?Sr:Pr:n?Z:V,I=h?void 0:g(t);return ge(I||t,function(y,p){I&&(p=y,y=t[p]),W(f,p,_t(y,e,r,p,t,s))}),f}var Zr=_t;var pn=1,ln=4;function mn(t){return Zr(t,pn|ln)}var Lt=mn;function un(t,e){return t!=null&&e in Object(t)}var Jr=un;function dn(t,e,r){e=D(e,t);for(var o=-1,a=e.length,s=!1;++o<a;){var f=tt(e[o]);if(!(s=t!=null&&r(t,f)))break;t=t[f]}return s||++o!=a?s:(a=t==null?0:t.length,!!a&&H(a)&&G(f,a)&&(v(t)||q(t)))}var Xr=dn;function cn(t,e){return t!=null&&Xr(t,e,Jr)}var Qr=cn;function hn(t,e,r,o){if(!P(t))return t;e=D(e,t);for(var a=-1,s=e.length,f=s-1,i=t;i!=null&&++a<s;){var n=tt(e[a]),m=r;if(n==="__proto__"||n==="constructor"||n==="prototype")return t;if(a!=f){var h=i[n];m=o?o(h,n,i):void 0,m===void 0&&(m=P(h)?h:G(e[a+1])?[]:{})}W(i,n,m),i=i[n]}return t}var to=hn;function xn(t,e,r){for(var o=-1,a=e.length,s={};++o<a;){var f=e[o],i=er(t,f);r(i,f)&&to(s,D(f,t),i)}return s}var eo=xn;function gn(t,e){return eo(t,e,function(r,o){return Qr(t,o)})}var ro=gn;var yn=fr(function(t,e){return t==null?{}:ro(t,e)}),Et=yn;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 Dt=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),"");var bn="array",vn="bit",ao="bits",wn="byte",io="bytes",st="",Tn="exponent",On="function",so="iec",An="Invalid number",Pn="Invalid rounding method",Ut="jedec",Sn="object",fo=".",jn="round",In="s",_n="si",En="kbit",Cn="kB",Mn=" ",Fn="string",Rn="0",kt={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function no(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:s=st,localeOptions:f={},separator:i=st,spacer:n=Mn,symbols:m={},standard:h=st,output:b=Fn,fullform:A=!1,fullforms:T=[],exponent:g=-1,roundingMethod:I=jn,precision:y=0}={}){let p=g,u=Number(t),l=[],_=0,Ct=st;h===_n?(o=10,h=Ut):h===so||h===Ut?o=2:o===2?h=so:(o=10,h=Ut);let mt=o===10?1e3:1024,po=A===!0,Kt=u<0,Gt=Math[I];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(An);if(typeof Gt!==On)throw new TypeError(Pn);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===Tn)return p;if(u===0)l[0]=0,Ct=l[1]=kt.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 ft=Math.pow(10,p>0?a:0);l[0]=Gt(_*ft)/ft,l[0]===mt&&p<8&&g===-1&&(l[0]=1,p++),Ct=l[1]=o===10&&p===1?e?En:Cn:kt.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,f):i.length>0&&(l[0]=l[0].toString().replace(fo,i)),r&&Number.isInteger(l[0])===!1&&a>0){let ft=i||fo,Wt=l[0].toString().split(ft),Ht=Wt[1]||st,$t=Ht.length,lo=a-$t;l[0]=`${Wt[0]}${ft}${Ht.padEnd($t+lo,Rn)}`}return po&&(l[1]=T[p]?T[p]:kt.fullform[h][p]+(e?vn:wn)+(l[0]===1?st:In)),b===bn?l:b===Sn?{value:l[0],symbol:l[1],exponent:p,unit:Ct}:l.join(n)}var k=class t{#t;id;name;icon;path;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),delete this.tera,this.#t=e.tera,this.sizeFormatted=no(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(){return this.#t.getProjectFile(this.path)}setContents(e){return this.#t.setProjectFile(this.path,e)}getRefs(){return this.#t.getProjectLibrary(this.path)}setRefs(e){return this.#t.setProjectLibrary(this.path,e)}serialize(){return Et(this,["id","name","icon","path","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new t(Et(e,["tera","id","name","icon","path","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};events=oo();dom={el:null,iframe:null,popup:null,stylesheet:null};methods=["handshake","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","saveProjectState","replaceProjectState","applyProjectStatePatch","setProjectFile","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPageUrl","setPageTitle","uiAlert","uiSplat","uiWindow"];plugins=[];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(),...Lt(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,Yt);return this.debug("INFO",3,"Created project patch",{newState:e,oldState:r}),this.applyProjectStatePatch(o)}applyProjectStatePatchLocal(e){throw new Error("applyProjectStatePatchLocal() has not been sub-classed by a plugin")}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.detectMode()).then(o=>this.settings.mode=o).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).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(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings))))}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(){return new Promise(e=>{switch(this.settings.mode){case"child":this.debug("INFO",2,"Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),document.body.append(this.dom.el),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("INFO",2,"Embeded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe);break;case"parent":this.debug("INFO",2,"Using TERA window parent"),e();break;case"popup":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"),(()=>{let r=0,o,a=()=>{this.debug("INFO",3,"Trying handshake",++r),clearTimeout(o),o=setTimeout(a,this.settings.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(o),this.debug("INFO",3,"Popup window accepted handshake"),e()})};a()})();break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","&.dev-mode {","display: flex;","border: 5px solid var(--TERA-accent);","background: #FFF;","}","& > iframe {","width: 100%;","height: 100%;","}","}","body.tera-fy-focus {","overflow: hidden;","& #tera-fy {","display: flex !important;","position: fixed !important;","top: 0px !important;","width: 100vw !important;","height: 100vh !important;","left: 0px !important;","z-index: 10000 !important;","}","}"].join(`
|
|
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 S=Object.keys(i),T=S.length,g=Object.keys(f),I=g.length,y,p=i.length-f.length;if(uo(i,f)){for(var u=0;u<T;u++){var l=Array.isArray(i)?Number(S[u]):S[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:S}){var T=f[i],g=m[i];if(!(i in f)&&i in m){var I=g;S.add.push({op:"add",path:r(h),value:I})}else T!==g&&(Object(T)!==T||Object(g)!==g||mo(T,g)||!Object.keys(T).length&&!Object.keys(g).length&&String(T)!=String(g)?n(h,S,g):o({obj1:f[i],obj2:m[i],basePath:h,basePathForRemoves:b,diffs:S}))}function n(i,f,m){f.replace.push({op:"replace",path:r(i),value:m})}}function Yt(t){return[""].concat(t).join("/")}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,w=go;var Vt=Object.prototype,yo=Vt.hasOwnProperty,bo=Vt.toString,ft=w?w.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 Zt=vo;var wo=Object.prototype,To=wo.toString;function Oo(t){return To.call(t)}var Jt=Oo;var So="[object Null]",jo="[object Undefined]",Xt=w?w.toStringTag:void 0;function Ao(t){return t==null?t===void 0?jo:So:Xt&&Xt in Object(t)?Zt(t):Jt(t)}var P=Ao;function Po(t){return t!=null&&typeof t=="object"}var A=Po;var Io="[object Symbol]";function _o(t){return typeof t=="symbol"||A(t)&&P(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 Qt=Eo;var Co=Array.isArray,v=Co;var Fo=1/0,te=w?w.prototype:void 0,ee=te?te.toString:void 0;function re(t){if(typeof t=="string")return t;if(v(t))return Qt(t,re)+"";if(z(t))return ee?ee.call(t):"";var e=t+"";return e=="0"&&1/t==-Fo?"-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 Ro="[object AsyncFunction]",Bo="[object Function]",Lo="[object GeneratorFunction]",Do="[object Proxy]";function Uo(t){if(!j(t))return!1;var e=P(t);return e==Bo||e==Lo||e==Ro||e==Do}var dt=Uo;var ko=x["__core-js_shared__"],ct=ko;var ie=function(){var t=/[^.]+$/.exec(ct&&ct.keys&&ct.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function zo(t){return!!ie&&ie in t}var se=zo;var 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,Yo=Object.prototype,Vo=qo.toString,Zo=Yo.hasOwnProperty,Jo=RegExp("^"+Vo.call(Zo).replace($o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Xo(t){if(!j(t)||se(t))return!1;var e=dt(t)?Jo:Ho;return e.test(E(t))}var ne=Xo;function Qo(t,e){return t?.[e]}var fe=Qo;function ta(t,e){var r=fe(t,e);return ne(r)?r:void 0}var O=ta;var ea=O(x,"WeakMap"),ht=ea;var pe=Object.create,ra=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=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 me=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 ue=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 de=fa;function pa(t){return function(){return t}}var ce=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:ce(e),writable:!0})}:ae,he=ma;var ua=de(he),xe=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 ge=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 wa(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=wa;function Ta(t,e,r,o){var a=!r;r||(r={});for(var s=-1,n=e.length;++s<n;){var i=e[s],f=o?o(r[i],t[i],i,r,t):void 0;f===void 0&&(f=t[i]),a?xt(r,i,f):W(r,i,f)}return r}var M=Ta;var ye=Math.max;function Oa(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=Oa;var Sa=9007199254740991;function ja(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Sa}var $=ja;function Aa(t){return t!=null&&$(t.length)&&!dt(t)}var yt=Aa;var Pa=Object.prototype;function Ia(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Pa;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 ve=_a;var Ea="[object Arguments]";function Ca(t){return A(t)&&P(t)==Ea}var Ft=Ca;var we=Object.prototype,Fa=we.hasOwnProperty,Ma=we.propertyIsEnumerable,Na=Ft(function(){return arguments}())?Ft:function(t){return A(t)&&Fa.call(t,"callee")&&!Ma.call(t,"callee")},q=Na;function Ra(){return!1}var Te=Ra;var je=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Oe=je&&typeof module=="object"&&module&&!module.nodeType&&module,Ba=Oe&&Oe.exports===je,Se=Ba?x.Buffer:void 0,La=Se?Se.isBuffer:void 0,Da=La||Te,bt=Da;var Ua="[object Arguments]",ka="[object Array]",za="[object Boolean]",Ka="[object Date]",Ga="[object Error]",Wa="[object Function]",$a="[object Map]",Ha="[object Number]",qa="[object Object]",Ya="[object RegExp]",Va="[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[Ua]=c[ka]=c[Xa]=c[za]=c[Qa]=c[Ka]=c[Ga]=c[Wa]=c[$a]=c[Ha]=c[qa]=c[Ya]=c[Va]=c[Za]=c[Ja]=!1;function pi(t){return A(t)&&$(t.length)&&!!c[P(t)]}var Ae=pi;function li(t){return function(e){return t(e)}}var Y=li;var Pe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,pt=Pe&&typeof module=="object"&&module&&!module.nodeType&&module,mi=pt&&pt.exports===Pe,Mt=mi&&ut.process,ui=function(){try{var t=pt&&pt.require&&pt.require("util").types;return t||Mt&&Mt.binding&&Mt.binding("util")}catch{}}(),C=ui;var Ie=C&&C.isTypedArray,di=Ie?Y(Ie):Ae,_e=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&&_e(t),n=r||o||a||s,i=n?ve(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 wt=gi;var yi=wt(Object.keys,Object),Ee=yi;var bi=Object.prototype,vi=bi.hasOwnProperty;function wi(t){if(!H(t))return Ee(t);var e=[];for(var r in Object(t))vi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ce=wi;function Ti(t){return yt(t)?vt(t):Ce(t)}var V=Ti;function Oi(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Fe=Oi;var Si=Object.prototype,ji=Si.hasOwnProperty;function Ai(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 Me=Ai;function Pi(t){return yt(t)?vt(t,!0):Me(t)}var Z=Pi;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 Ne=Ei;var Ci=O(Object,"create"),F=Ci;function Fi(){this.__data__=F?F(null):{},this.size=0}var Re=Fi;function Mi(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Be=Mi;var Ni="__lodash_hash_undefined__",Ri=Object.prototype,Bi=Ri.hasOwnProperty;function Li(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 Le=Li;var Di=Object.prototype,Ui=Di.hasOwnProperty;function ki(t){var e=this.__data__;return F?e[t]!==void 0:Ui.call(e,t)}var De=ki;var zi="__lodash_hash_undefined__";function Ki(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=F&&e===void 0?zi:e,this}var Ue=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=Re;J.prototype.delete=Be;J.prototype.get=Le;J.prototype.has=De;J.prototype.set=Ue;var Nt=J;function Gi(){this.__data__=[],this.size=0}var ke=Gi;function Wi(t,e){for(var r=t.length;r--;)if(gt(t[r][0],e))return r;return-1}var N=Wi;var $i=Array.prototype,Hi=$i.splice;function qi(t){var e=this.__data__,r=N(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 ze=qi;function Yi(t){var e=this.__data__,r=N(e,t);return r<0?void 0:e[r][1]}var Ke=Yi;function Vi(t){return N(this.__data__,t)>-1}var Ge=Vi;function Zi(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=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=ke;X.prototype.delete=ze;X.prototype.get=Ke;X.prototype.has=Ge;X.prototype.set=We;var R=X;var Ji=O(x,"Map"),B=Ji;function Xi(){this.size=0,this.__data__={hash:new Nt,map:new(B||R),string:new Nt}}var $e=Xi;function Qi(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var He=Qi;function ts(t,e){var r=t.__data__;return He(e)?r[typeof e=="string"?"string":"hash"]:r.map}var L=ts;function es(t){var e=L(this,t).delete(t);return this.size-=e?1:0,e}var qe=es;function rs(t){return L(this,t).get(t)}var Ye=rs;function os(t){return L(this,t).has(t)}var Ve=os;function as(t,e){var r=L(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ze=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=$e;Q.prototype.delete=qe;Q.prototype.get=Ye;Q.prototype.has=Ve;Q.prototype.set=Ze;var lt=Q;var is="Expected a function";function Rt(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(Rt.Cache||lt),r}Rt.Cache=lt;var Je=Rt;var ss=500;function ns(t){var e=Je(t,function(o){return r.size===ss&&r.clear(),o}),r=e.cache;return e}var Xe=ns;var fs=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ps=/\\(\\)?/g,ls=Xe(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}),Qe=ls;function ms(t){return t==null?"":oe(t)}var tr=ms;function us(t,e){return v(t)?t:Ne(t,e)?[t]:Qe(tr(t))}var D=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=D(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=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 rr=w?w.isConcatSpreadable:void 0;function gs(t){return v(t)||q(t)||!!(rr&&t&&t[rr])}var or=gs;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 ys(t){var e=t==null?0:t.length;return e?ir(t,1):[]}var sr=ys;function bs(t){return xe(be(t,void 0,sr),t+"")}var nr=bs;var vs=wt(Object.getPrototypeOf,Object),Tt=vs;function ws(){this.__data__=new R,this.size=0}var fr=ws;function Ts(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var pr=Ts;function Os(t){return this.__data__.get(t)}var lr=Os;function Ss(t){return this.__data__.has(t)}var mr=Ss;var js=200;function As(t,e){var r=this.__data__;if(r instanceof R){var o=r.__data__;if(!B||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 ur=As;function rt(t){var e=this.__data__=new R(t);this.size=e.size}rt.prototype.clear=fr;rt.prototype.delete=pr;rt.prototype.get=lr;rt.prototype.has=mr;rt.prototype.set=ur;var dr=rt;function Ps(t,e){return t&&M(e,V(e),t)}var cr=Ps;function Is(t,e){return t&&M(e,Z(e),t)}var hr=Is;var br=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xr=br&&typeof module=="object"&&module&&!module.nodeType&&module,_s=xr&&xr.exports===br,gr=_s?x.Buffer:void 0,yr=gr?gr.allocUnsafe:void 0;function Es(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=Es;function Cs(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=Cs;function Fs(){return[]}var Ot=Fs;var Ms=Object.prototype,Ns=Ms.propertyIsEnumerable,Tr=Object.getOwnPropertySymbols,Rs=Tr?function(t){return t==null?[]:(t=Object(t),wr(Tr(t),function(e){return Ns.call(t,e)}))}:Ot,ot=Rs;function Bs(t,e){return M(t,ot(t),e)}var Or=Bs;var Ls=Object.getOwnPropertySymbols,Ds=Ls?function(t){for(var e=[];t;)et(e,ot(t)),t=Tt(t);return e}:Ot,St=Ds;function Us(t,e){return M(t,St(t),e)}var Sr=Us;function ks(t,e,r){var o=e(t);return v(t)?o:et(o,r(t))}var jt=ks;function zs(t){return jt(t,V,ot)}var jr=zs;function Ks(t){return jt(t,Z,St)}var Ar=Ks;var Gs=O(x,"DataView"),At=Gs;var Ws=O(x,"Promise"),Pt=Ws;var $s=O(x,"Set"),It=$s;var Pr="[object Map]",Hs="[object Object]",Ir="[object Promise]",_r="[object Set]",Er="[object WeakMap]",Cr="[object DataView]",qs=E(At),Ys=E(B),Vs=E(Pt),Zs=E(It),Js=E(ht),U=P;(At&&U(new At(new ArrayBuffer(1)))!=Cr||B&&U(new B)!=Pr||Pt&&U(Pt.resolve())!=Ir||It&&U(new It)!=_r||ht&&U(new ht)!=Er)&&(U=function(t){var e=P(t),r=e==Hs?t.constructor:void 0,o=r?E(r):"";if(o)switch(o){case qs:return Cr;case Ys:return Pr;case Vs:return Ir;case Zs:return _r;case Js:return Er}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,Bt=en;function rn(t){var e=new t.constructor(t.byteLength);return new Bt(e).set(new Bt(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 Mr=on;var an=/\w*$/;function sn(t){var e=new t.constructor(t.source,an.exec(t));return e.lastIndex=t.lastIndex,e}var Nr=sn;var Rr=w?w.prototype:void 0,Br=Rr?Rr.valueOf:void 0;function nn(t){return Br?Object(Br.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 Dr=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]",wn="[object Int8Array]",Tn="[object Int16Array]",On="[object Int32Array]",Sn="[object Uint8Array]",jn="[object Uint8ClampedArray]",An="[object Uint16Array]",Pn="[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 Mr(t,r);case bn:case vn:case wn:case Tn:case On:case Sn:case jn:case An:case Pn:return Dr(t,r);case mn:return new o;case un:case hn:return new o(t);case dn:return Nr(t);case cn:return new o;case xn:return Lr(t)}}var Ur=In;function _n(t){return typeof t.constructor=="function"&&!H(t)?le(Tt(t)):{}}var kr=_n;var En="[object Map]";function Cn(t){return A(t)&&at(t)==En}var zr=Cn;var Kr=C&&C.isMap,Fn=Kr?Y(Kr):zr,Gr=Fn;var Mn="[object Set]";function Nn(t){return A(t)&&at(t)==Mn}var Wr=Nn;var $r=C&&C.isSet,Rn=$r?Y($r):Wr,Hr=Rn;var Bn=1,Ln=2,Dn=4,qr="[object Arguments]",Un="[object Array]",kn="[object Boolean]",zn="[object Date]",Kn="[object Error]",Yr="[object Function]",Gn="[object GeneratorFunction]",Wn="[object Map]",$n="[object Number]",Vr="[object Object]",Hn="[object RegExp]",qn="[object Set]",Yn="[object String]",Vn="[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[qr]=d[Un]=d[Jn]=d[Xn]=d[kn]=d[zn]=d[Qn]=d[tf]=d[ef]=d[rf]=d[of]=d[Wn]=d[$n]=d[Vr]=d[Hn]=d[qn]=d[Yn]=d[Vn]=d[af]=d[sf]=d[nf]=d[ff]=!0;d[Kn]=d[Yr]=d[Zn]=!1;function _t(t,e,r,o,a,s){var n,i=e&Bn,f=e&Ln,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),S=b==Yr||b==Gn;if(bt(t))return vr(t,i);if(b==Vr||b==qr||S&&!a){if(n=f||S?{}:kr(t),!i)return f?Sr(t,hr(n,t)):Or(t,cr(n,t))}else{if(!d[b])return a?t:{};n=Ur(t,b,i)}}s||(s=new dr);var T=s.get(t);if(T)return T;s.set(t,n),Hr(t)?t.forEach(function(y){n.add(_t(y,e,r,y,t,s))}):Gr(t)&&t.forEach(function(y,p){n.set(p,_t(y,e,r,p,t,s))});var g=m?f?Ar:jr:f?Z:V,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 pf=1,lf=4;function mf(t){return Zr(t,pf|lf)}var Lt=mf;function uf(t,e){return t!=null&&e in Object(t)}var Jr=uf;function df(t,e,r){e=D(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=df;function cf(t,e){return t!=null&&Xr(t,e,Jr)}var Qr=cf;function hf(t,e,r,o){if(!j(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=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=hf;function xf(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=xf;function gf(t,e){return eo(t,e,function(r,o){return Qr(t,o)})}var ro=gf;var yf=nr(function(t,e){return t==null?{}:ro(t,e)}),Et=yf;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 Dt=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,r)=>(r&=63,r<36?e+=r.toString(36):r<62?e+=(r-26).toString(36).toUpperCase():r>62?e+="-":e+="_",e),"");var bf="array",vf="bit",ao="bits",wf="byte",io="bytes",st="",Tf="exponent",Of="function",so="iec",Sf="Invalid number",jf="Invalid rounding method",Ut="jedec",Af="object",no=".",Pf="round",If="s",_f="si",Ef="kbit",Cf="kB",Ff=" ",Mf="string",Nf="0",kt={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function fo(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:s=st,localeOptions:n={},separator:i=st,spacer:f=Ff,symbols:m={},standard:h=st,output:b=Mf,fullform:S=!1,fullforms:T=[],exponent:g=-1,roundingMethod:I=Pf,precision:y=0}={}){let p=g,u=Number(t),l=[],_=0,Ct=st;h===_f?(o=10,h=Ut):h===so||h===Ut?o=2:o===2?h=so:(o=10,h=Ut);let mt=o===10?1e3:1024,po=S===!0,Kt=u<0,Gt=Math[I];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(Sf);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===Tf)return p;if(u===0)l[0]=0,Ct=l[1]=kt.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++),Ct=l[1]=o===10&&p===1?e?Ef:Cf:kt.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,Nf)}`}return po&&(l[1]=T[p]?T[p]:kt.fullform[h][p]+(e?vf:wf)+(l[0]===1?st:If)),b===bf?l:b===Af?{value:l[0],symbol:l[1],exponent:p,unit:Ct}:l.join(f)}var k=class t{#t;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),delete this.tera,this.#t=e.tera,this.teraUrl=this.url.replace(/^https:\/\/tera-tools.com\/projects\/(?:.+?)\/(.+)$/,"/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(){return this.#t.getProjectFile(this.id)}setContents(e){return this.#t.setProjectFile(this.id,e)}getRefs(){return this.#t.getProjectLibrary(this.id)}setRefs(e){return this.#t.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};events=oo();dom={el:null,iframe:null,popup:null,stylesheet:null};methods=["handshake","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateFlush","setProjectStateRefresh","saveProjectState","replaceProjectState","applyProjectStatePatch","setProjectFile","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPageUrl","setPageTitle","uiAlert","uiSplat","uiWindow"];plugins=[];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(),...Lt(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,Yt);return this.debug("INFO",3,"Created project patch",{newState:e,oldState:r}),this.applyProjectStatePatch(o)}applyProjectStatePatchLocal(e){throw new Error("applyProjectStatePatchLocal() has not been sub-classed by a plugin")}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/5] Init using server",this.settings.siteUrl)).then(()=>this.detectMode()).then(o=>{this.debug("INFO",4,"[1/5] Setting client mode to",o),this.settings.mode=o}).then(()=>this.debug("INFO",4,"[2/5] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>this.debug("INFO",4,"[3/5] Set server 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,"[4/5] Run client plugins")).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings)))).then(()=>this.debug("INFO",4,"[5/5] Init complete")).catch(o=>this.debug("WARN",0,"Init caught error",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(){return new Promise(e=>{switch(this.settings.mode){case"child":this.debug("INFO",2,"Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),document.body.append(this.dom.el),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("INFO",2,"Embeded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe);break;case"parent":this.debug("INFO",2,"Using TERA window parent"),e();break;case"popup":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"),(()=>{let r=0,o,a=()=>{this.debug("INFO",3,"Trying handshake",++r),clearTimeout(o),o=setTimeout(a,this.settings.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(o),this.debug("INFO",3,"Popup window accepted handshake"),e()})};a()})();break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","&.dev-mode {","display: flex;","border: 5px solid var(--TERA-accent);","background: #FFF;","}","& > iframe {","width: 100%;","height: 100%;","}","}","body.tera-fy-focus {","overflow: hidden;","& #tera-fy {","display: flex !important;","position: fixed !important;","top: 0px !important;","width: 100vw !important;","height: 100vh !important;","left: 0px !important;","z-index: 10000 !important;","}","}"].join(`
|
|
2
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){return typeof e=="string"?this.settings[e]=r:Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r){return!this.settings.devMode||r===void 0?this:this.set(e,r)}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 this.settings.devMode=e==="toggle"?!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 k({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new k({tera:this,...o})))}getProjectFile(e){return this.rpc("getProjectFile",e).then(r=>r&&new k({tera:this,...r}))}};export{zt as default};
|
|
3
3
|
/*! Bundled license information:
|
|
4
4
|
|
package/lib/projectFile.js
CHANGED
|
@@ -43,6 +43,22 @@ export default class ProjectFile {
|
|
|
43
43
|
path;
|
|
44
44
|
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Fully qualified URL to view / access / download the file from TERA
|
|
48
|
+
* This will usually open an edit UI within the TERA site
|
|
49
|
+
* @type {String}
|
|
50
|
+
*/
|
|
51
|
+
url;
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Rewrite of the URL where the absolute URL has been removed in place of a relative path, assuming the owner project is active
|
|
56
|
+
* This is used to direct to the edit/view/download UI when the files project is active and is usually used in place of URL for TERA related operations
|
|
57
|
+
* @type {String}
|
|
58
|
+
*/
|
|
59
|
+
teraUrl;
|
|
60
|
+
|
|
61
|
+
|
|
46
62
|
/**
|
|
47
63
|
* An object representing meta file parts of a file name
|
|
48
64
|
* @type {Object}
|
|
@@ -136,6 +152,9 @@ export default class ProjectFile {
|
|
|
136
152
|
delete this.tera;
|
|
137
153
|
this.#tera = baseFile.tera;
|
|
138
154
|
|
|
155
|
+
// Calculate `teraUrl` from URL
|
|
156
|
+
this.teraUrl = this.url.replace(/^https:\/\/tera-tools.com\/projects\/(?:.+?)\/(.+)$/, '/project/$1');
|
|
157
|
+
|
|
139
158
|
// Set all `*Formatted` fields
|
|
140
159
|
this.sizeFormatted = filesize(this.size || 0, {spacer: ''});
|
|
141
160
|
this.createdFormatted = this.created ? this.created.toLocaleDateString() : 'Unknown created date';
|
|
@@ -152,7 +171,7 @@ export default class ProjectFile {
|
|
|
152
171
|
* @see getProjectFile()
|
|
153
172
|
*/
|
|
154
173
|
getContents() {
|
|
155
|
-
return this.#tera.getProjectFile(this.
|
|
174
|
+
return this.#tera.getProjectFile(this.id);
|
|
156
175
|
}
|
|
157
176
|
|
|
158
177
|
|
|
@@ -166,7 +185,7 @@ export default class ProjectFile {
|
|
|
166
185
|
* @see setProjectFile()
|
|
167
186
|
*/
|
|
168
187
|
setContents(contents) {
|
|
169
|
-
return this.#tera.setProjectFile(this.
|
|
188
|
+
return this.#tera.setProjectFile(this.id, contents);
|
|
170
189
|
}
|
|
171
190
|
|
|
172
191
|
|
|
@@ -178,7 +197,7 @@ export default class ProjectFile {
|
|
|
178
197
|
* @see getProjectLibrary()
|
|
179
198
|
*/
|
|
180
199
|
getRefs() {
|
|
181
|
-
return this.#tera.getProjectLibrary(this.
|
|
200
|
+
return this.#tera.getProjectLibrary(this.id);
|
|
182
201
|
}
|
|
183
202
|
|
|
184
203
|
|
|
@@ -192,7 +211,7 @@ export default class ProjectFile {
|
|
|
192
211
|
* @see setProjectLibrary()
|
|
193
212
|
*/
|
|
194
213
|
setRefs(refs) {
|
|
195
|
-
return this.#tera.setProjectLibrary(this.
|
|
214
|
+
return this.#tera.setProjectLibrary(this.id, refs);
|
|
196
215
|
}
|
|
197
216
|
|
|
198
217
|
|
|
@@ -209,6 +228,7 @@ export default class ProjectFile {
|
|
|
209
228
|
'name',
|
|
210
229
|
'icon',
|
|
211
230
|
'path',
|
|
231
|
+
'url',
|
|
212
232
|
'parsedName',
|
|
213
233
|
'created',
|
|
214
234
|
'modified',
|
|
@@ -234,6 +254,7 @@ export default class ProjectFile {
|
|
|
234
254
|
'name',
|
|
235
255
|
'icon',
|
|
236
256
|
'path',
|
|
257
|
+
'url',
|
|
237
258
|
'parsedName',
|
|
238
259
|
'created',
|
|
239
260
|
'modified',
|