@iebh/tera-fy 1.15.2 → 1.15.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/api.md +2 -2
- package/dist/terafy.bootstrapper.es2019.js +2 -2
- package/dist/terafy.bootstrapper.js +2 -2
- package/dist/terafy.es2019.js +2 -2
- package/dist/terafy.js +2 -2
- package/lib/terafy.bootstrapper.js +1 -2
- package/lib/terafy.client.js +19 -14
- package/lib/terafy.proxy.js +2 -2
- package/lib/terafy.server.js +13 -3
- package/package.json +1 -1
- package/plugins/vue2.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.15.4](https://github.com/IEBH/TERA-fy/compare/v1.15.3...v1.15.4) (2024-12-12)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### fix
|
|
7
|
+
|
|
8
|
+
* Throw error when trying to use setProjectState() with a nullish/empty path ([6aeb6ae](https://github.com/IEBH/TERA-fy/commit/6aeb6ae00bb1ecc5ec9cf3494e2fe88495d81468))
|
|
9
|
+
|
|
10
|
+
## [1.15.3](https://github.com/IEBH/TERA-fy/compare/v1.15.2...v1.15.3) (2024-11-18)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### fix
|
|
14
|
+
|
|
15
|
+
* Moved restrictOrigin overrides into devMode toggle ([7e4ed36](https://github.com/IEBH/TERA-fy/commit/7e4ed365b446cfa97aa1726e8e940fa5e8939304))
|
|
16
|
+
* Removed useless eslint override ([7c9bbd9](https://github.com/IEBH/TERA-fy/commit/7c9bbd9a16c7868d7de1e2381e5e614ba8f80698))
|
|
17
|
+
* Various fixes to the new use() syntax ([6dbf55f](https://github.com/IEBH/TERA-fy/commit/6dbf55f6806000d9c6d55c1364de894f3aac515e))
|
|
18
|
+
* Various patches, mainly to keep eslint happy ([d9c111a](https://github.com/IEBH/TERA-fy/commit/d9c111ab372366a36006e1cf5ef53f426475678a))
|
|
19
|
+
|
|
3
20
|
## [1.15.2](https://github.com/IEBH/TERA-fy/compare/v1.15.1...v1.15.2) (2024-11-18)
|
|
4
21
|
|
|
5
22
|
|
package/api.md
CHANGED
|
@@ -348,7 +348,7 @@ Type: [Object][155]
|
|
|
348
348
|
#### Properties
|
|
349
349
|
|
|
350
350
|
* `session` **[String][154]** Unique session signature for this instance of TeraFy, used to sign server messages, if falsy `getEntropicString(16)` is used to populate
|
|
351
|
-
* `devMode` **[Boolean][163]** Operate in Dev-Mode - i.e. force outer refresh when encountering an existing TeraFy instance
|
|
351
|
+
* `devMode` **[Boolean][163]** Operate in Dev-Mode - i.e. force outer refresh when encountering an existing TeraFy instance + be more tolerent of weird iframe origins
|
|
352
352
|
* `verbosity` **[Number][157]** Verbosity level, the higher the more chatty TeraFY will be. Set to zero to disable all `debug()` call output
|
|
353
353
|
* `mode` **(`"detect"` | `"parent"` | `"child"` | `"popup"`)** How to communicate with TERA. 'parent' assumes that the parent of the current document is TERA, 'child' spawns an iFrame and uses TERA there, 'detect' tries parent and switches to `modeFallback` if communication fails
|
|
354
354
|
* `modeFallback` **[String][154]** Method to use when all method detection fails
|
|
@@ -568,7 +568,7 @@ Include a TeraFy client plugin
|
|
|
568
568
|
|
|
569
569
|
#### Parameters
|
|
570
570
|
|
|
571
|
-
* `source` **([Object][155] | [String][154])** Either the JS module
|
|
571
|
+
* `source` **([Function][164] | [Object][155] | [String][154])** Either the JS module class, singleton object or URL to fetch it from. Eventually constructed as invoked as `(teraClient:TeraFy, options:Object)`
|
|
572
572
|
* `options` **[Object][155]?** Additional options to mutate behaviour during construction (pass options to init() to intialize later options)
|
|
573
573
|
|
|
574
574
|
Returns **[TeraFy][30]** This chainable terafy instance
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var Pe=Object.defineProperty;var Ee=(t,e,r)=>e in t?Pe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Z=(t,e,r)=>Ee(t,typeof e!="symbol"?e+"":e,r);var Me=typeof global=="object"&&global&&global.Object===Object&&global,N=Me;var De=typeof self=="object"&&self&&self.Object===Object&&self,Re=N||De||Function("return this")(),d=Re;var Be=d.Symbol,_=Be;var st=Object.prototype,Le=st.hasOwnProperty,Fe=st.toString,M=_?_.toStringTag:void 0;function Ne(t){var e=Le.call(t,M),r=t[M];try{t[M]=void 0;var o=!0}catch{}var a=Fe.call(t);return o&&(e?t[M]=r:delete t[M]),a}var pt=Ne;var ze=Object.prototype,We=ze.toString;function Ue(t){return We.call(t)}var it=Ue;var Ge="[object Null]",He="[object Undefined]",nt=_?_.toStringTag:void 0;function qe(t){return t==null?t===void 0?He:Ge:nt&&nt in Object(t)?pt(t):it(t)}var h=qe;function $e(t){return t!=null&&typeof t=="object"}var x=$e;var Ke=Array.isArray,D=Ke;function Ve(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var u=Ve;function ke(t){return t}var z=ke;var Ye="[object AsyncFunction]",Je="[object Function]",Xe="[object GeneratorFunction]",Ze="[object Proxy]";function Qe(t){if(!u(t))return!1;var e=h(t);return e==Je||e==Xe||e==Ye||e==Ze}var O=Qe;var tr=d["__core-js_shared__"],W=tr;var ut=function(){var t=/[^.]+$/.exec(W&&W.keys&&W.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function er(t){return!!ut&&ut in t}var lt=er;var rr=Function.prototype,or=rr.toString;function ar(t){if(t!=null){try{return or.call(t)}catch{}try{return t+""}catch{}}return""}var mt=ar;var fr=/[\\^$.*+?()[\]{}|]/g,sr=/^\[object .+?Constructor\]$/,pr=Function.prototype,ir=Object.prototype,nr=pr.toString,ur=ir.hasOwnProperty,lr=RegExp("^"+nr.call(ur).replace(fr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function mr(t){if(!u(t)||lt(t))return!1;var e=O(t)?lr:sr;return e.test(mt(t))}var dt=mr;function dr(t,e){return t==null?void 0:t[e]}var xt=dr;function xr(t,e){var r=xt(t,e);return dt(r)?r:void 0}var T=xr;var ct=Object.create,cr=function(){function t(){}return function(e){if(!u(e))return{};if(ct)return ct(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),ht=cr;function hr(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 gt=hr;function gr(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var yt=gr;var yr=800,br=16,vr=Date.now;function _r(t){var e=0,r=0;return function(){var o=vr(),a=br-(o-r);if(r=o,a>0){if(++e>=yr)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var bt=_r;function Or(t){return function(){return t}}var vt=Or;var Tr=function(){try{var t=T(Object,"defineProperty");return t({},"",{}),t}catch{}}(),j=Tr;var jr=j?function(t,e){return j(t,"toString",{configurable:!0,enumerable:!1,value:vt(e),writable:!0})}:z,_t=jr;var wr=bt(_t),Ot=wr;var Ar=9007199254740991,Ir=/^(?:0|[1-9]\d*)$/;function Cr(t,e){var r=typeof t;return e=e==null?Ar:e,!!e&&(r=="number"||r!="symbol"&&Ir.test(t))&&t>-1&&t%1==0&&t<e}var U=Cr;function Sr(t,e,r){e=="__proto__"&&j?j(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var w=Sr;function Pr(t,e){return t===e||t!==t&&e!==e}var g=Pr;var Er=Object.prototype,Mr=Er.hasOwnProperty;function Dr(t,e,r){var o=t[e];(!(Mr.call(t,e)&&g(o,r))||r===void 0&&!(e in t))&&w(t,e,r)}var Tt=Dr;function Rr(t,e,r,o){var a=!r;r||(r={});for(var s=-1,p=e.length;++s<p;){var f=e[s],n=o?o(r[f],t[f],f,r,t):void 0;n===void 0&&(n=t[f]),a?w(r,f,n):Tt(r,f,n)}return r}var jt=Rr;var wt=Math.max;function Br(t,e,r){return e=wt(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=wt(o.length-e,0),p=Array(s);++a<s;)p[a]=o[e+a];a=-1;for(var f=Array(e+1);++a<e;)f[a]=o[a];return f[e]=r(p),gt(t,this,f)}}var At=Br;function Lr(t,e){return Ot(At(t,e,z),t+"")}var It=Lr;var Fr=9007199254740991;function Nr(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Fr}var G=Nr;function zr(t){return t!=null&&G(t.length)&&!O(t)}var A=zr;function Wr(t,e,r){if(!u(r))return!1;var o=typeof e;return(o=="number"?A(r)&&U(e,r.length):o=="string"&&e in r)?g(r[e],t):!1}var Ct=Wr;function Ur(t){return It(function(e,r){var o=-1,a=r.length,s=a>1?r[a-1]:void 0,p=a>2?r[2]:void 0;for(s=t.length>3&&typeof s=="function"?(a--,s):void 0,p&&Ct(r[0],r[1],p)&&(s=a<3?void 0:s,a=1),e=Object(e);++o<a;){var f=r[o];f&&t(e,f,o,s)}return e})}var St=Ur;var Gr=Object.prototype;function Hr(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Gr;return t===r}var H=Hr;function qr(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var Pt=qr;var $r="[object Arguments]";function Kr(t){return x(t)&&h(t)==$r}var Q=Kr;var Et=Object.prototype,Vr=Et.hasOwnProperty,kr=Et.propertyIsEnumerable,Yr=Q(function(){return arguments}())?Q:function(t){return x(t)&&Vr.call(t,"callee")&&!kr.call(t,"callee")},R=Yr;function Jr(){return!1}var Mt=Jr;var Bt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Dt=Bt&&typeof module=="object"&&module&&!module.nodeType&&module,Xr=Dt&&Dt.exports===Bt,Rt=Xr?d.Buffer:void 0,Zr=Rt?Rt.isBuffer:void 0,Qr=Zr||Mt,q=Qr;var to="[object Arguments]",eo="[object Array]",ro="[object Boolean]",oo="[object Date]",ao="[object Error]",fo="[object Function]",so="[object Map]",po="[object Number]",io="[object Object]",no="[object RegExp]",uo="[object Set]",lo="[object String]",mo="[object WeakMap]",xo="[object ArrayBuffer]",co="[object DataView]",ho="[object Float32Array]",go="[object Float64Array]",yo="[object Int8Array]",bo="[object Int16Array]",vo="[object Int32Array]",_o="[object Uint8Array]",Oo="[object Uint8ClampedArray]",To="[object Uint16Array]",jo="[object Uint32Array]",i={};i[ho]=i[go]=i[yo]=i[bo]=i[vo]=i[_o]=i[Oo]=i[To]=i[jo]=!0;i[to]=i[eo]=i[xo]=i[ro]=i[co]=i[oo]=i[ao]=i[fo]=i[so]=i[po]=i[io]=i[no]=i[uo]=i[lo]=i[mo]=!1;function wo(t){return x(t)&&G(t.length)&&!!i[h(t)]}var Lt=wo;function Ao(t){return function(e){return t(e)}}var Ft=Ao;var Nt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,B=Nt&&typeof module=="object"&&module&&!module.nodeType&&module,Io=B&&B.exports===Nt,tt=Io&&N.process,Co=function(){try{var t=B&&B.require&&B.require("util").types;return t||tt&&tt.binding&&tt.binding("util")}catch{}}(),et=Co;var zt=et&&et.isTypedArray,So=zt?Ft(zt):Lt,$=So;var Po=Object.prototype,Eo=Po.hasOwnProperty;function Mo(t,e){var r=D(t),o=!r&&R(t),a=!r&&!o&&q(t),s=!r&&!o&&!a&&$(t),p=r||o||a||s,f=p?Pt(t.length,String):[],n=f.length;for(var m in t)(e||Eo.call(t,m))&&!(p&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||U(m,n)))&&f.push(m);return f}var Wt=Mo;function Do(t,e){return function(r){return t(e(r))}}var Ut=Do;function Ro(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Gt=Ro;var Bo=Object.prototype,Lo=Bo.hasOwnProperty;function Fo(t){if(!u(t))return Gt(t);var e=H(t),r=[];for(var o in t)o=="constructor"&&(e||!Lo.call(t,o))||r.push(o);return r}var Ht=Fo;function No(t){return A(t)?Wt(t,!0):Ht(t)}var K=No;var zo=T(Object,"create"),c=zo;function Wo(){this.__data__=c?c(null):{},this.size=0}var qt=Wo;function Uo(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var $t=Uo;var Go="__lodash_hash_undefined__",Ho=Object.prototype,qo=Ho.hasOwnProperty;function $o(t){var e=this.__data__;if(c){var r=e[t];return r===Go?void 0:r}return qo.call(e,t)?e[t]:void 0}var Kt=$o;var Ko=Object.prototype,Vo=Ko.hasOwnProperty;function ko(t){var e=this.__data__;return c?e[t]!==void 0:Vo.call(e,t)}var Vt=ko;var Yo="__lodash_hash_undefined__";function Jo(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=c&&e===void 0?Yo:e,this}var kt=Jo;function I(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])}}I.prototype.clear=qt;I.prototype.delete=$t;I.prototype.get=Kt;I.prototype.has=Vt;I.prototype.set=kt;var rt=I;function Xo(){this.__data__=[],this.size=0}var Yt=Xo;function Zo(t,e){for(var r=t.length;r--;)if(g(t[r][0],e))return r;return-1}var y=Zo;var Qo=Array.prototype,ta=Qo.splice;function ea(t){var e=this.__data__,r=y(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():ta.call(e,r,1),--this.size,!0}var Jt=ea;function ra(t){var e=this.__data__,r=y(e,t);return r<0?void 0:e[r][1]}var Xt=ra;function oa(t){return y(this.__data__,t)>-1}var Zt=oa;function aa(t,e){var r=this.__data__,o=y(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Qt=aa;function C(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])}}C.prototype.clear=Yt;C.prototype.delete=Jt;C.prototype.get=Xt;C.prototype.has=Zt;C.prototype.set=Qt;var b=C;var fa=T(d,"Map"),V=fa;function sa(){this.size=0,this.__data__={hash:new rt,map:new(V||b),string:new rt}}var te=sa;function pa(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var ee=pa;function ia(t,e){var r=t.__data__;return ee(e)?r[typeof e=="string"?"string":"hash"]:r.map}var v=ia;function na(t){var e=v(this,t).delete(t);return this.size-=e?1:0,e}var re=na;function ua(t){return v(this,t).get(t)}var oe=ua;function la(t){return v(this,t).has(t)}var ae=la;function ma(t,e){var r=v(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var fe=ma;function S(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])}}S.prototype.clear=te;S.prototype.delete=re;S.prototype.get=oe;S.prototype.has=ae;S.prototype.set=fe;var se=S;var da=Ut(Object.getPrototypeOf,Object),k=da;var xa="[object Object]",ca=Function.prototype,ha=Object.prototype,pe=ca.toString,ga=ha.hasOwnProperty,ya=pe.call(Object);function ba(t){if(!x(t)||h(t)!=xa)return!1;var e=k(t);if(e===null)return!0;var r=ga.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&pe.call(r)==ya}var ie=ba;function va(){this.__data__=new b,this.size=0}var ne=va;function _a(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var ue=_a;function Oa(t){return this.__data__.get(t)}var le=Oa;function Ta(t){return this.__data__.has(t)}var me=Ta;var ja=200;function wa(t,e){var r=this.__data__;if(r instanceof b){var o=r.__data__;if(!V||o.length<ja-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new se(o)}return r.set(t,e),this.size=r.size,this}var de=wa;function P(t){var e=this.__data__=new b(t);this.size=e.size}P.prototype.clear=ne;P.prototype.delete=ue;P.prototype.get=le;P.prototype.has=me;P.prototype.set=de;var xe=P;var ye=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ce=ye&&typeof module=="object"&&module&&!module.nodeType&&module,Aa=ce&&ce.exports===ye,he=Aa?d.Buffer:void 0,ge=he?he.allocUnsafe:void 0;function Ia(t,e){if(e)return t.slice();var r=t.length,o=ge?ge(r):new t.constructor(r);return t.copy(o),o}var be=Ia;var Ca=d.Uint8Array,ot=Ca;function Sa(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}var ve=Sa;function Pa(t,e){var r=e?ve(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var _e=Pa;function Ea(t){return typeof t.constructor=="function"&&!H(t)?ht(k(t)):{}}var Oe=Ea;function Ma(t){return function(e,r,o){for(var a=-1,s=Object(e),p=o(e),f=p.length;f--;){var n=p[t?f:++a];if(r(s[n],n,s)===!1)break}return e}}var Te=Ma;var Da=Te(),je=Da;function Ra(t,e,r){(r!==void 0&&!g(t[e],r)||r===void 0&&!(e in t))&&w(t,e,r)}var L=Ra;function Ba(t){return x(t)&&A(t)}var we=Ba;function La(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var F=La;function Fa(t){return jt(t,K(t))}var Ae=Fa;function Na(t,e,r,o,a,s,p){var f=F(t,r),n=F(e,r),m=p.get(n);if(m){L(t,r,m);return}var l=s?s(f,n,r+"",t,e,p):void 0,E=l===void 0;if(E){var J=D(n),X=!J&&q(n),ft=!J&&!X&&$(n);l=n,J||X||ft?D(f)?l=f:we(f)?l=yt(f):X?(E=!1,l=be(n,!0)):ft?(E=!1,l=_e(n,!0)):l=[]:ie(n)||R(n)?(l=f,R(f)?l=Ae(f):(!u(f)||O(f))&&(l=Oe(n))):E=!1}E&&(p.set(n,l),a(l,n,o,s,p),p.delete(n)),L(t,r,l)}var Ie=Na;function Ce(t,e,r,o,a){t!==e&&je(e,function(s,p){if(a||(a=new xe),u(s))Ie(t,e,p,r,Ce,o,a);else{var f=o?o(F(t,p),s,p+"",t,e,a):void 0;f===void 0&&(f=s),L(t,p,f)}},K)}var Se=Ce;var za=St(function(t,e,r){Se(t,e,r)}),Y=za;var at=class{constructor(e){Z(this,"settings",{client:"tera-fy",clientType:"esm"});Z(this,"bootstrapperDeferredMethods",[]);e&&Y(this.settings,e),["set","setIfDev","use"].forEach(r=>{this[r]=(...o)=>(this.bootstrapperDeferredMethods.push({method:r,args:o}),this)})}init(e){let r=o=>`https://dev.tera-tools.com/api/tera-fy/${o}.js`;return Promise.resolve().then(()=>this.settings.clientType=="esm"?this.bootstrapperImport(r(this.settings.client)).then(o=>typeof o=="function"?o:Promise.reject("Tera-fy import didn't return a class")):Promise.reject(`Unsupported TERA-fy clientType "${this.settings.clientType}"`)).then(o=>{let a=new o;if(!a.mixin)throw new Error("TERA-fy client doesnt expose a mixin() method");a.mixin(this,a),Y(this.settings,a.settings,this.settings)}).then(()=>{if(console.log("IAM",this),!this.init||typeof this.init!="function")throw new Error("Newly mixed-in TERA-fy client doesnt expose a init() method");if(!this.detectMode||typeof this.detectMode!="function")throw new Error("Newly mixed-in TERA-fy client doesnt expose a detectMode() method")}).then(()=>this.bootstrapperDeferredMethods.reduce((o,a)=>a.method=="use"&&typeof a.args[0]=="string"?(console.log("TERA-FY DEFERRED-USE",a.args[0]),this.bootstrapperImport(r(a.args[0])).then(s=>typeof s=="function"?s:Promise.reject("Tera-fy plugin import didn't return a class")).then(s=>this.use(s,...a.args.slice(1)))):(console.log("TERA-FY DEFERRED-METHOD",a),this[a.method].apply(this,a.args))),Promise.resolve()).then(()=>delete this.bootstrapperDeferredMethods).then(()=>console.log("TYBS","Init")).then(()=>this.init.call(this,e))}bootstrapperImport(e){return new Promise((r,o)=>{let a=`installTFyBS${Math.random().toString(36).slice(2)}`,s=document.createElement("script");s.type="module",s.textContent=`
|
|
1
|
+
var Pe=Object.defineProperty;var Ee=(t,e,r)=>e in t?Pe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Z=(t,e,r)=>Ee(t,typeof e!="symbol"?e+"":e,r);var Me=typeof global=="object"&&global&&global.Object===Object&&global,N=Me;var De=typeof self=="object"&&self&&self.Object===Object&&self,Re=N||De||Function("return this")(),d=Re;var Be=d.Symbol,_=Be;var st=Object.prototype,Le=st.hasOwnProperty,Fe=st.toString,M=_?_.toStringTag:void 0;function Ne(t){var e=Le.call(t,M),r=t[M];try{t[M]=void 0;var o=!0}catch{}var a=Fe.call(t);return o&&(e?t[M]=r:delete t[M]),a}var pt=Ne;var ze=Object.prototype,We=ze.toString;function Ue(t){return We.call(t)}var it=Ue;var Ge="[object Null]",He="[object Undefined]",nt=_?_.toStringTag:void 0;function qe(t){return t==null?t===void 0?He:Ge:nt&&nt in Object(t)?pt(t):it(t)}var h=qe;function $e(t){return t!=null&&typeof t=="object"}var x=$e;var Ke=Array.isArray,D=Ke;function Ve(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var u=Ve;function ke(t){return t}var z=ke;var Ye="[object AsyncFunction]",Je="[object Function]",Xe="[object GeneratorFunction]",Ze="[object Proxy]";function Qe(t){if(!u(t))return!1;var e=h(t);return e==Je||e==Xe||e==Ye||e==Ze}var O=Qe;var tr=d["__core-js_shared__"],W=tr;var ut=function(){var t=/[^.]+$/.exec(W&&W.keys&&W.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function er(t){return!!ut&&ut in t}var lt=er;var rr=Function.prototype,or=rr.toString;function ar(t){if(t!=null){try{return or.call(t)}catch{}try{return t+""}catch{}}return""}var mt=ar;var fr=/[\\^$.*+?()[\]{}|]/g,sr=/^\[object .+?Constructor\]$/,pr=Function.prototype,ir=Object.prototype,nr=pr.toString,ur=ir.hasOwnProperty,lr=RegExp("^"+nr.call(ur).replace(fr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function mr(t){if(!u(t)||lt(t))return!1;var e=O(t)?lr:sr;return e.test(mt(t))}var dt=mr;function dr(t,e){return t==null?void 0:t[e]}var xt=dr;function xr(t,e){var r=xt(t,e);return dt(r)?r:void 0}var T=xr;var ct=Object.create,cr=function(){function t(){}return function(e){if(!u(e))return{};if(ct)return ct(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),ht=cr;function hr(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 gt=hr;function gr(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var yt=gr;var yr=800,br=16,vr=Date.now;function _r(t){var e=0,r=0;return function(){var o=vr(),a=br-(o-r);if(r=o,a>0){if(++e>=yr)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var bt=_r;function Or(t){return function(){return t}}var vt=Or;var Tr=function(){try{var t=T(Object,"defineProperty");return t({},"",{}),t}catch{}}(),j=Tr;var jr=j?function(t,e){return j(t,"toString",{configurable:!0,enumerable:!1,value:vt(e),writable:!0})}:z,_t=jr;var wr=bt(_t),Ot=wr;var Ar=9007199254740991,Ir=/^(?:0|[1-9]\d*)$/;function Sr(t,e){var r=typeof t;return e=e==null?Ar:e,!!e&&(r=="number"||r!="symbol"&&Ir.test(t))&&t>-1&&t%1==0&&t<e}var U=Sr;function Cr(t,e,r){e=="__proto__"&&j?j(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var w=Cr;function Pr(t,e){return t===e||t!==t&&e!==e}var g=Pr;var Er=Object.prototype,Mr=Er.hasOwnProperty;function Dr(t,e,r){var o=t[e];(!(Mr.call(t,e)&&g(o,r))||r===void 0&&!(e in t))&&w(t,e,r)}var Tt=Dr;function Rr(t,e,r,o){var a=!r;r||(r={});for(var s=-1,p=e.length;++s<p;){var f=e[s],n=o?o(r[f],t[f],f,r,t):void 0;n===void 0&&(n=t[f]),a?w(r,f,n):Tt(r,f,n)}return r}var jt=Rr;var wt=Math.max;function Br(t,e,r){return e=wt(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=wt(o.length-e,0),p=Array(s);++a<s;)p[a]=o[e+a];a=-1;for(var f=Array(e+1);++a<e;)f[a]=o[a];return f[e]=r(p),gt(t,this,f)}}var At=Br;function Lr(t,e){return Ot(At(t,e,z),t+"")}var It=Lr;var Fr=9007199254740991;function Nr(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Fr}var G=Nr;function zr(t){return t!=null&&G(t.length)&&!O(t)}var A=zr;function Wr(t,e,r){if(!u(r))return!1;var o=typeof e;return(o=="number"?A(r)&&U(e,r.length):o=="string"&&e in r)?g(r[e],t):!1}var St=Wr;function Ur(t){return It(function(e,r){var o=-1,a=r.length,s=a>1?r[a-1]:void 0,p=a>2?r[2]:void 0;for(s=t.length>3&&typeof s=="function"?(a--,s):void 0,p&&St(r[0],r[1],p)&&(s=a<3?void 0:s,a=1),e=Object(e);++o<a;){var f=r[o];f&&t(e,f,o,s)}return e})}var Ct=Ur;var Gr=Object.prototype;function Hr(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Gr;return t===r}var H=Hr;function qr(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var Pt=qr;var $r="[object Arguments]";function Kr(t){return x(t)&&h(t)==$r}var Q=Kr;var Et=Object.prototype,Vr=Et.hasOwnProperty,kr=Et.propertyIsEnumerable,Yr=Q(function(){return arguments}())?Q:function(t){return x(t)&&Vr.call(t,"callee")&&!kr.call(t,"callee")},R=Yr;function Jr(){return!1}var Mt=Jr;var Bt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Dt=Bt&&typeof module=="object"&&module&&!module.nodeType&&module,Xr=Dt&&Dt.exports===Bt,Rt=Xr?d.Buffer:void 0,Zr=Rt?Rt.isBuffer:void 0,Qr=Zr||Mt,q=Qr;var to="[object Arguments]",eo="[object Array]",ro="[object Boolean]",oo="[object Date]",ao="[object Error]",fo="[object Function]",so="[object Map]",po="[object Number]",io="[object Object]",no="[object RegExp]",uo="[object Set]",lo="[object String]",mo="[object WeakMap]",xo="[object ArrayBuffer]",co="[object DataView]",ho="[object Float32Array]",go="[object Float64Array]",yo="[object Int8Array]",bo="[object Int16Array]",vo="[object Int32Array]",_o="[object Uint8Array]",Oo="[object Uint8ClampedArray]",To="[object Uint16Array]",jo="[object Uint32Array]",i={};i[ho]=i[go]=i[yo]=i[bo]=i[vo]=i[_o]=i[Oo]=i[To]=i[jo]=!0;i[to]=i[eo]=i[xo]=i[ro]=i[co]=i[oo]=i[ao]=i[fo]=i[so]=i[po]=i[io]=i[no]=i[uo]=i[lo]=i[mo]=!1;function wo(t){return x(t)&&G(t.length)&&!!i[h(t)]}var Lt=wo;function Ao(t){return function(e){return t(e)}}var Ft=Ao;var Nt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,B=Nt&&typeof module=="object"&&module&&!module.nodeType&&module,Io=B&&B.exports===Nt,tt=Io&&N.process,So=function(){try{var t=B&&B.require&&B.require("util").types;return t||tt&&tt.binding&&tt.binding("util")}catch{}}(),et=So;var zt=et&&et.isTypedArray,Co=zt?Ft(zt):Lt,$=Co;var Po=Object.prototype,Eo=Po.hasOwnProperty;function Mo(t,e){var r=D(t),o=!r&&R(t),a=!r&&!o&&q(t),s=!r&&!o&&!a&&$(t),p=r||o||a||s,f=p?Pt(t.length,String):[],n=f.length;for(var m in t)(e||Eo.call(t,m))&&!(p&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||U(m,n)))&&f.push(m);return f}var Wt=Mo;function Do(t,e){return function(r){return t(e(r))}}var Ut=Do;function Ro(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Gt=Ro;var Bo=Object.prototype,Lo=Bo.hasOwnProperty;function Fo(t){if(!u(t))return Gt(t);var e=H(t),r=[];for(var o in t)o=="constructor"&&(e||!Lo.call(t,o))||r.push(o);return r}var Ht=Fo;function No(t){return A(t)?Wt(t,!0):Ht(t)}var K=No;var zo=T(Object,"create"),c=zo;function Wo(){this.__data__=c?c(null):{},this.size=0}var qt=Wo;function Uo(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var $t=Uo;var Go="__lodash_hash_undefined__",Ho=Object.prototype,qo=Ho.hasOwnProperty;function $o(t){var e=this.__data__;if(c){var r=e[t];return r===Go?void 0:r}return qo.call(e,t)?e[t]:void 0}var Kt=$o;var Ko=Object.prototype,Vo=Ko.hasOwnProperty;function ko(t){var e=this.__data__;return c?e[t]!==void 0:Vo.call(e,t)}var Vt=ko;var Yo="__lodash_hash_undefined__";function Jo(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=c&&e===void 0?Yo:e,this}var kt=Jo;function I(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])}}I.prototype.clear=qt;I.prototype.delete=$t;I.prototype.get=Kt;I.prototype.has=Vt;I.prototype.set=kt;var rt=I;function Xo(){this.__data__=[],this.size=0}var Yt=Xo;function Zo(t,e){for(var r=t.length;r--;)if(g(t[r][0],e))return r;return-1}var y=Zo;var Qo=Array.prototype,ta=Qo.splice;function ea(t){var e=this.__data__,r=y(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():ta.call(e,r,1),--this.size,!0}var Jt=ea;function ra(t){var e=this.__data__,r=y(e,t);return r<0?void 0:e[r][1]}var Xt=ra;function oa(t){return y(this.__data__,t)>-1}var Zt=oa;function aa(t,e){var r=this.__data__,o=y(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Qt=aa;function S(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])}}S.prototype.clear=Yt;S.prototype.delete=Jt;S.prototype.get=Xt;S.prototype.has=Zt;S.prototype.set=Qt;var b=S;var fa=T(d,"Map"),V=fa;function sa(){this.size=0,this.__data__={hash:new rt,map:new(V||b),string:new rt}}var te=sa;function pa(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var ee=pa;function ia(t,e){var r=t.__data__;return ee(e)?r[typeof e=="string"?"string":"hash"]:r.map}var v=ia;function na(t){var e=v(this,t).delete(t);return this.size-=e?1:0,e}var re=na;function ua(t){return v(this,t).get(t)}var oe=ua;function la(t){return v(this,t).has(t)}var ae=la;function ma(t,e){var r=v(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var fe=ma;function C(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])}}C.prototype.clear=te;C.prototype.delete=re;C.prototype.get=oe;C.prototype.has=ae;C.prototype.set=fe;var se=C;var da=Ut(Object.getPrototypeOf,Object),k=da;var xa="[object Object]",ca=Function.prototype,ha=Object.prototype,pe=ca.toString,ga=ha.hasOwnProperty,ya=pe.call(Object);function ba(t){if(!x(t)||h(t)!=xa)return!1;var e=k(t);if(e===null)return!0;var r=ga.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&pe.call(r)==ya}var ie=ba;function va(){this.__data__=new b,this.size=0}var ne=va;function _a(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var ue=_a;function Oa(t){return this.__data__.get(t)}var le=Oa;function Ta(t){return this.__data__.has(t)}var me=Ta;var ja=200;function wa(t,e){var r=this.__data__;if(r instanceof b){var o=r.__data__;if(!V||o.length<ja-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new se(o)}return r.set(t,e),this.size=r.size,this}var de=wa;function P(t){var e=this.__data__=new b(t);this.size=e.size}P.prototype.clear=ne;P.prototype.delete=ue;P.prototype.get=le;P.prototype.has=me;P.prototype.set=de;var xe=P;var ye=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ce=ye&&typeof module=="object"&&module&&!module.nodeType&&module,Aa=ce&&ce.exports===ye,he=Aa?d.Buffer:void 0,ge=he?he.allocUnsafe:void 0;function Ia(t,e){if(e)return t.slice();var r=t.length,o=ge?ge(r):new t.constructor(r);return t.copy(o),o}var be=Ia;var Sa=d.Uint8Array,ot=Sa;function Ca(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}var ve=Ca;function Pa(t,e){var r=e?ve(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var _e=Pa;function Ea(t){return typeof t.constructor=="function"&&!H(t)?ht(k(t)):{}}var Oe=Ea;function Ma(t){return function(e,r,o){for(var a=-1,s=Object(e),p=o(e),f=p.length;f--;){var n=p[t?f:++a];if(r(s[n],n,s)===!1)break}return e}}var Te=Ma;var Da=Te(),je=Da;function Ra(t,e,r){(r!==void 0&&!g(t[e],r)||r===void 0&&!(e in t))&&w(t,e,r)}var L=Ra;function Ba(t){return x(t)&&A(t)}var we=Ba;function La(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var F=La;function Fa(t){return jt(t,K(t))}var Ae=Fa;function Na(t,e,r,o,a,s,p){var f=F(t,r),n=F(e,r),m=p.get(n);if(m){L(t,r,m);return}var l=s?s(f,n,r+"",t,e,p):void 0,E=l===void 0;if(E){var J=D(n),X=!J&&q(n),ft=!J&&!X&&$(n);l=n,J||X||ft?D(f)?l=f:we(f)?l=yt(f):X?(E=!1,l=be(n,!0)):ft?(E=!1,l=_e(n,!0)):l=[]:ie(n)||R(n)?(l=f,R(f)?l=Ae(f):(!u(f)||O(f))&&(l=Oe(n))):E=!1}E&&(p.set(n,l),a(l,n,o,s,p),p.delete(n)),L(t,r,l)}var Ie=Na;function Se(t,e,r,o,a){t!==e&&je(e,function(s,p){if(a||(a=new xe),u(s))Ie(t,e,p,r,Se,o,a);else{var f=o?o(F(t,p),s,p+"",t,e,a):void 0;f===void 0&&(f=s),L(t,p,f)}},K)}var Ce=Se;var za=Ct(function(t,e,r){Ce(t,e,r)}),Y=za;var at=class{constructor(e){Z(this,"settings",{client:"tera-fy",clientType:"esm"});Z(this,"bootstrapperDeferredMethods",[]);e&&Y(this.settings,e),["set","setIfDev","use"].forEach(r=>{this[r]=(...o)=>(this.bootstrapperDeferredMethods.push({method:r,args:o}),this)})}init(e){let r=o=>`https://dev.tera-tools.com/api/tera-fy/${o}.js`;return Promise.resolve().then(()=>this.settings.clientType=="esm"?this.bootstrapperImport(r(this.settings.client)).then(o=>typeof o=="function"?o:Promise.reject("Tera-fy import didn't return a class")):Promise.reject(`Unsupported TERA-fy clientType "${this.settings.clientType}"`)).then(o=>{let a=new o;if(!a.mixin)throw new Error("TERA-fy client doesnt expose a mixin() method");a.mixin(this,a),Y(this.settings,a.settings,this.settings)}).then(()=>{if(console.log("IAM",this),!this.init||typeof this.init!="function")throw new Error("Newly mixed-in TERA-fy client doesnt expose a init() method");if(!this.detectMode||typeof this.detectMode!="function")throw new Error("Newly mixed-in TERA-fy client doesnt expose a detectMode() method")}).then(()=>this.bootstrapperDeferredMethods.reduce((o,a)=>a.method=="use"&&typeof a.args[0]=="string"?(console.log("TERA-FY DEFERRED-USE",a.args[0]),this.bootstrapperImport(r(a.args[0])).then(s=>typeof s=="function"?s:Promise.reject("Tera-fy plugin import didn't return a class")).then(s=>this.use(s,...a.args.slice(1)))):(console.log("TERA-FY DEFERRED-METHOD",a),this[a.method].apply(this,a.args))),Promise.resolve()).then(()=>delete this.bootstrapperDeferredMethods).then(()=>console.log("TYBS","Init")).then(()=>this.init.call(this,e))}bootstrapperImport(e){return new Promise((r,o)=>{let a=`installTFyBS${Math.random().toString(36).slice(2)}`,s=document.createElement("script");s.type="module",s.textContent=`
|
|
2
2
|
import mod from '${e}';
|
|
3
3
|
window['installMod${a}'](mod);
|
|
4
|
-
`;let p=()=>console.warn("CLEANUP",a);window[`installMod${a}`]=f=>{console.log("Accept module from",e,"=",f),r(f),p()},s.onerror=f=>{
|
|
4
|
+
`;let p=()=>console.warn("CLEANUP",a);window[`installMod${a}`]=f=>{console.log("Accept module from",e,"=",f),r(f),p()},s.onerror=f=>{o(new Error(`Failed to load module from ${e} - ${f.toString()}`)),p()},document.head.appendChild(s)})}};export{at as default};
|
|
5
5
|
/*! Bundled license information:
|
|
6
6
|
|
|
7
7
|
lodash-es/lodash.js:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var Se=typeof global=="object"&&global&&global.Object===Object&&global,N=Se;var Pe=typeof self=="object"&&self&&self.Object===Object&&self,Ee=N||Pe||Function("return this")(),d=Ee;var Me=d.Symbol,_=Me;var ft=Object.prototype,De=ft.hasOwnProperty,Re=ft.toString,M=_?_.toStringTag:void 0;function Be(t){var e=De.call(t,M),r=t[M];try{t[M]=void 0;var o=!0}catch{}var a=Re.call(t);return o&&(e?t[M]=r:delete t[M]),a}var st=Be;var Le=Object.prototype,Fe=Le.toString;function Ne(t){return Fe.call(t)}var pt=Ne;var ze="[object Null]",We="[object Undefined]",it=_?_.toStringTag:void 0;function Ue(t){return t==null?t===void 0?We:ze:it&&it in Object(t)?st(t):pt(t)}var h=Ue;function Ge(t){return t!=null&&typeof t=="object"}var x=Ge;var He=Array.isArray,D=He;function qe(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var u=qe;function $e(t){return t}var z=$e;var Ke="[object AsyncFunction]",Ve="[object Function]",ke="[object GeneratorFunction]",Ye="[object Proxy]";function Je(t){if(!u(t))return!1;var e=h(t);return e==Ve||e==ke||e==Ke||e==Ye}var O=Je;var Xe=d["__core-js_shared__"],W=Xe;var nt=function(){var t=/[^.]+$/.exec(W&&W.keys&&W.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Ze(t){return!!nt&&nt in t}var ut=Ze;var Qe=Function.prototype,tr=Qe.toString;function er(t){if(t!=null){try{return tr.call(t)}catch{}try{return t+""}catch{}}return""}var lt=er;var rr=/[\\^$.*+?()[\]{}|]/g,or=/^\[object .+?Constructor\]$/,ar=Function.prototype,fr=Object.prototype,sr=ar.toString,pr=fr.hasOwnProperty,ir=RegExp("^"+sr.call(pr).replace(rr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function nr(t){if(!u(t)||ut(t))return!1;var e=O(t)?ir:or;return e.test(lt(t))}var mt=nr;function ur(t,e){return t?.[e]}var dt=ur;function lr(t,e){var r=dt(t,e);return mt(r)?r:void 0}var T=lr;var xt=Object.create,mr=function(){function t(){}return function(e){if(!u(e))return{};if(xt)return xt(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),ct=mr;function dr(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 ht=dr;function xr(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var gt=xr;var cr=800,hr=16,gr=Date.now;function yr(t){var e=0,r=0;return function(){var o=gr(),a=hr-(o-r);if(r=o,a>0){if(++e>=cr)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var yt=yr;function br(t){return function(){return t}}var bt=br;var vr=function(){try{var t=T(Object,"defineProperty");return t({},"",{}),t}catch{}}(),j=vr;var _r=j?function(t,e){return j(t,"toString",{configurable:!0,enumerable:!1,value:bt(e),writable:!0})}:z,vt=_r;var Or=yt(vt),_t=Or;var Tr=9007199254740991,jr=/^(?:0|[1-9]\d*)$/;function wr(t,e){var r=typeof t;return e=e??Tr,!!e&&(r=="number"||r!="symbol"&&jr.test(t))&&t>-1&&t%1==0&&t<e}var U=wr;function Ar(t,e,r){e=="__proto__"&&j?j(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var w=Ar;function Ir(t,e){return t===e||t!==t&&e!==e}var g=Ir;var Cr=Object.prototype,Sr=Cr.hasOwnProperty;function Pr(t,e,r){var o=t[e];(!(Sr.call(t,e)&&g(o,r))||r===void 0&&!(e in t))&&w(t,e,r)}var Ot=Pr;function Er(t,e,r,o){var a=!r;r||(r={});for(var s=-1,p=e.length;++s<p;){var f=e[s],n=o?o(r[f],t[f],f,r,t):void 0;n===void 0&&(n=t[f]),a?w(r,f,n):Ot(r,f,n)}return r}var Tt=Er;var jt=Math.max;function Mr(t,e,r){return e=jt(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=jt(o.length-e,0),p=Array(s);++a<s;)p[a]=o[e+a];a=-1;for(var f=Array(e+1);++a<e;)f[a]=o[a];return f[e]=r(p),ht(t,this,f)}}var wt=Mr;function Dr(t,e){return _t(wt(t,e,z),t+"")}var At=Dr;var Rr=9007199254740991;function Br(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Rr}var G=Br;function Lr(t){return t!=null&&G(t.length)&&!O(t)}var A=Lr;function Fr(t,e,r){if(!u(r))return!1;var o=typeof e;return(o=="number"?A(r)&&U(e,r.length):o=="string"&&e in r)?g(r[e],t):!1}var It=Fr;function Nr(t){return At(function(e,r){var o=-1,a=r.length,s=a>1?r[a-1]:void 0,p=a>2?r[2]:void 0;for(s=t.length>3&&typeof s=="function"?(a--,s):void 0,p&&It(r[0],r[1],p)&&(s=a<3?void 0:s,a=1),e=Object(e);++o<a;){var f=r[o];f&&t(e,f,o,s)}return e})}var Ct=Nr;var zr=Object.prototype;function Wr(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||zr;return t===r}var H=Wr;function Ur(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var St=Ur;var Gr="[object Arguments]";function Hr(t){return x(t)&&h(t)==Gr}var Z=Hr;var Pt=Object.prototype,qr=Pt.hasOwnProperty,$r=Pt.propertyIsEnumerable,Kr=Z(function(){return arguments}())?Z:function(t){return x(t)&&qr.call(t,"callee")&&!$r.call(t,"callee")},R=Kr;function Vr(){return!1}var Et=Vr;var Rt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Mt=Rt&&typeof module=="object"&&module&&!module.nodeType&&module,kr=Mt&&Mt.exports===Rt,Dt=kr?d.Buffer:void 0,Yr=Dt?Dt.isBuffer:void 0,Jr=Yr||Et,q=Jr;var Xr="[object Arguments]",Zr="[object Array]",Qr="[object Boolean]",to="[object Date]",eo="[object Error]",ro="[object Function]",oo="[object Map]",ao="[object Number]",fo="[object Object]",so="[object RegExp]",po="[object Set]",io="[object String]",no="[object WeakMap]",uo="[object ArrayBuffer]",lo="[object DataView]",mo="[object Float32Array]",xo="[object Float64Array]",co="[object Int8Array]",ho="[object Int16Array]",go="[object Int32Array]",yo="[object Uint8Array]",bo="[object Uint8ClampedArray]",vo="[object Uint16Array]",_o="[object Uint32Array]",i={};i[mo]=i[xo]=i[co]=i[ho]=i[go]=i[yo]=i[bo]=i[vo]=i[_o]=!0;i[Xr]=i[Zr]=i[uo]=i[Qr]=i[lo]=i[to]=i[eo]=i[ro]=i[oo]=i[ao]=i[fo]=i[so]=i[po]=i[io]=i[no]=!1;function Oo(t){return x(t)&&G(t.length)&&!!i[h(t)]}var Bt=Oo;function To(t){return function(e){return t(e)}}var Lt=To;var Ft=typeof exports=="object"&&exports&&!exports.nodeType&&exports,B=Ft&&typeof module=="object"&&module&&!module.nodeType&&module,jo=B&&B.exports===Ft,Q=jo&&N.process,wo=function(){try{var t=B&&B.require&&B.require("util").types;return t||Q&&Q.binding&&Q.binding("util")}catch{}}(),tt=wo;var Nt=tt&&tt.isTypedArray,Ao=Nt?Lt(Nt):Bt,$=Ao;var Io=Object.prototype,Co=Io.hasOwnProperty;function So(t,e){var r=D(t),o=!r&&R(t),a=!r&&!o&&q(t),s=!r&&!o&&!a&&$(t),p=r||o||a||s,f=p?St(t.length,String):[],n=f.length;for(var m in t)(e||Co.call(t,m))&&!(p&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||U(m,n)))&&f.push(m);return f}var zt=So;function Po(t,e){return function(r){return t(e(r))}}var Wt=Po;function Eo(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Ut=Eo;var Mo=Object.prototype,Do=Mo.hasOwnProperty;function Ro(t){if(!u(t))return Ut(t);var e=H(t),r=[];for(var o in t)o=="constructor"&&(e||!Do.call(t,o))||r.push(o);return r}var Gt=Ro;function Bo(t){return A(t)?zt(t,!0):Gt(t)}var K=Bo;var Lo=T(Object,"create"),c=Lo;function Fo(){this.__data__=c?c(null):{},this.size=0}var Ht=Fo;function No(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var qt=No;var zo="__lodash_hash_undefined__",Wo=Object.prototype,Uo=Wo.hasOwnProperty;function Go(t){var e=this.__data__;if(c){var r=e[t];return r===zo?void 0:r}return Uo.call(e,t)?e[t]:void 0}var $t=Go;var Ho=Object.prototype,qo=Ho.hasOwnProperty;function $o(t){var e=this.__data__;return c?e[t]!==void 0:qo.call(e,t)}var Kt=$o;var Ko="__lodash_hash_undefined__";function Vo(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=c&&e===void 0?Ko:e,this}var Vt=Vo;function I(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])}}I.prototype.clear=Ht;I.prototype.delete=qt;I.prototype.get=$t;I.prototype.has=Kt;I.prototype.set=Vt;var et=I;function ko(){this.__data__=[],this.size=0}var kt=ko;function Yo(t,e){for(var r=t.length;r--;)if(g(t[r][0],e))return r;return-1}var y=Yo;var Jo=Array.prototype,Xo=Jo.splice;function Zo(t){var e=this.__data__,r=y(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Xo.call(e,r,1),--this.size,!0}var Yt=Zo;function Qo(t){var e=this.__data__,r=y(e,t);return r<0?void 0:e[r][1]}var Jt=Qo;function ta(t){return y(this.__data__,t)>-1}var Xt=ta;function ea(t,e){var r=this.__data__,o=y(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Zt=ea;function C(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])}}C.prototype.clear=kt;C.prototype.delete=Yt;C.prototype.get=Jt;C.prototype.has=Xt;C.prototype.set=Zt;var b=C;var ra=T(d,"Map"),V=ra;function oa(){this.size=0,this.__data__={hash:new et,map:new(V||b),string:new et}}var Qt=oa;function aa(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var te=aa;function fa(t,e){var r=t.__data__;return te(e)?r[typeof e=="string"?"string":"hash"]:r.map}var v=fa;function sa(t){var e=v(this,t).delete(t);return this.size-=e?1:0,e}var ee=sa;function pa(t){return v(this,t).get(t)}var re=pa;function ia(t){return v(this,t).has(t)}var oe=ia;function na(t,e){var r=v(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var ae=na;function S(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])}}S.prototype.clear=Qt;S.prototype.delete=ee;S.prototype.get=re;S.prototype.has=oe;S.prototype.set=ae;var fe=S;var ua=Wt(Object.getPrototypeOf,Object),k=ua;var la="[object Object]",ma=Function.prototype,da=Object.prototype,se=ma.toString,xa=da.hasOwnProperty,ca=se.call(Object);function ha(t){if(!x(t)||h(t)!=la)return!1;var e=k(t);if(e===null)return!0;var r=xa.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&se.call(r)==ca}var pe=ha;function ga(){this.__data__=new b,this.size=0}var ie=ga;function ya(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var ne=ya;function ba(t){return this.__data__.get(t)}var ue=ba;function va(t){return this.__data__.has(t)}var le=va;var _a=200;function Oa(t,e){var r=this.__data__;if(r instanceof b){var o=r.__data__;if(!V||o.length<_a-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new fe(o)}return r.set(t,e),this.size=r.size,this}var me=Oa;function P(t){var e=this.__data__=new b(t);this.size=e.size}P.prototype.clear=ie;P.prototype.delete=ne;P.prototype.get=ue;P.prototype.has=le;P.prototype.set=me;var de=P;var ge=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xe=ge&&typeof module=="object"&&module&&!module.nodeType&&module,Ta=xe&&xe.exports===ge,ce=Ta?d.Buffer:void 0,he=ce?ce.allocUnsafe:void 0;function ja(t,e){if(e)return t.slice();var r=t.length,o=he?he(r):new t.constructor(r);return t.copy(o),o}var ye=ja;var wa=d.Uint8Array,rt=wa;function Aa(t){var e=new t.constructor(t.byteLength);return new rt(e).set(new rt(t)),e}var be=Aa;function Ia(t,e){var r=e?be(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var ve=Ia;function Ca(t){return typeof t.constructor=="function"&&!H(t)?ct(k(t)):{}}var _e=Ca;function Sa(t){return function(e,r,o){for(var a=-1,s=Object(e),p=o(e),f=p.length;f--;){var n=p[t?f:++a];if(r(s[n],n,s)===!1)break}return e}}var Oe=Sa;var Pa=Oe(),Te=Pa;function Ea(t,e,r){(r!==void 0&&!g(t[e],r)||r===void 0&&!(e in t))&&w(t,e,r)}var L=Ea;function Ma(t){return x(t)&&A(t)}var je=Ma;function Da(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var F=Da;function Ra(t){return Tt(t,K(t))}var we=Ra;function Ba(t,e,r,o,a,s,p){var f=F(t,r),n=F(e,r),m=p.get(n);if(m){L(t,r,m);return}var l=s?s(f,n,r+"",t,e,p):void 0,E=l===void 0;if(E){var J=D(n),X=!J&&q(n),at=!J&&!X&&$(n);l=n,J||X||at?D(f)?l=f:je(f)?l=gt(f):X?(E=!1,l=ye(n,!0)):at?(E=!1,l=ve(n,!0)):l=[]:pe(n)||R(n)?(l=f,R(f)?l=we(f):(!u(f)||O(f))&&(l=_e(n))):E=!1}E&&(p.set(n,l),a(l,n,o,s,p),p.delete(n)),L(t,r,l)}var Ae=Ba;function Ie(t,e,r,o,a){t!==e&&Te(e,function(s,p){if(a||(a=new de),u(s))Ae(t,e,p,r,Ie,o,a);else{var f=o?o(F(t,p),s,p+"",t,e,a):void 0;f===void 0&&(f=s),L(t,p,f)}},K)}var Ce=Ie;var La=Ct(function(t,e,r){Ce(t,e,r)}),Y=La;var ot=class{settings={client:"tera-fy",clientType:"esm"};init(e){let r=o=>`https://dev.tera-tools.com/api/tera-fy/${o}.js`;return Promise.resolve().then(()=>this.settings.clientType=="esm"?this.bootstrapperImport(r(this.settings.client)).then(o=>typeof o=="function"?o:Promise.reject("Tera-fy import didn't return a class")):Promise.reject(`Unsupported TERA-fy clientType "${this.settings.clientType}"`)).then(o=>{let a=new o;if(!a.mixin)throw new Error("TERA-fy client doesnt expose a mixin() method");a.mixin(this,a),Y(this.settings,a.settings,this.settings)}).then(()=>{if(console.log("IAM",this),!this.init||typeof this.init!="function")throw new Error("Newly mixed-in TERA-fy client doesnt expose a init() method");if(!this.detectMode||typeof this.detectMode!="function")throw new Error("Newly mixed-in TERA-fy client doesnt expose a detectMode() method")}).then(()=>this.bootstrapperDeferredMethods.reduce((o,a)=>a.method=="use"&&typeof a.args[0]=="string"?(console.log("TERA-FY DEFERRED-USE",a.args[0]),this.bootstrapperImport(r(a.args[0])).then(s=>typeof s=="function"?s:Promise.reject("Tera-fy plugin import didn't return a class")).then(s=>this.use(s,...a.args.slice(1)))):(console.log("TERA-FY DEFERRED-METHOD",a),this[a.method].apply(this,a.args))),Promise.resolve()).then(()=>delete this.bootstrapperDeferredMethods).then(()=>console.log("TYBS","Init")).then(()=>this.init.call(this,e))}bootstrapperDeferredMethods=[];bootstrapperImport(e){return new Promise((r,o)=>{let a=`installTFyBS${Math.random().toString(36).slice(2)}`,s=document.createElement("script");s.type="module",s.textContent=`
|
|
1
|
+
var Ce=typeof global=="object"&&global&&global.Object===Object&&global,N=Ce;var Pe=typeof self=="object"&&self&&self.Object===Object&&self,Ee=N||Pe||Function("return this")(),d=Ee;var Me=d.Symbol,_=Me;var ft=Object.prototype,De=ft.hasOwnProperty,Re=ft.toString,M=_?_.toStringTag:void 0;function Be(t){var e=De.call(t,M),r=t[M];try{t[M]=void 0;var o=!0}catch{}var a=Re.call(t);return o&&(e?t[M]=r:delete t[M]),a}var st=Be;var Le=Object.prototype,Fe=Le.toString;function Ne(t){return Fe.call(t)}var pt=Ne;var ze="[object Null]",We="[object Undefined]",it=_?_.toStringTag:void 0;function Ue(t){return t==null?t===void 0?We:ze:it&&it in Object(t)?st(t):pt(t)}var h=Ue;function Ge(t){return t!=null&&typeof t=="object"}var x=Ge;var He=Array.isArray,D=He;function qe(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var u=qe;function $e(t){return t}var z=$e;var Ke="[object AsyncFunction]",Ve="[object Function]",ke="[object GeneratorFunction]",Ye="[object Proxy]";function Je(t){if(!u(t))return!1;var e=h(t);return e==Ve||e==ke||e==Ke||e==Ye}var O=Je;var Xe=d["__core-js_shared__"],W=Xe;var nt=function(){var t=/[^.]+$/.exec(W&&W.keys&&W.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Ze(t){return!!nt&&nt in t}var ut=Ze;var Qe=Function.prototype,tr=Qe.toString;function er(t){if(t!=null){try{return tr.call(t)}catch{}try{return t+""}catch{}}return""}var lt=er;var rr=/[\\^$.*+?()[\]{}|]/g,or=/^\[object .+?Constructor\]$/,ar=Function.prototype,fr=Object.prototype,sr=ar.toString,pr=fr.hasOwnProperty,ir=RegExp("^"+sr.call(pr).replace(rr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function nr(t){if(!u(t)||ut(t))return!1;var e=O(t)?ir:or;return e.test(lt(t))}var mt=nr;function ur(t,e){return t?.[e]}var dt=ur;function lr(t,e){var r=dt(t,e);return mt(r)?r:void 0}var T=lr;var xt=Object.create,mr=function(){function t(){}return function(e){if(!u(e))return{};if(xt)return xt(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),ct=mr;function dr(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 ht=dr;function xr(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var gt=xr;var cr=800,hr=16,gr=Date.now;function yr(t){var e=0,r=0;return function(){var o=gr(),a=hr-(o-r);if(r=o,a>0){if(++e>=cr)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var yt=yr;function br(t){return function(){return t}}var bt=br;var vr=function(){try{var t=T(Object,"defineProperty");return t({},"",{}),t}catch{}}(),j=vr;var _r=j?function(t,e){return j(t,"toString",{configurable:!0,enumerable:!1,value:bt(e),writable:!0})}:z,vt=_r;var Or=yt(vt),_t=Or;var Tr=9007199254740991,jr=/^(?:0|[1-9]\d*)$/;function wr(t,e){var r=typeof t;return e=e??Tr,!!e&&(r=="number"||r!="symbol"&&jr.test(t))&&t>-1&&t%1==0&&t<e}var U=wr;function Ar(t,e,r){e=="__proto__"&&j?j(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var w=Ar;function Ir(t,e){return t===e||t!==t&&e!==e}var g=Ir;var Sr=Object.prototype,Cr=Sr.hasOwnProperty;function Pr(t,e,r){var o=t[e];(!(Cr.call(t,e)&&g(o,r))||r===void 0&&!(e in t))&&w(t,e,r)}var Ot=Pr;function Er(t,e,r,o){var a=!r;r||(r={});for(var s=-1,p=e.length;++s<p;){var f=e[s],n=o?o(r[f],t[f],f,r,t):void 0;n===void 0&&(n=t[f]),a?w(r,f,n):Ot(r,f,n)}return r}var Tt=Er;var jt=Math.max;function Mr(t,e,r){return e=jt(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=jt(o.length-e,0),p=Array(s);++a<s;)p[a]=o[e+a];a=-1;for(var f=Array(e+1);++a<e;)f[a]=o[a];return f[e]=r(p),ht(t,this,f)}}var wt=Mr;function Dr(t,e){return _t(wt(t,e,z),t+"")}var At=Dr;var Rr=9007199254740991;function Br(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Rr}var G=Br;function Lr(t){return t!=null&&G(t.length)&&!O(t)}var A=Lr;function Fr(t,e,r){if(!u(r))return!1;var o=typeof e;return(o=="number"?A(r)&&U(e,r.length):o=="string"&&e in r)?g(r[e],t):!1}var It=Fr;function Nr(t){return At(function(e,r){var o=-1,a=r.length,s=a>1?r[a-1]:void 0,p=a>2?r[2]:void 0;for(s=t.length>3&&typeof s=="function"?(a--,s):void 0,p&&It(r[0],r[1],p)&&(s=a<3?void 0:s,a=1),e=Object(e);++o<a;){var f=r[o];f&&t(e,f,o,s)}return e})}var St=Nr;var zr=Object.prototype;function Wr(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||zr;return t===r}var H=Wr;function Ur(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var Ct=Ur;var Gr="[object Arguments]";function Hr(t){return x(t)&&h(t)==Gr}var Z=Hr;var Pt=Object.prototype,qr=Pt.hasOwnProperty,$r=Pt.propertyIsEnumerable,Kr=Z(function(){return arguments}())?Z:function(t){return x(t)&&qr.call(t,"callee")&&!$r.call(t,"callee")},R=Kr;function Vr(){return!1}var Et=Vr;var Rt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Mt=Rt&&typeof module=="object"&&module&&!module.nodeType&&module,kr=Mt&&Mt.exports===Rt,Dt=kr?d.Buffer:void 0,Yr=Dt?Dt.isBuffer:void 0,Jr=Yr||Et,q=Jr;var Xr="[object Arguments]",Zr="[object Array]",Qr="[object Boolean]",to="[object Date]",eo="[object Error]",ro="[object Function]",oo="[object Map]",ao="[object Number]",fo="[object Object]",so="[object RegExp]",po="[object Set]",io="[object String]",no="[object WeakMap]",uo="[object ArrayBuffer]",lo="[object DataView]",mo="[object Float32Array]",xo="[object Float64Array]",co="[object Int8Array]",ho="[object Int16Array]",go="[object Int32Array]",yo="[object Uint8Array]",bo="[object Uint8ClampedArray]",vo="[object Uint16Array]",_o="[object Uint32Array]",i={};i[mo]=i[xo]=i[co]=i[ho]=i[go]=i[yo]=i[bo]=i[vo]=i[_o]=!0;i[Xr]=i[Zr]=i[uo]=i[Qr]=i[lo]=i[to]=i[eo]=i[ro]=i[oo]=i[ao]=i[fo]=i[so]=i[po]=i[io]=i[no]=!1;function Oo(t){return x(t)&&G(t.length)&&!!i[h(t)]}var Bt=Oo;function To(t){return function(e){return t(e)}}var Lt=To;var Ft=typeof exports=="object"&&exports&&!exports.nodeType&&exports,B=Ft&&typeof module=="object"&&module&&!module.nodeType&&module,jo=B&&B.exports===Ft,Q=jo&&N.process,wo=function(){try{var t=B&&B.require&&B.require("util").types;return t||Q&&Q.binding&&Q.binding("util")}catch{}}(),tt=wo;var Nt=tt&&tt.isTypedArray,Ao=Nt?Lt(Nt):Bt,$=Ao;var Io=Object.prototype,So=Io.hasOwnProperty;function Co(t,e){var r=D(t),o=!r&&R(t),a=!r&&!o&&q(t),s=!r&&!o&&!a&&$(t),p=r||o||a||s,f=p?Ct(t.length,String):[],n=f.length;for(var m in t)(e||So.call(t,m))&&!(p&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||U(m,n)))&&f.push(m);return f}var zt=Co;function Po(t,e){return function(r){return t(e(r))}}var Wt=Po;function Eo(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Ut=Eo;var Mo=Object.prototype,Do=Mo.hasOwnProperty;function Ro(t){if(!u(t))return Ut(t);var e=H(t),r=[];for(var o in t)o=="constructor"&&(e||!Do.call(t,o))||r.push(o);return r}var Gt=Ro;function Bo(t){return A(t)?zt(t,!0):Gt(t)}var K=Bo;var Lo=T(Object,"create"),c=Lo;function Fo(){this.__data__=c?c(null):{},this.size=0}var Ht=Fo;function No(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var qt=No;var zo="__lodash_hash_undefined__",Wo=Object.prototype,Uo=Wo.hasOwnProperty;function Go(t){var e=this.__data__;if(c){var r=e[t];return r===zo?void 0:r}return Uo.call(e,t)?e[t]:void 0}var $t=Go;var Ho=Object.prototype,qo=Ho.hasOwnProperty;function $o(t){var e=this.__data__;return c?e[t]!==void 0:qo.call(e,t)}var Kt=$o;var Ko="__lodash_hash_undefined__";function Vo(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=c&&e===void 0?Ko:e,this}var Vt=Vo;function I(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])}}I.prototype.clear=Ht;I.prototype.delete=qt;I.prototype.get=$t;I.prototype.has=Kt;I.prototype.set=Vt;var et=I;function ko(){this.__data__=[],this.size=0}var kt=ko;function Yo(t,e){for(var r=t.length;r--;)if(g(t[r][0],e))return r;return-1}var y=Yo;var Jo=Array.prototype,Xo=Jo.splice;function Zo(t){var e=this.__data__,r=y(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Xo.call(e,r,1),--this.size,!0}var Yt=Zo;function Qo(t){var e=this.__data__,r=y(e,t);return r<0?void 0:e[r][1]}var Jt=Qo;function ta(t){return y(this.__data__,t)>-1}var Xt=ta;function ea(t,e){var r=this.__data__,o=y(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var Zt=ea;function S(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])}}S.prototype.clear=kt;S.prototype.delete=Yt;S.prototype.get=Jt;S.prototype.has=Xt;S.prototype.set=Zt;var b=S;var ra=T(d,"Map"),V=ra;function oa(){this.size=0,this.__data__={hash:new et,map:new(V||b),string:new et}}var Qt=oa;function aa(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var te=aa;function fa(t,e){var r=t.__data__;return te(e)?r[typeof e=="string"?"string":"hash"]:r.map}var v=fa;function sa(t){var e=v(this,t).delete(t);return this.size-=e?1:0,e}var ee=sa;function pa(t){return v(this,t).get(t)}var re=pa;function ia(t){return v(this,t).has(t)}var oe=ia;function na(t,e){var r=v(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var ae=na;function C(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])}}C.prototype.clear=Qt;C.prototype.delete=ee;C.prototype.get=re;C.prototype.has=oe;C.prototype.set=ae;var fe=C;var ua=Wt(Object.getPrototypeOf,Object),k=ua;var la="[object Object]",ma=Function.prototype,da=Object.prototype,se=ma.toString,xa=da.hasOwnProperty,ca=se.call(Object);function ha(t){if(!x(t)||h(t)!=la)return!1;var e=k(t);if(e===null)return!0;var r=xa.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&se.call(r)==ca}var pe=ha;function ga(){this.__data__=new b,this.size=0}var ie=ga;function ya(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var ne=ya;function ba(t){return this.__data__.get(t)}var ue=ba;function va(t){return this.__data__.has(t)}var le=va;var _a=200;function Oa(t,e){var r=this.__data__;if(r instanceof b){var o=r.__data__;if(!V||o.length<_a-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new fe(o)}return r.set(t,e),this.size=r.size,this}var me=Oa;function P(t){var e=this.__data__=new b(t);this.size=e.size}P.prototype.clear=ie;P.prototype.delete=ne;P.prototype.get=ue;P.prototype.has=le;P.prototype.set=me;var de=P;var ge=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xe=ge&&typeof module=="object"&&module&&!module.nodeType&&module,Ta=xe&&xe.exports===ge,ce=Ta?d.Buffer:void 0,he=ce?ce.allocUnsafe:void 0;function ja(t,e){if(e)return t.slice();var r=t.length,o=he?he(r):new t.constructor(r);return t.copy(o),o}var ye=ja;var wa=d.Uint8Array,rt=wa;function Aa(t){var e=new t.constructor(t.byteLength);return new rt(e).set(new rt(t)),e}var be=Aa;function Ia(t,e){var r=e?be(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var ve=Ia;function Sa(t){return typeof t.constructor=="function"&&!H(t)?ct(k(t)):{}}var _e=Sa;function Ca(t){return function(e,r,o){for(var a=-1,s=Object(e),p=o(e),f=p.length;f--;){var n=p[t?f:++a];if(r(s[n],n,s)===!1)break}return e}}var Oe=Ca;var Pa=Oe(),Te=Pa;function Ea(t,e,r){(r!==void 0&&!g(t[e],r)||r===void 0&&!(e in t))&&w(t,e,r)}var L=Ea;function Ma(t){return x(t)&&A(t)}var je=Ma;function Da(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var F=Da;function Ra(t){return Tt(t,K(t))}var we=Ra;function Ba(t,e,r,o,a,s,p){var f=F(t,r),n=F(e,r),m=p.get(n);if(m){L(t,r,m);return}var l=s?s(f,n,r+"",t,e,p):void 0,E=l===void 0;if(E){var J=D(n),X=!J&&q(n),at=!J&&!X&&$(n);l=n,J||X||at?D(f)?l=f:je(f)?l=gt(f):X?(E=!1,l=ye(n,!0)):at?(E=!1,l=ve(n,!0)):l=[]:pe(n)||R(n)?(l=f,R(f)?l=we(f):(!u(f)||O(f))&&(l=_e(n))):E=!1}E&&(p.set(n,l),a(l,n,o,s,p),p.delete(n)),L(t,r,l)}var Ae=Ba;function Ie(t,e,r,o,a){t!==e&&Te(e,function(s,p){if(a||(a=new de),u(s))Ae(t,e,p,r,Ie,o,a);else{var f=o?o(F(t,p),s,p+"",t,e,a):void 0;f===void 0&&(f=s),L(t,p,f)}},K)}var Se=Ie;var La=St(function(t,e,r){Se(t,e,r)}),Y=La;var ot=class{settings={client:"tera-fy",clientType:"esm"};init(e){let r=o=>`https://dev.tera-tools.com/api/tera-fy/${o}.js`;return Promise.resolve().then(()=>this.settings.clientType=="esm"?this.bootstrapperImport(r(this.settings.client)).then(o=>typeof o=="function"?o:Promise.reject("Tera-fy import didn't return a class")):Promise.reject(`Unsupported TERA-fy clientType "${this.settings.clientType}"`)).then(o=>{let a=new o;if(!a.mixin)throw new Error("TERA-fy client doesnt expose a mixin() method");a.mixin(this,a),Y(this.settings,a.settings,this.settings)}).then(()=>{if(console.log("IAM",this),!this.init||typeof this.init!="function")throw new Error("Newly mixed-in TERA-fy client doesnt expose a init() method");if(!this.detectMode||typeof this.detectMode!="function")throw new Error("Newly mixed-in TERA-fy client doesnt expose a detectMode() method")}).then(()=>this.bootstrapperDeferredMethods.reduce((o,a)=>a.method=="use"&&typeof a.args[0]=="string"?(console.log("TERA-FY DEFERRED-USE",a.args[0]),this.bootstrapperImport(r(a.args[0])).then(s=>typeof s=="function"?s:Promise.reject("Tera-fy plugin import didn't return a class")).then(s=>this.use(s,...a.args.slice(1)))):(console.log("TERA-FY DEFERRED-METHOD",a),this[a.method].apply(this,a.args))),Promise.resolve()).then(()=>delete this.bootstrapperDeferredMethods).then(()=>console.log("TYBS","Init")).then(()=>this.init.call(this,e))}bootstrapperDeferredMethods=[];bootstrapperImport(e){return new Promise((r,o)=>{let a=`installTFyBS${Math.random().toString(36).slice(2)}`,s=document.createElement("script");s.type="module",s.textContent=`
|
|
2
2
|
import mod from '${e}';
|
|
3
3
|
window['installMod${a}'](mod);
|
|
4
|
-
`;let p=()=>console.warn("CLEANUP",a);window[`installMod${a}`]=f=>{console.log("Accept module from",e,"=",f),r(f),p()},s.onerror=f=>{
|
|
4
|
+
`;let p=()=>console.warn("CLEANUP",a);window[`installMod${a}`]=f=>{console.log("Accept module from",e,"=",f),r(f),p()},s.onerror=f=>{o(new Error(`Failed to load module from ${e} - ${f.toString()}`)),p()},document.head.appendChild(s)})}constructor(e){e&&Y(this.settings,e),["set","setIfDev","use"].forEach(r=>{this[r]=(...o)=>(this.bootstrapperDeferredMethods.push({method:r,args:o}),this)})}};export{ot as default};
|
|
5
5
|
/*! Bundled license information:
|
|
6
6
|
|
|
7
7
|
lodash-es/lodash.js:
|
package/dist/terafy.es2019.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var uo=Object.defineProperty;var co=(t,e,r)=>e in t?uo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var d=(t,e,r)=>co(t,typeof e!="symbol"?e+"":e,r);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:x,diffs:v}){var P=Object.keys(i),O=P.length,y=Object.keys(f),_=y.length,b,p=i.length-f.length;if(xo(i,f)){for(var u=0;u<O;u++){var l=Array.isArray(i)?Number(P[u]):P[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:P}){var O=f[i],y=m[i];if(!(i in f)&&i in m){var _=y;P.add.push({op:"add",path:r(x),value:_})}else O!==y&&(Object(O)!==O||Object(y)!==y||ho(O,y)||!Object.keys(O).length&&!Object.keys(y).length&&String(O)!=String(y)?n(x,P,y):o({obj1:f[i],obj2:m[i],basePath:x,basePathForRemoves:v,diffs:P}))}function n(i,f,m){f.replace.push({op:"replace",path:r(i),value:m})}}function ho(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function xo(t,e){var r=t.length-e.length;if(Array.isArray(t)&&Array.isArray(e)&&r>0){for(var o=0,a=0,s=0;s<e.length&&String(t[s])===String(e[s]);s++)o++;for(var n=e.length;n>0&&String(t[n+r])===String(e[n]);n--)a++;return o>=a}return!0}var go=typeof global=="object"&&global&&global.Object===Object&&global,dt=go;var yo=typeof self=="object"&&self&&self.Object===Object&&self,bo=dt||yo||Function("return this")(),g=bo;var vo=g.Symbol,T=vo;var Yt=Object.prototype,wo=Yt.hasOwnProperty,To=Yt.toString,pt=T?T.toStringTag:void 0;function Oo(t){var e=wo.call(t,pt),r=t[pt];try{t[pt]=void 0;var o=!0}catch{}var a=To.call(t);return o&&(e?t[pt]=r:delete t[pt]),a}var Zt=Oo;var Ao=Object.prototype,Po=Ao.toString;function jo(t){return Po.call(t)}var Jt=jo;var So="[object Null]",Io="[object Undefined]",Xt=T?T.toStringTag:void 0;function _o(t){return t==null?t===void 0?Io:So:Xt&&Xt in Object(t)?Zt(t):Jt(t)}var I=_o;function Eo(t){return t!=null&&typeof t=="object"}var S=Eo;var Co="[object Symbol]";function Fo(t){return typeof t=="symbol"||S(t)&&I(t)==Co}var K=Fo;function Mo(t,e){for(var r=-1,o=t==null?0:t.length,a=Array(o);++r<o;)a[r]=e(t[r],r,t);return a}var Qt=Mo;var Ro=Array.isArray,w=Ro;var No=1/0,te=T?T.prototype:void 0,ee=te?te.toString:void 0;function re(t){if(typeof t=="string")return t;if(w(t))return Qt(t,re)+"";if(K(t))return ee?ee.call(t):"";var e=t+"";return e=="0"&&1/t==-No?"-0":e}var oe=re;function Lo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var j=Lo;function Bo(t){return t}var ae=Bo;var ko="[object AsyncFunction]",Uo="[object Function]",Do="[object GeneratorFunction]",zo="[object Proxy]";function Ko(t){if(!j(t))return!1;var e=I(t);return e==Uo||e==Do||e==ko||e==zo}var ct=Ko;var Go=g["__core-js_shared__"],ht=Go;var ie=function(){var t=/[^.]+$/.exec(ht&&ht.keys&&ht.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Wo(t){return!!ie&&ie in t}var se=Wo;var $o=Function.prototype,Ho=$o.toString;function Vo(t){if(t!=null){try{return Ho.call(t)}catch{}try{return t+""}catch{}}return""}var C=Vo;var qo=/[\\^$.*+?()[\]{}|]/g,Yo=/^\[object .+?Constructor\]$/,Zo=Function.prototype,Jo=Object.prototype,Xo=Zo.toString,Qo=Jo.hasOwnProperty,ta=RegExp("^"+Xo.call(Qo).replace(qo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ea(t){if(!j(t)||se(t))return!1;var e=ct(t)?ta:Yo;return e.test(C(t))}var ne=ea;function ra(t,e){return t==null?void 0:t[e]}var fe=ra;function oa(t,e){var r=fe(t,e);return ne(r)?r:void 0}var A=oa;var aa=A(g,"WeakMap"),xt=aa;var pe=Object.create,ia=function(){function t(){}return function(e){if(!j(e))return{};if(pe)return pe(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),le=ia;function sa(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var me=sa;function na(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var ue=na;var fa=800,pa=16,la=Date.now;function ma(t){var e=0,r=0;return function(){var o=la(),a=pa-(o-r);if(r=o,a>0){if(++e>=fa)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var de=ma;function ua(t){return function(){return t}}var ce=ua;var da=function(){try{var t=A(Object,"defineProperty");return t({},"",{}),t}catch{}}(),G=da;var ca=G?function(t,e){return G(t,"toString",{configurable:!0,enumerable:!1,value:ce(e),writable:!0})}:ae,he=ca;var ha=de(he),xe=ha;function xa(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var ge=xa;var ga=9007199254740991,ya=/^(?:0|[1-9]\d*)$/;function ba(t,e){var r=typeof t;return e=e==null?ga:e,!!e&&(r=="number"||r!="symbol"&&ya.test(t))&&t>-1&&t%1==0&&t<e}var W=ba;function va(t,e,r){e=="__proto__"&&G?G(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var gt=va;function wa(t,e){return t===e||t!==t&&e!==e}var yt=wa;var Ta=Object.prototype,Oa=Ta.hasOwnProperty;function Aa(t,e,r){var o=t[e];(!(Oa.call(t,e)&&yt(o,r))||r===void 0&&!(e in t))&>(t,e,r)}var $=Aa;function Pa(t,e,r,o){var a=!r;r||(r={});for(var s=-1,n=e.length;++s<n;){var i=e[s],f=o?o(r[i],t[i],i,r,t):void 0;f===void 0&&(f=t[i]),a?gt(r,i,f):$(r,i,f)}return r}var R=Pa;var ye=Math.max;function ja(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=ja;var Sa=9007199254740991;function Ia(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Sa}var H=Ia;function _a(t){return t!=null&&H(t.length)&&!ct(t)}var bt=_a;var Ea=Object.prototype;function Ca(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Ea;return t===r}var V=Ca;function Fa(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var ve=Fa;var Ma="[object Arguments]";function Ra(t){return S(t)&&I(t)==Ma}var Mt=Ra;var we=Object.prototype,Na=we.hasOwnProperty,La=we.propertyIsEnumerable,Ba=Mt(function(){return arguments}())?Mt:function(t){return S(t)&&Na.call(t,"callee")&&!La.call(t,"callee")},q=Ba;function ka(){return!1}var Te=ka;var Pe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Oe=Pe&&typeof module=="object"&&module&&!module.nodeType&&module,Ua=Oe&&Oe.exports===Pe,Ae=Ua?g.Buffer:void 0,Da=Ae?Ae.isBuffer:void 0,za=Da||Te,vt=za;var Ka="[object Arguments]",Ga="[object Array]",Wa="[object Boolean]",$a="[object Date]",Ha="[object Error]",Va="[object Function]",qa="[object Map]",Ya="[object Number]",Za="[object Object]",Ja="[object RegExp]",Xa="[object Set]",Qa="[object String]",ti="[object WeakMap]",ei="[object ArrayBuffer]",ri="[object DataView]",oi="[object Float32Array]",ai="[object Float64Array]",ii="[object Int8Array]",si="[object Int16Array]",ni="[object Int32Array]",fi="[object Uint8Array]",pi="[object Uint8ClampedArray]",li="[object Uint16Array]",mi="[object Uint32Array]",h={};h[oi]=h[ai]=h[ii]=h[si]=h[ni]=h[fi]=h[pi]=h[li]=h[mi]=!0;h[Ka]=h[Ga]=h[ei]=h[Wa]=h[ri]=h[$a]=h[Ha]=h[Va]=h[qa]=h[Ya]=h[Za]=h[Ja]=h[Xa]=h[Qa]=h[ti]=!1;function ui(t){return S(t)&&H(t.length)&&!!h[I(t)]}var je=ui;function di(t){return function(e){return t(e)}}var Y=di;var Se=typeof exports=="object"&&exports&&!exports.nodeType&&exports,lt=Se&&typeof module=="object"&&module&&!module.nodeType&&module,ci=lt&<.exports===Se,Rt=ci&&dt.process,hi=function(){try{var t=lt&<.require&<.require("util").types;return t||Rt&&Rt.binding&&Rt.binding("util")}catch{}}(),F=hi;var Ie=F&&F.isTypedArray,xi=Ie?Y(Ie):je,_e=xi;var gi=Object.prototype,yi=gi.hasOwnProperty;function bi(t,e){var r=w(t),o=!r&&q(t),a=!r&&!o&&vt(t),s=!r&&!o&&!a&&_e(t),n=r||o||a||s,i=n?ve(t.length,String):[],f=i.length;for(var m in t)(e||yi.call(t,m))&&!(n&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||W(m,f)))&&i.push(m);return i}var wt=bi;function vi(t,e){return function(r){return t(e(r))}}var Tt=vi;var wi=Tt(Object.keys,Object),Ee=wi;var Ti=Object.prototype,Oi=Ti.hasOwnProperty;function Ai(t){if(!V(t))return Ee(t);var e=[];for(var r in Object(t))Oi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ce=Ai;function Pi(t){return bt(t)?wt(t):Ce(t)}var Z=Pi;function ji(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Fe=ji;var Si=Object.prototype,Ii=Si.hasOwnProperty;function _i(t){if(!j(t))return Fe(t);var e=V(t),r=[];for(var o in t)o=="constructor"&&(e||!Ii.call(t,o))||r.push(o);return r}var Me=_i;function Ei(t){return bt(t)?wt(t,!0):Me(t)}var J=Ei;var Ci=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Fi=/^\w*$/;function Mi(t,e){if(w(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||K(t)?!0:Fi.test(t)||!Ci.test(t)||e!=null&&t in Object(e)}var Re=Mi;var Ri=A(Object,"create"),M=Ri;function Ni(){this.__data__=M?M(null):{},this.size=0}var Ne=Ni;function Li(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Le=Li;var Bi="__lodash_hash_undefined__",ki=Object.prototype,Ui=ki.hasOwnProperty;function Di(t){var e=this.__data__;if(M){var r=e[t];return r===Bi?void 0:r}return Ui.call(e,t)?e[t]:void 0}var Be=Di;var zi=Object.prototype,Ki=zi.hasOwnProperty;function Gi(t){var e=this.__data__;return M?e[t]!==void 0:Ki.call(e,t)}var ke=Gi;var Wi="__lodash_hash_undefined__";function $i(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=M&&e===void 0?Wi:e,this}var Ue=$i;function X(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}X.prototype.clear=Ne;X.prototype.delete=Le;X.prototype.get=Be;X.prototype.has=ke;X.prototype.set=Ue;var Nt=X;function Hi(){this.__data__=[],this.size=0}var De=Hi;function Vi(t,e){for(var r=t.length;r--;)if(yt(t[r][0],e))return r;return-1}var N=Vi;var qi=Array.prototype,Yi=qi.splice;function Zi(t){var e=this.__data__,r=N(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Yi.call(e,r,1),--this.size,!0}var ze=Zi;function Ji(t){var e=this.__data__,r=N(e,t);return r<0?void 0:e[r][1]}var Ke=Ji;function Xi(t){return N(this.__data__,t)>-1}var Ge=Xi;function Qi(t,e){var r=this.__data__,o=N(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var We=Qi;function Q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Q.prototype.clear=De;Q.prototype.delete=ze;Q.prototype.get=Ke;Q.prototype.has=Ge;Q.prototype.set=We;var L=Q;var ts=A(g,"Map"),B=ts;function es(){this.size=0,this.__data__={hash:new Nt,map:new(B||L),string:new Nt}}var $e=es;function rs(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var He=rs;function os(t,e){var r=t.__data__;return He(e)?r[typeof e=="string"?"string":"hash"]:r.map}var k=os;function as(t){var e=k(this,t).delete(t);return this.size-=e?1:0,e}var Ve=as;function is(t){return k(this,t).get(t)}var qe=is;function ss(t){return k(this,t).has(t)}var Ye=ss;function ns(t,e){var r=k(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ze=ns;function tt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}tt.prototype.clear=$e;tt.prototype.delete=Ve;tt.prototype.get=qe;tt.prototype.has=Ye;tt.prototype.set=Ze;var mt=tt;var fs="Expected a function";function Lt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(fs);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],s=r.cache;if(s.has(a))return s.get(a);var n=t.apply(this,o);return r.cache=s.set(a,n)||s,n};return r.cache=new(Lt.Cache||mt),r}Lt.Cache=mt;var Je=Lt;var ps=500;function ls(t){var e=Je(t,function(o){return r.size===ps&&r.clear(),o}),r=e.cache;return e}var Xe=ls;var ms=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,us=/\\(\\)?/g,ds=Xe(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(ms,function(r,o,a,s){e.push(a?s.replace(us,"$1"):o||r)}),e}),Qe=ds;function cs(t){return t==null?"":oe(t)}var tr=cs;function hs(t,e){return w(t)?t:Re(t,e)?[t]:Qe(tr(t))}var U=hs;var xs=1/0;function gs(t){if(typeof t=="string"||K(t))return t;var e=t+"";return e=="0"&&1/t==-xs?"-0":e}var et=gs;function ys(t,e){e=U(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[et(e[r++])];return r&&r==o?t:void 0}var er=ys;function bs(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var rt=bs;var rr=T?T.isConcatSpreadable:void 0;function vs(t){return w(t)||q(t)||!!(rr&&t&&t[rr])}var or=vs;function ar(t,e,r,o,a){var s=-1,n=t.length;for(r||(r=or),a||(a=[]);++s<n;){var i=t[s];e>0&&r(i)?e>1?ar(i,e-1,r,o,a):rt(a,i):o||(a[a.length]=i)}return a}var ir=ar;function ws(t){var e=t==null?0:t.length;return e?ir(t,1):[]}var sr=ws;function Ts(t){return xe(be(t,void 0,sr),t+"")}var nr=Ts;var Os=Tt(Object.getPrototypeOf,Object),Ot=Os;function As(){this.__data__=new L,this.size=0}var fr=As;function Ps(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var pr=Ps;function js(t){return this.__data__.get(t)}var lr=js;function Ss(t){return this.__data__.has(t)}var mr=Ss;var Is=200;function _s(t,e){var r=this.__data__;if(r instanceof L){var o=r.__data__;if(!B||o.length<Is-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new mt(o)}return r.set(t,e),this.size=r.size,this}var ur=_s;function ot(t){var e=this.__data__=new L(t);this.size=e.size}ot.prototype.clear=fr;ot.prototype.delete=pr;ot.prototype.get=lr;ot.prototype.has=mr;ot.prototype.set=ur;var dr=ot;function Es(t,e){return t&&R(e,Z(e),t)}var cr=Es;function Cs(t,e){return t&&R(e,J(e),t)}var hr=Cs;var br=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xr=br&&typeof module=="object"&&module&&!module.nodeType&&module,Fs=xr&&xr.exports===br,gr=Fs?g.Buffer:void 0,yr=gr?gr.allocUnsafe:void 0;function Ms(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=Ms;function Rs(t,e){for(var r=-1,o=t==null?0:t.length,a=0,s=[];++r<o;){var n=t[r];e(n,r,t)&&(s[a++]=n)}return s}var wr=Rs;function Ns(){return[]}var At=Ns;var Ls=Object.prototype,Bs=Ls.propertyIsEnumerable,Tr=Object.getOwnPropertySymbols,ks=Tr?function(t){return t==null?[]:(t=Object(t),wr(Tr(t),function(e){return Bs.call(t,e)}))}:At,at=ks;function Us(t,e){return R(t,at(t),e)}var Or=Us;var Ds=Object.getOwnPropertySymbols,zs=Ds?function(t){for(var e=[];t;)rt(e,at(t)),t=Ot(t);return e}:At,Pt=zs;function Ks(t,e){return R(t,Pt(t),e)}var Ar=Ks;function Gs(t,e,r){var o=e(t);return w(t)?o:rt(o,r(t))}var jt=Gs;function Ws(t){return jt(t,Z,at)}var Pr=Ws;function $s(t){return jt(t,J,Pt)}var jr=$s;var Hs=A(g,"DataView"),St=Hs;var Vs=A(g,"Promise"),It=Vs;var qs=A(g,"Set"),_t=qs;var Sr="[object Map]",Ys="[object Object]",Ir="[object Promise]",_r="[object Set]",Er="[object WeakMap]",Cr="[object DataView]",Zs=C(St),Js=C(B),Xs=C(It),Qs=C(_t),tn=C(xt),z=I;(St&&z(new St(new ArrayBuffer(1)))!=Cr||B&&z(new B)!=Sr||It&&z(It.resolve())!=Ir||_t&&z(new _t)!=_r||xt&&z(new xt)!=Er)&&(z=function(t){var e=I(t),r=e==Ys?t.constructor:void 0,o=r?C(r):"";if(o)switch(o){case Zs:return Cr;case Js:return Sr;case Xs:return Ir;case Qs:return _r;case tn:return Er}return e});var it=z;var en=Object.prototype,rn=en.hasOwnProperty;function on(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&rn.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Fr=on;var an=g.Uint8Array,Bt=an;function sn(t){var e=new t.constructor(t.byteLength);return new Bt(e).set(new Bt(t)),e}var st=sn;function nn(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Mr=nn;var fn=/\w*$/;function pn(t){var e=new t.constructor(t.source,fn.exec(t));return e.lastIndex=t.lastIndex,e}var Rr=pn;var Nr=T?T.prototype:void 0,Lr=Nr?Nr.valueOf:void 0;function ln(t){return Lr?Object(Lr.call(t)):{}}var Br=ln;function mn(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var kr=mn;var un="[object Boolean]",dn="[object Date]",cn="[object Map]",hn="[object Number]",xn="[object RegExp]",gn="[object Set]",yn="[object String]",bn="[object Symbol]",vn="[object ArrayBuffer]",wn="[object DataView]",Tn="[object Float32Array]",On="[object Float64Array]",An="[object Int8Array]",Pn="[object Int16Array]",jn="[object Int32Array]",Sn="[object Uint8Array]",In="[object Uint8ClampedArray]",_n="[object Uint16Array]",En="[object Uint32Array]";function Cn(t,e,r){var o=t.constructor;switch(e){case vn:return st(t);case un:case dn:return new o(+t);case wn:return Mr(t,r);case Tn:case On:case An:case Pn:case jn:case Sn:case In:case _n:case En:return kr(t,r);case cn:return new o;case hn:case yn:return new o(t);case xn:return Rr(t);case gn:return new o;case bn:return Br(t)}}var Ur=Cn;function Fn(t){return typeof t.constructor=="function"&&!V(t)?le(Ot(t)):{}}var Dr=Fn;var Mn="[object Map]";function Rn(t){return S(t)&&it(t)==Mn}var zr=Rn;var Kr=F&&F.isMap,Nn=Kr?Y(Kr):zr,Gr=Nn;var Ln="[object Set]";function Bn(t){return S(t)&&it(t)==Ln}var Wr=Bn;var $r=F&&F.isSet,kn=$r?Y($r):Wr,Hr=kn;var Un=1,Dn=2,zn=4,Vr="[object Arguments]",Kn="[object Array]",Gn="[object Boolean]",Wn="[object Date]",$n="[object Error]",qr="[object Function]",Hn="[object GeneratorFunction]",Vn="[object Map]",qn="[object Number]",Yr="[object Object]",Yn="[object RegExp]",Zn="[object Set]",Jn="[object String]",Xn="[object Symbol]",Qn="[object WeakMap]",tf="[object ArrayBuffer]",ef="[object DataView]",rf="[object Float32Array]",of="[object Float64Array]",af="[object Int8Array]",sf="[object Int16Array]",nf="[object Int32Array]",ff="[object Uint8Array]",pf="[object Uint8ClampedArray]",lf="[object Uint16Array]",mf="[object Uint32Array]",c={};c[Vr]=c[Kn]=c[tf]=c[ef]=c[Gn]=c[Wn]=c[rf]=c[of]=c[af]=c[sf]=c[nf]=c[Vn]=c[qn]=c[Yr]=c[Yn]=c[Zn]=c[Jn]=c[Xn]=c[ff]=c[pf]=c[lf]=c[mf]=!0;c[$n]=c[qr]=c[Qn]=!1;function Et(t,e,r,o,a,s){var n,i=e&Un,f=e&Dn,m=e&zn;if(r&&(n=a?r(t,o,a,s):r(t)),n!==void 0)return n;if(!j(t))return t;var x=w(t);if(x){if(n=Fr(t),!i)return ue(t,n)}else{var v=it(t),P=v==qr||v==Hn;if(vt(t))return vr(t,i);if(v==Yr||v==Vr||P&&!a){if(n=f||P?{}:Dr(t),!i)return f?Ar(t,hr(n,t)):Or(t,cr(n,t))}else{if(!c[v])return a?t:{};n=Ur(t,v,i)}}s||(s=new dr);var O=s.get(t);if(O)return O;s.set(t,n),Hr(t)?t.forEach(function(b){n.add(Et(b,e,r,b,t,s))}):Gr(t)&&t.forEach(function(b,p){n.set(p,Et(b,e,r,p,t,s))});var y=m?f?jr:Pr:f?J:Z,_=x?void 0:y(t);return ge(_||t,function(b,p){_&&(p=b,b=t[p]),$(n,p,Et(b,e,r,p,t,s))}),n}var Zr=Et;var uf=1,df=4;function cf(t){return Zr(t,uf|df)}var kt=cf;function hf(t,e){return t!=null&&e in Object(t)}var Jr=hf;function xf(t,e,r){e=U(e,t);for(var o=-1,a=e.length,s=!1;++o<a;){var n=et(e[o]);if(!(s=t!=null&&r(t,n)))break;t=t[n]}return s||++o!=a?s:(a=t==null?0:t.length,!!a&&H(a)&&W(n,a)&&(w(t)||q(t)))}var Xr=xf;function gf(t,e){return t!=null&&Xr(t,e,Jr)}var Qr=gf;function yf(t,e,r,o){if(!j(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=et(e[a]),m=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return t;if(a!=n){var x=i[f];m=o?o(x,f,i):void 0,m===void 0&&(m=j(x)?x:W(e[a+1])?[]:{})}$(i,f,m),i=i[f]}return t}var to=yf;function bf(t,e,r){for(var o=-1,a=e.length,s={};++o<a;){var n=e[o],i=er(t,n);r(i,n)&&to(s,U(n,t),i)}return s}var eo=bf;function vf(t,e){return eo(t,e,function(r,o){return Qr(t,o)})}var ro=vf;var wf=nr(function(t,e){return t==null?{}:ro(t,e)}),Ct=wf;function oo(t){return{all:t=t||new Map,on:function(e,r){var o=t.get(e);o?o.push(r):t.set(e,[r])},off:function(e,r){var o=t.get(e);o&&(r?o.splice(o.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var o=t.get(e);o&&o.slice().map(function(a){a(r)}),(o=t.get("*"))&&o.slice().map(function(a){a(e,r)})}}}var ao="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Ut=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=ao[r[t]&63];return e};var Tf="array",Of="bit",io="bits",Af="byte",so="bytes",nt="",Pf="exponent",jf="function",no="iec",Sf="Invalid number",If="Invalid rounding method",Dt="jedec",_f="object",fo=".",Ef="round",Cf="s",Ff="si",Mf="kbit",Rf="kB",Nf=" ",Lf="string",Bf="0",zt={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function po(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:s=nt,localeOptions:n={},separator:i=nt,spacer:f=Nf,symbols:m={},standard:x=nt,output:v=Lf,fullform:P=!1,fullforms:O=[],exponent:y=-1,roundingMethod:_=Ef,precision:b=0}={}){let p=y,u=Number(t),l=[],E=0,Ft=nt;x===Ff?(o=10,x=Dt):x===no||x===Dt?o=2:o===2?x=no:(o=10,x=Dt);let ut=o===10?1e3:1024,lo=P===!0,Gt=u<0,Wt=Math[_];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(Sf);if(typeof Wt!==jf)throw new TypeError(If);if(Gt&&(u=-u),(p===-1||isNaN(p))&&(p=Math.floor(Math.log(u)/Math.log(ut)),p<0&&(p=0)),p>8&&(b>0&&(b+=8-p),p=8),v===Pf)return p;if(u===0)l[0]=0,Ft=l[1]=zt.symbol[x][e?io:so][p];else{E=u/(o===2?Math.pow(2,p*10):Math.pow(1e3,p)),e&&(E=E*8,E>=ut&&p<8&&(E=E/ut,p++));let ft=Math.pow(10,p>0?a:0);l[0]=Wt(E*ft)/ft,l[0]===ut&&p<8&&y===-1&&(l[0]=1,p++),Ft=l[1]=o===10&&p===1?e?Mf:Rf:zt.symbol[x][e?io:so][p]}if(Gt&&(l[0]=-l[0]),b>0&&(l[0]=l[0].toPrecision(b)),l[1]=m[l[1]]||l[1],s===!0?l[0]=l[0].toLocaleString():s.length>0?l[0]=l[0].toLocaleString(s,n):i.length>0&&(l[0]=l[0].toString().replace(fo,i)),r&&Number.isInteger(l[0])===!1&&a>0){let ft=i||fo,$t=l[0].toString().split(ft),Ht=$t[1]||nt,Vt=Ht.length,mo=a-Vt;l[0]=`${$t[0]}${ft}${Ht.padEnd(Vt+mo,Bf)}`}return lo&&(l[1]=O[p]?O[p]:zt.fullform[x][p]+(e?Of:Af)+(l[0]===1?nt:Cf)),v===Tf?l:v===_f?{value:l[0],symbol:l[1],exponent:p,unit:Ft}:l.join(f)}var D=class t{constructor(e){d(this,"_tera");d(this,"id");d(this,"name");d(this,"icon");d(this,"path");d(this,"url");d(this,"teraUrl");d(this,"parsedName");d(this,"created");d(this,"createdFormatted");d(this,"modified");d(this,"modifiedFormatted");d(this,"accessed");d(this,"accessedFormatted");d(this,"size");d(this,"sizeFormatted");d(this,"mime");d(this,"meta",{});if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,e);let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.teraUrl=this.url.replace(/^https?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=po(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(e){return this._tera.getProjectFileContents(this.id,e)}setContents(e){return this._tera.setProjectFileContents(this.id,e)}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Ct(this,["id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new t(Ct(e,["tera","id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]))}};var Kt=class{constructor(e){d(this,"settings",{session:null,devMode:!0,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child(e){e.siteUrl=="https://tera-tools.com/embed"?Object.assign(e,{siteUrl:"https://dev.tera-tools.com/embed",restrictOrigin:"https://dev.tera-tools.com"}):e.restrictOrigin="*"}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"https://tera-tools.com",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});d(this,"events",oo());d(this,"dom",{el:null,iframe:null,popup:null,stylesheet:null});d(this,"methods",["handshake","setServerVerbosity","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateFlush","setProjectStateRefresh","saveProjectState","replaceProjectState","getProjectFileContents","deleteProjectFile","setProjectFileContents","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiProgress","uiPrompt","uiThrow","uiSplat","uiWindow"]);d(this,"plugins",[]);d(this,"acceptPostboxes",{});e&&this.set(e)}send(e){let r=Ut();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||Ut(),...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=qt(r,e);return this.debug("INFO",3,"Created project patch",{patch:o,newState:e,oldState:r}),this.applyProjectStatePatch(o)}applyProjectStatePatch(e){if(this.settings.devMode&&this.settings.debugPaths){if(!Array.isArray(this.settings.debugPaths))throw new Error("teraFyClient.settings.debugPaths should be either null or an Array<String>");let r=e.filter(o=>this.settings.debugPaths.some(a=>o.path.join(".").slice(0,a.length)==a)).map(o=>o.path.join("."));if(r.length>0){console.info("Detected writes to",r,"- entering debugging mode");debugger}}return this.rpc("applyProjectStatePatch",e,{session:this.settings.session})}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(()=>{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?Array.isArray(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")})()):(()=>{throw new Error("Unknown terafyClient.settings.debugPaths type")})():null,this.debug("INFO",0,"Watching state paths",this.settings.debugPaths))}).then(()=>this.detectMode()).then(o=>{if(this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o,this.settings.modeOverrides[o])return this.debug("INFO",4,"[1/6] Applying specific config overrides for mode",o),this.settings.modeOverrides[o](this.settings)}).then(()=>this.debug("INFO",4,"[2/6] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>{if(this.settings.verbosity<=1){this.debug("INFO",4,"[3/6] Skip - Server verbosity is already at 1");return}else return this.debug("INFO",4,`[3/6] Set server verbosity to ${this.settings.verbosity}`),this.rpc("setServerVerbosity",this.settings.verbosity)}).then(()=>this.debug("INFO",4,`[4/6] Set server mode to "${this.settings.mode}"`)).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw`Unknown server mode "${this.settings.mode}"`})())).then(()=>this.debug("INFO",4,"[5/6] Run client plugins")).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings)))).then(()=>this.debug("INFO",4,"[6/6] Init complete")).catch(o=>this.debug("WARN",0,"Init process fault",o))}detectMode(){return this.settings.mode!="detect"?Promise.resolve(this.settings.mode):window.self===window.parent?Promise.resolve(this.settings.modeFallback):Promise.resolve().then(()=>this.settings.mode="parent").then(()=>new Promise((e,r)=>{let o=setTimeout(()=>r(),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e())})).then(()=>"parent").catch(()=>this.settings.modeFallback)}injectComms(){switch(this.settings.mode){case"child":return Promise.resolve().then(()=>new Promise(e=>{this.debug("INFO",2,"Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this.dom.el.classList.add("minimized"),document.body.append(this.dom.el),this.dom.el.addEventListener("click",()=>this.dom.el.classList.toggle("minimized")),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("INFO",3,"Embeded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe)})).then(()=>this.handshakeLoop());case"parent":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,n,i=setTimeout(()=>{clearTimeout(n),a("TIMEOUT")},r.handshakeTimeout),f=()=>{this.debug("INFO",4,"Trying handshake",++s),clearTimeout(n),n=setTimeout(f,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(i),clearTimeout(n)}).then(()=>o()).catch(a)};f()})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","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.appendChild(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){this.methods.forEach(e=>this[e]=this.rpc.bind(this,e))}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r,o){let a={ignoreNullish:!0,...o};return typeof e=="string"?(!a.ignoreNullish||r!=null)&&(this.settings[e]=r):Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r,o){return!this.settings.devMode||r===void 0?this:this.set(e,r,o)}use(e,r){let o=typeof
|
|
1
|
+
var uo=Object.defineProperty;var co=(t,e,r)=>e in t?uo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var d=(t,e,r)=>co(t,typeof e!="symbol"?e+"":e,r);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:x,diffs:v}){var A=Object.keys(i),P=A.length,y=Object.keys(f),_=y.length,b,p=i.length-f.length;if(xo(i,f)){for(var u=0;u<P;u++){var l=Array.isArray(i)?Number(A[u]):A[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:A}){var P=f[i],y=m[i];if(!(i in f)&&i in m){var _=y;A.add.push({op:"add",path:r(x),value:_})}else P!==y&&(Object(P)!==P||Object(y)!==y||ho(P,y)||!Object.keys(P).length&&!Object.keys(y).length&&String(P)!=String(y)?n(x,A,y):o({obj1:f[i],obj2:m[i],basePath:x,basePathForRemoves:v,diffs:A}))}function n(i,f,m){f.replace.push({op:"replace",path:r(i),value:m})}}function ho(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function xo(t,e){var r=t.length-e.length;if(Array.isArray(t)&&Array.isArray(e)&&r>0){for(var o=0,a=0,s=0;s<e.length&&String(t[s])===String(e[s]);s++)o++;for(var n=e.length;n>0&&String(t[n+r])===String(e[n]);n--)a++;return o>=a}return!0}var go=typeof global=="object"&&global&&global.Object===Object&&global,dt=go;var yo=typeof self=="object"&&self&&self.Object===Object&&self,bo=dt||yo||Function("return this")(),g=bo;var vo=g.Symbol,T=vo;var Yt=Object.prototype,wo=Yt.hasOwnProperty,To=Yt.toString,pt=T?T.toStringTag:void 0;function Po(t){var e=wo.call(t,pt),r=t[pt];try{t[pt]=void 0;var o=!0}catch{}var a=To.call(t);return o&&(e?t[pt]=r:delete t[pt]),a}var Zt=Po;var Oo=Object.prototype,Ao=Oo.toString;function jo(t){return Ao.call(t)}var Jt=jo;var So="[object Null]",Io="[object Undefined]",Xt=T?T.toStringTag:void 0;function _o(t){return t==null?t===void 0?Io:So:Xt&&Xt in Object(t)?Zt(t):Jt(t)}var I=_o;function Eo(t){return t!=null&&typeof t=="object"}var S=Eo;var Co="[object Symbol]";function Fo(t){return typeof t=="symbol"||S(t)&&I(t)==Co}var K=Fo;function Mo(t,e){for(var r=-1,o=t==null?0:t.length,a=Array(o);++r<o;)a[r]=e(t[r],r,t);return a}var Qt=Mo;var Ro=Array.isArray,w=Ro;var No=1/0,te=T?T.prototype:void 0,ee=te?te.toString:void 0;function re(t){if(typeof t=="string")return t;if(w(t))return Qt(t,re)+"";if(K(t))return ee?ee.call(t):"";var e=t+"";return e=="0"&&1/t==-No?"-0":e}var oe=re;function Lo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var j=Lo;function Bo(t){return t}var ae=Bo;var ko="[object AsyncFunction]",Uo="[object Function]",Do="[object GeneratorFunction]",zo="[object Proxy]";function Ko(t){if(!j(t))return!1;var e=I(t);return e==Uo||e==Do||e==ko||e==zo}var ct=Ko;var Go=g["__core-js_shared__"],ht=Go;var ie=function(){var t=/[^.]+$/.exec(ht&&ht.keys&&ht.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Wo(t){return!!ie&&ie in t}var se=Wo;var $o=Function.prototype,Ho=$o.toString;function Vo(t){if(t!=null){try{return Ho.call(t)}catch{}try{return t+""}catch{}}return""}var C=Vo;var qo=/[\\^$.*+?()[\]{}|]/g,Yo=/^\[object .+?Constructor\]$/,Zo=Function.prototype,Jo=Object.prototype,Xo=Zo.toString,Qo=Jo.hasOwnProperty,ta=RegExp("^"+Xo.call(Qo).replace(qo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ea(t){if(!j(t)||se(t))return!1;var e=ct(t)?ta:Yo;return e.test(C(t))}var ne=ea;function ra(t,e){return t==null?void 0:t[e]}var fe=ra;function oa(t,e){var r=fe(t,e);return ne(r)?r:void 0}var O=oa;var aa=O(g,"WeakMap"),xt=aa;var pe=Object.create,ia=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=ia;function sa(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var me=sa;function na(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var ue=na;var fa=800,pa=16,la=Date.now;function ma(t){var e=0,r=0;return function(){var o=la(),a=pa-(o-r);if(r=o,a>0){if(++e>=fa)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var de=ma;function ua(t){return function(){return t}}var ce=ua;var da=function(){try{var t=O(Object,"defineProperty");return t({},"",{}),t}catch{}}(),G=da;var ca=G?function(t,e){return G(t,"toString",{configurable:!0,enumerable:!1,value:ce(e),writable:!0})}:ae,he=ca;var ha=de(he),xe=ha;function xa(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var ge=xa;var ga=9007199254740991,ya=/^(?:0|[1-9]\d*)$/;function ba(t,e){var r=typeof t;return e=e==null?ga:e,!!e&&(r=="number"||r!="symbol"&&ya.test(t))&&t>-1&&t%1==0&&t<e}var W=ba;function va(t,e,r){e=="__proto__"&&G?G(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var gt=va;function wa(t,e){return t===e||t!==t&&e!==e}var yt=wa;var Ta=Object.prototype,Pa=Ta.hasOwnProperty;function Oa(t,e,r){var o=t[e];(!(Pa.call(t,e)&&yt(o,r))||r===void 0&&!(e in t))&>(t,e,r)}var $=Oa;function Aa(t,e,r,o){var a=!r;r||(r={});for(var s=-1,n=e.length;++s<n;){var i=e[s],f=o?o(r[i],t[i],i,r,t):void 0;f===void 0&&(f=t[i]),a?gt(r,i,f):$(r,i,f)}return r}var R=Aa;var ye=Math.max;function ja(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=ja;var Sa=9007199254740991;function Ia(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Sa}var H=Ia;function _a(t){return t!=null&&H(t.length)&&!ct(t)}var bt=_a;var Ea=Object.prototype;function Ca(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Ea;return t===r}var V=Ca;function Fa(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var ve=Fa;var Ma="[object Arguments]";function Ra(t){return S(t)&&I(t)==Ma}var Mt=Ra;var we=Object.prototype,Na=we.hasOwnProperty,La=we.propertyIsEnumerable,Ba=Mt(function(){return arguments}())?Mt:function(t){return S(t)&&Na.call(t,"callee")&&!La.call(t,"callee")},q=Ba;function ka(){return!1}var Te=ka;var Ae=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pe=Ae&&typeof module=="object"&&module&&!module.nodeType&&module,Ua=Pe&&Pe.exports===Ae,Oe=Ua?g.Buffer:void 0,Da=Oe?Oe.isBuffer:void 0,za=Da||Te,vt=za;var Ka="[object Arguments]",Ga="[object Array]",Wa="[object Boolean]",$a="[object Date]",Ha="[object Error]",Va="[object Function]",qa="[object Map]",Ya="[object Number]",Za="[object Object]",Ja="[object RegExp]",Xa="[object Set]",Qa="[object String]",ti="[object WeakMap]",ei="[object ArrayBuffer]",ri="[object DataView]",oi="[object Float32Array]",ai="[object Float64Array]",ii="[object Int8Array]",si="[object Int16Array]",ni="[object Int32Array]",fi="[object Uint8Array]",pi="[object Uint8ClampedArray]",li="[object Uint16Array]",mi="[object Uint32Array]",h={};h[oi]=h[ai]=h[ii]=h[si]=h[ni]=h[fi]=h[pi]=h[li]=h[mi]=!0;h[Ka]=h[Ga]=h[ei]=h[Wa]=h[ri]=h[$a]=h[Ha]=h[Va]=h[qa]=h[Ya]=h[Za]=h[Ja]=h[Xa]=h[Qa]=h[ti]=!1;function ui(t){return S(t)&&H(t.length)&&!!h[I(t)]}var je=ui;function di(t){return function(e){return t(e)}}var Y=di;var Se=typeof exports=="object"&&exports&&!exports.nodeType&&exports,lt=Se&&typeof module=="object"&&module&&!module.nodeType&&module,ci=lt&<.exports===Se,Rt=ci&&dt.process,hi=function(){try{var t=lt&<.require&<.require("util").types;return t||Rt&&Rt.binding&&Rt.binding("util")}catch{}}(),F=hi;var Ie=F&&F.isTypedArray,xi=Ie?Y(Ie):je,_e=xi;var gi=Object.prototype,yi=gi.hasOwnProperty;function bi(t,e){var r=w(t),o=!r&&q(t),a=!r&&!o&&vt(t),s=!r&&!o&&!a&&_e(t),n=r||o||a||s,i=n?ve(t.length,String):[],f=i.length;for(var m in t)(e||yi.call(t,m))&&!(n&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||W(m,f)))&&i.push(m);return i}var wt=bi;function vi(t,e){return function(r){return t(e(r))}}var Tt=vi;var wi=Tt(Object.keys,Object),Ee=wi;var Ti=Object.prototype,Pi=Ti.hasOwnProperty;function Oi(t){if(!V(t))return Ee(t);var e=[];for(var r in Object(t))Pi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ce=Oi;function Ai(t){return bt(t)?wt(t):Ce(t)}var Z=Ai;function ji(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Fe=ji;var Si=Object.prototype,Ii=Si.hasOwnProperty;function _i(t){if(!j(t))return Fe(t);var e=V(t),r=[];for(var o in t)o=="constructor"&&(e||!Ii.call(t,o))||r.push(o);return r}var Me=_i;function Ei(t){return bt(t)?wt(t,!0):Me(t)}var J=Ei;var Ci=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Fi=/^\w*$/;function Mi(t,e){if(w(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||K(t)?!0:Fi.test(t)||!Ci.test(t)||e!=null&&t in Object(e)}var Re=Mi;var Ri=O(Object,"create"),M=Ri;function Ni(){this.__data__=M?M(null):{},this.size=0}var Ne=Ni;function Li(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Le=Li;var Bi="__lodash_hash_undefined__",ki=Object.prototype,Ui=ki.hasOwnProperty;function Di(t){var e=this.__data__;if(M){var r=e[t];return r===Bi?void 0:r}return Ui.call(e,t)?e[t]:void 0}var Be=Di;var zi=Object.prototype,Ki=zi.hasOwnProperty;function Gi(t){var e=this.__data__;return M?e[t]!==void 0:Ki.call(e,t)}var ke=Gi;var Wi="__lodash_hash_undefined__";function $i(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=M&&e===void 0?Wi:e,this}var Ue=$i;function X(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}X.prototype.clear=Ne;X.prototype.delete=Le;X.prototype.get=Be;X.prototype.has=ke;X.prototype.set=Ue;var Nt=X;function Hi(){this.__data__=[],this.size=0}var De=Hi;function Vi(t,e){for(var r=t.length;r--;)if(yt(t[r][0],e))return r;return-1}var N=Vi;var qi=Array.prototype,Yi=qi.splice;function Zi(t){var e=this.__data__,r=N(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Yi.call(e,r,1),--this.size,!0}var ze=Zi;function Ji(t){var e=this.__data__,r=N(e,t);return r<0?void 0:e[r][1]}var Ke=Ji;function Xi(t){return N(this.__data__,t)>-1}var Ge=Xi;function Qi(t,e){var r=this.__data__,o=N(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}var We=Qi;function Q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Q.prototype.clear=De;Q.prototype.delete=ze;Q.prototype.get=Ke;Q.prototype.has=Ge;Q.prototype.set=We;var L=Q;var ts=O(g,"Map"),B=ts;function es(){this.size=0,this.__data__={hash:new Nt,map:new(B||L),string:new Nt}}var $e=es;function rs(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var He=rs;function os(t,e){var r=t.__data__;return He(e)?r[typeof e=="string"?"string":"hash"]:r.map}var k=os;function as(t){var e=k(this,t).delete(t);return this.size-=e?1:0,e}var Ve=as;function is(t){return k(this,t).get(t)}var qe=is;function ss(t){return k(this,t).has(t)}var Ye=ss;function ns(t,e){var r=k(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ze=ns;function tt(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}tt.prototype.clear=$e;tt.prototype.delete=Ve;tt.prototype.get=qe;tt.prototype.has=Ye;tt.prototype.set=Ze;var mt=tt;var fs="Expected a function";function Lt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(fs);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],s=r.cache;if(s.has(a))return s.get(a);var n=t.apply(this,o);return r.cache=s.set(a,n)||s,n};return r.cache=new(Lt.Cache||mt),r}Lt.Cache=mt;var Je=Lt;var ps=500;function ls(t){var e=Je(t,function(o){return r.size===ps&&r.clear(),o}),r=e.cache;return e}var Xe=ls;var ms=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,us=/\\(\\)?/g,ds=Xe(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(ms,function(r,o,a,s){e.push(a?s.replace(us,"$1"):o||r)}),e}),Qe=ds;function cs(t){return t==null?"":oe(t)}var tr=cs;function hs(t,e){return w(t)?t:Re(t,e)?[t]:Qe(tr(t))}var U=hs;var xs=1/0;function gs(t){if(typeof t=="string"||K(t))return t;var e=t+"";return e=="0"&&1/t==-xs?"-0":e}var et=gs;function ys(t,e){e=U(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[et(e[r++])];return r&&r==o?t:void 0}var er=ys;function bs(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var rt=bs;var rr=T?T.isConcatSpreadable:void 0;function vs(t){return w(t)||q(t)||!!(rr&&t&&t[rr])}var or=vs;function ar(t,e,r,o,a){var s=-1,n=t.length;for(r||(r=or),a||(a=[]);++s<n;){var i=t[s];e>0&&r(i)?e>1?ar(i,e-1,r,o,a):rt(a,i):o||(a[a.length]=i)}return a}var ir=ar;function ws(t){var e=t==null?0:t.length;return e?ir(t,1):[]}var sr=ws;function Ts(t){return xe(be(t,void 0,sr),t+"")}var nr=Ts;var Ps=Tt(Object.getPrototypeOf,Object),Pt=Ps;function Os(){this.__data__=new L,this.size=0}var fr=Os;function As(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var pr=As;function js(t){return this.__data__.get(t)}var lr=js;function Ss(t){return this.__data__.has(t)}var mr=Ss;var Is=200;function _s(t,e){var r=this.__data__;if(r instanceof L){var o=r.__data__;if(!B||o.length<Is-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new mt(o)}return r.set(t,e),this.size=r.size,this}var ur=_s;function ot(t){var e=this.__data__=new L(t);this.size=e.size}ot.prototype.clear=fr;ot.prototype.delete=pr;ot.prototype.get=lr;ot.prototype.has=mr;ot.prototype.set=ur;var dr=ot;function Es(t,e){return t&&R(e,Z(e),t)}var cr=Es;function Cs(t,e){return t&&R(e,J(e),t)}var hr=Cs;var br=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xr=br&&typeof module=="object"&&module&&!module.nodeType&&module,Fs=xr&&xr.exports===br,gr=Fs?g.Buffer:void 0,yr=gr?gr.allocUnsafe:void 0;function Ms(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=Ms;function Rs(t,e){for(var r=-1,o=t==null?0:t.length,a=0,s=[];++r<o;){var n=t[r];e(n,r,t)&&(s[a++]=n)}return s}var wr=Rs;function Ns(){return[]}var Ot=Ns;var Ls=Object.prototype,Bs=Ls.propertyIsEnumerable,Tr=Object.getOwnPropertySymbols,ks=Tr?function(t){return t==null?[]:(t=Object(t),wr(Tr(t),function(e){return Bs.call(t,e)}))}:Ot,at=ks;function Us(t,e){return R(t,at(t),e)}var Pr=Us;var Ds=Object.getOwnPropertySymbols,zs=Ds?function(t){for(var e=[];t;)rt(e,at(t)),t=Pt(t);return e}:Ot,At=zs;function Ks(t,e){return R(t,At(t),e)}var Or=Ks;function Gs(t,e,r){var o=e(t);return w(t)?o:rt(o,r(t))}var jt=Gs;function Ws(t){return jt(t,Z,at)}var Ar=Ws;function $s(t){return jt(t,J,At)}var jr=$s;var Hs=O(g,"DataView"),St=Hs;var Vs=O(g,"Promise"),It=Vs;var qs=O(g,"Set"),_t=qs;var Sr="[object Map]",Ys="[object Object]",Ir="[object Promise]",_r="[object Set]",Er="[object WeakMap]",Cr="[object DataView]",Zs=C(St),Js=C(B),Xs=C(It),Qs=C(_t),tn=C(xt),z=I;(St&&z(new St(new ArrayBuffer(1)))!=Cr||B&&z(new B)!=Sr||It&&z(It.resolve())!=Ir||_t&&z(new _t)!=_r||xt&&z(new xt)!=Er)&&(z=function(t){var e=I(t),r=e==Ys?t.constructor:void 0,o=r?C(r):"";if(o)switch(o){case Zs:return Cr;case Js:return Sr;case Xs:return Ir;case Qs:return _r;case tn:return Er}return e});var it=z;var en=Object.prototype,rn=en.hasOwnProperty;function on(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&rn.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Fr=on;var an=g.Uint8Array,Bt=an;function sn(t){var e=new t.constructor(t.byteLength);return new Bt(e).set(new Bt(t)),e}var st=sn;function nn(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Mr=nn;var fn=/\w*$/;function pn(t){var e=new t.constructor(t.source,fn.exec(t));return e.lastIndex=t.lastIndex,e}var Rr=pn;var Nr=T?T.prototype:void 0,Lr=Nr?Nr.valueOf:void 0;function ln(t){return Lr?Object(Lr.call(t)):{}}var Br=ln;function mn(t,e){var r=e?st(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var kr=mn;var un="[object Boolean]",dn="[object Date]",cn="[object Map]",hn="[object Number]",xn="[object RegExp]",gn="[object Set]",yn="[object String]",bn="[object Symbol]",vn="[object ArrayBuffer]",wn="[object DataView]",Tn="[object Float32Array]",Pn="[object Float64Array]",On="[object Int8Array]",An="[object Int16Array]",jn="[object Int32Array]",Sn="[object Uint8Array]",In="[object Uint8ClampedArray]",_n="[object Uint16Array]",En="[object Uint32Array]";function Cn(t,e,r){var o=t.constructor;switch(e){case vn:return st(t);case un:case dn:return new o(+t);case wn:return Mr(t,r);case Tn:case Pn:case On:case An:case jn:case Sn:case In:case _n:case En:return kr(t,r);case cn:return new o;case hn:case yn:return new o(t);case xn:return Rr(t);case gn:return new o;case bn:return Br(t)}}var Ur=Cn;function Fn(t){return typeof t.constructor=="function"&&!V(t)?le(Pt(t)):{}}var Dr=Fn;var Mn="[object Map]";function Rn(t){return S(t)&&it(t)==Mn}var zr=Rn;var Kr=F&&F.isMap,Nn=Kr?Y(Kr):zr,Gr=Nn;var Ln="[object Set]";function Bn(t){return S(t)&&it(t)==Ln}var Wr=Bn;var $r=F&&F.isSet,kn=$r?Y($r):Wr,Hr=kn;var Un=1,Dn=2,zn=4,Vr="[object Arguments]",Kn="[object Array]",Gn="[object Boolean]",Wn="[object Date]",$n="[object Error]",qr="[object Function]",Hn="[object GeneratorFunction]",Vn="[object Map]",qn="[object Number]",Yr="[object Object]",Yn="[object RegExp]",Zn="[object Set]",Jn="[object String]",Xn="[object Symbol]",Qn="[object WeakMap]",tf="[object ArrayBuffer]",ef="[object DataView]",rf="[object Float32Array]",of="[object Float64Array]",af="[object Int8Array]",sf="[object Int16Array]",nf="[object Int32Array]",ff="[object Uint8Array]",pf="[object Uint8ClampedArray]",lf="[object Uint16Array]",mf="[object Uint32Array]",c={};c[Vr]=c[Kn]=c[tf]=c[ef]=c[Gn]=c[Wn]=c[rf]=c[of]=c[af]=c[sf]=c[nf]=c[Vn]=c[qn]=c[Yr]=c[Yn]=c[Zn]=c[Jn]=c[Xn]=c[ff]=c[pf]=c[lf]=c[mf]=!0;c[$n]=c[qr]=c[Qn]=!1;function Et(t,e,r,o,a,s){var n,i=e&Un,f=e&Dn,m=e&zn;if(r&&(n=a?r(t,o,a,s):r(t)),n!==void 0)return n;if(!j(t))return t;var x=w(t);if(x){if(n=Fr(t),!i)return ue(t,n)}else{var v=it(t),A=v==qr||v==Hn;if(vt(t))return vr(t,i);if(v==Yr||v==Vr||A&&!a){if(n=f||A?{}:Dr(t),!i)return f?Or(t,hr(n,t)):Pr(t,cr(n,t))}else{if(!c[v])return a?t:{};n=Ur(t,v,i)}}s||(s=new dr);var P=s.get(t);if(P)return P;s.set(t,n),Hr(t)?t.forEach(function(b){n.add(Et(b,e,r,b,t,s))}):Gr(t)&&t.forEach(function(b,p){n.set(p,Et(b,e,r,p,t,s))});var y=m?f?jr:Ar:f?J:Z,_=x?void 0:y(t);return ge(_||t,function(b,p){_&&(p=b,b=t[p]),$(n,p,Et(b,e,r,p,t,s))}),n}var Zr=Et;var uf=1,df=4;function cf(t){return Zr(t,uf|df)}var kt=cf;function hf(t,e){return t!=null&&e in Object(t)}var Jr=hf;function xf(t,e,r){e=U(e,t);for(var o=-1,a=e.length,s=!1;++o<a;){var n=et(e[o]);if(!(s=t!=null&&r(t,n)))break;t=t[n]}return s||++o!=a?s:(a=t==null?0:t.length,!!a&&H(a)&&W(n,a)&&(w(t)||q(t)))}var Xr=xf;function gf(t,e){return t!=null&&Xr(t,e,Jr)}var Qr=gf;function yf(t,e,r,o){if(!j(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=et(e[a]),m=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return t;if(a!=n){var x=i[f];m=o?o(x,f,i):void 0,m===void 0&&(m=j(x)?x:W(e[a+1])?[]:{})}$(i,f,m),i=i[f]}return t}var to=yf;function bf(t,e,r){for(var o=-1,a=e.length,s={};++o<a;){var n=e[o],i=er(t,n);r(i,n)&&to(s,U(n,t),i)}return s}var eo=bf;function vf(t,e){return eo(t,e,function(r,o){return Qr(t,o)})}var ro=vf;var wf=nr(function(t,e){return t==null?{}:ro(t,e)}),Ct=wf;function oo(t){return{all:t=t||new Map,on:function(e,r){var o=t.get(e);o?o.push(r):t.set(e,[r])},off:function(e,r){var o=t.get(e);o&&(r?o.splice(o.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var o=t.get(e);o&&o.slice().map(function(a){a(r)}),(o=t.get("*"))&&o.slice().map(function(a){a(e,r)})}}}var ao="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Ut=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=ao[r[t]&63];return e};var Tf="array",Pf="bit",io="bits",Of="byte",so="bytes",nt="",Af="exponent",jf="function",no="iec",Sf="Invalid number",If="Invalid rounding method",Dt="jedec",_f="object",fo=".",Ef="round",Cf="s",Ff="si",Mf="kbit",Rf="kB",Nf=" ",Lf="string",Bf="0",zt={symbol:{iec:{bits:["bit","Kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["bit","Kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},fullform:{iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]}};function po(t,{bits:e=!1,pad:r=!1,base:o=-1,round:a=2,locale:s=nt,localeOptions:n={},separator:i=nt,spacer:f=Nf,symbols:m={},standard:x=nt,output:v=Lf,fullform:A=!1,fullforms:P=[],exponent:y=-1,roundingMethod:_=Ef,precision:b=0}={}){let p=y,u=Number(t),l=[],E=0,Ft=nt;x===Ff?(o=10,x=Dt):x===no||x===Dt?o=2:o===2?x=no:(o=10,x=Dt);let ut=o===10?1e3:1024,lo=A===!0,Gt=u<0,Wt=Math[_];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(Sf);if(typeof Wt!==jf)throw new TypeError(If);if(Gt&&(u=-u),(p===-1||isNaN(p))&&(p=Math.floor(Math.log(u)/Math.log(ut)),p<0&&(p=0)),p>8&&(b>0&&(b+=8-p),p=8),v===Af)return p;if(u===0)l[0]=0,Ft=l[1]=zt.symbol[x][e?io:so][p];else{E=u/(o===2?Math.pow(2,p*10):Math.pow(1e3,p)),e&&(E=E*8,E>=ut&&p<8&&(E=E/ut,p++));let ft=Math.pow(10,p>0?a:0);l[0]=Wt(E*ft)/ft,l[0]===ut&&p<8&&y===-1&&(l[0]=1,p++),Ft=l[1]=o===10&&p===1?e?Mf:Rf:zt.symbol[x][e?io:so][p]}if(Gt&&(l[0]=-l[0]),b>0&&(l[0]=l[0].toPrecision(b)),l[1]=m[l[1]]||l[1],s===!0?l[0]=l[0].toLocaleString():s.length>0?l[0]=l[0].toLocaleString(s,n):i.length>0&&(l[0]=l[0].toString().replace(fo,i)),r&&Number.isInteger(l[0])===!1&&a>0){let ft=i||fo,$t=l[0].toString().split(ft),Ht=$t[1]||nt,Vt=Ht.length,mo=a-Vt;l[0]=`${$t[0]}${ft}${Ht.padEnd(Vt+mo,Bf)}`}return lo&&(l[1]=P[p]?P[p]:zt.fullform[x][p]+(e?Pf:Of)+(l[0]===1?nt:Cf)),v===Tf?l:v===_f?{value:l[0],symbol:l[1],exponent:p,unit:Ft}:l.join(f)}var D=class t{constructor(e){d(this,"_tera");d(this,"id");d(this,"name");d(this,"icon");d(this,"path");d(this,"url");d(this,"teraUrl");d(this,"parsedName");d(this,"created");d(this,"createdFormatted");d(this,"modified");d(this,"modifiedFormatted");d(this,"accessed");d(this,"accessedFormatted");d(this,"size");d(this,"sizeFormatted");d(this,"mime");d(this,"meta",{});if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,e);let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.teraUrl=this.url.replace(/^https?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=po(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(e){return this._tera.getProjectFileContents(this.id,e)}setContents(e){return this._tera.setProjectFileContents(this.id,e)}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Ct(this,["id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new t(Ct(e,["tera","id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]))}};var Kt=class{constructor(e){d(this,"settings",{session:null,devMode:!1,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child(e){e.siteUrl=="https://tera-tools.com/embed"&&Object.assign(e,{siteUrl:"https://dev.tera-tools.com/embed",restrictOrigin:"https://dev.tera-tools.com"})}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"https://tera-tools.com",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});d(this,"events",oo());d(this,"dom",{el:null,iframe:null,popup:null,stylesheet:null});d(this,"methods",["handshake","setServerVerbosity","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateFlush","setProjectStateRefresh","saveProjectState","replaceProjectState","getProjectFileContents","deleteProjectFile","setProjectFileContents","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiProgress","uiPrompt","uiThrow","uiSplat","uiWindow"]);d(this,"plugins",[]);d(this,"acceptPostboxes",{});e&&this.set(e)}send(e){let r=Ut();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||Ut(),...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 Promise.resolve();let r=e.data;return!r.TERA||!r.id?Promise.resolve():(this.debug("INFO",3,"Recieved message",r),(r==null?void 0:r.action)=="response"&&this.acceptPostboxes[r.id]?(r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response),Promise.resolve()):(r==null?void 0:r.action)=="rpc"?Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})}):(r==null?void 0:r.action)=="event"?Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o}):r!=null&&r.id?(this.debug("INFO",3,`Ignoring message ID ${r.id} - was meant for someone else?`),Promise.resolve()):(this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r}),Promise.resolve()))}createProjectStatePatch(e,r){let o=qt(r,e);return this.debug("INFO",3,"Created project patch",{patch:o,newState:e,oldState:r}),this.applyProjectStatePatch(o)}applyProjectStatePatch(e){if(this.settings.devMode&&this.settings.debugPaths){if(!Array.isArray(this.settings.debugPaths))throw new Error("teraFyClient.settings.debugPaths should be either null or an Array<String>");let r=e.filter(o=>this.settings.debugPaths.some(a=>o.path.join(".").slice(0,a.length)==a)).map(o=>o.path.join("."));if(r.length>0){console.info("Detected writes to",r,"- entering debugging mode");debugger}}return this.rpc("applyProjectStatePatch",e,{session:this.settings.session})}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(()=>{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?Array.isArray(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")})()):(()=>{throw new Error("Unknown terafyClient.settings.debugPaths type")})():null,this.debug("INFO",0,"Watching state paths",this.settings.debugPaths))}).then(()=>this.detectMode()).then(o=>{if(this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o,this.settings.modeOverrides[o])return this.debug("INFO",4,"[1/6] Applying specific config overrides for mode",o),this.settings.modeOverrides[o](this.settings)}).then(()=>this.debug("INFO",4,"[2/6] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>{if(this.settings.verbosity<=1){this.debug("INFO",4,"[3/6] Skip - Server verbosity is already at 1");return}else return this.debug("INFO",4,`[3/6] Set server verbosity to ${this.settings.verbosity}`),this.rpc("setServerVerbosity",this.settings.verbosity)}).then(()=>this.debug("INFO",4,`[4/6] Set server mode to "${this.settings.mode}"`)).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw`Unknown server mode "${this.settings.mode}"`})())).then(()=>this.debug("INFO",4,"[5/6] Run client plugins")).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings)))).then(()=>this.debug("INFO",4,"[6/6] Init complete")).catch(o=>this.debug("WARN",0,"Init process fault",o))}detectMode(){return this.settings.mode!="detect"?Promise.resolve(this.settings.mode):window.self===window.parent?Promise.resolve(this.settings.modeFallback):Promise.resolve().then(()=>this.settings.mode="parent").then(()=>new Promise((e,r)=>{let o=setTimeout(()=>r(),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e())})).then(()=>"parent").catch(()=>this.settings.modeFallback)}injectComms(){switch(this.settings.mode){case"child":return Promise.resolve().then(()=>new Promise(e=>{this.debug("INFO",2,"Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this.dom.el.classList.add("minimized"),document.body.append(this.dom.el),this.dom.el.addEventListener("click",()=>this.dom.el.classList.toggle("minimized")),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("INFO",3,"Embeded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe)})).then(()=>this.handshakeLoop());case"parent":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,n,i=setTimeout(()=>{clearTimeout(n),a("TIMEOUT")},r.handshakeTimeout),f=()=>{this.debug("INFO",4,"Trying handshake",++s),clearTimeout(n),n=setTimeout(f,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(i),clearTimeout(n)}).then(()=>o()).catch(a)};f()})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","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.appendChild(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){this.methods.forEach(e=>this[e]=this.rpc.bind(this,e))}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r,o){let a={ignoreNullish:!0,...o};return typeof e=="string"?(!a.ignoreNullish||r!=null)&&(this.settings[e]=r):Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r,o){return!this.settings.devMode||r===void 0?this:this.set(e,r,o)}use(e,r){let o=typeof e=="function"?new e(this,r):typeof e=="object"?e:typeof e=="string"?(()=>{throw new Error("use(String) is not yet supported")})():(()=>{throw new Error("Expected use() call to be provided with a class initalizer")})();return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){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"){var r;return e==="toggle"?this.settings.devMode=!this.settings.devMode:e==="proxy"?Object.assign(this.settings,{devMode:!0,siteUrl:"http://localhost:7334/embed",mode:"child"}):this.settings.devMode=!!e,this.settings.devMode&&(this.settings.restrictOrigin="*"),(r=this.dom)!=null&&r.el&&this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this}toggleFocus(e="toggle"){this.debug("INFO",2,"Request focus",{isFocused:e}),globalThis.document.body.classList.toggle("tera-fy-focus",e==="toggle"?void 0:e)}getEntropicString(e=32){let r=new Uint32Array(4);return window.crypto.getRandomValues(r),btoa(String.fromCharCode(...new Uint8Array(r.buffer))).replace(/[+/]/g,"").slice(0,e)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new D({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new D({tera:this,...o})))}getProjectFile(e,r){return this.rpc("getProjectFile",e,r).then(o=>o&&new D({tera:this,...o}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new D({tera:this,...r}))}};export{Kt as default};
|
|
3
3
|
/*! Bundled license information:
|
|
4
4
|
|
|
5
5
|
lodash-es/lodash.js:
|
package/dist/terafy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
function Vt(t,e,r){if(!t||typeof t!="object"||!e||typeof e!="object")throw new Error("both arguments must be objects or arrays");r||(r=function(i){return i});function o({obj1:i,obj2:f,basePath:m,basePathForRemoves:h,diffs:b}){var A=Object.keys(i),T=A.length,x=Object.keys(f),I=x.length,y,p=i.length-f.length;if(uo(i,f)){for(var u=0;u<T;u++){var l=Array.isArray(i)?Number(A[u]):A[u];l in f||(y=h.concat(l),b.remove.push({op:"remove",path:r(y)}))}for(var u=0;u<I;u++){var l=Array.isArray(f)?Number(x[u]):x[u];s({key:l,obj1:i,obj2:f,path:m.concat(l),pathForRemoves:m.concat(l),diffs:b})}}else{for(var u=0;u<p;u++)y=h.concat(u),b.remove.push({op:"remove",path:r(y)});for(var _=i.slice(p),u=0;u<I;u++)s({key:u,obj1:_,obj2:f,path:m.concat(u),pathForRemoves:m.concat(u+p),diffs:b})}}var a={remove:[],replace:[],add:[]};return o({obj1:t,obj2:e,basePath:[],basePathForRemoves:[],diffs:a}),a.remove.reverse().concat(a.replace).concat(a.add);function s({key:i,obj1:f,obj2:m,path:h,pathForRemoves:b,diffs:A}){var T=f[i],x=m[i];if(!(i in f)&&i in m){var I=x;A.add.push({op:"add",path:r(h),value:I})}else T!==x&&(Object(T)!==T||Object(x)!==x||mo(T,x)||!Object.keys(T).length&&!Object.keys(x).length&&String(T)!=String(x)?n(h,A,x):o({obj1:f[i],obj2:m[i],basePath:h,basePathForRemoves:b,diffs:A}))}function n(i,f,m){f.replace.push({op:"replace",path:r(i),value:m})}}function mo(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function uo(t,e){var r=t.length-e.length;if(Array.isArray(t)&&Array.isArray(e)&&r>0){for(var o=0,a=0,s=0;s<e.length&&String(t[s])===String(e[s]);s++)o++;for(var n=e.length;n>0&&String(t[n+r])===String(e[n]);n--)a++;return o>=a}return!0}var co=typeof global=="object"&&global&&global.Object===Object&&global,ut=co;var ho=typeof self=="object"&&self&&self.Object===Object&&self,go=ut||ho||Function("return this")(),g=go;var xo=g.Symbol,w=xo;var qt=Object.prototype,yo=qt.hasOwnProperty,bo=qt.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 Yt=vo;var wo=Object.prototype,To=wo.toString;function Oo(t){return To.call(t)}var Zt=Oo;var Ao="[object Null]",Po="[object Undefined]",Jt=w?w.toStringTag:void 0;function jo(t){return t==null?t===void 0?Po:Ao:Jt&&Jt in Object(t)?Yt(t):Zt(t)}var S=jo;function So(t){return t!=null&&typeof t=="object"}var j=So;var Io="[object Symbol]";function _o(t){return typeof t=="symbol"||j(t)&&S(t)==Io}var z=_o;function Eo(t,e){for(var r=-1,o=t==null?0:t.length,a=Array(o);++r<o;)a[r]=e(t[r],r,t);return a}var Xt=Eo;var Co=Array.isArray,v=Co;var Fo=1/0,Qt=w?w.prototype:void 0,te=Qt?Qt.toString:void 0;function ee(t){if(typeof t=="string")return t;if(v(t))return Xt(t,ee)+"";if(z(t))return te?te.call(t):"";var e=t+"";return e=="0"&&1/t==-Fo?"-0":e}var re=ee;function Mo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var P=Mo;function Ro(t){return t}var oe=Ro;var No="[object AsyncFunction]",Lo="[object Function]",Bo="[object GeneratorFunction]",ko="[object Proxy]";function Uo(t){if(!P(t))return!1;var e=S(t);return e==Lo||e==Bo||e==No||e==ko}var dt=Uo;var Do=g["__core-js_shared__"],ct=Do;var ae=function(){var t=/[^.]+$/.exec(ct&&ct.keys&&ct.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function zo(t){return!!ae&&ae in t}var ie=zo;var Ko=Function.prototype,Go=Ko.toString;function Wo(t){if(t!=null){try{return Go.call(t)}catch{}try{return t+""}catch{}}return""}var E=Wo;var $o=/[\\^$.*+?()[\]{}|]/g,Ho=/^\[object .+?Constructor\]$/,Vo=Function.prototype,qo=Object.prototype,Yo=Vo.toString,Zo=qo.hasOwnProperty,Jo=RegExp("^"+Yo.call(Zo).replace($o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Xo(t){if(!P(t)||ie(t))return!1;var e=dt(t)?Jo:Ho;return e.test(E(t))}var se=Xo;function Qo(t,e){return t?.[e]}var ne=Qo;function ta(t,e){var r=ne(t,e);return se(r)?r:void 0}var O=ta;var ea=O(g,"WeakMap"),ht=ea;var fe=Object.create,ra=function(){function t(){}return function(e){if(!P(e))return{};if(fe)return fe(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),pe=ra;function oa(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var le=oa;function aa(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var me=aa;var ia=800,sa=16,na=Date.now;function fa(t){var e=0,r=0;return function(){var o=na(),a=sa-(o-r);if(r=o,a>0){if(++e>=ia)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var ue=fa;function pa(t){return function(){return t}}var de=pa;var la=function(){try{var t=O(Object,"defineProperty");return t({},"",{}),t}catch{}}(),K=la;var ma=K?function(t,e){return K(t,"toString",{configurable:!0,enumerable:!1,value:de(e),writable:!0})}:oe,ce=ma;var ua=ue(ce),he=ua;function da(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var ge=da;var ca=9007199254740991,ha=/^(?:0|[1-9]\d*)$/;function ga(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=ga;function xa(t,e,r){e=="__proto__"&&K?K(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var gt=xa;function ya(t,e){return t===e||t!==t&&e!==e}var xt=ya;var ba=Object.prototype,va=ba.hasOwnProperty;function wa(t,e,r){var o=t[e];(!(va.call(t,e)&&xt(o,r))||r===void 0&&!(e in t))&>(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?gt(r,i,f):W(r,i,f)}return r}var M=Ta;var xe=Math.max;function Oa(t,e,r){return e=xe(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=xe(o.length-e,0),n=Array(s);++a<s;)n[a]=o[e+a];a=-1;for(var i=Array(e+1);++a<e;)i[a]=o[a];return i[e]=r(n),le(t,this,i)}}var ye=Oa;var Aa=9007199254740991;function Pa(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Aa}var $=Pa;function ja(t){return t!=null&&$(t.length)&&!dt(t)}var yt=ja;var Sa=Object.prototype;function Ia(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Sa;return t===r}var H=Ia;function _a(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var be=_a;var Ea="[object Arguments]";function Ca(t){return j(t)&&S(t)==Ea}var Ft=Ca;var ve=Object.prototype,Fa=ve.hasOwnProperty,Ma=ve.propertyIsEnumerable,Ra=Ft(function(){return arguments}())?Ft:function(t){return j(t)&&Fa.call(t,"callee")&&!Ma.call(t,"callee")},V=Ra;function Na(){return!1}var we=Na;var Ae=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Te=Ae&&typeof module=="object"&&module&&!module.nodeType&&module,La=Te&&Te.exports===Ae,Oe=La?g.Buffer:void 0,Ba=Oe?Oe.isBuffer:void 0,ka=Ba||we,bt=ka;var Ua="[object Arguments]",Da="[object Array]",za="[object Boolean]",Ka="[object Date]",Ga="[object Error]",Wa="[object Function]",$a="[object Map]",Ha="[object Number]",Va="[object Object]",qa="[object RegExp]",Ya="[object Set]",Za="[object String]",Ja="[object WeakMap]",Xa="[object ArrayBuffer]",Qa="[object DataView]",ti="[object Float32Array]",ei="[object Float64Array]",ri="[object Int8Array]",oi="[object Int16Array]",ai="[object Int32Array]",ii="[object Uint8Array]",si="[object Uint8ClampedArray]",ni="[object Uint16Array]",fi="[object Uint32Array]",c={};c[ti]=c[ei]=c[ri]=c[oi]=c[ai]=c[ii]=c[si]=c[ni]=c[fi]=!0;c[Ua]=c[Da]=c[Xa]=c[za]=c[Qa]=c[Ka]=c[Ga]=c[Wa]=c[$a]=c[Ha]=c[Va]=c[qa]=c[Ya]=c[Za]=c[Ja]=!1;function pi(t){return j(t)&&$(t.length)&&!!c[S(t)]}var Pe=pi;function li(t){return function(e){return t(e)}}var q=li;var je=typeof exports=="object"&&exports&&!exports.nodeType&&exports,pt=je&&typeof module=="object"&&module&&!module.nodeType&&module,mi=pt&&pt.exports===je,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 Se=C&&C.isTypedArray,di=Se?q(Se):Pe,Ie=di;var ci=Object.prototype,hi=ci.hasOwnProperty;function gi(t,e){var r=v(t),o=!r&&V(t),a=!r&&!o&&bt(t),s=!r&&!o&&!a&&Ie(t),n=r||o||a||s,i=n?be(t.length,String):[],f=i.length;for(var m in t)(e||hi.call(t,m))&&!(n&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||G(m,f)))&&i.push(m);return i}var vt=gi;function xi(t,e){return function(r){return t(e(r))}}var wt=xi;var yi=wt(Object.keys,Object),_e=yi;var bi=Object.prototype,vi=bi.hasOwnProperty;function wi(t){if(!H(t))return _e(t);var e=[];for(var r in Object(t))vi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ee=wi;function Ti(t){return yt(t)?vt(t):Ee(t)}var Y=Ti;function Oi(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Ce=Oi;var Ai=Object.prototype,Pi=Ai.hasOwnProperty;function ji(t){if(!P(t))return Ce(t);var e=H(t),r=[];for(var o in t)o=="constructor"&&(e||!Pi.call(t,o))||r.push(o);return r}var Fe=ji;function Si(t){return yt(t)?vt(t,!0):Fe(t)}var Z=Si;var Ii=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_i=/^\w*$/;function Ei(t,e){if(v(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||z(t)?!0:_i.test(t)||!Ii.test(t)||e!=null&&t in Object(e)}var Me=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 Ne=Mi;var Ri="__lodash_hash_undefined__",Ni=Object.prototype,Li=Ni.hasOwnProperty;function Bi(t){var e=this.__data__;if(F){var r=e[t];return r===Ri?void 0:r}return Li.call(e,t)?e[t]:void 0}var Le=Bi;var ki=Object.prototype,Ui=ki.hasOwnProperty;function Di(t){var e=this.__data__;return F?e[t]!==void 0:Ui.call(e,t)}var Be=Di;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 ke=Ki;function J(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}J.prototype.clear=Re;J.prototype.delete=Ne;J.prototype.get=Le;J.prototype.has=Be;J.prototype.set=ke;var Rt=J;function Gi(){this.__data__=[],this.size=0}var Ue=Gi;function Wi(t,e){for(var r=t.length;r--;)if(xt(t[r][0],e))return r;return-1}var R=Wi;var $i=Array.prototype,Hi=$i.splice;function Vi(t){var e=this.__data__,r=R(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 De=Vi;function qi(t){var e=this.__data__,r=R(e,t);return r<0?void 0:e[r][1]}var ze=qi;function Yi(t){return R(this.__data__,t)>-1}var Ke=Yi;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 Ge=Zi;function X(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}X.prototype.clear=Ue;X.prototype.delete=De;X.prototype.get=ze;X.prototype.has=Ke;X.prototype.set=Ge;var N=X;var Ji=O(g,"Map"),L=Ji;function Xi(){this.size=0,this.__data__={hash:new Rt,map:new(L||N),string:new Rt}}var We=Xi;function Qi(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var $e=Qi;function ts(t,e){var r=t.__data__;return $e(e)?r[typeof e=="string"?"string":"hash"]:r.map}var B=ts;function es(t){var e=B(this,t).delete(t);return this.size-=e?1:0,e}var He=es;function rs(t){return B(this,t).get(t)}var Ve=rs;function os(t){return B(this,t).has(t)}var qe=os;function as(t,e){var r=B(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ye=as;function Q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Q.prototype.clear=We;Q.prototype.delete=He;Q.prototype.get=Ve;Q.prototype.has=qe;Q.prototype.set=Ye;var lt=Q;var is="Expected a function";function Nt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(is);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],s=r.cache;if(s.has(a))return s.get(a);var n=t.apply(this,o);return r.cache=s.set(a,n)||s,n};return r.cache=new(Nt.Cache||lt),r}Nt.Cache=lt;var Ze=Nt;var ss=500;function ns(t){var e=Ze(t,function(o){return r.size===ss&&r.clear(),o}),r=e.cache;return e}var Je=ns;var fs=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ps=/\\(\\)?/g,ls=Je(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(fs,function(r,o,a,s){e.push(a?s.replace(ps,"$1"):o||r)}),e}),Xe=ls;function ms(t){return t==null?"":re(t)}var Qe=ms;function us(t,e){return v(t)?t:Me(t,e)?[t]:Xe(Qe(t))}var k=us;var ds=1/0;function cs(t){if(typeof t=="string"||z(t))return t;var e=t+"";return e=="0"&&1/t==-ds?"-0":e}var tt=cs;function hs(t,e){e=k(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[tt(e[r++])];return r&&r==o?t:void 0}var tr=hs;function gs(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var et=gs;var er=w?w.isConcatSpreadable:void 0;function xs(t){return v(t)||V(t)||!!(er&&t&&t[er])}var rr=xs;function or(t,e,r,o,a){var s=-1,n=t.length;for(r||(r=rr),a||(a=[]);++s<n;){var i=t[s];e>0&&r(i)?e>1?or(i,e-1,r,o,a):et(a,i):o||(a[a.length]=i)}return a}var ar=or;function ys(t){var e=t==null?0:t.length;return e?ar(t,1):[]}var ir=ys;function bs(t){return he(ye(t,void 0,ir),t+"")}var sr=bs;var vs=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 fr=Ts;function Os(t){return this.__data__.get(t)}var pr=Os;function As(t){return this.__data__.has(t)}var lr=As;var Ps=200;function js(t,e){var r=this.__data__;if(r instanceof N){var o=r.__data__;if(!L||o.length<Ps-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new lt(o)}return r.set(t,e),this.size=r.size,this}var mr=js;function rt(t){var e=this.__data__=new N(t);this.size=e.size}rt.prototype.clear=nr;rt.prototype.delete=fr;rt.prototype.get=pr;rt.prototype.has=lr;rt.prototype.set=mr;var ur=rt;function Ss(t,e){return t&&M(e,Y(e),t)}var dr=Ss;function Is(t,e){return t&&M(e,Z(e),t)}var cr=Is;var yr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,hr=yr&&typeof module=="object"&&module&&!module.nodeType&&module,_s=hr&&hr.exports===yr,gr=_s?g.Buffer:void 0,xr=gr?gr.allocUnsafe:void 0;function Es(t,e){if(e)return t.slice();var r=t.length,o=xr?xr(r):new t.constructor(r);return t.copy(o),o}var br=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 vr=Cs;function Fs(){return[]}var Ot=Fs;var Ms=Object.prototype,Rs=Ms.propertyIsEnumerable,wr=Object.getOwnPropertySymbols,Ns=wr?function(t){return t==null?[]:(t=Object(t),vr(wr(t),function(e){return Rs.call(t,e)}))}:Ot,ot=Ns;function Ls(t,e){return M(t,ot(t),e)}var Tr=Ls;var Bs=Object.getOwnPropertySymbols,ks=Bs?function(t){for(var e=[];t;)et(e,ot(t)),t=Tt(t);return e}:Ot,At=ks;function Us(t,e){return M(t,At(t),e)}var Or=Us;function Ds(t,e,r){var o=e(t);return v(t)?o:et(o,r(t))}var Pt=Ds;function zs(t){return Pt(t,Y,ot)}var Ar=zs;function Ks(t){return Pt(t,Z,At)}var Pr=Ks;var Gs=O(g,"DataView"),jt=Gs;var Ws=O(g,"Promise"),St=Ws;var $s=O(g,"Set"),It=$s;var jr="[object Map]",Hs="[object Object]",Sr="[object Promise]",Ir="[object Set]",_r="[object WeakMap]",Er="[object DataView]",Vs=E(jt),qs=E(L),Ys=E(St),Zs=E(It),Js=E(ht),D=S;(jt&&D(new jt(new ArrayBuffer(1)))!=Er||L&&D(new L)!=jr||St&&D(St.resolve())!=Sr||It&&D(new It)!=Ir||ht&&D(new ht)!=_r)&&(D=function(t){var e=S(t),r=e==Hs?t.constructor:void 0,o=r?E(r):"";if(o)switch(o){case Vs:return Er;case qs:return jr;case Ys:return Sr;case Zs:return Ir;case Js:return _r}return e});var at=D;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 Cr=tn;var en=g.Uint8Array,Lt=en;function rn(t){var e=new t.constructor(t.byteLength);return new Lt(e).set(new Lt(t)),e}var it=rn;function on(t,e){var r=e?it(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Fr=on;var an=/\w*$/;function sn(t){var e=new t.constructor(t.source,an.exec(t));return e.lastIndex=t.lastIndex,e}var Mr=sn;var Rr=w?w.prototype:void 0,Nr=Rr?Rr.valueOf:void 0;function nn(t){return Nr?Object(Nr.call(t)):{}}var Lr=nn;function fn(t,e){var r=e?it(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Br=fn;var pn="[object Boolean]",ln="[object Date]",mn="[object Map]",un="[object Number]",dn="[object RegExp]",cn="[object Set]",hn="[object String]",gn="[object Symbol]",xn="[object ArrayBuffer]",yn="[object DataView]",bn="[object Float32Array]",vn="[object Float64Array]",wn="[object Int8Array]",Tn="[object Int16Array]",On="[object Int32Array]",An="[object Uint8Array]",Pn="[object Uint8ClampedArray]",jn="[object Uint16Array]",Sn="[object Uint32Array]";function In(t,e,r){var o=t.constructor;switch(e){case xn:return it(t);case pn:case ln:return new o(+t);case yn:return Fr(t,r);case bn:case vn:case wn:case Tn:case On:case An:case Pn:case jn:case Sn:return Br(t,r);case mn:return new o;case un:case hn:return new o(t);case dn:return Mr(t);case cn:return new o;case gn:return Lr(t)}}var kr=In;function _n(t){return typeof t.constructor=="function"&&!H(t)?pe(Tt(t)):{}}var Ur=_n;var En="[object Map]";function Cn(t){return j(t)&&at(t)==En}var Dr=Cn;var zr=C&&C.isMap,Fn=zr?q(zr):Dr,Kr=Fn;var Mn="[object Set]";function Rn(t){return j(t)&&at(t)==Mn}var Gr=Rn;var Wr=C&&C.isSet,Nn=Wr?q(Wr):Gr,$r=Nn;var Ln=1,Bn=2,kn=4,Hr="[object Arguments]",Un="[object Array]",Dn="[object Boolean]",zn="[object Date]",Kn="[object Error]",Vr="[object Function]",Gn="[object GeneratorFunction]",Wn="[object Map]",$n="[object Number]",qr="[object Object]",Hn="[object RegExp]",Vn="[object Set]",qn="[object String]",Yn="[object Symbol]",Zn="[object WeakMap]",Jn="[object ArrayBuffer]",Xn="[object DataView]",Qn="[object Float32Array]",tf="[object Float64Array]",ef="[object Int8Array]",rf="[object Int16Array]",of="[object Int32Array]",af="[object Uint8Array]",sf="[object Uint8ClampedArray]",nf="[object Uint16Array]",ff="[object Uint32Array]",d={};d[Hr]=d[Un]=d[Jn]=d[Xn]=d[Dn]=d[zn]=d[Qn]=d[tf]=d[ef]=d[rf]=d[of]=d[Wn]=d[$n]=d[qr]=d[Hn]=d[Vn]=d[qn]=d[Yn]=d[af]=d[sf]=d[nf]=d[ff]=!0;d[Kn]=d[Vr]=d[Zn]=!1;function _t(t,e,r,o,a,s){var n,i=e&Ln,f=e&Bn,m=e&kn;if(r&&(n=a?r(t,o,a,s):r(t)),n!==void 0)return n;if(!P(t))return t;var h=v(t);if(h){if(n=Cr(t),!i)return me(t,n)}else{var b=at(t),A=b==Vr||b==Gn;if(bt(t))return br(t,i);if(b==qr||b==Hr||A&&!a){if(n=f||A?{}:Ur(t),!i)return f?Or(t,cr(n,t)):Tr(t,dr(n,t))}else{if(!d[b])return a?t:{};n=kr(t,b,i)}}s||(s=new ur);var T=s.get(t);if(T)return T;s.set(t,n),$r(t)?t.forEach(function(y){n.add(_t(y,e,r,y,t,s))}):Kr(t)&&t.forEach(function(y,p){n.set(p,_t(y,e,r,p,t,s))});var x=m?f?Pr:Ar:f?Z:Y,I=h?void 0:x(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 Yr=_t;var pf=1,lf=4;function mf(t){return Yr(t,pf|lf)}var Bt=mf;function uf(t,e){return t!=null&&e in Object(t)}var Zr=uf;function df(t,e,r){e=k(e,t);for(var o=-1,a=e.length,s=!1;++o<a;){var n=tt(e[o]);if(!(s=t!=null&&r(t,n)))break;t=t[n]}return s||++o!=a?s:(a=t==null?0:t.length,!!a&&$(a)&&G(n,a)&&(v(t)||V(t)))}var Jr=df;function cf(t,e){return t!=null&&Jr(t,e,Zr)}var Xr=cf;function hf(t,e,r,o){if(!P(t))return t;e=k(e,t);for(var a=-1,s=e.length,n=s-1,i=t;i!=null&&++a<s;){var f=tt(e[a]),m=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return t;if(a!=n){var h=i[f];m=o?o(h,f,i):void 0,m===void 0&&(m=P(h)?h:G(e[a+1])?[]:{})}W(i,f,m),i=i[f]}return t}var Qr=hf;function gf(t,e,r){for(var o=-1,a=e.length,s={};++o<a;){var n=e[o],i=tr(t,n);r(i,n)&&Qr(s,k(n,t),i)}return s}var to=gf;function xf(t,e){return to(t,e,function(r,o){return Xr(t,o)})}var eo=xf;var yf=sr(function(t,e){return t==null?{}:eo(t,e)}),Et=yf;function ro(t){return{all:t=t||new Map,on:function(e,r){var o=t.get(e);o?o.push(r):t.set(e,[r])},off:function(e,r){var o=t.get(e);o&&(r?o.splice(o.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var o=t.get(e);o&&o.slice().map(function(a){a(r)}),(o=t.get("*"))&&o.slice().map(function(a){a(e,r)})}}}var oo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var kt=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=oo[r[t]&63];return e};var bf="array",vf="bit",ao="bits",wf="byte",io="bytes",st="",Tf="exponent",Of="function",so="iec",Af="Invalid number",Pf="Invalid rounding method",Ut="jedec",jf="object",no=".",Sf="round",If="s",_f="si",Ef="kbit",Cf="kB",Ff=" ",Mf="string",Rf="0",Dt={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:A=!1,fullforms:T=[],exponent:x=-1,roundingMethod:I=Sf,precision:y=0}={}){let p=x,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=A===!0,Kt=u<0,Gt=Math[I];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(Af);if(typeof Gt!==Of)throw new TypeError(Pf);if(Kt&&(u=-u),(p===-1||isNaN(p))&&(p=Math.floor(Math.log(u)/Math.log(mt)),p<0&&(p=0)),p>8&&(y>0&&(y+=8-p),p=8),b===Tf)return p;if(u===0)l[0]=0,Ct=l[1]=Dt.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&&x===-1&&(l[0]=1,p++),Ct=l[1]=o===10&&p===1?e?Ef:Cf:Dt.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,Rf)}`}return po&&(l[1]=T[p]?T[p]:Dt.fullform[h][p]+(e?vf:wf)+(l[0]===1?st:If)),b===bf?l:b===jf?{value:l[0],symbol:l[1],exponent:p,unit:Ct}:l.join(f)}var U=class t{_tera;id;name;icon;path;url;teraUrl;parsedName;created;createdFormatted;modified;modifiedFormatted;accessed;accessedFormatted;size;sizeFormatted;mime;meta={};constructor(e){if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,e);let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.teraUrl=this.url.replace(/^https?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=fo(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(e){return this._tera.getProjectFileContents(this.id,e)}setContents(e){return this._tera.setProjectFileContents(this.id,e)}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Et(this,["id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new t(Et(e,["tera","id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]))}};var zt=class{settings={session:null,devMode:!0,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child(e){e.siteUrl=="https://tera-tools.com/embed"?Object.assign(e,{siteUrl:"https://dev.tera-tools.com/embed",restrictOrigin:"https://dev.tera-tools.com"}):e.restrictOrigin="*"}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"https://tera-tools.com",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=ro();dom={el:null,iframe:null,popup:null,stylesheet:null};methods=["handshake","setServerVerbosity","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateFlush","setProjectStateRefresh","saveProjectState","replaceProjectState","getProjectFileContents","deleteProjectFile","setProjectFileContents","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiProgress","uiPrompt","uiThrow","uiSplat","uiWindow"];plugins=[];send(e){let r=kt();return this.acceptPostboxes[r]={},this.acceptPostboxes[r].promise=new Promise((o,a)=>{Object.assign(this.acceptPostboxes[r],{resolve:o,reject:a}),this.sendRaw({id:r,...e})}),this.acceptPostboxes[r].promise}sendRaw(e){let r;try{if(r={TERA:1,id:e.id||kt(),...Bt(e)},this.settings.mode=="parent")window.parent.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="child")this.dom.iframe.contentWindow.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="popup")this.dom.popup.postMessage(r,this.settings.restrictOrigin);else throw this.settings.mode=="detect"?new Error("Call init() or detectMode() before trying to send data to determine the mode"):new Error(`Unknown TERA communication mode "${this.settings.mode}"`)}catch(o){throw this.debug("ERROR",1,"Message compose client->server:",o),this.debug("ERROR",1,"Attempted to dispatch payload client->server",r),o}}rpc(e,...r){return this.send({action:"rpc",method:e,args:r})}acceptMessage(e){if(e.origin==window.location.origin)return;let r=e.data;if(!(!r.TERA||!r.id))if(this.debug("INFO",3,"Recieved message",r),r?.action=="response"&&this.acceptPostboxes[r.id])r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response);else{if(r?.action=="rpc")return Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})});if(r?.action=="event")return Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o});r?.id?this.debug("INFO",3,`Ignoring message ID ${r.id} - was meant for someone else?`):this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r})}}acceptPostboxes={};createProjectStatePatch(e,r){let o=Vt(r,e);return this.debug("INFO",3,"Created project patch",{patch:o,newState:e,oldState:r}),this.applyProjectStatePatch(o)}applyProjectStatePatch(e){if(this.settings.devMode&&this.settings.debugPaths){if(!Array.isArray(this.settings.debugPaths))throw new Error("teraFyClient.settings.debugPaths should be either null or an Array<String>");let r=e.filter(o=>this.settings.debugPaths.some(a=>o.path.join(".").slice(0,a.length)==a)).map(o=>o.path.join("."));if(r.length>0){console.info("Detected writes to",r,"- entering debugging mode");debugger}}return this.rpc("applyProjectStatePatch",e,{session:this.settings.session})}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.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?Array.isArray(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")})()):(()=>{throw new Error("Unknown terafyClient.settings.debugPaths type")})():null,this.debug("INFO",0,"Watching state paths",this.settings.debugPaths))}).then(()=>this.detectMode()).then(o=>{if(this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o,this.settings.modeOverrides[o])return this.debug("INFO",4,"[1/6] Applying specific config overrides for mode",o),this.settings.modeOverrides[o](this.settings)}).then(()=>this.debug("INFO",4,"[2/6] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>{if(this.settings.verbosity<=1){this.debug("INFO",4,"[3/6] Skip - Server verbosity is already at 1");return}else return this.debug("INFO",4,`[3/6] Set server verbosity to ${this.settings.verbosity}`),this.rpc("setServerVerbosity",this.settings.verbosity)}).then(()=>this.debug("INFO",4,`[4/6] Set server mode to "${this.settings.mode}"`)).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw`Unknown server mode "${this.settings.mode}"`})())).then(()=>this.debug("INFO",4,"[5/6] Run client plugins")).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings)))).then(()=>this.debug("INFO",4,"[6/6] Init complete")).catch(o=>this.debug("WARN",0,"Init process fault",o))}detectMode(){return this.settings.mode!="detect"?Promise.resolve(this.settings.mode):window.self===window.parent?Promise.resolve(this.settings.modeFallback):Promise.resolve().then(()=>this.settings.mode="parent").then(()=>new Promise((e,r)=>{let o=setTimeout(()=>r(),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e())})).then(()=>"parent").catch(()=>this.settings.modeFallback)}injectComms(){switch(this.settings.mode){case"child":return Promise.resolve().then(()=>new Promise(e=>{this.debug("INFO",2,"Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this.dom.el.classList.add("minimized"),document.body.append(this.dom.el),this.dom.el.addEventListener("click",()=>this.dom.el.classList.toggle("minimized")),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("INFO",3,"Embeded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe)})).then(()=>this.handshakeLoop());case"parent":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,n,i=setTimeout(()=>{clearTimeout(n),a("TIMEOUT")},r.handshakeTimeout),f=()=>{this.debug("INFO",4,"Trying handshake",++s),clearTimeout(n),n=setTimeout(f,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(i),clearTimeout(n)}).then(()=>o()).catch(a)};f()})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","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.appendChild(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){this.methods.forEach(e=>this[e]=this.rpc.bind(this,e))}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r,o){let a={ignoreNullish:!0,...o};return typeof e=="string"?(!a.ignoreNullish||r!=null)&&(this.settings[e]=r):Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r,o){return!this.settings.devMode||r===void 0?this:this.set(e,r,o)}use(e,r){let o=typeof
|
|
1
|
+
function Vt(t,e,r){if(!t||typeof t!="object"||!e||typeof e!="object")throw new Error("both arguments must be objects or arrays");r||(r=function(i){return i});function o({obj1:i,obj2:f,basePath:m,basePathForRemoves:h,diffs:b}){var O=Object.keys(i),T=O.length,x=Object.keys(f),I=x.length,y,p=i.length-f.length;if(uo(i,f)){for(var u=0;u<T;u++){var l=Array.isArray(i)?Number(O[u]):O[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(x[u]):x[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:O}){var T=f[i],x=m[i];if(!(i in f)&&i in m){var I=x;O.add.push({op:"add",path:r(h),value:I})}else T!==x&&(Object(T)!==T||Object(x)!==x||mo(T,x)||!Object.keys(T).length&&!Object.keys(x).length&&String(T)!=String(x)?n(h,O,x):o({obj1:f[i],obj2:m[i],basePath:h,basePathForRemoves:b,diffs:O}))}function n(i,f,m){f.replace.push({op:"replace",path:r(i),value:m})}}function mo(t,e){return Object.prototype.toString.call(t)!=Object.prototype.toString.call(e)}function uo(t,e){var r=t.length-e.length;if(Array.isArray(t)&&Array.isArray(e)&&r>0){for(var o=0,a=0,s=0;s<e.length&&String(t[s])===String(e[s]);s++)o++;for(var n=e.length;n>0&&String(t[n+r])===String(e[n]);n--)a++;return o>=a}return!0}var co=typeof global=="object"&&global&&global.Object===Object&&global,ut=co;var ho=typeof self=="object"&&self&&self.Object===Object&&self,go=ut||ho||Function("return this")(),g=go;var xo=g.Symbol,w=xo;var qt=Object.prototype,yo=qt.hasOwnProperty,bo=qt.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 Yt=vo;var wo=Object.prototype,To=wo.toString;function Po(t){return To.call(t)}var Zt=Po;var Oo="[object Null]",Ao="[object Undefined]",Jt=w?w.toStringTag:void 0;function jo(t){return t==null?t===void 0?Ao:Oo:Jt&&Jt in Object(t)?Yt(t):Zt(t)}var S=jo;function So(t){return t!=null&&typeof t=="object"}var j=So;var Io="[object Symbol]";function _o(t){return typeof t=="symbol"||j(t)&&S(t)==Io}var z=_o;function Eo(t,e){for(var r=-1,o=t==null?0:t.length,a=Array(o);++r<o;)a[r]=e(t[r],r,t);return a}var Xt=Eo;var Co=Array.isArray,v=Co;var Fo=1/0,Qt=w?w.prototype:void 0,te=Qt?Qt.toString:void 0;function ee(t){if(typeof t=="string")return t;if(v(t))return Xt(t,ee)+"";if(z(t))return te?te.call(t):"";var e=t+"";return e=="0"&&1/t==-Fo?"-0":e}var re=ee;function Mo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var A=Mo;function Ro(t){return t}var oe=Ro;var No="[object AsyncFunction]",Lo="[object Function]",Bo="[object GeneratorFunction]",ko="[object Proxy]";function Uo(t){if(!A(t))return!1;var e=S(t);return e==Lo||e==Bo||e==No||e==ko}var dt=Uo;var Do=g["__core-js_shared__"],ct=Do;var ae=function(){var t=/[^.]+$/.exec(ct&&ct.keys&&ct.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function zo(t){return!!ae&&ae in t}var ie=zo;var Ko=Function.prototype,Go=Ko.toString;function Wo(t){if(t!=null){try{return Go.call(t)}catch{}try{return t+""}catch{}}return""}var E=Wo;var $o=/[\\^$.*+?()[\]{}|]/g,Ho=/^\[object .+?Constructor\]$/,Vo=Function.prototype,qo=Object.prototype,Yo=Vo.toString,Zo=qo.hasOwnProperty,Jo=RegExp("^"+Yo.call(Zo).replace($o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Xo(t){if(!A(t)||ie(t))return!1;var e=dt(t)?Jo:Ho;return e.test(E(t))}var se=Xo;function Qo(t,e){return t?.[e]}var ne=Qo;function ta(t,e){var r=ne(t,e);return se(r)?r:void 0}var P=ta;var ea=P(g,"WeakMap"),ht=ea;var fe=Object.create,ra=function(){function t(){}return function(e){if(!A(e))return{};if(fe)return fe(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),pe=ra;function oa(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var le=oa;function aa(t,e){var r=-1,o=t.length;for(e||(e=Array(o));++r<o;)e[r]=t[r];return e}var me=aa;var ia=800,sa=16,na=Date.now;function fa(t){var e=0,r=0;return function(){var o=na(),a=sa-(o-r);if(r=o,a>0){if(++e>=ia)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var ue=fa;function pa(t){return function(){return t}}var de=pa;var la=function(){try{var t=P(Object,"defineProperty");return t({},"",{}),t}catch{}}(),K=la;var ma=K?function(t,e){return K(t,"toString",{configurable:!0,enumerable:!1,value:de(e),writable:!0})}:oe,ce=ma;var ua=ue(ce),he=ua;function da(t,e){for(var r=-1,o=t==null?0:t.length;++r<o&&e(t[r],r,t)!==!1;);return t}var ge=da;var ca=9007199254740991,ha=/^(?:0|[1-9]\d*)$/;function ga(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=ga;function xa(t,e,r){e=="__proto__"&&K?K(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var gt=xa;function ya(t,e){return t===e||t!==t&&e!==e}var xt=ya;var ba=Object.prototype,va=ba.hasOwnProperty;function wa(t,e,r){var o=t[e];(!(va.call(t,e)&&xt(o,r))||r===void 0&&!(e in t))&>(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?gt(r,i,f):W(r,i,f)}return r}var M=Ta;var xe=Math.max;function Pa(t,e,r){return e=xe(e===void 0?t.length-1:e,0),function(){for(var o=arguments,a=-1,s=xe(o.length-e,0),n=Array(s);++a<s;)n[a]=o[e+a];a=-1;for(var i=Array(e+1);++a<e;)i[a]=o[a];return i[e]=r(n),le(t,this,i)}}var ye=Pa;var Oa=9007199254740991;function Aa(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Oa}var $=Aa;function ja(t){return t!=null&&$(t.length)&&!dt(t)}var yt=ja;var Sa=Object.prototype;function Ia(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Sa;return t===r}var H=Ia;function _a(t,e){for(var r=-1,o=Array(t);++r<t;)o[r]=e(r);return o}var be=_a;var Ea="[object Arguments]";function Ca(t){return j(t)&&S(t)==Ea}var Ft=Ca;var ve=Object.prototype,Fa=ve.hasOwnProperty,Ma=ve.propertyIsEnumerable,Ra=Ft(function(){return arguments}())?Ft:function(t){return j(t)&&Fa.call(t,"callee")&&!Ma.call(t,"callee")},V=Ra;function Na(){return!1}var we=Na;var Oe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Te=Oe&&typeof module=="object"&&module&&!module.nodeType&&module,La=Te&&Te.exports===Oe,Pe=La?g.Buffer:void 0,Ba=Pe?Pe.isBuffer:void 0,ka=Ba||we,bt=ka;var Ua="[object Arguments]",Da="[object Array]",za="[object Boolean]",Ka="[object Date]",Ga="[object Error]",Wa="[object Function]",$a="[object Map]",Ha="[object Number]",Va="[object Object]",qa="[object RegExp]",Ya="[object Set]",Za="[object String]",Ja="[object WeakMap]",Xa="[object ArrayBuffer]",Qa="[object DataView]",ti="[object Float32Array]",ei="[object Float64Array]",ri="[object Int8Array]",oi="[object Int16Array]",ai="[object Int32Array]",ii="[object Uint8Array]",si="[object Uint8ClampedArray]",ni="[object Uint16Array]",fi="[object Uint32Array]",c={};c[ti]=c[ei]=c[ri]=c[oi]=c[ai]=c[ii]=c[si]=c[ni]=c[fi]=!0;c[Ua]=c[Da]=c[Xa]=c[za]=c[Qa]=c[Ka]=c[Ga]=c[Wa]=c[$a]=c[Ha]=c[Va]=c[qa]=c[Ya]=c[Za]=c[Ja]=!1;function pi(t){return j(t)&&$(t.length)&&!!c[S(t)]}var Ae=pi;function li(t){return function(e){return t(e)}}var q=li;var je=typeof exports=="object"&&exports&&!exports.nodeType&&exports,pt=je&&typeof module=="object"&&module&&!module.nodeType&&module,mi=pt&&pt.exports===je,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 Se=C&&C.isTypedArray,di=Se?q(Se):Ae,Ie=di;var ci=Object.prototype,hi=ci.hasOwnProperty;function gi(t,e){var r=v(t),o=!r&&V(t),a=!r&&!o&&bt(t),s=!r&&!o&&!a&&Ie(t),n=r||o||a||s,i=n?be(t.length,String):[],f=i.length;for(var m in t)(e||hi.call(t,m))&&!(n&&(m=="length"||a&&(m=="offset"||m=="parent")||s&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||G(m,f)))&&i.push(m);return i}var vt=gi;function xi(t,e){return function(r){return t(e(r))}}var wt=xi;var yi=wt(Object.keys,Object),_e=yi;var bi=Object.prototype,vi=bi.hasOwnProperty;function wi(t){if(!H(t))return _e(t);var e=[];for(var r in Object(t))vi.call(t,r)&&r!="constructor"&&e.push(r);return e}var Ee=wi;function Ti(t){return yt(t)?vt(t):Ee(t)}var Y=Ti;function Pi(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Ce=Pi;var Oi=Object.prototype,Ai=Oi.hasOwnProperty;function ji(t){if(!A(t))return Ce(t);var e=H(t),r=[];for(var o in t)o=="constructor"&&(e||!Ai.call(t,o))||r.push(o);return r}var Fe=ji;function Si(t){return yt(t)?vt(t,!0):Fe(t)}var Z=Si;var Ii=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_i=/^\w*$/;function Ei(t,e){if(v(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||z(t)?!0:_i.test(t)||!Ii.test(t)||e!=null&&t in Object(e)}var Me=Ei;var Ci=P(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 Ne=Mi;var Ri="__lodash_hash_undefined__",Ni=Object.prototype,Li=Ni.hasOwnProperty;function Bi(t){var e=this.__data__;if(F){var r=e[t];return r===Ri?void 0:r}return Li.call(e,t)?e[t]:void 0}var Le=Bi;var ki=Object.prototype,Ui=ki.hasOwnProperty;function Di(t){var e=this.__data__;return F?e[t]!==void 0:Ui.call(e,t)}var Be=Di;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 ke=Ki;function J(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}J.prototype.clear=Re;J.prototype.delete=Ne;J.prototype.get=Le;J.prototype.has=Be;J.prototype.set=ke;var Rt=J;function Gi(){this.__data__=[],this.size=0}var Ue=Gi;function Wi(t,e){for(var r=t.length;r--;)if(xt(t[r][0],e))return r;return-1}var R=Wi;var $i=Array.prototype,Hi=$i.splice;function Vi(t){var e=this.__data__,r=R(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 De=Vi;function qi(t){var e=this.__data__,r=R(e,t);return r<0?void 0:e[r][1]}var ze=qi;function Yi(t){return R(this.__data__,t)>-1}var Ke=Yi;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 Ge=Zi;function X(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}X.prototype.clear=Ue;X.prototype.delete=De;X.prototype.get=ze;X.prototype.has=Ke;X.prototype.set=Ge;var N=X;var Ji=P(g,"Map"),L=Ji;function Xi(){this.size=0,this.__data__={hash:new Rt,map:new(L||N),string:new Rt}}var We=Xi;function Qi(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var $e=Qi;function ts(t,e){var r=t.__data__;return $e(e)?r[typeof e=="string"?"string":"hash"]:r.map}var B=ts;function es(t){var e=B(this,t).delete(t);return this.size-=e?1:0,e}var He=es;function rs(t){return B(this,t).get(t)}var Ve=rs;function os(t){return B(this,t).has(t)}var qe=os;function as(t,e){var r=B(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}var Ye=as;function Q(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}Q.prototype.clear=We;Q.prototype.delete=He;Q.prototype.get=Ve;Q.prototype.has=qe;Q.prototype.set=Ye;var lt=Q;var is="Expected a function";function Nt(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(is);var r=function(){var o=arguments,a=e?e.apply(this,o):o[0],s=r.cache;if(s.has(a))return s.get(a);var n=t.apply(this,o);return r.cache=s.set(a,n)||s,n};return r.cache=new(Nt.Cache||lt),r}Nt.Cache=lt;var Ze=Nt;var ss=500;function ns(t){var e=Ze(t,function(o){return r.size===ss&&r.clear(),o}),r=e.cache;return e}var Je=ns;var fs=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ps=/\\(\\)?/g,ls=Je(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(fs,function(r,o,a,s){e.push(a?s.replace(ps,"$1"):o||r)}),e}),Xe=ls;function ms(t){return t==null?"":re(t)}var Qe=ms;function us(t,e){return v(t)?t:Me(t,e)?[t]:Xe(Qe(t))}var k=us;var ds=1/0;function cs(t){if(typeof t=="string"||z(t))return t;var e=t+"";return e=="0"&&1/t==-ds?"-0":e}var tt=cs;function hs(t,e){e=k(e,t);for(var r=0,o=e.length;t!=null&&r<o;)t=t[tt(e[r++])];return r&&r==o?t:void 0}var tr=hs;function gs(t,e){for(var r=-1,o=e.length,a=t.length;++r<o;)t[a+r]=e[r];return t}var et=gs;var er=w?w.isConcatSpreadable:void 0;function xs(t){return v(t)||V(t)||!!(er&&t&&t[er])}var rr=xs;function or(t,e,r,o,a){var s=-1,n=t.length;for(r||(r=rr),a||(a=[]);++s<n;){var i=t[s];e>0&&r(i)?e>1?or(i,e-1,r,o,a):et(a,i):o||(a[a.length]=i)}return a}var ar=or;function ys(t){var e=t==null?0:t.length;return e?ar(t,1):[]}var ir=ys;function bs(t){return he(ye(t,void 0,ir),t+"")}var sr=bs;var vs=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 fr=Ts;function Ps(t){return this.__data__.get(t)}var pr=Ps;function Os(t){return this.__data__.has(t)}var lr=Os;var As=200;function js(t,e){var r=this.__data__;if(r instanceof N){var o=r.__data__;if(!L||o.length<As-1)return o.push([t,e]),this.size=++r.size,this;r=this.__data__=new lt(o)}return r.set(t,e),this.size=r.size,this}var mr=js;function rt(t){var e=this.__data__=new N(t);this.size=e.size}rt.prototype.clear=nr;rt.prototype.delete=fr;rt.prototype.get=pr;rt.prototype.has=lr;rt.prototype.set=mr;var ur=rt;function Ss(t,e){return t&&M(e,Y(e),t)}var dr=Ss;function Is(t,e){return t&&M(e,Z(e),t)}var cr=Is;var yr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,hr=yr&&typeof module=="object"&&module&&!module.nodeType&&module,_s=hr&&hr.exports===yr,gr=_s?g.Buffer:void 0,xr=gr?gr.allocUnsafe:void 0;function Es(t,e){if(e)return t.slice();var r=t.length,o=xr?xr(r):new t.constructor(r);return t.copy(o),o}var br=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 vr=Cs;function Fs(){return[]}var Pt=Fs;var Ms=Object.prototype,Rs=Ms.propertyIsEnumerable,wr=Object.getOwnPropertySymbols,Ns=wr?function(t){return t==null?[]:(t=Object(t),vr(wr(t),function(e){return Rs.call(t,e)}))}:Pt,ot=Ns;function Ls(t,e){return M(t,ot(t),e)}var Tr=Ls;var Bs=Object.getOwnPropertySymbols,ks=Bs?function(t){for(var e=[];t;)et(e,ot(t)),t=Tt(t);return e}:Pt,Ot=ks;function Us(t,e){return M(t,Ot(t),e)}var Pr=Us;function Ds(t,e,r){var o=e(t);return v(t)?o:et(o,r(t))}var At=Ds;function zs(t){return At(t,Y,ot)}var Or=zs;function Ks(t){return At(t,Z,Ot)}var Ar=Ks;var Gs=P(g,"DataView"),jt=Gs;var Ws=P(g,"Promise"),St=Ws;var $s=P(g,"Set"),It=$s;var jr="[object Map]",Hs="[object Object]",Sr="[object Promise]",Ir="[object Set]",_r="[object WeakMap]",Er="[object DataView]",Vs=E(jt),qs=E(L),Ys=E(St),Zs=E(It),Js=E(ht),D=S;(jt&&D(new jt(new ArrayBuffer(1)))!=Er||L&&D(new L)!=jr||St&&D(St.resolve())!=Sr||It&&D(new It)!=Ir||ht&&D(new ht)!=_r)&&(D=function(t){var e=S(t),r=e==Hs?t.constructor:void 0,o=r?E(r):"";if(o)switch(o){case Vs:return Er;case qs:return jr;case Ys:return Sr;case Zs:return Ir;case Js:return _r}return e});var at=D;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 Cr=tn;var en=g.Uint8Array,Lt=en;function rn(t){var e=new t.constructor(t.byteLength);return new Lt(e).set(new Lt(t)),e}var it=rn;function on(t,e){var r=e?it(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Fr=on;var an=/\w*$/;function sn(t){var e=new t.constructor(t.source,an.exec(t));return e.lastIndex=t.lastIndex,e}var Mr=sn;var Rr=w?w.prototype:void 0,Nr=Rr?Rr.valueOf:void 0;function nn(t){return Nr?Object(Nr.call(t)):{}}var Lr=nn;function fn(t,e){var r=e?it(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Br=fn;var pn="[object Boolean]",ln="[object Date]",mn="[object Map]",un="[object Number]",dn="[object RegExp]",cn="[object Set]",hn="[object String]",gn="[object Symbol]",xn="[object ArrayBuffer]",yn="[object DataView]",bn="[object Float32Array]",vn="[object Float64Array]",wn="[object Int8Array]",Tn="[object Int16Array]",Pn="[object Int32Array]",On="[object Uint8Array]",An="[object Uint8ClampedArray]",jn="[object Uint16Array]",Sn="[object Uint32Array]";function In(t,e,r){var o=t.constructor;switch(e){case xn:return it(t);case pn:case ln:return new o(+t);case yn:return Fr(t,r);case bn:case vn:case wn:case Tn:case Pn:case On:case An:case jn:case Sn:return Br(t,r);case mn:return new o;case un:case hn:return new o(t);case dn:return Mr(t);case cn:return new o;case gn:return Lr(t)}}var kr=In;function _n(t){return typeof t.constructor=="function"&&!H(t)?pe(Tt(t)):{}}var Ur=_n;var En="[object Map]";function Cn(t){return j(t)&&at(t)==En}var Dr=Cn;var zr=C&&C.isMap,Fn=zr?q(zr):Dr,Kr=Fn;var Mn="[object Set]";function Rn(t){return j(t)&&at(t)==Mn}var Gr=Rn;var Wr=C&&C.isSet,Nn=Wr?q(Wr):Gr,$r=Nn;var Ln=1,Bn=2,kn=4,Hr="[object Arguments]",Un="[object Array]",Dn="[object Boolean]",zn="[object Date]",Kn="[object Error]",Vr="[object Function]",Gn="[object GeneratorFunction]",Wn="[object Map]",$n="[object Number]",qr="[object Object]",Hn="[object RegExp]",Vn="[object Set]",qn="[object String]",Yn="[object Symbol]",Zn="[object WeakMap]",Jn="[object ArrayBuffer]",Xn="[object DataView]",Qn="[object Float32Array]",tf="[object Float64Array]",ef="[object Int8Array]",rf="[object Int16Array]",of="[object Int32Array]",af="[object Uint8Array]",sf="[object Uint8ClampedArray]",nf="[object Uint16Array]",ff="[object Uint32Array]",d={};d[Hr]=d[Un]=d[Jn]=d[Xn]=d[Dn]=d[zn]=d[Qn]=d[tf]=d[ef]=d[rf]=d[of]=d[Wn]=d[$n]=d[qr]=d[Hn]=d[Vn]=d[qn]=d[Yn]=d[af]=d[sf]=d[nf]=d[ff]=!0;d[Kn]=d[Vr]=d[Zn]=!1;function _t(t,e,r,o,a,s){var n,i=e&Ln,f=e&Bn,m=e&kn;if(r&&(n=a?r(t,o,a,s):r(t)),n!==void 0)return n;if(!A(t))return t;var h=v(t);if(h){if(n=Cr(t),!i)return me(t,n)}else{var b=at(t),O=b==Vr||b==Gn;if(bt(t))return br(t,i);if(b==qr||b==Hr||O&&!a){if(n=f||O?{}:Ur(t),!i)return f?Pr(t,cr(n,t)):Tr(t,dr(n,t))}else{if(!d[b])return a?t:{};n=kr(t,b,i)}}s||(s=new ur);var T=s.get(t);if(T)return T;s.set(t,n),$r(t)?t.forEach(function(y){n.add(_t(y,e,r,y,t,s))}):Kr(t)&&t.forEach(function(y,p){n.set(p,_t(y,e,r,p,t,s))});var x=m?f?Ar:Or:f?Z:Y,I=h?void 0:x(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 Yr=_t;var pf=1,lf=4;function mf(t){return Yr(t,pf|lf)}var Bt=mf;function uf(t,e){return t!=null&&e in Object(t)}var Zr=uf;function df(t,e,r){e=k(e,t);for(var o=-1,a=e.length,s=!1;++o<a;){var n=tt(e[o]);if(!(s=t!=null&&r(t,n)))break;t=t[n]}return s||++o!=a?s:(a=t==null?0:t.length,!!a&&$(a)&&G(n,a)&&(v(t)||V(t)))}var Jr=df;function cf(t,e){return t!=null&&Jr(t,e,Zr)}var Xr=cf;function hf(t,e,r,o){if(!A(t))return t;e=k(e,t);for(var a=-1,s=e.length,n=s-1,i=t;i!=null&&++a<s;){var f=tt(e[a]),m=r;if(f==="__proto__"||f==="constructor"||f==="prototype")return t;if(a!=n){var h=i[f];m=o?o(h,f,i):void 0,m===void 0&&(m=A(h)?h:G(e[a+1])?[]:{})}W(i,f,m),i=i[f]}return t}var Qr=hf;function gf(t,e,r){for(var o=-1,a=e.length,s={};++o<a;){var n=e[o],i=tr(t,n);r(i,n)&&Qr(s,k(n,t),i)}return s}var to=gf;function xf(t,e){return to(t,e,function(r,o){return Xr(t,o)})}var eo=xf;var yf=sr(function(t,e){return t==null?{}:eo(t,e)}),Et=yf;function ro(t){return{all:t=t||new Map,on:function(e,r){var o=t.get(e);o?o.push(r):t.set(e,[r])},off:function(e,r){var o=t.get(e);o&&(r?o.splice(o.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var o=t.get(e);o&&o.slice().map(function(a){a(r)}),(o=t.get("*"))&&o.slice().map(function(a){a(e,r)})}}}var oo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var kt=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=oo[r[t]&63];return e};var bf="array",vf="bit",ao="bits",wf="byte",io="bytes",st="",Tf="exponent",Pf="function",so="iec",Of="Invalid number",Af="Invalid rounding method",Ut="jedec",jf="object",no=".",Sf="round",If="s",_f="si",Ef="kbit",Cf="kB",Ff=" ",Mf="string",Rf="0",Dt={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:O=!1,fullforms:T=[],exponent:x=-1,roundingMethod:I=Sf,precision:y=0}={}){let p=x,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=O===!0,Kt=u<0,Gt=Math[I];if(typeof t!="bigint"&&isNaN(t))throw new TypeError(Of);if(typeof Gt!==Pf)throw new TypeError(Af);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]=Dt.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&&x===-1&&(l[0]=1,p++),Ct=l[1]=o===10&&p===1?e?Ef:Cf:Dt.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,Rf)}`}return po&&(l[1]=T[p]?T[p]:Dt.fullform[h][p]+(e?vf:wf)+(l[0]===1?st:If)),b===bf?l:b===jf?{value:l[0],symbol:l[1],exponent:p,unit:Ct}:l.join(f)}var U=class t{_tera;id;name;icon;path;url;teraUrl;parsedName;created;createdFormatted;modified;modifiedFormatted;accessed;accessedFormatted;size;sizeFormatted;mime;meta={};constructor(e){if(!e.tera)throw new Error("Basic file requires a `tera` key to access the Tera instance");Object.assign(this,e);let r=this.tera;Object.defineProperty(this,"_tera",{enumerable:!1,configurable:!1,get(){return r}}),delete this.tera,this.teraUrl=this.url.replace(/^https?:\/\/(?:.+?)\/projects\/(?:.+?)\/project\/(.+)$/,"/project/$1"),this.sizeFormatted=fo(this.size||0,{spacer:""}),this.createdFormatted=this.created?this.created.toLocaleDateString():"Unknown created date",this.modifiedFormatted=this.modified?this.modified.toLocaleDateString():"Unknown modified date",this.accessedFormatted=this.accessed?this.accessed.toLocaleDateString():"Unknown access date"}getContents(e){return this._tera.getProjectFileContents(this.id,e)}setContents(e){return this._tera.setProjectFileContents(this.id,e)}getRefs(){return this._tera.getProjectLibrary(this.id)}setRefs(e){return this._tera.setProjectLibrary(this.id,e)}serialize(){return Et(this,["id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"])}static deserialize(e){return new t(Et(e,["tera","id","name","icon","path","url","parsedName","created","modified","accessed","size","mime","meta"]))}};var zt=class{settings={session:null,devMode:!1,verbosity:1,mode:"detect",modeTimeout:300,modeFallback:"child",modeOverrides:{child(e){e.siteUrl=="https://tera-tools.com/embed"&&Object.assign(e,{siteUrl:"https://dev.tera-tools.com/embed",restrictOrigin:"https://dev.tera-tools.com"})}},siteUrl:"https://tera-tools.com/embed",restrictOrigin:"https://tera-tools.com",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=ro();dom={el:null,iframe:null,popup:null,stylesheet:null};methods=["handshake","setServerVerbosity","getUser","requireUser","bindProject","getProject","getProjects","setActiveProject","requireProject","selectProject","getProjectState","setProjectState","setProjectStateDefaults","setProjectStateFlush","setProjectStateRefresh","saveProjectState","replaceProjectState","getProjectFileContents","deleteProjectFile","setProjectFileContents","selectProjectLibrary","getProjectLibrary","setProjectLibrary","projectLog","setPage","uiAlert","uiConfirm","uiProgress","uiPrompt","uiThrow","uiSplat","uiWindow"];plugins=[];send(e){let r=kt();return this.acceptPostboxes[r]={},this.acceptPostboxes[r].promise=new Promise((o,a)=>{Object.assign(this.acceptPostboxes[r],{resolve:o,reject:a}),this.sendRaw({id:r,...e})}),this.acceptPostboxes[r].promise}sendRaw(e){let r;try{if(r={TERA:1,id:e.id||kt(),...Bt(e)},this.settings.mode=="parent")window.parent.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="child")this.dom.iframe.contentWindow.postMessage(r,this.settings.restrictOrigin);else if(this.settings.mode=="popup")this.dom.popup.postMessage(r,this.settings.restrictOrigin);else throw this.settings.mode=="detect"?new Error("Call init() or detectMode() before trying to send data to determine the mode"):new Error(`Unknown TERA communication mode "${this.settings.mode}"`)}catch(o){throw this.debug("ERROR",1,"Message compose client->server:",o),this.debug("ERROR",1,"Attempted to dispatch payload client->server",r),o}}rpc(e,...r){return this.send({action:"rpc",method:e,args:r})}acceptMessage(e){if(e.origin==window.location.origin)return Promise.resolve();let r=e.data;return!r.TERA||!r.id?Promise.resolve():(this.debug("INFO",3,"Recieved message",r),r?.action=="response"&&this.acceptPostboxes[r.id]?(r.isError===!0?this.acceptPostboxes[r.id].reject(r.response):this.acceptPostboxes[r.id].resolve(r.response),Promise.resolve()):r?.action=="rpc"?Promise.resolve().then(()=>this[r.method].apply(this,r.args)).then(o=>this.sendRaw({id:r.id,action:"response",response:o})).catch(o=>{console.warn(`TERA-FY client threw on RPC:${r.method}:`,o),this.sendRaw({id:r.id,action:"response",isError:!0,response:o&&o.toString()})}):r?.action=="event"?Promise.resolve().then(()=>this.events.emit(r.event,...r.payload)).catch(o=>{throw console.warn(`TERA-FY client threw while handling emitted event "${r.event}"`,{message:r}),o}):r?.id?(this.debug("INFO",3,`Ignoring message ID ${r.id} - was meant for someone else?`),Promise.resolve()):(this.debug("INFO",3,"Unexpected incoming TERA-FY CLIENT message",{message:r}),Promise.resolve()))}acceptPostboxes={};createProjectStatePatch(e,r){let o=Vt(r,e);return this.debug("INFO",3,"Created project patch",{patch:o,newState:e,oldState:r}),this.applyProjectStatePatch(o)}applyProjectStatePatch(e){if(this.settings.devMode&&this.settings.debugPaths){if(!Array.isArray(this.settings.debugPaths))throw new Error("teraFyClient.settings.debugPaths should be either null or an Array<String>");let r=e.filter(o=>this.settings.debugPaths.some(a=>o.path.join(".").slice(0,a.length)==a)).map(o=>o.path.join("."));if(r.length>0){console.info("Detected writes to",r,"- entering debugging mode");debugger}}return this.rpc("applyProjectStatePatch",e,{session:this.settings.session})}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.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?Array.isArray(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")})()):(()=>{throw new Error("Unknown terafyClient.settings.debugPaths type")})():null,this.debug("INFO",0,"Watching state paths",this.settings.debugPaths))}).then(()=>this.detectMode()).then(o=>{if(this.debug("INFO",4,"[1/6] Setting client mode to",o),this.settings.mode=o,this.settings.modeOverrides[o])return this.debug("INFO",4,"[1/6] Applying specific config overrides for mode",o),this.settings.modeOverrides[o](this.settings)}).then(()=>this.debug("INFO",4,"[2/6] Injecting comms + styles + methods")).then(()=>Promise.all([this.injectComms(),this.injectStylesheet(),this.injectMethods()])).then(()=>{if(this.settings.verbosity<=1){this.debug("INFO",4,"[3/6] Skip - Server verbosity is already at 1");return}else return this.debug("INFO",4,`[3/6] Set server verbosity to ${this.settings.verbosity}`),this.rpc("setServerVerbosity",this.settings.verbosity)}).then(()=>this.debug("INFO",4,`[4/6] Set server mode to "${this.settings.mode}"`)).then(()=>this.rpc("setServerMode",this.settings.mode=="child"?"embedded":this.settings.mode=="parent"?"frame":this.settings.mode=="popup"?"popup":(()=>{throw`Unknown server mode "${this.settings.mode}"`})())).then(()=>this.debug("INFO",4,"[5/6] Run client plugins")).then(()=>Promise.all(this.plugins.map(o=>o.init.call(r,this.settings)))).then(()=>this.debug("INFO",4,"[6/6] Init complete")).catch(o=>this.debug("WARN",0,"Init process fault",o))}detectMode(){return this.settings.mode!="detect"?Promise.resolve(this.settings.mode):window.self===window.parent?Promise.resolve(this.settings.modeFallback):Promise.resolve().then(()=>this.settings.mode="parent").then(()=>new Promise((e,r)=>{let o=setTimeout(()=>r(),this.settings.modeTimeout);this.rpc("handshake").then(()=>clearTimeout(o)).then(()=>e())})).then(()=>"parent").catch(()=>this.settings.modeFallback)}injectComms(){switch(this.settings.mode){case"child":return Promise.resolve().then(()=>new Promise(e=>{this.debug("INFO",2,"Injecting TERA site as iFrame child"),this.dom.el=document.createElement("div"),this.dom.el.id="tera-fy",this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this.dom.el.classList.add("minimized"),document.body.append(this.dom.el),this.dom.el.addEventListener("click",()=>this.dom.el.classList.toggle("minimized")),this.dom.iframe=document.createElement("iframe"),this.dom.iframe.setAttribute("sandbox",this.settings.frameSandbox.join(" ")),this.dom.iframe.addEventListener("load",()=>{this.debug("INFO",3,"Embeded iframe ready"),e()}),this.dom.iframe.src=this.settings.siteUrl,this.dom.el.append(this.dom.iframe)})).then(()=>this.handshakeLoop());case"parent":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,n,i=setTimeout(()=>{clearTimeout(n),a("TIMEOUT")},r.handshakeTimeout),f=()=>{this.debug("INFO",4,"Trying handshake",++s),clearTimeout(n),n=setTimeout(f,r.handshakeInterval),this.rpc("handshake").then(()=>{clearTimeout(i),clearTimeout(n)}).then(()=>o()).catch(a)};f()})}injectStylesheet(){switch(this.settings.mode){case"child":this.dom.stylesheet=document.createElement("style"),this.dom.stylesheet.innerHTML=[":root {","--TERA-accent: #4d659c;","}","#tera-fy {","display: none;","position: fixed;","right: 50px;","bottom: 50px;","width: 300px;","height: 150px;","background: transparent;","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.appendChild(this.dom.stylesheet);break;case"parent":case"popup":break;default:throw new Error(`Unsupported mode "${this.settings.mode}" when injectStylesheet()`)}return Promise.resolve()}injectMethods(){this.methods.forEach(e=>this[e]=this.rpc.bind(this,e))}debug(...e){if(!this.settings.devMode||this.settings.verbosity<1)return;let r="log",o=1;typeof e[0]=="string"&&["INFO","LOG","WARN","ERROR"].includes(e[0])&&(r=e.shift().toLowerCase()),typeof e[0]=="number"&&(o=e[0],e.shift()),!(this.settings.verbosity<o)&&console[r]("%c[TERA-FY CLIENT]","font-weight: bold; color: #ff5722;",...e)}set(e,r,o){let a={ignoreNullish:!0,...o};return typeof e=="string"?(!a.ignoreNullish||r!=null)&&(this.settings[e]=r):Object.assign(this.settings,e),this.toggleDevMode(this.settings.devMode)}setIfDev(e,r,o){return!this.settings.devMode||r===void 0?this:this.set(e,r,o)}use(e,r){let o=typeof e=="function"?new e(this,r):typeof e=="object"?e:typeof e=="string"?(()=>{throw new Error("use(String) is not yet supported")})():(()=>{throw new Error("Expected use() call to be provided with a class initalizer")})();return this.mixin(this,o),this.plugins.push(o),this}mixin(e,r){Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(o=>!["constructor","prototype","name"].includes(o)).filter(o=>o!="init").forEach(o=>{Object.defineProperty(e,o,{value:r[o].bind(e),enumerable:!1})})}toggleDevMode(e="toggle"){return e==="toggle"?this.settings.devMode=!this.settings.devMode:e==="proxy"?Object.assign(this.settings,{devMode:!0,siteUrl:"http://localhost:7334/embed",mode:"child"}):this.settings.devMode=!!e,this.settings.devMode&&(this.settings.restrictOrigin="*"),this.dom?.el&&this.dom.el.classList.toggle("dev-mode",this.settings.devMode),this}toggleFocus(e="toggle"){this.debug("INFO",2,"Request focus",{isFocused:e}),globalThis.document.body.classList.toggle("tera-fy-focus",e==="toggle"?void 0:e)}getEntropicString(e=32){let r=new Uint32Array(4);return window.crypto.getRandomValues(r),btoa(String.fromCharCode(...new Uint8Array(r.buffer))).replace(/[+/]/g,"").slice(0,e)}selectProjectFile(e){return this.rpc("selectProjectFile",e).then(r=>r&&new U({tera:this,...r}))}getProjectFiles(e){return this.rpc("getProjectFiles",e).then(r=>r.map(o=>new U({tera:this,...o})))}getProjectFile(e,r){return this.rpc("getProjectFile",e,r).then(o=>o&&new U({tera:this,...o}))}createProjectFile(e){return this.rpc("createProjectFile",e).then(r=>r&&new U({tera:this,...r}))}};export{zt as default};
|
|
3
3
|
/*! Bundled license information:
|
|
4
4
|
|
|
5
5
|
lodash-es/lodash.js:
|
|
@@ -107,8 +107,7 @@ export default class TeraFy {
|
|
|
107
107
|
|
|
108
108
|
// FIXME: Not sure if this is actually detecting errors? addEventListener instead maybe?
|
|
109
109
|
script.onerror = (error) => {
|
|
110
|
-
|
|
111
|
-
reject(new Error(`Failed to load module from ${url}`));
|
|
110
|
+
reject(new Error(`Failed to load module from ${url} - ${error.toString()}`));
|
|
112
111
|
cleanup();
|
|
113
112
|
};
|
|
114
113
|
|
package/lib/terafy.client.js
CHANGED
|
@@ -18,7 +18,7 @@ export default class TeraFy {
|
|
|
18
18
|
*
|
|
19
19
|
* @type {Object}
|
|
20
20
|
* @property {String} session Unique session signature for this instance of TeraFy, used to sign server messages, if falsy `getEntropicString(16)` is used to populate
|
|
21
|
-
* @property {Boolean} devMode Operate in Dev-Mode - i.e. force outer refresh when encountering an existing TeraFy instance
|
|
21
|
+
* @property {Boolean} devMode Operate in Dev-Mode - i.e. force outer refresh when encountering an existing TeraFy instance + be more tolerent of weird iframe origins
|
|
22
22
|
* @property {Number} verbosity Verbosity level, the higher the more chatty TeraFY will be. Set to zero to disable all `debug()` call output
|
|
23
23
|
* @property {'detect'|'parent'|'child'|'popup'} mode How to communicate with TERA. 'parent' assumes that the parent of the current document is TERA, 'child' spawns an iFrame and uses TERA there, 'detect' tries parent and switches to `modeFallback` if communication fails
|
|
24
24
|
* @property {String} modeFallback Method to use when all method detection fails
|
|
@@ -35,7 +35,7 @@ export default class TeraFy {
|
|
|
35
35
|
session: null,
|
|
36
36
|
// client: 'tera-fy', // Reserved by terafy.bootstrapper.js
|
|
37
37
|
// clientType: 'esm', // Reserved by terafy.bootstrapper.js
|
|
38
|
-
devMode:
|
|
38
|
+
devMode: false,
|
|
39
39
|
verbosity: 1,
|
|
40
40
|
mode: 'detect',
|
|
41
41
|
modeTimeout: 300,
|
|
@@ -47,8 +47,6 @@ export default class TeraFy {
|
|
|
47
47
|
siteUrl: 'https://dev.tera-tools.com/embed', // Repoint URL to dev site
|
|
48
48
|
restrictOrigin: 'https://dev.tera-tools.com', // Move origin restriction rule to point at dev site
|
|
49
49
|
});
|
|
50
|
-
} else { // If we're using some weird upstream allow all origins for postMessage
|
|
51
|
-
config.restrictOrigin = '*'; // Allow all upstream iframes
|
|
52
50
|
}
|
|
53
51
|
},
|
|
54
52
|
},
|
|
@@ -253,10 +251,10 @@ export default class TeraFy {
|
|
|
253
251
|
* @returns {Promise} A promise which will resolve when the message has been processed
|
|
254
252
|
*/
|
|
255
253
|
acceptMessage(rawMessage) {
|
|
256
|
-
if (rawMessage.origin == window.location.origin) return; // Message came from us
|
|
254
|
+
if (rawMessage.origin == window.location.origin) return Promise.resolve(); // Message came from us
|
|
257
255
|
|
|
258
256
|
let message = rawMessage.data;
|
|
259
|
-
if (!message.TERA || !message.id) return; // Ignore non-TERA signed messages
|
|
257
|
+
if (!message.TERA || !message.id) return Promise.resolve(); // Ignore non-TERA signed messages
|
|
260
258
|
this.debug('INFO', 3, 'Recieved message', message);
|
|
261
259
|
|
|
262
260
|
if (message?.action == 'response' && this.acceptPostboxes[message.id]) { // Postbox waiting for reply
|
|
@@ -265,6 +263,7 @@ export default class TeraFy {
|
|
|
265
263
|
} else {
|
|
266
264
|
this.acceptPostboxes[message.id].resolve(message.response);
|
|
267
265
|
}
|
|
266
|
+
return Promise.resolve();
|
|
268
267
|
} else if (message?.action == 'rpc') {
|
|
269
268
|
return Promise.resolve()
|
|
270
269
|
.then(()=> this[message.method].apply(this, message.args))
|
|
@@ -291,8 +290,10 @@ export default class TeraFy {
|
|
|
291
290
|
})
|
|
292
291
|
} else if (message?.id) {
|
|
293
292
|
this.debug('INFO', 3, `Ignoring message ID ${message.id} - was meant for someone else?`);
|
|
293
|
+
return Promise.resolve();
|
|
294
294
|
} else {
|
|
295
295
|
this.debug('INFO', 3, 'Unexpected incoming TERA-FY CLIENT message', {message});
|
|
296
|
+
return Promise.resolve();
|
|
296
297
|
}
|
|
297
298
|
}
|
|
298
299
|
|
|
@@ -351,6 +352,7 @@ export default class TeraFy {
|
|
|
351
352
|
}
|
|
352
353
|
|
|
353
354
|
|
|
355
|
+
// eslint-disable-next-line jsdoc/require-returns-check
|
|
354
356
|
/**
|
|
355
357
|
* Client function which accepts a patch from the server and applies it to local project state
|
|
356
358
|
* The patch should follow the [JSPatch](http://jsonpatch.com) standard
|
|
@@ -805,21 +807,21 @@ export default class TeraFy {
|
|
|
805
807
|
/**
|
|
806
808
|
* Include a TeraFy client plugin
|
|
807
809
|
*
|
|
808
|
-
* @param {Object|String} source Either the JS module
|
|
810
|
+
* @param {Function|Object|String} source Either the JS module class, singleton object or URL to fetch it from. Eventually constructed as invoked as `(teraClient:TeraFy, options:Object)`
|
|
809
811
|
* @param {Object} [options] Additional options to mutate behaviour during construction (pass options to init() to intialize later options)
|
|
810
812
|
*
|
|
811
813
|
* @returns {TeraFy} This chainable terafy instance
|
|
812
814
|
*/
|
|
813
815
|
use(source, options) {
|
|
814
816
|
let mod =
|
|
815
|
-
typeof
|
|
816
|
-
: typeof
|
|
817
|
+
typeof source == 'function' ? new source(this, options)
|
|
818
|
+
: typeof source == 'object' ? source
|
|
819
|
+
: typeof source == 'string' ? (()=> { throw new Error('use(String) is not yet supported') })()
|
|
817
820
|
: (()=> { throw new Error('Expected use() call to be provided with a class initalizer') })();
|
|
818
821
|
|
|
819
|
-
|
|
820
|
-
this.mixin(this, singleton);
|
|
822
|
+
this.mixin(this, mod);
|
|
821
823
|
|
|
822
|
-
this.plugins.push(
|
|
824
|
+
this.plugins.push(mod);
|
|
823
825
|
return this;
|
|
824
826
|
}
|
|
825
827
|
|
|
@@ -871,6 +873,9 @@ export default class TeraFy {
|
|
|
871
873
|
this.settings.devMode = !! devModeEnabled;
|
|
872
874
|
}
|
|
873
875
|
|
|
876
|
+
if (this.settings.devMode)
|
|
877
|
+
this.settings.restrictOrigin = '*'; // Allow all upstream iframes
|
|
878
|
+
|
|
874
879
|
if (this.dom?.el) // Have we actually set up yet?
|
|
875
880
|
this.dom.el.classList.toggle('dev-mode', this.settings.devMode);
|
|
876
881
|
|
|
@@ -1212,8 +1217,8 @@ export default class TeraFy {
|
|
|
1212
1217
|
*
|
|
1213
1218
|
* @returns {Promise<ProjectFile>} The eventual fetched ProjectFile (or requested subkey)
|
|
1214
1219
|
*/
|
|
1215
|
-
getProjectFile(id) {
|
|
1216
|
-
return this.rpc('getProjectFile', id)
|
|
1220
|
+
getProjectFile(id, options) {
|
|
1221
|
+
return this.rpc('getProjectFile', id, options)
|
|
1217
1222
|
.then(file => file
|
|
1218
1223
|
? new ProjectFile({
|
|
1219
1224
|
tera: this,
|
package/lib/terafy.proxy.js
CHANGED
|
@@ -63,9 +63,9 @@ export class TeraProxy {
|
|
|
63
63
|
let domain = createDomain();
|
|
64
64
|
domain.on('error', err => {
|
|
65
65
|
if (err.code == 'EADDRINUSE') {
|
|
66
|
-
|
|
66
|
+
reject('PORT-CONFLICT');
|
|
67
67
|
} else {
|
|
68
|
-
|
|
68
|
+
reject(err);
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
this.proxyServer.listen(this.settings.port, ()=> {
|
package/lib/terafy.server.js
CHANGED
|
@@ -112,7 +112,7 @@ export default class TeraFyServer {
|
|
|
112
112
|
this.debug('INFO', 2, 'Cannot locate TERA-FY top-level->iFrame#external - maybe there is none');
|
|
113
113
|
return mixin(this, {
|
|
114
114
|
sendRaw(message) {
|
|
115
|
-
this.debug('INFO', 2, 'Sending broadcast to zero listening clients');
|
|
115
|
+
this.debug('INFO', 2, 'Sending broadcast to zero listening clients', {message});
|
|
116
116
|
},
|
|
117
117
|
});
|
|
118
118
|
}
|
|
@@ -756,6 +756,13 @@ export default class TeraFyServer {
|
|
|
756
756
|
|
|
757
757
|
if (!app.service('$projects').active) throw new Error('No active project');
|
|
758
758
|
if (typeof path != 'string' && !Array.isArray(path)) throw new Error('setProjectStateDefaults(path, value) - path must be a dotted string or array of path segments');
|
|
759
|
+
if (
|
|
760
|
+
path === ''
|
|
761
|
+
|| (
|
|
762
|
+
Array.isArray(path)
|
|
763
|
+
&& path.length == 0
|
|
764
|
+
)
|
|
765
|
+
) throw new Error('setProjectState path cannot be empty! Use replaceProjectState() if you really want to do this');
|
|
759
766
|
|
|
760
767
|
pathTools.set(
|
|
761
768
|
app.service('$projects').active,
|
|
@@ -1074,7 +1081,7 @@ export default class TeraFyServer {
|
|
|
1074
1081
|
*
|
|
1075
1082
|
* @param {String} [id] File ID to retrieve the contents of
|
|
1076
1083
|
*
|
|
1077
|
-
* @param {Object} [options]
|
|
1084
|
+
* @param {Object} [options] Additional options to mutate behaviour
|
|
1078
1085
|
* @param {'blob'|'json'} [options.format='blob'] The format to retrieve the file in. If `json` the raw output is run via JSON.parse() first
|
|
1079
1086
|
*
|
|
1080
1087
|
* @returns {*} The file contents in the requested format
|
|
@@ -1562,6 +1569,7 @@ export default class TeraFyServer {
|
|
|
1562
1569
|
} else { // Merge options with existing uiProgress window
|
|
1563
1570
|
Object.assign(this.uiProgressOptions, options);
|
|
1564
1571
|
}
|
|
1572
|
+
|
|
1565
1573
|
if (this.uiProgressOptions.close) { // Asked to close the dialog
|
|
1566
1574
|
return Promise.resolve()
|
|
1567
1575
|
.then(()=> this.uiProgressPromise && app.service('$prompt').close(true)) // Close the dialog if its open
|
|
@@ -1580,6 +1588,8 @@ export default class TeraFyServer {
|
|
|
1580
1588
|
})
|
|
1581
1589
|
);
|
|
1582
1590
|
return Promise.resolve();
|
|
1591
|
+
} else {
|
|
1592
|
+
throw new Error('Unknown uiProgress state');
|
|
1583
1593
|
}
|
|
1584
1594
|
}
|
|
1585
1595
|
|
|
@@ -1633,7 +1643,7 @@ export default class TeraFyServer {
|
|
|
1633
1643
|
class: 'btn btn-success',
|
|
1634
1644
|
icon: 'fas fa-check',
|
|
1635
1645
|
title: 'Ok',
|
|
1636
|
-
click(
|
|
1646
|
+
click() {
|
|
1637
1647
|
return this.$prompt.close(true, this.newValue);
|
|
1638
1648
|
},
|
|
1639
1649
|
},
|
package/package.json
CHANGED
package/plugins/vue2.js
CHANGED
|
@@ -79,7 +79,7 @@ export default class TeraFyPluginVue2 extends TeraFyPluginBase {
|
|
|
79
79
|
if (settings.componentKey) return; // Already allocated by user
|
|
80
80
|
for (let x = 0; x < 50; x++) {
|
|
81
81
|
let key = `terafy_${x}`;
|
|
82
|
-
if (!Object.hasOwnProperty(settings.component, key)) {
|
|
82
|
+
if (!Object.hasOwnProperty(settings.component, key)) {
|
|
83
83
|
settings.componentKey = key;
|
|
84
84
|
return;
|
|
85
85
|
}
|