!function(){"use strict";conste=e=>parseInt(e,10),t=(e,t)=>{consta=e-t;return0===a?0:a>0?1:-1},a=(e,t,a)=>({major:e,minor:t,patch:a}),n=t=>{constn=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(t);returnn?a(e(n[1]),e(n[2]),e(n[3])):a(0,0,0)},o=e=>t=>(e=>{constt=typeofe;returnnull===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(a=n=e,(o=String).prototype.isPrototypeOf(a)||(null===(r=n.constructor)||void0===r?void0:r.name)===o.name)?"string":t;vara,n,o,r})(t)===e,r=e=>t=>typeoft===e,i=o("string"),l=o("object"),s=o("array"),c=r("boolean"),m=(void0,e=>undefined===e);constd=e=>null==e,p=e=>!d(e),u=r("function"),g=r("number"),y=e=>{lett=e;return{get:()=>t,set:e=>{t=e}}},v=()=>{},h=e=>()=>e,f=e=>e,_=e=>e(),b=h(!1),w=h(!0);classx{constructor(e,t){this.tag=e,this.value=t}staticsome(e){returnnewx(!0,e)}staticnone(){returnx.singletonNone}fold(e,t){returnthis.tag?t(this.value):e()}isSome(){returnthis.tag}isNone(){return!this.tag}map(e){returnthis.tag?x.some(e(this.value)):x.none()}bind(e){returnthis.tag?e(this.value):x.none()}exists(e){returnthis.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:x.none()}getOr(e){returnthis.tag?this.value:e}or(e){returnthis.tag?this:e}getOrThunk(e){returnthis.tag?this.value:e()}orThunk(e){returnthis.tag?this:e()}getOrDie(e){if(this.tag)returnthis.value;thrownewError(null!=e?e:"Called getOrDie on None")}staticfrom(e){returnp(e)?x.some(e):x.none()}getOrNull(){returnthis.tag?this.value:null}getOrUndefined(){returnthis.value}each(e){this.tag&&e(this.value)}toArray(){returnthis.tag?[this.value]:[]}toString(){returnthis.tag?`some(${this.value})`:"none()"}}x.singletonNone=newx(!1);constC=Array.prototype.slice,S=Array.prototype.indexOf,A=Array.prototype.push,E=(e,t)=>((e,t)=>S.call(e,t))(e,t)>-1,T=(e,t)=>{consta=e.length,n=newArray(a);for(leto=0;o<a;o++){consta=e[o];n[o]=t(a,o)}returnn},D=(e,t)=>{for(leta=0,n=e.length;a<n;a++)t(e[a],a)},O=(e,t)=>{for(leta=0,n=e.length;a<n;a++)if(t(e[a],a))returnx.some(a);returnx.none()},P=(e,t)=>(e=>{constt=[];for(leta=0,n=e.length;a<n;++a){if(!s(e[a]))thrownewError("Arr.flatten item "+a+" was not an array, input: "+e);A.apply(t,e[a])}returnt})(T(e,t)),I=(e,t)=>{for(leta=0,n=e.length;a<n;++a)if(!0!==t(e[a],a))return!1;return!0},M=e=>((e,t)=>0<e.length?x.some(e[0]):x.none())(e);class$extendsError{constructor(e){super(e),this.name="AdvTemplateError"}}constN=e=>{constt=t=>t(e),a=h(e),n=()=>o,o={tag:!0,inner:e,fold:(t,a)=>a(e),isValue:w,isError:b,map:t=>k.value(t(e)),mapError:n,bind:t,exists:t,forall:t,getOr:a,or:n,getOrThunk:a,orThunk:n,getOrDie:a,each:t=>{t(e)},toOptional:()=>x.some(e)};returno},j=e=>{constt=()=>a,a={tag:!1,inner:e,fold:(t,a)=>t(e),isValue:b,isError:w,map:t,mapError:t=>k.error(t(e)),bind:t,exists:b,forall:w,getOr:f,or:f,getOrThunk:_,orThunk:_,getOrDie:(n=String(e),()=>{thrownewError(n)}),each:v,toOptional:x.none};varn;returna},k={value:N,error:j,fromOption:(e,t)=>e.fold((()=>j(t)),N)},R=Object.keys,B=Object.hasOwnProperty,L=(e,t)=>B.call(e,t),z=e=>i(e)&&e.length>0,U=e=>z(e),V=e=>L(e,"id")&&U(e.id),K=e=>L(e,"title")&&z(e.title),q=e=>L(e,"content")&&z(e.content),F=e=>l(e)&&V(e)&&K(e)&&L(e,"items")&&G(e.items),H=e=>l(e)&&V(e)&&K(e)&&(e=>!L(e,"items")||G(e.items))(e),G=e=>s(e)&&I(e,H),W=e=>L(e,"items")&&J(e.items),Y=e=>l(e)&&K(e)&&((e=>q(e))(e)||W(e)),J=e=>s(e)&&I(e,Y),Q=(e,t)=>a=>e(a)?k.value(a):k.error(t),X=Q((e=>l(e)&&(e=>{for(consttine)if(B.call(e,t))return!1;return!0})(e)),"response should contain empty object"),Z=Q((e=>l(e)&&V(e)),"response should contain id"),ee=Q((e=>l(e)&&V(e)&&K(e)&&q(e)),"response contains invalid template data"),te=e=>G(e)?(e=>{constt=e=>P(e,(e=>F(e)?[e.id,...t(e.items)]:[e.id])),a=t(e);returna.length===[...newSet(a)].length})(e)?k.value(e):k.error("response contains duplicated ids"):k.error("response contains invalid data"),ae=e=>t=>t.options.get(e),ne=e=>{constt=(t,a)=>{varn,o;n=t,o=(e,t)=>(...n)=>((e,t,a)=>{returnl(n=a)&&u(n.then)&&u(n.catch)?a.then((a=>t(a).fold((t=>Promise.reject(ne