@iebh/tera-fy 2.3.13 → 2.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  var jo=Object.defineProperty;var Ao=(t,e,r)=>e in t?jo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var l=(t,e,r)=>Ao(t,typeof e!="symbol"?e+"":e,r);var Io=typeof global=="object"&&global&&global.Object===Object&&global,ut=Io;var _o=typeof self=="object"&&self&&self.Object===Object&&self,Eo=ut||_o||Function("return this")(),c=Eo;var Co=c.Symbol,v=Co;var re=Object.prototype,Fo=re.hasOwnProperty,No=re.toString,nt=v?v.toStringTag:void 0;function Mo(t){var e=Fo.call(t,nt),r=t[nt];try{t[nt]=void 0;var o=!0}catch{}var a=No.call(t);return o&&(e?t[nt]=r:delete t[nt]),a}var oe=Mo;var Ro=Object.prototype,Lo=Ro.toString;function Bo(t){return Lo.call(t)}var ae=Bo;var Do="[object Null]",ko="[object Undefined]",ie=v?v.toStringTag:void 0;function Uo(t){return t==null?t===void 0?ko:Do:ie&&ie in Object(t)?oe(t):ae(t)}var P=Uo;function Go(t){return t!=null&&typeof t=="object"}var w=Go;var zo="[object Symbol]";function Ko(t){return typeof t=="symbol"||w(t)&&P(t)==zo}var z=Ko;function Wo(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 dt=Wo;var Yo=Array.isArray,g=Yo;var $o=1/0,se=v?v.prototype:void 0,ne=se?se.toString:void 0;function fe(t){if(typeof t=="string")return t;if(g(t))return dt(t,fe)+"";if(z(t))return ne?ne.call(t):"";var e=t+"";return e=="0"&&1/t==-$o?"-0":e}var pe=fe;function Ho(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var O=Ho;function Vo(t){return t}var le=Vo;var qo="[object AsyncFunction]",Jo="[object Function]",Zo="[object GeneratorFunction]",Xo="[object Proxy]";function Qo(t){if(!O(t))return!1;var e=P(t);return e==Jo||e==Zo||e==qo||e==Xo}var ct=Qo;var ta=c["__core-js_shared__"],ht=ta;var me=(function(){var t=/[^.]+$/.exec(ht&&ht.keys&&ht.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function ea(t){return!!me&&me in t}var ue=ea;var ra=Function.prototype,oa=ra.toString;function aa(t){if(t!=null){try{return oa.call(t)}catch{}try{return t+""}catch{}}return""}var E=aa;var ia=/[\\^$.*+?()[\]{}|]/g,sa=/^\[object .+?Constructor\]$/,na=Function.prototype,fa=Object.prototype,pa=na.toString,la=fa.hasOwnProperty,ma=RegExp("^"+pa.call(la).replace(ia,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ua(t){if(!O(t)||ue(t))return!1;var e=ct(t)?ma:sa;return e.test(E(t))}var de=ua;function da(t,e){return t==null?void 0:t[e]}var ce=da;function ca(t,e){var r=ce(t,e);return de(r)?r:void 0}var T=ca;var ha=T(c,"WeakMap"),xt=ha;var he=Object.create,xa=(function(){function t(){}return function(e){if(!O(e))return{};if(he)return he(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}})(),xe=xa;function ga(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 ge=ga;function ba(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var be=ba;var ya=800,va=16,wa=Date.now;function Ta(t){var e=0,r=0;return function(){var o=wa(),a=va-(o-r);if(r=o,a>0){if(++e>=ya)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var ye=Ta;function Pa(t){return function(){return t}}var ve=Pa;var Oa=(function(){try{var t=T(Object,"defineProperty");return t({},"",{}),t}catch{}})(),K=Oa;var Sa=K?function(t,e){return K(t,"toString",{configurable:!0,enumerable:!1,value:ve(e),writable:!0})}:le,we=Sa;var ja=ye(we),Te=ja;function Aa(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var Pe=Aa;var Ia=9007199254740991,_a=/^(?:0|[1-9]\d*)$/;function Ea(t,e){var r=typeof t;return e=e==null?Ia:e,!!e&&(r=="number"||r!="symbol"&&_a.test(t))&&t>-1&&t%1==0&&t<e}var W=Ea;function Ca(t,e,r){e=="__proto__"&&K?K(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var gt=Ca;function Fa(t,e){return t===e||t!==t&&e!==e}var bt=Fa;var Na=Object.prototype,Ma=Na.hasOwnProperty;function Ra(t,e,r){var o=t[e];(!(Ma.call(t,e)&&bt(o,r))||r===void 0&&!(e in t))&&gt(t,e,r)}var Y=Ra;function La(t,e,r,o){var a=!r;r||(r={});for(var s=-1,i=e.length;++s<i;){var n=e[s],f=o?o(r[n],t[n],n,r,t):void 0;f===void 0&&(f=t[n]),a?gt(r,n,f):Y(r,n,f)}return r}var _=La;var Oe=Math.max;function Ba(t,e,r){return e=Oe(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=Oe(o.length-e,0),i=Array(s);++a<s;)i[a]=o[e+a];a=-1;for(var n=Array(e+1);++a<e;)n[a]=o[a];return n[e]=r(i),ge(t,this,n)}}var Se=Ba;var Da=9007199254740991;function ka(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Da}var $=ka;function Ua(t){return t!=null&&$(t.length)&&!ct(t)}var yt=Ua;var Ga=Object.prototype;function za(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Ga;return t===r}var H=za;function Ka(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var je=Ka;var Wa="[object Arguments]";function Ya(t){return w(t)&&P(t)==Wa}var Ut=Ya;var Ae=Object.prototype,$a=Ae.hasOwnProperty,Ha=Ae.propertyIsEnumerable,Va=Ut((function(){return arguments})())?Ut:function(t){return w(t)&&$a.call(t,"callee")&&!Ha.call(t,"callee")},V=Va;function qa(){return!1}var Ie=qa;var Ce=typeof exports=="object"&&exports&&!exports.nodeType&&exports,_e=Ce&&typeof module=="object"&&module&&!module.nodeType&&module,Ja=_e&&_e.exports===Ce,Ee=Ja?c.Buffer:void 0,Za=Ee?Ee.isBuffer:void 0,Xa=Za||Ie,vt=Xa;var Qa="[object Arguments]",ti="[object Array]",ei="[object Boolean]",ri="[object Date]",oi="[object Error]",ai="[object Function]",ii="[object Map]",si="[object Number]",ni="[object Object]",fi="[object RegExp]",pi="[object Set]",li="[object String]",mi="[object WeakMap]",ui="[object ArrayBuffer]",di="[object DataView]",ci="[object Float32Array]",hi="[object Float64Array]",xi="[object Int8Array]",gi="[object Int16Array]",bi="[object Int32Array]",yi="[object Uint8Array]",vi="[object Uint8ClampedArray]",wi="[object Uint16Array]",Ti="[object Uint32Array]",u={};u[ci]=u[hi]=u[xi]=u[gi]=u[bi]=u[yi]=u[vi]=u[wi]=u[Ti]=!0;u[Qa]=u[ti]=u[ui]=u[ei]=u[di]=u[ri]=u[oi]=u[ai]=u[ii]=u[si]=u[ni]=u[fi]=u[pi]=u[li]=u[mi]=!1;function Pi(t){return w(t)&&$(t.length)&&!!u[P(t)]}var Fe=Pi;function Oi(t){return function(e){return t(e)}}var q=Oi;var Ne=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ft=Ne&&typeof module=="object"&&module&&!module.nodeType&&module,Si=ft&&ft.exports===Ne,Gt=Si&&ut.process,ji=(function(){try{var t=ft&&ft.require&&ft.require("util").types;return t||Gt&&Gt.binding&&Gt.binding("util")}catch{}})(),C=ji;var Me=C&&C.isTypedArray,Ai=Me?q(Me):Fe,Re=Ai;var Ii=Object.prototype,_i=Ii.hasOwnProperty;function Ei(t,e){var r=g(t),o=!r&&V(t),a=!r&&!o&&vt(t),s=!r&&!o&&!a&&Re(t),i=r||o||a||s,n=i?je(t.length,String):[],f=n.length;for(var p in t)(e||_i.call(t,p))&&!(i&&(p=="length"||a&&(p=="offset"||p=="parent")||s&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||W(p,f)))&&n.push(p);return n}var wt=Ei;function Ci(t,e){return function(r){return t(e(r))}}var Tt=Ci;var Fi=Tt(Object.keys,Object),Le=Fi;var Ni=Object.prototype,Mi=Ni.hasOwnProperty;function Ri(t){if(!H(t))return Le(t);var e=[];for(var r in Object(t))Mi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Be=Ri;function Li(t){return yt(t)?wt(t):Be(t)}var J=Li;function Bi(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var De=Bi;var Di=Object.prototype,ki=Di.hasOwnProperty;function Ui(t){if(!O(t))return De(t);var e=H(t),r=[];for(var o in t)o=="constructor"&&(e||!ki.call(t,o))||r.push(o);return r}var ke=Ui;function Gi(t){return yt(t)?wt(t,!0):ke(t)}var Z=Gi;var zi=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ki=/^\w*$/;function Wi(t,e){if(g(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||z(t)?!0:Ki.test(t)||!zi.test(t)||e!=null&&t in Object(e)}var Ue=Wi;var Yi=T(Object,"create"),F=Yi;function $i(){this.__data__=F?F(null):{},this.size=0}var Ge=$i;function Hi(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var ze=Hi;var Vi="__lodash_hash_undefined__",qi=Object.prototype,Ji=qi.hasOwnProperty;function Zi(t){var e=this.__data__;if(F){var r=e[t];return r===Vi?void 0:r}return Ji.call(e,t)?e[t]:void 0}var Ke=Zi;var Xi=Object.prototype,Qi=Xi.hasOwnProperty;function ts(t){var e=this.__data__;return F?e[t]!==void 0:Qi.call(e,t)}var We=ts;var es="__lodash_hash_undefined__";function rs(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=F&&e===void 0?es:e,this}var Ye=rs;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=Ge;X.prototype.delete=ze;X.prototype.get=Ke;X.prototype.has=We;X.prototype.set=Ye;var zt=X;function os(){this.__data__=[],this.size=0}var $e=os;function as(t,e){for(var r=t.length;r--;)if(bt(t[r][0],e))return r;return-1}var L=as;var is=Array.prototype,ss=is.splice;function ns(t){var e=this.__data__,r=L(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():ss.call(e,r,1),--this.size,!0}var He=ns;function fs(t){var e=this.__data__,r=L(e,t);return r<0?void 0:e[r][1]}var Ve=fs;function ps(t){return L(this.__data__,t)>-1}var qe=ps;function ls(t,e){var r=this.__data__,o=L(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Je=ls;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=He;Q.prototype.get=Ve;Q.prototype.has=qe;Q.prototype.set=Je;var B=Q;var ms=T(c,"Map"),D=ms;function us(){this.size=0,this.__data__={hash:new zt,map:new(D||B),string:new zt}}var Ze=us;function ds(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Xe=ds;function cs(t,e){var r=t.__data__;return Xe(e)?r[typeof e=="string"?"string":"hash"]:r.map}var k=cs;function hs(t){var e=k(this,t).delete(t);return this.size-=e?1:0,e}var Qe=hs;function xs(t){return k(this,t).get(t)}var tr=xs;function gs(t){return k(this,t).has(t)}var er=gs;function bs(t,e){var r=k(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var rr=bs;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=Ze;tt.prototype.delete=Qe;tt.prototype.get=tr;tt.prototype.has=er;tt.prototype.set=rr;var pt=tt;var ys="Expected a function";function Kt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(ys);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 i=t.apply(this,o);return r.cache=s.set(a,i)||s,i};return r.cache=new(Kt.Cache||pt),r}Kt.Cache=pt;var or=Kt;var vs=500;function ws(t){var e=or(t,function(o){return r.size===vs&&r.clear(),o}),r=e.cache;return e}var ar=ws;var Ts=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ps=/\\(\\)?/g,Os=ar(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Ts,function(r,o,a,s){e.push(a?s.replace(Ps,"$1"):o||r)}),e}),ir=Os;function Ss(t){return t==null?"":pe(t)}var sr=Ss;function js(t,e){return g(t)?t:Ue(t,e)?[t]:ir(sr(t))}var S=js;var As=1/0;function Is(t){if(typeof t=="string"||z(t))return t;var e=t+"";return e=="0"&&1/t==-As?"-0":e}var N=Is;function _s(t,e){e=S(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[N(e[r++])];return r&&r==o?t:void 0}var Pt=_s;function Es(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var et=Es;var nr=v?v.isConcatSpreadable:void 0;function Cs(t){return g(t)||V(t)||!!(nr&&t&&t[nr])}var fr=Cs;function pr(t,e,r,o,a){var s=-1,i=t.length;for(r||(r=fr),a||(a=[]);++s<i;){var n=t[s];e>0&&r(n)?e>1?pr(n,e-1,r,o,a):et(a,n):o||(a[a.length]=n)}return a}var lr=pr;function Fs(t){var e=t==null?0:t.length;return e?lr(t,1):[]}var mr=Fs;function Ns(t){return Te(Se(t,void 0,mr),t+"")}var Ot=Ns;var Ms=Tt(Object.getPrototypeOf,Object),rt=Ms;var Rs="[object Object]",Ls=Function.prototype,Bs=Object.prototype,ur=Ls.toString,Ds=Bs.hasOwnProperty,ks=ur.call(Object);function Us(t){if(!w(t)||P(t)!=Rs)return!1;var e=rt(t);if(e===null)return!0;var r=Ds.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&ur.call(r)==ks}var dr=Us;function Gs(t,e,r){var o=-1,a=t.length;e<0&&(e=-e>a?0:a+e),r=r>a?a:r,r<0&&(r+=a),a=e>r?0:r-e>>>0,e>>>=0;for(var s=Array(a);++o<a;)s[o]=t[o+e];return s}var cr=Gs;function zs(){this.__data__=new B,this.size=0}var hr=zs;function Ks(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var xr=Ks;function Ws(t){return this.__data__.get(t)}var gr=Ws;function Ys(t){return this.__data__.has(t)}var br=Ys;var $s=200;function Hs(t,e){var r=this.__data__;if(r instanceof B){var o=r.__data__;if(!D||o.length<$s-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new pt(o)}return r.set(t,e),this.size=r.size,this}var yr=Hs;function ot(t){var e=this.__data__=new B(t);this.size=e.size}ot.prototype.clear=hr;ot.prototype.delete=xr;ot.prototype.get=gr;ot.prototype.has=br;ot.prototype.set=yr;var vr=ot;function Vs(t,e){return t&&_(e,J(e),t)}var wr=Vs;function qs(t,e){return t&&_(e,Z(e),t)}var Tr=qs;var jr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pr=jr&&typeof module=="object"&&module&&!module.nodeType&&module,Js=Pr&&Pr.exports===jr,Or=Js?c.Buffer:void 0,Sr=Or?Or.allocUnsafe:void 0;function Zs(t,e){if(e)return t.slice();var r=t.length,o=Sr?Sr(r):new t.constructor(r);return t.copy(o),o}var Ar=Zs;function Xs(t,e){for(var r=-1,o=t==null?0:t.length,a=0,s=[];++r<o;){var i=t[r];e(i,r,t)&&(s[a++]=i)}return s}var Ir=Xs;function Qs(){return[]}var St=Qs;var tn=Object.prototype,en=tn.propertyIsEnumerable,_r=Object.getOwnPropertySymbols,rn=_r?function(t){return t==null?[]:(t=Object(t),Ir(_r(t),function(e){return en.call(t,e)}))}:St,at=rn;function on(t,e){return _(t,at(t),e)}var Er=on;var an=Object.getOwnPropertySymbols,sn=an?function(t){for(var e=[];t;)et(e,at(t)),t=rt(t);return e}:St,jt=sn;function nn(t,e){return _(t,jt(t),e)}var Cr=nn;function fn(t,e,r){var o=e(t);return g(t)?o:et(o,r(t))}var At=fn;function pn(t){return At(t,J,at)}var Fr=pn;function ln(t){return At(t,Z,jt)}var It=ln;var mn=T(c,"DataView"),_t=mn;var un=T(c,"Promise"),Et=un;var dn=T(c,"Set"),Ct=dn;var Nr="[object Map]",cn="[object Object]",Mr="[object Promise]",Rr="[object Set]",Lr="[object WeakMap]",Br="[object DataView]",hn=E(_t),xn=E(D),gn=E(Et),bn=E(Ct),yn=E(xt),U=P;(_t&&U(new _t(new ArrayBuffer(1)))!=Br||D&&U(new D)!=Nr||Et&&U(Et.resolve())!=Mr||Ct&&U(new Ct)!=Rr||xt&&U(new xt)!=Lr)&&(U=function(t){var e=P(t),r=e==cn?t.constructor:void 0,o=r?E(r):"";if(o)switch(o){case hn:return Br;case xn:return Nr;case gn:return Mr;case bn:return Rr;case yn:return Lr}return e});var it=U;var vn=Object.prototype,wn=vn.hasOwnProperty;function Tn(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&wn.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Dr=Tn;var Pn=c.Uint8Array,Wt=Pn;function On(t){var e=new t.constructor(t.byteLength);return new Wt(e).set(new Wt(t)),e}var st=On;function Sn(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var kr=Sn;var jn=/\w*$/;function An(t){var e=new t.constructor(t.source,jn.exec(t));return e.lastIndex=t.lastIndex,e}var Ur=An;var Gr=v?v.prototype:void 0,zr=Gr?Gr.valueOf:void 0;function In(t){return zr?Object(zr.call(t)):{}}var Kr=In;function _n(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Wr=_n;var En="[object Boolean]",Cn="[object Date]",Fn="[object Map]",Nn="[object Number]",Mn="[object RegExp]",Rn="[object Set]",Ln="[object String]",Bn="[object Symbol]",Dn="[object ArrayBuffer]",kn="[object DataView]",Un="[object Float32Array]",Gn="[object Float64Array]",zn="[object Int8Array]",Kn="[object Int16Array]",Wn="[object Int32Array]",Yn="[object Uint8Array]",$n="[object Uint8ClampedArray]",Hn="[object Uint16Array]",Vn="[object Uint32Array]";function qn(t,e,r){var o=t.constructor;switch(e){case Dn:return st(t);case En:case Cn:return new o(+t);case kn:return kr(t,r);case Un:case Gn:case zn:case Kn:case Wn:case Yn:case $n:case Hn:case Vn:return Wr(t,r);case Fn:return new o;case Nn:case Ln:return new o(t);case Mn:return Ur(t);case Rn:return new o;case Bn:return Kr(t)}}var Yr=qn;function Jn(t){return typeof t.constructor=="function"&&!H(t)?xe(rt(t)):{}}var $r=Jn;var Zn="[object Map]";function Xn(t){return w(t)&&it(t)==Zn}var Hr=Xn;var Vr=C&&C.isMap,Qn=Vr?q(Vr):Hr,qr=Qn;var tf="[object Set]";function ef(t){return w(t)&&it(t)==tf}var Jr=ef;var Zr=C&&C.isSet,rf=Zr?q(Zr):Jr,Xr=rf;var of=1,af=2,sf=4,Qr="[object Arguments]",nf="[object Array]",ff="[object Boolean]",pf="[object Date]",lf="[object Error]",to="[object Function]",mf="[object GeneratorFunction]",uf="[object Map]",df="[object Number]",eo="[object Object]",cf="[object RegExp]",hf="[object Set]",xf="[object String]",gf="[object Symbol]",bf="[object WeakMap]",yf="[object ArrayBuffer]",vf="[object DataView]",wf="[object Float32Array]",Tf="[object Float64Array]",Pf="[object Int8Array]",Of="[object Int16Array]",Sf="[object Int32Array]",jf="[object Uint8Array]",Af="[object Uint8ClampedArray]",If="[object Uint16Array]",_f="[object Uint32Array]",m={};m[Qr]=m[nf]=m[yf]=m[vf]=m[ff]=m[pf]=m[wf]=m[Tf]=m[Pf]=m[Of]=m[Sf]=m[uf]=m[df]=m[eo]=m[cf]=m[hf]=m[xf]=m[gf]=m[jf]=m[Af]=m[If]=m[_f]=!0;m[lf]=m[to]=m[bf]=!1;function Ft(t,e,r,o,a,s){var i,n=e&of,f=e&af,p=e&sf;if(r&&(i=a?r(t,o,a,s):r(t)),i!==void 0)return i;if(!O(t))return t;var x=g(t);if(x){if(i=Dr(t),!n)return be(t,i)}else{var h=it(t),j=h==to||h==mf;if(vt(t))return Ar(t,n);if(h==eo||h==Qr||j&&!a){if(i=f||j?{}:$r(t),!n)return f?Cr(t,Tr(i,t)):Er(t,wr(i,t))}else{if(!m[h])return a?t:{};i=Yr(t,h,n)}}s||(s=new vr);var b=s.get(t);if(b)return b;s.set(t,i),Xr(t)?t.forEach(function(A){i.add(Ft(A,e,r,A,t,s))}):qr(t)&&t.forEach(function(A,d){i.set(d,Ft(A,e,r,d,t,s))});var y=p?f?It:Fr:f?Z:J,R=x?void 0:y(t);return Pe(R||t,function(A,d){R&&(d=A,A=t[d]),Y(i,d,Ft(A,e,r,d,t,s))}),i}var Nt=Ft;var Ef=1,Cf=4;function Ff(t){return Nt(t,Ef|Cf)}var Yt=Ff;function Nf(t,e){return t!=null&&e in Object(t)}var ro=Nf;function Mf(t,e,r){e=S(e,t);for(var o=-1,a=e.length,s=!1;++o<a;){var i=N(e[o]);if(!(s=t!=null&&r(t,i)))break;t=t[i]}return s||++o!=a?s:(a=t==null?0:t.length,!!a&&$(a)&&W(i,a)&&(g(t)||V(t)))}var oo=Mf;function Rf(t,e){return t!=null&&oo(t,e,ro)}var ao=Rf;function Lf(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var io=Lf;function Bf(t,e){return e.length<2?t:Pt(t,cr(e,0,-1))}var so=Bf;var Df=Object.prototype,kf=Df.hasOwnProperty;function Uf(t,e){e=S(e,t);var r=-1,o=e.length;if(!o)return!0;for(;++r<o;){var a=N(e[r]);if(a==="__proto__"&&!kf.call(t,"__proto__")||(a==="constructor"||a==="prototype")&&r<o-1)return!1}var s=so(t,e);return s==null||delete s[N(io(e))]}var no=Uf;function Gf(t){return dr(t)?void 0:t}var fo=Gf;var zf=1,Kf=2,Wf=4,Yf=Ot(function(t,e){var r={};if(t==null)return r;var o=!1;e=dt(e,function(s){return s=S(s,t),o||(o=s.length>1),s}),_(t,It(t),r),o&&(r=Nt(r,zf|Kf|Wf,fo));for(var a=e.length;a--;)no(r,e[a]);return r}),$t=Yf;function $f(t,e,r,o){if(!O(t))return t;e=S(e,t);for(var a=-1,s=e.length,i=s-1,n=t;n!=null&&++a<s;){var f=N(e[a]),p=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return t;if(a!=i){var x=n[f];p=o?o(x,f,n):void 0,p===void 0&&(p=O(x)?x:W(e[a+1])?[]:{})}Y(n,f,p),n=n[f]}return t}var po=$f;function Hf(t,e,r){for(var o=-1,a=e.length,s={};++o<a;){var i=e[o],n=Pt(t,i);r(n,i)&&po(s,S(i,t),n)}return s}var lo=Hf;function Vf(t,e){return lo(t,e,function(r,o){return ao(t,o)})}var mo=Vf;var qf=Ot(function(t,e){return t==null?{}:mo(t,e)}),Mt=qf;function uo(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 co="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Ht=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=co[r[t]&63];return e};var ho="Invalid number",Jf="Invalid rounding method";var Rt="jedec";var Zf="bits",go="byte",Xf="bytes",Qf="kbit";var bo="array",tp="function",yo="object",ep="string",vo="exponent",rp="round";var lt={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"]}},op=[1,1024,1048576,1073741824,1099511627776,0x4000000000000,1152921504606847e3,11805916207174113e5,12089258196146292e8],ap=[1,1e3,1e6,1e9,1e12,1e15,1e18,1e21,1e24],ip=Math.log(1024),sp=Math.log(1e3),xo={si:{isDecimal:!0,ceil:1e3,actualStandard:Rt},iec:{isDecimal:!1,ceil:1024,actualStandard:"iec"},[Rt]:{isDecimal:!1,ceil:1024,actualStandard:Rt}};function np(t,e){return xo[t]?xo[t]:e===2?{isDecimal:!1,ceil:1024,actualStandard:"iec"}:{isDecimal:!0,ceil:1e3,actualStandard:Rt}}function fp(t,e,r,o,a,s,i,n,f){let p;return t>0?p=0 .toPrecision(t):p=0,i===vo?0:(f||(f=r?lt.symbol[e].bits[0]:lt.symbol[e].bytes[0]),o[f]&&(f=o[f]),a&&(s[0]?f=s[0]:(f=lt.fullform[e][0],r?f+="bit":f+=go)),i===bo?[p,f]:i===yo?{value:p,symbol:f,exponent:0,unit:f}:p+n+f)}function wo(t,e,r,o,a,s=!0){let i;r?i=ap[e]:i=op[e];let n=t/i;return o&&(n*=8,s&&n>=a&&e<8&&(n/=a,e++)),{result:n,e}}function pp(t,e,r,o,a,s,i,n,f,p){typeof t=="string"&&(t=parseFloat(t));let x=t.toPrecision(e),h=p===-1||isNaN(p);if(x.includes("e")&&r<8&&h){r++;let{result:j}=wo(o,r,a,s,i),b;f>0?b=Math.pow(10,f):b=1;let y;b===1?y=n(j):y=n(j*b)/b,x=y.toPrecision(e)}return{value:x,e:r}}function lp(t,e,r,o,a,s){let i=t;if(e===!0?i=i.toLocaleString():e.length>0?i=i.toLocaleString(e,r):o.length>0&&(i=i.toString().replace(".",o)),a&&s>0){let n=i.toString(),f=o||(n.slice(1).match(/[.,]/g)||[]).pop()||".",p=n.split(f),x=p[1]||"",h=x.length,j=s-h;i=`${p[0]}${f}${x.padEnd(h+j,"0")}`}return i}function mp(t,e,r,o,a){return(e===-1||isNaN(e))&&(o?e=Math.floor(Math.log(t)/sp):e=Math.floor(Math.log(t)/ip),e<0&&(e=0)),e>8?(a>0&&(a+=8-e),{e:8,precision:a}):{e,precision:a}}function up(t,e,r,o,a,s){let i;r>0&&o>0?i=Math.pow(10,o):i=1;let n;return i===1?n=a(t):n=a(t*i)/i,n===e&&r<8&&s&&(n=1,r++),{value:n,e:r}}function dp(t,e,r,o){let a=lt.symbol[t][e?Zf:Xf],s;return o&&r===1?e?s=Qf:s="kB":s=a[r],s}function cp(t,e,r,o,a,s,i,n,f,p,x,h,j){if(e&&(t[0]=-t[0]),r[t[1]]&&(t[1]=r[t[1]]),t[0]=lp(t[0],o,a,s,i,n),f){let b;j?b="bit":b=go;let y;typeof t[0]=="string"?y=parseFloat(t[0]):y=t[0];let R;y===1?R="":R="s",p[h]?t[1]=p[h]:t[1]=lt.fullform[x][h]+b+R}}function hp(t,e,r,o,a){if(o===bo)return t;if(o===yo)return{value:t[0],symbol:t[1],exponent:e,unit:r};let s;return a===" "?s=`${t[0]} ${t[1]}`:s=t.join(a),s}function To(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:s="",localeOptions:i={},separator:n="",spacer:f=" ",symbols:p={},standard:x="",output:h=ep,fullform:j=!1,fullforms:b=[],exponent:y=-1,roundingMethod:R=rp,precision:A=0}={}){let d=y,I,G=[],qt=0,Lt="";if(typeof t=="bigint")I=Number(t);else{if(I=Number(t),isNaN(t))throw new TypeError(ho);if(!isFinite(I))throw new TypeError(ho)}let{isDecimal:mt,ceil:Bt,actualStandard:Dt}=np(x,o),Jt=j===!0,Zt=I<0,kt=Math[R];if(typeof kt!==tp)throw new TypeError(Jf);if(Zt&&(I=-I),I===0)return fp(A,Dt,e,p,Jt,b,h,f);let{e:Po,precision:Xt}=mp(I,d,y,mt,A);d=Po;let Qt=y===-1||isNaN(y);if(h===vo)return d;let{result:Oo,e:So}=wo(I,d,mt,e,Bt,Qt);qt=Oo,d=So;let te=up(qt,Bt,d,a,kt,Qt);if(G[0]=te.value,d=te.e,Xt>0){let ee=pp(G[0],Xt,d,I,mt,e,Bt,kt,a,y);G[0]=ee.value,d=ee.e}return Lt=dp(Dt,e,d,mt),G[1]=Lt,cp(G,Zt,p,s,i,n,r,a,Jt,b,Dt,d,e),hp(G,d,Lt,h,f)}var M=class t{constructor(e){l(this,"_tera");l(this,"id");l(this,"sbId");l(this,"name");l(this,"icon");l(this,"path");l(this,"url");l(this,"teraUrl");l(this,"parsedName");l(this,"created");l(this,"createdFormatted");l(this,"modified");l(this,"modifiedFormatted");l(this,"accessed");l(this,"accessedFormatted");l(this,"size");l(this,"sizeFormatted");l(this,"mime");l(this,"meta",{});l(this,"isFolder");l(this,"files");var o;if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,$t(e,"encodeIdFunction")),e.encodeIdFunction&&typeof e.encodeIdFunction=="function"&&(this.id=e.encodeIdFunction(this.id));let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.created&&typeof this.created=="string"&&(this.created=new Date(this.created)),this.modified&&typeof this.modified=="string"&&(this.modified=new Date(this.modified)),this.accessed&&typeof this.accessed=="string"&&(this.accessed=new Date(this.accessed)),this.isFolder&&(this.files=(o=this.files)==null?void 0:o.map(a=>{let s=a.path.split(/\//).slice(3).join("/"),i=this.url+"/"+a.name;return a.meta.reflib&&(i=i.replace(/\/project\/download\//,"/project/library/")),new t({tera:r,...a,sbId:a.id,id:a.path,encodeIdFunction:e.encodeIdFunction,path:s,url:i})})),this.teraUrl=this.url.replace(/^https?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=To(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(e){return this._tera.getProjectFileContents(this.id,e)}setContents(e){return this._tera.setProjectFileContents(this.id,e,{})}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Mt(this,["id","sbId","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){let r=Mt(e,["tera","id","sbId","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]);return new t(r)}};var Vt=class{constructor(e){l(this,"settings",{session:null,devMode:!1,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child(e){e.siteUrl=="https://tera-tools.com/embed"&&(e.siteUrl="https://dev.tera-tools.com/embed")}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"*",frameSandbox:["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation"],handshakeInterval:1e3,handshakeTimeout:1e4,debugPaths:null});l(this,"events",uo());l(this,"dom",{el:null,iframe:null,popup:null,stylesheet:null});l(this,"methods",["handshake","setServerVerbosity","getUser","requireUser","getCredentials","getKindeToken","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getNamespace","setNamespace","listNamespaces","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateRefresh","getProjectFileContents","deleteProjectFile","setProjectFileContents","createProjectFolder","deleteProjectFolder","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiJson","uiPanic","uiProgress","uiPrompt","uiThrow","uiSplat","uiWindow"]);l(this,"plugins",[]);l(this,"namespaces",{});l(this,"acceptPostboxes",{});l(this,"initPromise",null);e&&this.set(e)}send(e){let r=Ht();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||Ht(),...Yt(e)},this.settings.mode=="parent")window.parent.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="child")this.dom.iframe.contentWindow.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="popup")this.dom.popup.postMessage(r,this.settings.restrictOrigin);else throw this.settings.mode=="detect"?new Error("Call init() or detectMode() before trying to send data to determine the mode"):new Error(`Unknown TERA communication mode "${this.settings.mode}"`)}catch(o){throw this.debug("ERROR",1,"Message compose client->server:",o),this.debug("ERROR",1,"Attempted to dispatch payload client->server",r),o}}rpc(e,...r){return this.send({action:"rpc",method:e,args:r})}acceptMessage(e){if(e.origin==window.location.origin)return Promise.resolve();let r=e.data;return!r.TERA||!r.id?Promise.resolve():(this.debug("INFO",3,"Received message",r),(r==null?void 0:r.action)=="response"&&this.acceptPostboxes[r.id]?(r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response),Promise.resolve()):(r==null?void 0:r.action)=="rpc"?Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})}):(r==null?void 0:r.action)=="event"?Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o}):r!=null&&r.id?(this.debug("INFO",3,`Ignoring message ID ${r.id} - was meant for someone else?`),Promise.resolve()):(this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r}),Promise.resolve()))}mountNamespace(e){if(!/^[\w-]+$/.test(e))throw new Error("Namespaces must be alphanumeric + hyphens + underscores");return this.namespaces[e]?Promise.resolve(this.namespaces[e]):Promise.resolve().then(()=>this._mountNamespace(e)).then(()=>this.namespaces[e]||Promise.reject(`teraFy.mountNamespace('${e}') resolved but no namespace has been mounted`))}_mountNamespace(e){throw console.warn(`teraFy._mountNamespace() for ${e} has not been overridden by a TERA-fy plugin, load one to add this functionality for your preferred framework`),new Error("teraFy._mountNamespace() is not supported")}unmountNamespace(e){return this.namespaces[e]?this._unmountNamespace(e):Promise.resolve()}_unmountNamespace(e){console.warn(`teraFy.unbindNamespace() for ${e} has not been overridden by a TERA-fy plugin, load one to add this functionality for your preferred framework`)}init(e){if(e&&this.set(e),this.initPromise)return this.initPromise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.initPromise=Promise.resolve().then(()=>{var o;return(o=this.settings).session||(o.session="tfy-"+this.getEntropicString(16))}).then(()=>this.debug("INFO",4,"[0/6] Init","Session",this.settings.session,"against",this.settings.siteUrl)).then(()=>{this.settings.devMode&&(this.settings.debugPaths?this.settings.debugPaths=this.settings.debugPaths.map(o=>Array.isArray(o)?o.join("."):typeof o=="string"?o:(()=>{throw new Error("Unknown path type - should be an array or string in dotted notation")})()):this.settings.debugPaths=null,this.debug("INFO",0,"Watching state paths",this.settings.debugPaths))}).then(()=>this.detectMode()).then(o=>{if(this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o,this.settings.modeOverrides[o])return this.debug("INFO",4,"[1/6] Applying specific config overrides for mode",o),this.settings.modeOverrides[o](this.settings)}).then(()=>this.debug("INFO",4,"[2/6] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>{if(this.settings.verbosity<=1){this.debug("INFO",4,"[3/6] Skip - Server verbosity is already at 1");return}else return this.debug("INFO",4,`[3/6] Set server verbosity to ${this.settings.verbosity}`),this.rpc("setServerVerbosity",this.settings.verbosity)}).then(()=>this.debug("INFO",4,`[4/6] Set server mode to "${this.settings.mode}"`)).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw new Error(`Unknown server mode "${this.settings.mode}"`)})())).then(()=>this.debug("INFO",4,"[5/6] Run client plugins")).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings)))).then(()=>(this.debug("INFO",4,"[6/6] Init complete"),r)).catch(o=>{throw this.debug("WARN",0,"Init process fault",o),o}),this.initPromise}detectMode(){return this.settings.mode!="detect"?Promise.resolve(this.settings.mode):window.self===window.parent?Promise.resolve(this.settings.modeFallback):Promise.resolve().then(()=>this.settings.mode="parent").then(()=>new Promise((e,r)=>{let o=setTimeout(()=>r("TIMEOUT"),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e()).catch(r)})).then(()=>"parent").catch(()=>this.settings.modeFallback)}injectComms(){switch(this.settings.mode){case"child":return Promise.resolve().then(()=>new Promise(e=>{this.debug("INFO",2,"Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this.dom.el.classList.add("minimized"),document.body.append(this.dom.el),this.dom.el.addEventListener("click",()=>this.dom.el.classList.toggle("minimized")),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("INFO",3,"Embedded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe)})).then(()=>this.handshakeLoop());case"parent":return this.debug("INFO",2,"Using TERA window parent"),Promise.resolve();case"popup":return this.debug("INFO",2,"Injecting TERA site as a popup window"),this.dom.popup=window.open(this.settings.siteUrl,"_blank","popup=1, location=0, menubar=0, status=0, scrollbars=0, width=500, height=600"),this.handshakeLoop().then(()=>this.debug("INFO",3,"Popup window accepted handshake"));default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}}handshakeLoop(e){let r={handshakeInterval:this.settings.handshakeInterval,handshakeTimeout:this.settings.handshakeTimeout,...e};return new Promise((o,a)=>{let s=0,i,n=setTimeout(()=>{clearTimeout(i),a("TIMEOUT")},r.handshakeTimeout),f=()=>{this.debug("INFO",4,"Trying handshake",++s),clearTimeout(i),i=setTimeout(f,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(n),clearTimeout(i)}).then(()=>o()).catch(a)};f()})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","body:not(.tera-fy-focus) &.minimized.dev-mode {","background: var(--TERA-accent) !important;","opacity: 0.5;","right: 0px;","bottom: 0px;","width: 30px;","height: 30px;","transition: opacity 0.2s ease-out;","cursor: pointer;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","display: flex;","justify-content: center;","align-items: center;","&::before {","margin: 2px 0 0 0;",'content: "\u{1F300}";',"color: #FFF;","}","&:hover {","opacity: 1;","}","& > iframe {","display: none;","}","}","body:not(.tera-fy-focus) &:not(.minimized) {","&::before {","display: flex;","align-items: center;","justify-content: center;","cursor: pointer;","background: var(--TERA-accent) !important;","opacity: 0.5;","transition: opacity 0.2s ease-out;","position: absolute;","right: 0px;","bottom: 0px;","width: 20px;","height: 20px;","margin: 2px 0 0 0;",'content: "\u2B68";',"color: #FFF;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","}","&:hover::before {","opacity: 1;","}","}","&.dev-mode {","display: flex;","border: 5px solid var(--TERA-accent);","background: #FFF;","}","& > iframe {","width: 100%;","height: 100%;","}","}","body.tera-fy-focus {","overflow: hidden;","& #tera-fy {","display: flex !important;","position: fixed !important;","top: 0px !important;","width: 100vw !important;","height: 100vh !important;","left: 0px !important;","z-index: 10000 !important;","}","}"].join(`
2
- `),document.head.append(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){return this.methods.forEach(e=>this[e]=this.rpc.bind(this,e)),Promise.resolve()}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r,o){let a={ignoreNullish:!0,...o};return typeof e=="string"?(!a.ignoreNullish||r!=null)&&(this.settings[e]=r):Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r,o){return!this.settings.devMode||r===void 0?this:this.set(e,r,o)}use(e,r){let o=typeof e=="function"?new e(this,r):typeof e=="object"?e:typeof e=="string"?(()=>{throw new Error("use(String) is not yet supported")})():(()=>{throw new Error("Expected use() call to be provided with a class initializer")})();return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){let o=[],a=r;do o.unshift(a);while(a=Object.getPrototypeOf(a));o.forEach(s=>Object.getOwnPropertyNames(s).filter(i=>!["constructor","init","prototype","name"].includes(i)&&!i.startsWith("__")).forEach(i=>{typeof r[i]=="function"?Object.defineProperty(e,i,{enumerable:!1,value:r[i].bind(e)}):e[i]=r[i]}))}toggleDevMode(e="toggle"){var r;return e==="toggle"?this.settings.devMode=!this.settings.devMode:e==="proxy"?Object.assign(this.settings,{devMode:!0,siteUrl:"http://localhost:7334/embed",mode:"child"}):this.settings.devMode=!!e,this.settings.devMode&&(this.settings.restrictOrigin="*"),(r=this.dom)!=null&&r.el&&this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this}toggleFocus(e="toggle"){this.debug("INFO",2,"Request focus",{isFocused:e}),globalThis.document.body.classList.toggle("tera-fy-focus",e==="toggle"?void 0:e)}getEntropicString(e=32){let r=new Uint32Array(4);return window.crypto.getRandomValues(r),btoa(String.fromCodePoint(...new Uint8Array(r.buffer))).replace(/[+/]/g,"").slice(0,e)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new M({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new M({tera:this,...o})))}getProjectFile(e,r){return this.rpc("getProjectFile",e,r).then(o=>o&&new M({tera:this,...o}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new M({tera:this,...r}))}moveProjectFile(e,r,o){return this.rpc("moveProjectFile",e,r,o).then(a=>a?new M({tera:this,...a}):null)}};export{Vt as default};
2
+ `),document.head.append(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){return this.methods.forEach(e=>this[e]=this.rpc.bind(this,e)),Promise.resolve()}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r,o){let a={ignoreNullish:!0,...o};return typeof e=="string"?(!a.ignoreNullish||r!=null)&&(this.settings[e]=r):Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r,o){return!this.settings.devMode||r===void 0?this:this.set(e,r,o)}use(e,r){let o=typeof e=="function"?new e(this,r):typeof e=="object"?e:typeof e=="string"?(()=>{throw new Error("use(String) is not yet supported")})():(()=>{throw new Error("Expected use() call to be provided with a class initializer")})();return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){let o=[],a=r;do o.unshift(a);while(a=Object.getPrototypeOf(a));o.forEach(s=>Object.getOwnPropertyNames(s).filter(i=>!["constructor","init","prototype","name","hasOwnProperty","isPrototypeOf","propertyIsEnumerable"].includes(i)&&!i.startsWith("__")).forEach(i=>{typeof r[i]=="function"?Object.defineProperty(e,i,{enumerable:!1,value:r[i].bind(e)}):e[i]=r[i]}))}toggleDevMode(e="toggle"){var r;return e==="toggle"?this.settings.devMode=!this.settings.devMode:e==="proxy"?Object.assign(this.settings,{devMode:!0,siteUrl:"http://localhost:7334/embed",mode:"child"}):this.settings.devMode=!!e,this.settings.devMode&&(this.settings.restrictOrigin="*"),(r=this.dom)!=null&&r.el&&this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this}toggleFocus(e="toggle"){this.debug("INFO",2,"Request focus",{isFocused:e}),globalThis.document.body.classList.toggle("tera-fy-focus",e==="toggle"?void 0:e)}getEntropicString(e=32){let r=new Uint32Array(4);return window.crypto.getRandomValues(r),btoa(String.fromCodePoint(...new Uint8Array(r.buffer))).replace(/[+/]/g,"").slice(0,e)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new M({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new M({tera:this,...o})))}getProjectFile(e,r){return this.rpc("getProjectFile",e,r).then(o=>o&&new M({tera:this,...o}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new M({tera:this,...r}))}moveProjectFile(e,r,o){return this.rpc("moveProjectFile",e,r,o).then(a=>a?new M({tera:this,...a}):null)}};export{Vt as default};
3
3
  /*! Bundled license information:
4
4
 
5
5
  lodash-es/lodash.js:
package/dist/terafy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  var So=typeof global=="object"&&global&&global.Object===Object&&global,mt=So;var jo=typeof self=="object"&&self&&self.Object===Object&&self,Ao=mt||jo||Function("return this")(),d=Ao;var Io=d.Symbol,y=Io;var ee=Object.prototype,_o=ee.hasOwnProperty,Eo=ee.toString,st=y?y.toStringTag:void 0;function Co(t){var e=_o.call(t,st),r=t[st];try{t[st]=void 0;var o=!0}catch{}var a=Eo.call(t);return o&&(e?t[st]=r:delete t[st]),a}var re=Co;var Fo=Object.prototype,No=Fo.toString;function Mo(t){return No.call(t)}var oe=Mo;var Ro="[object Null]",Lo="[object Undefined]",ae=y?y.toStringTag:void 0;function Bo(t){return t==null?t===void 0?Lo:Ro:ae&&ae in Object(t)?re(t):oe(t)}var T=Bo;function Do(t){return t!=null&&typeof t=="object"}var v=Do;var ko="[object Symbol]";function Uo(t){return typeof t=="symbol"||v(t)&&T(t)==ko}var G=Uo;function Go(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 ut=Go;var zo=Array.isArray,x=zo;var Ko=1/0,ie=y?y.prototype:void 0,se=ie?ie.toString:void 0;function ne(t){if(typeof t=="string")return t;if(x(t))return ut(t,ne)+"";if(G(t))return se?se.call(t):"";var e=t+"";return e=="0"&&1/t==-Ko?"-0":e}var fe=ne;function Wo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var P=Wo;function Yo(t){return t}var pe=Yo;var $o="[object AsyncFunction]",Ho="[object Function]",Vo="[object GeneratorFunction]",qo="[object Proxy]";function Jo(t){if(!P(t))return!1;var e=T(t);return e==Ho||e==Vo||e==$o||e==qo}var dt=Jo;var Zo=d["__core-js_shared__"],ct=Zo;var le=(function(){var t=/[^.]+$/.exec(ct&&ct.keys&&ct.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function Xo(t){return!!le&&le in t}var me=Xo;var Qo=Function.prototype,ta=Qo.toString;function ea(t){if(t!=null){try{return ta.call(t)}catch{}try{return t+""}catch{}}return""}var _=ea;var ra=/[\\^$.*+?()[\]{}|]/g,oa=/^\[object .+?Constructor\]$/,aa=Function.prototype,ia=Object.prototype,sa=aa.toString,na=ia.hasOwnProperty,fa=RegExp("^"+sa.call(na).replace(ra,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function pa(t){if(!P(t)||me(t))return!1;var e=dt(t)?fa:oa;return e.test(_(t))}var ue=pa;function la(t,e){return t?.[e]}var de=la;function ma(t,e){var r=de(t,e);return ue(r)?r:void 0}var w=ma;var ua=w(d,"WeakMap"),ht=ua;var ce=Object.create,da=(function(){function t(){}return function(e){if(!P(e))return{};if(ce)return ce(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}})(),he=da;function ca(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 xe=ca;function ha(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var ge=ha;var xa=800,ga=16,ba=Date.now;function ya(t){var e=0,r=0;return function(){var o=ba(),a=ga-(o-r);if(r=o,a>0){if(++e>=xa)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var be=ya;function va(t){return function(){return t}}var ye=va;var wa=(function(){try{var t=w(Object,"defineProperty");return t({},"",{}),t}catch{}})(),z=wa;var Ta=z?function(t,e){return z(t,"toString",{configurable:!0,enumerable:!1,value:ye(e),writable:!0})}:pe,ve=Ta;var Pa=be(ve),we=Pa;function Oa(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var Te=Oa;var Sa=9007199254740991,ja=/^(?:0|[1-9]\d*)$/;function Aa(t,e){var r=typeof t;return e=e??Sa,!!e&&(r=="number"||r!="symbol"&&ja.test(t))&&t>-1&&t%1==0&&t<e}var K=Aa;function Ia(t,e,r){e=="__proto__"&&z?z(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var xt=Ia;function _a(t,e){return t===e||t!==t&&e!==e}var gt=_a;var Ea=Object.prototype,Ca=Ea.hasOwnProperty;function Fa(t,e,r){var o=t[e];(!(Ca.call(t,e)&&gt(o,r))||r===void 0&&!(e in t))&&xt(t,e,r)}var W=Fa;function Na(t,e,r,o){var a=!r;r||(r={});for(var i=-1,s=e.length;++i<s;){var n=e[i],f=o?o(r[n],t[n],n,r,t):void 0;f===void 0&&(f=t[n]),a?xt(r,n,f):W(r,n,f)}return r}var I=Na;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,i=Pe(o.length-e,0),s=Array(i);++a<i;)s[a]=o[e+a];a=-1;for(var n=Array(e+1);++a<e;)n[a]=o[a];return n[e]=r(s),xe(t,this,n)}}var Oe=Ma;var Ra=9007199254740991;function La(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Ra}var Y=La;function Ba(t){return t!=null&&Y(t.length)&&!dt(t)}var bt=Ba;var Da=Object.prototype;function ka(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Da;return t===r}var $=ka;function Ua(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var Se=Ua;var Ga="[object Arguments]";function za(t){return v(t)&&T(t)==Ga}var kt=za;var je=Object.prototype,Ka=je.hasOwnProperty,Wa=je.propertyIsEnumerable,Ya=kt((function(){return arguments})())?kt:function(t){return v(t)&&Ka.call(t,"callee")&&!Wa.call(t,"callee")},H=Ya;function $a(){return!1}var Ae=$a;var Ee=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ie=Ee&&typeof module=="object"&&module&&!module.nodeType&&module,Ha=Ie&&Ie.exports===Ee,_e=Ha?d.Buffer:void 0,Va=_e?_e.isBuffer:void 0,qa=Va||Ae,yt=qa;var Ja="[object Arguments]",Za="[object Array]",Xa="[object Boolean]",Qa="[object Date]",ti="[object Error]",ei="[object Function]",ri="[object Map]",oi="[object Number]",ai="[object Object]",ii="[object RegExp]",si="[object Set]",ni="[object String]",fi="[object WeakMap]",pi="[object ArrayBuffer]",li="[object DataView]",mi="[object Float32Array]",ui="[object Float64Array]",di="[object Int8Array]",ci="[object Int16Array]",hi="[object Int32Array]",xi="[object Uint8Array]",gi="[object Uint8ClampedArray]",bi="[object Uint16Array]",yi="[object Uint32Array]",m={};m[mi]=m[ui]=m[di]=m[ci]=m[hi]=m[xi]=m[gi]=m[bi]=m[yi]=!0;m[Ja]=m[Za]=m[pi]=m[Xa]=m[li]=m[Qa]=m[ti]=m[ei]=m[ri]=m[oi]=m[ai]=m[ii]=m[si]=m[ni]=m[fi]=!1;function vi(t){return v(t)&&Y(t.length)&&!!m[T(t)]}var Ce=vi;function wi(t){return function(e){return t(e)}}var V=wi;var Fe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,nt=Fe&&typeof module=="object"&&module&&!module.nodeType&&module,Ti=nt&&nt.exports===Fe,Ut=Ti&&mt.process,Pi=(function(){try{var t=nt&&nt.require&&nt.require("util").types;return t||Ut&&Ut.binding&&Ut.binding("util")}catch{}})(),E=Pi;var Ne=E&&E.isTypedArray,Oi=Ne?V(Ne):Ce,Me=Oi;var Si=Object.prototype,ji=Si.hasOwnProperty;function Ai(t,e){var r=x(t),o=!r&&H(t),a=!r&&!o&&yt(t),i=!r&&!o&&!a&&Me(t),s=r||o||a||i,n=s?Se(t.length,String):[],f=n.length;for(var p in t)(e||ji.call(t,p))&&!(s&&(p=="length"||a&&(p=="offset"||p=="parent")||i&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||K(p,f)))&&n.push(p);return n}var vt=Ai;function Ii(t,e){return function(r){return t(e(r))}}var wt=Ii;var _i=wt(Object.keys,Object),Re=_i;var Ei=Object.prototype,Ci=Ei.hasOwnProperty;function Fi(t){if(!$(t))return Re(t);var e=[];for(var r in Object(t))Ci.call(t,r)&&r!="constructor"&&e.push(r);return e}var Le=Fi;function Ni(t){return bt(t)?vt(t):Le(t)}var q=Ni;function Mi(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Be=Mi;var Ri=Object.prototype,Li=Ri.hasOwnProperty;function Bi(t){if(!P(t))return Be(t);var e=$(t),r=[];for(var o in t)o=="constructor"&&(e||!Li.call(t,o))||r.push(o);return r}var De=Bi;function Di(t){return bt(t)?vt(t,!0):De(t)}var J=Di;var ki=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ui=/^\w*$/;function Gi(t,e){if(x(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||G(t)?!0:Ui.test(t)||!ki.test(t)||e!=null&&t in Object(e)}var ke=Gi;var zi=w(Object,"create"),C=zi;function Ki(){this.__data__=C?C(null):{},this.size=0}var Ue=Ki;function Wi(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Ge=Wi;var Yi="__lodash_hash_undefined__",$i=Object.prototype,Hi=$i.hasOwnProperty;function Vi(t){var e=this.__data__;if(C){var r=e[t];return r===Yi?void 0:r}return Hi.call(e,t)?e[t]:void 0}var ze=Vi;var qi=Object.prototype,Ji=qi.hasOwnProperty;function Zi(t){var e=this.__data__;return C?e[t]!==void 0:Ji.call(e,t)}var Ke=Zi;var Xi="__lodash_hash_undefined__";function Qi(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=C&&e===void 0?Xi:e,this}var We=Qi;function Z(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Z.prototype.clear=Ue;Z.prototype.delete=Ge;Z.prototype.get=ze;Z.prototype.has=Ke;Z.prototype.set=We;var Gt=Z;function ts(){this.__data__=[],this.size=0}var Ye=ts;function es(t,e){for(var r=t.length;r--;)if(gt(t[r][0],e))return r;return-1}var R=es;var rs=Array.prototype,os=rs.splice;function as(t){var e=this.__data__,r=R(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():os.call(e,r,1),--this.size,!0}var $e=as;function is(t){var e=this.__data__,r=R(e,t);return r<0?void 0:e[r][1]}var He=is;function ss(t){return R(this.__data__,t)>-1}var Ve=ss;function ns(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 qe=ns;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=Ye;X.prototype.delete=$e;X.prototype.get=He;X.prototype.has=Ve;X.prototype.set=qe;var L=X;var fs=w(d,"Map"),B=fs;function ps(){this.size=0,this.__data__={hash:new Gt,map:new(B||L),string:new Gt}}var Je=ps;function ls(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Ze=ls;function ms(t,e){var r=t.__data__;return Ze(e)?r[typeof e=="string"?"string":"hash"]:r.map}var D=ms;function us(t){var e=D(this,t).delete(t);return this.size-=e?1:0,e}var Xe=us;function ds(t){return D(this,t).get(t)}var Qe=ds;function cs(t){return D(this,t).has(t)}var tr=cs;function hs(t,e){var r=D(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var er=hs;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=Je;Q.prototype.delete=Xe;Q.prototype.get=Qe;Q.prototype.has=tr;Q.prototype.set=er;var ft=Q;var xs="Expected a function";function zt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(xs);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],i=r.cache;if(i.has(a))return i.get(a);var s=t.apply(this,o);return r.cache=i.set(a,s)||i,s};return r.cache=new(zt.Cache||ft),r}zt.Cache=ft;var rr=zt;var gs=500;function bs(t){var e=rr(t,function(o){return r.size===gs&&r.clear(),o}),r=e.cache;return e}var or=bs;var ys=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,vs=/\\(\\)?/g,ws=or(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(ys,function(r,o,a,i){e.push(a?i.replace(vs,"$1"):o||r)}),e}),ar=ws;function Ts(t){return t==null?"":fe(t)}var ir=Ts;function Ps(t,e){return x(t)?t:ke(t,e)?[t]:ar(ir(t))}var O=Ps;var Os=1/0;function Ss(t){if(typeof t=="string"||G(t))return t;var e=t+"";return e=="0"&&1/t==-Os?"-0":e}var F=Ss;function js(t,e){e=O(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[F(e[r++])];return r&&r==o?t:void 0}var Tt=js;function As(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var tt=As;var sr=y?y.isConcatSpreadable:void 0;function Is(t){return x(t)||H(t)||!!(sr&&t&&t[sr])}var nr=Is;function fr(t,e,r,o,a){var i=-1,s=t.length;for(r||(r=nr),a||(a=[]);++i<s;){var n=t[i];e>0&&r(n)?e>1?fr(n,e-1,r,o,a):tt(a,n):o||(a[a.length]=n)}return a}var pr=fr;function _s(t){var e=t==null?0:t.length;return e?pr(t,1):[]}var lr=_s;function Es(t){return we(Oe(t,void 0,lr),t+"")}var Pt=Es;var Cs=wt(Object.getPrototypeOf,Object),et=Cs;var Fs="[object Object]",Ns=Function.prototype,Ms=Object.prototype,mr=Ns.toString,Rs=Ms.hasOwnProperty,Ls=mr.call(Object);function Bs(t){if(!v(t)||T(t)!=Fs)return!1;var e=et(t);if(e===null)return!0;var r=Rs.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&mr.call(r)==Ls}var ur=Bs;function Ds(t,e,r){var o=-1,a=t.length;e<0&&(e=-e>a?0:a+e),r=r>a?a:r,r<0&&(r+=a),a=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(a);++o<a;)i[o]=t[o+e];return i}var dr=Ds;function ks(){this.__data__=new L,this.size=0}var cr=ks;function Us(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var hr=Us;function Gs(t){return this.__data__.get(t)}var xr=Gs;function zs(t){return this.__data__.has(t)}var gr=zs;var Ks=200;function Ws(t,e){var r=this.__data__;if(r instanceof L){var o=r.__data__;if(!B||o.length<Ks-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new ft(o)}return r.set(t,e),this.size=r.size,this}var br=Ws;function rt(t){var e=this.__data__=new L(t);this.size=e.size}rt.prototype.clear=cr;rt.prototype.delete=hr;rt.prototype.get=xr;rt.prototype.has=gr;rt.prototype.set=br;var yr=rt;function Ys(t,e){return t&&I(e,q(e),t)}var vr=Ys;function $s(t,e){return t&&I(e,J(e),t)}var wr=$s;var Sr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Tr=Sr&&typeof module=="object"&&module&&!module.nodeType&&module,Hs=Tr&&Tr.exports===Sr,Pr=Hs?d.Buffer:void 0,Or=Pr?Pr.allocUnsafe:void 0;function Vs(t,e){if(e)return t.slice();var r=t.length,o=Or?Or(r):new t.constructor(r);return t.copy(o),o}var jr=Vs;function qs(t,e){for(var r=-1,o=t==null?0:t.length,a=0,i=[];++r<o;){var s=t[r];e(s,r,t)&&(i[a++]=s)}return i}var Ar=qs;function Js(){return[]}var Ot=Js;var Zs=Object.prototype,Xs=Zs.propertyIsEnumerable,Ir=Object.getOwnPropertySymbols,Qs=Ir?function(t){return t==null?[]:(t=Object(t),Ar(Ir(t),function(e){return Xs.call(t,e)}))}:Ot,ot=Qs;function tn(t,e){return I(t,ot(t),e)}var _r=tn;var en=Object.getOwnPropertySymbols,rn=en?function(t){for(var e=[];t;)tt(e,ot(t)),t=et(t);return e}:Ot,St=rn;function on(t,e){return I(t,St(t),e)}var Er=on;function an(t,e,r){var o=e(t);return x(t)?o:tt(o,r(t))}var jt=an;function sn(t){return jt(t,q,ot)}var Cr=sn;function nn(t){return jt(t,J,St)}var At=nn;var fn=w(d,"DataView"),It=fn;var pn=w(d,"Promise"),_t=pn;var ln=w(d,"Set"),Et=ln;var Fr="[object Map]",mn="[object Object]",Nr="[object Promise]",Mr="[object Set]",Rr="[object WeakMap]",Lr="[object DataView]",un=_(It),dn=_(B),cn=_(_t),hn=_(Et),xn=_(ht),k=T;(It&&k(new It(new ArrayBuffer(1)))!=Lr||B&&k(new B)!=Fr||_t&&k(_t.resolve())!=Nr||Et&&k(new Et)!=Mr||ht&&k(new ht)!=Rr)&&(k=function(t){var e=T(t),r=e==mn?t.constructor:void 0,o=r?_(r):"";if(o)switch(o){case un:return Lr;case dn:return Fr;case cn:return Nr;case hn:return Mr;case xn:return Rr}return e});var at=k;var gn=Object.prototype,bn=gn.hasOwnProperty;function yn(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&bn.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Br=yn;var vn=d.Uint8Array,Kt=vn;function wn(t){var e=new t.constructor(t.byteLength);return new Kt(e).set(new Kt(t)),e}var it=wn;function Tn(t,e){var r=e?it(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Dr=Tn;var Pn=/\w*$/;function On(t){var e=new t.constructor(t.source,Pn.exec(t));return e.lastIndex=t.lastIndex,e}var kr=On;var Ur=y?y.prototype:void 0,Gr=Ur?Ur.valueOf:void 0;function Sn(t){return Gr?Object(Gr.call(t)):{}}var zr=Sn;function jn(t,e){var r=e?it(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Kr=jn;var An="[object Boolean]",In="[object Date]",_n="[object Map]",En="[object Number]",Cn="[object RegExp]",Fn="[object Set]",Nn="[object String]",Mn="[object Symbol]",Rn="[object ArrayBuffer]",Ln="[object DataView]",Bn="[object Float32Array]",Dn="[object Float64Array]",kn="[object Int8Array]",Un="[object Int16Array]",Gn="[object Int32Array]",zn="[object Uint8Array]",Kn="[object Uint8ClampedArray]",Wn="[object Uint16Array]",Yn="[object Uint32Array]";function $n(t,e,r){var o=t.constructor;switch(e){case Rn:return it(t);case An:case In:return new o(+t);case Ln:return Dr(t,r);case Bn:case Dn:case kn:case Un:case Gn:case zn:case Kn:case Wn:case Yn:return Kr(t,r);case _n:return new o;case En:case Nn:return new o(t);case Cn:return kr(t);case Fn:return new o;case Mn:return zr(t)}}var Wr=$n;function Hn(t){return typeof t.constructor=="function"&&!$(t)?he(et(t)):{}}var Yr=Hn;var Vn="[object Map]";function qn(t){return v(t)&&at(t)==Vn}var $r=qn;var Hr=E&&E.isMap,Jn=Hr?V(Hr):$r,Vr=Jn;var Zn="[object Set]";function Xn(t){return v(t)&&at(t)==Zn}var qr=Xn;var Jr=E&&E.isSet,Qn=Jr?V(Jr):qr,Zr=Qn;var tf=1,ef=2,rf=4,Xr="[object Arguments]",of="[object Array]",af="[object Boolean]",sf="[object Date]",nf="[object Error]",Qr="[object Function]",ff="[object GeneratorFunction]",pf="[object Map]",lf="[object Number]",to="[object Object]",mf="[object RegExp]",uf="[object Set]",df="[object String]",cf="[object Symbol]",hf="[object WeakMap]",xf="[object ArrayBuffer]",gf="[object DataView]",bf="[object Float32Array]",yf="[object Float64Array]",vf="[object Int8Array]",wf="[object Int16Array]",Tf="[object Int32Array]",Pf="[object Uint8Array]",Of="[object Uint8ClampedArray]",Sf="[object Uint16Array]",jf="[object Uint32Array]",l={};l[Xr]=l[of]=l[xf]=l[gf]=l[af]=l[sf]=l[bf]=l[yf]=l[vf]=l[wf]=l[Tf]=l[pf]=l[lf]=l[to]=l[mf]=l[uf]=l[df]=l[cf]=l[Pf]=l[Of]=l[Sf]=l[jf]=!0;l[nf]=l[Qr]=l[hf]=!1;function Ct(t,e,r,o,a,i){var s,n=e&tf,f=e&ef,p=e&rf;if(r&&(s=a?r(t,o,a,i):r(t)),s!==void 0)return s;if(!P(t))return t;var h=x(t);if(h){if(s=Br(t),!n)return ge(t,s)}else{var c=at(t),S=c==Qr||c==ff;if(yt(t))return jr(t,n);if(c==to||c==Xr||S&&!a){if(s=f||S?{}:Yr(t),!n)return f?Er(t,wr(s,t)):_r(t,vr(s,t))}else{if(!l[c])return a?t:{};s=Wr(t,c,n)}}i||(i=new yr);var g=i.get(t);if(g)return g;i.set(t,s),Zr(t)?t.forEach(function(j){s.add(Ct(j,e,r,j,t,i))}):Vr(t)&&t.forEach(function(j,u){s.set(u,Ct(j,e,r,u,t,i))});var b=p?f?At:Cr:f?J:q,M=h?void 0:b(t);return Te(M||t,function(j,u){M&&(u=j,j=t[u]),W(s,u,Ct(j,e,r,u,t,i))}),s}var Ft=Ct;var Af=1,If=4;function _f(t){return Ft(t,Af|If)}var Wt=_f;function Ef(t,e){return t!=null&&e in Object(t)}var eo=Ef;function Cf(t,e,r){e=O(e,t);for(var o=-1,a=e.length,i=!1;++o<a;){var s=F(e[o]);if(!(i=t!=null&&r(t,s)))break;t=t[s]}return i||++o!=a?i:(a=t==null?0:t.length,!!a&&Y(a)&&K(s,a)&&(x(t)||H(t)))}var ro=Cf;function Ff(t,e){return t!=null&&ro(t,e,eo)}var oo=Ff;function Nf(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var ao=Nf;function Mf(t,e){return e.length<2?t:Tt(t,dr(e,0,-1))}var io=Mf;var Rf=Object.prototype,Lf=Rf.hasOwnProperty;function Bf(t,e){e=O(e,t);var r=-1,o=e.length;if(!o)return!0;for(;++r<o;){var a=F(e[r]);if(a==="__proto__"&&!Lf.call(t,"__proto__")||(a==="constructor"||a==="prototype")&&r<o-1)return!1}var i=io(t,e);return i==null||delete i[F(ao(e))]}var so=Bf;function Df(t){return ur(t)?void 0:t}var no=Df;var kf=1,Uf=2,Gf=4,zf=Pt(function(t,e){var r={};if(t==null)return r;var o=!1;e=ut(e,function(i){return i=O(i,t),o||(o=i.length>1),i}),I(t,At(t),r),o&&(r=Ft(r,kf|Uf|Gf,no));for(var a=e.length;a--;)so(r,e[a]);return r}),Yt=zf;function Kf(t,e,r,o){if(!P(t))return t;e=O(e,t);for(var a=-1,i=e.length,s=i-1,n=t;n!=null&&++a<i;){var f=F(e[a]),p=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return t;if(a!=s){var h=n[f];p=o?o(h,f,n):void 0,p===void 0&&(p=P(h)?h:K(e[a+1])?[]:{})}W(n,f,p),n=n[f]}return t}var fo=Kf;function Wf(t,e,r){for(var o=-1,a=e.length,i={};++o<a;){var s=e[o],n=Tt(t,s);r(n,s)&&fo(i,O(s,t),n)}return i}var po=Wf;function Yf(t,e){return po(t,e,function(r,o){return oo(t,o)})}var lo=Yf;var $f=Pt(function(t,e){return t==null?{}:lo(t,e)}),Nt=$f;function mo(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 uo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var $t=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=uo[r[t]&63];return e};var co="Invalid number",Hf="Invalid rounding method";var Mt="jedec";var Vf="bits",xo="byte",qf="bytes",Jf="kbit";var go="array",Zf="function",bo="object",Xf="string",yo="exponent",Qf="round";var pt={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"]}},tp=[1,1024,1048576,1073741824,1099511627776,0x4000000000000,1152921504606847e3,11805916207174113e5,12089258196146292e8],ep=[1,1e3,1e6,1e9,1e12,1e15,1e18,1e21,1e24],rp=Math.log(1024),op=Math.log(1e3),ho={si:{isDecimal:!0,ceil:1e3,actualStandard:Mt},iec:{isDecimal:!1,ceil:1024,actualStandard:"iec"},[Mt]:{isDecimal:!1,ceil:1024,actualStandard:Mt}};function ap(t,e){return ho[t]?ho[t]:e===2?{isDecimal:!1,ceil:1024,actualStandard:"iec"}:{isDecimal:!0,ceil:1e3,actualStandard:Mt}}function ip(t,e,r,o,a,i,s,n,f){let p;return t>0?p=0 .toPrecision(t):p=0,s===yo?0:(f||(f=r?pt.symbol[e].bits[0]:pt.symbol[e].bytes[0]),o[f]&&(f=o[f]),a&&(i[0]?f=i[0]:(f=pt.fullform[e][0],r?f+="bit":f+=xo)),s===go?[p,f]:s===bo?{value:p,symbol:f,exponent:0,unit:f}:p+n+f)}function vo(t,e,r,o,a,i=!0){let s;r?s=ep[e]:s=tp[e];let n=t/s;return o&&(n*=8,i&&n>=a&&e<8&&(n/=a,e++)),{result:n,e}}function sp(t,e,r,o,a,i,s,n,f,p){typeof t=="string"&&(t=parseFloat(t));let h=t.toPrecision(e),c=p===-1||isNaN(p);if(h.includes("e")&&r<8&&c){r++;let{result:S}=vo(o,r,a,i,s),g;f>0?g=Math.pow(10,f):g=1;let b;g===1?b=n(S):b=n(S*g)/g,h=b.toPrecision(e)}return{value:h,e:r}}function np(t,e,r,o,a,i){let s=t;if(e===!0?s=s.toLocaleString():e.length>0?s=s.toLocaleString(e,r):o.length>0&&(s=s.toString().replace(".",o)),a&&i>0){let n=s.toString(),f=o||(n.slice(1).match(/[.,]/g)||[]).pop()||".",p=n.split(f),h=p[1]||"",c=h.length,S=i-c;s=`${p[0]}${f}${h.padEnd(c+S,"0")}`}return s}function fp(t,e,r,o,a){return(e===-1||isNaN(e))&&(o?e=Math.floor(Math.log(t)/op):e=Math.floor(Math.log(t)/rp),e<0&&(e=0)),e>8?(a>0&&(a+=8-e),{e:8,precision:a}):{e,precision:a}}function pp(t,e,r,o,a,i){let s;r>0&&o>0?s=Math.pow(10,o):s=1;let n;return s===1?n=a(t):n=a(t*s)/s,n===e&&r<8&&i&&(n=1,r++),{value:n,e:r}}function lp(t,e,r,o){let a=pt.symbol[t][e?Vf:qf],i;return o&&r===1?e?i=Jf:i="kB":i=a[r],i}function mp(t,e,r,o,a,i,s,n,f,p,h,c,S){if(e&&(t[0]=-t[0]),r[t[1]]&&(t[1]=r[t[1]]),t[0]=np(t[0],o,a,i,s,n),f){let g;S?g="bit":g=xo;let b;typeof t[0]=="string"?b=parseFloat(t[0]):b=t[0];let M;b===1?M="":M="s",p[c]?t[1]=p[c]:t[1]=pt.fullform[h][c]+g+M}}function up(t,e,r,o,a){if(o===go)return t;if(o===bo)return{value:t[0],symbol:t[1],exponent:e,unit:r};let i;return a===" "?i=`${t[0]} ${t[1]}`:i=t.join(a),i}function wo(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:i="",localeOptions:s={},separator:n="",spacer:f=" ",symbols:p={},standard:h="",output:c=Xf,fullform:S=!1,fullforms:g=[],exponent:b=-1,roundingMethod:M=Qf,precision:j=0}={}){let u=b,A,U=[],Vt=0,Rt="";if(typeof t=="bigint")A=Number(t);else{if(A=Number(t),isNaN(t))throw new TypeError(co);if(!isFinite(A))throw new TypeError(co)}let{isDecimal:lt,ceil:Lt,actualStandard:Bt}=ap(h,o),qt=S===!0,Jt=A<0,Dt=Math[M];if(typeof Dt!==Zf)throw new TypeError(Hf);if(Jt&&(A=-A),A===0)return ip(j,Bt,e,p,qt,g,c,f);let{e:To,precision:Zt}=fp(A,u,b,lt,j);u=To;let Xt=b===-1||isNaN(b);if(c===yo)return u;let{result:Po,e:Oo}=vo(A,u,lt,e,Lt,Xt);Vt=Po,u=Oo;let Qt=pp(Vt,Lt,u,a,Dt,Xt);if(U[0]=Qt.value,u=Qt.e,Zt>0){let te=sp(U[0],Zt,u,A,lt,e,Lt,Dt,a,b);U[0]=te.value,u=te.e}return Rt=lp(Bt,e,u,lt),U[1]=Rt,mp(U,Jt,p,i,s,n,r,a,qt,g,Bt,u,e),up(U,u,Rt,c,f)}var N=class t{_tera;id;sbId;name;icon;path;url;teraUrl;parsedName;created;createdFormatted;modified;modifiedFormatted;accessed;accessedFormatted;size;sizeFormatted;mime;meta={};isFolder;files;constructor(e){if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,Yt(e,"encodeIdFunction")),e.encodeIdFunction&&typeof e.encodeIdFunction=="function"&&(this.id=e.encodeIdFunction(this.id));let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.created&&typeof this.created=="string"&&(this.created=new Date(this.created)),this.modified&&typeof this.modified=="string"&&(this.modified=new Date(this.modified)),this.accessed&&typeof this.accessed=="string"&&(this.accessed=new Date(this.accessed)),this.isFolder&&(this.files=this.files?.map(o=>{let a=o.path.split(/\//).slice(3).join("/"),i=this.url+"/"+o.name;return o.meta.reflib&&(i=i.replace(/\/project\/download\//,"/project/library/")),new t({tera:r,...o,sbId:o.id,id:o.path,encodeIdFunction:e.encodeIdFunction,path:a,url:i})})),this.teraUrl=this.url.replace(/^https?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=wo(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(e){return this._tera.getProjectFileContents(this.id,e)}setContents(e){return this._tera.setProjectFileContents(this.id,e,{})}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Nt(this,["id","sbId","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){let r=Nt(e,["tera","id","sbId","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]);return new t(r)}};var Ht=class{settings={session:null,devMode:!1,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child(e){e.siteUrl=="https://tera-tools.com/embed"&&(e.siteUrl="https://dev.tera-tools.com/embed")}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"*",frameSandbox:["allow-forms","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts","allow-top-navigation"],handshakeInterval:1e3,handshakeTimeout:1e4,debugPaths:null};events=mo();dom={el:null,iframe:null,popup:null,stylesheet:null};methods=["handshake","setServerVerbosity","getUser","requireUser","getCredentials","getKindeToken","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getNamespace","setNamespace","listNamespaces","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateRefresh","getProjectFileContents","deleteProjectFile","setProjectFileContents","createProjectFolder","deleteProjectFolder","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiJson","uiPanic","uiProgress","uiPrompt","uiThrow","uiSplat","uiWindow"];plugins=[];namespaces={};send(e){let r=$t();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||$t(),...Wt(e)},this.settings.mode=="parent")window.parent.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="child")this.dom.iframe.contentWindow.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="popup")this.dom.popup.postMessage(r,this.settings.restrictOrigin);else throw this.settings.mode=="detect"?new Error("Call init() or detectMode() before trying to send data to determine the mode"):new Error(`Unknown TERA communication mode "${this.settings.mode}"`)}catch(o){throw this.debug("ERROR",1,"Message compose client->server:",o),this.debug("ERROR",1,"Attempted to dispatch payload client->server",r),o}}rpc(e,...r){return this.send({action:"rpc",method:e,args:r})}acceptMessage(e){if(e.origin==window.location.origin)return Promise.resolve();let r=e.data;return!r.TERA||!r.id?Promise.resolve():(this.debug("INFO",3,"Received message",r),r?.action=="response"&&this.acceptPostboxes[r.id]?(r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response),Promise.resolve()):r?.action=="rpc"?Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})}):r?.action=="event"?Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o}):r?.id?(this.debug("INFO",3,`Ignoring message ID ${r.id} - was meant for someone else?`),Promise.resolve()):(this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r}),Promise.resolve()))}acceptPostboxes={};mountNamespace(e){if(!/^[\w-]+$/.test(e))throw new Error("Namespaces must be alphanumeric + hyphens + underscores");return this.namespaces[e]?Promise.resolve(this.namespaces[e]):Promise.resolve().then(()=>this._mountNamespace(e)).then(()=>this.namespaces[e]||Promise.reject(`teraFy.mountNamespace('${e}') resolved but no namespace has been mounted`))}_mountNamespace(e){throw console.warn(`teraFy._mountNamespace() for ${e} has not been overridden by a TERA-fy plugin, load one to add this functionality for your preferred framework`),new Error("teraFy._mountNamespace() is not supported")}unmountNamespace(e){return this.namespaces[e]?this._unmountNamespace(e):Promise.resolve()}_unmountNamespace(e){console.warn(`teraFy.unbindNamespace() for ${e} has not been overridden by a TERA-fy plugin, load one to add this functionality for your preferred framework`)}constructor(e){e&&this.set(e)}initPromise=null;init(e){if(e&&this.set(e),this.initPromise)return this.initPromise;window.addEventListener("message",this.acceptMessage.bind(this));let r=this;return this.initPromise=Promise.resolve().then(()=>this.settings.session||="tfy-"+this.getEntropicString(16)).then(()=>this.debug("INFO",4,"[0/6] Init","Session",this.settings.session,"against",this.settings.siteUrl)).then(()=>{this.settings.devMode&&(this.settings.debugPaths?this.settings.debugPaths=this.settings.debugPaths.map(o=>Array.isArray(o)?o.join("."):typeof o=="string"?o:(()=>{throw new Error("Unknown path type - should be an array or string in dotted notation")})()):this.settings.debugPaths=null,this.debug("INFO",0,"Watching state paths",this.settings.debugPaths))}).then(()=>this.detectMode()).then(o=>{if(this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o,this.settings.modeOverrides[o])return this.debug("INFO",4,"[1/6] Applying specific config overrides for mode",o),this.settings.modeOverrides[o](this.settings)}).then(()=>this.debug("INFO",4,"[2/6] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>{if(this.settings.verbosity<=1){this.debug("INFO",4,"[3/6] Skip - Server verbosity is already at 1");return}else return this.debug("INFO",4,`[3/6] Set server verbosity to ${this.settings.verbosity}`),this.rpc("setServerVerbosity",this.settings.verbosity)}).then(()=>this.debug("INFO",4,`[4/6] Set server mode to "${this.settings.mode}"`)).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw new Error(`Unknown server mode "${this.settings.mode}"`)})())).then(()=>this.debug("INFO",4,"[5/6] Run client plugins")).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings)))).then(()=>(this.debug("INFO",4,"[6/6] Init complete"),r)).catch(o=>{throw this.debug("WARN",0,"Init process fault",o),o}),this.initPromise}detectMode(){return this.settings.mode!="detect"?Promise.resolve(this.settings.mode):window.self===window.parent?Promise.resolve(this.settings.modeFallback):Promise.resolve().then(()=>this.settings.mode="parent").then(()=>new Promise((e,r)=>{let o=setTimeout(()=>r("TIMEOUT"),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e()).catch(r)})).then(()=>"parent").catch(()=>this.settings.modeFallback)}injectComms(){switch(this.settings.mode){case"child":return Promise.resolve().then(()=>new Promise(e=>{this.debug("INFO",2,"Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this.dom.el.classList.add("minimized"),document.body.append(this.dom.el),this.dom.el.addEventListener("click",()=>this.dom.el.classList.toggle("minimized")),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("INFO",3,"Embedded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe)})).then(()=>this.handshakeLoop());case"parent":return this.debug("INFO",2,"Using TERA window parent"),Promise.resolve();case"popup":return this.debug("INFO",2,"Injecting TERA site as a popup window"),this.dom.popup=window.open(this.settings.siteUrl,"_blank","popup=1, location=0, menubar=0, status=0, scrollbars=0, width=500, height=600"),this.handshakeLoop().then(()=>this.debug("INFO",3,"Popup window accepted handshake"));default:throw new Error(`Unsupported mode "${this.settings.mode}" when calling injectComms()`)}}handshakeLoop(e){let r={handshakeInterval:this.settings.handshakeInterval,handshakeTimeout:this.settings.handshakeTimeout,...e};return new Promise((o,a)=>{let i=0,s,n=setTimeout(()=>{clearTimeout(s),a("TIMEOUT")},r.handshakeTimeout),f=()=>{this.debug("INFO",4,"Trying handshake",++i),clearTimeout(s),s=setTimeout(f,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(n),clearTimeout(s)}).then(()=>o()).catch(a)};f()})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","body:not(.tera-fy-focus) &.minimized.dev-mode {","background: var(--TERA-accent) !important;","opacity: 0.5;","right: 0px;","bottom: 0px;","width: 30px;","height: 30px;","transition: opacity 0.2s ease-out;","cursor: pointer;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","display: flex;","justify-content: center;","align-items: center;","&::before {","margin: 2px 0 0 0;",'content: "\u{1F300}";',"color: #FFF;","}","&:hover {","opacity: 1;","}","& > iframe {","display: none;","}","}","body:not(.tera-fy-focus) &:not(.minimized) {","&::before {","display: flex;","align-items: center;","justify-content: center;","cursor: pointer;","background: var(--TERA-accent) !important;","opacity: 0.5;","transition: opacity 0.2s ease-out;","position: absolute;","right: 0px;","bottom: 0px;","width: 20px;","height: 20px;","margin: 2px 0 0 0;",'content: "\u2B68";',"color: #FFF;","border: none;","border-top-left-radius: 30px;","border-top: 2px solid var(--TERA-accent);","border-left: 2px solid var(--TERA-accent);","}","&:hover::before {","opacity: 1;","}","}","&.dev-mode {","display: flex;","border: 5px solid var(--TERA-accent);","background: #FFF;","}","& > iframe {","width: 100%;","height: 100%;","}","}","body.tera-fy-focus {","overflow: hidden;","& #tera-fy {","display: flex !important;","position: fixed !important;","top: 0px !important;","width: 100vw !important;","height: 100vh !important;","left: 0px !important;","z-index: 10000 !important;","}","}"].join(`
2
- `),document.head.append(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){return this.methods.forEach(e=>this[e]=this.rpc.bind(this,e)),Promise.resolve()}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r,o){let a={ignoreNullish:!0,...o};return typeof e=="string"?(!a.ignoreNullish||r!=null)&&(this.settings[e]=r):Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r,o){return!this.settings.devMode||r===void 0?this:this.set(e,r,o)}use(e,r){let o=typeof e=="function"?new e(this,r):typeof e=="object"?e:typeof e=="string"?(()=>{throw new Error("use(String) is not yet supported")})():(()=>{throw new Error("Expected use() call to be provided with a class initializer")})();return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){let o=[],a=r;do o.unshift(a);while(a=Object.getPrototypeOf(a));o.forEach(i=>Object.getOwnPropertyNames(i).filter(s=>!["constructor","init","prototype","name"].includes(s)&&!s.startsWith("__")).forEach(s=>{typeof r[s]=="function"?Object.defineProperty(e,s,{enumerable:!1,value:r[s].bind(e)}):e[s]=r[s]}))}toggleDevMode(e="toggle"){return e==="toggle"?this.settings.devMode=!this.settings.devMode:e==="proxy"?Object.assign(this.settings,{devMode:!0,siteUrl:"http://localhost:7334/embed",mode:"child"}):this.settings.devMode=!!e,this.settings.devMode&&(this.settings.restrictOrigin="*"),this.dom?.el&&this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this}toggleFocus(e="toggle"){this.debug("INFO",2,"Request focus",{isFocused:e}),globalThis.document.body.classList.toggle("tera-fy-focus",e==="toggle"?void 0:e)}getEntropicString(e=32){let r=new Uint32Array(4);return window.crypto.getRandomValues(r),btoa(String.fromCodePoint(...new Uint8Array(r.buffer))).replace(/[+/]/g,"").slice(0,e)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new N({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new N({tera:this,...o})))}getProjectFile(e,r){return this.rpc("getProjectFile",e,r).then(o=>o&&new N({tera:this,...o}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new N({tera:this,...r}))}moveProjectFile(e,r,o){return this.rpc("moveProjectFile",e,r,o).then(a=>a?new N({tera:this,...a}):null)}};export{Ht as default};
2
+ `),document.head.append(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){return this.methods.forEach(e=>this[e]=this.rpc.bind(this,e)),Promise.resolve()}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r,o){let a={ignoreNullish:!0,...o};return typeof e=="string"?(!a.ignoreNullish||r!=null)&&(this.settings[e]=r):Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r,o){return!this.settings.devMode||r===void 0?this:this.set(e,r,o)}use(e,r){let o=typeof e=="function"?new e(this,r):typeof e=="object"?e:typeof e=="string"?(()=>{throw new Error("use(String) is not yet supported")})():(()=>{throw new Error("Expected use() call to be provided with a class initializer")})();return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){let o=[],a=r;do o.unshift(a);while(a=Object.getPrototypeOf(a));o.forEach(i=>Object.getOwnPropertyNames(i).filter(s=>!["constructor","init","prototype","name","hasOwnProperty","isPrototypeOf","propertyIsEnumerable"].includes(s)&&!s.startsWith("__")).forEach(s=>{typeof r[s]=="function"?Object.defineProperty(e,s,{enumerable:!1,value:r[s].bind(e)}):e[s]=r[s]}))}toggleDevMode(e="toggle"){return e==="toggle"?this.settings.devMode=!this.settings.devMode:e==="proxy"?Object.assign(this.settings,{devMode:!0,siteUrl:"http://localhost:7334/embed",mode:"child"}):this.settings.devMode=!!e,this.settings.devMode&&(this.settings.restrictOrigin="*"),this.dom?.el&&this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this}toggleFocus(e="toggle"){this.debug("INFO",2,"Request focus",{isFocused:e}),globalThis.document.body.classList.toggle("tera-fy-focus",e==="toggle"?void 0:e)}getEntropicString(e=32){let r=new Uint32Array(4);return window.crypto.getRandomValues(r),btoa(String.fromCodePoint(...new Uint8Array(r.buffer))).replace(/[+/]/g,"").slice(0,e)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new N({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new N({tera:this,...o})))}getProjectFile(e,r){return this.rpc("getProjectFile",e,r).then(o=>o&&new N({tera:this,...o}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new N({tera:this,...r}))}moveProjectFile(e,r,o){return this.rpc("moveProjectFile",e,r,o).then(a=>a?new N({tera:this,...a}):null)}};export{Ht as default};
3
3
  /*! Bundled license information:
4
4
 
5
5
  lodash-es/lodash.js:
@@ -3,8 +3,6 @@ import Mitt from 'mitt';
3
3
  import {nanoid} from 'nanoid';
4
4
  import ProjectFile from './projectFile.js';
5
5
 
6
- /* globals window */
7
-
8
6
 
9
7
  /**
10
8
  * Main Tera-Fy Client (class singleton) to be used in a frontend browser
@@ -877,7 +875,7 @@ export default class TeraFy {
877
875
  prototypeStack.forEach(stack =>
878
876
  Object.getOwnPropertyNames(stack)
879
877
  .filter(prop =>
880
- !['constructor', 'init', 'prototype', 'name'].includes(prop) // Ignore forbidden properties
878
+ !['constructor', 'init', 'prototype', 'name', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable'].includes(prop) // Ignore forbidden properties
881
879
  && !prop.startsWith('__') // Ignore double underscore meta properties
882
880
  )
883
881
  .forEach(prop => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iebh/tera-fy",
3
- "version": "2.3.13",
3
+ "version": "2.3.14",
4
4
  "description": "TERA website worker",
5
5
  "scripts": {
6
6
  "dev": "esbuild --platform=browser --format=esm --bundle lib/terafy.client.js --outfile=dist/terafy.js --minify --serve --servedir=.",
@@ -37,7 +37,6 @@ export default class TeraFyPluginFirebase extends TeraFyPluginBase {
37
37
  * @name getReactive
38
38
  * @type {Function} A reactive function as defined in Syncro
39
39
  */
40
- getReactive;
41
40
 
42
41
 
43
42
  /**