@shopware-ag/admin-extension-sdk
Advanced tools
Comparing version 0.0.46 to 0.0.47
@@ -1,1 +0,1 @@ | ||
var sg=Object.defineProperty;var Te=Object.getOwnPropertySymbols;var og=Object.prototype.hasOwnProperty,cg=Object.prototype.propertyIsEnumerable;var mt=(p,h,b)=>h in p?sg(p,h,{enumerable:!0,configurable:!0,writable:!0,value:b}):p[h]=b,wt=(p,h)=>{for(var b in h||(h={}))og.call(h,b)&&mt(p,b,h[b]);if(Te)for(var b of Te(h))cg.call(h,b)&&mt(p,b,h[b]);return p};var g=(p,h,b)=>(mt(p,typeof h!="symbol"?h+"":h,b),b);(function(p,h){typeof exports=="object"&&typeof module!="undefined"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(p=typeof globalThis!="undefined"?globalThis:p||self,h(p.sw={}))})(this,function(p){var Se;"use strict";function h(){return String(Date.now().toString(36)+Math.random().toString(36).substr(2))}function b(t){return t!==null&&typeof t=="object"}function Q(){return new URLSearchParams(window.location.search).get("location-id")}function je(){const t=window.location;return new URL(t.pathname,t.origin).toString()}function X(t,e){return b(e)&&e.__type__&&e.__type__===t}const Z={notificationDispatch:{},windowRedirect:{},windowReload:{},contextLanguage:{},contextEnvironment:{},contextLocale:{},contextCurrency:{},contextShopwareVersion:{},contextAppInformation:{},getPageTitle:{},uiComponentSectionRenderer:{},uiTabsAddTabItem:{},locationUpdateHeight:{},menuItemAdd:{},settingsItemAdd:{},mainModuleAdd:{},uiModalOpen:{},uiModalClose:{},actionButtonAdd:{},actionExecute:{},__function__:{},__registerWindow__:{},_criteriaTest:{},_collectionTest:{},_multiply:{},_subtract:{},_privileges:{create:["user"],read:["user"],update:["user"],delete:["user"]}};function Oe(t){const e=At(t),r=Ie(window.location);return!e||Object.keys(e).length<=0?null:St(e,r)}function Ce(t,e,r){const n=At(t),i=Pe(e,r);return i?St(n,i.permissions):null}function At(t){var e;return(e=Z[t])!=null?e:{}}function Ie(t){const r=new URLSearchParams(t.search).get("privileges");return r?JSON.parse(r):{}}function St(t,e){const r=Object.keys(t),n=[];return r.forEach(i=>{var s;(s=t[i])==null||s.forEach(a=>{var c;(c=e[i])!=null&&c.includes(a)||n.push(`${i}:${a}`)})}),n.length>=1?n:null}function Pe(t,e){let r=null;return Object.values(t).forEach(n=>{n.baseUrl===e&&(r=n)}),r}class tt extends Error{constructor(e,r){super(`Your app is missing the priviliges ${r.join(", ")} for action "${e}".`);g(this,"missingPrivileges");this.missingPrivileges=r,Object.setPrototypeOf(this,tt.prototype)}}const Me=({send:t,handleFactory:e})=>{const r={};let n=!1;function i(){if(n)return;n=!0,e({})("__function__",async({args:u,id:o})=>await Promise.resolve(r[o](...u)))}return{name:"function",serialize:({value:c})=>{if(typeof c=="function"){const u=h();return r[u]=c,i(),{__type__:"__function__",id:u,origin:window.origin}}},deserialize:({value:c,event:u})=>{var l;const o=(l=u==null?void 0:u.source)!=null?l:window;if(b(c)&&c.__type__&&c.__type__==="__function__"&&typeof c.id=="string"){const f=c.id,y=c.origin;return(...m)=>t("__function__",{args:m,id:f},o,y)}}}};var B=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Ee(){this.__data__=[],this.size=0}var xe=Ee;function De(t,e){return t===e||t!==t&&e!==e}var Tt=De,Le=Tt;function ze(t,e){for(var r=t.length;r--;)if(Le(t[r][0],e))return r;return-1}var H=ze,Fe=H,Ne=Array.prototype,Ge=Ne.splice;function Re(t){var e=this.__data__,r=Fe(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Ge.call(e,r,1),--this.size,!0}var Ue=Re,Be=H;function He(t){var e=this.__data__,r=Be(e,t);return r<0?void 0:e[r][1]}var Ke=He,ke=H;function qe(t){return ke(this.__data__,t)>-1}var Ve=qe,We=H;function Je(t,e){var r=this.__data__,n=We(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var Ye=Je,Qe=xe,Xe=Ue,Ze=Ke,tr=Ve,er=Ye;function C(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}C.prototype.clear=Qe,C.prototype.delete=Xe,C.prototype.get=Ze,C.prototype.has=tr,C.prototype.set=er;var K=C,rr=K;function nr(){this.__data__=new rr,this.size=0}var ir=nr;function ar(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var sr=ar;function or(t){return this.__data__.get(t)}var cr=or;function ur(t){return this.__data__.has(t)}var lr=ur,gr=typeof B=="object"&&B&&B.Object===Object&&B,jt=gr,fr=jt,dr=typeof self=="object"&&self&&self.Object===Object&&self,_r=fr||dr||Function("return this")(),S=_r,pr=S,hr=pr.Symbol,et=hr,Ot=et,Ct=Object.prototype,yr=Ct.hasOwnProperty,vr=Ct.toString,z=Ot?Ot.toStringTag:void 0;function br(t){var e=yr.call(t,z),r=t[z];try{t[z]=void 0;var n=!0}catch{}var i=vr.call(t);return n&&(e?t[z]=r:delete t[z]),i}var $r=br,mr=Object.prototype,wr=mr.toString;function Ar(t){return wr.call(t)}var Sr=Ar,It=et,Tr=$r,jr=Sr,Or="[object Null]",Cr="[object Undefined]",Pt=It?It.toStringTag:void 0;function Ir(t){return t==null?t===void 0?Cr:Or:Pt&&Pt in Object(t)?Tr(t):jr(t)}var k=Ir;function Pr(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var F=Pr,Mr=k,Er=F,xr="[object AsyncFunction]",Dr="[object Function]",Lr="[object GeneratorFunction]",zr="[object Proxy]";function Fr(t){if(!Er(t))return!1;var e=Mr(t);return e==Dr||e==Lr||e==xr||e==zr}var Mt=Fr,Nr=S,Gr=Nr["__core-js_shared__"],Rr=Gr,rt=Rr,Et=function(){var t=/[^.]+$/.exec(rt&&rt.keys&&rt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Ur(t){return!!Et&&Et in t}var Br=Ur,Hr=Function.prototype,Kr=Hr.toString;function kr(t){if(t!=null){try{return Kr.call(t)}catch{}try{return t+""}catch{}}return""}var xt=kr,qr=Mt,Vr=Br,Wr=F,Jr=xt,Yr=/[\\^$.*+?()[\]{}|]/g,Qr=/^\[object .+?Constructor\]$/,Xr=Function.prototype,Zr=Object.prototype,tn=Xr.toString,en=Zr.hasOwnProperty,rn=RegExp("^"+tn.call(en).replace(Yr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function nn(t){if(!Wr(t)||Vr(t))return!1;var e=qr(t)?rn:Qr;return e.test(Jr(t))}var an=nn;function sn(t,e){return t==null?void 0:t[e]}var on=sn,cn=an,un=on;function ln(t,e){var r=un(t,e);return cn(r)?r:void 0}var j=ln,gn=j,fn=S,dn=gn(fn,"Map"),nt=dn,_n=j,pn=_n(Object,"create"),q=pn,Dt=q;function hn(){this.__data__=Dt?Dt(null):{},this.size=0}var yn=hn;function vn(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var bn=vn,$n=q,mn="__lodash_hash_undefined__",wn=Object.prototype,An=wn.hasOwnProperty;function Sn(t){var e=this.__data__;if($n){var r=e[t];return r===mn?void 0:r}return An.call(e,t)?e[t]:void 0}var Tn=Sn,jn=q,On=Object.prototype,Cn=On.hasOwnProperty;function In(t){var e=this.__data__;return jn?e[t]!==void 0:Cn.call(e,t)}var Pn=In,Mn=q,En="__lodash_hash_undefined__";function xn(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Mn&&e===void 0?En:e,this}var Dn=xn,Ln=yn,zn=bn,Fn=Tn,Nn=Pn,Gn=Dn;function I(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}I.prototype.clear=Ln,I.prototype.delete=zn,I.prototype.get=Fn,I.prototype.has=Nn,I.prototype.set=Gn;var Rn=I,Lt=Rn,Un=K,Bn=nt;function Hn(){this.size=0,this.__data__={hash:new Lt,map:new(Bn||Un),string:new Lt}}var Kn=Hn;function kn(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var qn=kn,Vn=qn;function Wn(t,e){var r=t.__data__;return Vn(e)?r[typeof e=="string"?"string":"hash"]:r.map}var V=Wn,Jn=V;function Yn(t){var e=Jn(this,t).delete(t);return this.size-=e?1:0,e}var Qn=Yn,Xn=V;function Zn(t){return Xn(this,t).get(t)}var ti=Zn,ei=V;function ri(t){return ei(this,t).has(t)}var ni=ri,ii=V;function ai(t,e){var r=ii(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var si=ai,oi=Kn,ci=Qn,ui=ti,li=ni,gi=si;function P(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}P.prototype.clear=oi,P.prototype.delete=ci,P.prototype.get=ui,P.prototype.has=li,P.prototype.set=gi;var fi=P,di=K,_i=nt,pi=fi,hi=200;function yi(t,e){var r=this.__data__;if(r instanceof di){var n=r.__data__;if(!_i||n.length<hi-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new pi(n)}return r.set(t,e),this.size=r.size,this}var vi=yi,bi=K,$i=ir,mi=sr,wi=cr,Ai=lr,Si=vi;function M(t){var e=this.__data__=new bi(t);this.size=e.size}M.prototype.clear=$i,M.prototype.delete=mi,M.prototype.get=wi,M.prototype.has=Ai,M.prototype.set=Si;var Ti=M;function ji(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}var Oi=ji,Ci=j,Ii=function(){try{var t=Ci(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Pi=Ii,zt=Pi;function Mi(t,e,r){e=="__proto__"&&zt?zt(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Ft=Mi,Ei=Ft,xi=Tt,Di=Object.prototype,Li=Di.hasOwnProperty;function zi(t,e,r){var n=t[e];(!(Li.call(t,e)&&xi(n,r))||r===void 0&&!(e in t))&&Ei(t,e,r)}var Nt=zi,Fi=Nt,Ni=Ft;function Gi(t,e,r,n){var i=!r;r||(r={});for(var s=-1,a=e.length;++s<a;){var c=e[s],u=n?n(r[c],t[c],c,r,t):void 0;u===void 0&&(u=t[c]),i?Ni(r,c,u):Fi(r,c,u)}return r}var W=Gi;function Ri(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var Ui=Ri;function Bi(t){return t!=null&&typeof t=="object"}var N=Bi,Hi=k,Ki=N,ki="[object Arguments]";function qi(t){return Ki(t)&&Hi(t)==ki}var Vi=qi,Gt=Vi,Wi=N,Rt=Object.prototype,Ji=Rt.hasOwnProperty,Yi=Rt.propertyIsEnumerable,Qi=Gt(function(){return arguments}())?Gt:function(t){return Wi(t)&&Ji.call(t,"callee")&&!Yi.call(t,"callee")},Xi=Qi,Zi=Array.isArray,it=Zi,J={exports:{}};function ta(){return!1}var ea=ta;(function(t,e){var r=S,n=ea,i=e&&!e.nodeType&&e,s=i&&!0&&t&&!t.nodeType&&t,a=s&&s.exports===i,c=a?r.Buffer:void 0,u=c?c.isBuffer:void 0,o=u||n;t.exports=o})(J,J.exports);var ra=9007199254740991,na=/^(?:0|[1-9]\d*)$/;function ia(t,e){var r=typeof t;return e=e==null?ra:e,!!e&&(r=="number"||r!="symbol"&&na.test(t))&&t>-1&&t%1==0&&t<e}var aa=ia,sa=9007199254740991;function oa(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=sa}var Ut=oa,ca=k,ua=Ut,la=N,ga="[object Arguments]",fa="[object Array]",da="[object Boolean]",_a="[object Date]",pa="[object Error]",ha="[object Function]",ya="[object Map]",va="[object Number]",ba="[object Object]",$a="[object RegExp]",ma="[object Set]",wa="[object String]",Aa="[object WeakMap]",Sa="[object ArrayBuffer]",Ta="[object DataView]",ja="[object Float32Array]",Oa="[object Float64Array]",Ca="[object Int8Array]",Ia="[object Int16Array]",Pa="[object Int32Array]",Ma="[object Uint8Array]",Ea="[object Uint8ClampedArray]",xa="[object Uint16Array]",Da="[object Uint32Array]",_={};_[ja]=_[Oa]=_[Ca]=_[Ia]=_[Pa]=_[Ma]=_[Ea]=_[xa]=_[Da]=!0,_[ga]=_[fa]=_[Sa]=_[da]=_[Ta]=_[_a]=_[pa]=_[ha]=_[ya]=_[va]=_[ba]=_[$a]=_[ma]=_[wa]=_[Aa]=!1;function La(t){return la(t)&&ua(t.length)&&!!_[ca(t)]}var za=La;function Fa(t){return function(e){return t(e)}}var at=Fa,G={exports:{}};(function(t,e){var r=jt,n=e&&!e.nodeType&&e,i=n&&!0&&t&&!t.nodeType&&t,s=i&&i.exports===n,a=s&&r.process,c=function(){try{var u=i&&i.require&&i.require("util").types;return u||a&&a.binding&&a.binding("util")}catch{}}();t.exports=c})(G,G.exports);var Na=za,Ga=at,Bt=G.exports,Ht=Bt&&Bt.isTypedArray,Ra=Ht?Ga(Ht):Na,Ua=Ra,Ba=Ui,Ha=Xi,Ka=it,ka=J.exports,qa=aa,Va=Ua,Wa=Object.prototype,Ja=Wa.hasOwnProperty;function Ya(t,e){var r=Ka(t),n=!r&&Ha(t),i=!r&&!n&&ka(t),s=!r&&!n&&!i&&Va(t),a=r||n||i||s,c=a?Ba(t.length,String):[],u=c.length;for(var o in t)(e||Ja.call(t,o))&&!(a&&(o=="length"||i&&(o=="offset"||o=="parent")||s&&(o=="buffer"||o=="byteLength"||o=="byteOffset")||qa(o,u)))&&c.push(o);return c}var Kt=Ya,Qa=Object.prototype;function Xa(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Qa;return t===r}var st=Xa;function Za(t,e){return function(r){return t(e(r))}}var kt=Za,ts=kt,es=ts(Object.keys,Object),rs=es,ns=st,is=rs,as=Object.prototype,ss=as.hasOwnProperty;function os(t){if(!ns(t))return is(t);var e=[];for(var r in Object(t))ss.call(t,r)&&r!="constructor"&&e.push(r);return e}var cs=os,us=Mt,ls=Ut;function gs(t){return t!=null&&ls(t.length)&&!us(t)}var qt=gs,fs=Kt,ds=cs,_s=qt;function ps(t){return _s(t)?fs(t):ds(t)}var ot=ps,hs=W,ys=ot;function vs(t,e){return t&&hs(e,ys(e),t)}var bs=vs;function $s(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var ms=$s,ws=F,As=st,Ss=ms,Ts=Object.prototype,js=Ts.hasOwnProperty;function Os(t){if(!ws(t))return Ss(t);var e=As(t),r=[];for(var n in t)n=="constructor"&&(e||!js.call(t,n))||r.push(n);return r}var Cs=Os,Is=Kt,Ps=Cs,Ms=qt;function Es(t){return Ms(t)?Is(t,!0):Ps(t)}var ct=Es,xs=W,Ds=ct;function Ls(t,e){return t&&xs(e,Ds(e),t)}var zs=Ls,ut={exports:{}};(function(t,e){var r=S,n=e&&!e.nodeType&&e,i=n&&!0&&t&&!t.nodeType&&t,s=i&&i.exports===n,a=s?r.Buffer:void 0,c=a?a.allocUnsafe:void 0;function u(o,l){if(l)return o.slice();var f=o.length,y=c?c(f):new o.constructor(f);return o.copy(y),y}t.exports=u})(ut,ut.exports);function Fs(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var Ns=Fs;function Gs(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r<n;){var a=t[r];e(a,r,t)&&(s[i++]=a)}return s}var Rs=Gs;function Us(){return[]}var Vt=Us,Bs=Rs,Hs=Vt,Ks=Object.prototype,ks=Ks.propertyIsEnumerable,Wt=Object.getOwnPropertySymbols,qs=Wt?function(t){return t==null?[]:(t=Object(t),Bs(Wt(t),function(e){return ks.call(t,e)}))}:Hs,lt=qs,Vs=W,Ws=lt;function Js(t,e){return Vs(t,Ws(t),e)}var Ys=Js;function Qs(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var Jt=Qs,Xs=kt,Zs=Xs(Object.getPrototypeOf,Object),Yt=Zs,to=Jt,eo=Yt,ro=lt,no=Vt,io=Object.getOwnPropertySymbols,ao=io?function(t){for(var e=[];t;)to(e,ro(t)),t=eo(t);return e}:no,Qt=ao,so=W,oo=Qt;function co(t,e){return so(t,oo(t),e)}var uo=co,lo=Jt,go=it;function fo(t,e,r){var n=e(t);return go(t)?n:lo(n,r(t))}var Xt=fo,_o=Xt,po=lt,ho=ot;function yo(t){return _o(t,ho,po)}var vo=yo,bo=Xt,$o=Qt,mo=ct;function wo(t){return bo(t,mo,$o)}var Ao=wo,So=j,To=S,jo=So(To,"DataView"),Oo=jo,Co=j,Io=S,Po=Co(Io,"Promise"),Mo=Po,Eo=j,xo=S,Do=Eo(xo,"Set"),Lo=Do,zo=j,Fo=S,No=zo(Fo,"WeakMap"),Go=No,gt=Oo,ft=nt,dt=Mo,_t=Lo,pt=Go,Zt=k,E=xt,te="[object Map]",Ro="[object Object]",ee="[object Promise]",re="[object Set]",ne="[object WeakMap]",ie="[object DataView]",Uo=E(gt),Bo=E(ft),Ho=E(dt),Ko=E(_t),ko=E(pt),O=Zt;(gt&&O(new gt(new ArrayBuffer(1)))!=ie||ft&&O(new ft)!=te||dt&&O(dt.resolve())!=ee||_t&&O(new _t)!=re||pt&&O(new pt)!=ne)&&(O=function(t){var e=Zt(t),r=e==Ro?t.constructor:void 0,n=r?E(r):"";if(n)switch(n){case Uo:return ie;case Bo:return te;case Ho:return ee;case Ko:return re;case ko:return ne}return e});var ht=O,qo=Object.prototype,Vo=qo.hasOwnProperty;function Wo(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Vo.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Jo=Wo,Yo=S,Qo=Yo.Uint8Array,Xo=Qo,ae=Xo;function Zo(t){var e=new t.constructor(t.byteLength);return new ae(e).set(new ae(t)),e}var yt=Zo,tc=yt;function ec(t,e){var r=e?tc(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var rc=ec,nc=/\w*$/;function ic(t){var e=new t.constructor(t.source,nc.exec(t));return e.lastIndex=t.lastIndex,e}var ac=ic,se=et,oe=se?se.prototype:void 0,ce=oe?oe.valueOf:void 0;function sc(t){return ce?Object(ce.call(t)):{}}var oc=sc,cc=yt;function uc(t,e){var r=e?cc(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var lc=uc,gc=yt,fc=rc,dc=ac,_c=oc,pc=lc,hc="[object Boolean]",yc="[object Date]",vc="[object Map]",bc="[object Number]",$c="[object RegExp]",mc="[object Set]",wc="[object String]",Ac="[object Symbol]",Sc="[object ArrayBuffer]",Tc="[object DataView]",jc="[object Float32Array]",Oc="[object Float64Array]",Cc="[object Int8Array]",Ic="[object Int16Array]",Pc="[object Int32Array]",Mc="[object Uint8Array]",Ec="[object Uint8ClampedArray]",xc="[object Uint16Array]",Dc="[object Uint32Array]";function Lc(t,e,r){var n=t.constructor;switch(e){case Sc:return gc(t);case hc:case yc:return new n(+t);case Tc:return fc(t,r);case jc:case Oc:case Cc:case Ic:case Pc:case Mc:case Ec:case xc:case Dc:return pc(t,r);case vc:return new n;case bc:case wc:return new n(t);case $c:return dc(t);case mc:return new n;case Ac:return _c(t)}}var zc=Lc,Fc=F,ue=Object.create,Nc=function(){function t(){}return function(e){if(!Fc(e))return{};if(ue)return ue(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),Gc=Nc,Rc=Gc,Uc=Yt,Bc=st;function Hc(t){return typeof t.constructor=="function"&&!Bc(t)?Rc(Uc(t)):{}}var Kc=Hc,kc=ht,qc=N,Vc="[object Map]";function Wc(t){return qc(t)&&kc(t)==Vc}var Jc=Wc,Yc=Jc,Qc=at,le=G.exports,ge=le&&le.isMap,Xc=ge?Qc(ge):Yc,Zc=Xc,tu=ht,eu=N,ru="[object Set]";function nu(t){return eu(t)&&tu(t)==ru}var iu=nu,au=iu,su=at,fe=G.exports,de=fe&&fe.isSet,ou=de?su(de):au,cu=ou,uu=Ti,lu=Oi,gu=Nt,fu=bs,du=zs,_u=ut.exports,pu=Ns,hu=Ys,yu=uo,vu=vo,bu=Ao,$u=ht,mu=Jo,wu=zc,Au=Kc,Su=it,Tu=J.exports,ju=Zc,Ou=F,Cu=cu,Iu=ot,Pu=ct,Mu=1,Eu=2,xu=4,_e="[object Arguments]",Du="[object Array]",Lu="[object Boolean]",zu="[object Date]",Fu="[object Error]",pe="[object Function]",Nu="[object GeneratorFunction]",Gu="[object Map]",Ru="[object Number]",he="[object Object]",Uu="[object RegExp]",Bu="[object Set]",Hu="[object String]",Ku="[object Symbol]",ku="[object WeakMap]",qu="[object ArrayBuffer]",Vu="[object DataView]",Wu="[object Float32Array]",Ju="[object Float64Array]",Yu="[object Int8Array]",Qu="[object Int16Array]",Xu="[object Int32Array]",Zu="[object Uint8Array]",tl="[object Uint8ClampedArray]",el="[object Uint16Array]",rl="[object Uint32Array]",d={};d[_e]=d[Du]=d[qu]=d[Vu]=d[Lu]=d[zu]=d[Wu]=d[Ju]=d[Yu]=d[Qu]=d[Xu]=d[Gu]=d[Ru]=d[he]=d[Uu]=d[Bu]=d[Hu]=d[Ku]=d[Zu]=d[tl]=d[el]=d[rl]=!0,d[Fu]=d[pe]=d[ku]=!1;function Y(t,e,r,n,i,s){var a,c=e&Mu,u=e&Eu,o=e&xu;if(r&&(a=i?r(t,n,i,s):r(t)),a!==void 0)return a;if(!Ou(t))return t;var l=Su(t);if(l){if(a=mu(t),!c)return pu(t,a)}else{var f=$u(t),y=f==pe||f==Nu;if(Tu(t))return _u(t,c);if(f==he||f==_e||y&&!i){if(a=u||y?{}:Au(t),!c)return u?yu(t,du(a,t)):hu(t,fu(a,t))}else{if(!d[f])return i?t:{};a=wu(t,f,c)}}s||(s=new uu);var m=s.get(t);if(m)return m;s.set(t,a),Cu(t)?t.forEach(function(w){a.add(Y(w,e,r,w,t,s))}):ju(t)&&t.forEach(function(w,A){a.set(A,Y(w,e,r,A,t,s))});var L=o?u?bu:vu:u?Pu:Iu,T=l?void 0:L(t);return lu(T||t,function(w,A){T&&(A=w,w=t[A]),gu(a,A,Y(w,e,r,A,t,s))}),a}var ye=Y,nl=ye,il=1,al=4;function sl(t){return nl(t,il|al)}var vt=sl;class x{constructor(e=1,r=25){g(this,"page");g(this,"limit");g(this,"term");g(this,"filters");g(this,"ids");g(this,"queries");g(this,"associations");g(this,"postFilter");g(this,"sortings");g(this,"aggregations");g(this,"grouping");g(this,"fields");g(this,"groupFields");g(this,"totalCountMode");g(this,"includes");this.page=e,this.limit=r,this.term=null,this.filters=[],this.includes=null,this.ids=[],this.queries=[],this.associations=[],this.postFilter=[],this.sortings=[],this.aggregations=[],this.grouping=[],this.groupFields=[],this.fields=[],this.totalCountMode=1}static fromCriteria(e){return vt(e)}parse(){const e={};return this.ids.length>0&&(e.ids=this.ids.join("|")),this.page!==null&&(e.page=this.page),this.limit!==null&&(e.limit=this.limit),this.term!==null&&(e.term=this.term),this.queries.length>0&&(e.query=this.queries),this.filters.length>0&&(e.filter=this.filters),this.postFilter.length>0&&(e["post-filter"]=this.postFilter),this.sortings.length>0&&(e.sort=this.sortings),this.aggregations.length>0&&(e.aggregations=this.aggregations),this.groupFields.length>0&&(e.groupFields=this.groupFields),this.grouping.length>0&&(e.grouping=this.grouping),this.fields.length>0&&(e.fields=this.fields),this.associations.length>0&&(e.associations={},this.associations.forEach(r=>{!e.associations||(e.associations[r.association]=r.criteria.parse())})),this.includes!==null&&(e.includes=this.includes),this.totalCountMode!==null&&(e["total-count-mode"]=this.totalCountMode),e}setIds(e){return this.ids=e,this}setTotalCountMode(e){return typeof e!="number"&&(this.totalCountMode=null),this.totalCountMode=e<0||e>2?null:e,this}setPage(e){return this.page=e,this}setLimit(e){return this.limit=e,this}setTerm(e){return this.term=e,this}addFilter(e){return this.filters.push(e),this}addIncludes(e){return Object.entries(e).forEach(([r,n])=>{this.includes===null&&(this.includes={}),this.includes[r]||(this.includes[r]=[]),this.includes[r].push(...n)}),this}addPostFilter(e){return this.postFilter.push(e),this}addSorting(e){return this.sortings.push(e),this}addQuery(e,r,n=null){const i={score:r,query:e};return n&&(i[n]=n),this.queries.push(i),this}addGroupField(e){return this.groupFields.push(e),this}addGrouping(e){return this.grouping.push(e),this}addFields(...e){return this.fields.push(...e),this}addAggregation(e){return this.aggregations.push(e),this}addAssociation(e){const r=e.split(".");let n=this;return r.forEach(i=>{n=n.getAssociation(i)}),this}getAssociation(e){const r=e.split(".");let n=this;return r.forEach(i=>{n.hasAssociation(i)||n.associations.push({association:i,criteria:new x(null,null)}),n=n.getAssociationCriteria(i)}),n}getAssociationCriteria(e){let r=null;return this.associations.forEach(n=>{n.association===e&&(r=n.criteria)}),r}getLimit(){var e;return(e=this.limit)!=null?e:0}getPage(){var e;return(e=this.page)!=null?e:0}getCriteriaData(){return{page:this.page,limit:this.limit,term:this.term,filters:this.filters,ids:this.ids,queries:this.queries,associations:this.associations,postFilter:this.postFilter,sortings:this.sortings,aggregations:this.aggregations,grouping:this.grouping,fields:this.fields,groupFields:this.groupFields,totalCountMode:this.totalCountMode,includes:this.includes}}hasAssociation(e){return this.associations.some(r=>r.association===e)}resetSorting(){this.sortings=[]}static avg(e,r){return{type:"avg",name:e,field:r}}static count(e,r){return{type:"count",name:e,field:r}}static max(e,r){return{type:"max",name:e,field:r}}static min(e,r){return{type:"min",name:e,field:r}}static stats(e,r){return{type:"stats",name:e,field:r}}static sum(e,r){return{type:"sum",name:e,field:r}}static terms(e,r,n=null,i=null,s=null){return{type:"terms",name:e,field:r,limit:n,sort:i,aggregation:s}}static filter(e,r,n){return{type:"filter",name:e,filter:r,aggregation:n}}static histogram(e,r,n,i,s,a){return{type:"histogram",name:e,field:r,interval:n,format:i,aggregation:s,timeZone:a}}static sort(e,r="ASC",n=!1){return{field:e,order:r,naturalSorting:n}}static naturalSorting(e,r="ASC"){return{field:e,order:r,naturalSorting:!0}}static contains(e,r){return{type:"contains",field:e,value:r}}static prefix(e,r){return{type:"prefix",field:e,value:r}}static suffix(e,r){return{type:"suffix",field:e,value:r}}static equalsAny(e,r){return{type:"equalsAny",field:e,value:r.join("|")}}static range(e,r){return{type:"range",field:e,parameters:r}}static equals(e,r){return{type:"equals",field:e,value:r}}static not(e,r=[]){return{type:"not",operator:e,queries:r}}static multi(e,r=[]){return{type:"multi",operator:e,queries:r}}}const ol=()=>({name:"criteria",serialize:({value:r,customizerMethod:n})=>{if(r instanceof x)return{__type__:"__Criteria__",data:n(r.getCriteriaData())}},deserialize:({value:r,customizerMethod:n})=>{if(X("__Criteria__",r)&&typeof r.data=="object"){const i=r.data,s=new x;return s.setPage(i.page),s.setLimit(i.limit),s.setTerm(i.term),i.filters.forEach(a=>{s.addFilter(a)}),s.setIds(i.ids),i.queries.forEach(({query:a,score:c})=>{s.addQuery(a,c)}),i.associations.forEach(a=>{s.associations.push(n(a))}),i.postFilter.forEach(a=>{s.addPostFilter(a)}),i.sortings.forEach(a=>{s.addSorting(a)}),i.aggregations.forEach(a=>{s.addAggregation(a)}),i.grouping.forEach(a=>{s.addGrouping(a)}),i.fields.forEach(a=>{s.addFields(a)}),i.groupFields.forEach(a=>{s.addGroupField(a)}),i.includes&&s.addIncludes(i.includes),s.setTotalCountMode(i.totalCountMode),s}}});let cl=(t,e,r)=>{t[e]=r};class ul{constructor(e,r,n,i={}){g(this,"id");g(this,"_origin");g(this,"_entityName");g(this,"_draft");g(this,"_isDirty");g(this,"_isNew");var a,c;this.id=e,this._origin=i.originData?vt(i.originData):vt(n),this._entityName=r,this._draft=n,this._isDirty=(a=i.isDirty)!=null?a:!1,this._isNew=(c=i.isNew)!=null?c:!1;const s=this;return new Proxy(this._draft,{get(u,o){return o in s._draft?s._draft[o]:s[o]},set(u,o,l){return cl(s._draft,o,l),s._isDirty=!0,!0}})}markAsNew(){this._isNew=!0}isNew(){return this._isNew}getIsDirty(){return this._isDirty}getOrigin(){return this._origin}getDraft(){return this._draft}getEntityName(){return this._entityName}}const ve=function(e,r,n,i){return new ul(e,r,n,i)},ll=()=>({name:"entity",serialize:({value:r,customizerMethod:n})=>{if(!b(r)||typeof r.getDraft!="function")return;const i=r;return{__type__:"__Entity__",__id__:i.id,__entityName__:i._entityName,__isDirty__:i._isDirty,__isNew__:i._isNew,__origin__:n(i._origin),__draft__:n(i._draft)}},deserialize:({value:r,customizerMethod:n})=>{if(X("__Entity__",r)&&typeof r.__origin__=="object")return new ve(r.__id__,r.__entityName__,n(r.__draft__),{originData:n(r.__origin__),isDirty:r.__isDirty__,isNew:r.__isNew__})}});class D extends Array{constructor(e,r,n,i=null,s=[],a=null,c=null){super();g(this,"entity");g(this,"source");g(this,"context");g(this,"criteria");g(this,"aggregations");g(this,"total");g(this,"first");g(this,"last");g(this,"remove");g(this,"has");g(this,"get");g(this,"getAt");g(this,"getIds");g(this,"add");g(this,"addAt");g(this,"moveItem");this.entity=r,this.source=e,this.context=n,this.criteria=i,this.aggregations=c,this.total=a,this.push(...s),this.first=function(){return this.length<=0?null:this[0]},this.last=function(){return this.length<=0?null:this[this.length-1]},this.remove=function(o){const l=this.findIndex(f=>f.id===o);return l<0?!1:(this.splice(l,1),!0)},this.has=function(o){return this.some(l=>l.id===o)},this.get=function(o){const l=this.find(f=>f.id===o);return typeof l!="undefined"?l:null},this.getAt=function(o){const l=this[o];return typeof l!="undefined"?l:null},this.getIds=function(){return this.map(o=>o.id)},this.add=function(o){this.push(o)},this.addAt=function(o,l){if(typeof l=="undefined"){this.add(o);return}this.splice(l,0,o)},this.moveItem=function(o,l=null){if(l===null&&(l=this.length),o<0||o>=this.length)return null;if(l===o)return this.getAt(o);const f=this.find((L,T)=>T===o);if(typeof f=="undefined")return null;const y=this.filter((L,T)=>T!==o),m=[...y.slice(0,l),f,...y.slice(l)];return this.splice(0,this.length,...m),f},this.filter=function(o,l){const f=Object.getPrototypeOf(this).filter.call(this,o,l);return new D(this.source,this.entity,this.context,this.criteria,f,this.total,this.aggregations)}}static fromCollection(e){return new D(e.source,e.entity,e.context,e.criteria===null?e.criteria:x.fromCriteria(e.criteria),e,e.total,e.aggregations)}}const gl=()=>({name:"entity-collection",serialize:({value:r,customizerMethod:n})=>{if(r instanceof D)return n({__type__:"__EntityCollection__",__source__:r.source,__entityName__:r.entity,__context__:r.context,__criteria__:r.criteria,__entities__:Array.from(r),__total__:r.total,__aggregations__:r.aggregations})},deserialize:({value:r,customizerMethod:n})=>{if(X("__EntityCollection__",r))return new D(r.__source__,r.__entityName__,r.__context__,n(r.__criteria__),n(r.__entities__),r.__total__,r.__aggregations__)}});var fl=ye,dl=1,_l=4;function pl(t,e){return e=typeof e=="function"?e:void 0,fl(t,dl|_l,e)}var be=pl;const hl=[ol,gl,ll,Me];function yl(t){const e=hl.map(a=>a(t));function r(){return e}function n(a){var c;return(c=e.find(u=>u.name===a))!=null?c:null}function i(a){return be(a,(c,u,o,l)=>e.map(y=>y.serialize({value:c,key:u,object:o,stack:l,customizerMethod:i})).find(y=>!!y))}function s(a,c){return be(a,(u,o,l,f)=>e.map(m=>m.deserialize({value:u,key:o,object:l,stack:f,event:c,customizerMethod:s})).find(m=>!!m))}return{getSerializers:r,getSerializerByName:n,serialize:i,deserialize:s}}const{serialize:$e,deserialize:me}=yl({handleFactory:vl,send:$}),bt=new Set;function $(t,e,r,n){const i=Oe(t);if(i!==null){const y=new tt(t,i);return Promise.reject(y)}const s=h(),a=e!=null?e:{},u=$e({_type:t,_data:a,_callbackId:s}),o=JSON.stringify(u);let l=!1;const f=7e3;return new Promise((y,m)=>{const L=function(A){if(typeof A.data!="string")return;let U;try{U=JSON.parse(A.data)}catch{return}if(!ml(U)||U._callbackId!==s||!U.hasOwnProperty("_response"))return;const ag=me(U,A);window.removeEventListener("message",L),l||(l=!0,y(ag._response))};window.addEventListener("message",L);let T=!0;try{T=!window.parent.origin}catch{}let w=T?document.referrer:window.parent.origin;n&&(w=n),r?r.postMessage(o,w):window.parent.postMessage(o,w),setTimeout(()=>{l||m("Send timeout expired. It could be possible that no handler for the postMessage request exists or that the handler freezed.")},f)})}function $t(t,e,r){const n=async function(i){var f;if(Z[t]&&Object.keys(Z[t]).length&&(!r||Ce(t,r,i.origin)!==null)||typeof i.data!="string")return;let s;try{s=JSON.parse(i.data)}catch{return}if(!$l(s)||s._type!==t)return;const a=me(s,i),c=await Promise.resolve(e(a._data,{_event_:i})),u={_callbackId:a._callbackId,_type:a._type,_response:c!=null?c:null},o=$e(u),l=JSON.stringify(o);i.source?i.source.postMessage(l,{targetOrigin:(f=i.origin)!=null?f:"*"}):window.postMessage(l,window.origin)};return window.addEventListener("message",n),()=>window.removeEventListener("message",n)}function vl(t){return(e,r)=>$t(e,r,t)}function bl(t,e){return $t(t,e,{})}function v(t,e){return r=>$(t,wt(wt({},e),r))}function we(t){return e=>bl(t,e)}(async()=>{$t("__registerWindow__",(t,e)=>{if(e._event_.source){const r=e._event_.source;bt.add({source:r,origin:e._event_.origin})}else bt.add({source:window,origin:window.origin})},{}),await $("__registerWindow__",{})})().catch(t=>console.error(t)),window._swsdk={sourceRegistry:bt};function $l(t){const e=t;return!!e._type&&!!e._data&&!!e._callbackId}function ml(t){const e=t;return!!e._type&&!!e.hasOwnProperty("_response")&&!!e._callbackId}const wl=v("windowRedirect"),Al=v("windowReload",{});var Sl=Object.freeze(Object.defineProperty({__proto__:null,redirect:wl,reload:Al},Symbol.toStringTag,{value:"Module"}));const Tl=v("notificationDispatch");var jl=Object.freeze(Object.defineProperty({__proto__:null,dispatch:Tl},Symbol.toStringTag,{value:"Module"}));const Ol=v("contextLanguage",{}),Cl=we("contextLanguage"),Il=v("contextEnvironment",{}),Pl=v("contextLocale",{}),Ml=we("contextLocale"),El=v("contextCurrency",{}),xl=v("contextShopwareVersion",{}),Dl=v("contextAppInformation",{});var Ll=Object.freeze(Object.defineProperty({__proto__:null,getLanguage:Ol,subscribeLanguage:Cl,getEnvironment:Il,getLocale:Pl,subscribeLocale:Ml,getCurrency:El,getShopwareVersion:xl,getAppInformation:Dl},Symbol.toStringTag,{value:"Module"}));const zl=v("uiComponentSectionRenderer",{src:(Se=je())!=null?Se:void 0});var Fl=Object.freeze(Object.defineProperty({__proto__:null,add:zl},Symbol.toStringTag,{value:"Module"})),Nl=t=>({addTabItem:v("uiTabsAddTabItem",{positionId:t})});const Gl=t=>Q()===t,Rl=()=>window!==window.parent,Ae=t=>{if(t)return $("locationUpdateHeight",{height:t,locationId:Q()});const e=document.documentElement.offsetHeight;return $("locationUpdateHeight",{height:e,locationId:Q()})};let R=null;var Ul=Object.freeze(Object.defineProperty({__proto__:null,is:Gl,isIframe:Rl,updateHeight:Ae,startAutoResizer:()=>{R=new ResizeObserver(()=>{Ae()}),R.observe(document.body)},stopAutoResizer:()=>{R&&(R.unobserve(document.body),R.disconnect())},MAIN_HIDDEN:"sw-main-hidden"},Symbol.toStringTag,{value:"Module"}));const Bl=v("menuItemAdd");var Hl=Object.freeze(Object.defineProperty({__proto__:null,addMenuItem:Bl},Symbol.toStringTag,{value:"Module"}));const Kl=v("settingsItemAdd");var kl=Object.freeze(Object.defineProperty({__proto__:null,addSettingsItem:Kl},Symbol.toStringTag,{value:"Module"}));const ql=v("mainModuleAdd");var Vl=Object.freeze(Object.defineProperty({__proto__:null,addMainModule:ql},Symbol.toStringTag,{value:"Module"}));const Wl=v("uiModalOpen"),Jl=v("uiModalClose");var Yl=Object.freeze(Object.defineProperty({__proto__:null,open:Wl,close:Jl},Symbol.toStringTag,{value:"Module"}));const Ql=v("actionButtonAdd");var Xl=Object.freeze(Object.defineProperty({__proto__:null,add:Ql},Symbol.toStringTag,{value:"Module"}));const Zl=v("actionExecute");var tg=Object.freeze(Object.defineProperty({__proto__:null,actionExecute:Zl},Symbol.toStringTag,{value:"Module"})),eg=t=>({search:(e,r)=>$("repositorySearch",{entityName:t,context:r,criteria:e}),get:(e,r,n)=>$("repositoryGet",{entityName:t,id:e,context:r,criteria:n}),save:(e,r)=>$("repositorySave",{entityName:t,entity:e,context:r}),clone:(e,r,n)=>$("repositoryClone",{entityName:t,entityId:e,context:r,behavior:n}),hasChanges:e=>$("repositoryHasChanges",{entityName:t,entity:e}),saveAll:(e,r)=>$("repositorySaveAll",{entityName:t,entities:e,context:r}),delete:(e,r)=>$("repositoryDelete",{entityName:t,entityId:e,context:r}),create:(e,r)=>$("repositoryCreate",{entityName:t,entityId:r,context:e})}),rg=Object.freeze(Object.defineProperty({__proto__:null,repository:eg,Classes:{Criteria:x,Entity:ve,EntityCollection:D}},Symbol.toStringTag,{value:"Module"}));const ng={webhook:tg},ig={componentSection:Fl,tabs:Nl,menu:Hl,settings:kl,mainModule:Vl,modal:Yl,actionButton:Xl};p.app=ng,p.context=Ll,p.data=rg,p.location=Ul,p.notification=jl,p.ui=ig,p.window=Sl,Object.defineProperties(p,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
var sg=Object.defineProperty;var Te=Object.getOwnPropertySymbols;var og=Object.prototype.hasOwnProperty,cg=Object.prototype.propertyIsEnumerable;var mt=(p,h,b)=>h in p?sg(p,h,{enumerable:!0,configurable:!0,writable:!0,value:b}):p[h]=b,wt=(p,h)=>{for(var b in h||(h={}))og.call(h,b)&&mt(p,b,h[b]);if(Te)for(var b of Te(h))cg.call(h,b)&&mt(p,b,h[b]);return p};var g=(p,h,b)=>(mt(p,typeof h!="symbol"?h+"":h,b),b);(function(p,h){typeof exports=="object"&&typeof module!="undefined"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(p=typeof globalThis!="undefined"?globalThis:p||self,h(p.sw={}))})(this,function(p){var Se;"use strict";function h(){return String(Date.now().toString(36)+Math.random().toString(36).substr(2))}function b(t){return t!==null&&typeof t=="object"}function Q(){return new URLSearchParams(window.location.search).get("location-id")}function je(){const t=window.location;return new URL(t.pathname,t.origin).toString()}function X(t,e){return b(e)&&e.__type__&&e.__type__===t}const Z={notificationDispatch:{},windowRedirect:{},windowReload:{},contextLanguage:{},contextEnvironment:{},contextLocale:{},contextCurrency:{},contextShopwareVersion:{},contextAppInformation:{},getPageTitle:{},uiComponentSectionRenderer:{},uiTabsAddTabItem:{},locationUpdateHeight:{},menuItemAdd:{},settingsItemAdd:{},mainModuleAdd:{},uiModalOpen:{},uiModalClose:{},actionButtonAdd:{},actionExecute:{},__function__:{},__registerWindow__:{},_criteriaTest:{},_collectionTest:{},_multiply:{},_subtract:{},_privileges:{create:["user"],read:["user"],update:["user"],delete:["user"]}};function Oe(t){const e=At(t),r=Ie(window.location);return!e||Object.keys(e).length<=0?null:St(e,r)}function Ce(t,e,r){const n=At(t),i=Pe(e,r);return i?St(n,i.permissions):null}function At(t){var e;return(e=Z[t])!=null?e:{}}function Ie(t){const r=new URLSearchParams(t.search).get("privileges");return r?JSON.parse(r):{}}function St(t,e){const r=Object.keys(t),n=[];return r.forEach(i=>{var a;(a=t[i])==null||a.forEach(s=>{var c;(c=e[i])!=null&&c.includes(s)||n.push(`${i}:${s}`)})}),n.length>=1?n:null}function Pe(t,e){let r=null;return Object.values(t).forEach(n=>{n.baseUrl===e&&(r=n)}),r}class tt extends Error{constructor(e,r){super(`Your app is missing the priviliges ${r.join(", ")} for action "${e}".`);g(this,"missingPrivileges");this.missingPrivileges=r,Object.setPrototypeOf(this,tt.prototype)}}const Me=({send:t,handleFactory:e})=>{const r={};let n=!1;function i(){if(n)return;n=!0,e({})("__function__",async({args:s,id:c})=>await Promise.resolve(r[c](...s)))}return{name:"function",serialize:({value:a})=>{if(typeof a=="function"){const s=h();return r[s]=a,i(),{__type__:"__function__",id:s,origin:window.origin}}},deserialize:({value:a,event:s})=>{var u;const c=(u=s==null?void 0:s.source)!=null?u:window;if(b(a)&&a.__type__&&a.__type__==="__function__"&&typeof a.id=="string"){const o=a.id,l=a.origin;return(...f)=>t("__function__",{args:f,id:o},c,l)}}}};var B=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Ee(){this.__data__=[],this.size=0}var xe=Ee;function De(t,e){return t===e||t!==t&&e!==e}var Tt=De,Le=Tt;function Fe(t,e){for(var r=t.length;r--;)if(Le(t[r][0],e))return r;return-1}var H=Fe,ze=H,Ne=Array.prototype,Ge=Ne.splice;function Re(t){var e=this.__data__,r=ze(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Ge.call(e,r,1),--this.size,!0}var Ue=Re,Be=H;function He(t){var e=this.__data__,r=Be(e,t);return r<0?void 0:e[r][1]}var Ke=He,ke=H;function qe(t){return ke(this.__data__,t)>-1}var Ve=qe,We=H;function Je(t,e){var r=this.__data__,n=We(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var Ye=Je,Qe=xe,Xe=Ue,Ze=Ke,tr=Ve,er=Ye;function C(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}C.prototype.clear=Qe,C.prototype.delete=Xe,C.prototype.get=Ze,C.prototype.has=tr,C.prototype.set=er;var K=C,rr=K;function nr(){this.__data__=new rr,this.size=0}var ir=nr;function ar(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var sr=ar;function or(t){return this.__data__.get(t)}var cr=or;function ur(t){return this.__data__.has(t)}var lr=ur,gr=typeof B=="object"&&B&&B.Object===Object&&B,jt=gr,fr=jt,dr=typeof self=="object"&&self&&self.Object===Object&&self,_r=fr||dr||Function("return this")(),A=_r,pr=A,hr=pr.Symbol,et=hr,Ot=et,Ct=Object.prototype,yr=Ct.hasOwnProperty,vr=Ct.toString,F=Ot?Ot.toStringTag:void 0;function br(t){var e=yr.call(t,F),r=t[F];try{t[F]=void 0;var n=!0}catch{}var i=vr.call(t);return n&&(e?t[F]=r:delete t[F]),i}var $r=br,mr=Object.prototype,wr=mr.toString;function Ar(t){return wr.call(t)}var Sr=Ar,It=et,Tr=$r,jr=Sr,Or="[object Null]",Cr="[object Undefined]",Pt=It?It.toStringTag:void 0;function Ir(t){return t==null?t===void 0?Cr:Or:Pt&&Pt in Object(t)?Tr(t):jr(t)}var k=Ir;function Pr(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var z=Pr,Mr=k,Er=z,xr="[object AsyncFunction]",Dr="[object Function]",Lr="[object GeneratorFunction]",Fr="[object Proxy]";function zr(t){if(!Er(t))return!1;var e=Mr(t);return e==Dr||e==Lr||e==xr||e==Fr}var Mt=zr,Nr=A,Gr=Nr["__core-js_shared__"],Rr=Gr,rt=Rr,Et=function(){var t=/[^.]+$/.exec(rt&&rt.keys&&rt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Ur(t){return!!Et&&Et in t}var Br=Ur,Hr=Function.prototype,Kr=Hr.toString;function kr(t){if(t!=null){try{return Kr.call(t)}catch{}try{return t+""}catch{}}return""}var xt=kr,qr=Mt,Vr=Br,Wr=z,Jr=xt,Yr=/[\\^$.*+?()[\]{}|]/g,Qr=/^\[object .+?Constructor\]$/,Xr=Function.prototype,Zr=Object.prototype,tn=Xr.toString,en=Zr.hasOwnProperty,rn=RegExp("^"+tn.call(en).replace(Yr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function nn(t){if(!Wr(t)||Vr(t))return!1;var e=qr(t)?rn:Qr;return e.test(Jr(t))}var an=nn;function sn(t,e){return t==null?void 0:t[e]}var on=sn,cn=an,un=on;function ln(t,e){var r=un(t,e);return cn(r)?r:void 0}var j=ln,gn=j,fn=A,dn=gn(fn,"Map"),nt=dn,_n=j,pn=_n(Object,"create"),q=pn,Dt=q;function hn(){this.__data__=Dt?Dt(null):{},this.size=0}var yn=hn;function vn(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var bn=vn,$n=q,mn="__lodash_hash_undefined__",wn=Object.prototype,An=wn.hasOwnProperty;function Sn(t){var e=this.__data__;if($n){var r=e[t];return r===mn?void 0:r}return An.call(e,t)?e[t]:void 0}var Tn=Sn,jn=q,On=Object.prototype,Cn=On.hasOwnProperty;function In(t){var e=this.__data__;return jn?e[t]!==void 0:Cn.call(e,t)}var Pn=In,Mn=q,En="__lodash_hash_undefined__";function xn(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Mn&&e===void 0?En:e,this}var Dn=xn,Ln=yn,Fn=bn,zn=Tn,Nn=Pn,Gn=Dn;function I(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}I.prototype.clear=Ln,I.prototype.delete=Fn,I.prototype.get=zn,I.prototype.has=Nn,I.prototype.set=Gn;var Rn=I,Lt=Rn,Un=K,Bn=nt;function Hn(){this.size=0,this.__data__={hash:new Lt,map:new(Bn||Un),string:new Lt}}var Kn=Hn;function kn(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var qn=kn,Vn=qn;function Wn(t,e){var r=t.__data__;return Vn(e)?r[typeof e=="string"?"string":"hash"]:r.map}var V=Wn,Jn=V;function Yn(t){var e=Jn(this,t).delete(t);return this.size-=e?1:0,e}var Qn=Yn,Xn=V;function Zn(t){return Xn(this,t).get(t)}var ti=Zn,ei=V;function ri(t){return ei(this,t).has(t)}var ni=ri,ii=V;function ai(t,e){var r=ii(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var si=ai,oi=Kn,ci=Qn,ui=ti,li=ni,gi=si;function P(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}P.prototype.clear=oi,P.prototype.delete=ci,P.prototype.get=ui,P.prototype.has=li,P.prototype.set=gi;var fi=P,di=K,_i=nt,pi=fi,hi=200;function yi(t,e){var r=this.__data__;if(r instanceof di){var n=r.__data__;if(!_i||n.length<hi-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new pi(n)}return r.set(t,e),this.size=r.size,this}var vi=yi,bi=K,$i=ir,mi=sr,wi=cr,Ai=lr,Si=vi;function M(t){var e=this.__data__=new bi(t);this.size=e.size}M.prototype.clear=$i,M.prototype.delete=mi,M.prototype.get=wi,M.prototype.has=Ai,M.prototype.set=Si;var Ti=M;function ji(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}var Oi=ji,Ci=j,Ii=function(){try{var t=Ci(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Pi=Ii,Ft=Pi;function Mi(t,e,r){e=="__proto__"&&Ft?Ft(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var zt=Mi,Ei=zt,xi=Tt,Di=Object.prototype,Li=Di.hasOwnProperty;function Fi(t,e,r){var n=t[e];(!(Li.call(t,e)&&xi(n,r))||r===void 0&&!(e in t))&&Ei(t,e,r)}var Nt=Fi,zi=Nt,Ni=zt;function Gi(t,e,r,n){var i=!r;r||(r={});for(var a=-1,s=e.length;++a<s;){var c=e[a],u=n?n(r[c],t[c],c,r,t):void 0;u===void 0&&(u=t[c]),i?Ni(r,c,u):zi(r,c,u)}return r}var W=Gi;function Ri(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var Ui=Ri;function Bi(t){return t!=null&&typeof t=="object"}var N=Bi,Hi=k,Ki=N,ki="[object Arguments]";function qi(t){return Ki(t)&&Hi(t)==ki}var Vi=qi,Gt=Vi,Wi=N,Rt=Object.prototype,Ji=Rt.hasOwnProperty,Yi=Rt.propertyIsEnumerable,Qi=Gt(function(){return arguments}())?Gt:function(t){return Wi(t)&&Ji.call(t,"callee")&&!Yi.call(t,"callee")},Xi=Qi,Zi=Array.isArray,it=Zi,J={exports:{}};function ta(){return!1}var ea=ta;(function(t,e){var r=A,n=ea,i=e&&!e.nodeType&&e,a=i&&!0&&t&&!t.nodeType&&t,s=a&&a.exports===i,c=s?r.Buffer:void 0,u=c?c.isBuffer:void 0,o=u||n;t.exports=o})(J,J.exports);var ra=9007199254740991,na=/^(?:0|[1-9]\d*)$/;function ia(t,e){var r=typeof t;return e=e==null?ra:e,!!e&&(r=="number"||r!="symbol"&&na.test(t))&&t>-1&&t%1==0&&t<e}var aa=ia,sa=9007199254740991;function oa(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=sa}var Ut=oa,ca=k,ua=Ut,la=N,ga="[object Arguments]",fa="[object Array]",da="[object Boolean]",_a="[object Date]",pa="[object Error]",ha="[object Function]",ya="[object Map]",va="[object Number]",ba="[object Object]",$a="[object RegExp]",ma="[object Set]",wa="[object String]",Aa="[object WeakMap]",Sa="[object ArrayBuffer]",Ta="[object DataView]",ja="[object Float32Array]",Oa="[object Float64Array]",Ca="[object Int8Array]",Ia="[object Int16Array]",Pa="[object Int32Array]",Ma="[object Uint8Array]",Ea="[object Uint8ClampedArray]",xa="[object Uint16Array]",Da="[object Uint32Array]",_={};_[ja]=_[Oa]=_[Ca]=_[Ia]=_[Pa]=_[Ma]=_[Ea]=_[xa]=_[Da]=!0,_[ga]=_[fa]=_[Sa]=_[da]=_[Ta]=_[_a]=_[pa]=_[ha]=_[ya]=_[va]=_[ba]=_[$a]=_[ma]=_[wa]=_[Aa]=!1;function La(t){return la(t)&&ua(t.length)&&!!_[ca(t)]}var Fa=La;function za(t){return function(e){return t(e)}}var at=za,G={exports:{}};(function(t,e){var r=jt,n=e&&!e.nodeType&&e,i=n&&!0&&t&&!t.nodeType&&t,a=i&&i.exports===n,s=a&&r.process,c=function(){try{var u=i&&i.require&&i.require("util").types;return u||s&&s.binding&&s.binding("util")}catch{}}();t.exports=c})(G,G.exports);var Na=Fa,Ga=at,Bt=G.exports,Ht=Bt&&Bt.isTypedArray,Ra=Ht?Ga(Ht):Na,Ua=Ra,Ba=Ui,Ha=Xi,Ka=it,ka=J.exports,qa=aa,Va=Ua,Wa=Object.prototype,Ja=Wa.hasOwnProperty;function Ya(t,e){var r=Ka(t),n=!r&&Ha(t),i=!r&&!n&&ka(t),a=!r&&!n&&!i&&Va(t),s=r||n||i||a,c=s?Ba(t.length,String):[],u=c.length;for(var o in t)(e||Ja.call(t,o))&&!(s&&(o=="length"||i&&(o=="offset"||o=="parent")||a&&(o=="buffer"||o=="byteLength"||o=="byteOffset")||qa(o,u)))&&c.push(o);return c}var Kt=Ya,Qa=Object.prototype;function Xa(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Qa;return t===r}var st=Xa;function Za(t,e){return function(r){return t(e(r))}}var kt=Za,ts=kt,es=ts(Object.keys,Object),rs=es,ns=st,is=rs,as=Object.prototype,ss=as.hasOwnProperty;function os(t){if(!ns(t))return is(t);var e=[];for(var r in Object(t))ss.call(t,r)&&r!="constructor"&&e.push(r);return e}var cs=os,us=Mt,ls=Ut;function gs(t){return t!=null&&ls(t.length)&&!us(t)}var qt=gs,fs=Kt,ds=cs,_s=qt;function ps(t){return _s(t)?fs(t):ds(t)}var ot=ps,hs=W,ys=ot;function vs(t,e){return t&&hs(e,ys(e),t)}var bs=vs;function $s(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var ms=$s,ws=z,As=st,Ss=ms,Ts=Object.prototype,js=Ts.hasOwnProperty;function Os(t){if(!ws(t))return Ss(t);var e=As(t),r=[];for(var n in t)n=="constructor"&&(e||!js.call(t,n))||r.push(n);return r}var Cs=Os,Is=Kt,Ps=Cs,Ms=qt;function Es(t){return Ms(t)?Is(t,!0):Ps(t)}var ct=Es,xs=W,Ds=ct;function Ls(t,e){return t&&xs(e,Ds(e),t)}var Fs=Ls,ut={exports:{}};(function(t,e){var r=A,n=e&&!e.nodeType&&e,i=n&&!0&&t&&!t.nodeType&&t,a=i&&i.exports===n,s=a?r.Buffer:void 0,c=s?s.allocUnsafe:void 0;function u(o,l){if(l)return o.slice();var f=o.length,v=c?c(f):new o.constructor(f);return o.copy(v),v}t.exports=u})(ut,ut.exports);function zs(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var Ns=zs;function Gs(t,e){for(var r=-1,n=t==null?0:t.length,i=0,a=[];++r<n;){var s=t[r];e(s,r,t)&&(a[i++]=s)}return a}var Rs=Gs;function Us(){return[]}var Vt=Us,Bs=Rs,Hs=Vt,Ks=Object.prototype,ks=Ks.propertyIsEnumerable,Wt=Object.getOwnPropertySymbols,qs=Wt?function(t){return t==null?[]:(t=Object(t),Bs(Wt(t),function(e){return ks.call(t,e)}))}:Hs,lt=qs,Vs=W,Ws=lt;function Js(t,e){return Vs(t,Ws(t),e)}var Ys=Js;function Qs(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var Jt=Qs,Xs=kt,Zs=Xs(Object.getPrototypeOf,Object),Yt=Zs,to=Jt,eo=Yt,ro=lt,no=Vt,io=Object.getOwnPropertySymbols,ao=io?function(t){for(var e=[];t;)to(e,ro(t)),t=eo(t);return e}:no,Qt=ao,so=W,oo=Qt;function co(t,e){return so(t,oo(t),e)}var uo=co,lo=Jt,go=it;function fo(t,e,r){var n=e(t);return go(t)?n:lo(n,r(t))}var Xt=fo,_o=Xt,po=lt,ho=ot;function yo(t){return _o(t,ho,po)}var vo=yo,bo=Xt,$o=Qt,mo=ct;function wo(t){return bo(t,mo,$o)}var Ao=wo,So=j,To=A,jo=So(To,"DataView"),Oo=jo,Co=j,Io=A,Po=Co(Io,"Promise"),Mo=Po,Eo=j,xo=A,Do=Eo(xo,"Set"),Lo=Do,Fo=j,zo=A,No=Fo(zo,"WeakMap"),Go=No,gt=Oo,ft=nt,dt=Mo,_t=Lo,pt=Go,Zt=k,E=xt,te="[object Map]",Ro="[object Object]",ee="[object Promise]",re="[object Set]",ne="[object WeakMap]",ie="[object DataView]",Uo=E(gt),Bo=E(ft),Ho=E(dt),Ko=E(_t),ko=E(pt),O=Zt;(gt&&O(new gt(new ArrayBuffer(1)))!=ie||ft&&O(new ft)!=te||dt&&O(dt.resolve())!=ee||_t&&O(new _t)!=re||pt&&O(new pt)!=ne)&&(O=function(t){var e=Zt(t),r=e==Ro?t.constructor:void 0,n=r?E(r):"";if(n)switch(n){case Uo:return ie;case Bo:return te;case Ho:return ee;case Ko:return re;case ko:return ne}return e});var ht=O,qo=Object.prototype,Vo=qo.hasOwnProperty;function Wo(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&Vo.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Jo=Wo,Yo=A,Qo=Yo.Uint8Array,Xo=Qo,ae=Xo;function Zo(t){var e=new t.constructor(t.byteLength);return new ae(e).set(new ae(t)),e}var yt=Zo,tc=yt;function ec(t,e){var r=e?tc(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var rc=ec,nc=/\w*$/;function ic(t){var e=new t.constructor(t.source,nc.exec(t));return e.lastIndex=t.lastIndex,e}var ac=ic,se=et,oe=se?se.prototype:void 0,ce=oe?oe.valueOf:void 0;function sc(t){return ce?Object(ce.call(t)):{}}var oc=sc,cc=yt;function uc(t,e){var r=e?cc(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var lc=uc,gc=yt,fc=rc,dc=ac,_c=oc,pc=lc,hc="[object Boolean]",yc="[object Date]",vc="[object Map]",bc="[object Number]",$c="[object RegExp]",mc="[object Set]",wc="[object String]",Ac="[object Symbol]",Sc="[object ArrayBuffer]",Tc="[object DataView]",jc="[object Float32Array]",Oc="[object Float64Array]",Cc="[object Int8Array]",Ic="[object Int16Array]",Pc="[object Int32Array]",Mc="[object Uint8Array]",Ec="[object Uint8ClampedArray]",xc="[object Uint16Array]",Dc="[object Uint32Array]";function Lc(t,e,r){var n=t.constructor;switch(e){case Sc:return gc(t);case hc:case yc:return new n(+t);case Tc:return fc(t,r);case jc:case Oc:case Cc:case Ic:case Pc:case Mc:case Ec:case xc:case Dc:return pc(t,r);case vc:return new n;case bc:case wc:return new n(t);case $c:return dc(t);case mc:return new n;case Ac:return _c(t)}}var Fc=Lc,zc=z,ue=Object.create,Nc=function(){function t(){}return function(e){if(!zc(e))return{};if(ue)return ue(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),Gc=Nc,Rc=Gc,Uc=Yt,Bc=st;function Hc(t){return typeof t.constructor=="function"&&!Bc(t)?Rc(Uc(t)):{}}var Kc=Hc,kc=ht,qc=N,Vc="[object Map]";function Wc(t){return qc(t)&&kc(t)==Vc}var Jc=Wc,Yc=Jc,Qc=at,le=G.exports,ge=le&&le.isMap,Xc=ge?Qc(ge):Yc,Zc=Xc,tu=ht,eu=N,ru="[object Set]";function nu(t){return eu(t)&&tu(t)==ru}var iu=nu,au=iu,su=at,fe=G.exports,de=fe&&fe.isSet,ou=de?su(de):au,cu=ou,uu=Ti,lu=Oi,gu=Nt,fu=bs,du=Fs,_u=ut.exports,pu=Ns,hu=Ys,yu=uo,vu=vo,bu=Ao,$u=ht,mu=Jo,wu=Fc,Au=Kc,Su=it,Tu=J.exports,ju=Zc,Ou=z,Cu=cu,Iu=ot,Pu=ct,Mu=1,Eu=2,xu=4,_e="[object Arguments]",Du="[object Array]",Lu="[object Boolean]",Fu="[object Date]",zu="[object Error]",pe="[object Function]",Nu="[object GeneratorFunction]",Gu="[object Map]",Ru="[object Number]",he="[object Object]",Uu="[object RegExp]",Bu="[object Set]",Hu="[object String]",Ku="[object Symbol]",ku="[object WeakMap]",qu="[object ArrayBuffer]",Vu="[object DataView]",Wu="[object Float32Array]",Ju="[object Float64Array]",Yu="[object Int8Array]",Qu="[object Int16Array]",Xu="[object Int32Array]",Zu="[object Uint8Array]",tl="[object Uint8ClampedArray]",el="[object Uint16Array]",rl="[object Uint32Array]",d={};d[_e]=d[Du]=d[qu]=d[Vu]=d[Lu]=d[Fu]=d[Wu]=d[Ju]=d[Yu]=d[Qu]=d[Xu]=d[Gu]=d[Ru]=d[he]=d[Uu]=d[Bu]=d[Hu]=d[Ku]=d[Zu]=d[tl]=d[el]=d[rl]=!0,d[zu]=d[pe]=d[ku]=!1;function Y(t,e,r,n,i,a){var s,c=e&Mu,u=e&Eu,o=e&xu;if(r&&(s=i?r(t,n,i,a):r(t)),s!==void 0)return s;if(!Ou(t))return t;var l=Su(t);if(l){if(s=mu(t),!c)return pu(t,s)}else{var f=$u(t),v=f==pe||f==Nu;if(Tu(t))return _u(t,c);if(f==he||f==_e||v&&!i){if(s=u||v?{}:Au(t),!c)return u?yu(t,du(s,t)):hu(t,fu(s,t))}else{if(!d[f])return i?t:{};s=wu(t,f,c)}}a||(a=new uu);var S=a.get(t);if(S)return S;a.set(t,s),Cu(t)?t.forEach(function(m){s.add(Y(m,e,r,m,t,a))}):ju(t)&&t.forEach(function(m,w){s.set(w,Y(m,e,r,w,t,a))});var L=o?u?bu:vu:u?Pu:Iu,T=l?void 0:L(t);return lu(T||t,function(m,w){T&&(w=m,m=t[w]),gu(s,w,Y(m,e,r,w,t,a))}),s}var ye=Y,nl=ye,il=1,al=4;function sl(t){return nl(t,il|al)}var vt=sl;class x{constructor(e=1,r=25){g(this,"page");g(this,"limit");g(this,"term");g(this,"filters");g(this,"ids");g(this,"queries");g(this,"associations");g(this,"postFilter");g(this,"sortings");g(this,"aggregations");g(this,"grouping");g(this,"fields");g(this,"groupFields");g(this,"totalCountMode");g(this,"includes");this.page=e,this.limit=r,this.term=null,this.filters=[],this.includes=null,this.ids=[],this.queries=[],this.associations=[],this.postFilter=[],this.sortings=[],this.aggregations=[],this.grouping=[],this.groupFields=[],this.fields=[],this.totalCountMode=1}static fromCriteria(e){return vt(e)}parse(){const e={};return this.ids.length>0&&(e.ids=this.ids.join("|")),this.page!==null&&(e.page=this.page),this.limit!==null&&(e.limit=this.limit),this.term!==null&&(e.term=this.term),this.queries.length>0&&(e.query=this.queries),this.filters.length>0&&(e.filter=this.filters),this.postFilter.length>0&&(e["post-filter"]=this.postFilter),this.sortings.length>0&&(e.sort=this.sortings),this.aggregations.length>0&&(e.aggregations=this.aggregations),this.groupFields.length>0&&(e.groupFields=this.groupFields),this.grouping.length>0&&(e.grouping=this.grouping),this.fields.length>0&&(e.fields=this.fields),this.associations.length>0&&(e.associations={},this.associations.forEach(r=>{!e.associations||(e.associations[r.association]=r.criteria.parse())})),this.includes!==null&&(e.includes=this.includes),this.totalCountMode!==null&&(e["total-count-mode"]=this.totalCountMode),e}setIds(e){return this.ids=e,this}setTotalCountMode(e){return typeof e!="number"&&(this.totalCountMode=null),this.totalCountMode=e<0||e>2?null:e,this}setPage(e){return this.page=e,this}setLimit(e){return this.limit=e,this}setTerm(e){return this.term=e,this}addFilter(e){return this.filters.push(e),this}addIncludes(e){return Object.entries(e).forEach(([r,n])=>{this.includes===null&&(this.includes={}),this.includes[r]||(this.includes[r]=[]),this.includes[r].push(...n)}),this}addPostFilter(e){return this.postFilter.push(e),this}addSorting(e){return this.sortings.push(e),this}addQuery(e,r,n=null){const i={score:r,query:e};return n&&(i[n]=n),this.queries.push(i),this}addGroupField(e){return this.groupFields.push(e),this}addGrouping(e){return this.grouping.push(e),this}addFields(...e){return this.fields.push(...e),this}addAggregation(e){return this.aggregations.push(e),this}addAssociation(e){const r=e.split(".");let n=this;return r.forEach(i=>{n=n.getAssociation(i)}),this}getAssociation(e){const r=e.split(".");let n=this;return r.forEach(i=>{n.hasAssociation(i)||n.associations.push({association:i,criteria:new x(null,null)}),n=n.getAssociationCriteria(i)}),n}getAssociationCriteria(e){let r=null;return this.associations.forEach(n=>{n.association===e&&(r=n.criteria)}),r}getLimit(){var e;return(e=this.limit)!=null?e:0}getPage(){var e;return(e=this.page)!=null?e:0}getCriteriaData(){return{page:this.page,limit:this.limit,term:this.term,filters:this.filters,ids:this.ids,queries:this.queries,associations:this.associations,postFilter:this.postFilter,sortings:this.sortings,aggregations:this.aggregations,grouping:this.grouping,fields:this.fields,groupFields:this.groupFields,totalCountMode:this.totalCountMode,includes:this.includes}}hasAssociation(e){return this.associations.some(r=>r.association===e)}resetSorting(){this.sortings=[]}static avg(e,r){return{type:"avg",name:e,field:r}}static count(e,r){return{type:"count",name:e,field:r}}static max(e,r){return{type:"max",name:e,field:r}}static min(e,r){return{type:"min",name:e,field:r}}static stats(e,r){return{type:"stats",name:e,field:r}}static sum(e,r){return{type:"sum",name:e,field:r}}static terms(e,r,n=null,i=null,a=null){return{type:"terms",name:e,field:r,limit:n,sort:i,aggregation:a}}static filter(e,r,n){return{type:"filter",name:e,filter:r,aggregation:n}}static histogram(e,r,n,i,a,s){return{type:"histogram",name:e,field:r,interval:n,format:i,aggregation:a,timeZone:s}}static sort(e,r="ASC",n=!1){return{field:e,order:r,naturalSorting:n}}static naturalSorting(e,r="ASC"){return{field:e,order:r,naturalSorting:!0}}static contains(e,r){return{type:"contains",field:e,value:r}}static prefix(e,r){return{type:"prefix",field:e,value:r}}static suffix(e,r){return{type:"suffix",field:e,value:r}}static equalsAny(e,r){return{type:"equalsAny",field:e,value:r.join("|")}}static range(e,r){return{type:"range",field:e,parameters:r}}static equals(e,r){return{type:"equals",field:e,value:r}}static not(e,r=[]){return{type:"not",operator:e,queries:r}}static multi(e,r=[]){return{type:"multi",operator:e,queries:r}}}const ol=()=>({name:"criteria",serialize:({value:t,customizerMethod:e})=>{if(t instanceof x)return{__type__:"__Criteria__",data:e(t.getCriteriaData())}},deserialize:({value:t,customizerMethod:e})=>{if(X("__Criteria__",t)&&typeof t.data=="object"){const r=t.data,n=new x;return n.setPage(r.page),n.setLimit(r.limit),n.setTerm(r.term),r.filters.forEach(i=>{n.addFilter(i)}),n.setIds(r.ids),r.queries.forEach(({query:i,score:a})=>{n.addQuery(i,a)}),r.associations.forEach(i=>{n.associations.push(e(i))}),r.postFilter.forEach(i=>{n.addPostFilter(i)}),r.sortings.forEach(i=>{n.addSorting(i)}),r.aggregations.forEach(i=>{n.addAggregation(i)}),r.grouping.forEach(i=>{n.addGrouping(i)}),r.fields.forEach(i=>{n.addFields(i)}),r.groupFields.forEach(i=>{n.addGroupField(i)}),r.includes&&n.addIncludes(r.includes),n.setTotalCountMode(r.totalCountMode),n}}});let cl=(t,e,r)=>{t[e]=r};class ul{constructor(e,r,n,i={}){g(this,"id");g(this,"_origin");g(this,"_entityName");g(this,"_draft");g(this,"_isDirty");g(this,"_isNew");var s,c;this.id=e,this._origin=i.originData?vt(i.originData):vt(n),this._entityName=r,this._draft=n,this._isDirty=(s=i.isDirty)!=null?s:!1,this._isNew=(c=i.isNew)!=null?c:!1;const a=this;return new Proxy(this._draft,{get(u,o){return o in a._draft?a._draft[o]:a[o]},set(u,o,l){return cl(a._draft,o,l),a._isDirty=!0,!0}})}markAsNew(){this._isNew=!0}isNew(){return this._isNew}getIsDirty(){return this._isDirty}getOrigin(){return this._origin}getDraft(){return this._draft}getEntityName(){return this._entityName}}const ve=function(e,r,n,i){return new ul(e,r,n,i)},ll=()=>({name:"entity",serialize:({value:t,customizerMethod:e})=>{if(!(!b(t)||typeof t.getDraft!="function"))return{__type__:"__Entity__",__id__:t.id,__entityName__:t._entityName,__isDirty__:t._isDirty,__isNew__:t._isNew,__origin__:e(t._origin),__draft__:e(t._draft)}},deserialize:({value:t,customizerMethod:e})=>{if(X("__Entity__",t)&&typeof t.__origin__=="object")return new ve(t.__id__,t.__entityName__,e(t.__draft__),{originData:e(t.__origin__),isDirty:t.__isDirty__,isNew:t.__isNew__})}});class D extends Array{constructor(e,r,n,i=null,a=[],s=null,c=null){super();g(this,"entity");g(this,"source");g(this,"context");g(this,"criteria");g(this,"aggregations");g(this,"total");g(this,"first");g(this,"last");g(this,"remove");g(this,"has");g(this,"get");g(this,"getAt");g(this,"getIds");g(this,"add");g(this,"addAt");g(this,"moveItem");this.entity=r,this.source=e,this.context=n,this.criteria=i,this.aggregations=c,this.total=s,this.push(...a),this.first=function(){return this.length<=0?null:this[0]},this.last=function(){return this.length<=0?null:this[this.length-1]},this.remove=function(o){const l=this.findIndex(f=>f.id===o);return l<0?!1:(this.splice(l,1),!0)},this.has=function(o){return this.some(l=>l.id===o)},this.get=function(o){const l=this.find(f=>f.id===o);return typeof l!="undefined"?l:null},this.getAt=function(o){const l=this[o];return typeof l!="undefined"?l:null},this.getIds=function(){return this.map(o=>o.id)},this.add=function(o){this.push(o)},this.addAt=function(o,l){if(typeof l=="undefined"){this.add(o);return}this.splice(l,0,o)},this.moveItem=function(o,l=null){if(l===null&&(l=this.length),o<0||o>=this.length)return null;if(l===o)return this.getAt(o);const f=this.find((L,T)=>T===o);if(typeof f=="undefined")return null;const v=this.filter((L,T)=>T!==o),S=[...v.slice(0,l),f,...v.slice(l)];return this.splice(0,this.length,...S),f},this.filter=function(o,l){const f=Object.getPrototypeOf(this).filter.call(this,o,l);return new D(this.source,this.entity,this.context,this.criteria,f,this.total,this.aggregations)}}static fromCollection(e){return new D(e.source,e.entity,e.context,e.criteria===null?e.criteria:x.fromCriteria(e.criteria),e,e.total,e.aggregations)}}const gl=()=>({name:"entity-collection",serialize:({value:t,customizerMethod:e})=>{if(t instanceof D)return e({__type__:"__EntityCollection__",__source__:t.source,__entityName__:t.entity,__context__:t.context,__criteria__:t.criteria,__entities__:Array.from(t),__total__:t.total,__aggregations__:t.aggregations})},deserialize:({value:t,customizerMethod:e})=>{if(X("__EntityCollection__",t))return new D(t.__source__,t.__entityName__,t.__context__,e(t.__criteria__),e(t.__entities__),t.__total__,t.__aggregations__)}});var fl=ye,dl=1,_l=4;function pl(t,e){return e=typeof e=="function"?e:void 0,fl(t,dl|_l,e)}var be=pl;const hl=[ol,gl,ll,Me];function yl(t){const e=hl.map(s=>s(t));function r(){return e}function n(s){var c;return(c=e.find(u=>u.name===s))!=null?c:null}function i(s){return be(s,(c,u,o,l)=>{for(const f of e){const v=f.serialize({value:c,key:u,object:o,stack:l,customizerMethod:i});if(v)return v}})}function a(s,c){return be(s,(u,o,l,f)=>{for(const v of e){const S=v.deserialize({value:u,key:o,object:l,stack:f,event:c,customizerMethod:a});if(S)return S}})}return{getSerializers:r,getSerializerByName:n,serialize:i,deserialize:a}}const{serialize:$e,deserialize:me}=yl({handleFactory:vl,send:$}),bt=new Set;function $(t,e,r,n){const i=Oe(t);if(i!==null){const v=new tt(t,i);return Promise.reject(v)}const a=h(),s=e!=null?e:{},u=$e({_type:t,_data:s,_callbackId:a}),o=JSON.stringify(u);let l=!1;const f=7e3;return new Promise((v,S)=>{const L=function(w){if(typeof w.data!="string")return;let U;try{U=JSON.parse(w.data)}catch{return}if(!ml(U)||U._callbackId!==a||!U.hasOwnProperty("_response"))return;const ag=me(U,w);window.removeEventListener("message",L),l||(l=!0,v(ag._response))};window.addEventListener("message",L);let T=!0;try{T=!window.parent.origin}catch{}let m=T?document.referrer:window.parent.origin;n&&(m=n),r?r.postMessage(o,m):window.parent.postMessage(o,m),setTimeout(()=>{l||S("Send timeout expired. It could be possible that no handler for the postMessage request exists or that the handler freezed.")},f)})}function $t(t,e,r){const n=async function(i){var f;if(Z[t]&&Object.keys(Z[t]).length&&(!r||Ce(t,r,i.origin)!==null)||typeof i.data!="string")return;let a;try{a=JSON.parse(i.data)}catch{return}if(!$l(a)||a._type!==t)return;const s=me(a,i),c=await Promise.resolve(e(s._data,{_event_:i})),u={_callbackId:s._callbackId,_type:s._type,_response:c!=null?c:null},o=$e(u),l=JSON.stringify(o);i.source?i.source.postMessage(l,{targetOrigin:(f=i.origin)!=null?f:"*"}):window.postMessage(l,window.origin)};return window.addEventListener("message",n),()=>window.removeEventListener("message",n)}function vl(t){return(e,r)=>$t(e,r,t)}function bl(t,e){return $t(t,e,{})}function y(t,e){return r=>$(t,wt(wt({},e),r))}function we(t){return e=>bl(t,e)}(async()=>{$t("__registerWindow__",(t,e)=>{if(e._event_.source){const r=e._event_.source;bt.add({source:r,origin:e._event_.origin})}else bt.add({source:window,origin:window.origin})},{}),await $("__registerWindow__",{})})().catch(t=>console.error(t)),window._swsdk={sourceRegistry:bt};function $l(t){const e=t;return!!e._type&&!!e._data&&!!e._callbackId}function ml(t){const e=t;return!!e._type&&!!e.hasOwnProperty("_response")&&!!e._callbackId}const wl=y("windowRedirect"),Al=y("windowReload",{});var Sl=Object.freeze(Object.defineProperty({__proto__:null,redirect:wl,reload:Al},Symbol.toStringTag,{value:"Module"}));const Tl=y("notificationDispatch");var jl=Object.freeze(Object.defineProperty({__proto__:null,dispatch:Tl},Symbol.toStringTag,{value:"Module"}));const Ol=y("contextLanguage",{}),Cl=we("contextLanguage"),Il=y("contextEnvironment",{}),Pl=y("contextLocale",{}),Ml=we("contextLocale"),El=y("contextCurrency",{}),xl=y("contextShopwareVersion",{}),Dl=y("contextAppInformation",{});var Ll=Object.freeze(Object.defineProperty({__proto__:null,getLanguage:Ol,subscribeLanguage:Cl,getEnvironment:Il,getLocale:Pl,subscribeLocale:Ml,getCurrency:El,getShopwareVersion:xl,getAppInformation:Dl},Symbol.toStringTag,{value:"Module"}));const Fl=y("uiComponentSectionRenderer",{src:(Se=je())!=null?Se:void 0});var zl=Object.freeze(Object.defineProperty({__proto__:null,add:Fl},Symbol.toStringTag,{value:"Module"})),Nl=t=>({addTabItem:y("uiTabsAddTabItem",{positionId:t})});const Gl=t=>Q()===t,Rl=()=>window!==window.parent,Ae=t=>{if(t)return $("locationUpdateHeight",{height:t,locationId:Q()});const e=document.documentElement.offsetHeight;return $("locationUpdateHeight",{height:e,locationId:Q()})};let R=null;var Ul=Object.freeze(Object.defineProperty({__proto__:null,is:Gl,isIframe:Rl,updateHeight:Ae,startAutoResizer:()=>{R=new ResizeObserver(()=>{Ae()}),R.observe(document.body)},stopAutoResizer:()=>{R&&(R.unobserve(document.body),R.disconnect())},MAIN_HIDDEN:"sw-main-hidden"},Symbol.toStringTag,{value:"Module"}));const Bl=y("menuItemAdd");var Hl=Object.freeze(Object.defineProperty({__proto__:null,addMenuItem:Bl},Symbol.toStringTag,{value:"Module"}));const Kl=y("settingsItemAdd");var kl=Object.freeze(Object.defineProperty({__proto__:null,addSettingsItem:Kl},Symbol.toStringTag,{value:"Module"}));const ql=y("mainModuleAdd");var Vl=Object.freeze(Object.defineProperty({__proto__:null,addMainModule:ql},Symbol.toStringTag,{value:"Module"}));const Wl=y("uiModalOpen"),Jl=y("uiModalClose");var Yl=Object.freeze(Object.defineProperty({__proto__:null,open:Wl,close:Jl},Symbol.toStringTag,{value:"Module"}));const Ql=y("actionButtonAdd");var Xl=Object.freeze(Object.defineProperty({__proto__:null,add:Ql},Symbol.toStringTag,{value:"Module"}));const Zl=y("actionExecute");var tg=Object.freeze(Object.defineProperty({__proto__:null,actionExecute:Zl},Symbol.toStringTag,{value:"Module"})),eg=t=>({search:(e,r)=>$("repositorySearch",{entityName:t,context:r,criteria:e}),get:(e,r,n)=>$("repositoryGet",{entityName:t,id:e,context:r,criteria:n}),save:(e,r)=>$("repositorySave",{entityName:t,entity:e,context:r}),clone:(e,r,n)=>$("repositoryClone",{entityName:t,entityId:e,context:r,behavior:n}),hasChanges:e=>$("repositoryHasChanges",{entityName:t,entity:e}),saveAll:(e,r)=>$("repositorySaveAll",{entityName:t,entities:e,context:r}),delete:(e,r)=>$("repositoryDelete",{entityName:t,entityId:e,context:r}),create:(e,r)=>$("repositoryCreate",{entityName:t,entityId:r,context:e})}),rg=Object.freeze(Object.defineProperty({__proto__:null,repository:eg,Classes:{Criteria:x,Entity:ve,EntityCollection:D}},Symbol.toStringTag,{value:"Module"}));const ng={webhook:tg},ig={componentSection:zl,tabs:Nl,menu:Hl,settings:kl,mainModule:Vl,modal:Yl,actionButton:Xl};p.app=ng,p.context=Ll,p.data=rg,p.location=Ul,p.notification=jl,p.ui=ig,p.window=Sl,Object.defineProperties(p,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
import { hasType } from '../utils'; | ||
import Criteria from '../../data/Criteria'; | ||
/* eslint-disable */ | ||
const CriteriaSerializer = () => { | ||
const serialize = ({ value, customizerMethod }) => { | ||
const CriteriaSerializer = () => ({ | ||
name: 'criteria', | ||
serialize: ({ value, customizerMethod }) => { | ||
if (value instanceof Criteria) { | ||
@@ -12,4 +13,4 @@ return { | ||
} | ||
}; | ||
const deserialize = ({ value, customizerMethod }) => { | ||
}, | ||
deserialize: ({ value, customizerMethod }) => { | ||
// When object is containing a criteria wrapper | ||
@@ -71,10 +72,5 @@ if (hasType('__Criteria__', value) && typeof value['data'] === 'object') { | ||
} | ||
}; | ||
return { | ||
name: 'criteria', | ||
serialize, | ||
deserialize, | ||
}; | ||
}; | ||
} | ||
}); | ||
export default CriteriaSerializer; | ||
//# sourceMappingURL=criteria-serializer.js.map |
import { hasType } from '../utils'; | ||
import EntityCollection from '../../data/_internals/EntityCollection'; | ||
const EntityCollectionSerializerFactory = () => { | ||
/* eslint-disable */ | ||
const serialize = ({ value, customizerMethod }) => { | ||
/* eslint-disable */ | ||
const EntityCollectionSerializerFactory = () => ({ | ||
name: 'entity-collection', | ||
serialize: ({ value, customizerMethod }) => { | ||
if (value instanceof EntityCollection) { | ||
@@ -18,15 +19,10 @@ return customizerMethod({ | ||
} | ||
}; | ||
const deserialize = ({ value, customizerMethod }) => { | ||
}, | ||
deserialize: ({ value, customizerMethod }) => { | ||
if (hasType('__EntityCollection__', value)) { | ||
return new EntityCollection(value.__source__, value.__entityName__, value.__context__, customizerMethod(value.__criteria__), customizerMethod(value.__entities__), value.__total__, value.__aggregations__); | ||
} | ||
}; | ||
return { | ||
name: 'entity-collection', | ||
serialize, | ||
deserialize, | ||
}; | ||
}; | ||
}, | ||
}); | ||
export default EntityCollectionSerializerFactory; | ||
//# sourceMappingURL=entity-collection-serializer.js.map |
import { isObject, hasType } from '../utils'; | ||
import EntityClass from '../../data/_internals/Entity'; | ||
const EntitySerializerFactory = () => { | ||
/* eslint-disable */ | ||
const serialize = ({ value, customizerMethod }) => { | ||
/* eslint-disable */ | ||
const EntitySerializerFactory = () => ({ | ||
name: 'entity', | ||
serialize: ({ value, customizerMethod }) => { | ||
if (!isObject(value) || typeof value.getDraft !== 'function') { | ||
return; | ||
} | ||
const entity = value; | ||
return { | ||
__type__: '__Entity__', | ||
__id__: entity.id, | ||
__entityName__: entity._entityName, | ||
__isDirty__: entity._isDirty, | ||
__isNew__: entity._isNew, | ||
__origin__: customizerMethod(entity._origin), | ||
__draft__: customizerMethod(entity._draft), | ||
__id__: value.id, | ||
__entityName__: value._entityName, | ||
__isDirty__: value._isDirty, | ||
__isNew__: value._isNew, | ||
__origin__: customizerMethod(value._origin), | ||
__draft__: customizerMethod(value._draft), | ||
}; | ||
}; | ||
const deserialize = ({ value, customizerMethod }) => { | ||
}, | ||
deserialize: ({ value, customizerMethod }) => { | ||
if (hasType('__Entity__', value) && typeof value.__origin__ === 'object') { | ||
@@ -28,10 +28,5 @@ return new EntityClass(value.__id__, value.__entityName__, customizerMethod(value.__draft__), { | ||
} | ||
}; | ||
return { | ||
name: 'entity', | ||
serialize, | ||
deserialize, | ||
}; | ||
}; | ||
}, | ||
}); | ||
export default EntitySerializerFactory; | ||
//# sourceMappingURL=entity-serializer.js.map |
@@ -11,4 +11,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { isObject, generateUniqueId } from '../utils'; | ||
/* eslint-disable */ | ||
const FunctionSerializerFactory = ({ send, handleFactory }) => { | ||
/* eslint-disable */ | ||
// only available on sender side | ||
@@ -26,44 +26,42 @@ const methodRegistry = {}; | ||
} | ||
const serialize = ({ value }) => { | ||
if (typeof value === 'function') { | ||
const id = generateUniqueId(); | ||
// add the method reference to the methodRegistry | ||
methodRegistry[id] = value; | ||
// start a general function listener which calls the method when the handler calls the method | ||
startMethodHandler(); | ||
// replace function with a object containing the type and id | ||
return { | ||
__type__: '__function__', | ||
id: id, | ||
origin: window.origin, | ||
}; | ||
} | ||
}; | ||
const deserialize = ({ value, event }) => { | ||
var _a; | ||
// @ts-expect-error | ||
const targetWindow = (_a = event === null || event === void 0 ? void 0 : event.source) !== null && _a !== void 0 ? _a : window; | ||
// when object is containing a method wrapper | ||
if (isObject(value) | ||
&& value['__type__'] | ||
&& value['__type__'] === '__function__' | ||
&& typeof value['id'] === 'string') { | ||
const id = value['id']; | ||
const origin = value['origin']; | ||
// convert wrapper to a callable method | ||
return (...args) => { | ||
return send('__function__', { | ||
args: args, | ||
return { | ||
name: 'function', | ||
serialize: ({ value }) => { | ||
if (typeof value === 'function') { | ||
const id = generateUniqueId(); | ||
// add the method reference to the methodRegistry | ||
methodRegistry[id] = value; | ||
// start a general function listener which calls the method when the handler calls the method | ||
startMethodHandler(); | ||
// replace function with a object containing the type and id | ||
return { | ||
__type__: '__function__', | ||
id: id, | ||
}, targetWindow, origin); | ||
}; | ||
origin: window.origin, | ||
}; | ||
} | ||
}, | ||
deserialize: ({ value, event }) => { | ||
var _a; | ||
// @ts-expect-error | ||
const targetWindow = (_a = event === null || event === void 0 ? void 0 : event.source) !== null && _a !== void 0 ? _a : window; | ||
// when object is containing a method wrapper | ||
if (isObject(value) | ||
&& value['__type__'] | ||
&& value['__type__'] === '__function__' | ||
&& typeof value['id'] === 'string') { | ||
const id = value['id']; | ||
const origin = value['origin']; | ||
// convert wrapper to a callable method | ||
return (...args) => { | ||
return send('__function__', { | ||
args: args, | ||
id: id, | ||
}, targetWindow, origin); | ||
}; | ||
} | ||
} | ||
}; | ||
return { | ||
name: 'function', | ||
serialize, | ||
deserialize | ||
}; | ||
}; | ||
export default FunctionSerializerFactory; | ||
//# sourceMappingURL=function-serializer.js.map |
import type { send, handleFactory } from '../../channel'; | ||
export declare type customizerProperties = { | ||
interface SerializerDependencies { | ||
send: typeof send; | ||
handleFactory: typeof handleFactory; | ||
} | ||
interface customizerProperties { | ||
value: any; | ||
@@ -9,16 +13,14 @@ key: number | string | undefined; | ||
customizerMethod: (messageData: any, event?: MessageEvent<string>) => any; | ||
}; | ||
export declare type serializeFunction = (customizerProperties: customizerProperties) => any; | ||
export declare type deserializeFunction = (customizerProperties: customizerProperties) => any; | ||
interface SerializerDependencies { | ||
send: typeof send; | ||
handleFactory: typeof handleFactory; | ||
} | ||
export declare type SerializerFactory = (dependencies: SerializerDependencies) => serializer; | ||
interface serializer { | ||
name: string; | ||
serialize: serializeFunction; | ||
deserialize: deserializeFunction; | ||
serialize: (customizerProperties: customizerProperties) => any; | ||
deserialize: (customizerProperties: customizerProperties) => any; | ||
} | ||
export default function serializerFactory(dependencies: SerializerDependencies): { | ||
export declare type SerializerFactory = (dependencies: SerializerDependencies) => serializer; | ||
/** | ||
* The main serializer factory. It returns a general serializer/deserializer which combines | ||
* all single serializer | ||
*/ | ||
export default function mainSerializerFactory(dependencies: SerializerDependencies): { | ||
getSerializers: () => serializer[]; | ||
@@ -25,0 +27,0 @@ getSerializerByName: (name: string) => serializer | null; |
@@ -6,2 +6,6 @@ import FunctionSerializer from './function-serializer'; | ||
import cloneDeepWith from 'lodash/cloneDeepWith'; | ||
/** | ||
* Collect all single serializer/deserializer. The first matching result | ||
* will be used as the customizer in cloneDeepWith | ||
*/ | ||
const serializerFactories = [ | ||
@@ -13,3 +17,7 @@ CriteriaSerializer, | ||
]; | ||
export default function serializerFactory(dependencies) { | ||
/** | ||
* The main serializer factory. It returns a general serializer/deserializer which combines | ||
* all single serializer | ||
*/ | ||
export default function mainSerializerFactory(dependencies) { | ||
const serializers = serializerFactories.map(serializerFactory => serializerFactory(dependencies)); | ||
@@ -26,5 +34,5 @@ function getSerializers() { | ||
return cloneDeepWith(messageData, (value, key, object, stack) => { | ||
// find first matching result | ||
const serializerResults = serializers.map(serializer => { | ||
return serializer.serialize({ | ||
// return first matching serializer result | ||
for (const serializer of serializers) { | ||
const result = serializer.serialize({ | ||
value, | ||
@@ -36,5 +44,7 @@ key, | ||
}); | ||
}); | ||
// get first serializer result which is not undefined | ||
return serializerResults.find(r => !!r); | ||
if (result) { | ||
return result; | ||
} | ||
; | ||
} | ||
}); | ||
@@ -44,5 +54,5 @@ } | ||
return cloneDeepWith(messageData, (value, key, object, stack) => { | ||
// find first matching result | ||
const deserializerResults = serializers.map(serializer => { | ||
return serializer.deserialize({ | ||
// return first matching serializer result | ||
for (const serializer of serializers) { | ||
const result = serializer.deserialize({ | ||
value, | ||
@@ -55,5 +65,7 @@ key, | ||
}); | ||
}); | ||
// get first serializer result which is not undefined | ||
return deserializerResults.find(r => !!r); | ||
if (result) { | ||
return result; | ||
} | ||
; | ||
} | ||
}); | ||
@@ -60,0 +72,0 @@ } |
{ | ||
"name": "@shopware-ag/admin-extension-sdk", | ||
"license": "MIT", | ||
"version": "0.0.46", | ||
"version": "0.0.47", | ||
"repository": "git://github.com/shopware/admin-extension-sdk.git", | ||
@@ -6,0 +6,0 @@ "description": "The SDK for App iframes to communicate with the Shopware Adminstration", |
@@ -18,4 +18,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) { | ||
/* eslint-disable */ | ||
const CriteriaSerializer = () => { | ||
const serialize = ({ value, customizerMethod }) => { | ||
const CriteriaSerializer = () => ({ | ||
name: 'criteria', | ||
serialize: ({ value, customizerMethod }) => { | ||
if (value instanceof Criteria_1.default) { | ||
@@ -27,4 +28,4 @@ return { | ||
} | ||
}; | ||
const deserialize = ({ value, customizerMethod }) => { | ||
}, | ||
deserialize: ({ value, customizerMethod }) => { | ||
// When object is containing a criteria wrapper | ||
@@ -86,11 +87,6 @@ if ((0, utils_1.hasType)('__Criteria__', value) && typeof value['data'] === 'object') { | ||
} | ||
}; | ||
return { | ||
name: 'criteria', | ||
serialize, | ||
deserialize, | ||
}; | ||
}; | ||
} | ||
}); | ||
exports.default = CriteriaSerializer; | ||
}); | ||
//# sourceMappingURL=criteria-serializer.js.map |
@@ -17,5 +17,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) { | ||
const EntityCollection_1 = __importDefault(require("../../data/_internals/EntityCollection")); | ||
const EntityCollectionSerializerFactory = () => { | ||
/* eslint-disable */ | ||
const serialize = ({ value, customizerMethod }) => { | ||
/* eslint-disable */ | ||
const EntityCollectionSerializerFactory = () => ({ | ||
name: 'entity-collection', | ||
serialize: ({ value, customizerMethod }) => { | ||
if (value instanceof EntityCollection_1.default) { | ||
@@ -33,16 +34,11 @@ return customizerMethod({ | ||
} | ||
}; | ||
const deserialize = ({ value, customizerMethod }) => { | ||
}, | ||
deserialize: ({ value, customizerMethod }) => { | ||
if ((0, utils_1.hasType)('__EntityCollection__', value)) { | ||
return new EntityCollection_1.default(value.__source__, value.__entityName__, value.__context__, customizerMethod(value.__criteria__), customizerMethod(value.__entities__), value.__total__, value.__aggregations__); | ||
} | ||
}; | ||
return { | ||
name: 'entity-collection', | ||
serialize, | ||
deserialize, | ||
}; | ||
}; | ||
}, | ||
}); | ||
exports.default = EntityCollectionSerializerFactory; | ||
}); | ||
//# sourceMappingURL=entity-collection-serializer.js.map |
@@ -17,20 +17,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) { | ||
const Entity_1 = __importDefault(require("../../data/_internals/Entity")); | ||
const EntitySerializerFactory = () => { | ||
/* eslint-disable */ | ||
const serialize = ({ value, customizerMethod }) => { | ||
/* eslint-disable */ | ||
const EntitySerializerFactory = () => ({ | ||
name: 'entity', | ||
serialize: ({ value, customizerMethod }) => { | ||
if (!(0, utils_1.isObject)(value) || typeof value.getDraft !== 'function') { | ||
return; | ||
} | ||
const entity = value; | ||
return { | ||
__type__: '__Entity__', | ||
__id__: entity.id, | ||
__entityName__: entity._entityName, | ||
__isDirty__: entity._isDirty, | ||
__isNew__: entity._isNew, | ||
__origin__: customizerMethod(entity._origin), | ||
__draft__: customizerMethod(entity._draft), | ||
__id__: value.id, | ||
__entityName__: value._entityName, | ||
__isDirty__: value._isDirty, | ||
__isNew__: value._isNew, | ||
__origin__: customizerMethod(value._origin), | ||
__draft__: customizerMethod(value._draft), | ||
}; | ||
}; | ||
const deserialize = ({ value, customizerMethod }) => { | ||
}, | ||
deserialize: ({ value, customizerMethod }) => { | ||
if ((0, utils_1.hasType)('__Entity__', value) && typeof value.__origin__ === 'object') { | ||
@@ -43,11 +43,6 @@ return new Entity_1.default(value.__id__, value.__entityName__, customizerMethod(value.__draft__), { | ||
} | ||
}; | ||
return { | ||
name: 'entity', | ||
serialize, | ||
deserialize, | ||
}; | ||
}; | ||
}, | ||
}); | ||
exports.default = EntitySerializerFactory; | ||
}); | ||
//# sourceMappingURL=entity-serializer.js.map |
@@ -22,4 +22,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
const utils_1 = require("../utils"); | ||
/* eslint-disable */ | ||
const FunctionSerializerFactory = ({ send, handleFactory }) => { | ||
/* eslint-disable */ | ||
// only available on sender side | ||
@@ -37,42 +37,40 @@ const methodRegistry = {}; | ||
} | ||
const serialize = ({ value }) => { | ||
if (typeof value === 'function') { | ||
const id = (0, utils_1.generateUniqueId)(); | ||
// add the method reference to the methodRegistry | ||
methodRegistry[id] = value; | ||
// start a general function listener which calls the method when the handler calls the method | ||
startMethodHandler(); | ||
// replace function with a object containing the type and id | ||
return { | ||
__type__: '__function__', | ||
id: id, | ||
origin: window.origin, | ||
}; | ||
} | ||
}; | ||
const deserialize = ({ value, event }) => { | ||
var _a; | ||
// @ts-expect-error | ||
const targetWindow = (_a = event === null || event === void 0 ? void 0 : event.source) !== null && _a !== void 0 ? _a : window; | ||
// when object is containing a method wrapper | ||
if ((0, utils_1.isObject)(value) | ||
&& value['__type__'] | ||
&& value['__type__'] === '__function__' | ||
&& typeof value['id'] === 'string') { | ||
const id = value['id']; | ||
const origin = value['origin']; | ||
// convert wrapper to a callable method | ||
return (...args) => { | ||
return send('__function__', { | ||
args: args, | ||
return { | ||
name: 'function', | ||
serialize: ({ value }) => { | ||
if (typeof value === 'function') { | ||
const id = (0, utils_1.generateUniqueId)(); | ||
// add the method reference to the methodRegistry | ||
methodRegistry[id] = value; | ||
// start a general function listener which calls the method when the handler calls the method | ||
startMethodHandler(); | ||
// replace function with a object containing the type and id | ||
return { | ||
__type__: '__function__', | ||
id: id, | ||
}, targetWindow, origin); | ||
}; | ||
origin: window.origin, | ||
}; | ||
} | ||
}, | ||
deserialize: ({ value, event }) => { | ||
var _a; | ||
// @ts-expect-error | ||
const targetWindow = (_a = event === null || event === void 0 ? void 0 : event.source) !== null && _a !== void 0 ? _a : window; | ||
// when object is containing a method wrapper | ||
if ((0, utils_1.isObject)(value) | ||
&& value['__type__'] | ||
&& value['__type__'] === '__function__' | ||
&& typeof value['id'] === 'string') { | ||
const id = value['id']; | ||
const origin = value['origin']; | ||
// convert wrapper to a callable method | ||
return (...args) => { | ||
return send('__function__', { | ||
args: args, | ||
id: id, | ||
}, targetWindow, origin); | ||
}; | ||
} | ||
} | ||
}; | ||
return { | ||
name: 'function', | ||
serialize, | ||
deserialize | ||
}; | ||
}; | ||
@@ -79,0 +77,0 @@ exports.default = FunctionSerializerFactory; |
import type { send, handleFactory } from '../../channel'; | ||
export declare type customizerProperties = { | ||
interface SerializerDependencies { | ||
send: typeof send; | ||
handleFactory: typeof handleFactory; | ||
} | ||
interface customizerProperties { | ||
value: any; | ||
@@ -9,16 +13,14 @@ key: number | string | undefined; | ||
customizerMethod: (messageData: any, event?: MessageEvent<string>) => any; | ||
}; | ||
export declare type serializeFunction = (customizerProperties: customizerProperties) => any; | ||
export declare type deserializeFunction = (customizerProperties: customizerProperties) => any; | ||
interface SerializerDependencies { | ||
send: typeof send; | ||
handleFactory: typeof handleFactory; | ||
} | ||
export declare type SerializerFactory = (dependencies: SerializerDependencies) => serializer; | ||
interface serializer { | ||
name: string; | ||
serialize: serializeFunction; | ||
deserialize: deserializeFunction; | ||
serialize: (customizerProperties: customizerProperties) => any; | ||
deserialize: (customizerProperties: customizerProperties) => any; | ||
} | ||
export default function serializerFactory(dependencies: SerializerDependencies): { | ||
export declare type SerializerFactory = (dependencies: SerializerDependencies) => serializer; | ||
/** | ||
* The main serializer factory. It returns a general serializer/deserializer which combines | ||
* all single serializer | ||
*/ | ||
export default function mainSerializerFactory(dependencies: SerializerDependencies): { | ||
getSerializers: () => serializer[]; | ||
@@ -25,0 +27,0 @@ getSerializerByName: (name: string) => serializer | null; |
@@ -20,2 +20,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) { | ||
const cloneDeepWith_1 = __importDefault(require("lodash/cloneDeepWith")); | ||
/** | ||
* Collect all single serializer/deserializer. The first matching result | ||
* will be used as the customizer in cloneDeepWith | ||
*/ | ||
const serializerFactories = [ | ||
@@ -27,3 +31,7 @@ criteria_serializer_1.default, | ||
]; | ||
function serializerFactory(dependencies) { | ||
/** | ||
* The main serializer factory. It returns a general serializer/deserializer which combines | ||
* all single serializer | ||
*/ | ||
function mainSerializerFactory(dependencies) { | ||
const serializers = serializerFactories.map(serializerFactory => serializerFactory(dependencies)); | ||
@@ -40,5 +48,5 @@ function getSerializers() { | ||
return (0, cloneDeepWith_1.default)(messageData, (value, key, object, stack) => { | ||
// find first matching result | ||
const serializerResults = serializers.map(serializer => { | ||
return serializer.serialize({ | ||
// return first matching serializer result | ||
for (const serializer of serializers) { | ||
const result = serializer.serialize({ | ||
value, | ||
@@ -50,5 +58,7 @@ key, | ||
}); | ||
}); | ||
// get first serializer result which is not undefined | ||
return serializerResults.find(r => !!r); | ||
if (result) { | ||
return result; | ||
} | ||
; | ||
} | ||
}); | ||
@@ -58,5 +68,5 @@ } | ||
return (0, cloneDeepWith_1.default)(messageData, (value, key, object, stack) => { | ||
// find first matching result | ||
const deserializerResults = serializers.map(serializer => { | ||
return serializer.deserialize({ | ||
// return first matching serializer result | ||
for (const serializer of serializers) { | ||
const result = serializer.deserialize({ | ||
value, | ||
@@ -69,5 +79,7 @@ key, | ||
}); | ||
}); | ||
// get first serializer result which is not undefined | ||
return deserializerResults.find(r => !!r); | ||
if (result) { | ||
return result; | ||
} | ||
; | ||
} | ||
}); | ||
@@ -83,4 +95,4 @@ } | ||
} | ||
exports.default = serializerFactory; | ||
exports.default = mainSerializerFactory; | ||
}); | ||
//# sourceMappingURL=index.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
498617
7695