@luminocity/lemonate-gateway 8.2.28 → 8.2.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,8 +8,8 @@ n.version="2.30.1",i(Za),n.fn=ur,n.min=Qa,n.max=en,n.now=tn,n.utc=f,n.unix=cr,n.
8
8
  * Released under MIT license <https://lodash.com/license>
9
9
  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
10
10
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
11
- */var q=(Y||(Y=1,function(e,t){(function(){var a,n="Expected a function",i="__lodash_hash_undefined__",r="__lodash_placeholder__",s=32,o=128,l=256,u=1/0,c=9007199254740991,d=NaN,p=4294967295,h=[["ary",o],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",l]],f="[object Arguments]",m="[object Array]",y="[object Boolean]",g="[object Date]",b="[object Error]",v="[object Function]",_="[object GeneratorFunction]",w="[object Map]",A="[object Number]",k="[object Object]",S="[object Promise]",N="[object RegExp]",T="[object Set]",M="[object String]",x="[object Symbol]",C="[object WeakMap]",V="[object ArrayBuffer]",E="[object DataView]",F="[object Float32Array]",D="[object Float64Array]",R="[object Int8Array]",L="[object Int16Array]",P="[object Int32Array]",B="[object Uint8Array]",O="[object Uint8ClampedArray]",$="[object Uint16Array]",U="[object Uint32Array]",j=/\b__p \+= '';/g,z=/\b(__p \+=) '' \+/g,W=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Y=/&(?:amp|lt|gt|quot|#39);/g,H=/[&<>"']/g,G=RegExp(Y.source),q=RegExp(H.source),Z=/<%-([\s\S]+?)%>/g,J=/<%([\s\S]+?)%>/g,K=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ae=RegExp(te.source),ne=/^\s+/,ie=/\s/,re=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,se=/\{\n\/\* \[wrapped with (.+)\] \*/,oe=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ue=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,de=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,fe=/^0b[01]+$/i,me=/^\[object .+?Constructor\]$/,ye=/^0o[0-7]+$/i,ge=/^(?:0|[1-9]\d*)$/,be=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ve=/($^)/,_e=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Ae="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ke="\\u2700-\\u27bf",Se="a-z\\xdf-\\xf6\\xf8-\\xff",Ne="A-Z\\xc0-\\xd6\\xd8-\\xde",Te="\\ufe0e\\ufe0f",Me="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",xe="['’]",Ce="["+we+"]",Ie="["+Me+"]",Ve="["+Ae+"]",Ee="\\d+",Fe="["+ke+"]",De="["+Se+"]",Re="[^"+we+Me+Ee+ke+Se+Ne+"]",Le="\\ud83c[\\udffb-\\udfff]",Pe="[^"+we+"]",Be="(?:\\ud83c[\\udde6-\\uddff]){2}",Oe="[\\ud800-\\udbff][\\udc00-\\udfff]",$e="["+Ne+"]",Ue="\\u200d",je="(?:"+De+"|"+Re+")",ze="(?:"+$e+"|"+Re+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",Ye="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ve+"|"+Le+")?",Ge="["+Te+"]?",qe=Ge+He+"(?:"+Ue+"(?:"+[Pe,Be,Oe].join("|")+")"+Ge+He+")*",Ze="(?:"+[Fe,Be,Oe].join("|")+")"+qe,Je="(?:"+[Pe+Ve+"?",Ve,Be,Oe,Ce].join("|")+")",Ke=RegExp(xe,"g"),Xe=RegExp(Ve,"g"),Qe=RegExp(Le+"(?="+Le+")|"+Je+qe,"g"),et=RegExp([$e+"?"+De+"+"+We+"(?="+[Ie,$e,"$"].join("|")+")",ze+"+"+Ye+"(?="+[Ie,$e+je,"$"].join("|")+")",$e+"?"+je+"+"+We,$e+"+"+Ye,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ee,Ze].join("|"),"g"),tt=RegExp("["+Ue+we+Ae+Te+"]"),at=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],it=-1,rt={};rt[F]=rt[D]=rt[R]=rt[L]=rt[P]=rt[B]=rt[O]=rt[$]=rt[U]=!0,rt[f]=rt[m]=rt[V]=rt[y]=rt[E]=rt[g]=rt[b]=rt[v]=rt[w]=rt[A]=rt[k]=rt[N]=rt[T]=rt[M]=rt[C]=!1;var st={};st[f]=st[m]=st[V]=st[E]=st[y]=st[g]=st[F]=st[D]=st[R]=st[L]=st[P]=st[w]=st[A]=st[k]=st[N]=st[T]=st[M]=st[x]=st[B]=st[O]=st[$]=st[U]=!0,st[b]=st[v]=st[C]=!1;var ot={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},lt=parseFloat,ut=parseInt,ct="object"==typeof I&&I&&I.Object===Object&&I,dt="object"==typeof self&&self&&self.Object===Object&&self,pt=ct||dt||Function("return this")(),ht=t&&!t.nodeType&&t,ft=ht&&e&&!e.nodeType&&e,mt=ft&&ft.exports===ht,yt=mt&&ct.process,gt=function(){try{var e=ft&&ft.require&&ft.require("util").types;return e||yt&&yt.binding&&yt.binding("util")}catch(e){}}(),bt=gt&&gt.isArrayBuffer,vt=gt&&gt.isDate,_t=gt&&gt.isMap,wt=gt&&gt.isRegExp,At=gt&&gt.isSet,kt=gt&&gt.isTypedArray;function St(e,t,a){switch(a.length){case 0:return e.call(t);case 1:return e.call(t,a[0]);case 2:return e.call(t,a[0],a[1]);case 3:return e.call(t,a[0],a[1],a[2])}return e.apply(t,a)}function Nt(e,t,a,n){for(var i=-1,r=null==e?0:e.length;++i<r;){var s=e[i];t(n,s,a(s),e)}return n}function Tt(e,t){for(var a=-1,n=null==e?0:e.length;++a<n&&!1!==t(e[a],a,e););return e}function Mt(e,t){for(var a=null==e?0:e.length;a--&&!1!==t(e[a],a,e););return e}function xt(e,t){for(var a=-1,n=null==e?0:e.length;++a<n;)if(!t(e[a],a,e))return!1;return!0}function Ct(e,t){for(var a=-1,n=null==e?0:e.length,i=0,r=[];++a<n;){var s=e[a];t(s,a,e)&&(r[i++]=s)}return r}function It(e,t){return!(null==e||!e.length)&&$t(e,t,0)>-1}function Vt(e,t,a){for(var n=-1,i=null==e?0:e.length;++n<i;)if(a(t,e[n]))return!0;return!1}function Et(e,t){for(var a=-1,n=null==e?0:e.length,i=Array(n);++a<n;)i[a]=t(e[a],a,e);return i}function Ft(e,t){for(var a=-1,n=t.length,i=e.length;++a<n;)e[i+a]=t[a];return e}function Dt(e,t,a,n){var i=-1,r=null==e?0:e.length;for(n&&r&&(a=e[++i]);++i<r;)a=t(a,e[i],i,e);return a}function Rt(e,t,a,n){var i=null==e?0:e.length;for(n&&i&&(a=e[--i]);i--;)a=t(a,e[i],i,e);return a}function Lt(e,t){for(var a=-1,n=null==e?0:e.length;++a<n;)if(t(e[a],a,e))return!0;return!1}var Pt=Wt("length");function Bt(e,t,a){var n;return a(e,(function(e,a,i){if(t(e,a,i))return n=a,!1})),n}function Ot(e,t,a,n){for(var i=e.length,r=a+(n?1:-1);n?r--:++r<i;)if(t(e[r],r,e))return r;return-1}function $t(e,t,a){return t==t?function(e,t,a){for(var n=a-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t,a):Ot(e,jt,a)}function Ut(e,t,a,n){for(var i=a-1,r=e.length;++i<r;)if(n(e[i],t))return i;return-1}function jt(e){return e!=e}function zt(e,t){var a=null==e?0:e.length;return a?Gt(e,t)/a:d}function Wt(e){return function(t){return null==t?a:t[e]}}function Yt(e){return function(t){return null==e?a:e[t]}}function Ht(e,t,a,n,i){return i(e,(function(e,i,r){a=n?(n=!1,e):t(a,e,i,r)})),a}function Gt(e,t){for(var n,i=-1,r=e.length;++i<r;){var s=t(e[i]);s!==a&&(n=n===a?s:n+s)}return n}function qt(e,t){for(var a=-1,n=Array(e);++a<e;)n[a]=t(a);return n}function Zt(e){return e?e.slice(0,pa(e)+1).replace(ne,""):e}function Jt(e){return function(t){return e(t)}}function Kt(e,t){return Et(t,(function(t){return e[t]}))}function Xt(e,t){return e.has(t)}function Qt(e,t){for(var a=-1,n=e.length;++a<n&&$t(t,e[a],0)>-1;);return a}function ea(e,t){for(var a=e.length;a--&&$t(t,e[a],0)>-1;);return a}var ta=Yt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),aa=Yt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function na(e){return"\\"+ot[e]}function ia(e){return tt.test(e)}function ra(e){var t=-1,a=Array(e.size);return e.forEach((function(e,n){a[++t]=[n,e]})),a}function sa(e,t){return function(a){return e(t(a))}}function oa(e,t){for(var a=-1,n=e.length,i=0,s=[];++a<n;){var o=e[a];o!==t&&o!==r||(e[a]=r,s[i++]=a)}return s}function la(e){var t=-1,a=Array(e.size);return e.forEach((function(e){a[++t]=e})),a}function ua(e){var t=-1,a=Array(e.size);return e.forEach((function(e){a[++t]=[e,e]})),a}function ca(e){return ia(e)?function(e){for(var t=Qe.lastIndex=0;Qe.test(e);)++t;return t}(e):Pt(e)}function da(e){return ia(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.split("")}(e)}function pa(e){for(var t=e.length;t--&&ie.test(e.charAt(t)););return t}var ha=Yt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),fa=function e(t){var I,ie=(t=null==t?pt:fa.defaults(pt.Object(),t,fa.pick(pt,nt))).Array,we=t.Date,Ae=t.Error,ke=t.Function,Se=t.Math,Ne=t.Object,Te=t.RegExp,Me=t.String,xe=t.TypeError,Ce=ie.prototype,Ie=ke.prototype,Ve=Ne.prototype,Ee=t["__core-js_shared__"],Fe=Ie.toString,De=Ve.hasOwnProperty,Re=0,Le=(I=/[^.]+$/.exec(Ee&&Ee.keys&&Ee.keys.IE_PROTO||""))?"Symbol(src)_1."+I:"",Pe=Ve.toString,Be=Fe.call(Ne),Oe=pt._,$e=Te("^"+Fe.call(De).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ue=mt?t.Buffer:a,je=t.Symbol,ze=t.Uint8Array,We=Ue?Ue.allocUnsafe:a,Ye=sa(Ne.getPrototypeOf,Ne),He=Ne.create,Ge=Ve.propertyIsEnumerable,qe=Ce.splice,Ze=je?je.isConcatSpreadable:a,Je=je?je.iterator:a,Qe=je?je.toStringTag:a,tt=function(){try{var e=cr(Ne,"defineProperty");return e({},"",{}),e}catch(e){}}(),ot=t.clearTimeout!==pt.clearTimeout&&t.clearTimeout,ct=we&&we.now!==pt.Date.now&&we.now,dt=t.setTimeout!==pt.setTimeout&&t.setTimeout,ht=Se.ceil,ft=Se.floor,yt=Ne.getOwnPropertySymbols,gt=Ue?Ue.isBuffer:a,Pt=t.isFinite,Yt=Ce.join,ma=sa(Ne.keys,Ne),ya=Se.max,ga=Se.min,ba=we.now,va=t.parseInt,_a=Se.random,wa=Ce.reverse,Aa=cr(t,"DataView"),ka=cr(t,"Map"),Sa=cr(t,"Promise"),Na=cr(t,"Set"),Ta=cr(t,"WeakMap"),Ma=cr(Ne,"create"),xa=Ta&&new Ta,Ca={},Ia=Lr(Aa),Va=Lr(ka),Ea=Lr(Sa),Fa=Lr(Na),Da=Lr(Ta),Ra=je?je.prototype:a,La=Ra?Ra.valueOf:a,Pa=Ra?Ra.toString:a;function Ba(e){if(Qs(e)&&!js(e)&&!(e instanceof ja)){if(e instanceof Ua)return e;if(De.call(e,"__wrapped__"))return Pr(e)}return new Ua(e)}var Oa=function(){function e(){}return function(t){if(!Xs(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=a,n}}();function $a(){}function Ua(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=a}function ja(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=p,this.__views__=[]}function za(e){var t=-1,a=null==e?0:e.length;for(this.clear();++t<a;){var n=e[t];this.set(n[0],n[1])}}function Wa(e){var t=-1,a=null==e?0:e.length;for(this.clear();++t<a;){var n=e[t];this.set(n[0],n[1])}}function Ya(e){var t=-1,a=null==e?0:e.length;for(this.clear();++t<a;){var n=e[t];this.set(n[0],n[1])}}function Ha(e){var t=-1,a=null==e?0:e.length;for(this.__data__=new Ya;++t<a;)this.add(e[t])}function Ga(e){var t=this.__data__=new Wa(e);this.size=t.size}function qa(e,t){var a=js(e),n=!a&&Us(e),i=!a&&!n&&Hs(e),r=!a&&!n&&!i&&oo(e),s=a||n||i||r,o=s?qt(e.length,Me):[],l=o.length;for(var u in e)!t&&!De.call(e,u)||s&&("length"==u||i&&("offset"==u||"parent"==u)||r&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||gr(u,l))||o.push(u);return o}function Za(e){var t=e.length;return t?e[Gn(0,t-1)]:a}function Ja(e,t){return Fr(xi(e),sn(t,0,e.length))}function Ka(e){return Fr(xi(e))}function Xa(e,t,n){(n!==a&&!Bs(e[t],n)||n===a&&!(t in e))&&nn(e,t,n)}function Qa(e,t,n){var i=e[t];De.call(e,t)&&Bs(i,n)&&(n!==a||t in e)||nn(e,t,n)}function en(e,t){for(var a=e.length;a--;)if(Bs(e[a][0],t))return a;return-1}function tn(e,t,a,n){return dn(e,(function(e,i,r){t(n,e,a(e),r)})),n}function an(e,t){return e&&Ci(t,Io(t),e)}function nn(e,t,a){"__proto__"==t&&tt?tt(e,t,{configurable:!0,enumerable:!0,value:a,writable:!0}):e[t]=a}function rn(e,t){for(var n=-1,i=t.length,r=ie(i),s=null==e;++n<i;)r[n]=s?a:No(e,t[n]);return r}function sn(e,t,n){return e==e&&(n!==a&&(e=e<=n?e:n),t!==a&&(e=e>=t?e:t)),e}function on(e,t,n,i,r,s){var o,l=1&t,u=2&t,c=4&t;if(n&&(o=r?n(e,i,r,s):n(e)),o!==a)return o;if(!Xs(e))return e;var d=js(e);if(d){if(o=function(e){var t=e.length,a=new e.constructor(t);return t&&"string"==typeof e[0]&&De.call(e,"index")&&(a.index=e.index,a.input=e.input),a}(e),!l)return xi(e,o)}else{var p=hr(e),h=p==v||p==_;if(Hs(e))return Ai(e,l);if(p==k||p==f||h&&!r){if(o=u||h?{}:mr(e),!l)return u?function(e,t){return Ci(e,pr(e),t)}(e,function(e,t){return e&&Ci(t,Vo(t),e)}(o,e)):function(e,t){return Ci(e,dr(e),t)}(e,an(o,e))}else{if(!st[p])return r?e:{};o=function(e,t,a){var n,i=e.constructor;switch(t){case V:return ki(e);case y:case g:return new i(+e);case E:return function(e,t){var a=t?ki(e.buffer):e.buffer;return new e.constructor(a,e.byteOffset,e.byteLength)}(e,a);case F:case D:case R:case L:case P:case B:case O:case $:case U:return Si(e,a);case w:return new i;case A:case M:return new i(e);case N:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case T:return new i;case x:return n=e,La?Ne(La.call(n)):{}}}(e,p,l)}}s||(s=new Ga);var m=s.get(e);if(m)return m;s.set(e,o),io(e)?e.forEach((function(a){o.add(on(a,t,n,a,e,s))})):eo(e)&&e.forEach((function(a,i){o.set(i,on(a,t,n,i,e,s))}));var b=d?a:(c?u?nr:ar:u?Vo:Io)(e);return Tt(b||e,(function(a,i){b&&(a=e[i=a]),Qa(o,i,on(a,t,n,i,e,s))})),o}function ln(e,t,n){var i=n.length;if(null==e)return!i;for(e=Ne(e);i--;){var r=n[i],s=t[r],o=e[r];if(o===a&&!(r in e)||!s(o))return!1}return!0}function un(e,t,i){if("function"!=typeof e)throw new xe(n);return Cr((function(){e.apply(a,i)}),t)}function cn(e,t,a,n){var i=-1,r=It,s=!0,o=e.length,l=[],u=t.length;if(!o)return l;a&&(t=Et(t,Jt(a))),n?(r=Vt,s=!1):t.length>=200&&(r=Xt,s=!1,t=new Ha(t));e:for(;++i<o;){var c=e[i],d=null==a?c:a(c);if(c=n||0!==c?c:0,s&&d==d){for(var p=u;p--;)if(t[p]===d)continue e;l.push(c)}else r(t,d,n)||l.push(c)}return l}Ba.templateSettings={escape:Z,evaluate:J,interpolate:K,variable:"",imports:{_:Ba}},Ba.prototype=$a.prototype,Ba.prototype.constructor=Ba,Ua.prototype=Oa($a.prototype),Ua.prototype.constructor=Ua,ja.prototype=Oa($a.prototype),ja.prototype.constructor=ja,za.prototype.clear=function(){this.__data__=Ma?Ma(null):{},this.size=0},za.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},za.prototype.get=function(e){var t=this.__data__;if(Ma){var n=t[e];return n===i?a:n}return De.call(t,e)?t[e]:a},za.prototype.has=function(e){var t=this.__data__;return Ma?t[e]!==a:De.call(t,e)},za.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ma&&t===a?i:t,this},Wa.prototype.clear=function(){this.__data__=[],this.size=0},Wa.prototype.delete=function(e){var t=this.__data__,a=en(t,e);return!(a<0||(a==t.length-1?t.pop():qe.call(t,a,1),--this.size,0))},Wa.prototype.get=function(e){var t=this.__data__,n=en(t,e);return n<0?a:t[n][1]},Wa.prototype.has=function(e){return en(this.__data__,e)>-1},Wa.prototype.set=function(e,t){var a=this.__data__,n=en(a,e);return n<0?(++this.size,a.push([e,t])):a[n][1]=t,this},Ya.prototype.clear=function(){this.size=0,this.__data__={hash:new za,map:new(ka||Wa),string:new za}},Ya.prototype.delete=function(e){var t=lr(this,e).delete(e);return this.size-=t?1:0,t},Ya.prototype.get=function(e){return lr(this,e).get(e)},Ya.prototype.has=function(e){return lr(this,e).has(e)},Ya.prototype.set=function(e,t){var a=lr(this,e),n=a.size;return a.set(e,t),this.size+=a.size==n?0:1,this},Ha.prototype.add=Ha.prototype.push=function(e){return this.__data__.set(e,i),this},Ha.prototype.has=function(e){return this.__data__.has(e)},Ga.prototype.clear=function(){this.__data__=new Wa,this.size=0},Ga.prototype.delete=function(e){var t=this.__data__,a=t.delete(e);return this.size=t.size,a},Ga.prototype.get=function(e){return this.__data__.get(e)},Ga.prototype.has=function(e){return this.__data__.has(e)},Ga.prototype.set=function(e,t){var a=this.__data__;if(a instanceof Wa){var n=a.__data__;if(!ka||n.length<199)return n.push([e,t]),this.size=++a.size,this;a=this.__data__=new Ya(n)}return a.set(e,t),this.size=a.size,this};var dn=Ei(vn),pn=Ei(_n,!0);function hn(e,t){var a=!0;return dn(e,(function(e,n,i){return a=!!t(e,n,i)})),a}function fn(e,t,n){for(var i=-1,r=e.length;++i<r;){var s=e[i],o=t(s);if(null!=o&&(l===a?o==o&&!so(o):n(o,l)))var l=o,u=s}return u}function mn(e,t){var a=[];return dn(e,(function(e,n,i){t(e,n,i)&&a.push(e)})),a}function yn(e,t,a,n,i){var r=-1,s=e.length;for(a||(a=yr),i||(i=[]);++r<s;){var o=e[r];t>0&&a(o)?t>1?yn(o,t-1,a,n,i):Ft(i,o):n||(i[i.length]=o)}return i}var gn=Fi(),bn=Fi(!0);function vn(e,t){return e&&gn(e,t,Io)}function _n(e,t){return e&&bn(e,t,Io)}function wn(e,t){return Ct(t,(function(t){return Zs(e[t])}))}function An(e,t){for(var n=0,i=(t=bi(t,e)).length;null!=e&&n<i;)e=e[Rr(t[n++])];return n&&n==i?e:a}function kn(e,t,a){var n=t(e);return js(e)?n:Ft(n,a(e))}function Sn(e){return null==e?e===a?"[object Undefined]":"[object Null]":Qe&&Qe in Ne(e)?function(e){var t=De.call(e,Qe),n=e[Qe];try{e[Qe]=a;var i=!0}catch(e){}var r=Pe.call(e);return i&&(t?e[Qe]=n:delete e[Qe]),r}(e):function(e){return Pe.call(e)}(e)}function Nn(e,t){return e>t}function Tn(e,t){return null!=e&&De.call(e,t)}function Mn(e,t){return null!=e&&t in Ne(e)}function xn(e,t,n){for(var i=n?Vt:It,r=e[0].length,s=e.length,o=s,l=ie(s),u=1/0,c=[];o--;){var d=e[o];o&&t&&(d=Et(d,Jt(t))),u=ga(d.length,u),l[o]=!n&&(t||r>=120&&d.length>=120)?new Ha(o&&d):a}d=e[0];var p=-1,h=l[0];e:for(;++p<r&&c.length<u;){var f=d[p],m=t?t(f):f;if(f=n||0!==f?f:0,!(h?Xt(h,m):i(c,m,n))){for(o=s;--o;){var y=l[o];if(!(y?Xt(y,m):i(e[o],m,n)))continue e}h&&h.push(m),c.push(f)}}return c}function Cn(e,t,n){var i=null==(e=Tr(e,t=bi(t,e)))?e:e[Rr(qr(t))];return null==i?a:St(i,e,n)}function In(e){return Qs(e)&&Sn(e)==f}function Vn(e,t,n,i,r){return e===t||(null==e||null==t||!Qs(e)&&!Qs(t)?e!=e&&t!=t:function(e,t,n,i,r,s){var o=js(e),l=js(t),u=o?m:hr(e),c=l?m:hr(t),d=(u=u==f?k:u)==k,p=(c=c==f?k:c)==k,h=u==c;if(h&&Hs(e)){if(!Hs(t))return!1;o=!0,d=!1}if(h&&!d)return s||(s=new Ga),o||oo(e)?er(e,t,n,i,r,s):function(e,t,a,n,i,r,s){switch(a){case E:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case V:return!(e.byteLength!=t.byteLength||!r(new ze(e),new ze(t)));case y:case g:case A:return Bs(+e,+t);case b:return e.name==t.name&&e.message==t.message;case N:case M:return e==t+"";case w:var o=ra;case T:var l=1&n;if(o||(o=la),e.size!=t.size&&!l)return!1;var u=s.get(e);if(u)return u==t;n|=2,s.set(e,t);var c=er(o(e),o(t),n,i,r,s);return s.delete(e),c;case x:if(La)return La.call(e)==La.call(t)}return!1}(e,t,u,n,i,r,s);if(!(1&n)){var v=d&&De.call(e,"__wrapped__"),_=p&&De.call(t,"__wrapped__");if(v||_){var S=v?e.value():e,C=_?t.value():t;return s||(s=new Ga),r(S,C,n,i,s)}}return!!h&&(s||(s=new Ga),function(e,t,n,i,r,s){var o=1&n,l=ar(e),u=l.length,c=ar(t),d=c.length;if(u!=d&&!o)return!1;for(var p=u;p--;){var h=l[p];if(!(o?h in t:De.call(t,h)))return!1}var f=s.get(e),m=s.get(t);if(f&&m)return f==t&&m==e;var y=!0;s.set(e,t),s.set(t,e);for(var g=o;++p<u;){var b=e[h=l[p]],v=t[h];if(i)var _=o?i(v,b,h,t,e,s):i(b,v,h,e,t,s);if(!(_===a?b===v||r(b,v,n,i,s):_)){y=!1;break}g||(g="constructor"==h)}if(y&&!g){var w=e.constructor,A=t.constructor;w==A||!("constructor"in e)||!("constructor"in t)||"function"==typeof w&&w instanceof w&&"function"==typeof A&&A instanceof A||(y=!1)}return s.delete(e),s.delete(t),y}(e,t,n,i,r,s))}(e,t,n,i,Vn,r))}function En(e,t,n,i){var r=n.length,s=r,o=!i;if(null==e)return!s;for(e=Ne(e);r--;){var l=n[r];if(o&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++r<s;){var u=(l=n[r])[0],c=e[u],d=l[1];if(o&&l[2]){if(c===a&&!(u in e))return!1}else{var p=new Ga;if(i)var h=i(c,d,u,e,t,p);if(!(h===a?Vn(d,c,3,i,p):h))return!1}}return!0}function Fn(e){return!(!Xs(e)||(t=e,Le&&Le in t))&&(Zs(e)?$e:me).test(Lr(e));var t}function Dn(e){return"function"==typeof e?e:null==e?al:"object"==typeof e?js(e)?$n(e[0],e[1]):On(e):dl(e)}function Rn(e){if(!Ar(e))return ma(e);var t=[];for(var a in Ne(e))De.call(e,a)&&"constructor"!=a&&t.push(a);return t}function Ln(e){if(!Xs(e))return function(e){var t=[];if(null!=e)for(var a in Ne(e))t.push(a);return t}(e);var t=Ar(e),a=[];for(var n in e)("constructor"!=n||!t&&De.call(e,n))&&a.push(n);return a}function Pn(e,t){return e<t}function Bn(e,t){var a=-1,n=Ws(e)?ie(e.length):[];return dn(e,(function(e,i,r){n[++a]=t(e,i,r)})),n}function On(e){var t=ur(e);return 1==t.length&&t[0][2]?Sr(t[0][0],t[0][1]):function(a){return a===e||En(a,e,t)}}function $n(e,t){return vr(e)&&kr(t)?Sr(Rr(e),t):function(n){var i=No(n,e);return i===a&&i===t?To(n,e):Vn(t,i,3)}}function Un(e,t,n,i,r){e!==t&&gn(t,(function(s,o){if(r||(r=new Ga),Xs(s))!function(e,t,n,i,r,s,o){var l=Mr(e,n),u=Mr(t,n),c=o.get(u);if(c)Xa(e,n,c);else{var d=s?s(l,u,n+"",e,t,o):a,p=d===a;if(p){var h=js(u),f=!h&&Hs(u),m=!h&&!f&&oo(u);d=u,h||f||m?js(l)?d=l:Ys(l)?d=xi(l):f?(p=!1,d=Ai(u,!0)):m?(p=!1,d=Si(u,!0)):d=[]:ao(u)||Us(u)?(d=l,Us(l)?d=yo(l):Xs(l)&&!Zs(l)||(d=mr(u))):p=!1}p&&(o.set(u,d),r(d,u,i,s,o),o.delete(u)),Xa(e,n,d)}}(e,t,o,n,Un,i,r);else{var l=i?i(Mr(e,o),s,o+"",e,t,r):a;l===a&&(l=s),Xa(e,o,l)}}),Vo)}function jn(e,t){var n=e.length;if(n)return gr(t+=t<0?n:0,n)?e[t]:a}function zn(e,t,a){t=t.length?Et(t,(function(e){return js(e)?function(t){return An(t,1===e.length?e[0]:e)}:e})):[al];var n=-1;t=Et(t,Jt(or()));var i=Bn(e,(function(e,a,i){var r=Et(t,(function(t){return t(e)}));return{criteria:r,index:++n,value:e}}));return function(e,t){var a=e.length;for(e.sort(t);a--;)e[a]=e[a].value;return e}(i,(function(e,t){return function(e,t,a){for(var n=-1,i=e.criteria,r=t.criteria,s=i.length,o=a.length;++n<s;){var l=Ni(i[n],r[n]);if(l)return n>=o?l:l*("desc"==a[n]?-1:1)}return e.index-t.index}(e,t,a)}))}function Wn(e,t,a){for(var n=-1,i=t.length,r={};++n<i;){var s=t[n],o=An(e,s);a(o,s)&&Xn(r,bi(s,e),o)}return r}function Yn(e,t,a,n){var i=n?Ut:$t,r=-1,s=t.length,o=e;for(e===t&&(t=xi(t)),a&&(o=Et(e,Jt(a)));++r<s;)for(var l=0,u=t[r],c=a?a(u):u;(l=i(o,c,l,n))>-1;)o!==e&&qe.call(o,l,1),qe.call(e,l,1);return e}function Hn(e,t){for(var a=e?t.length:0,n=a-1;a--;){var i=t[a];if(a==n||i!==r){var r=i;gr(i)?qe.call(e,i,1):ci(e,i)}}return e}function Gn(e,t){return e+ft(_a()*(t-e+1))}function qn(e,t){var a="";if(!e||t<1||t>c)return a;do{t%2&&(a+=e),(t=ft(t/2))&&(e+=e)}while(t);return a}function Zn(e,t){return Ir(Nr(e,t,al),e+"")}function Jn(e){return Za(Oo(e))}function Kn(e,t){var a=Oo(e);return Fr(a,sn(t,0,a.length))}function Xn(e,t,n,i){if(!Xs(e))return e;for(var r=-1,s=(t=bi(t,e)).length,o=s-1,l=e;null!=l&&++r<s;){var u=Rr(t[r]),c=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(r!=o){var d=l[u];(c=i?i(d,u,l):a)===a&&(c=Xs(d)?d:gr(t[r+1])?[]:{})}Qa(l,u,c),l=l[u]}return e}var Qn=xa?function(e,t){return xa.set(e,t),e}:al,ei=tt?function(e,t){return tt(e,"toString",{configurable:!0,enumerable:!1,value:Qo(t),writable:!0})}:al;function ti(e){return Fr(Oo(e))}function ai(e,t,a){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(a=a>i?i:a)<0&&(a+=i),i=t>a?0:a-t>>>0,t>>>=0;for(var r=ie(i);++n<i;)r[n]=e[n+t];return r}function ni(e,t){var a;return dn(e,(function(e,n,i){return!(a=t(e,n,i))})),!!a}function ii(e,t,a){var n=0,i=null==e?n:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;n<i;){var r=n+i>>>1,s=e[r];null!==s&&!so(s)&&(a?s<=t:s<t)?n=r+1:i=r}return i}return ri(e,t,al,a)}function ri(e,t,n,i){var r=0,s=null==e?0:e.length;if(0===s)return 0;for(var o=(t=n(t))!=t,l=null===t,u=so(t),c=t===a;r<s;){var d=ft((r+s)/2),p=n(e[d]),h=p!==a,f=null===p,m=p==p,y=so(p);if(o)var g=i||m;else g=c?m&&(i||h):l?m&&h&&(i||!f):u?m&&h&&!f&&(i||!y):!f&&!y&&(i?p<=t:p<t);g?r=d+1:s=d}return ga(s,4294967294)}function si(e,t){for(var a=-1,n=e.length,i=0,r=[];++a<n;){var s=e[a],o=t?t(s):s;if(!a||!Bs(o,l)){var l=o;r[i++]=0===s?0:s}}return r}function oi(e){return"number"==typeof e?e:so(e)?d:+e}function li(e){if("string"==typeof e)return e;if(js(e))return Et(e,li)+"";if(so(e))return Pa?Pa.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ui(e,t,a){var n=-1,i=It,r=e.length,s=!0,o=[],l=o;if(a)s=!1,i=Vt;else if(r>=200){var u=t?null:qi(e);if(u)return la(u);s=!1,i=Xt,l=new Ha}else l=t?[]:o;e:for(;++n<r;){var c=e[n],d=t?t(c):c;if(c=a||0!==c?c:0,s&&d==d){for(var p=l.length;p--;)if(l[p]===d)continue e;t&&l.push(d),o.push(c)}else i(l,d,a)||(l!==o&&l.push(d),o.push(c))}return o}function ci(e,t){return null==(e=Tr(e,t=bi(t,e)))||delete e[Rr(qr(t))]}function di(e,t,a,n){return Xn(e,t,a(An(e,t)),n)}function pi(e,t,a,n){for(var i=e.length,r=n?i:-1;(n?r--:++r<i)&&t(e[r],r,e););return a?ai(e,n?0:r,n?r+1:i):ai(e,n?r+1:0,n?i:r)}function hi(e,t){var a=e;return a instanceof ja&&(a=a.value()),Dt(t,(function(e,t){return t.func.apply(t.thisArg,Ft([e],t.args))}),a)}function fi(e,t,a){var n=e.length;if(n<2)return n?ui(e[0]):[];for(var i=-1,r=ie(n);++i<n;)for(var s=e[i],o=-1;++o<n;)o!=i&&(r[i]=cn(r[i]||s,e[o],t,a));return ui(yn(r,1),t,a)}function mi(e,t,n){for(var i=-1,r=e.length,s=t.length,o={};++i<r;){var l=i<s?t[i]:a;n(o,e[i],l)}return o}function yi(e){return Ys(e)?e:[]}function gi(e){return"function"==typeof e?e:al}function bi(e,t){return js(e)?e:vr(e,t)?[e]:Dr(go(e))}var vi=Zn;function _i(e,t,n){var i=e.length;return n=n===a?i:n,!t&&n>=i?e:ai(e,t,n)}var wi=ot||function(e){return pt.clearTimeout(e)};function Ai(e,t){if(t)return e.slice();var a=e.length,n=We?We(a):new e.constructor(a);return e.copy(n),n}function ki(e){var t=new e.constructor(e.byteLength);return new ze(t).set(new ze(e)),t}function Si(e,t){var a=t?ki(e.buffer):e.buffer;return new e.constructor(a,e.byteOffset,e.length)}function Ni(e,t){if(e!==t){var n=e!==a,i=null===e,r=e==e,s=so(e),o=t!==a,l=null===t,u=t==t,c=so(t);if(!l&&!c&&!s&&e>t||s&&o&&u&&!l&&!c||i&&o&&u||!n&&u||!r)return 1;if(!i&&!s&&!c&&e<t||c&&n&&r&&!i&&!s||l&&n&&r||!o&&r||!u)return-1}return 0}function Ti(e,t,a,n){for(var i=-1,r=e.length,s=a.length,o=-1,l=t.length,u=ya(r-s,0),c=ie(l+u),d=!n;++o<l;)c[o]=t[o];for(;++i<s;)(d||i<r)&&(c[a[i]]=e[i]);for(;u--;)c[o++]=e[i++];return c}function Mi(e,t,a,n){for(var i=-1,r=e.length,s=-1,o=a.length,l=-1,u=t.length,c=ya(r-o,0),d=ie(c+u),p=!n;++i<c;)d[i]=e[i];for(var h=i;++l<u;)d[h+l]=t[l];for(;++s<o;)(p||i<r)&&(d[h+a[s]]=e[i++]);return d}function xi(e,t){var a=-1,n=e.length;for(t||(t=ie(n));++a<n;)t[a]=e[a];return t}function Ci(e,t,n,i){var r=!n;n||(n={});for(var s=-1,o=t.length;++s<o;){var l=t[s],u=i?i(n[l],e[l],l,n,e):a;u===a&&(u=e[l]),r?nn(n,l,u):Qa(n,l,u)}return n}function Ii(e,t){return function(a,n){var i=js(a)?Nt:tn,r=t?t():{};return i(a,e,or(n,2),r)}}function Vi(e){return Zn((function(t,n){var i=-1,r=n.length,s=r>1?n[r-1]:a,o=r>2?n[2]:a;for(s=e.length>3&&"function"==typeof s?(r--,s):a,o&&br(n[0],n[1],o)&&(s=r<3?a:s,r=1),t=Ne(t);++i<r;){var l=n[i];l&&e(t,l,i,s)}return t}))}function Ei(e,t){return function(a,n){if(null==a)return a;if(!Ws(a))return e(a,n);for(var i=a.length,r=t?i:-1,s=Ne(a);(t?r--:++r<i)&&!1!==n(s[r],r,s););return a}}function Fi(e){return function(t,a,n){for(var i=-1,r=Ne(t),s=n(t),o=s.length;o--;){var l=s[e?o:++i];if(!1===a(r[l],l,r))break}return t}}function Di(e){return function(t){var n=ia(t=go(t))?da(t):a,i=n?n[0]:t.charAt(0),r=n?_i(n,1).join(""):t.slice(1);return i[e]()+r}}function Ri(e){return function(t){return Dt(Jo(jo(t).replace(Ke,"")),e,"")}}function Li(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var a=Oa(e.prototype),n=e.apply(a,t);return Xs(n)?n:a}}function Pi(e){return function(t,n,i){var r=Ne(t);if(!Ws(t)){var s=or(n,3);t=Io(t),n=function(e){return s(r[e],e,r)}}var o=e(t,n,i);return o>-1?r[s?t[o]:o]:a}}function Bi(e){return tr((function(t){var i=t.length,r=i,s=Ua.prototype.thru;for(e&&t.reverse();r--;){var o=t[r];if("function"!=typeof o)throw new xe(n);if(s&&!l&&"wrapper"==rr(o))var l=new Ua([],!0)}for(r=l?r:i;++r<i;){var u=rr(o=t[r]),c="wrapper"==u?ir(o):a;l=c&&_r(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?l[rr(c[0])].apply(l,c[3]):1==o.length&&_r(o)?l[u]():l.thru(o)}return function(){var e=arguments,a=e[0];if(l&&1==e.length&&js(a))return l.plant(a).value();for(var n=0,r=i?t[n].apply(this,e):a;++n<i;)r=t[n].call(this,r);return r}}))}function Oi(e,t,n,i,r,s,l,u,c,d){var p=t&o,h=1&t,f=2&t,m=24&t,y=512&t,g=f?a:Li(e);return function o(){for(var b=arguments.length,v=ie(b),_=b;_--;)v[_]=arguments[_];if(m)var w=sr(o),A=function(e,t){for(var a=e.length,n=0;a--;)e[a]===t&&++n;return n}(v,w);if(i&&(v=Ti(v,i,r,m)),s&&(v=Mi(v,s,l,m)),b-=A,m&&b<d){var k=oa(v,w);return Hi(e,t,Oi,o.placeholder,n,v,k,u,c,d-b)}var S=h?n:this,N=f?S[e]:e;return b=v.length,u?v=function(e,t){for(var n=e.length,i=ga(t.length,n),r=xi(e);i--;){var s=t[i];e[i]=gr(s,n)?r[s]:a}return e}(v,u):y&&b>1&&v.reverse(),p&&c<b&&(v.length=c),this&&this!==pt&&this instanceof o&&(N=g||Li(N)),N.apply(S,v)}}function $i(e,t){return function(a,n){return function(e,t,a,n){return vn(e,(function(e,i,r){t(n,a(e),i,r)})),n}(a,e,t(n),{})}}function Ui(e,t){return function(n,i){var r;if(n===a&&i===a)return t;if(n!==a&&(r=n),i!==a){if(r===a)return i;"string"==typeof n||"string"==typeof i?(n=li(n),i=li(i)):(n=oi(n),i=oi(i)),r=e(n,i)}return r}}function ji(e){return tr((function(t){return t=Et(t,Jt(or())),Zn((function(a){var n=this;return e(t,(function(e){return St(e,n,a)}))}))}))}function zi(e,t){var n=(t=t===a?" ":li(t)).length;if(n<2)return n?qn(t,e):t;var i=qn(t,ht(e/ca(t)));return ia(t)?_i(da(i),0,e).join(""):i.slice(0,e)}function Wi(e){return function(t,n,i){return i&&"number"!=typeof i&&br(t,n,i)&&(n=i=a),t=po(t),n===a?(n=t,t=0):n=po(n),function(e,t,a,n){for(var i=-1,r=ya(ht((t-e)/(a||1)),0),s=ie(r);r--;)s[n?r:++i]=e,e+=a;return s}(t,n,i=i===a?t<n?1:-1:po(i),e)}}function Yi(e){return function(t,a){return"string"==typeof t&&"string"==typeof a||(t=mo(t),a=mo(a)),e(t,a)}}function Hi(e,t,n,i,r,o,l,u,c,d){var p=8&t;t|=p?s:64,4&(t&=~(p?64:s))||(t&=-4);var h=[e,t,r,p?o:a,p?l:a,p?a:o,p?a:l,u,c,d],f=n.apply(a,h);return _r(e)&&xr(f,h),f.placeholder=i,Vr(f,e,t)}function Gi(e){var t=Se[e];return function(e,a){if(e=mo(e),(a=null==a?0:ga(ho(a),292))&&Pt(e)){var n=(go(e)+"e").split("e");return+((n=(go(t(n[0]+"e"+(+n[1]+a)))+"e").split("e"))[0]+"e"+(+n[1]-a))}return t(e)}}var qi=Na&&1/la(new Na([,-0]))[1]==u?function(e){return new Na(e)}:ol;function Zi(e){return function(t){var a=hr(t);return a==w?ra(t):a==T?ua(t):function(e,t){return Et(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Ji(e,t,i,u,c,d,p,h){var f=2&t;if(!f&&"function"!=typeof e)throw new xe(n);var m=u?u.length:0;if(m||(t&=-97,u=c=a),p=p===a?p:ya(ho(p),0),h=h===a?h:ho(h),m-=c?c.length:0,64&t){var y=u,g=c;u=c=a}var b=f?a:ir(e),v=[e,t,i,u,c,y,g,d,p,h];if(b&&function(e,t){var a=e[1],n=t[1],i=a|n,s=i<131,u=n==o&&8==a||n==o&&a==l&&e[7].length<=t[8]||384==n&&t[7].length<=t[8]&&8==a;if(!s&&!u)return e;1&n&&(e[2]=t[2],i|=1&a?0:4);var c=t[3];if(c){var d=e[3];e[3]=d?Ti(d,c,t[4]):c,e[4]=d?oa(e[3],r):t[4]}(c=t[5])&&(d=e[5],e[5]=d?Mi(d,c,t[6]):c,e[6]=d?oa(e[5],r):t[6]),(c=t[7])&&(e[7]=c),n&o&&(e[8]=null==e[8]?t[8]:ga(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(v,b),e=v[0],t=v[1],i=v[2],u=v[3],c=v[4],!(h=v[9]=v[9]===a?f?0:e.length:ya(v[9]-m,0))&&24&t&&(t&=-25),t&&1!=t)_=8==t||16==t?function(e,t,n){var i=Li(e);return function r(){for(var s=arguments.length,o=ie(s),l=s,u=sr(r);l--;)o[l]=arguments[l];var c=s<3&&o[0]!==u&&o[s-1]!==u?[]:oa(o,u);return(s-=c.length)<n?Hi(e,t,Oi,r.placeholder,a,o,c,a,a,n-s):St(this&&this!==pt&&this instanceof r?i:e,this,o)}}(e,t,h):t!=s&&33!=t||c.length?Oi.apply(a,v):function(e,t,a,n){var i=1&t,r=Li(e);return function t(){for(var s=-1,o=arguments.length,l=-1,u=n.length,c=ie(u+o),d=this&&this!==pt&&this instanceof t?r:e;++l<u;)c[l]=n[l];for(;o--;)c[l++]=arguments[++s];return St(d,i?a:this,c)}}(e,t,i,u);else var _=function(e,t,a){var n=1&t,i=Li(e);return function t(){return(this&&this!==pt&&this instanceof t?i:e).apply(n?a:this,arguments)}}(e,t,i);return Vr((b?Qn:xr)(_,v),e,t)}function Ki(e,t,n,i){return e===a||Bs(e,Ve[n])&&!De.call(i,n)?t:e}function Xi(e,t,n,i,r,s){return Xs(e)&&Xs(t)&&(s.set(t,e),Un(e,t,a,Xi,s),s.delete(t)),e}function Qi(e){return ao(e)?a:e}function er(e,t,n,i,r,s){var o=1&n,l=e.length,u=t.length;if(l!=u&&!(o&&u>l))return!1;var c=s.get(e),d=s.get(t);if(c&&d)return c==t&&d==e;var p=-1,h=!0,f=2&n?new Ha:a;for(s.set(e,t),s.set(t,e);++p<l;){var m=e[p],y=t[p];if(i)var g=o?i(y,m,p,t,e,s):i(m,y,p,e,t,s);if(g!==a){if(g)continue;h=!1;break}if(f){if(!Lt(t,(function(e,t){if(!Xt(f,t)&&(m===e||r(m,e,n,i,s)))return f.push(t)}))){h=!1;break}}else if(m!==y&&!r(m,y,n,i,s)){h=!1;break}}return s.delete(e),s.delete(t),h}function tr(e){return Ir(Nr(e,a,zr),e+"")}function ar(e){return kn(e,Io,dr)}function nr(e){return kn(e,Vo,pr)}var ir=xa?function(e){return xa.get(e)}:ol;function rr(e){for(var t=e.name+"",a=Ca[t],n=De.call(Ca,t)?a.length:0;n--;){var i=a[n],r=i.func;if(null==r||r==e)return i.name}return t}function sr(e){return(De.call(Ba,"placeholder")?Ba:e).placeholder}function or(){var e=Ba.iteratee||nl;return e=e===nl?Dn:e,arguments.length?e(arguments[0],arguments[1]):e}function lr(e,t){var a,n,i=e.__data__;return("string"==(n=typeof(a=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==a:null===a)?i["string"==typeof t?"string":"hash"]:i.map}function ur(e){for(var t=Io(e),a=t.length;a--;){var n=t[a],i=e[n];t[a]=[n,i,kr(i)]}return t}function cr(e,t){var n=function(e,t){return null==e?a:e[t]}(e,t);return Fn(n)?n:a}var dr=yt?function(e){return null==e?[]:(e=Ne(e),Ct(yt(e),(function(t){return Ge.call(e,t)})))}:fl,pr=yt?function(e){for(var t=[];e;)Ft(t,dr(e)),e=Ye(e);return t}:fl,hr=Sn;function fr(e,t,a){for(var n=-1,i=(t=bi(t,e)).length,r=!1;++n<i;){var s=Rr(t[n]);if(!(r=null!=e&&a(e,s)))break;e=e[s]}return r||++n!=i?r:!!(i=null==e?0:e.length)&&Ks(i)&&gr(s,i)&&(js(e)||Us(e))}function mr(e){return"function"!=typeof e.constructor||Ar(e)?{}:Oa(Ye(e))}function yr(e){return js(e)||Us(e)||!!(Ze&&e&&e[Ze])}function gr(e,t){var a=typeof e;return!!(t=null==t?c:t)&&("number"==a||"symbol"!=a&&ge.test(e))&&e>-1&&e%1==0&&e<t}function br(e,t,a){if(!Xs(a))return!1;var n=typeof t;return!!("number"==n?Ws(a)&&gr(t,a.length):"string"==n&&t in a)&&Bs(a[t],e)}function vr(e,t){if(js(e))return!1;var a=typeof e;return!("number"!=a&&"symbol"!=a&&"boolean"!=a&&null!=e&&!so(e))||Q.test(e)||!X.test(e)||null!=t&&e in Ne(t)}function _r(e){var t=rr(e),a=Ba[t];if("function"!=typeof a||!(t in ja.prototype))return!1;if(e===a)return!0;var n=ir(a);return!!n&&e===n[0]}(Aa&&hr(new Aa(new ArrayBuffer(1)))!=E||ka&&hr(new ka)!=w||Sa&&hr(Sa.resolve())!=S||Na&&hr(new Na)!=T||Ta&&hr(new Ta)!=C)&&(hr=function(e){var t=Sn(e),n=t==k?e.constructor:a,i=n?Lr(n):"";if(i)switch(i){case Ia:return E;case Va:return w;case Ea:return S;case Fa:return T;case Da:return C}return t});var wr=Ee?Zs:ml;function Ar(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ve)}function kr(e){return e==e&&!Xs(e)}function Sr(e,t){return function(n){return null!=n&&n[e]===t&&(t!==a||e in Ne(n))}}function Nr(e,t,n){return t=ya(t===a?e.length-1:t,0),function(){for(var a=arguments,i=-1,r=ya(a.length-t,0),s=ie(r);++i<r;)s[i]=a[t+i];i=-1;for(var o=ie(t+1);++i<t;)o[i]=a[i];return o[t]=n(s),St(e,this,o)}}function Tr(e,t){return t.length<2?e:An(e,ai(t,0,-1))}function Mr(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var xr=Er(Qn),Cr=dt||function(e,t){return pt.setTimeout(e,t)},Ir=Er(ei);function Vr(e,t,a){var n=t+"";return Ir(e,function(e,t){var a=t.length;if(!a)return e;var n=a-1;return t[n]=(a>1?"& ":"")+t[n],t=t.join(a>2?", ":" "),e.replace(re,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return Tt(h,(function(a){var n="_."+a[0];t&a[1]&&!It(e,n)&&e.push(n)})),e.sort()}(function(e){var t=e.match(se);return t?t[1].split(oe):[]}(n),a)))}function Er(e){var t=0,n=0;return function(){var i=ba(),r=16-(i-n);if(n=i,r>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(a,arguments)}}function Fr(e,t){var n=-1,i=e.length,r=i-1;for(t=t===a?i:t;++n<t;){var s=Gn(n,r),o=e[s];e[s]=e[n],e[n]=o}return e.length=t,e}var Dr=function(e){var t=Es(e,(function(e){return 500===a.size&&a.clear(),e})),a=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ee,(function(e,a,n,i){t.push(n?i.replace(ce,"$1"):a||e)})),t}));function Rr(e){if("string"==typeof e||so(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Lr(e){if(null!=e){try{return Fe.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Pr(e){if(e instanceof ja)return e.clone();var t=new Ua(e.__wrapped__,e.__chain__);return t.__actions__=xi(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Br=Zn((function(e,t){return Ys(e)?cn(e,yn(t,1,Ys,!0)):[]})),Or=Zn((function(e,t){var n=qr(t);return Ys(n)&&(n=a),Ys(e)?cn(e,yn(t,1,Ys,!0),or(n,2)):[]})),$r=Zn((function(e,t){var n=qr(t);return Ys(n)&&(n=a),Ys(e)?cn(e,yn(t,1,Ys,!0),a,n):[]}));function Ur(e,t,a){var n=null==e?0:e.length;if(!n)return-1;var i=null==a?0:ho(a);return i<0&&(i=ya(n+i,0)),Ot(e,or(t,3),i)}function jr(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var r=i-1;return n!==a&&(r=ho(n),r=n<0?ya(i+r,0):ga(r,i-1)),Ot(e,or(t,3),r,!0)}function zr(e){return null!=e&&e.length?yn(e,1):[]}function Wr(e){return e&&e.length?e[0]:a}var Yr=Zn((function(e){var t=Et(e,yi);return t.length&&t[0]===e[0]?xn(t):[]})),Hr=Zn((function(e){var t=qr(e),n=Et(e,yi);return t===qr(n)?t=a:n.pop(),n.length&&n[0]===e[0]?xn(n,or(t,2)):[]})),Gr=Zn((function(e){var t=qr(e),n=Et(e,yi);return(t="function"==typeof t?t:a)&&n.pop(),n.length&&n[0]===e[0]?xn(n,a,t):[]}));function qr(e){var t=null==e?0:e.length;return t?e[t-1]:a}var Zr=Zn(Jr);function Jr(e,t){return e&&e.length&&t&&t.length?Yn(e,t):e}var Kr=tr((function(e,t){var a=null==e?0:e.length,n=rn(e,t);return Hn(e,Et(t,(function(e){return gr(e,a)?+e:e})).sort(Ni)),n}));function Xr(e){return null==e?e:wa.call(e)}var Qr=Zn((function(e){return ui(yn(e,1,Ys,!0))})),es=Zn((function(e){var t=qr(e);return Ys(t)&&(t=a),ui(yn(e,1,Ys,!0),or(t,2))})),ts=Zn((function(e){var t=qr(e);return t="function"==typeof t?t:a,ui(yn(e,1,Ys,!0),a,t)}));function as(e){if(!e||!e.length)return[];var t=0;return e=Ct(e,(function(e){if(Ys(e))return t=ya(e.length,t),!0})),qt(t,(function(t){return Et(e,Wt(t))}))}function ns(e,t){if(!e||!e.length)return[];var n=as(e);return null==t?n:Et(n,(function(e){return St(t,a,e)}))}var is=Zn((function(e,t){return Ys(e)?cn(e,t):[]})),rs=Zn((function(e){return fi(Ct(e,Ys))})),ss=Zn((function(e){var t=qr(e);return Ys(t)&&(t=a),fi(Ct(e,Ys),or(t,2))})),os=Zn((function(e){var t=qr(e);return t="function"==typeof t?t:a,fi(Ct(e,Ys),a,t)})),ls=Zn(as),us=Zn((function(e){var t=e.length,n=t>1?e[t-1]:a;return n="function"==typeof n?(e.pop(),n):a,ns(e,n)}));function cs(e){var t=Ba(e);return t.__chain__=!0,t}function ds(e,t){return t(e)}var ps=tr((function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,r=function(t){return rn(t,e)};return!(t>1||this.__actions__.length)&&i instanceof ja&&gr(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:ds,args:[r],thisArg:a}),new Ua(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(a),e}))):this.thru(r)})),hs=Ii((function(e,t,a){De.call(e,a)?++e[a]:nn(e,a,1)})),fs=Pi(Ur),ms=Pi(jr);function ys(e,t){return(js(e)?Tt:dn)(e,or(t,3))}function gs(e,t){return(js(e)?Mt:pn)(e,or(t,3))}var bs=Ii((function(e,t,a){De.call(e,a)?e[a].push(t):nn(e,a,[t])})),vs=Zn((function(e,t,a){var n=-1,i="function"==typeof t,r=Ws(e)?ie(e.length):[];return dn(e,(function(e){r[++n]=i?St(t,e,a):Cn(e,t,a)})),r})),_s=Ii((function(e,t,a){nn(e,a,t)}));function ws(e,t){return(js(e)?Et:Bn)(e,or(t,3))}var As=Ii((function(e,t,a){e[a?0:1].push(t)}),(function(){return[[],[]]})),ks=Zn((function(e,t){if(null==e)return[];var a=t.length;return a>1&&br(e,t[0],t[1])?t=[]:a>2&&br(t[0],t[1],t[2])&&(t=[t[0]]),zn(e,yn(t,1),[])})),Ss=ct||function(){return pt.Date.now()};function Ns(e,t,n){return t=n?a:t,t=e&&null==t?e.length:t,Ji(e,o,a,a,a,a,t)}function Ts(e,t){var i;if("function"!=typeof t)throw new xe(n);return e=ho(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=a),i}}var Ms=Zn((function(e,t,a){var n=1;if(a.length){var i=oa(a,sr(Ms));n|=s}return Ji(e,n,t,a,i)})),xs=Zn((function(e,t,a){var n=3;if(a.length){var i=oa(a,sr(xs));n|=s}return Ji(t,n,e,a,i)}));function Cs(e,t,i){var r,s,o,l,u,c,d=0,p=!1,h=!1,f=!0;if("function"!=typeof e)throw new xe(n);function m(t){var n=r,i=s;return r=s=a,d=t,l=e.apply(i,n)}function y(e){var n=e-c;return c===a||n>=t||n<0||h&&e-d>=o}function g(){var e=Ss();if(y(e))return b(e);u=Cr(g,function(e){var a=t-(e-c);return h?ga(a,o-(e-d)):a}(e))}function b(e){return u=a,f&&r?m(e):(r=s=a,l)}function v(){var e=Ss(),n=y(e);if(r=arguments,s=this,c=e,n){if(u===a)return function(e){return d=e,u=Cr(g,t),p?m(e):l}(c);if(h)return wi(u),u=Cr(g,t),m(c)}return u===a&&(u=Cr(g,t)),l}return t=mo(t)||0,Xs(i)&&(p=!!i.leading,o=(h="maxWait"in i)?ya(mo(i.maxWait)||0,t):o,f="trailing"in i?!!i.trailing:f),v.cancel=function(){u!==a&&wi(u),d=0,r=c=s=u=a},v.flush=function(){return u===a?l:b(Ss())},v}var Is=Zn((function(e,t){return un(e,1,t)})),Vs=Zn((function(e,t,a){return un(e,mo(t)||0,a)}));function Es(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(n);var a=function(){var n=arguments,i=t?t.apply(this,n):n[0],r=a.cache;if(r.has(i))return r.get(i);var s=e.apply(this,n);return a.cache=r.set(i,s)||r,s};return a.cache=new(Es.Cache||Ya),a}function Fs(e){if("function"!=typeof e)throw new xe(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Es.Cache=Ya;var Ds=vi((function(e,t){var a=(t=1==t.length&&js(t[0])?Et(t[0],Jt(or())):Et(yn(t,1),Jt(or()))).length;return Zn((function(n){for(var i=-1,r=ga(n.length,a);++i<r;)n[i]=t[i].call(this,n[i]);return St(e,this,n)}))})),Rs=Zn((function(e,t){var n=oa(t,sr(Rs));return Ji(e,s,a,t,n)})),Ls=Zn((function(e,t){var n=oa(t,sr(Ls));return Ji(e,64,a,t,n)})),Ps=tr((function(e,t){return Ji(e,l,a,a,a,t)}));function Bs(e,t){return e===t||e!=e&&t!=t}var Os=Yi(Nn),$s=Yi((function(e,t){return e>=t})),Us=In(function(){return arguments}())?In:function(e){return Qs(e)&&De.call(e,"callee")&&!Ge.call(e,"callee")},js=ie.isArray,zs=bt?Jt(bt):function(e){return Qs(e)&&Sn(e)==V};function Ws(e){return null!=e&&Ks(e.length)&&!Zs(e)}function Ys(e){return Qs(e)&&Ws(e)}var Hs=gt||ml,Gs=vt?Jt(vt):function(e){return Qs(e)&&Sn(e)==g};function qs(e){if(!Qs(e))return!1;var t=Sn(e);return t==b||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ao(e)}function Zs(e){if(!Xs(e))return!1;var t=Sn(e);return t==v||t==_||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Js(e){return"number"==typeof e&&e==ho(e)}function Ks(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function Xs(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Qs(e){return null!=e&&"object"==typeof e}var eo=_t?Jt(_t):function(e){return Qs(e)&&hr(e)==w};function to(e){return"number"==typeof e||Qs(e)&&Sn(e)==A}function ao(e){if(!Qs(e)||Sn(e)!=k)return!1;var t=Ye(e);if(null===t)return!0;var a=De.call(t,"constructor")&&t.constructor;return"function"==typeof a&&a instanceof a&&Fe.call(a)==Be}var no=wt?Jt(wt):function(e){return Qs(e)&&Sn(e)==N},io=At?Jt(At):function(e){return Qs(e)&&hr(e)==T};function ro(e){return"string"==typeof e||!js(e)&&Qs(e)&&Sn(e)==M}function so(e){return"symbol"==typeof e||Qs(e)&&Sn(e)==x}var oo=kt?Jt(kt):function(e){return Qs(e)&&Ks(e.length)&&!!rt[Sn(e)]},lo=Yi(Pn),uo=Yi((function(e,t){return e<=t}));function co(e){if(!e)return[];if(Ws(e))return ro(e)?da(e):xi(e);if(Je&&e[Je])return function(e){for(var t,a=[];!(t=e.next()).done;)a.push(t.value);return a}(e[Je]());var t=hr(e);return(t==w?ra:t==T?la:Oo)(e)}function po(e){return e?(e=mo(e))===u||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ho(e){var t=po(e),a=t%1;return t==t?a?t-a:t:0}function fo(e){return e?sn(ho(e),0,p):0}function mo(e){if("number"==typeof e)return e;if(so(e))return d;if(Xs(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Xs(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Zt(e);var a=fe.test(e);return a||ye.test(e)?ut(e.slice(2),a?2:8):he.test(e)?d:+e}function yo(e){return Ci(e,Vo(e))}function go(e){return null==e?"":li(e)}var bo=Vi((function(e,t){if(Ar(t)||Ws(t))Ci(t,Io(t),e);else for(var a in t)De.call(t,a)&&Qa(e,a,t[a])})),vo=Vi((function(e,t){Ci(t,Vo(t),e)})),_o=Vi((function(e,t,a,n){Ci(t,Vo(t),e,n)})),wo=Vi((function(e,t,a,n){Ci(t,Io(t),e,n)})),Ao=tr(rn),ko=Zn((function(e,t){e=Ne(e);var n=-1,i=t.length,r=i>2?t[2]:a;for(r&&br(t[0],t[1],r)&&(i=1);++n<i;)for(var s=t[n],o=Vo(s),l=-1,u=o.length;++l<u;){var c=o[l],d=e[c];(d===a||Bs(d,Ve[c])&&!De.call(e,c))&&(e[c]=s[c])}return e})),So=Zn((function(e){return e.push(a,Xi),St(Fo,a,e)}));function No(e,t,n){var i=null==e?a:An(e,t);return i===a?n:i}function To(e,t){return null!=e&&fr(e,t,Mn)}var Mo=$i((function(e,t,a){null!=t&&"function"!=typeof t.toString&&(t=Pe.call(t)),e[t]=a}),Qo(al)),xo=$i((function(e,t,a){null!=t&&"function"!=typeof t.toString&&(t=Pe.call(t)),De.call(e,t)?e[t].push(a):e[t]=[a]}),or),Co=Zn(Cn);function Io(e){return Ws(e)?qa(e):Rn(e)}function Vo(e){return Ws(e)?qa(e,!0):Ln(e)}var Eo=Vi((function(e,t,a){Un(e,t,a)})),Fo=Vi((function(e,t,a,n){Un(e,t,a,n)})),Do=tr((function(e,t){var a={};if(null==e)return a;var n=!1;t=Et(t,(function(t){return t=bi(t,e),n||(n=t.length>1),t})),Ci(e,nr(e),a),n&&(a=on(a,7,Qi));for(var i=t.length;i--;)ci(a,t[i]);return a})),Ro=tr((function(e,t){return null==e?{}:function(e,t){return Wn(e,t,(function(t,a){return To(e,a)}))}(e,t)}));function Lo(e,t){if(null==e)return{};var a=Et(nr(e),(function(e){return[e]}));return t=or(t),Wn(e,a,(function(e,a){return t(e,a[0])}))}var Po=Zi(Io),Bo=Zi(Vo);function Oo(e){return null==e?[]:Kt(e,Io(e))}var $o=Ri((function(e,t,a){return t=t.toLowerCase(),e+(a?Uo(t):t)}));function Uo(e){return Zo(go(e).toLowerCase())}function jo(e){return(e=go(e))&&e.replace(be,ta).replace(Xe,"")}var zo=Ri((function(e,t,a){return e+(a?"-":"")+t.toLowerCase()})),Wo=Ri((function(e,t,a){return e+(a?" ":"")+t.toLowerCase()})),Yo=Di("toLowerCase"),Ho=Ri((function(e,t,a){return e+(a?"_":"")+t.toLowerCase()})),Go=Ri((function(e,t,a){return e+(a?" ":"")+Zo(t)})),qo=Ri((function(e,t,a){return e+(a?" ":"")+t.toUpperCase()})),Zo=Di("toUpperCase");function Jo(e,t,n){return e=go(e),(t=n?a:t)===a?function(e){return at.test(e)}(e)?function(e){return e.match(et)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Ko=Zn((function(e,t){try{return St(e,a,t)}catch(e){return qs(e)?e:new Ae(e)}})),Xo=tr((function(e,t){return Tt(t,(function(t){t=Rr(t),nn(e,t,Ms(e[t],e))})),e}));function Qo(e){return function(){return e}}var el=Bi(),tl=Bi(!0);function al(e){return e}function nl(e){return Dn("function"==typeof e?e:on(e,1))}var il=Zn((function(e,t){return function(a){return Cn(a,e,t)}})),rl=Zn((function(e,t){return function(a){return Cn(e,a,t)}}));function sl(e,t,a){var n=Io(t),i=wn(t,n);null!=a||Xs(t)&&(i.length||!n.length)||(a=t,t=e,e=this,i=wn(t,Io(t)));var r=!(Xs(a)&&"chain"in a&&!a.chain),s=Zs(e);return Tt(i,(function(a){var n=t[a];e[a]=n,s&&(e.prototype[a]=function(){var t=this.__chain__;if(r||t){var a=e(this.__wrapped__);return(a.__actions__=xi(this.__actions__)).push({func:n,args:arguments,thisArg:e}),a.__chain__=t,a}return n.apply(e,Ft([this.value()],arguments))})})),e}function ol(){}var ll=ji(Et),ul=ji(xt),cl=ji(Lt);function dl(e){return vr(e)?Wt(Rr(e)):function(e){return function(t){return An(t,e)}}(e)}var pl=Wi(),hl=Wi(!0);function fl(){return[]}function ml(){return!1}var yl,gl=Ui((function(e,t){return e+t}),0),bl=Gi("ceil"),vl=Ui((function(e,t){return e/t}),1),_l=Gi("floor"),wl=Ui((function(e,t){return e*t}),1),Al=Gi("round"),kl=Ui((function(e,t){return e-t}),0);return Ba.after=function(e,t){if("function"!=typeof t)throw new xe(n);return e=ho(e),function(){if(--e<1)return t.apply(this,arguments)}},Ba.ary=Ns,Ba.assign=bo,Ba.assignIn=vo,Ba.assignInWith=_o,Ba.assignWith=wo,Ba.at=Ao,Ba.before=Ts,Ba.bind=Ms,Ba.bindAll=Xo,Ba.bindKey=xs,Ba.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return js(e)?e:[e]},Ba.chain=cs,Ba.chunk=function(e,t,n){t=(n?br(e,t,n):t===a)?1:ya(ho(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var r=0,s=0,o=ie(ht(i/t));r<i;)o[s++]=ai(e,r,r+=t);return o},Ba.compact=function(e){for(var t=-1,a=null==e?0:e.length,n=0,i=[];++t<a;){var r=e[t];r&&(i[n++]=r)}return i},Ba.concat=function(){var e=arguments.length;if(!e)return[];for(var t=ie(e-1),a=arguments[0],n=e;n--;)t[n-1]=arguments[n];return Ft(js(a)?xi(a):[a],yn(t,1))},Ba.cond=function(e){var t=null==e?0:e.length,a=or();return e=t?Et(e,(function(e){if("function"!=typeof e[1])throw new xe(n);return[a(e[0]),e[1]]})):[],Zn((function(a){for(var n=-1;++n<t;){var i=e[n];if(St(i[0],this,a))return St(i[1],this,a)}}))},Ba.conforms=function(e){return function(e){var t=Io(e);return function(a){return ln(a,e,t)}}(on(e,1))},Ba.constant=Qo,Ba.countBy=hs,Ba.create=function(e,t){var a=Oa(e);return null==t?a:an(a,t)},Ba.curry=function e(t,n,i){var r=Ji(t,8,a,a,a,a,a,n=i?a:n);return r.placeholder=e.placeholder,r},Ba.curryRight=function e(t,n,i){var r=Ji(t,16,a,a,a,a,a,n=i?a:n);return r.placeholder=e.placeholder,r},Ba.debounce=Cs,Ba.defaults=ko,Ba.defaultsDeep=So,Ba.defer=Is,Ba.delay=Vs,Ba.difference=Br,Ba.differenceBy=Or,Ba.differenceWith=$r,Ba.drop=function(e,t,n){var i=null==e?0:e.length;return i?ai(e,(t=n||t===a?1:ho(t))<0?0:t,i):[]},Ba.dropRight=function(e,t,n){var i=null==e?0:e.length;return i?ai(e,0,(t=i-(t=n||t===a?1:ho(t)))<0?0:t):[]},Ba.dropRightWhile=function(e,t){return e&&e.length?pi(e,or(t,3),!0,!0):[]},Ba.dropWhile=function(e,t){return e&&e.length?pi(e,or(t,3),!0):[]},Ba.fill=function(e,t,n,i){var r=null==e?0:e.length;return r?(n&&"number"!=typeof n&&br(e,t,n)&&(n=0,i=r),function(e,t,n,i){var r=e.length;for((n=ho(n))<0&&(n=-n>r?0:r+n),(i=i===a||i>r?r:ho(i))<0&&(i+=r),i=n>i?0:fo(i);n<i;)e[n++]=t;return e}(e,t,n,i)):[]},Ba.filter=function(e,t){return(js(e)?Ct:mn)(e,or(t,3))},Ba.flatMap=function(e,t){return yn(ws(e,t),1)},Ba.flatMapDeep=function(e,t){return yn(ws(e,t),u)},Ba.flatMapDepth=function(e,t,n){return n=n===a?1:ho(n),yn(ws(e,t),n)},Ba.flatten=zr,Ba.flattenDeep=function(e){return null!=e&&e.length?yn(e,u):[]},Ba.flattenDepth=function(e,t){return null!=e&&e.length?yn(e,t=t===a?1:ho(t)):[]},Ba.flip=function(e){return Ji(e,512)},Ba.flow=el,Ba.flowRight=tl,Ba.fromPairs=function(e){for(var t=-1,a=null==e?0:e.length,n={};++t<a;){var i=e[t];n[i[0]]=i[1]}return n},Ba.functions=function(e){return null==e?[]:wn(e,Io(e))},Ba.functionsIn=function(e){return null==e?[]:wn(e,Vo(e))},Ba.groupBy=bs,Ba.initial=function(e){return null!=e&&e.length?ai(e,0,-1):[]},Ba.intersection=Yr,Ba.intersectionBy=Hr,Ba.intersectionWith=Gr,Ba.invert=Mo,Ba.invertBy=xo,Ba.invokeMap=vs,Ba.iteratee=nl,Ba.keyBy=_s,Ba.keys=Io,Ba.keysIn=Vo,Ba.map=ws,Ba.mapKeys=function(e,t){var a={};return t=or(t,3),vn(e,(function(e,n,i){nn(a,t(e,n,i),e)})),a},Ba.mapValues=function(e,t){var a={};return t=or(t,3),vn(e,(function(e,n,i){nn(a,n,t(e,n,i))})),a},Ba.matches=function(e){return On(on(e,1))},Ba.matchesProperty=function(e,t){return $n(e,on(t,1))},Ba.memoize=Es,Ba.merge=Eo,Ba.mergeWith=Fo,Ba.method=il,Ba.methodOf=rl,Ba.mixin=sl,Ba.negate=Fs,Ba.nthArg=function(e){return e=ho(e),Zn((function(t){return jn(t,e)}))},Ba.omit=Do,Ba.omitBy=function(e,t){return Lo(e,Fs(or(t)))},Ba.once=function(e){return Ts(2,e)},Ba.orderBy=function(e,t,n,i){return null==e?[]:(js(t)||(t=null==t?[]:[t]),js(n=i?a:n)||(n=null==n?[]:[n]),zn(e,t,n))},Ba.over=ll,Ba.overArgs=Ds,Ba.overEvery=ul,Ba.overSome=cl,Ba.partial=Rs,Ba.partialRight=Ls,Ba.partition=As,Ba.pick=Ro,Ba.pickBy=Lo,Ba.property=dl,Ba.propertyOf=function(e){return function(t){return null==e?a:An(e,t)}},Ba.pull=Zr,Ba.pullAll=Jr,Ba.pullAllBy=function(e,t,a){return e&&e.length&&t&&t.length?Yn(e,t,or(a,2)):e},Ba.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Yn(e,t,a,n):e},Ba.pullAt=Kr,Ba.range=pl,Ba.rangeRight=hl,Ba.rearg=Ps,Ba.reject=function(e,t){return(js(e)?Ct:mn)(e,Fs(or(t,3)))},Ba.remove=function(e,t){var a=[];if(!e||!e.length)return a;var n=-1,i=[],r=e.length;for(t=or(t,3);++n<r;){var s=e[n];t(s,n,e)&&(a.push(s),i.push(n))}return Hn(e,i),a},Ba.rest=function(e,t){if("function"!=typeof e)throw new xe(n);return Zn(e,t=t===a?t:ho(t))},Ba.reverse=Xr,Ba.sampleSize=function(e,t,n){return t=(n?br(e,t,n):t===a)?1:ho(t),(js(e)?Ja:Kn)(e,t)},Ba.set=function(e,t,a){return null==e?e:Xn(e,t,a)},Ba.setWith=function(e,t,n,i){return i="function"==typeof i?i:a,null==e?e:Xn(e,t,n,i)},Ba.shuffle=function(e){return(js(e)?Ka:ti)(e)},Ba.slice=function(e,t,n){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&br(e,t,n)?(t=0,n=i):(t=null==t?0:ho(t),n=n===a?i:ho(n)),ai(e,t,n)):[]},Ba.sortBy=ks,Ba.sortedUniq=function(e){return e&&e.length?si(e):[]},Ba.sortedUniqBy=function(e,t){return e&&e.length?si(e,or(t,2)):[]},Ba.split=function(e,t,n){return n&&"number"!=typeof n&&br(e,t,n)&&(t=n=a),(n=n===a?p:n>>>0)?(e=go(e))&&("string"==typeof t||null!=t&&!no(t))&&!(t=li(t))&&ia(e)?_i(da(e),0,n):e.split(t,n):[]},Ba.spread=function(e,t){if("function"!=typeof e)throw new xe(n);return t=null==t?0:ya(ho(t),0),Zn((function(a){var n=a[t],i=_i(a,0,t);return n&&Ft(i,n),St(e,this,i)}))},Ba.tail=function(e){var t=null==e?0:e.length;return t?ai(e,1,t):[]},Ba.take=function(e,t,n){return e&&e.length?ai(e,0,(t=n||t===a?1:ho(t))<0?0:t):[]},Ba.takeRight=function(e,t,n){var i=null==e?0:e.length;return i?ai(e,(t=i-(t=n||t===a?1:ho(t)))<0?0:t,i):[]},Ba.takeRightWhile=function(e,t){return e&&e.length?pi(e,or(t,3),!1,!0):[]},Ba.takeWhile=function(e,t){return e&&e.length?pi(e,or(t,3)):[]},Ba.tap=function(e,t){return t(e),e},Ba.throttle=function(e,t,a){var i=!0,r=!0;if("function"!=typeof e)throw new xe(n);return Xs(a)&&(i="leading"in a?!!a.leading:i,r="trailing"in a?!!a.trailing:r),Cs(e,t,{leading:i,maxWait:t,trailing:r})},Ba.thru=ds,Ba.toArray=co,Ba.toPairs=Po,Ba.toPairsIn=Bo,Ba.toPath=function(e){return js(e)?Et(e,Rr):so(e)?[e]:xi(Dr(go(e)))},Ba.toPlainObject=yo,Ba.transform=function(e,t,a){var n=js(e),i=n||Hs(e)||oo(e);if(t=or(t,4),null==a){var r=e&&e.constructor;a=i?n?new r:[]:Xs(e)&&Zs(r)?Oa(Ye(e)):{}}return(i?Tt:vn)(e,(function(e,n,i){return t(a,e,n,i)})),a},Ba.unary=function(e){return Ns(e,1)},Ba.union=Qr,Ba.unionBy=es,Ba.unionWith=ts,Ba.uniq=function(e){return e&&e.length?ui(e):[]},Ba.uniqBy=function(e,t){return e&&e.length?ui(e,or(t,2)):[]},Ba.uniqWith=function(e,t){return t="function"==typeof t?t:a,e&&e.length?ui(e,a,t):[]},Ba.unset=function(e,t){return null==e||ci(e,t)},Ba.unzip=as,Ba.unzipWith=ns,Ba.update=function(e,t,a){return null==e?e:di(e,t,gi(a))},Ba.updateWith=function(e,t,n,i){return i="function"==typeof i?i:a,null==e?e:di(e,t,gi(n),i)},Ba.values=Oo,Ba.valuesIn=function(e){return null==e?[]:Kt(e,Vo(e))},Ba.without=is,Ba.words=Jo,Ba.wrap=function(e,t){return Rs(gi(t),e)},Ba.xor=rs,Ba.xorBy=ss,Ba.xorWith=os,Ba.zip=ls,Ba.zipObject=function(e,t){return mi(e||[],t||[],Qa)},Ba.zipObjectDeep=function(e,t){return mi(e||[],t||[],Xn)},Ba.zipWith=us,Ba.entries=Po,Ba.entriesIn=Bo,Ba.extend=vo,Ba.extendWith=_o,sl(Ba,Ba),Ba.add=gl,Ba.attempt=Ko,Ba.camelCase=$o,Ba.capitalize=Uo,Ba.ceil=bl,Ba.clamp=function(e,t,n){return n===a&&(n=t,t=a),n!==a&&(n=(n=mo(n))==n?n:0),t!==a&&(t=(t=mo(t))==t?t:0),sn(mo(e),t,n)},Ba.clone=function(e){return on(e,4)},Ba.cloneDeep=function(e){return on(e,5)},Ba.cloneDeepWith=function(e,t){return on(e,5,t="function"==typeof t?t:a)},Ba.cloneWith=function(e,t){return on(e,4,t="function"==typeof t?t:a)},Ba.conformsTo=function(e,t){return null==t||ln(e,t,Io(t))},Ba.deburr=jo,Ba.defaultTo=function(e,t){return null==e||e!=e?t:e},Ba.divide=vl,Ba.endsWith=function(e,t,n){e=go(e),t=li(t);var i=e.length,r=n=n===a?i:sn(ho(n),0,i);return(n-=t.length)>=0&&e.slice(n,r)==t},Ba.eq=Bs,Ba.escape=function(e){return(e=go(e))&&q.test(e)?e.replace(H,aa):e},Ba.escapeRegExp=function(e){return(e=go(e))&&ae.test(e)?e.replace(te,"\\$&"):e},Ba.every=function(e,t,n){var i=js(e)?xt:hn;return n&&br(e,t,n)&&(t=a),i(e,or(t,3))},Ba.find=fs,Ba.findIndex=Ur,Ba.findKey=function(e,t){return Bt(e,or(t,3),vn)},Ba.findLast=ms,Ba.findLastIndex=jr,Ba.findLastKey=function(e,t){return Bt(e,or(t,3),_n)},Ba.floor=_l,Ba.forEach=ys,Ba.forEachRight=gs,Ba.forIn=function(e,t){return null==e?e:gn(e,or(t,3),Vo)},Ba.forInRight=function(e,t){return null==e?e:bn(e,or(t,3),Vo)},Ba.forOwn=function(e,t){return e&&vn(e,or(t,3))},Ba.forOwnRight=function(e,t){return e&&_n(e,or(t,3))},Ba.get=No,Ba.gt=Os,Ba.gte=$s,Ba.has=function(e,t){return null!=e&&fr(e,t,Tn)},Ba.hasIn=To,Ba.head=Wr,Ba.identity=al,Ba.includes=function(e,t,a,n){e=Ws(e)?e:Oo(e),a=a&&!n?ho(a):0;var i=e.length;return a<0&&(a=ya(i+a,0)),ro(e)?a<=i&&e.indexOf(t,a)>-1:!!i&&$t(e,t,a)>-1},Ba.indexOf=function(e,t,a){var n=null==e?0:e.length;if(!n)return-1;var i=null==a?0:ho(a);return i<0&&(i=ya(n+i,0)),$t(e,t,i)},Ba.inRange=function(e,t,n){return t=po(t),n===a?(n=t,t=0):n=po(n),function(e,t,a){return e>=ga(t,a)&&e<ya(t,a)}(e=mo(e),t,n)},Ba.invoke=Co,Ba.isArguments=Us,Ba.isArray=js,Ba.isArrayBuffer=zs,Ba.isArrayLike=Ws,Ba.isArrayLikeObject=Ys,Ba.isBoolean=function(e){return!0===e||!1===e||Qs(e)&&Sn(e)==y},Ba.isBuffer=Hs,Ba.isDate=Gs,Ba.isElement=function(e){return Qs(e)&&1===e.nodeType&&!ao(e)},Ba.isEmpty=function(e){if(null==e)return!0;if(Ws(e)&&(js(e)||"string"==typeof e||"function"==typeof e.splice||Hs(e)||oo(e)||Us(e)))return!e.length;var t=hr(e);if(t==w||t==T)return!e.size;if(Ar(e))return!Rn(e).length;for(var a in e)if(De.call(e,a))return!1;return!0},Ba.isEqual=function(e,t){return Vn(e,t)},Ba.isEqualWith=function(e,t,n){var i=(n="function"==typeof n?n:a)?n(e,t):a;return i===a?Vn(e,t,a,n):!!i},Ba.isError=qs,Ba.isFinite=function(e){return"number"==typeof e&&Pt(e)},Ba.isFunction=Zs,Ba.isInteger=Js,Ba.isLength=Ks,Ba.isMap=eo,Ba.isMatch=function(e,t){return e===t||En(e,t,ur(t))},Ba.isMatchWith=function(e,t,n){return n="function"==typeof n?n:a,En(e,t,ur(t),n)},Ba.isNaN=function(e){return to(e)&&e!=+e},Ba.isNative=function(e){if(wr(e))throw new Ae("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Fn(e)},Ba.isNil=function(e){return null==e},Ba.isNull=function(e){return null===e},Ba.isNumber=to,Ba.isObject=Xs,Ba.isObjectLike=Qs,Ba.isPlainObject=ao,Ba.isRegExp=no,Ba.isSafeInteger=function(e){return Js(e)&&e>=-9007199254740991&&e<=c},Ba.isSet=io,Ba.isString=ro,Ba.isSymbol=so,Ba.isTypedArray=oo,Ba.isUndefined=function(e){return e===a},Ba.isWeakMap=function(e){return Qs(e)&&hr(e)==C},Ba.isWeakSet=function(e){return Qs(e)&&"[object WeakSet]"==Sn(e)},Ba.join=function(e,t){return null==e?"":Yt.call(e,t)},Ba.kebabCase=zo,Ba.last=qr,Ba.lastIndexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var r=i;return n!==a&&(r=(r=ho(n))<0?ya(i+r,0):ga(r,i-1)),t==t?function(e,t,a){for(var n=a+1;n--;)if(e[n]===t)return n;return n}(e,t,r):Ot(e,jt,r,!0)},Ba.lowerCase=Wo,Ba.lowerFirst=Yo,Ba.lt=lo,Ba.lte=uo,Ba.max=function(e){return e&&e.length?fn(e,al,Nn):a},Ba.maxBy=function(e,t){return e&&e.length?fn(e,or(t,2),Nn):a},Ba.mean=function(e){return zt(e,al)},Ba.meanBy=function(e,t){return zt(e,or(t,2))},Ba.min=function(e){return e&&e.length?fn(e,al,Pn):a},Ba.minBy=function(e,t){return e&&e.length?fn(e,or(t,2),Pn):a},Ba.stubArray=fl,Ba.stubFalse=ml,Ba.stubObject=function(){return{}},Ba.stubString=function(){return""},Ba.stubTrue=function(){return!0},Ba.multiply=wl,Ba.nth=function(e,t){return e&&e.length?jn(e,ho(t)):a},Ba.noConflict=function(){return pt._===this&&(pt._=Oe),this},Ba.noop=ol,Ba.now=Ss,Ba.pad=function(e,t,a){e=go(e);var n=(t=ho(t))?ca(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return zi(ft(i),a)+e+zi(ht(i),a)},Ba.padEnd=function(e,t,a){e=go(e);var n=(t=ho(t))?ca(e):0;return t&&n<t?e+zi(t-n,a):e},Ba.padStart=function(e,t,a){e=go(e);var n=(t=ho(t))?ca(e):0;return t&&n<t?zi(t-n,a)+e:e},Ba.parseInt=function(e,t,a){return a||null==t?t=0:t&&(t=+t),va(go(e).replace(ne,""),t||0)},Ba.random=function(e,t,n){if(n&&"boolean"!=typeof n&&br(e,t,n)&&(t=n=a),n===a&&("boolean"==typeof t?(n=t,t=a):"boolean"==typeof e&&(n=e,e=a)),e===a&&t===a?(e=0,t=1):(e=po(e),t===a?(t=e,e=0):t=po(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var r=_a();return ga(e+r*(t-e+lt("1e-"+((r+"").length-1))),t)}return Gn(e,t)},Ba.reduce=function(e,t,a){var n=js(e)?Dt:Ht,i=arguments.length<3;return n(e,or(t,4),a,i,dn)},Ba.reduceRight=function(e,t,a){var n=js(e)?Rt:Ht,i=arguments.length<3;return n(e,or(t,4),a,i,pn)},Ba.repeat=function(e,t,n){return t=(n?br(e,t,n):t===a)?1:ho(t),qn(go(e),t)},Ba.replace=function(){var e=arguments,t=go(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ba.result=function(e,t,n){var i=-1,r=(t=bi(t,e)).length;for(r||(r=1,e=a);++i<r;){var s=null==e?a:e[Rr(t[i])];s===a&&(i=r,s=n),e=Zs(s)?s.call(e):s}return e},Ba.round=Al,Ba.runInContext=e,Ba.sample=function(e){return(js(e)?Za:Jn)(e)},Ba.size=function(e){if(null==e)return 0;if(Ws(e))return ro(e)?ca(e):e.length;var t=hr(e);return t==w||t==T?e.size:Rn(e).length},Ba.snakeCase=Ho,Ba.some=function(e,t,n){var i=js(e)?Lt:ni;return n&&br(e,t,n)&&(t=a),i(e,or(t,3))},Ba.sortedIndex=function(e,t){return ii(e,t)},Ba.sortedIndexBy=function(e,t,a){return ri(e,t,or(a,2))},Ba.sortedIndexOf=function(e,t){var a=null==e?0:e.length;if(a){var n=ii(e,t);if(n<a&&Bs(e[n],t))return n}return-1},Ba.sortedLastIndex=function(e,t){return ii(e,t,!0)},Ba.sortedLastIndexBy=function(e,t,a){return ri(e,t,or(a,2),!0)},Ba.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var a=ii(e,t,!0)-1;if(Bs(e[a],t))return a}return-1},Ba.startCase=Go,Ba.startsWith=function(e,t,a){return e=go(e),a=null==a?0:sn(ho(a),0,e.length),t=li(t),e.slice(a,a+t.length)==t},Ba.subtract=kl,Ba.sum=function(e){return e&&e.length?Gt(e,al):0},Ba.sumBy=function(e,t){return e&&e.length?Gt(e,or(t,2)):0},Ba.template=function(e,t,n){var i=Ba.templateSettings;n&&br(e,t,n)&&(t=a),e=go(e),t=_o({},t,i,Ki);var r,s,o=_o({},t.imports,i.imports,Ki),l=Io(o),u=Kt(o,l),c=0,d=t.interpolate||ve,p="__p += '",h=Te((t.escape||ve).source+"|"+d.source+"|"+(d===K?de:ve).source+"|"+(t.evaluate||ve).source+"|$","g"),f="//# sourceURL="+(De.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++it+"]")+"\n";e.replace(h,(function(t,a,n,i,o,l){return n||(n=i),p+=e.slice(c,l).replace(_e,na),a&&(r=!0,p+="' +\n__e("+a+") +\n'"),o&&(s=!0,p+="';\n"+o+";\n__p += '"),n&&(p+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),c=l+t.length,t})),p+="';\n";var m=De.call(t,"variable")&&t.variable;if(m){if(ue.test(m))throw new Ae("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(s?p.replace(j,""):p).replace(z,"$1").replace(W,"$1;"),p="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(r?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var y=Ko((function(){return ke(l,f+"return "+p).apply(a,u)}));if(y.source=p,qs(y))throw y;return y},Ba.times=function(e,t){if((e=ho(e))<1||e>c)return[];var a=p,n=ga(e,p);t=or(t),e-=p;for(var i=qt(n,t);++a<e;)t(a);return i},Ba.toFinite=po,Ba.toInteger=ho,Ba.toLength=fo,Ba.toLower=function(e){return go(e).toLowerCase()},Ba.toNumber=mo,Ba.toSafeInteger=function(e){return e?sn(ho(e),-9007199254740991,c):0===e?e:0},Ba.toString=go,Ba.toUpper=function(e){return go(e).toUpperCase()},Ba.trim=function(e,t,n){if((e=go(e))&&(n||t===a))return Zt(e);if(!e||!(t=li(t)))return e;var i=da(e),r=da(t);return _i(i,Qt(i,r),ea(i,r)+1).join("")},Ba.trimEnd=function(e,t,n){if((e=go(e))&&(n||t===a))return e.slice(0,pa(e)+1);if(!e||!(t=li(t)))return e;var i=da(e);return _i(i,0,ea(i,da(t))+1).join("")},Ba.trimStart=function(e,t,n){if((e=go(e))&&(n||t===a))return e.replace(ne,"");if(!e||!(t=li(t)))return e;var i=da(e);return _i(i,Qt(i,da(t))).join("")},Ba.truncate=function(e,t){var n=30,i="...";if(Xs(t)){var r="separator"in t?t.separator:r;n="length"in t?ho(t.length):n,i="omission"in t?li(t.omission):i}var s=(e=go(e)).length;if(ia(e)){var o=da(e);s=o.length}if(n>=s)return e;var l=n-ca(i);if(l<1)return i;var u=o?_i(o,0,l).join(""):e.slice(0,l);if(r===a)return u+i;if(o&&(l+=u.length-l),no(r)){if(e.slice(l).search(r)){var c,d=u;for(r.global||(r=Te(r.source,go(pe.exec(r))+"g")),r.lastIndex=0;c=r.exec(d);)var p=c.index;u=u.slice(0,p===a?l:p)}}else if(e.indexOf(li(r),l)!=l){var h=u.lastIndexOf(r);h>-1&&(u=u.slice(0,h))}return u+i},Ba.unescape=function(e){return(e=go(e))&&G.test(e)?e.replace(Y,ha):e},Ba.uniqueId=function(e){var t=++Re;return go(e)+t},Ba.upperCase=qo,Ba.upperFirst=Zo,Ba.each=ys,Ba.eachRight=gs,Ba.first=Wr,sl(Ba,(yl={},vn(Ba,(function(e,t){De.call(Ba.prototype,t)||(yl[t]=e)})),yl),{chain:!1}),Ba.VERSION="4.17.21",Tt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ba[e].placeholder=Ba})),Tt(["drop","take"],(function(e,t){ja.prototype[e]=function(n){n=n===a?1:ya(ho(n),0);var i=this.__filtered__&&!t?new ja(this):this.clone();return i.__filtered__?i.__takeCount__=ga(n,i.__takeCount__):i.__views__.push({size:ga(n,p),type:e+(i.__dir__<0?"Right":"")}),i},ja.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Tt(["filter","map","takeWhile"],(function(e,t){var a=t+1,n=1==a||3==a;ja.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:or(e,3),type:a}),t.__filtered__=t.__filtered__||n,t}})),Tt(["head","last"],(function(e,t){var a="take"+(t?"Right":"");ja.prototype[e]=function(){return this[a](1).value()[0]}})),Tt(["initial","tail"],(function(e,t){var a="drop"+(t?"":"Right");ja.prototype[e]=function(){return this.__filtered__?new ja(this):this[a](1)}})),ja.prototype.compact=function(){return this.filter(al)},ja.prototype.find=function(e){return this.filter(e).head()},ja.prototype.findLast=function(e){return this.reverse().find(e)},ja.prototype.invokeMap=Zn((function(e,t){return"function"==typeof e?new ja(this):this.map((function(a){return Cn(a,e,t)}))})),ja.prototype.reject=function(e){return this.filter(Fs(or(e)))},ja.prototype.slice=function(e,t){e=ho(e);var n=this;return n.__filtered__&&(e>0||t<0)?new ja(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==a&&(n=(t=ho(t))<0?n.dropRight(-t):n.take(t-e)),n)},ja.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},ja.prototype.toArray=function(){return this.take(p)},vn(ja.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),r=Ba[i?"take"+("last"==t?"Right":""):t],s=i||/^find/.test(t);r&&(Ba.prototype[t]=function(){var t=this.__wrapped__,o=i?[1]:arguments,l=t instanceof ja,u=o[0],c=l||js(t),d=function(e){var t=r.apply(Ba,Ft([e],o));return i&&p?t[0]:t};c&&n&&"function"==typeof u&&1!=u.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,f=s&&!p,m=l&&!h;if(!s&&c){t=m?t:new ja(this);var y=e.apply(t,o);return y.__actions__.push({func:ds,args:[d],thisArg:a}),new Ua(y,p)}return f&&m?e.apply(this,o):(y=this.thru(d),f?i?y.value()[0]:y.value():y)})})),Tt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ce[e],a=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Ba.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(js(i)?i:[],e)}return this[a]((function(a){return t.apply(js(a)?a:[],e)}))}})),vn(ja.prototype,(function(e,t){var a=Ba[t];if(a){var n=a.name+"";De.call(Ca,n)||(Ca[n]=[]),Ca[n].push({name:t,func:a})}})),Ca[Oi(a,2).name]=[{name:"wrapper",func:a}],ja.prototype.clone=function(){var e=new ja(this.__wrapped__);return e.__actions__=xi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=xi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=xi(this.__views__),e},ja.prototype.reverse=function(){if(this.__filtered__){var e=new ja(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},ja.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,a=js(e),n=t<0,i=a?e.length:0,r=function(e,t,a){for(var n=-1,i=a.length;++n<i;){var r=a[n],s=r.size;switch(r.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=ga(t,e+s);break;case"takeRight":e=ya(e,t-s)}}return{start:e,end:t}}(0,i,this.__views__),s=r.start,o=r.end,l=o-s,u=n?o:s-1,c=this.__iteratees__,d=c.length,p=0,h=ga(l,this.__takeCount__);if(!a||!n&&i==l&&h==l)return hi(e,this.__actions__);var f=[];e:for(;l--&&p<h;){for(var m=-1,y=e[u+=t];++m<d;){var g=c[m],b=g.iteratee,v=g.type,_=b(y);if(2==v)y=_;else if(!_){if(1==v)continue e;break e}}f[p++]=y}return f},Ba.prototype.at=ps,Ba.prototype.chain=function(){return cs(this)},Ba.prototype.commit=function(){return new Ua(this.value(),this.__chain__)},Ba.prototype.next=function(){this.__values__===a&&(this.__values__=co(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?a:this.__values__[this.__index__++]}},Ba.prototype.plant=function(e){for(var t,n=this;n instanceof $a;){var i=Pr(n);i.__index__=0,i.__values__=a,t?r.__wrapped__=i:t=i;var r=i;n=n.__wrapped__}return r.__wrapped__=e,t},Ba.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof ja){var t=e;return this.__actions__.length&&(t=new ja(this)),(t=t.reverse()).__actions__.push({func:ds,args:[Xr],thisArg:a}),new Ua(t,this.__chain__)}return this.thru(Xr)},Ba.prototype.toJSON=Ba.prototype.valueOf=Ba.prototype.value=function(){return hi(this.__wrapped__,this.__actions__)},Ba.prototype.first=Ba.prototype.head,Je&&(Ba.prototype[Je]=function(){return this}),Ba}();ft?((ft.exports=fa)._=fa,ht._=fa):pt._=fa}).call(G)}(H,H.exports)),H.exports);class Z extends ${name="";displayName="";type=void 0;info;preload=!0;loadingManagerRule="load";item;itemRepo;condition;conditionFields=[];conditionFieldNames=[];dependantFields=[];dependenciesInitialized=!1;linkableTypes=[];collapsed=!1;presets=[];datatype=null;defaultValue=null;minValue=null;maxValue=null;language=null;widget=null;length=null;labelType=null;blocks=[];connections=[];_id="";_internalValue;_internalOptions=[];_updateConditions=!0;_hidden=!1;get hidden(){return!(!this.condition||!this.dependenciesInitialized)&&(this._updateConditions&&(this._hidden=!this._calculateConditionBlock(this.condition),this._updateConditions=!1),this._hidden)}get id(){return this._id}get options(){return this._internalOptions}set options(e){this._internalOptions=e,this.updateConditions()}get value(){return this._internalValue}set value(e){this._internalValue=e,this._processDependencies()}constructor(e,t=void 0,a=void 0,n=void 0,i=void 0,r=void 0){super(i),e instanceof O?(this._id=e.id,this.restoreFromSnapshot(e)):(h.assert(e,"Field has no name!"),h.assert(a,"Field has no type!"),this._id=h.createFieldID(),this.name=e,this.displayName=t||e,this.type=a,this._internalValue=n,this.item=i,this.itemRepo=r)}updateConditions(){this.condition&&this.dependenciesInitialized&&(this._updateConditions=!0,u.$emit("field:hiddenChanged",this.id))}getId(){return this.id}resetValue(){this.value=this.defaultValue}makeIdsUnique(e=new Map,t=!1){if(e.has(this._id)||t){const t=h.createFieldID();e.set(this._id,t),this._id=t}else e.set(this._id,this._id);for(const a of this.blocks)a.makeIdsUnique(e,t);return e}transformNodeIds(e){for(const t of this.blocks)t.transformNodeIds(e);"Attribute"===this.type&&"Node"===this.datatype&&this.value&&e.has(this.value)&&(this.value=e.get(this.value))}findBlock(e){for(const t of this.blocks){const a=t.findBlock(e);if(a)return a}return null}clone(e=void 0,t=!1){let a=new Z(this.name,this.displayName,this.type);void 0===this._internalValue?a._internalValue=void 0:null===this._internalValue?a._internalValue=null:"Link"===this.type?a._internalValue=this._internalValue:a._internalValue=q.cloneDeep(this._internalValue),a.info=this.info,a.preload=this.preload,a.loadingManagerRule=this.loadingManagerRule,a.item=this.item,a.ownerItem=this.ownerItem,a.itemRepo=this.itemRepo,a.condition=this.condition,a.conditionFields=this.conditionFields,a.conditionFieldNames=this.conditionFieldNames,a.dependantFields=this.dependantFields,a.collapsed=this.collapsed,a.presets=this.presets,a.labelType=this.labelType,a.datatype=this.datatype,a.defaultValue=this.defaultValue,a.minValue=this.minValue,a.maxValue=this.maxValue,a.options=this.options,a.language=this.language,a.widget=this.widget,a.length=this.length,a.linkableTypes=this.linkableTypes;for(const n of this.blocks){let i=n.clone(e,!0,{},t);e&&(i=g.instance.proxyBlock(i,e)),a.blocks.push(i)}for(const t of this.connections){let n=t.clone();e&&(n=g.instance.proxyConnection(n,e)),a.connections.push(n)}return a}_processDependencies(){for(const e of this.dependantFields)e.updateConditions()}_getConditionField(e){for(const t of this.conditionFields)if(t&&t.name===e)return t;return null}_calculateConditionField(e,t){if(!e.startsWith("$")){let a;e.includes(".")?(a=e.split("."),e=a.splice(0,1)[0]):a=[];let n=e.endsWith("?");n&&(e=e.substring(0,e.length-1));const i=this._getConditionField(e);if(!i)return n||console.error("Field to resolve condition not found: "+e),!1;let r=i.value;for(let t=0;t<a.length;t++){if(!r)return console.error(`Field path ${a.join(".")} not found in field ${e}!`),!1;r=r[a[t]]}return"object"==typeof t?void 0!==t.$isset?t.$isset===!!r:void 0!==t.$not?t.$not!==r:(console.error("Condition value cannot be interpreted: ",t,this),!1):i.value==t}switch(e){case"$isroot":return this.item._id===this.itemRepo.rootItemId===t;case"$parenttype":return console.log("$parenttype is not yet implemented!",this),!1;case"$optionsexist":return(Array.isArray(this.options)&&this.options.length>0)===t;case"$featureenabled":return this.itemRepo.apiClient.isFeatureEnabled(t);default:return console.error("Computed value unknown: "+e,this),!1}}_calculateConditionBlock(e){for(const t in e)if(e.hasOwnProperty(t)){const a=e[t];if("$or"===t)if(Array.isArray(a)){let e=!1;for(const t of a)if(this._calculateConditionBlock(t)){e=!0;break}if(!e)return!1}else console.error("Condition contains $or but its value is not an array!");else if("$not"===t){if("object"!=typeof a)console.error("When using the $not operator, the value needs to be an object");else if(this._calculateConditionBlock(a))return!1}else if(!this._calculateConditionField(t,a))return!1}return!0}refreshFieldDependencies(){for(const e of this.blocks)e.refreshFieldDependencies()}refreshDependantFields(e,t){const a=[];if(this.condition)for(let t of this.conditionFieldNames){const n=t.endsWith("?");n&&(t=t.substring(0,t.length-1));const i=e.get(t);i?a.push(i):n||console.warn("Condition field not found: "+t)}this.conditionFields=a,this.dependantFields=t||[],this.dependenciesInitialized=!0}setCondition(e){e?"object"==typeof e?this.condition=e:(console.error("Condition must be an object if set",e),this.condition=null):this.condition=null,this.conditionFieldNames=[],this.condition&&this._scanConditions(this.condition)}_scanConditions(e){for(let t in e)if(e.hasOwnProperty(t)){const a=e[t];if(Array.isArray(a))for(const e of a)this._scanConditions(e);else t.startsWith("$")||(t.includes(".")&&(t=t.split(".")[0]),this.conditionFieldNames.includes(t)||this.conditionFieldNames.push(t))}}forEachField(e){if(e(this),this.blocks)for(const t of this.blocks)t.forEachField(e)}setInfo(e){this.info=e}setPreload(e){this.preload=e}setLoadingManagerRule(e){this.loadingManagerRule=e}setLinkableTypes(e){this.linkableTypes=e}setDefaultValue(e){this.defaultValue=e,void 0!==this._internalValue&&null!==this._internalValue||(this._internalValue=e)}setMinValue(e){this.minValue=e}setMaxValue(e){this.maxValue=e}setOptions(e){this.options=e}setDatatype(e){this.datatype=e}setLanguage(e){this.language=e}setLength(e){this.length=e}setWidget(e){this.widget=e}setBlocks(e){this.blocks=e}setConnections(e){this.connections=e}setCollapsed(e){this.collapsed=!!e}setPresets(e){this.presets=e||[]}setLabelType(e){this.labelType=e||"info"}createSnapshot(e=!1){h.assert(this.id,"Field has no ID. Cannot create snapshot");const t=[];for(const a of this.blocks)t.push(a.createSnapshot(e));const a=[];for(const e of this.connections)a.push(e.createSnapshot());return new O(this.id,"field",{name:this.name,displayName:this.displayName,type:this.type,value:this._internalValue,preload:this.preload,info:this.info,loadingManagerRule:this.loadingManagerRule,item:this.item,itemRepo:this.itemRepo,condition:this.condition,conditionFields:this.conditionFields,conditionFieldNames:this.conditionFieldNames,dependantFields:this.dependantFields,linkableTypes:this.linkableTypes,collapsed:this.collapsed,presets:this.presets,datatype:this.datatype,defaultValue:this.defaultValue,minValue:this.minValue,maxValue:this.maxValue,options:this.options,language:this.language,widget:this.widget,length:this.length,labelType:this.labelType,blocks:t,connections:a})}restoreFromSnapshot(e){e.id===this.id?(this.name=e.data.name,this.displayName=e.data.displayName,this.type=e.data.type,this._internalValue=e.data.value,this.info=e.data.info,this.preload=e.data.preload,this.loadingManagerRule=e.data.loadingManagerRule,this.item=e.data.item,this.ownerItem=e.data.item,this.itemRepo=e.data.itemRepo,this.condition=e.data.condition,this.conditionFields=e.data.conditionFields,this.conditionFieldNames=e.data.conditionFieldNames,this.dependantFields=e.data.dependantFields,this.linkableTypes=e.data.linkableTypes,this.collapsed=e.data.collapsed,this.presets=e.data.presets,this.datatype=e.data.datatype,this.defaultValue=e.data.defaultValue,this.minValue=e.data.minValue,this.maxValue=e.data.maxValue,this.options=e.data.options,this.language=e.data.language,this.widget=e.data.widget,this.length=e.data.length,this.labelType=e.data.labelType,this.blocks=[],this.connections=[],this._rollbackArray(this.blocks,e.data.blocks,((e,t)=>g.instance.proxyBlock(new ae(e,t),this.ownerItem))),this._rollbackArray(this.connections,e.data.connections,((e,t)=>g.instance.proxyConnection(new U(e.data,t),this.ownerItem)))):console.error("Snapshot ID does not match! Cannot rollback!",this,e)}rollbackFromSnapshot(e){this.value=e.data.value,this._rollbackArray(this.blocks,e.data.blocks,((e,t)=>g.instance.proxyBlock(new ae(e,t),this.ownerItem))),this._rollbackArray(this.connections,e.data.connections,((e,t)=>g.instance.proxyConnection(new U(e.data,t),this.ownerItem)))}}class J extends ${id;name=void 0;displayName=void 0;value;type=void 0;datatype=void 0;linkableTypes=[];order=0;constructor(e=void 0,t=void 0,a=void 0){super(a),this.value=t,this.id=h.createItemOrBlockID(),this.name=e,this.displayName=e,this._updateDisplayName()}getId(){return this.id}setName(e){this.name=e,this._updateDisplayName()}setType(e){this.type=e}setOrder(e){this.order=e}clone(e=new Map){const t=new J;return t.ownerItem=this.ownerItem,t.value=e.get(this.value)??this.value,t.type=this.type,t.order=this.order,t.setName(this.name),t}clearDefinition(){this.type=void 0}setDefinition(e){const t=e.type.toLowerCase();switch(t){case"boolean":case"bool":this.type="Attribute",this.datatype="Boolean",this.value=void 0!==this.value?this._toBoolean(this.value):this._toBoolean(e.defaultValue);break;case"float":this.type="Attribute",this.datatype="Float",this.value=void 0!==this.value?Number(this.value):Number(e.defaultValue);break;case"int":this.type="Attribute",this.datatype="Integer",this.value=void 0!==this.value?parseInt(this.value):parseInt(e.defaultValue);break;case"string":this.type="Attribute",this.datatype="String",this.value=void 0!==this.value&&null!==this.value?this.value.toString():e.defaultValue?e.defaultValue.toString():"";break;case"vec2":this.type="Attribute",this.datatype="Vector2d";break;case"vec3":this.type="Attribute",this.datatype="Vector3d";break;case"vec4":this.type="Attribute",this.datatype="Vector4d";break;case"mat3":this.type="Attribute",this.datatype="Mat3";break;case"mat4":this.type="Attribute",this.datatype="Mat4";break;case"color":this.type="Attribute",this.datatype="Color";break;case"image":this.type="Link",this.linkableTypes=["Image"];break;default:console.error("Unknown script field type: "+t),this.type="Attribute",this.datatype="String",this.value=this.value?this.value.toString():e.defaultValue?e.defaultValue.toString():""}}_toBoolean(e){return null!=e&&(!0===e||!1===e?e:"false"!==e.toString().toLowerCase())}_updateDisplayName(){this.name?this.displayName=h.toUserFriendlyName(this.name):this.displayName=""}createSnapshot(){return new O(this.id,"customfield",{id:this.id,value:this.value})}rollbackFromSnapshot(e){this.value=e.data.value}}class K extends M{links;instanceId;isDirty=!1;fieldInstances;userFieldInstances;customFieldInstances;packageContent;packageType;public=!1;readOnly=!1;isPackaged=!1;isGenerated=!1;packageItem;isPreparedItem=!0;resultingAcl;userData={};constructor(e){if(super(e),this.instanceId=h.createItemOrBlockID(),this.links=[],Array.isArray(e.links))for(const t of e.links)this.links.push({to:t.to,usage:t.usage,stopRecursion:t.stopRecursion,item:t.item});this.fieldInstances=[],this.userFieldInstances=[],this.customFieldInstances=g.instance.proxyCustomFieldsArray([],this),this.public=!!e.public,this.packageContent=e.packageContent,this.packageType=e.packageType,this.packageItem=e.packageItem,this.readOnly=!!e.readOnly,this.isPackaged=!!e.isPackaged,this.isGenerated=!!e.isGenerated,this.resultingAcl=JSON.parse(JSON.stringify(e.resultingAcl||[]))}createCustomFieldInstances(e){function t(e,t){for(const a of e)if(a.name===t)return a;return null}for(const a of this.customFieldInstances)t(e,a.name)||a.clearDefinition();let a=0;for(const n of e){let e=t(this.customFieldInstances,n.name);e||(e=new J(n.name,n.defaultValue,this),this.addCustomField(e)),e.setOrder(a++),e.setDefinition(n)}this.customFieldInstances.sort((function(e,t){return e.order-t.order}))}addCustomField(e){this.customFieldInstances.push(g.instance.proxyCustomField(e,this))}markDirty(){this.isDirty||(this.isDirty=!0,u.$emit("itemRepo:itemBecameDirty",this._id))}makeIdsUnique(){const e=new Map;for(const t of this.fieldInstances)t.makeIdsUnique(e,!0);this.packageContent&&this.packageContent.makeIdsUnique()}clone(e=!1){let t=new K(this);const a=new Map;for(const n of this.fieldInstances){const i=n.clone(this,!0);e&&i.makeIdsUnique(a,!0),t.fieldInstances.push(i)}if(e)for(const e of t.fieldInstances)e.transformNodeIds(a);return t}findBlock(e){for(const t of this.fieldInstances){const a=t.findBlock(e);if(a)return a}return null}refreshFieldDependencies(){te.refreshFieldDependencies(this.fieldInstances);for(const e of this.fieldInstances)e.refreshFieldDependencies()}forEachItem(e){if(e(this),this.links)for(const t of this.links)t.item&&t.item.forEachItem(e)}forEachFieldInstance(e){if(this.fieldInstances)for(const t of this.fieldInstances)t.forEachField(e)}toString(){return`PreparedItem(${JSON.stringify({_id:this._id,name:this.name,type:this.type})})`}}function X(e,t,a){if(e.admin||e.superadmin)return!0;if(!Array.isArray(t))return!0;for(const n of t)if(n.can.includes(a)){if(!n.user&&!n.group)return!0;if(n.user&&n.user===e._id)return!0;if(n.group)for(const t of e.groups){if("object"==typeof t&&t._id===n.group)return!0;if(t===n.group)return!0}}}class Q{fields;constructor(e){if(!Array.isArray(e))throw"Template fields need to be an array!";this.fields=e}clone(){const e=[];for(const t of this.fields)e.push(t.clone());return new Q(e)}specialize(e){for(const t of this.fields)void 0!==e[t.name]&&(t.defaultValue=e[t.name]);return this}instantiate(e){if(e)return this.fields;{const e=[];for(const t of this.fields)e.push(t.clone());return e}}}class ee{templates=new Map;templatesByField=new Map;static _instance;static get instance(){return this._instance||(this._instance=new this)}_existsTemplate(e,t){for(const a of e)if(a.typeName===t)return!0;return!1}addTemplates(e,t,a){const n=`${e}_${t}`,i=this.templatesByField.get(n)||[];for(const e of a){const t=`${n}_${e.typeName}`;this.templates.set(t,e),this._existsTemplate(i,e.typeName)||i.push(e)}this.templatesByField.set(n,i)}getTemplate(e,t,a){const n=`${e}_${t}_${a}`;return this.templates.get(n)}getTemplates(e,t){const a=`${e}_${t}`;return this.templatesByField.get(a)||[]}}class te{itemRepo;itemFetcher;constructor(e){this.itemRepo=e,this.itemFetcher=function(e){return e}}setItemFetcher(e){this.itemFetcher=e}setFieldsFromDatatypes(e){const t=C(e.type,!0);e.fields=t?.fields||[],e.fieldSets=t?.fieldSets||[]}async prepare(e){return e instanceof K?(console.warn("Trying to prepare an already prepared item: ",e),e):this.itemRepo.undoManager.ignore((async()=>{const t=new K(e);return this.setFieldsFromDatatypes(t),t.fieldInstances=await this.createFieldInstances(t,t.fields,t.attributes,"","attributes",!1),t.userFieldInstances=await this.createFieldInstances(t,t.userFields,t.userAttributes,"","userAttributes",!1),t.customFieldInstances=await this.createCustomFieldInstances(t,t.userAttributes,"_"),t.allowConversation=!!t.allowConversation,t.packageContent&&(t.packageContent.name=t.name,await this.itemRepo.traverseItems((e=>{e.readOnly=!0,e.isPackaged=!0,e.packageItem=t}),t.packageContent)),t.packageItem?(t.readOnly=!0,t.isPackaged=!0):(t.isPackaged=!1,t.resultingAcl&&t.resultingAcl.length>0?t.readOnly=!X(await this.itemRepo.apiClient.me(!0),t.resultingAcl,"write"):t.readOnly=!0),t}))}async createCustomFieldInstances(e,t,a=""){if(!e)throw new w("createCustomFieldInstances(): Item cannot be null!");if(!t)throw new w("createCustomFieldInstances(): attributes cannot be null!");const n=[];for(const i in t)if(!a.length||i.startsWith(a)){const r=i.substring(a.length);let s=new J(r,t[i],e);s.setType("Attribute"),n.push(g.instance.proxyCustomField(s,e))}if(e.links)for(const t of e.links)if(!a.length||t.usage.startsWith(a)){const i=t.usage.substring(a.length);let r,{id:s,linkItem:o,stopRecursion:l}=await this.fetchLinkValue(e,t.usage);o?r=o:l&&(r=s);let u=new J(i,r,e);u.setType("Link"),n.push(g.instance.proxyCustomField(u,e))}return n}async createFieldInstances(e,t,a,n,i,r=!1){if(!e)throw new w("createFieldInstances(): Item cannot be null!");if(!t)throw new w("createFieldInstances(): Fields cannot be null!");const s=[],o=n.length?`${n}->`:n;for(let a=0;a<t.length;a++){const n=t[a];if("FieldSet"===n.type){const i=this.getFieldSet(e,n.name);i?(t.splice(a,1,...structuredClone(i.fields)),a+=i.fields.length-1):console.error("Fieldset not found: "+n.name)}}for(const n of t)switch(n.type){case"Separator":{const t=new Z("Separator",n.label,"Separator",null,e,this.itemRepo);t.setInfo(n.info),t.setCondition(n.if),t.setCollapsed(n.collapsed),t.setPresets(n.presets),s.push(t);break}case"Label":{const t=new Z("Label","","Label",n.text,e,this.itemRepo);t.setLabelType(n.labelType),t.setCondition(n.if),s.push(t);break}case"Link":{let t;if(!r){let{id:a,linkItem:i,stopRecursion:r}=await this.fetchLinkValue(e,n.usageAs);i?t=i:r&&(t=a)}let a=new Z(n.usageAs,n.displayName,n.type,t,e,this.itemRepo);a.setInfo(n.info),a.setCondition(n.if),a.setLinkableTypes(n.linkableTypes),void 0!==n.preload&&a.setPreload(n.preload),void 0!==n.loadingManager&&a.setLoadingManagerRule(n.loadingManager),s.push(g.instance.proxyItemField(a,e));break}case"Tree":{const t=`${o}${n.name}`,r=[];for(const s of n.childTypes){const n=new Q(await this.createFieldInstances(e,s.fields,a,t,i,!0));r.push({typeName:s.typeName,displayName:s.displayName||s.typeName,template:n,inputs:[],outputs:[]})}r.sort((function(e,t){return e.displayName.localeCompare(t.displayName)})),ee.instance.addTemplates(e.type,n.name,r);const l=new ae(void 0,void 0,"","Root",void 0,e),u=await this.readBlocks(e,l,n.name,t,a,!0,!0,"Tree");l.blocks=g.instance.proxyBlockArray(u,l,e);let c=new Z(n.name,n.displayName,n.type,null,e,this.itemRepo);c.setInfo(n.info),c.setCondition(n.if),c.setBlocks([l]),s.push(c);break}case"List":{const t=`${o}${n.name}`,r=new Q(await this.createFieldInstances(e,n.fields,a,t,i,!0)),l=[{typeName:"Entry",displayName:n.elementName,template:r,inputs:[],outputs:[]}];ee.instance.addTemplates(e.type,n.name,l);let u=new Z(n.name,n.displayName,n.type,null,e,this.itemRepo);const c=await this.readBlocks(e,void 0,n.name,t,a,!0,!0,"List"),d=g.instance.proxyListArray(c,u,e);u.setInfo(n.info),u.setCondition(n.if),u.setBlocks(d),s.push(u);break}case"NodeGraph":{const t=`${o}${n.name}`,r=[];for(const s of n.childTypes){const n=new Q(await this.createFieldInstances(e,s.fields,a,t,i,!0));r.push({typeName:s.typeName,displayName:s.displayName||s.typeName,template:n,inputs:s.inputs||[],outputs:s.outputs||[]})}r.sort((function(e,t){return e.displayName.localeCompare(t.displayName)})),ee.instance.addTemplates(e.type,n.name,r);let l=await this.readBlocks(e,void 0,n.name,t,a,!1,!1,"NodeGraph"),u=this.readConnections(e,t,a),c=new Z(n.name,n.displayName,n.type,null,e,this.itemRepo);c.setInfo(n.info),c.setCondition(n.if),c.setBlocks(g.instance.proxyGraphBlockArray(l,e)),c.setConnections(g.instance.proxyConnectionArray(u,e)),s.push(c);break}case"Attribute":{let t;r||(t=e[i]?e[i][n.name]:void 0,void 0===t&&(t=n.defaultValue));let a=new Z(n.name,n.displayName,n.type,t,e,this.itemRepo);a.setInfo(n.info),a.setCondition(n.if),a.setDefaultValue(n.defaultValue),a.setMinValue(n.minValue),a.setMaxValue(n.maxValue),a.setOptions(n.options),a.setDatatype(n.datatype),a.setLanguage(n.language),a.setWidget(n.widget),a.setLength(n.length),s.push(g.instance.proxyItemField(a,e));break}}return s}getFieldSet(e,t){if(Array.isArray(e.fieldSets))for(const a of e.fieldSets)if(a.name===t)return a;return null}async fetchLinkValue(e,t){if(!e)throw new w("fetchLinkValue(): Item cannot be null!");for(const a of e.links)if(a.usage===t)return{id:a.to,linkItem:a.item?await this.itemFetcher(a.item):null,stopRecursion:a.stopRecursion};return{id:null,linkItem:null}}async readBlocks(e,t,a,n,i,r,s,o){if(!e)throw new w("readBlocks(): Item cannot be null!");const l=[];let u=0;for(;;){const c=`${n}[${u}]`;if(!this.existsBlockNamespace(e,i,c))break;{const n=`${c}#id`,u=e.attributes[n],d=`${c}#type`;let p,h,f=e.attributes[d];switch(o){case"NodeGraph":{const t=`${c}#posx`,a=`${c}#posy`;p=e.attributes[t]||0,h=e.attributes[a]||0;break}case"List":r=!1,f="Entry"}const m=ee.instance.getTemplate(e.packageType||e.type,a,f);if(m){const n=m.typeName,d=m.displayName,f=new ae(u,t,n,n,d,e),y=await this.createFields(f,e,m.template,c,"NodeGraph"===o,i);if(f.setFields(y),"NodeGraph"===o&&(f.setPosition(p,h),f.setInputs(m.inputs),f.setOutputs(m.outputs)),r){const t=await this.readBlocks(e,f,a,c,i,r,s,o);f.blocks=g.instance.proxyBlockArray(t,f,e)}if(s){const t=await this.readScripts(e,f,c,i);f.scripts=g.instance.proxyScriptArray(t,f,e)}"NodeGraph"===o?l.push(g.instance.proxyGraphBlock(f,e)):l.push(g.instance.proxyBlock(f,e))}else console.error(`Block template not found: ${a}_${f}`)}u++}return l}async readScripts(e,t,a,n){if(!e)throw new w("readScripts(): Item cannot be null!");const i=[];let r=0;for(;;){const s=`${a}#scripts[${r}]`;if(!this.existsScriptNamespace(e,n,s))break;{const a=n[`${s}#id`],r=`${s}#item`,o=`${s}->`,l=o.length;let{linkItem:u}=await this.fetchLinkValue(e,r);const c=new W(a,t,e,u);i.push(c);for(const t in n)if(n.hasOwnProperty(t)&&t.startsWith(o)){const a=n[t],i=t.substring(l),r=new j(c,i,a,e);c.addField(r)}}r++}return i}existsScriptNamespace(e,t,a){if(!e)throw new w("existsScriptNamespace(): Item cannot be null!");return"Script"===t[`${a}#usage`]}readConnections(e,t,a){const n=[];let i=0;for(;;){const r=a[`${t}#connection[${i++}]`];if(!r)break;n.push(new U(r,e))}return n}existsBlockNamespace(e,t,a){if(!e)throw new w("existsBlockNamespace(): Item cannot be null!");const n=t[`${a}#usage`];if(n)return"Block"===n;for(const e in t)if(t.hasOwnProperty(e)&&e.startsWith(a))return!0;for(const t of e.links)if(t.usage.startsWith(a))return!0;return!1}async createFields(e,t,a,n,i,r,s=!1){let o=a.instantiate(s),l=[];for(const a of o)if(a.name){const s=`${n}->${a.name}`;switch(a.type){case"Link":if(n){let{id:e,linkItem:n,stopRecursion:i}=await this.fetchLinkValue(t,s);a.value=n||(i?e:null)}else a.value=a.defaultValue;break;case"List":{const e=await this.readBlocks(t,void 0,a.name,s,r,!0,!0,"List"),n=g.instance.proxyListArray(e,a,t);a.setBlocks(n);break}case"Attribute":n?(a.value=t.attributes[s],void 0===a.value&&(a.value=a.defaultValue)):a.value=a.defaultValue}i?l.push(g.instance.proxyGraphBlockField(a,e,t)):l.push(g.instance.proxyBlockField(a,e,t))}return l}static refreshFieldDependencies(e){const t=new Map,a=new Map;for(const a of e)t.set(a.name,a);for(const n of e)if(Array.isArray(n.conditionFieldNames))for(const e of n.conditionFieldNames){const i=t.get(e);if(i){const e=a.get(i);e?e.push(n):a.set(i,[n])}}for(const n of e)n.refreshDependantFields(t,a.get(n))}}class ae extends ${id="";parent=void 0;type=void 0;name="";displayName="";fields=[];blocks=[];isSelected=!1;isExpanded=!0;scripts=[];inputs=[];outputs=[];posX=0;posY=0;constructor(e=void 0,t=void 0,a=void 0,n=void 0,i=void 0,r=void 0){super(r),e instanceof O?this.restoreFromSnapshot(e,t):(this.id=e||h.createItemOrBlockID(),this.parent=t,this.type=a,this.name=n||this.type||"",this.displayName=i||this.name)}getId(){return this.id}getPositionInParent(){if(this.parent){let e=0;for(const t of this.parent.blocks){if(t.id===this.id)return e;e++}}return-1}refreshFieldDependencies(){te.refreshFieldDependencies(this.fields);for(const e of this.fields)e.refreshFieldDependencies();for(const e of this.blocks)e.refreshFieldDependencies()}resetFieldValues(e=!1){for(const e of this.fields)e.resetValue();if(e)for(const t of this.blocks)t.resetFieldValues(e)}makeIdsUnique(e=new Map,t=!1){if(e.has(this.id)||t){const t=h.createItemOrBlockID();e.set(this.id,t),this.id=t}else e.set(this.id,this.id);for(const a of this.fields)a.makeIdsUnique(e,t);for(const a of this.blocks)a.makeIdsUnique(e,t);for(const a of this.scripts)a.makeIdsUnique(e,t);return e}transformNodeIds(e){for(const t of this.fields)t.transformNodeIds(e);for(const t of this.blocks)t.transformNodeIds(e);for(const t of this.scripts)t.transformNodeIds(e)}clone(e,t=!0,a={},n=!1){const i=new ae;n&&(i.id=this.id),i.ownerItem=this.ownerItem,i.parent=this.parent,i.type=this.type,i.name=this.name,i.displayName=this.displayName,i.isSelected=!1,i.isExpanded=!0,i.inputs=this.inputs,i.outputs=this.outputs,i.posX=0,i.posY=0;for(const t of this.fields){let r=t.clone(e,n);void 0!==a[t.name]&&(r.value=a[t.name]),e&&(r=g.instance.proxyBlockField(r,i,e)),i.fields.push(r)}if(e&&(i.scripts=g.instance.proxyScriptArray(i.scripts,i,e)),t)for(const e of this.scripts){const t=e.clone();i.scripts.push(t)}const r=i.blocks;e&&(i.blocks=g.instance.proxyBlockArray(r,i,e));for(const a of this.blocks){let s=a.clone(e,t,{},n);s.parent=i,e&&(s=g.instance.proxyBlock(s,e)),r.push(s)}return i}getDescendantBlocks(e=[]){const t=this.blocks;return e.push(...t),t.forEach((t=>t.getDescendantBlocks(e))),e}setFields(e){this.fields=e}setInputs(e){this.inputs=e}setOutputs(e){this.outputs=e}setPosition(e,t){this.posX=e,this.posY=t}setSelected(e){this.isSelected=e}setExpanded(e){this.isExpanded=e}getRoot(){return this.parent?this.parent.getRoot():this}forEachField(e){if(this.fields)for(const t of this.fields)t.forEachField(e);if(this.blocks)for(const t of this.blocks)t.forEachField(e)}findField(e){for(const t of this.fields)if(t.name===e)return t;return null}findBlock(e){if(this.id===e)return this;for(const t of this.blocks){const a=t.findBlock(e);if(a)return a}return null}removeBlock(e){this.blocks.removeObject(e)}addBlock(e,t){this.blocks.includes(e)||(void 0===t?this.blocks.push(e):this.blocks.splice(t,0,e))}moveBlock(e,t){e.parent.blocks.moveObjectToArray(e,e.parent.blocks,t)}moveToPosition(e){this.parent.moveBlock(this,e)}moveBlockToParent(e,t){this.parent.blocks.moveObjectToArray(this,e.blocks,t),this.parent=e}moveToParent(e,t){if(this.findBlock(e))return void console.error("Cannot move block to a parent that is a child.");const a=this.getRoot();if(!a)return void console.error("Cannot find root block!");const n=a.findBlock(e);n?this.parent!==n?this.moveBlockToParent(n,t):console.warn(`Node is already in parent ${e}`):console.error(`Cannot find the new parent block: ${e}`)}getField(e){for(const t of this.fields)if(t.name===e)return t;return null}hasTag(e){const t=this.getField("Tags");return!(!t||!Array.isArray(t.value))&&t.value.includes(e)}hasOneTag(e){const t=this.getField("Tags");if(t&&Array.isArray(t.value))for(const a of e)if(t.value.includes(a))return!0;return!1}getNameFieldValue(){const e=this.getField("Name");return e?e.value:null}getActiveFieldValue(){const e=this.getField("Active");return!e||e.value}createSnapshot(e=!1){const t=[];for(const a of this.fields)a.createSnapshot&&t.push(a.createSnapshot(e));const a=[];if(!e)for(const t of this.blocks)a.push(t.createSnapshot(e));const n=[];for(const e of this.scripts)n.push(e.createSnapshot());return new O(this.id,"block",{id:this.id,ownerItem:this.ownerItem,type:this.type,name:this.name,displayName:this.displayName,fields:t,blocks:a,isExpanded:this.isExpanded,scripts:n,inputs:this.inputs,outputs:this.outputs,posX:this.posX,posY:this.posY})}restoreFromSnapshot(e,t){this.id=e.data.id,this.parent=t,this.type=e.data.type,this.ownerItem=e.data.ownerItem,this.name=e.data.name,this.displayName=e.data.displayName,this.isSelected=!1,this.isExpanded=e.data.isExpanded,this.inputs=e.data.inputs,this.outputs=e.data.outputs,this.posX=e.data.posX,this.posY=e.data.posY;const a=[];this._rollbackArray(a,e.data.fields,(e=>g.instance.proxyBlockField(new Z(e),this,this.ownerItem))),this.fields=a;const n=[];this._rollbackArray(n,e.data.blocks,((e,t)=>g.instance.proxyBlock(new ae(e,t),this.ownerItem))),this.blocks=g.instance.proxyBlockArray(n,this,this.ownerItem);const i=[];this._rollbackArray(i,e.data.scripts,((e,t)=>new W(e,t,this.ownerItem))),this.scripts=g.instance.proxyScriptArray(i,this,this.ownerItem)}rollbackFromSnapshot(e,t=!1){this._rollbackArray(this.fields,e.data.fields,(e=>g.instance.proxyBlockField(new Z(e),this,this.ownerItem))),this._rollbackArray(this.scripts,e.data.scripts,(e=>new W(e,this,this.ownerItem))),t||this._rollbackArray(this.blocks,e.data.blocks,((e,t)=>g.instance.proxyBlock(new ae(e,t),this.ownerItem)))}_getFieldByName(e,t){for(const a of t)if(a.id===e)return a;return null}}
12
- /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function ne(e){let t=e.length;for(;--t>=0;)e[t]=0}const ie=256,re=286,se=30,oe=15,le=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),ue=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),ce=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),de=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),pe=new Array(576);ne(pe);const he=new Array(60);ne(he);const fe=new Array(512);ne(fe);const me=new Array(256);ne(me);const ye=new Array(29);ne(ye);const ge=new Array(se);function be(e,t,a,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=a,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}let ve,_e,we;function Ae(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}ne(ge);const ke=e=>e<256?fe[e]:fe[256+(e>>>7)],Se=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},Ne=(e,t,a)=>{e.bi_valid>16-a?(e.bi_buf|=t<<e.bi_valid&65535,Se(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=a-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=a)},Te=(e,t,a)=>{Ne(e,a[2*t],a[2*t+1])},Me=(e,t)=>{let a=0;do{a|=1&e,e>>>=1,a<<=1}while(--t>0);return a>>>1},xe=(e,t,a)=>{const n=new Array(16);let i,r,s=0;for(i=1;i<=oe;i++)s=s+a[i-1]<<1,n[i]=s;for(r=0;r<=t;r++){let t=e[2*r+1];0!==t&&(e[2*r]=Me(n[t]++,t))}},Ce=e=>{let t;for(t=0;t<re;t++)e.dyn_ltree[2*t]=0;for(t=0;t<se;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Ie=e=>{e.bi_valid>8?Se(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Ve=(e,t,a,n)=>{const i=2*t,r=2*a;return e[i]<e[r]||e[i]===e[r]&&n[t]<=n[a]},Ee=(e,t,a)=>{const n=e.heap[a];let i=a<<1;for(;i<=e.heap_len&&(i<e.heap_len&&Ve(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!Ve(t,n,e.heap[i],e.depth));)e.heap[a]=e.heap[i],a=i,i<<=1;e.heap[a]=n},Fe=(e,t,a)=>{let n,i,r,s,o=0;if(0!==e.sym_next)do{n=255&e.pending_buf[e.sym_buf+o++],n+=(255&e.pending_buf[e.sym_buf+o++])<<8,i=e.pending_buf[e.sym_buf+o++],0===n?Te(e,i,t):(r=me[i],Te(e,r+ie+1,t),s=le[r],0!==s&&(i-=ye[r],Ne(e,i,s)),n--,r=ke(n),Te(e,r,a),s=ue[r],0!==s&&(n-=ge[r],Ne(e,n,s)))}while(o<e.sym_next);Te(e,256,t)},De=(e,t)=>{const a=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,r=t.stat_desc.elems;let s,o,l,u=-1;for(e.heap_len=0,e.heap_max=573,s=0;s<r;s++)0!==a[2*s]?(e.heap[++e.heap_len]=u=s,e.depth[s]=0):a[2*s+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=u<2?++u:0,a[2*l]=1,e.depth[l]=0,e.opt_len--,i&&(e.static_len-=n[2*l+1]);for(t.max_code=u,s=e.heap_len>>1;s>=1;s--)Ee(e,a,s);l=r;do{s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Ee(e,a,1),o=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=o,a[2*l]=a[2*s]+a[2*o],e.depth[l]=(e.depth[s]>=e.depth[o]?e.depth[s]:e.depth[o])+1,a[2*s+1]=a[2*o+1]=l,e.heap[1]=l++,Ee(e,a,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const a=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,l=t.stat_desc.max_length;let u,c,d,p,h,f,m=0;for(p=0;p<=oe;p++)e.bl_count[p]=0;for(a[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)c=e.heap[u],p=a[2*a[2*c+1]+1]+1,p>l&&(p=l,m++),a[2*c+1]=p,c>n||(e.bl_count[p]++,h=0,c>=o&&(h=s[c-o]),f=a[2*c],e.opt_len+=f*(p+h),r&&(e.static_len+=f*(i[2*c+1]+h)));if(0!==m){do{for(p=l-1;0===e.bl_count[p];)p--;e.bl_count[p]--,e.bl_count[p+1]+=2,e.bl_count[l]--,m-=2}while(m>0);for(p=l;0!==p;p--)for(c=e.bl_count[p];0!==c;)d=e.heap[--u],d>n||(a[2*d+1]!==p&&(e.opt_len+=(p-a[2*d+1])*a[2*d],a[2*d+1]=p),c--)}})(e,t),xe(a,u,e.bl_count)},Re=(e,t,a)=>{let n,i,r=-1,s=t[1],o=0,l=7,u=4;for(0===s&&(l=138,u=3),t[2*(a+1)+1]=65535,n=0;n<=a;n++)i=s,s=t[2*(n+1)+1],++o<l&&i===s||(o<u?e.bl_tree[2*i]+=o:0!==i?(i!==r&&e.bl_tree[2*i]++,e.bl_tree[32]++):o<=10?e.bl_tree[34]++:e.bl_tree[36]++,o=0,r=i,0===s?(l=138,u=3):i===s?(l=6,u=3):(l=7,u=4))},Le=(e,t,a)=>{let n,i,r=-1,s=t[1],o=0,l=7,u=4;for(0===s&&(l=138,u=3),n=0;n<=a;n++)if(i=s,s=t[2*(n+1)+1],!(++o<l&&i===s)){if(o<u)do{Te(e,i,e.bl_tree)}while(0!=--o);else 0!==i?(i!==r&&(Te(e,i,e.bl_tree),o--),Te(e,16,e.bl_tree),Ne(e,o-3,2)):o<=10?(Te(e,17,e.bl_tree),Ne(e,o-3,3)):(Te(e,18,e.bl_tree),Ne(e,o-11,7));o=0,r=i,0===s?(l=138,u=3):i===s?(l=6,u=3):(l=7,u=4)}};let Pe=!1;const Be=(e,t,a,n)=>{Ne(e,0+(n?1:0),3),Ie(e),Se(e,a),Se(e,~a),a&&e.pending_buf.set(e.window.subarray(t,t+a),e.pending),e.pending+=a};var Oe=e=>{Pe||((()=>{let e,t,a,n,i;const r=new Array(16);for(a=0,n=0;n<28;n++)for(ye[n]=a,e=0;e<1<<le[n];e++)me[a++]=n;for(me[a-1]=n,i=0,n=0;n<16;n++)for(ge[n]=i,e=0;e<1<<ue[n];e++)fe[i++]=n;for(i>>=7;n<se;n++)for(ge[n]=i<<7,e=0;e<1<<ue[n]-7;e++)fe[256+i++]=n;for(t=0;t<=oe;t++)r[t]=0;for(e=0;e<=143;)pe[2*e+1]=8,e++,r[8]++;for(;e<=255;)pe[2*e+1]=9,e++,r[9]++;for(;e<=279;)pe[2*e+1]=7,e++,r[7]++;for(;e<=287;)pe[2*e+1]=8,e++,r[8]++;for(xe(pe,287,r),e=0;e<se;e++)he[2*e+1]=5,he[2*e]=Me(e,5);ve=new be(pe,le,257,re,oe),_e=new be(he,ue,0,se,oe),we=new be(new Array(0),ce,0,19,7)})(),Pe=!0),e.l_desc=new Ae(e.dyn_ltree,ve),e.d_desc=new Ae(e.dyn_dtree,_e),e.bl_desc=new Ae(e.bl_tree,we),e.bi_buf=0,e.bi_valid=0,Ce(e)},$e=(e,t,a,n)=>{let i,r,s=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,a=4093624447;for(t=0;t<=31;t++,a>>>=1)if(1&a&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<ie;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),De(e,e.l_desc),De(e,e.d_desc),s=(e=>{let t;for(Re(e,e.dyn_ltree,e.l_desc.max_code),Re(e,e.dyn_dtree,e.d_desc.max_code),De(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*de[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),i=e.opt_len+3+7>>>3,r=e.static_len+3+7>>>3,r<=i&&(i=r)):i=r=a+5,a+4<=i&&-1!==t?Be(e,t,a,n):4===e.strategy||r===i?(Ne(e,2+(n?1:0),3),Fe(e,pe,he)):(Ne(e,4+(n?1:0),3),((e,t,a,n)=>{let i;for(Ne(e,t-257,5),Ne(e,a-1,5),Ne(e,n-4,4),i=0;i<n;i++)Ne(e,e.bl_tree[2*de[i]+1],3);Le(e,e.dyn_ltree,t-1),Le(e,e.dyn_dtree,a-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),Fe(e,e.dyn_ltree,e.dyn_dtree)),Ce(e),n&&Ie(e)},Ue={_tr_init:Oe,_tr_stored_block:Be,_tr_flush_block:$e,_tr_tally:(e,t,a)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=a,0===t?e.dyn_ltree[2*a]++:(e.matches++,t--,e.dyn_ltree[2*(me[a]+ie+1)]++,e.dyn_dtree[2*ke(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{Ne(e,2,3),Te(e,256,pe),(e=>{16===e.bi_valid?(Se(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var je=(e,t,a,n)=>{let i=65535&e,r=e>>>16&65535,s=0;for(;0!==a;){s=a>2e3?2e3:a,a-=s;do{i=i+t[n++]|0,r=r+i|0}while(--s);i%=65521,r%=65521}return i|r<<16};const ze=new Uint32Array((()=>{let e,t=[];for(var a=0;a<256;a++){e=a;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[a]=e}return t})());var We=(e,t,a,n)=>{const i=ze,r=n+a;e^=-1;for(let a=n;a<r;a++)e=e>>>8^i[255&(e^t[a])];return~e},Ye={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},He={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Ge,_tr_stored_block:qe,_tr_flush_block:Ze,_tr_tally:Je,_tr_align:Ke}=Ue,{Z_NO_FLUSH:Xe,Z_PARTIAL_FLUSH:Qe,Z_FULL_FLUSH:et,Z_FINISH:tt,Z_BLOCK:at,Z_OK:nt,Z_STREAM_END:it,Z_STREAM_ERROR:rt,Z_DATA_ERROR:st,Z_BUF_ERROR:ot,Z_DEFAULT_COMPRESSION:lt,Z_FILTERED:ut,Z_HUFFMAN_ONLY:ct,Z_RLE:dt,Z_FIXED:pt,Z_DEFAULT_STRATEGY:ht,Z_UNKNOWN:ft,Z_DEFLATED:mt}=He,yt=258,gt=262,bt=42,vt=113,_t=666,wt=(e,t)=>(e.msg=Ye[t],t),At=e=>2*e-(e>4?9:0),kt=e=>{let t=e.length;for(;--t>=0;)e[t]=0},St=e=>{let t,a,n,i=e.w_size;t=e.hash_size,n=t;do{a=e.head[--n],e.head[n]=a>=i?a-i:0}while(--t);t=i,n=t;do{a=e.prev[--n],e.prev[n]=a>=i?a-i:0}while(--t)};let Nt=(e,t,a)=>(t<<e.hash_shift^a)&e.hash_mask;const Tt=e=>{const t=e.state;let a=t.pending;a>e.avail_out&&(a=e.avail_out),0!==a&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+a),e.next_out),e.next_out+=a,t.pending_out+=a,e.total_out+=a,e.avail_out-=a,t.pending-=a,0===t.pending&&(t.pending_out=0))},Mt=(e,t)=>{Ze(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Tt(e.strm)},xt=(e,t)=>{e.pending_buf[e.pending++]=t},Ct=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},It=(e,t,a,n)=>{let i=e.avail_in;return i>n&&(i=n),0===i?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),a),1===e.state.wrap?e.adler=je(e.adler,t,i,a):2===e.state.wrap&&(e.adler=We(e.adler,t,i,a)),e.next_in+=i,e.total_in+=i,i)},Vt=(e,t)=>{let a,n,i=e.max_chain_length,r=e.strstart,s=e.prev_length,o=e.nice_match;const l=e.strstart>e.w_size-gt?e.strstart-(e.w_size-gt):0,u=e.window,c=e.w_mask,d=e.prev,p=e.strstart+yt;let h=u[r+s-1],f=u[r+s];e.prev_length>=e.good_match&&(i>>=2),o>e.lookahead&&(o=e.lookahead);do{if(a=t,u[a+s]===f&&u[a+s-1]===h&&u[a]===u[r]&&u[++a]===u[r+1]){r+=2,a++;do{}while(u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&r<p);if(n=yt-(p-r),r=p-yt,n>s){if(e.match_start=t,s=n,n>=o)break;h=u[r+s-1],f=u[r+s]}}}while((t=d[t&c])>l&&0!=--i);return s<=e.lookahead?s:e.lookahead},Et=e=>{const t=e.w_size;let a,n,i;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-gt)&&(e.window.set(e.window.subarray(t,t+t-n),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),St(e),n+=t),0===e.strm.avail_in)break;if(a=It(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=a,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Nt(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Nt(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<gt&&0!==e.strm.avail_in)},Ft=(e,t)=>{let a,n,i,r=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,s=0,o=e.strm.avail_in;do{if(a=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i)break;if(i=e.strm.avail_out-i,n=e.strstart-e.block_start,a>n+e.strm.avail_in&&(a=n+e.strm.avail_in),a>i&&(a=i),a<r&&(0===a&&t!==tt||t===Xe||a!==n+e.strm.avail_in))break;s=t===tt&&a===n+e.strm.avail_in?1:0,qe(e,0,0,s),e.pending_buf[e.pending-4]=a,e.pending_buf[e.pending-3]=a>>8,e.pending_buf[e.pending-2]=~a,e.pending_buf[e.pending-1]=~a>>8,Tt(e.strm),n&&(n>a&&(n=a),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+n),e.strm.next_out),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n,e.block_start+=n,a-=n),a&&(It(e.strm,e.strm.output,e.strm.next_out,a),e.strm.next_out+=a,e.strm.avail_out-=a,e.strm.total_out+=a)}while(0===s);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),s?4:t!==Xe&&t!==tt&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(It(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,r=i>e.w_size?e.w_size:i,n=e.strstart-e.block_start,(n>=r||(n||t===tt)&&t!==Xe&&0===e.strm.avail_in&&n<=i)&&(a=n>i?i:n,s=t===tt&&0===e.strm.avail_in&&a===n?1:0,qe(e,e.block_start,a,s),e.block_start+=a,Tt(e.strm)),s?3:1)},Dt=(e,t)=>{let a,n;for(;;){if(e.lookahead<gt){if(Et(e),e.lookahead<gt&&t===Xe)return 1;if(0===e.lookahead)break}if(a=0,e.lookahead>=3&&(e.ins_h=Nt(e,e.ins_h,e.window[e.strstart+3-1]),a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==a&&e.strstart-a<=e.w_size-gt&&(e.match_length=Vt(e,a)),e.match_length>=3)if(n=Je(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=Nt(e,e.ins_h,e.window[e.strstart+3-1]),a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Nt(e,e.ins_h,e.window[e.strstart+1]);else n=Je(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(Mt(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===tt?(Mt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Mt(e,!1),0===e.strm.avail_out)?1:2},Rt=(e,t)=>{let a,n,i;for(;;){if(e.lookahead<gt){if(Et(e),e.lookahead<gt&&t===Xe)return 1;if(0===e.lookahead)break}if(a=0,e.lookahead>=3&&(e.ins_h=Nt(e,e.ins_h,e.window[e.strstart+3-1]),a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==a&&e.prev_length<e.max_lazy_match&&e.strstart-a<=e.w_size-gt&&(e.match_length=Vt(e,a),e.match_length<=5&&(e.strategy===ut||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,n=Je(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=Nt(e,e.ins_h,e.window[e.strstart+3-1]),a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(Mt(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(n=Je(e,0,e.window[e.strstart-1]),n&&Mt(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=Je(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===tt?(Mt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Mt(e,!1),0===e.strm.avail_out)?1:2};function Lt(e,t,a,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=a,this.max_chain=n,this.func=i}const Pt=[new Lt(0,0,0,0,Ft),new Lt(4,4,8,4,Dt),new Lt(4,5,16,8,Dt),new Lt(4,6,32,32,Dt),new Lt(4,4,16,16,Rt),new Lt(8,16,32,32,Rt),new Lt(8,16,128,128,Rt),new Lt(8,32,128,256,Rt),new Lt(32,128,258,1024,Rt),new Lt(32,258,258,4096,Rt)];function Bt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=mt,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),kt(this.dyn_ltree),kt(this.dyn_dtree),kt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),kt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),kt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Ot=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==bt&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==vt&&t.status!==_t?1:0},$t=e=>{if(Ot(e))return wt(e,rt);e.total_in=e.total_out=0,e.data_type=ft;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?bt:vt,e.adler=2===t.wrap?0:1,t.last_flush=-2,Ge(t),nt},Ut=e=>{const t=$t(e);var a;return t===nt&&((a=e.state).window_size=2*a.w_size,kt(a.head),a.max_lazy_match=Pt[a.level].max_lazy,a.good_match=Pt[a.level].good_length,a.nice_match=Pt[a.level].nice_length,a.max_chain_length=Pt[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0),t},jt=(e,t,a,n,i,r)=>{if(!e)return rt;let s=1;if(t===lt&&(t=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),i<1||i>9||a!==mt||n<8||n>15||t<0||t>9||r<0||r>pt||8===n&&1!==s)return wt(e,rt);8===n&&(n=9);const o=new Bt;return e.state=o,o.strm=e,o.status=bt,o.wrap=s,o.gzhead=null,o.w_bits=n,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=i+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new Uint8Array(2*o.w_size),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<i+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=3*(o.lit_bufsize-1),o.level=t,o.strategy=r,o.method=a,Ut(e)};var zt=(e,t)=>{if(Ot(e)||t>at||t<0)return e?wt(e,rt):rt;const a=e.state;if(!e.output||0!==e.avail_in&&!e.input||a.status===_t&&t!==tt)return wt(e,0===e.avail_out?ot:rt);const n=a.last_flush;if(a.last_flush=t,0!==a.pending){if(Tt(e),0===e.avail_out)return a.last_flush=-1,nt}else if(0===e.avail_in&&At(t)<=At(n)&&t!==tt)return wt(e,ot);if(a.status===_t&&0!==e.avail_in)return wt(e,ot);if(a.status===bt&&0===a.wrap&&(a.status=vt),a.status===bt){let t=mt+(a.w_bits-8<<4)<<8,n=-1;if(n=a.strategy>=ct||a.level<2?0:a.level<6?1:6===a.level?2:3,t|=n<<6,0!==a.strstart&&(t|=32),t+=31-t%31,Ct(a,t),0!==a.strstart&&(Ct(a,e.adler>>>16),Ct(a,65535&e.adler)),e.adler=1,a.status=vt,Tt(e),0!==a.pending)return a.last_flush=-1,nt}if(57===a.status)if(e.adler=0,xt(a,31),xt(a,139),xt(a,8),a.gzhead)xt(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),xt(a,255&a.gzhead.time),xt(a,a.gzhead.time>>8&255),xt(a,a.gzhead.time>>16&255),xt(a,a.gzhead.time>>24&255),xt(a,9===a.level?2:a.strategy>=ct||a.level<2?4:0),xt(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(xt(a,255&a.gzhead.extra.length),xt(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(e.adler=We(e.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=69;else if(xt(a,0),xt(a,0),xt(a,0),xt(a,0),xt(a,0),xt(a,9===a.level?2:a.strategy>=ct||a.level<2?4:0),xt(a,3),a.status=vt,Tt(e),0!==a.pending)return a.last_flush=-1,nt;if(69===a.status){if(a.gzhead.extra){let t=a.pending,n=(65535&a.gzhead.extra.length)-a.gzindex;for(;a.pending+n>a.pending_buf_size;){let i=a.pending_buf_size-a.pending;if(a.pending_buf.set(a.gzhead.extra.subarray(a.gzindex,a.gzindex+i),a.pending),a.pending=a.pending_buf_size,a.gzhead.hcrc&&a.pending>t&&(e.adler=We(e.adler,a.pending_buf,a.pending-t,t)),a.gzindex+=i,Tt(e),0!==a.pending)return a.last_flush=-1,nt;t=0,n-=i}let i=new Uint8Array(a.gzhead.extra);a.pending_buf.set(i.subarray(a.gzindex,a.gzindex+n),a.pending),a.pending+=n,a.gzhead.hcrc&&a.pending>t&&(e.adler=We(e.adler,a.pending_buf,a.pending-t,t)),a.gzindex=0}a.status=73}if(73===a.status){if(a.gzhead.name){let t,n=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>n&&(e.adler=We(e.adler,a.pending_buf,a.pending-n,n)),Tt(e),0!==a.pending)return a.last_flush=-1,nt;n=0}t=a.gzindex<a.gzhead.name.length?255&a.gzhead.name.charCodeAt(a.gzindex++):0,xt(a,t)}while(0!==t);a.gzhead.hcrc&&a.pending>n&&(e.adler=We(e.adler,a.pending_buf,a.pending-n,n)),a.gzindex=0}a.status=91}if(91===a.status){if(a.gzhead.comment){let t,n=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>n&&(e.adler=We(e.adler,a.pending_buf,a.pending-n,n)),Tt(e),0!==a.pending)return a.last_flush=-1,nt;n=0}t=a.gzindex<a.gzhead.comment.length?255&a.gzhead.comment.charCodeAt(a.gzindex++):0,xt(a,t)}while(0!==t);a.gzhead.hcrc&&a.pending>n&&(e.adler=We(e.adler,a.pending_buf,a.pending-n,n))}a.status=103}if(103===a.status){if(a.gzhead.hcrc){if(a.pending+2>a.pending_buf_size&&(Tt(e),0!==a.pending))return a.last_flush=-1,nt;xt(a,255&e.adler),xt(a,e.adler>>8&255),e.adler=0}if(a.status=vt,Tt(e),0!==a.pending)return a.last_flush=-1,nt}if(0!==e.avail_in||0!==a.lookahead||t!==Xe&&a.status!==_t){let n=0===a.level?Ft(a,t):a.strategy===ct?((e,t)=>{let a;for(;;){if(0===e.lookahead&&(Et(e),0===e.lookahead)){if(t===Xe)return 1;break}if(e.match_length=0,a=Je(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,a&&(Mt(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===tt?(Mt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Mt(e,!1),0===e.strm.avail_out)?1:2})(a,t):a.strategy===dt?((e,t)=>{let a,n,i,r;const s=e.window;for(;;){if(e.lookahead<=yt){if(Et(e),e.lookahead<=yt&&t===Xe)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=e.strstart-1,n=s[i],n===s[++i]&&n===s[++i]&&n===s[++i])){r=e.strstart+yt;do{}while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&i<r);e.match_length=yt-(r-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(a=Je(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(a=Je(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),a&&(Mt(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===tt?(Mt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Mt(e,!1),0===e.strm.avail_out)?1:2})(a,t):Pt[a.level].func(a,t);if(3!==n&&4!==n||(a.status=_t),1===n||3===n)return 0===e.avail_out&&(a.last_flush=-1),nt;if(2===n&&(t===Qe?Ke(a):t!==at&&(qe(a,0,0,!1),t===et&&(kt(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),Tt(e),0===e.avail_out))return a.last_flush=-1,nt}return t!==tt?nt:a.wrap<=0?it:(2===a.wrap?(xt(a,255&e.adler),xt(a,e.adler>>8&255),xt(a,e.adler>>16&255),xt(a,e.adler>>24&255),xt(a,255&e.total_in),xt(a,e.total_in>>8&255),xt(a,e.total_in>>16&255),xt(a,e.total_in>>24&255)):(Ct(a,e.adler>>>16),Ct(a,65535&e.adler)),Tt(e),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?nt:it)},Wt={deflateInit:(e,t)=>jt(e,t,mt,15,8,ht),deflateInit2:jt,deflateReset:Ut,deflateResetKeep:$t,deflateSetHeader:(e,t)=>Ot(e)||2!==e.state.wrap?rt:(e.state.gzhead=t,nt),deflate:zt,deflateEnd:e=>{if(Ot(e))return rt;const t=e.state.status;return e.state=null,t===vt?wt(e,st):nt},deflateSetDictionary:(e,t)=>{let a=t.length;if(Ot(e))return rt;const n=e.state,i=n.wrap;if(2===i||1===i&&n.status!==bt||n.lookahead)return rt;if(1===i&&(e.adler=je(e.adler,t,a,0)),n.wrap=0,a>=n.w_size){0===i&&(kt(n.head),n.strstart=0,n.block_start=0,n.insert=0);let e=new Uint8Array(n.w_size);e.set(t.subarray(a-n.w_size,a),0),t=e,a=n.w_size}const r=e.avail_in,s=e.next_in,o=e.input;for(e.avail_in=a,e.next_in=0,e.input=t,Et(n);n.lookahead>=3;){let e=n.strstart,t=n.lookahead-2;do{n.ins_h=Nt(n,n.ins_h,n.window[e+3-1]),n.prev[e&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=e,e++}while(--t);n.strstart=e,n.lookahead=2,Et(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,e.next_in=s,e.input=o,e.avail_in=r,n.wrap=i,nt},deflateInfo:"pako deflate (from Nodeca project)"};const Yt=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ht=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const a=t.shift();if(a){if("object"!=typeof a)throw new TypeError(a+"must be non-object");for(const t in a)Yt(a,t)&&(e[t]=a[t])}}return e},Gt=e=>{let t=0;for(let a=0,n=e.length;a<n;a++)t+=e[a].length;const a=new Uint8Array(t);for(let t=0,n=0,i=e.length;t<i;t++){let i=e[t];a.set(i,n),n+=i.length}return a};let qt=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){qt=!1}const Zt=new Uint8Array(256);for(let e=0;e<256;e++)Zt[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Zt[254]=Zt[254]=1;var Jt=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,a,n,i,r,s=e.length,o=0;for(i=0;i<s;i++)a=e.charCodeAt(i),55296==(64512&a)&&i+1<s&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(a=65536+(a-55296<<10)+(n-56320),i++)),o+=a<128?1:a<2048?2:a<65536?3:4;for(t=new Uint8Array(o),r=0,i=0;r<o;i++)a=e.charCodeAt(i),55296==(64512&a)&&i+1<s&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(a=65536+(a-55296<<10)+(n-56320),i++)),a<128?t[r++]=a:a<2048?(t[r++]=192|a>>>6,t[r++]=128|63&a):a<65536?(t[r++]=224|a>>>12,t[r++]=128|a>>>6&63,t[r++]=128|63&a):(t[r++]=240|a>>>18,t[r++]=128|a>>>12&63,t[r++]=128|a>>>6&63,t[r++]=128|63&a);return t},Kt=(e,t)=>{const a=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let n,i;const r=new Array(2*a);for(i=0,n=0;n<a;){let t=e[n++];if(t<128){r[i++]=t;continue}let s=Zt[t];if(s>4)r[i++]=65533,n+=s-1;else{for(t&=2===s?31:3===s?15:7;s>1&&n<a;)t=t<<6|63&e[n++],s--;s>1?r[i++]=65533:t<65536?r[i++]=t:(t-=65536,r[i++]=55296|t>>10&1023,r[i++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&qt)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let a="";for(let n=0;n<t;n++)a+=String.fromCharCode(e[n]);return a})(r,i)},Xt=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let a=t-1;for(;a>=0&&128==(192&e[a]);)a--;return a<0||0===a?t:a+Zt[e[a]]>t?a:t};var Qt=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const ea=Object.prototype.toString,{Z_NO_FLUSH:ta,Z_SYNC_FLUSH:aa,Z_FULL_FLUSH:na,Z_FINISH:ia,Z_OK:ra,Z_STREAM_END:sa,Z_DEFAULT_COMPRESSION:oa,Z_DEFAULT_STRATEGY:la,Z_DEFLATED:ua}=He;function ca(e){this.options=Ht({level:oa,method:ua,chunkSize:16384,windowBits:15,memLevel:8,strategy:la},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Qt,this.strm.avail_out=0;let a=Wt.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(a!==ra)throw new Error(Ye[a]);if(t.header&&Wt.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?Jt(t.dictionary):"[object ArrayBuffer]"===ea.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,a=Wt.deflateSetDictionary(this.strm,e),a!==ra)throw new Error(Ye[a]);this._dict_set=!0}}function da(e,t){const a=new ca(t);if(a.push(e,!0),a.err)throw a.msg||Ye[a.err];return a.result}ca.prototype.push=function(e,t){const a=this.strm,n=this.options.chunkSize;let i,r;if(this.ended)return!1;for(r=t===~~t?t:!0===t?ia:ta,"string"==typeof e?a.input=Jt(e):"[object ArrayBuffer]"===ea.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;;)if(0===a.avail_out&&(a.output=new Uint8Array(n),a.next_out=0,a.avail_out=n),(r===aa||r===na)&&a.avail_out<=6)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else{if(i=Wt.deflate(a,r),i===sa)return a.next_out>0&&this.onData(a.output.subarray(0,a.next_out)),i=Wt.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===ra;if(0!==a.avail_out){if(r>0&&a.next_out>0)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else if(0===a.avail_in)break}else this.onData(a.output)}return!0},ca.prototype.onData=function(e){this.chunks.push(e)},ca.prototype.onEnd=function(e){e===ra&&(this.result=Gt(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var pa=function(e,t){return(t=t||{}).raw=!0,da(e,t)},ha=function(e,t){return(t=t||{}).gzip=!0,da(e,t)},fa={Deflate:ca,deflate:da,deflateRaw:pa,gzip:ha};const ma=16209;var ya=function(e,t){let a,n,i,r,s,o,l,u,c,d,p,h,f,m,y,g,b,v,_,w,A,k,S,N;const T=e.state;a=e.next_in,S=e.input,n=a+(e.avail_in-5),i=e.next_out,N=e.output,r=i-(t-e.avail_out),s=i+(e.avail_out-257),o=T.dmax,l=T.wsize,u=T.whave,c=T.wnext,d=T.window,p=T.hold,h=T.bits,f=T.lencode,m=T.distcode,y=(1<<T.lenbits)-1,g=(1<<T.distbits)-1;e:do{h<15&&(p+=S[a++]<<h,h+=8,p+=S[a++]<<h,h+=8),b=f[p&y];t:for(;;){if(v=b>>>24,p>>>=v,h-=v,v=b>>>16&255,0===v)N[i++]=65535&b;else{if(!(16&v)){if(64&v){if(32&v){T.mode=16191;break e}e.msg="invalid literal/length code",T.mode=ma;break e}b=f[(65535&b)+(p&(1<<v)-1)];continue t}for(_=65535&b,v&=15,v&&(h<v&&(p+=S[a++]<<h,h+=8),_+=p&(1<<v)-1,p>>>=v,h-=v),h<15&&(p+=S[a++]<<h,h+=8,p+=S[a++]<<h,h+=8),b=m[p&g];;){if(v=b>>>24,p>>>=v,h-=v,v=b>>>16&255,16&v){if(w=65535&b,v&=15,h<v&&(p+=S[a++]<<h,h+=8,h<v&&(p+=S[a++]<<h,h+=8)),w+=p&(1<<v)-1,w>o){e.msg="invalid distance too far back",T.mode=ma;break e}if(p>>>=v,h-=v,v=i-r,w>v){if(v=w-v,v>u&&T.sane){e.msg="invalid distance too far back",T.mode=ma;break e}if(A=0,k=d,0===c){if(A+=l-v,v<_){_-=v;do{N[i++]=d[A++]}while(--v);A=i-w,k=N}}else if(c<v){if(A+=l+c-v,v-=c,v<_){_-=v;do{N[i++]=d[A++]}while(--v);if(A=0,c<_){v=c,_-=v;do{N[i++]=d[A++]}while(--v);A=i-w,k=N}}}else if(A+=c-v,v<_){_-=v;do{N[i++]=d[A++]}while(--v);A=i-w,k=N}for(;_>2;)N[i++]=k[A++],N[i++]=k[A++],N[i++]=k[A++],_-=3;_&&(N[i++]=k[A++],_>1&&(N[i++]=k[A++]))}else{A=i-w;do{N[i++]=N[A++],N[i++]=N[A++],N[i++]=N[A++],_-=3}while(_>2);_&&(N[i++]=N[A++],_>1&&(N[i++]=N[A++]))}break}if(64&v){e.msg="invalid distance code",T.mode=ma;break e}b=m[(65535&b)+(p&(1<<v)-1)]}}break}}while(a<n&&i<s);_=h>>3,a-=_,h-=_<<3,p&=(1<<h)-1,e.next_in=a,e.next_out=i,e.avail_in=a<n?n-a+5:5-(a-n),e.avail_out=i<s?s-i+257:257-(i-s),T.hold=p,T.bits=h};const ga=15,ba=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),va=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),_a=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),wa=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Aa=(e,t,a,n,i,r,s,o)=>{const l=o.bits;let u,c,d,p,h,f,m=0,y=0,g=0,b=0,v=0,_=0,w=0,A=0,k=0,S=0,N=null;const T=new Uint16Array(16),M=new Uint16Array(16);let x,C,I,V=null;for(m=0;m<=ga;m++)T[m]=0;for(y=0;y<n;y++)T[t[a+y]]++;for(v=l,b=ga;b>=1&&0===T[b];b--);if(v>b&&(v=b),0===b)return i[r++]=20971520,i[r++]=20971520,o.bits=1,0;for(g=1;g<b&&0===T[g];g++);for(v<g&&(v=g),A=1,m=1;m<=ga;m++)if(A<<=1,A-=T[m],A<0)return-1;if(A>0&&(0===e||1!==b))return-1;for(M[1]=0,m=1;m<ga;m++)M[m+1]=M[m]+T[m];for(y=0;y<n;y++)0!==t[a+y]&&(s[M[t[a+y]]++]=y);if(0===e?(N=V=s,f=20):1===e?(N=ba,V=va,f=257):(N=_a,V=wa,f=0),S=0,y=0,m=g,h=r,_=v,w=0,d=-1,k=1<<v,p=k-1,1===e&&k>852||2===e&&k>592)return 1;for(;;){x=m-w,s[y]+1<f?(C=0,I=s[y]):s[y]>=f?(C=V[s[y]-f],I=N[s[y]-f]):(C=96,I=0),u=1<<m-w,c=1<<_,g=c;do{c-=u,i[h+(S>>w)+c]=x<<24|C<<16|I}while(0!==c);for(u=1<<m-1;S&u;)u>>=1;if(0!==u?(S&=u-1,S+=u):S=0,y++,0==--T[m]){if(m===b)break;m=t[a+s[y]]}if(m>v&&(S&p)!==d){for(0===w&&(w=v),h+=g,_=m-w,A=1<<_;_+w<b&&(A-=T[_+w],!(A<=0));)_++,A<<=1;if(k+=1<<_,1===e&&k>852||2===e&&k>592)return 1;d=S&p,i[d]=v<<24|_<<16|h-r}}return 0!==S&&(i[h+S]=m-w<<24|64<<16),o.bits=v,0};const{Z_FINISH:ka,Z_BLOCK:Sa,Z_TREES:Na,Z_OK:Ta,Z_STREAM_END:Ma,Z_NEED_DICT:xa,Z_STREAM_ERROR:Ca,Z_DATA_ERROR:Ia,Z_MEM_ERROR:Va,Z_BUF_ERROR:Ea,Z_DEFLATED:Fa}=He,Da=16180,Ra=16190,La=16191,Pa=16192,Ba=16194,Oa=16199,$a=16200,Ua=16206,ja=16209,za=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Wa(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Ya=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<Da||t.mode>16211?1:0},Ha=e=>{if(Ya(e))return Ca;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Da,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Ta},Ga=e=>{if(Ya(e))return Ca;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Ha(e)},qa=(e,t)=>{let a;if(Ya(e))return Ca;const n=e.state;return t<0?(a=0,t=-t):(a=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Ca:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=a,n.wbits=t,Ga(e))},Za=(e,t)=>{if(!e)return Ca;const a=new Wa;e.state=a,a.strm=e,a.window=null,a.mode=Da;const n=qa(e,t);return n!==Ta&&(e.state=null),n};let Ja,Ka,Xa=!0;const Qa=e=>{if(Xa){Ja=new Int32Array(512),Ka=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Aa(1,e.lens,0,288,Ja,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Aa(2,e.lens,0,32,Ka,0,e.work,{bits:5}),Xa=!1}e.lencode=Ja,e.lenbits=9,e.distcode=Ka,e.distbits=5},en=(e,t,a,n)=>{let i;const r=e.state;return null===r.window&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new Uint8Array(r.wsize)),n>=r.wsize?(r.window.set(t.subarray(a-r.wsize,a),0),r.wnext=0,r.whave=r.wsize):(i=r.wsize-r.wnext,i>n&&(i=n),r.window.set(t.subarray(a-n,a-n+i),r.wnext),(n-=i)?(r.window.set(t.subarray(a-n,a),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=i,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=i))),0};var tn=(e,t)=>{let a,n,i,r,s,o,l,u,c,d,p,h,f,m,y,g,b,v,_,w,A,k,S=0;const N=new Uint8Array(4);let T,M;const x=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ya(e)||!e.output||!e.input&&0!==e.avail_in)return Ca;a=e.state,a.mode===La&&(a.mode=Pa),s=e.next_out,i=e.output,l=e.avail_out,r=e.next_in,n=e.input,o=e.avail_in,u=a.hold,c=a.bits,d=o,p=l,k=Ta;e:for(;;)switch(a.mode){case Da:if(0===a.wrap){a.mode=Pa;break}for(;c<16;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}if(2&a.wrap&&35615===u){0===a.wbits&&(a.wbits=15),a.check=0,N[0]=255&u,N[1]=u>>>8&255,a.check=We(a.check,N,2,0),u=0,c=0,a.mode=16181;break}if(a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",a.mode=ja;break}if((15&u)!==Fa){e.msg="unknown compression method",a.mode=ja;break}if(u>>>=4,c-=4,A=8+(15&u),0===a.wbits&&(a.wbits=A),A>15||A>a.wbits){e.msg="invalid window size",a.mode=ja;break}a.dmax=1<<a.wbits,a.flags=0,e.adler=a.check=1,a.mode=512&u?16189:La,u=0,c=0;break;case 16181:for(;c<16;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}if(a.flags=u,(255&a.flags)!==Fa){e.msg="unknown compression method",a.mode=ja;break}if(57344&a.flags){e.msg="unknown header flags set",a.mode=ja;break}a.head&&(a.head.text=u>>8&1),512&a.flags&&4&a.wrap&&(N[0]=255&u,N[1]=u>>>8&255,a.check=We(a.check,N,2,0)),u=0,c=0,a.mode=16182;case 16182:for(;c<32;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}a.head&&(a.head.time=u),512&a.flags&&4&a.wrap&&(N[0]=255&u,N[1]=u>>>8&255,N[2]=u>>>16&255,N[3]=u>>>24&255,a.check=We(a.check,N,4,0)),u=0,c=0,a.mode=16183;case 16183:for(;c<16;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}a.head&&(a.head.xflags=255&u,a.head.os=u>>8),512&a.flags&&4&a.wrap&&(N[0]=255&u,N[1]=u>>>8&255,a.check=We(a.check,N,2,0)),u=0,c=0,a.mode=16184;case 16184:if(1024&a.flags){for(;c<16;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}a.length=u,a.head&&(a.head.extra_len=u),512&a.flags&&4&a.wrap&&(N[0]=255&u,N[1]=u>>>8&255,a.check=We(a.check,N,2,0)),u=0,c=0}else a.head&&(a.head.extra=null);a.mode=16185;case 16185:if(1024&a.flags&&(h=a.length,h>o&&(h=o),h&&(a.head&&(A=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(n.subarray(r,r+h),A)),512&a.flags&&4&a.wrap&&(a.check=We(a.check,n,h,r)),o-=h,r+=h,a.length-=h),a.length))break e;a.length=0,a.mode=16186;case 16186:if(2048&a.flags){if(0===o)break e;h=0;do{A=n[r+h++],a.head&&A&&a.length<65536&&(a.head.name+=String.fromCharCode(A))}while(A&&h<o);if(512&a.flags&&4&a.wrap&&(a.check=We(a.check,n,h,r)),o-=h,r+=h,A)break e}else a.head&&(a.head.name=null);a.length=0,a.mode=16187;case 16187:if(4096&a.flags){if(0===o)break e;h=0;do{A=n[r+h++],a.head&&A&&a.length<65536&&(a.head.comment+=String.fromCharCode(A))}while(A&&h<o);if(512&a.flags&&4&a.wrap&&(a.check=We(a.check,n,h,r)),o-=h,r+=h,A)break e}else a.head&&(a.head.comment=null);a.mode=16188;case 16188:if(512&a.flags){for(;c<16;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}if(4&a.wrap&&u!==(65535&a.check)){e.msg="header crc mismatch",a.mode=ja;break}u=0,c=0}a.head&&(a.head.hcrc=a.flags>>9&1,a.head.done=!0),e.adler=a.check=0,a.mode=La;break;case 16189:for(;c<32;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}e.adler=a.check=za(u),u=0,c=0,a.mode=Ra;case Ra:if(0===a.havedict)return e.next_out=s,e.avail_out=l,e.next_in=r,e.avail_in=o,a.hold=u,a.bits=c,xa;e.adler=a.check=1,a.mode=La;case La:if(t===Sa||t===Na)break e;case Pa:if(a.last){u>>>=7&c,c-=7&c,a.mode=Ua;break}for(;c<3;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}switch(a.last=1&u,u>>>=1,c-=1,3&u){case 0:a.mode=16193;break;case 1:if(Qa(a),a.mode=Oa,t===Na){u>>>=2,c-=2;break e}break;case 2:a.mode=16196;break;case 3:e.msg="invalid block type",a.mode=ja}u>>>=2,c-=2;break;case 16193:for(u>>>=7&c,c-=7&c;c<32;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",a.mode=ja;break}if(a.length=65535&u,u=0,c=0,a.mode=Ba,t===Na)break e;case Ba:a.mode=16195;case 16195:if(h=a.length,h){if(h>o&&(h=o),h>l&&(h=l),0===h)break e;i.set(n.subarray(r,r+h),s),o-=h,r+=h,l-=h,s+=h,a.length-=h;break}a.mode=La;break;case 16196:for(;c<14;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}if(a.nlen=257+(31&u),u>>>=5,c-=5,a.ndist=1+(31&u),u>>>=5,c-=5,a.ncode=4+(15&u),u>>>=4,c-=4,a.nlen>286||a.ndist>30){e.msg="too many length or distance symbols",a.mode=ja;break}a.have=0,a.mode=16197;case 16197:for(;a.have<a.ncode;){for(;c<3;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}a.lens[x[a.have++]]=7&u,u>>>=3,c-=3}for(;a.have<19;)a.lens[x[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,T={bits:a.lenbits},k=Aa(0,a.lens,0,19,a.lencode,0,a.work,T),a.lenbits=T.bits,k){e.msg="invalid code lengths set",a.mode=ja;break}a.have=0,a.mode=16198;case 16198:for(;a.have<a.nlen+a.ndist;){for(;S=a.lencode[u&(1<<a.lenbits)-1],y=S>>>24,g=S>>>16&255,b=65535&S,!(y<=c);){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}if(b<16)u>>>=y,c-=y,a.lens[a.have++]=b;else{if(16===b){for(M=y+2;c<M;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}if(u>>>=y,c-=y,0===a.have){e.msg="invalid bit length repeat",a.mode=ja;break}A=a.lens[a.have-1],h=3+(3&u),u>>>=2,c-=2}else if(17===b){for(M=y+3;c<M;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}u>>>=y,c-=y,A=0,h=3+(7&u),u>>>=3,c-=3}else{for(M=y+7;c<M;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}u>>>=y,c-=y,A=0,h=11+(127&u),u>>>=7,c-=7}if(a.have+h>a.nlen+a.ndist){e.msg="invalid bit length repeat",a.mode=ja;break}for(;h--;)a.lens[a.have++]=A}}if(a.mode===ja)break;if(0===a.lens[256]){e.msg="invalid code -- missing end-of-block",a.mode=ja;break}if(a.lenbits=9,T={bits:a.lenbits},k=Aa(1,a.lens,0,a.nlen,a.lencode,0,a.work,T),a.lenbits=T.bits,k){e.msg="invalid literal/lengths set",a.mode=ja;break}if(a.distbits=6,a.distcode=a.distdyn,T={bits:a.distbits},k=Aa(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,T),a.distbits=T.bits,k){e.msg="invalid distances set",a.mode=ja;break}if(a.mode=Oa,t===Na)break e;case Oa:a.mode=$a;case $a:if(o>=6&&l>=258){e.next_out=s,e.avail_out=l,e.next_in=r,e.avail_in=o,a.hold=u,a.bits=c,ya(e,p),s=e.next_out,i=e.output,l=e.avail_out,r=e.next_in,n=e.input,o=e.avail_in,u=a.hold,c=a.bits,a.mode===La&&(a.back=-1);break}for(a.back=0;S=a.lencode[u&(1<<a.lenbits)-1],y=S>>>24,g=S>>>16&255,b=65535&S,!(y<=c);){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}if(g&&!(240&g)){for(v=y,_=g,w=b;S=a.lencode[w+((u&(1<<v+_)-1)>>v)],y=S>>>24,g=S>>>16&255,b=65535&S,!(v+y<=c);){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}u>>>=v,c-=v,a.back+=v}if(u>>>=y,c-=y,a.back+=y,a.length=b,0===g){a.mode=16205;break}if(32&g){a.back=-1,a.mode=La;break}if(64&g){e.msg="invalid literal/length code",a.mode=ja;break}a.extra=15&g,a.mode=16201;case 16201:if(a.extra){for(M=a.extra;c<M;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}a.length+=u&(1<<a.extra)-1,u>>>=a.extra,c-=a.extra,a.back+=a.extra}a.was=a.length,a.mode=16202;case 16202:for(;S=a.distcode[u&(1<<a.distbits)-1],y=S>>>24,g=S>>>16&255,b=65535&S,!(y<=c);){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}if(!(240&g)){for(v=y,_=g,w=b;S=a.distcode[w+((u&(1<<v+_)-1)>>v)],y=S>>>24,g=S>>>16&255,b=65535&S,!(v+y<=c);){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}u>>>=v,c-=v,a.back+=v}if(u>>>=y,c-=y,a.back+=y,64&g){e.msg="invalid distance code",a.mode=ja;break}a.offset=b,a.extra=15&g,a.mode=16203;case 16203:if(a.extra){for(M=a.extra;c<M;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}a.offset+=u&(1<<a.extra)-1,u>>>=a.extra,c-=a.extra,a.back+=a.extra}if(a.offset>a.dmax){e.msg="invalid distance too far back",a.mode=ja;break}a.mode=16204;case 16204:if(0===l)break e;if(h=p-l,a.offset>h){if(h=a.offset-h,h>a.whave&&a.sane){e.msg="invalid distance too far back",a.mode=ja;break}h>a.wnext?(h-=a.wnext,f=a.wsize-h):f=a.wnext-h,h>a.length&&(h=a.length),m=a.window}else m=i,f=s-a.offset,h=a.length;h>l&&(h=l),l-=h,a.length-=h;do{i[s++]=m[f++]}while(--h);0===a.length&&(a.mode=$a);break;case 16205:if(0===l)break e;i[s++]=a.length,l--,a.mode=$a;break;case Ua:if(a.wrap){for(;c<32;){if(0===o)break e;o--,u|=n[r++]<<c,c+=8}if(p-=l,e.total_out+=p,a.total+=p,4&a.wrap&&p&&(e.adler=a.check=a.flags?We(a.check,i,p,s-p):je(a.check,i,p,s-p)),p=l,4&a.wrap&&(a.flags?u:za(u))!==a.check){e.msg="incorrect data check",a.mode=ja;break}u=0,c=0}a.mode=16207;case 16207:if(a.wrap&&a.flags){for(;c<32;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}if(4&a.wrap&&u!==(4294967295&a.total)){e.msg="incorrect length check",a.mode=ja;break}u=0,c=0}a.mode=16208;case 16208:k=Ma;break e;case ja:k=Ia;break e;case 16210:return Va;default:return Ca}return e.next_out=s,e.avail_out=l,e.next_in=r,e.avail_in=o,a.hold=u,a.bits=c,(a.wsize||p!==e.avail_out&&a.mode<ja&&(a.mode<Ua||t!==ka))&&en(e,e.output,e.next_out,p-e.avail_out),d-=e.avail_in,p-=e.avail_out,e.total_in+=d,e.total_out+=p,a.total+=p,4&a.wrap&&p&&(e.adler=a.check=a.flags?We(a.check,i,p,e.next_out-p):je(a.check,i,p,e.next_out-p)),e.data_type=a.bits+(a.last?64:0)+(a.mode===La?128:0)+(a.mode===Oa||a.mode===Ba?256:0),(0===d&&0===p||t===ka)&&k===Ta&&(k=Ea),k},an={inflateReset:Ga,inflateReset2:qa,inflateResetKeep:Ha,inflateInit:e=>Za(e,15),inflateInit2:Za,inflate:tn,inflateEnd:e=>{if(Ya(e))return Ca;let t=e.state;return t.window&&(t.window=null),e.state=null,Ta},inflateGetHeader:(e,t)=>{if(Ya(e))return Ca;const a=e.state;return 2&a.wrap?(a.head=t,t.done=!1,Ta):Ca},inflateSetDictionary:(e,t)=>{const a=t.length;let n,i,r;return Ya(e)?Ca:(n=e.state,0!==n.wrap&&n.mode!==Ra?Ca:n.mode===Ra&&(i=1,i=je(i,t,a,0),i!==n.check)?Ia:(r=en(e,t,a,a),r?(n.mode=16210,Va):(n.havedict=1,Ta)))},inflateInfo:"pako inflate (from Nodeca project)"};var nn=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const rn=Object.prototype.toString,{Z_NO_FLUSH:sn,Z_FINISH:on,Z_OK:ln,Z_STREAM_END:un,Z_NEED_DICT:cn,Z_STREAM_ERROR:dn,Z_DATA_ERROR:pn,Z_MEM_ERROR:hn}=He;function fn(e){this.options=Ht({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Qt,this.strm.avail_out=0;let a=an.inflateInit2(this.strm,t.windowBits);if(a!==ln)throw new Error(Ye[a]);if(this.header=new nn,an.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Jt(t.dictionary):"[object ArrayBuffer]"===rn.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(a=an.inflateSetDictionary(this.strm,t.dictionary),a!==ln)))throw new Error(Ye[a])}function mn(e,t){const a=new fn(t);if(a.push(e),a.err)throw a.msg||Ye[a.err];return a.result}fn.prototype.push=function(e,t){const a=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let r,s,o;if(this.ended)return!1;for(s=t===~~t?t:!0===t?on:sn,"[object ArrayBuffer]"===rn.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(n),a.next_out=0,a.avail_out=n),r=an.inflate(a,s),r===cn&&i&&(r=an.inflateSetDictionary(a,i),r===ln?r=an.inflate(a,s):r===pn&&(r=cn));a.avail_in>0&&r===un&&a.state.wrap>0&&0!==e[a.next_in];)an.inflateReset(a),r=an.inflate(a,s);switch(r){case dn:case pn:case cn:case hn:return this.onEnd(r),this.ended=!0,!1}if(o=a.avail_out,a.next_out&&(0===a.avail_out||r===un))if("string"===this.options.to){let e=Xt(a.output,a.next_out),t=a.next_out-e,i=Kt(a.output,e);a.next_out=t,a.avail_out=n-t,t&&a.output.set(a.output.subarray(e,e+t),0),this.onData(i)}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(r!==ln||0!==o){if(r===un)return r=an.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===a.avail_in)break}}return!0},fn.prototype.onData=function(e){this.chunks.push(e)},fn.prototype.onEnd=function(e){e===ln&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Gt(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var yn=function(e,t){return(t=t||{}).raw=!0,mn(e,t)},gn={Inflate:fn,inflate:mn,inflateRaw:yn,ungzip:mn};const{Deflate:bn,deflate:vn,deflateRaw:_n,gzip:wn}=fa,{Inflate:An,inflate:kn,inflateRaw:Sn,ungzip:Nn}=gn;var Tn={Deflate:bn,deflate:vn,deflateRaw:_n,gzip:wn,Inflate:An,inflate:kn,inflateRaw:Sn,ungzip:Nn,constants:He},Mn="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},xn=[],Cn=[],In="undefined"!=typeof Uint8Array?Uint8Array:Array,Vn=!1;function En(){Vn=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)xn[t]=e[t],Cn[e.charCodeAt(t)]=t;Cn["-".charCodeAt(0)]=62,Cn["_".charCodeAt(0)]=63}function Fn(e,t,a){for(var n,i,r=[],s=t;s<a;s+=3)n=(e[s]<<16)+(e[s+1]<<8)+e[s+2],r.push(xn[(i=n)>>18&63]+xn[i>>12&63]+xn[i>>6&63]+xn[63&i]);return r.join("")}function Dn(e){var t;Vn||En();for(var a=e.length,n=a%3,i="",r=[],s=16383,o=0,l=a-n;o<l;o+=s)r.push(Fn(e,o,o+s>l?l:o+s));return 1===n?(t=e[a-1],i+=xn[t>>2],i+=xn[t<<4&63],i+="=="):2===n&&(t=(e[a-2]<<8)+e[a-1],i+=xn[t>>10],i+=xn[t>>4&63],i+=xn[t<<2&63],i+="="),r.push(i),r.join("")}function Rn(e,t,a,n,i){var r,s,o=8*i-n-1,l=(1<<o)-1,u=l>>1,c=-7,d=a?i-1:0,p=a?-1:1,h=e[t+d];for(d+=p,r=h&(1<<-c)-1,h>>=-c,c+=o;c>0;r=256*r+e[t+d],d+=p,c-=8);for(s=r&(1<<-c)-1,r>>=-c,c+=n;c>0;s=256*s+e[t+d],d+=p,c-=8);if(0===r)r=1-u;else{if(r===l)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,n),r-=u}return(h?-1:1)*s*Math.pow(2,r-n)}function Ln(e,t,a,n,i,r){var s,o,l,u=8*r-i-1,c=(1<<u)-1,d=c>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:r-1,f=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+d>=1?p/l:p*Math.pow(2,1-d))*l>=2&&(s++,l/=2),s+d>=c?(o=0,s=c):s+d>=1?(o=(t*l-1)*Math.pow(2,i),s+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[a+h]=255&o,h+=f,o/=256,i-=8);for(s=s<<i|o,u+=i;u>0;e[a+h]=255&s,h+=f,s/=256,u-=8);e[a+h-f]|=128*m}var Pn={}.toString,Bn=Array.isArray||function(e){return"[object Array]"==Pn.call(e)};function On(){return Un.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function $n(e,t){if(On()<t)throw new RangeError("Invalid typed array length");return Un.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Un.prototype:(null===e&&(e=new Un(t)),e.length=t),e}function Un(e,t,a){if(!(Un.TYPED_ARRAY_SUPPORT||this instanceof Un))return new Un(e,t,a);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return Wn(this,e)}return jn(this,e,t,a)}function jn(e,t,a,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,a,n){if(t.byteLength,a<0||t.byteLength<a)throw new RangeError("'offset' is out of bounds");if(t.byteLength<a+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===a&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,a):new Uint8Array(t,a,n);Un.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Un.prototype:e=Yn(e,t);return e}(e,t,a,n):"string"==typeof t?function(e,t,a){"string"==typeof a&&""!==a||(a="utf8");if(!Un.isEncoding(a))throw new TypeError('"encoding" must be a valid string encoding');var n=0|qn(t,a);e=$n(e,n);var i=e.write(t,a);i!==n&&(e=e.slice(0,i));return e}(e,t,a):function(e,t){if(Gn(t)){var a=0|Hn(t.length);return 0===(e=$n(e,a)).length||t.copy(e,0,0,a),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?$n(e,0):Yn(e,t);if("Buffer"===t.type&&Bn(t.data))return Yn(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function zn(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function Wn(e,t){if(zn(t),e=$n(e,t<0?0:0|Hn(t)),!Un.TYPED_ARRAY_SUPPORT)for(var a=0;a<t;++a)e[a]=0;return e}function Yn(e,t){var a=t.length<0?0:0|Hn(t.length);e=$n(e,a);for(var n=0;n<a;n+=1)e[n]=255&t[n];return e}function Hn(e){if(e>=On())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+On().toString(16)+" bytes");return 0|e}function Gn(e){return!(null==e||!e._isBuffer)}function qn(e,t){if(Gn(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var a=e.length;if(0===a)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return a;case"utf8":case"utf-8":case void 0:return wi(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*a;case"hex":return a>>>1;case"base64":return Ai(e).length;default:if(n)return wi(e).length;t=(""+t).toLowerCase(),n=!0}}function Zn(e,t,a){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===a||a>this.length)&&(a=this.length),a<=0)return"";if((a>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return ci(this,t,a);case"utf8":case"utf-8":return si(this,t,a);case"ascii":return li(this,t,a);case"latin1":case"binary":return ui(this,t,a);case"base64":return ri(this,t,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return di(this,t,a);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function Jn(e,t,a){var n=e[t];e[t]=e[a],e[a]=n}function Kn(e,t,a,n,i){if(0===e.length)return-1;if("string"==typeof a?(n=a,a=0):a>2147483647?a=2147483647:a<-2147483648&&(a=-2147483648),a=+a,isNaN(a)&&(a=i?0:e.length-1),a<0&&(a=e.length+a),a>=e.length){if(i)return-1;a=e.length-1}else if(a<0){if(!i)return-1;a=0}if("string"==typeof t&&(t=Un.from(t,n)),Gn(t))return 0===t.length?-1:Xn(e,t,a,n,i);if("number"==typeof t)return t&=255,Un.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,a):Uint8Array.prototype.lastIndexOf.call(e,t,a):Xn(e,[t],a,n,i);throw new TypeError("val must be string, number or Buffer")}function Xn(e,t,a,n,i){var r,s=1,o=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,o/=2,l/=2,a/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(r=a;r<o;r++)if(u(e,r)===u(t,-1===c?0:r-c)){if(-1===c&&(c=r),r-c+1===l)return c*s}else-1!==c&&(r-=r-c),c=-1}else for(a+l>o&&(a=o-l),r=a;r>=0;r--){for(var d=!0,p=0;p<l;p++)if(u(e,r+p)!==u(t,p)){d=!1;break}if(d)return r}return-1}function Qn(e,t,a,n){a=Number(a)||0;var i=e.length-a;n?(n=Number(n))>i&&(n=i):n=i;var r=t.length;if(r%2!=0)throw new TypeError("Invalid hex string");n>r/2&&(n=r/2);for(var s=0;s<n;++s){var o=parseInt(t.substr(2*s,2),16);if(isNaN(o))return s;e[a+s]=o}return s}function ei(e,t,a,n){return ki(wi(t,e.length-a),e,a,n)}function ti(e,t,a,n){return ki(function(e){for(var t=[],a=0;a<e.length;++a)t.push(255&e.charCodeAt(a));return t}(t),e,a,n)}function ai(e,t,a,n){return ti(e,t,a,n)}function ni(e,t,a,n){return ki(Ai(t),e,a,n)}function ii(e,t,a,n){return ki(function(e,t){for(var a,n,i,r=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(a=e.charCodeAt(s))>>8,i=a%256,r.push(i),r.push(n);return r}(t,e.length-a),e,a,n)}function ri(e,t,a){return 0===t&&a===e.length?Dn(e):Dn(e.slice(t,a))}function si(e,t,a){a=Math.min(e.length,a);for(var n=[],i=t;i<a;){var r,s,o,l,u=e[i],c=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=a)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(r=e[i+1]))&&(l=(31&u)<<6|63&r)>127&&(c=l);break;case 3:r=e[i+1],s=e[i+2],128==(192&r)&&128==(192&s)&&(l=(15&u)<<12|(63&r)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:r=e[i+1],s=e[i+2],o=e[i+3],128==(192&r)&&128==(192&s)&&128==(192&o)&&(l=(15&u)<<18|(63&r)<<12|(63&s)<<6|63&o)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=d}return function(e){var t=e.length;if(t<=oi)return String.fromCharCode.apply(String,e);var a="",n=0;for(;n<t;)a+=String.fromCharCode.apply(String,e.slice(n,n+=oi));return a}(n)}Un.TYPED_ARRAY_SUPPORT=void 0===Mn.TYPED_ARRAY_SUPPORT||Mn.TYPED_ARRAY_SUPPORT,On(),Un.poolSize=8192,Un._augment=function(e){return e.__proto__=Un.prototype,e},Un.from=function(e,t,a){return jn(null,e,t,a)},Un.TYPED_ARRAY_SUPPORT&&(Un.prototype.__proto__=Uint8Array.prototype,Un.__proto__=Uint8Array),Un.alloc=function(e,t,a){return function(e,t,a,n){return zn(t),t<=0?$n(e,t):void 0!==a?"string"==typeof n?$n(e,t).fill(a,n):$n(e,t).fill(a):$n(e,t)}(null,e,t,a)},Un.allocUnsafe=function(e){return Wn(null,e)},Un.allocUnsafeSlow=function(e){return Wn(null,e)},Un.isBuffer=function(e){return null!=e&&(!!e._isBuffer||Si(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Si(e.slice(0,0))}(e))},Un.compare=function(e,t){if(!Gn(e)||!Gn(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var a=e.length,n=t.length,i=0,r=Math.min(a,n);i<r;++i)if(e[i]!==t[i]){a=e[i],n=t[i];break}return a<n?-1:n<a?1:0},Un.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Un.concat=function(e,t){if(!Bn(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Un.alloc(0);var a;if(void 0===t)for(t=0,a=0;a<e.length;++a)t+=e[a].length;var n=Un.allocUnsafe(t),i=0;for(a=0;a<e.length;++a){var r=e[a];if(!Gn(r))throw new TypeError('"list" argument must be an Array of Buffers');r.copy(n,i),i+=r.length}return n},Un.byteLength=qn,Un.prototype._isBuffer=!0,Un.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)Jn(this,t,t+1);return this},Un.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)Jn(this,t,t+3),Jn(this,t+1,t+2);return this},Un.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)Jn(this,t,t+7),Jn(this,t+1,t+6),Jn(this,t+2,t+5),Jn(this,t+3,t+4);return this},Un.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?si(this,0,e):Zn.apply(this,arguments)},Un.prototype.equals=function(e){if(!Gn(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Un.compare(this,e)},Un.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},Un.prototype.compare=function(e,t,a,n,i){if(!Gn(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===a&&(a=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||a>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=a)return 0;if(n>=i)return-1;if(t>=a)return 1;if(this===e)return 0;for(var r=(i>>>=0)-(n>>>=0),s=(a>>>=0)-(t>>>=0),o=Math.min(r,s),l=this.slice(n,i),u=e.slice(t,a),c=0;c<o;++c)if(l[c]!==u[c]){r=l[c],s=u[c];break}return r<s?-1:s<r?1:0},Un.prototype.includes=function(e,t,a){return-1!==this.indexOf(e,t,a)},Un.prototype.indexOf=function(e,t,a){return Kn(this,e,t,a,!0)},Un.prototype.lastIndexOf=function(e,t,a){return Kn(this,e,t,a,!1)},Un.prototype.write=function(e,t,a,n){if(void 0===t)n="utf8",a=this.length,t=0;else if(void 0===a&&"string"==typeof t)n=t,a=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(a)?(a|=0,void 0===n&&(n="utf8")):(n=a,a=void 0)}var i=this.length-t;if((void 0===a||a>i)&&(a=i),e.length>0&&(a<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var r=!1;;)switch(n){case"hex":return Qn(this,e,t,a);case"utf8":case"utf-8":return ei(this,e,t,a);case"ascii":return ti(this,e,t,a);case"latin1":case"binary":return ai(this,e,t,a);case"base64":return ni(this,e,t,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ii(this,e,t,a);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),r=!0}},Un.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var oi=4096;function li(e,t,a){var n="";a=Math.min(e.length,a);for(var i=t;i<a;++i)n+=String.fromCharCode(127&e[i]);return n}function ui(e,t,a){var n="";a=Math.min(e.length,a);for(var i=t;i<a;++i)n+=String.fromCharCode(e[i]);return n}function ci(e,t,a){var n=e.length;(!t||t<0)&&(t=0),(!a||a<0||a>n)&&(a=n);for(var i="",r=t;r<a;++r)i+=_i(e[r]);return i}function di(e,t,a){for(var n=e.slice(t,a),i="",r=0;r<n.length;r+=2)i+=String.fromCharCode(n[r]+256*n[r+1]);return i}function pi(e,t,a){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>a)throw new RangeError("Trying to access beyond buffer length")}function hi(e,t,a,n,i,r){if(!Gn(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<r)throw new RangeError('"value" argument is out of bounds');if(a+n>e.length)throw new RangeError("Index out of range")}function fi(e,t,a,n){t<0&&(t=65535+t+1);for(var i=0,r=Math.min(e.length-a,2);i<r;++i)e[a+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function mi(e,t,a,n){t<0&&(t=4294967295+t+1);for(var i=0,r=Math.min(e.length-a,4);i<r;++i)e[a+i]=t>>>8*(n?i:3-i)&255}function yi(e,t,a,n,i,r){if(a+n>e.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("Index out of range")}function gi(e,t,a,n,i){return i||yi(e,0,a,4),Ln(e,t,a,n,23,4),a+4}function bi(e,t,a,n,i){return i||yi(e,0,a,8),Ln(e,t,a,n,52,8),a+8}Un.prototype.slice=function(e,t){var a,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),Un.TYPED_ARRAY_SUPPORT)(a=this.subarray(e,t)).__proto__=Un.prototype;else{var i=t-e;a=new Un(i,void 0);for(var r=0;r<i;++r)a[r]=this[r+e]}return a},Un.prototype.readUIntLE=function(e,t,a){e|=0,t|=0,a||pi(e,t,this.length);for(var n=this[e],i=1,r=0;++r<t&&(i*=256);)n+=this[e+r]*i;return n},Un.prototype.readUIntBE=function(e,t,a){e|=0,t|=0,a||pi(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},Un.prototype.readUInt8=function(e,t){return t||pi(e,1,this.length),this[e]},Un.prototype.readUInt16LE=function(e,t){return t||pi(e,2,this.length),this[e]|this[e+1]<<8},Un.prototype.readUInt16BE=function(e,t){return t||pi(e,2,this.length),this[e]<<8|this[e+1]},Un.prototype.readUInt32LE=function(e,t){return t||pi(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Un.prototype.readUInt32BE=function(e,t){return t||pi(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Un.prototype.readIntLE=function(e,t,a){e|=0,t|=0,a||pi(e,t,this.length);for(var n=this[e],i=1,r=0;++r<t&&(i*=256);)n+=this[e+r]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},Un.prototype.readIntBE=function(e,t,a){e|=0,t|=0,a||pi(e,t,this.length);for(var n=t,i=1,r=this[e+--n];n>0&&(i*=256);)r+=this[e+--n]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},Un.prototype.readInt8=function(e,t){return t||pi(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Un.prototype.readInt16LE=function(e,t){t||pi(e,2,this.length);var a=this[e]|this[e+1]<<8;return 32768&a?4294901760|a:a},Un.prototype.readInt16BE=function(e,t){t||pi(e,2,this.length);var a=this[e+1]|this[e]<<8;return 32768&a?4294901760|a:a},Un.prototype.readInt32LE=function(e,t){return t||pi(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Un.prototype.readInt32BE=function(e,t){return t||pi(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Un.prototype.readFloatLE=function(e,t){return t||pi(e,4,this.length),Rn(this,e,!0,23,4)},Un.prototype.readFloatBE=function(e,t){return t||pi(e,4,this.length),Rn(this,e,!1,23,4)},Un.prototype.readDoubleLE=function(e,t){return t||pi(e,8,this.length),Rn(this,e,!0,52,8)},Un.prototype.readDoubleBE=function(e,t){return t||pi(e,8,this.length),Rn(this,e,!1,52,8)},Un.prototype.writeUIntLE=function(e,t,a,n){(e=+e,t|=0,a|=0,n)||hi(this,e,t,a,Math.pow(2,8*a)-1,0);var i=1,r=0;for(this[t]=255&e;++r<a&&(i*=256);)this[t+r]=e/i&255;return t+a},Un.prototype.writeUIntBE=function(e,t,a,n){(e=+e,t|=0,a|=0,n)||hi(this,e,t,a,Math.pow(2,8*a)-1,0);var i=a-1,r=1;for(this[t+i]=255&e;--i>=0&&(r*=256);)this[t+i]=e/r&255;return t+a},Un.prototype.writeUInt8=function(e,t,a){return e=+e,t|=0,a||hi(this,e,t,1,255,0),Un.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Un.prototype.writeUInt16LE=function(e,t,a){return e=+e,t|=0,a||hi(this,e,t,2,65535,0),Un.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):fi(this,e,t,!0),t+2},Un.prototype.writeUInt16BE=function(e,t,a){return e=+e,t|=0,a||hi(this,e,t,2,65535,0),Un.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):fi(this,e,t,!1),t+2},Un.prototype.writeUInt32LE=function(e,t,a){return e=+e,t|=0,a||hi(this,e,t,4,4294967295,0),Un.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):mi(this,e,t,!0),t+4},Un.prototype.writeUInt32BE=function(e,t,a){return e=+e,t|=0,a||hi(this,e,t,4,4294967295,0),Un.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):mi(this,e,t,!1),t+4},Un.prototype.writeIntLE=function(e,t,a,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*a-1);hi(this,e,t,a,i-1,-i)}var r=0,s=1,o=0;for(this[t]=255&e;++r<a&&(s*=256);)e<0&&0===o&&0!==this[t+r-1]&&(o=1),this[t+r]=(e/s|0)-o&255;return t+a},Un.prototype.writeIntBE=function(e,t,a,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*a-1);hi(this,e,t,a,i-1,-i)}var r=a-1,s=1,o=0;for(this[t+r]=255&e;--r>=0&&(s*=256);)e<0&&0===o&&0!==this[t+r+1]&&(o=1),this[t+r]=(e/s|0)-o&255;return t+a},Un.prototype.writeInt8=function(e,t,a){return e=+e,t|=0,a||hi(this,e,t,1,127,-128),Un.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Un.prototype.writeInt16LE=function(e,t,a){return e=+e,t|=0,a||hi(this,e,t,2,32767,-32768),Un.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):fi(this,e,t,!0),t+2},Un.prototype.writeInt16BE=function(e,t,a){return e=+e,t|=0,a||hi(this,e,t,2,32767,-32768),Un.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):fi(this,e,t,!1),t+2},Un.prototype.writeInt32LE=function(e,t,a){return e=+e,t|=0,a||hi(this,e,t,4,2147483647,-2147483648),Un.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):mi(this,e,t,!0),t+4},Un.prototype.writeInt32BE=function(e,t,a){return e=+e,t|=0,a||hi(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Un.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):mi(this,e,t,!1),t+4},Un.prototype.writeFloatLE=function(e,t,a){return gi(this,e,t,!0,a)},Un.prototype.writeFloatBE=function(e,t,a){return gi(this,e,t,!1,a)},Un.prototype.writeDoubleLE=function(e,t,a){return bi(this,e,t,!0,a)},Un.prototype.writeDoubleBE=function(e,t,a){return bi(this,e,t,!1,a)},Un.prototype.copy=function(e,t,a,n){if(a||(a=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<a&&(n=a),n===a)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(a<0||a>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-a&&(n=e.length-t+a);var i,r=n-a;if(this===e&&a<t&&t<n)for(i=r-1;i>=0;--i)e[i+t]=this[i+a];else if(r<1e3||!Un.TYPED_ARRAY_SUPPORT)for(i=0;i<r;++i)e[i+t]=this[i+a];else Uint8Array.prototype.set.call(e,this.subarray(a,a+r),t);return r},Un.prototype.fill=function(e,t,a,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,a=this.length):"string"==typeof a&&(n=a,a=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Un.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<a)throw new RangeError("Out of range index");if(a<=t)return this;var r;if(t>>>=0,a=void 0===a?this.length:a>>>0,e||(e=0),"number"==typeof e)for(r=t;r<a;++r)this[r]=e;else{var s=Gn(e)?e:wi(new Un(e,n).toString()),o=s.length;for(r=0;r<a-t;++r)this[r+t]=s[r%o]}return this};var vi=/[^+\/0-9A-Za-z-_]/g;function _i(e){return e<16?"0"+e.toString(16):e.toString(16)}function wi(e,t){var a;t=t||1/0;for(var n=e.length,i=null,r=[],s=0;s<n;++s){if((a=e.charCodeAt(s))>55295&&a<57344){if(!i){if(a>56319){(t-=3)>-1&&r.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&r.push(239,191,189);continue}i=a;continue}if(a<56320){(t-=3)>-1&&r.push(239,191,189),i=a;continue}a=65536+(i-55296<<10|a-56320)}else i&&(t-=3)>-1&&r.push(239,191,189);if(i=null,a<128){if((t-=1)<0)break;r.push(a)}else if(a<2048){if((t-=2)<0)break;r.push(a>>6|192,63&a|128)}else if(a<65536){if((t-=3)<0)break;r.push(a>>12|224,a>>6&63|128,63&a|128)}else{if(!(a<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;r.push(a>>18|240,a>>12&63|128,a>>6&63|128,63&a|128)}}return r}function Ai(e){return function(e){var t,a,n,i,r,s;Vn||En();var o=e.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");r="="===e[o-2]?2:"="===e[o-1]?1:0,s=new In(3*o/4-r),n=r>0?o-4:o;var l=0;for(t=0,a=0;t<n;t+=4,a+=3)i=Cn[e.charCodeAt(t)]<<18|Cn[e.charCodeAt(t+1)]<<12|Cn[e.charCodeAt(t+2)]<<6|Cn[e.charCodeAt(t+3)],s[l++]=i>>16&255,s[l++]=i>>8&255,s[l++]=255&i;return 2===r?(i=Cn[e.charCodeAt(t)]<<2|Cn[e.charCodeAt(t+1)]>>4,s[l++]=255&i):1===r&&(i=Cn[e.charCodeAt(t)]<<10|Cn[e.charCodeAt(t+1)]<<4|Cn[e.charCodeAt(t+2)]>>2,s[l++]=i>>8&255,s[l++]=255&i),s}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(vi,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ki(e,t,a,n){for(var i=0;i<n&&!(i+a>=t.length||i>=e.length);++i)t[i+a]=e[i];return i}function Si(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}const Ni={files:{},items:{},folders:{}};function Ti(e){return Ni.files[e]}function Mi(){return Ni.folders}function xi(e){return Ni.folders[e]}function Ci(e,t){for(const a of Object.values(Ni.folders))if(a.name===e&&a.parent===t)return a}function Ii(e,t){for(const a of Object.values(Ni.items))if(a.name===e&&a.folder._id===t)return a}function Vi(){return Ni.items}function Ei(e){return Ni.items[e]}function Fi(e,t){Ni.items[e]=t.rootItem;for(const[e,a]of Object.entries(t.metadata)){if(t.files[e]&&(Ni.files[e]={blob:new Blob([new Uint8Array(t.files[e])],{type:a.mimeType}),hash:a.hash,itemName:a.name,itemType:a.type,mimeType:a.mimeType}),a.attachments)for(const n of a.attachments){const a=Ri(e,n.name,n.queryParam,n.index);Ni.files[a]={blob:new Blob([new Uint8Array(t.files[a])],{type:n.mimeType}),hash:n.hash,itemName:n.name,itemType:n.type,mimeType:n.mimeType}}Ni.items[e]=a}for(const a of Object.values(t.folders))a._id=e+":"+a._id,a.parent=e+":"+a.parent,Ni.folders[a._id]=a}async function Di(e,t){const a=Un.from(await e.arrayBuffer());let n=0;n+=8;const i=a.readInt32LE(8);n+=4;const r=new TextDecoder,s=a.subarray(n,n+i);n+=i;const o=JSON.parse(r.decode(s));o.root=t+"/"+o.root;let l=0;const u=Tn.ungzip(a.subarray(n)),c=Un.from(u),d=c.subarray(l,l+o.metadataSize);l+=o.metadataSize;const p=JSON.parse(r.decode(d)),h={};Object.entries(p).forEach((([e,a])=>{const n=t+"/"+e;a._id=n,h[n]=a,a.folder._id=t+":"+a.folder._id;for(const e of a.links)e.to=t+"/"+e.to}));const f=c.subarray(l,l+o.foldersSize);l+=o.foldersSize;const m=JSON.parse(r.decode(f)),y={};for(const[,e]of Object.entries(h))if(e.filesize&&(y[e._id]={start:l+(e.packageFileOffset||0),end:l+(e.packageFileOffset||0)+e.filesize}),e.attachments)for(const t of e.attachments)y[Ri(e._id,t.name,t.queryParam,t.index)]={start:l+(t.packageFileOffset||0),end:l+(t.packageFileOffset||0)+t.filesize};const g={};for(const[e,t]of Object.entries(y)){const a=c.subarray(t.start,t.end);g[e]=a}const b=h[o.root],v=[],_=e=>{v.push(e._id);for(const t of e.links)t.item=structuredClone(h[t.to]),_(t.item)};return _(b),{rootItem:b,metadata:h,folders:m,files:g}}function Ri(e,t,a,n){return`${e}_${t}`+(null!=a?`_${a}`:"")+(null!=n?`_${n}`:"")}function Li(e,t,a,n){return Array.isArray(e.attachments)?e.attachments.filter((e=>e.name===t&&(void 0===n||e.index===n))).reduce(((e,t)=>Math.abs(t.queryParam-(a??0))<Math.abs(e.queryParam-(a??0))?t:e),{queryParam:1/0}):null}function Pi(e,t,a,n){const i=Ei(e);if(i){const r=Li(i,t,a,n);if(!r)return null;return Ti(Ri(e,r.name,r.queryParam,r.index))}}var Bi=Object.freeze({__proto__:null,addPackageToCache:Fi,createAttachmentID:Ri,findFolder:Ci,findItem:Ii,getAttachmentFromPackageCache:Pi,getFileFromCache:Ti,getFolder:xi,getFolders:Mi,getItemFromCache:Ei,getItems:Vi,parsePackage:Di,queryAttachments:Li});class Oi{id=h.createGUID();items=[]}class $i{itemRepo;undoEvents=[];redoEvents=[];maxUndoCount=100;enabled=!0;snapshots=new Map;_undoRedoPromise=Promise.resolve();constructor(e,t=100){this.itemRepo=e,this.maxUndoCount=t,g.instance.setUndoManager(this),u.$on("undoManager:undo",(e=>this.undo(e))),u.$on("undoManager:redo",(e=>this.redo(e)))}clear(){this.undoEvents=[],this.redoEvents=[],this.snapshots.clear(),u.$emit("undoManager:undoStepsChanged",0),u.$emit("undoManager:redoStepsChanged",0)}createSnapshot(){const e=new Oi;for(const t of this.itemRepo.itemInstances.values())for(const a of t.values())e.items.push({_id:a._id,instanceId:a.instanceId,data:this._grabSnapshot(a)});return this.snapshots.set(e.id,e),e.id}rollbackFromSnapshot(e){const t=this.snapshots.get(e);if(!t)throw new w("Snapshot not found");for(const e of t.items){const t=this.itemRepo.itemInstances.get(e._id);if(t){const a=t.get(e.instanceId);a?this._rollbackFromSnapshot(a,e.data):console.error(`[SNAPSHOT] - Trying to rollback snapshot for item but did not find the instance: ${e._id} -> ${e.instanceId}`)}else console.error(`[SNAPSHOT] - Trying to rollback snapshot for item but did not find the item map: ${e._id}`)}this.snapshots.delete(e)}_grabSnapshot(e){const t=[];for(const a of e.fieldInstances)try{t.push(a.createSnapshot())}catch(e){const t=`[SNAPSHOT] - Could not grab snapshot of field ${a.name}`;throw console.error(t,e),new Error(e.toString())}const a=[];for(const t of e.customFieldInstances)try{a.push(t.createSnapshot())}catch(e){const a=`[SNAPSHOT] - Could not grab snapshot of custom field ${t.name}`;throw console.error(a,e),new Error(e.toString())}return new O(e._id,"item",{fieldInstances:t,customFieldInstances:a})}_getFieldInstance(e,t){for(const a of e.fieldInstances)if(a.getId()===t)return a;return null}_getCustomFieldInstance(e,t){for(const a of e.customFieldInstances)if(a.getId()===t)return a;return null}_rollbackFromSnapshot(e,t){for(const a of t.data.fieldInstances){const t=this._getFieldInstance(e,a.id);t?t.rollbackFromSnapshot(a):console.warn("[SNAPSHOT] - Could not find field instance in snapshot: "+a.id)}for(const a of t.data.customFieldInstances){const t=this._getCustomFieldInstance(e,a.id);t?t.rollbackFromSnapshot(a):console.warn("[SNAPSHOT] - Could not find custom field instance in snapshot: "+a.id)}}getEnabled(){return this.enabled}setEnabled(e){this.enabled=!!e}ignore(e){const t=this.enabled;let a=!1;try{t&&this.setEnabled(!1);const n=e();if(n&&n.then)return a=!0,n.finally((()=>{t&&this.setEnabled(!0)}))}finally{t&&!a&&this.setEnabled(!0)}}undo(e){return this._undoRedoPromise=this._undoRedoPromise.then((()=>this._performUndo(e))),this._undoRedoPromise}redo(e){return this._undoRedoPromise=this._undoRedoPromise.then((()=>this._performRedo(e))),this._undoRedoPromise}async _performUndo(e){if(this.enabled&&this.undoEvents.length){for(e=e||1;this.undoEvents.length>0&&e>0;){const t=this.spliceLastEventBundle(this.undoEvents).reverse();for(const e of t)await e.undo(),this.redoEvents.push(e);e--}u.$emit("undoManager:undoStepsChanged",this.getNumberOfUndoBundles()),u.$emit("undoManager:redoStepsChanged",this.getNumberOfRedoBundles())}}async _performRedo(e){if(this.enabled&&this.redoEvents.length){for(e=e||1;this.redoEvents.length>0&&e>0;){const t=this.spliceLastEventBundle(this.redoEvents).reverse();for(const e of t)await e.redo(),this.undoEvents.push(e);e--}u.$emit("undoManager:undoStepsChanged",this.getNumberOfUndoBundles()),u.$emit("undoManager:redoStepsChanged",this.getNumberOfRedoBundles())}}getUndoSteps(){return this.undoEvents.map((function(e){return{type:e.type,itemId:e.itemId,prop:e.prop}}))}getRedoSteps(){return this.redoEvents.map((e=>({type:e.type,itemId:e.itemId,prop:e.prop})))}event(e){if(this.enabled){if(this.redoEvents=[],u.$emit("undoManager:redoStepsChanged",0),this.assignBundleIndexToEvent(e),0!==this.undoEvents.length){let t=!1;for(let a=this.undoEvents.length-1;a>=0;a--){const n=this.undoEvents[a];if(!e.isWithinMergeDeltaOf(n,300))break;const i=n.merge(e,300);if(i){t=!0,this.undoEvents.splice(a,1),this.undoEvents.push(i);break}}t||(this.undoEvents.push(e),u.$emit("undoManager:undoStepsChanged",this.getNumberOfUndoBundles()))}else this.undoEvents.push(e),u.$emit("undoManager:undoStepsChanged",this.getNumberOfUndoBundles());if(this.getNumberOfUndoBundles()>this.maxUndoCount){this.spliceFirstEventBundle(this.undoEvents);for(const e of this.undoEvents)e.bundleIndex-=1;u.$emit("undoManager:undoStepsChanged",this.getNumberOfUndoBundles())}}}getNumberOfUndoBundles(){return 0===this.undoEvents.length?0:this.undoEvents.at(-1).bundleIndex+1}getNumberOfRedoBundles(){if(0===this.redoEvents.length)return 0;const e=this.getNumberOfUndoBundles()-1;return this.redoEvents.at(0).bundleIndex-e}spliceLastEventBundle(e){if(0===e.length)return[];const t=e.at(-1).bundleIndex;let a=e.length-1;for(let n=e.length-1;n>=0&&e[n].bundleIndex===t;n--)a=n;return e.splice(a)}spliceFirstEventBundle(e){if(0===e.length)return[];const t=e.at(0).bundleIndex;for(let a=1;a<e.length;a++)if(e[a].bundleIndex!==t)return e.splice(0,a);return e.splice(0)}assignBundleIndexToEvent(e){if(0===this.undoEvents.length)return void(e.bundleIndex=0);const t=this.undoEvents.at(-1),a=Math.abs(e.createdAt-t.createdAt);e.bundleIndex=a>300?t.bundleIndex+1:t.bundleIndex}}class Ui{updateItemLinksAndAttributes(e,t,a){try{const n=[],i={},r={};this.getLinksAndAttributes(e,n,i,r,t,a),e.attributes=i,e.userAttributes=r,e.links=n}catch(e){throw console.error(e),new k(e)}}getLinksAndAttributes(e,t,a,n,i,r){e.fieldInstances.length&&this.retrieveLinksAndAttributesFromFieldInstances(e.fieldInstances,t,a,i,r),e.userFieldInstances.length&&this.retrieveLinksAndAttributesFromFieldInstances(e.userFieldInstances,t,n,i,r),e.customFieldInstances.length&&(console.log(e.customFieldInstances),this.retrieveLinksAndAttributesFromFieldInstances(e.customFieldInstances,t,n,i,r,"_"))}retrieveLinksAndAttributesFromFieldInstances(e,t,a,n,i,r=""){for(const s of e)switch(s.type){case"Link":if(s.value&&t){if(i&&s.hidden)continue;n?t.push({usage:r+s.name,to:s.value._id,item:s.value}):t.push({usage:r+s.name,to:s.value._id})}break;case"Attribute":a&&(a[r+s.name]=s.value);break;case"List":s.blocks&&this.traverseListFieldInstances(s.blocks,t,a,r+s.name,n);break;case"Tree":if(s.blocks){const e=s.blocks[0];e.blocks&&this.traverseTreeFieldInstance(e.blocks,t,a,r+s.name,n)}break;case"NodeGraph":if(s.blocks&&this.traverseTreeFieldInstance(s.blocks,t,a,r+s.name,n),a&&Array.isArray(s.connections)){let e=0;for(const t of s.connections){a[`${r}${s.name}#connection[${e++}]`]={srcNode:t.srcNode,srcSlot:t.srcSlot,destNode:t.destNode,destSlot:t.destSlot}}}}}traverseTreeFieldInstance(e,t,a,n,i){let r=0;for(const s of e){const e=`${n}[${r}]`,o=e+"#type",l=e+"#id",u=e+"#posx",c=e+"#posy";a&&(a[e+"#usage"]="Block",a[o]=s.type,a[l]=s.id,void 0!==s.posX&&(a[u]=s.posX||0),void 0!==s.posY&&(a[c]=s.posY||0));for(const n of s.fields){const r=`${e}->${n.name}`;switch(n.type){case"Link":n.value&&t&&(i?t.push({usage:r,to:n.value._id,item:n.value}):t.push({usage:r,to:n.value._id}));break;case"List":n.blocks&&this.traverseListFieldInstances(n.blocks,t,a,r,i);break;case"Attribute":a&&(a[r]=n.value)}}s.scripts&&this.processScripts(s.scripts,t,a,e,i),s.blocks&&this.traverseTreeFieldInstance(s.blocks,t,a,e,i),r++}}traverseListFieldInstances(e,t,a,n,i){let r=0;for(const s of e){const e=`${n}[${r}]`;for(const n of s.fields){const r=`${e}->${n.name}`;switch(n.type){case"Link":if(n.value&&t){const e={usage:r,to:"object"==typeof n.value?n.value._id:n.value,item:null};i&&"object"===n.value&&(e.item=n.value),t.push(e)}break;case"Attribute":a&&(a[r]=n.value)}}r++}}processScripts(e,t,a,n,i){let r=0;for(const s of e){const e=`${n}#scripts[${r}]`,o=e+"#id",l=e+"#item";a&&(a[e+"#usage"]="Script",a[o]=s.id),t&&s.item.value&&(i?t.push({usage:l,to:s.item.value._id,item:s.item.value}):t.push({usage:l,to:s.item.value._id}));for(const n of s.fields){const r=`${e}->${n.name}`;if("Link"===n.type)n.value&&t&&(i?t.push({usage:r,to:n.value._id,item:n.value}):t.push({usage:r,to:n.value._id}));else a&&(a[r]=n.value)}r++}}}class ji{apiClient;activeItem=void 0;rootItemId=void 0;loadingItems=new Map;loadedItems=new Map;itemInstances=new Map;resolvedPaths=new Map;jail;apiGateway;itemCache;undoManager=new $i(this);itemPreparator=new te(this);itemChangeProcessor=new Ui;usePublicApi;constructor(e,t){this.apiClient=t,this.apiGateway=new P(t),this.itemCache=new B(this.apiGateway),this.usePublicApi=!!e,this.jail={active:!1,mountedFolders:[]},u.$on("item:rename",(e=>this.handleRename(e)))}_logGroup(e){}_logGroupEnd(){}_log(e){}getLoadedItems(){return Array.from(this.loadedItems.values())}getItemInstances(){return this.itemInstances}findLoadedItem(e){return this.loadedItems.get(e)}_handleError(e,t){throw console.error(e),new k("ItemRepo: "+t)}getUndoManager(){return this.undoManager}async createFieldsForItem(e,t,a,n=!1){return this.itemPreparator.createFields(e,a,t,"",!1,a.attributes,n)}async createScriptsForItem(e,t=[],a,n=!0){const i=[];for(const n of t){if(!n.item)continue;const t=await this.loadItem(n.item);if(!t)continue;const r=new W(void 0,e,a,t);i.push(r);for(const e of n.fields){const t=new j(r,e.name,e.value,a);r.addField(t)}}e.scripts=n?g.instance.proxyScriptArray(i,e,a):i}clear(){this.rootItemId=void 0,this.activeItem=void 0,this.loadedItems.clear(),this.resolvedPaths.clear(),this.itemInstances.clear(),this.loadingItems.clear();const e=this.apiClient.getCollab();e&&e.endCollaboration()}removeBlock(e,t){t.blocks.removeObject(e),e.parent=void 0}traverseBlockPairs(e,t,a){a(e,t);for(let n=0;n<e.blocks.length&&n<t.blocks.length;n++)this.traverseBlockPairs(e.blocks[n],t.blocks[n],a)}copyScripts(e,t,a=!1){const n=new Map;this.traverseBlockPairs(e,t,((e,t)=>n.set(e.getId(),t.getId())));const i=[];return this.traverseBlockPairs(e,t,((e,t)=>{for(const r of e.scripts){const e=r.clone(n);a&&(e.deferInitCall=!0),t.scripts.push(e),i.push(e)}})),i}updateScriptFieldReferences(e,t){const a=new Map;this.traverseBlockPairs(e,t,((e,t)=>{a.set(e.id,t.id)})),this.updateScriptFieldReferencesFromMap(a,t)}updateScriptFieldReferencesFromMap(e,t){this.traverseBlocks((t=>{for(const a of t.scripts)for(const t of a.fields)e.has(t.value)&&(t.value=e.get(t.value))}),[t])}async createNewBlock(e,t,a){const n=new ae(void 0,t,e.typeName,void 0,void 0,a),i=await this.createFieldsForItem(n,e.template,a);return n.setFields(i),n.blocks=g.instance.proxyBlockArray(n.blocks,n,a),await this.createScriptsForItem(n,void 0,a),this.addBlockToParent(n,t,a)}addBlockToParent(e,t,a){e.parent=t;const n=g.instance.proxyBlock(e,a);return t.blocks.push(n),n}async createNewListEntry(e,t,a){const n=new ae(void 0,void 0,e.typeName,void 0,void 0,a),i=await this.createFieldsForItem(n,e.template,a);return n.setFields(i),n.blocks=g.instance.proxyListArray(n.blocks,t,a),g.instance.proxyBlock(n,a)}async createNewGraphNode(e,t,a,n,i){const r=new ae(void 0,void 0,e.typeName,void 0,e.displayName,i),s=await this.itemPreparator.createFields(r,i,e.template,"",!0,i.attributes);return r.setFields(s),r.setInputs(e.inputs),r.setOutputs(e.outputs),r.setPosition(a,n),r.blocks=g.instance.proxyGraphBlockArray(r.blocks,t),this.addNodeToGraph(r,t,i),r}addNodeToGraph(e,t,a){const n=g.instance.proxyGraphBlock(e,a);t.blocks.push(n)}removeGraphNode(e,t){const a=[];for(const n of e.connections)n.srcNode!==t.id&&n.destNode!==t.id||a.push(n);for(const t of a)e.connections.removeObject(t);e.blocks.removeObject(t)}addGraphLink(e,t,a,n,i,r){e.connections.push(new U({srcNode:t,srcSlot:a,destNode:n,destSlot:i},r))}removeGraphLink(e,t,a,n,i){for(const r of e.connections)if(r.srcNode===t&&r.srcSlot===a&&r.destNode===n&&r.destSlot===i)return void e.connections.removeObject(r)}createNewScript(e,t=-1,a){t=t>=0?t:e.scripts.length;const n=new W(void 0,e,a);return e.scripts.splice(t,0,n),n}removeScript(e,t){t.scripts.removeObject(e)}findBlock(e){for(const t of this.itemInstances.values())for(const a of t.values()){const t=a.findBlock(e);if(t)return t}return null}async loadPackage(e,t){const a=await h.downloadFile(e,((e,a,n)=>{t&&t({phase:"Loading",percent:e,bytesTotal:a,bytesLoaded:n})})),n=await a.data,i=this.apiClient.getCollab();i&&i.endCollaboration();const r=new K({_id:"root",name:"Root package",type:"Package",links:[],attributes:{},fields:[],readOnly:!0,isPackaged:!1}),s=await Di(n,r._id);Fi(r._id,structuredClone(s));const o=Object.values(s.metadata).reverse();for(const e of o)e._id===s.rootItem._id&&(r.packageContent=e,r.packageType=e.type);return await this._linkAndPrepareItems(o),r.packageContent=this.loadedItems.get(s.rootItem._id),this.activeItem=r,r}createPackageItemUrl(e){const t=Ti(e);return t?URL.createObjectURL(t.blob):null}revokePackageItemUrl(e){URL.revokeObjectURL(e)}async _loadPackageContentRecursively(e,t){t("Loading from cache",0);const a=await this.apiClient.itemCache.addItemToCache(e._id,void 0,e.hash,(function(e,a,n){t("Loading from cloud",.9*e,n,a)})),n=await(await fetch(a.objectUrl)).blob();t("Unpacking",90);const i=await Di(n,e._id);Fi(e._id,structuredClone(i));const r=Object.values(i.metadata).reverse();for(const t of r)t._id===i.rootItem._id&&(e.packageContent=t,e.packageType=t.type);return r}createNewItemInstance(e){const t=this.loadedItems.get(e);if(!t)return console.error(`Tried creating new instance of item, but it was not found: ${e}`),null;const a=t.clone(!0);return this._addItemInstance(a),a}_addLoadedItem(e){this.loadedItems.set(e._id,e),this._addItemInstance(e)}_addItemInstance(e){let t=this.itemInstances.get(e._id);t||(t=new Map,this.itemInstances.set(e._id,t)),t.set(e.instanceId,e)}async loadItemByRelativePath(e,t,a={}){try{const n=Ei(e);let i;if(n){const e=t.split("/"),a=e.pop();let r=xi(n.folder._id);for(const t of e)if(r=".."===t?xi(r.parent):Ci(t,r._id),!r)return;const s=Ii(a,r._id);i=s?._id}else i=await this.resolveRelativePath(t,e);return this.loadItem(i,a)}catch(e){this._handleError(e,`Unable to load item by relative path: ${t}: ${e}`)}}async _loadItemFromApi(e,t={}){let a;if(this.apiGateway.start(),t.recursive)if(this.usePublicApi)a=await this.apiGateway.call("_loadItemFromApi","getItemPublicRecursive",e,!0),a.forEach((e=>e.public=!0));else try{a=await this.apiGateway.call("_loadItemFromApi","getItemAggregatedRecursive",e,{withAttachmentInfo:!0,noFields:!0})}catch{a=await this.apiGateway.call("_loadItemFromApi","getItemPublicRecursive",e,!0),a.forEach((e=>e.public=!0))}else{let t;if(this.usePublicApi)t=await this.apiGateway.call("_loadItemFromApi","getItemPublicRecursive",e),t.public=!0;else try{t=await this.apiGateway.call("_loadItemFromApi","getItemAggregated",e,{noFields:!0})}catch{t=await this.apiGateway.call("_loadItemFromApi","getItemPublicRecursive",e),t.public=!0}a=[t]}return this.apiGateway.end(),a}_relinkItems(e,t){for(const a of e){if(Array.isArray(a.links))for(const e of a.links)e.item=t.get(e.to),e.item||e.stopRecursion||console.warn(`Missing link in item '${a.name}' (${a._id}) to: ${e.to} with usage ${e.usage}`);a.packageContent&&(a.packageContent=t.get(a.packageContent._id))}}createItem(e,t){const a={_id:h.createGeneratedItemId(),name:`Generated ${e}`,type:e,attributes:t||{},links:[],fields:[],fieldInstances:[],userFieldInstances:[],isGenerated:!0};return this.itemPreparator.prepare(a)}getLoadedItem(e){return this.loadedItems.get(e)}async loadItem(e,t={}){let a,n,i;if(i=this.loadedItems.get(e),i)return i;if(i=this.loadingItems.get(e),i)return i;try{const r=new Promise(((e,t)=>{a=e,n=t}));return this.loadingItems.set(e,r),i=await this._loadItemInternal(e,t),a(i),!this.activeItem&&i&&(this.rootItemId=e,this.activeItem=i,t.withCollaboration,await u.$emit("itemRepo:itemLoaded",i)),i}catch(t){return this._handleError(t,`Unable to load item ${e}: ${t}`),void n(void 0)}finally{this.loadingItems.delete(e)}}async _loadItemInternal(e,t={}){const a=(e,a,n=0,i=0)=>{"function"==typeof t.progressCallback&&t.progressCallback({phase:e,percent:a,bytesTotal:n,bytesLoaded:i})};a("Fetching metadata",1);let n=await this._loadItemFromApi(e,t);if(n=n.filter((e=>!this.loadedItems.has(e._id))),0===n.length)return console.log("After loading the item, it turns out we have them all already loaded! This should not happen!"),this.loadedItems.get(e);const i=n[0]._id;for(const e of n)if("Package"===e.type){const t=await this._loadPackageContentRecursively(e,a);for(const e of t)n.push(e)}a("Preparing data",100),await this._linkAndPrepareItems(n);return this.loadedItems.get(i)}async _linkAndPrepareItems(e){const t=new Map;for(const a of e)t.set(a._id,a);const a=new Map([...this.loadedItems,...t]);this._relinkItems(e,a);const n=[],i=()=>{const e=t.values().next().value;return t.delete(e._id),this._log(`- Fetched next item ${e.name} (${e._id})`),e},r=async e=>{this._logGroup(`- Preparing item ${e.name} (${e._id})`);const t=await this.itemPreparator.prepare(e);return n.push(t),this._addLoadedItem(t),this._logGroupEnd(),t};for(this.itemPreparator.setItemFetcher((async e=>{this._logGroup(`- Requesting item ${e.name} (${e._id})`);let a=this.loadedItems.get(e._id);if(a)return this._log("- Already prepared. Returning."),this._logGroupEnd(),a;const n=t.get(e._id);return n?(t.delete(e._id),this._log("- Don't have it yet. Preparing..."),a=await r(n),this._log("- Now prepared. Returning."),this._logGroupEnd(),a):(console.error("ItemFetcher: Could not find requested item: "+e._id,t,this.loadedItems),null)}));t.size>0;){let e=i();await r(e)}return this._relinkItems(n,this.loadedItems),n}async resolveRelativePath(e,t=null){if(!(t=t||this.activeItem?._id||null))return null;const a=`${t}#${e}`;let n;return n=this.resolvedPaths.has(a)?this.resolvedPaths.get(a):this.usePublicApi?await this.apiClient.publicResolveRelativeItem(t,e):await this.apiClient.resolveRelativeItem(t,e),this.resolvedPaths.set(a,n),n}async traverseItems(e,t=void 0){if("function"!=typeof e)return;const a=this,n=new Map;await async function t(i){if(!i)return;if(n.has(i._id))return;n.set(i._id,!0);const r=e(i);if(r&&r.then&&await r,Array.isArray(i.links))for(const e of i.links)if(e.item)await t(e.item);else if(e.to)try{const n=await a.loadItem(e.to);await t(n)}catch{console.warn(`Could not load additional item ${e.to} so cannot traverse it. Probably dead link!`)}}(t||this.activeItem)}async traverseBlocks(e,t){for(const a of t){const t=e(a);t&&t.then&&await t,Array.isArray(a.blocks)&&a.blocks?.length&&await this.traverseBlocks(e,a.blocks)}}async traverseFieldInstances(e,t){const a=this;t=t||this.activeItem?.fieldInstances||[];for(const n of t){const t=e(n);t&&t.then&&await t,Array.isArray(n.blocks)&&await this.traverseBlocks((async function(t){Array.isArray(t.fields)&&t.fields?.length&&await a.traverseFieldInstances(e,t.fields)}),n.blocks)}}async _updateLinkReferences(e,t,a,n){t?await this.traverseItems((async i=>{if(Array.isArray(i.fieldInstances)&&i.fieldInstances.length){await this.traverseFieldInstances((async a=>{"Link"===a.type&&a.value&&a.value._id===e&&(n&&(a.value=null),a.value=t)}),i.fieldInstances);for(const a of i.fieldInstances)Array.isArray(a.blocks)&&await this.traverseBlocks((async a=>{if(Array.isArray(a.scripts))for(const i of a.scripts)i.item?.value?._id===e&&(n&&(i.item.value=void 0),i.item.value=t)}),a.blocks)}if(i.links)for(const r of i.links)r.to===e&&(n&&(r.to=null,r.item=null),r.to=a,r.item=t)})):console.warn(`Aborting link update: Could not load item ${a}`)}async replaceLink(e,t){if(this.getLoadedItem(e)){const a=await this.loadItem(t,{recursive:!0});await this._updateLinkReferences(e,a,t,!1)}}async forceUpdateLink(e){const t=await this.loadItem(e,{recursive:!0});await this._updateLinkReferences(e,t,e,!0)}saveItem(e){return e._id&&e.isDirty?(this.itemChangeProcessor.updateItemLinksAndAttributes(e,!1,!0),e.version||(e.version={major:0,minor:0,revision:1}),this.apiClient.updateItem({_id:e._id,name:e.name,attributes:e.attributes,userAttributes:e.userAttributes,links:e.links,tags:e.tags,contributors:e.contributors,description:e.description,shortDescription:e.shortDescription,categories:e.categories,license:e.license,version:e.version,allowConversation:e.allowConversation,visibility:e.visibility}).then((t=>(JSON.stringify(e.version)===JSON.stringify(t.version)?console.log(`Saved item ${e.name}. New version: ${e.version.major}.${e.version.minor}.${e.version.revision}`):console.log(`Saved item ${e.name}. Version ${e.version.major}.${e.version.minor}.${e.version.revision} -> ${t.version.major}.${t.version.minor}.${t.version.revision}`),t&&t.version&&(e.version=t.version),e.isDirty=!1,this.itemChangeProcessor.updateItemLinksAndAttributes(e,!0,!1),e))).catch((function(t){throw console.error(`Error saving item ${e.name}`,t,e),t}))):null}async save(){console.log("Saving changes in loaded items...");const e=[];for(const t of this.loadedItems.values()){const a=this.saveItem(t);a&&e.push(a)}if(0!==e.length){let t=0;for(const a of e)a.then((function(a){u.$emit("itemRepo:itemSaved",{item:a,progress:++t,total:e.length})}));return Promise.all(e).then((function(){console.log("Saved successfully"),u.$emit("itemRepo:itemsSaved")})).catch((function(e){console.error("Error saving:",e)}))}console.log("No changes detected.")}async existsUnsavedChanges(){if(!this.activeItem)return!1;for(const e of this.loadedItems.values())if(e._id&&e.isDirty)return!0;return!1}handleRename({id:e,newName:t}){for(const a of this.itemInstances.values())for(const n of a.values())n._id===e&&(n.name=t)}isItemKnown(e){return this.loadedItems.has(e)||this.itemInstances.has(e)||this.loadingItems.has(e)}invalidateId(e){this.loadedItems.delete(e),this.itemInstances.delete(e),this.loadingItems.delete(e)}}var zi,Wi={exports:{}};
11
+ */var q=(Y||(Y=1,function(e,t){(function(){var a,n="Expected a function",i="__lodash_hash_undefined__",r="__lodash_placeholder__",s=32,o=128,l=256,u=1/0,c=9007199254740991,d=NaN,p=4294967295,h=[["ary",o],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",l]],f="[object Arguments]",m="[object Array]",y="[object Boolean]",g="[object Date]",b="[object Error]",v="[object Function]",_="[object GeneratorFunction]",w="[object Map]",A="[object Number]",k="[object Object]",S="[object Promise]",N="[object RegExp]",T="[object Set]",M="[object String]",x="[object Symbol]",C="[object WeakMap]",V="[object ArrayBuffer]",E="[object DataView]",F="[object Float32Array]",D="[object Float64Array]",R="[object Int8Array]",L="[object Int16Array]",P="[object Int32Array]",B="[object Uint8Array]",O="[object Uint8ClampedArray]",$="[object Uint16Array]",U="[object Uint32Array]",j=/\b__p \+= '';/g,z=/\b(__p \+=) '' \+/g,W=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Y=/&(?:amp|lt|gt|quot|#39);/g,H=/[&<>"']/g,G=RegExp(Y.source),q=RegExp(H.source),Z=/<%-([\s\S]+?)%>/g,J=/<%([\s\S]+?)%>/g,K=/<%=([\s\S]+?)%>/g,X=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ae=RegExp(te.source),ne=/^\s+/,ie=/\s/,re=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,se=/\{\n\/\* \[wrapped with (.+)\] \*/,oe=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ue=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,de=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,fe=/^0b[01]+$/i,me=/^\[object .+?Constructor\]$/,ye=/^0o[0-7]+$/i,ge=/^(?:0|[1-9]\d*)$/,be=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ve=/($^)/,_e=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Ae="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ke="\\u2700-\\u27bf",Se="a-z\\xdf-\\xf6\\xf8-\\xff",Ne="A-Z\\xc0-\\xd6\\xd8-\\xde",Te="\\ufe0e\\ufe0f",Me="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",xe="['’]",Ce="["+we+"]",Ie="["+Me+"]",Ve="["+Ae+"]",Ee="\\d+",Fe="["+ke+"]",De="["+Se+"]",Re="[^"+we+Me+Ee+ke+Se+Ne+"]",Le="\\ud83c[\\udffb-\\udfff]",Pe="[^"+we+"]",Be="(?:\\ud83c[\\udde6-\\uddff]){2}",Oe="[\\ud800-\\udbff][\\udc00-\\udfff]",$e="["+Ne+"]",Ue="\\u200d",je="(?:"+De+"|"+Re+")",ze="(?:"+$e+"|"+Re+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",Ye="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ve+"|"+Le+")?",Ge="["+Te+"]?",qe=Ge+He+"(?:"+Ue+"(?:"+[Pe,Be,Oe].join("|")+")"+Ge+He+")*",Ze="(?:"+[Fe,Be,Oe].join("|")+")"+qe,Je="(?:"+[Pe+Ve+"?",Ve,Be,Oe,Ce].join("|")+")",Ke=RegExp(xe,"g"),Xe=RegExp(Ve,"g"),Qe=RegExp(Le+"(?="+Le+")|"+Je+qe,"g"),et=RegExp([$e+"?"+De+"+"+We+"(?="+[Ie,$e,"$"].join("|")+")",ze+"+"+Ye+"(?="+[Ie,$e+je,"$"].join("|")+")",$e+"?"+je+"+"+We,$e+"+"+Ye,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ee,Ze].join("|"),"g"),tt=RegExp("["+Ue+we+Ae+Te+"]"),at=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],it=-1,rt={};rt[F]=rt[D]=rt[R]=rt[L]=rt[P]=rt[B]=rt[O]=rt[$]=rt[U]=!0,rt[f]=rt[m]=rt[V]=rt[y]=rt[E]=rt[g]=rt[b]=rt[v]=rt[w]=rt[A]=rt[k]=rt[N]=rt[T]=rt[M]=rt[C]=!1;var st={};st[f]=st[m]=st[V]=st[E]=st[y]=st[g]=st[F]=st[D]=st[R]=st[L]=st[P]=st[w]=st[A]=st[k]=st[N]=st[T]=st[M]=st[x]=st[B]=st[O]=st[$]=st[U]=!0,st[b]=st[v]=st[C]=!1;var ot={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},lt=parseFloat,ut=parseInt,ct="object"==typeof I&&I&&I.Object===Object&&I,dt="object"==typeof self&&self&&self.Object===Object&&self,pt=ct||dt||Function("return this")(),ht=t&&!t.nodeType&&t,ft=ht&&e&&!e.nodeType&&e,mt=ft&&ft.exports===ht,yt=mt&&ct.process,gt=function(){try{var e=ft&&ft.require&&ft.require("util").types;return e||yt&&yt.binding&&yt.binding("util")}catch(e){}}(),bt=gt&&gt.isArrayBuffer,vt=gt&&gt.isDate,_t=gt&&gt.isMap,wt=gt&&gt.isRegExp,At=gt&&gt.isSet,kt=gt&&gt.isTypedArray;function St(e,t,a){switch(a.length){case 0:return e.call(t);case 1:return e.call(t,a[0]);case 2:return e.call(t,a[0],a[1]);case 3:return e.call(t,a[0],a[1],a[2])}return e.apply(t,a)}function Nt(e,t,a,n){for(var i=-1,r=null==e?0:e.length;++i<r;){var s=e[i];t(n,s,a(s),e)}return n}function Tt(e,t){for(var a=-1,n=null==e?0:e.length;++a<n&&!1!==t(e[a],a,e););return e}function Mt(e,t){for(var a=null==e?0:e.length;a--&&!1!==t(e[a],a,e););return e}function xt(e,t){for(var a=-1,n=null==e?0:e.length;++a<n;)if(!t(e[a],a,e))return!1;return!0}function Ct(e,t){for(var a=-1,n=null==e?0:e.length,i=0,r=[];++a<n;){var s=e[a];t(s,a,e)&&(r[i++]=s)}return r}function It(e,t){return!(null==e||!e.length)&&$t(e,t,0)>-1}function Vt(e,t,a){for(var n=-1,i=null==e?0:e.length;++n<i;)if(a(t,e[n]))return!0;return!1}function Et(e,t){for(var a=-1,n=null==e?0:e.length,i=Array(n);++a<n;)i[a]=t(e[a],a,e);return i}function Ft(e,t){for(var a=-1,n=t.length,i=e.length;++a<n;)e[i+a]=t[a];return e}function Dt(e,t,a,n){var i=-1,r=null==e?0:e.length;for(n&&r&&(a=e[++i]);++i<r;)a=t(a,e[i],i,e);return a}function Rt(e,t,a,n){var i=null==e?0:e.length;for(n&&i&&(a=e[--i]);i--;)a=t(a,e[i],i,e);return a}function Lt(e,t){for(var a=-1,n=null==e?0:e.length;++a<n;)if(t(e[a],a,e))return!0;return!1}var Pt=Wt("length");function Bt(e,t,a){var n;return a(e,(function(e,a,i){if(t(e,a,i))return n=a,!1})),n}function Ot(e,t,a,n){for(var i=e.length,r=a+(n?1:-1);n?r--:++r<i;)if(t(e[r],r,e))return r;return-1}function $t(e,t,a){return t==t?function(e,t,a){for(var n=a-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t,a):Ot(e,jt,a)}function Ut(e,t,a,n){for(var i=a-1,r=e.length;++i<r;)if(n(e[i],t))return i;return-1}function jt(e){return e!=e}function zt(e,t){var a=null==e?0:e.length;return a?Gt(e,t)/a:d}function Wt(e){return function(t){return null==t?a:t[e]}}function Yt(e){return function(t){return null==e?a:e[t]}}function Ht(e,t,a,n,i){return i(e,(function(e,i,r){a=n?(n=!1,e):t(a,e,i,r)})),a}function Gt(e,t){for(var n,i=-1,r=e.length;++i<r;){var s=t(e[i]);s!==a&&(n=n===a?s:n+s)}return n}function qt(e,t){for(var a=-1,n=Array(e);++a<e;)n[a]=t(a);return n}function Zt(e){return e?e.slice(0,pa(e)+1).replace(ne,""):e}function Jt(e){return function(t){return e(t)}}function Kt(e,t){return Et(t,(function(t){return e[t]}))}function Xt(e,t){return e.has(t)}function Qt(e,t){for(var a=-1,n=e.length;++a<n&&$t(t,e[a],0)>-1;);return a}function ea(e,t){for(var a=e.length;a--&&$t(t,e[a],0)>-1;);return a}var ta=Yt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),aa=Yt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function na(e){return"\\"+ot[e]}function ia(e){return tt.test(e)}function ra(e){var t=-1,a=Array(e.size);return e.forEach((function(e,n){a[++t]=[n,e]})),a}function sa(e,t){return function(a){return e(t(a))}}function oa(e,t){for(var a=-1,n=e.length,i=0,s=[];++a<n;){var o=e[a];o!==t&&o!==r||(e[a]=r,s[i++]=a)}return s}function la(e){var t=-1,a=Array(e.size);return e.forEach((function(e){a[++t]=e})),a}function ua(e){var t=-1,a=Array(e.size);return e.forEach((function(e){a[++t]=[e,e]})),a}function ca(e){return ia(e)?function(e){for(var t=Qe.lastIndex=0;Qe.test(e);)++t;return t}(e):Pt(e)}function da(e){return ia(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.split("")}(e)}function pa(e){for(var t=e.length;t--&&ie.test(e.charAt(t)););return t}var ha=Yt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),fa=function e(t){var I,ie=(t=null==t?pt:fa.defaults(pt.Object(),t,fa.pick(pt,nt))).Array,we=t.Date,Ae=t.Error,ke=t.Function,Se=t.Math,Ne=t.Object,Te=t.RegExp,Me=t.String,xe=t.TypeError,Ce=ie.prototype,Ie=ke.prototype,Ve=Ne.prototype,Ee=t["__core-js_shared__"],Fe=Ie.toString,De=Ve.hasOwnProperty,Re=0,Le=(I=/[^.]+$/.exec(Ee&&Ee.keys&&Ee.keys.IE_PROTO||""))?"Symbol(src)_1."+I:"",Pe=Ve.toString,Be=Fe.call(Ne),Oe=pt._,$e=Te("^"+Fe.call(De).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ue=mt?t.Buffer:a,je=t.Symbol,ze=t.Uint8Array,We=Ue?Ue.allocUnsafe:a,Ye=sa(Ne.getPrototypeOf,Ne),He=Ne.create,Ge=Ve.propertyIsEnumerable,qe=Ce.splice,Ze=je?je.isConcatSpreadable:a,Je=je?je.iterator:a,Qe=je?je.toStringTag:a,tt=function(){try{var e=cr(Ne,"defineProperty");return e({},"",{}),e}catch(e){}}(),ot=t.clearTimeout!==pt.clearTimeout&&t.clearTimeout,ct=we&&we.now!==pt.Date.now&&we.now,dt=t.setTimeout!==pt.setTimeout&&t.setTimeout,ht=Se.ceil,ft=Se.floor,yt=Ne.getOwnPropertySymbols,gt=Ue?Ue.isBuffer:a,Pt=t.isFinite,Yt=Ce.join,ma=sa(Ne.keys,Ne),ya=Se.max,ga=Se.min,ba=we.now,va=t.parseInt,_a=Se.random,wa=Ce.reverse,Aa=cr(t,"DataView"),ka=cr(t,"Map"),Sa=cr(t,"Promise"),Na=cr(t,"Set"),Ta=cr(t,"WeakMap"),Ma=cr(Ne,"create"),xa=Ta&&new Ta,Ca={},Ia=Lr(Aa),Va=Lr(ka),Ea=Lr(Sa),Fa=Lr(Na),Da=Lr(Ta),Ra=je?je.prototype:a,La=Ra?Ra.valueOf:a,Pa=Ra?Ra.toString:a;function Ba(e){if(Qs(e)&&!js(e)&&!(e instanceof ja)){if(e instanceof Ua)return e;if(De.call(e,"__wrapped__"))return Pr(e)}return new Ua(e)}var Oa=function(){function e(){}return function(t){if(!Xs(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=a,n}}();function $a(){}function Ua(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=a}function ja(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=p,this.__views__=[]}function za(e){var t=-1,a=null==e?0:e.length;for(this.clear();++t<a;){var n=e[t];this.set(n[0],n[1])}}function Wa(e){var t=-1,a=null==e?0:e.length;for(this.clear();++t<a;){var n=e[t];this.set(n[0],n[1])}}function Ya(e){var t=-1,a=null==e?0:e.length;for(this.clear();++t<a;){var n=e[t];this.set(n[0],n[1])}}function Ha(e){var t=-1,a=null==e?0:e.length;for(this.__data__=new Ya;++t<a;)this.add(e[t])}function Ga(e){var t=this.__data__=new Wa(e);this.size=t.size}function qa(e,t){var a=js(e),n=!a&&Us(e),i=!a&&!n&&Hs(e),r=!a&&!n&&!i&&oo(e),s=a||n||i||r,o=s?qt(e.length,Me):[],l=o.length;for(var u in e)!t&&!De.call(e,u)||s&&("length"==u||i&&("offset"==u||"parent"==u)||r&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||gr(u,l))||o.push(u);return o}function Za(e){var t=e.length;return t?e[Gn(0,t-1)]:a}function Ja(e,t){return Fr(xi(e),sn(t,0,e.length))}function Ka(e){return Fr(xi(e))}function Xa(e,t,n){(n!==a&&!Bs(e[t],n)||n===a&&!(t in e))&&nn(e,t,n)}function Qa(e,t,n){var i=e[t];De.call(e,t)&&Bs(i,n)&&(n!==a||t in e)||nn(e,t,n)}function en(e,t){for(var a=e.length;a--;)if(Bs(e[a][0],t))return a;return-1}function tn(e,t,a,n){return dn(e,(function(e,i,r){t(n,e,a(e),r)})),n}function an(e,t){return e&&Ci(t,Io(t),e)}function nn(e,t,a){"__proto__"==t&&tt?tt(e,t,{configurable:!0,enumerable:!0,value:a,writable:!0}):e[t]=a}function rn(e,t){for(var n=-1,i=t.length,r=ie(i),s=null==e;++n<i;)r[n]=s?a:No(e,t[n]);return r}function sn(e,t,n){return e==e&&(n!==a&&(e=e<=n?e:n),t!==a&&(e=e>=t?e:t)),e}function on(e,t,n,i,r,s){var o,l=1&t,u=2&t,c=4&t;if(n&&(o=r?n(e,i,r,s):n(e)),o!==a)return o;if(!Xs(e))return e;var d=js(e);if(d){if(o=function(e){var t=e.length,a=new e.constructor(t);return t&&"string"==typeof e[0]&&De.call(e,"index")&&(a.index=e.index,a.input=e.input),a}(e),!l)return xi(e,o)}else{var p=hr(e),h=p==v||p==_;if(Hs(e))return Ai(e,l);if(p==k||p==f||h&&!r){if(o=u||h?{}:mr(e),!l)return u?function(e,t){return Ci(e,pr(e),t)}(e,function(e,t){return e&&Ci(t,Vo(t),e)}(o,e)):function(e,t){return Ci(e,dr(e),t)}(e,an(o,e))}else{if(!st[p])return r?e:{};o=function(e,t,a){var n,i=e.constructor;switch(t){case V:return ki(e);case y:case g:return new i(+e);case E:return function(e,t){var a=t?ki(e.buffer):e.buffer;return new e.constructor(a,e.byteOffset,e.byteLength)}(e,a);case F:case D:case R:case L:case P:case B:case O:case $:case U:return Si(e,a);case w:return new i;case A:case M:return new i(e);case N:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case T:return new i;case x:return n=e,La?Ne(La.call(n)):{}}}(e,p,l)}}s||(s=new Ga);var m=s.get(e);if(m)return m;s.set(e,o),io(e)?e.forEach((function(a){o.add(on(a,t,n,a,e,s))})):eo(e)&&e.forEach((function(a,i){o.set(i,on(a,t,n,i,e,s))}));var b=d?a:(c?u?nr:ar:u?Vo:Io)(e);return Tt(b||e,(function(a,i){b&&(a=e[i=a]),Qa(o,i,on(a,t,n,i,e,s))})),o}function ln(e,t,n){var i=n.length;if(null==e)return!i;for(e=Ne(e);i--;){var r=n[i],s=t[r],o=e[r];if(o===a&&!(r in e)||!s(o))return!1}return!0}function un(e,t,i){if("function"!=typeof e)throw new xe(n);return Cr((function(){e.apply(a,i)}),t)}function cn(e,t,a,n){var i=-1,r=It,s=!0,o=e.length,l=[],u=t.length;if(!o)return l;a&&(t=Et(t,Jt(a))),n?(r=Vt,s=!1):t.length>=200&&(r=Xt,s=!1,t=new Ha(t));e:for(;++i<o;){var c=e[i],d=null==a?c:a(c);if(c=n||0!==c?c:0,s&&d==d){for(var p=u;p--;)if(t[p]===d)continue e;l.push(c)}else r(t,d,n)||l.push(c)}return l}Ba.templateSettings={escape:Z,evaluate:J,interpolate:K,variable:"",imports:{_:Ba}},Ba.prototype=$a.prototype,Ba.prototype.constructor=Ba,Ua.prototype=Oa($a.prototype),Ua.prototype.constructor=Ua,ja.prototype=Oa($a.prototype),ja.prototype.constructor=ja,za.prototype.clear=function(){this.__data__=Ma?Ma(null):{},this.size=0},za.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},za.prototype.get=function(e){var t=this.__data__;if(Ma){var n=t[e];return n===i?a:n}return De.call(t,e)?t[e]:a},za.prototype.has=function(e){var t=this.__data__;return Ma?t[e]!==a:De.call(t,e)},za.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ma&&t===a?i:t,this},Wa.prototype.clear=function(){this.__data__=[],this.size=0},Wa.prototype.delete=function(e){var t=this.__data__,a=en(t,e);return!(a<0||(a==t.length-1?t.pop():qe.call(t,a,1),--this.size,0))},Wa.prototype.get=function(e){var t=this.__data__,n=en(t,e);return n<0?a:t[n][1]},Wa.prototype.has=function(e){return en(this.__data__,e)>-1},Wa.prototype.set=function(e,t){var a=this.__data__,n=en(a,e);return n<0?(++this.size,a.push([e,t])):a[n][1]=t,this},Ya.prototype.clear=function(){this.size=0,this.__data__={hash:new za,map:new(ka||Wa),string:new za}},Ya.prototype.delete=function(e){var t=lr(this,e).delete(e);return this.size-=t?1:0,t},Ya.prototype.get=function(e){return lr(this,e).get(e)},Ya.prototype.has=function(e){return lr(this,e).has(e)},Ya.prototype.set=function(e,t){var a=lr(this,e),n=a.size;return a.set(e,t),this.size+=a.size==n?0:1,this},Ha.prototype.add=Ha.prototype.push=function(e){return this.__data__.set(e,i),this},Ha.prototype.has=function(e){return this.__data__.has(e)},Ga.prototype.clear=function(){this.__data__=new Wa,this.size=0},Ga.prototype.delete=function(e){var t=this.__data__,a=t.delete(e);return this.size=t.size,a},Ga.prototype.get=function(e){return this.__data__.get(e)},Ga.prototype.has=function(e){return this.__data__.has(e)},Ga.prototype.set=function(e,t){var a=this.__data__;if(a instanceof Wa){var n=a.__data__;if(!ka||n.length<199)return n.push([e,t]),this.size=++a.size,this;a=this.__data__=new Ya(n)}return a.set(e,t),this.size=a.size,this};var dn=Ei(vn),pn=Ei(_n,!0);function hn(e,t){var a=!0;return dn(e,(function(e,n,i){return a=!!t(e,n,i)})),a}function fn(e,t,n){for(var i=-1,r=e.length;++i<r;){var s=e[i],o=t(s);if(null!=o&&(l===a?o==o&&!so(o):n(o,l)))var l=o,u=s}return u}function mn(e,t){var a=[];return dn(e,(function(e,n,i){t(e,n,i)&&a.push(e)})),a}function yn(e,t,a,n,i){var r=-1,s=e.length;for(a||(a=yr),i||(i=[]);++r<s;){var o=e[r];t>0&&a(o)?t>1?yn(o,t-1,a,n,i):Ft(i,o):n||(i[i.length]=o)}return i}var gn=Fi(),bn=Fi(!0);function vn(e,t){return e&&gn(e,t,Io)}function _n(e,t){return e&&bn(e,t,Io)}function wn(e,t){return Ct(t,(function(t){return Zs(e[t])}))}function An(e,t){for(var n=0,i=(t=bi(t,e)).length;null!=e&&n<i;)e=e[Rr(t[n++])];return n&&n==i?e:a}function kn(e,t,a){var n=t(e);return js(e)?n:Ft(n,a(e))}function Sn(e){return null==e?e===a?"[object Undefined]":"[object Null]":Qe&&Qe in Ne(e)?function(e){var t=De.call(e,Qe),n=e[Qe];try{e[Qe]=a;var i=!0}catch(e){}var r=Pe.call(e);return i&&(t?e[Qe]=n:delete e[Qe]),r}(e):function(e){return Pe.call(e)}(e)}function Nn(e,t){return e>t}function Tn(e,t){return null!=e&&De.call(e,t)}function Mn(e,t){return null!=e&&t in Ne(e)}function xn(e,t,n){for(var i=n?Vt:It,r=e[0].length,s=e.length,o=s,l=ie(s),u=1/0,c=[];o--;){var d=e[o];o&&t&&(d=Et(d,Jt(t))),u=ga(d.length,u),l[o]=!n&&(t||r>=120&&d.length>=120)?new Ha(o&&d):a}d=e[0];var p=-1,h=l[0];e:for(;++p<r&&c.length<u;){var f=d[p],m=t?t(f):f;if(f=n||0!==f?f:0,!(h?Xt(h,m):i(c,m,n))){for(o=s;--o;){var y=l[o];if(!(y?Xt(y,m):i(e[o],m,n)))continue e}h&&h.push(m),c.push(f)}}return c}function Cn(e,t,n){var i=null==(e=Tr(e,t=bi(t,e)))?e:e[Rr(qr(t))];return null==i?a:St(i,e,n)}function In(e){return Qs(e)&&Sn(e)==f}function Vn(e,t,n,i,r){return e===t||(null==e||null==t||!Qs(e)&&!Qs(t)?e!=e&&t!=t:function(e,t,n,i,r,s){var o=js(e),l=js(t),u=o?m:hr(e),c=l?m:hr(t),d=(u=u==f?k:u)==k,p=(c=c==f?k:c)==k,h=u==c;if(h&&Hs(e)){if(!Hs(t))return!1;o=!0,d=!1}if(h&&!d)return s||(s=new Ga),o||oo(e)?er(e,t,n,i,r,s):function(e,t,a,n,i,r,s){switch(a){case E:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case V:return!(e.byteLength!=t.byteLength||!r(new ze(e),new ze(t)));case y:case g:case A:return Bs(+e,+t);case b:return e.name==t.name&&e.message==t.message;case N:case M:return e==t+"";case w:var o=ra;case T:var l=1&n;if(o||(o=la),e.size!=t.size&&!l)return!1;var u=s.get(e);if(u)return u==t;n|=2,s.set(e,t);var c=er(o(e),o(t),n,i,r,s);return s.delete(e),c;case x:if(La)return La.call(e)==La.call(t)}return!1}(e,t,u,n,i,r,s);if(!(1&n)){var v=d&&De.call(e,"__wrapped__"),_=p&&De.call(t,"__wrapped__");if(v||_){var S=v?e.value():e,C=_?t.value():t;return s||(s=new Ga),r(S,C,n,i,s)}}return!!h&&(s||(s=new Ga),function(e,t,n,i,r,s){var o=1&n,l=ar(e),u=l.length,c=ar(t),d=c.length;if(u!=d&&!o)return!1;for(var p=u;p--;){var h=l[p];if(!(o?h in t:De.call(t,h)))return!1}var f=s.get(e),m=s.get(t);if(f&&m)return f==t&&m==e;var y=!0;s.set(e,t),s.set(t,e);for(var g=o;++p<u;){var b=e[h=l[p]],v=t[h];if(i)var _=o?i(v,b,h,t,e,s):i(b,v,h,e,t,s);if(!(_===a?b===v||r(b,v,n,i,s):_)){y=!1;break}g||(g="constructor"==h)}if(y&&!g){var w=e.constructor,A=t.constructor;w==A||!("constructor"in e)||!("constructor"in t)||"function"==typeof w&&w instanceof w&&"function"==typeof A&&A instanceof A||(y=!1)}return s.delete(e),s.delete(t),y}(e,t,n,i,r,s))}(e,t,n,i,Vn,r))}function En(e,t,n,i){var r=n.length,s=r,o=!i;if(null==e)return!s;for(e=Ne(e);r--;){var l=n[r];if(o&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++r<s;){var u=(l=n[r])[0],c=e[u],d=l[1];if(o&&l[2]){if(c===a&&!(u in e))return!1}else{var p=new Ga;if(i)var h=i(c,d,u,e,t,p);if(!(h===a?Vn(d,c,3,i,p):h))return!1}}return!0}function Fn(e){return!(!Xs(e)||(t=e,Le&&Le in t))&&(Zs(e)?$e:me).test(Lr(e));var t}function Dn(e){return"function"==typeof e?e:null==e?al:"object"==typeof e?js(e)?$n(e[0],e[1]):On(e):dl(e)}function Rn(e){if(!Ar(e))return ma(e);var t=[];for(var a in Ne(e))De.call(e,a)&&"constructor"!=a&&t.push(a);return t}function Ln(e){if(!Xs(e))return function(e){var t=[];if(null!=e)for(var a in Ne(e))t.push(a);return t}(e);var t=Ar(e),a=[];for(var n in e)("constructor"!=n||!t&&De.call(e,n))&&a.push(n);return a}function Pn(e,t){return e<t}function Bn(e,t){var a=-1,n=Ws(e)?ie(e.length):[];return dn(e,(function(e,i,r){n[++a]=t(e,i,r)})),n}function On(e){var t=ur(e);return 1==t.length&&t[0][2]?Sr(t[0][0],t[0][1]):function(a){return a===e||En(a,e,t)}}function $n(e,t){return vr(e)&&kr(t)?Sr(Rr(e),t):function(n){var i=No(n,e);return i===a&&i===t?To(n,e):Vn(t,i,3)}}function Un(e,t,n,i,r){e!==t&&gn(t,(function(s,o){if(r||(r=new Ga),Xs(s))!function(e,t,n,i,r,s,o){var l=Mr(e,n),u=Mr(t,n),c=o.get(u);if(c)Xa(e,n,c);else{var d=s?s(l,u,n+"",e,t,o):a,p=d===a;if(p){var h=js(u),f=!h&&Hs(u),m=!h&&!f&&oo(u);d=u,h||f||m?js(l)?d=l:Ys(l)?d=xi(l):f?(p=!1,d=Ai(u,!0)):m?(p=!1,d=Si(u,!0)):d=[]:ao(u)||Us(u)?(d=l,Us(l)?d=yo(l):Xs(l)&&!Zs(l)||(d=mr(u))):p=!1}p&&(o.set(u,d),r(d,u,i,s,o),o.delete(u)),Xa(e,n,d)}}(e,t,o,n,Un,i,r);else{var l=i?i(Mr(e,o),s,o+"",e,t,r):a;l===a&&(l=s),Xa(e,o,l)}}),Vo)}function jn(e,t){var n=e.length;if(n)return gr(t+=t<0?n:0,n)?e[t]:a}function zn(e,t,a){t=t.length?Et(t,(function(e){return js(e)?function(t){return An(t,1===e.length?e[0]:e)}:e})):[al];var n=-1;t=Et(t,Jt(or()));var i=Bn(e,(function(e,a,i){var r=Et(t,(function(t){return t(e)}));return{criteria:r,index:++n,value:e}}));return function(e,t){var a=e.length;for(e.sort(t);a--;)e[a]=e[a].value;return e}(i,(function(e,t){return function(e,t,a){for(var n=-1,i=e.criteria,r=t.criteria,s=i.length,o=a.length;++n<s;){var l=Ni(i[n],r[n]);if(l)return n>=o?l:l*("desc"==a[n]?-1:1)}return e.index-t.index}(e,t,a)}))}function Wn(e,t,a){for(var n=-1,i=t.length,r={};++n<i;){var s=t[n],o=An(e,s);a(o,s)&&Xn(r,bi(s,e),o)}return r}function Yn(e,t,a,n){var i=n?Ut:$t,r=-1,s=t.length,o=e;for(e===t&&(t=xi(t)),a&&(o=Et(e,Jt(a)));++r<s;)for(var l=0,u=t[r],c=a?a(u):u;(l=i(o,c,l,n))>-1;)o!==e&&qe.call(o,l,1),qe.call(e,l,1);return e}function Hn(e,t){for(var a=e?t.length:0,n=a-1;a--;){var i=t[a];if(a==n||i!==r){var r=i;gr(i)?qe.call(e,i,1):ci(e,i)}}return e}function Gn(e,t){return e+ft(_a()*(t-e+1))}function qn(e,t){var a="";if(!e||t<1||t>c)return a;do{t%2&&(a+=e),(t=ft(t/2))&&(e+=e)}while(t);return a}function Zn(e,t){return Ir(Nr(e,t,al),e+"")}function Jn(e){return Za(Oo(e))}function Kn(e,t){var a=Oo(e);return Fr(a,sn(t,0,a.length))}function Xn(e,t,n,i){if(!Xs(e))return e;for(var r=-1,s=(t=bi(t,e)).length,o=s-1,l=e;null!=l&&++r<s;){var u=Rr(t[r]),c=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(r!=o){var d=l[u];(c=i?i(d,u,l):a)===a&&(c=Xs(d)?d:gr(t[r+1])?[]:{})}Qa(l,u,c),l=l[u]}return e}var Qn=xa?function(e,t){return xa.set(e,t),e}:al,ei=tt?function(e,t){return tt(e,"toString",{configurable:!0,enumerable:!1,value:Qo(t),writable:!0})}:al;function ti(e){return Fr(Oo(e))}function ai(e,t,a){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(a=a>i?i:a)<0&&(a+=i),i=t>a?0:a-t>>>0,t>>>=0;for(var r=ie(i);++n<i;)r[n]=e[n+t];return r}function ni(e,t){var a;return dn(e,(function(e,n,i){return!(a=t(e,n,i))})),!!a}function ii(e,t,a){var n=0,i=null==e?n:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;n<i;){var r=n+i>>>1,s=e[r];null!==s&&!so(s)&&(a?s<=t:s<t)?n=r+1:i=r}return i}return ri(e,t,al,a)}function ri(e,t,n,i){var r=0,s=null==e?0:e.length;if(0===s)return 0;for(var o=(t=n(t))!=t,l=null===t,u=so(t),c=t===a;r<s;){var d=ft((r+s)/2),p=n(e[d]),h=p!==a,f=null===p,m=p==p,y=so(p);if(o)var g=i||m;else g=c?m&&(i||h):l?m&&h&&(i||!f):u?m&&h&&!f&&(i||!y):!f&&!y&&(i?p<=t:p<t);g?r=d+1:s=d}return ga(s,4294967294)}function si(e,t){for(var a=-1,n=e.length,i=0,r=[];++a<n;){var s=e[a],o=t?t(s):s;if(!a||!Bs(o,l)){var l=o;r[i++]=0===s?0:s}}return r}function oi(e){return"number"==typeof e?e:so(e)?d:+e}function li(e){if("string"==typeof e)return e;if(js(e))return Et(e,li)+"";if(so(e))return Pa?Pa.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ui(e,t,a){var n=-1,i=It,r=e.length,s=!0,o=[],l=o;if(a)s=!1,i=Vt;else if(r>=200){var u=t?null:qi(e);if(u)return la(u);s=!1,i=Xt,l=new Ha}else l=t?[]:o;e:for(;++n<r;){var c=e[n],d=t?t(c):c;if(c=a||0!==c?c:0,s&&d==d){for(var p=l.length;p--;)if(l[p]===d)continue e;t&&l.push(d),o.push(c)}else i(l,d,a)||(l!==o&&l.push(d),o.push(c))}return o}function ci(e,t){return null==(e=Tr(e,t=bi(t,e)))||delete e[Rr(qr(t))]}function di(e,t,a,n){return Xn(e,t,a(An(e,t)),n)}function pi(e,t,a,n){for(var i=e.length,r=n?i:-1;(n?r--:++r<i)&&t(e[r],r,e););return a?ai(e,n?0:r,n?r+1:i):ai(e,n?r+1:0,n?i:r)}function hi(e,t){var a=e;return a instanceof ja&&(a=a.value()),Dt(t,(function(e,t){return t.func.apply(t.thisArg,Ft([e],t.args))}),a)}function fi(e,t,a){var n=e.length;if(n<2)return n?ui(e[0]):[];for(var i=-1,r=ie(n);++i<n;)for(var s=e[i],o=-1;++o<n;)o!=i&&(r[i]=cn(r[i]||s,e[o],t,a));return ui(yn(r,1),t,a)}function mi(e,t,n){for(var i=-1,r=e.length,s=t.length,o={};++i<r;){var l=i<s?t[i]:a;n(o,e[i],l)}return o}function yi(e){return Ys(e)?e:[]}function gi(e){return"function"==typeof e?e:al}function bi(e,t){return js(e)?e:vr(e,t)?[e]:Dr(go(e))}var vi=Zn;function _i(e,t,n){var i=e.length;return n=n===a?i:n,!t&&n>=i?e:ai(e,t,n)}var wi=ot||function(e){return pt.clearTimeout(e)};function Ai(e,t){if(t)return e.slice();var a=e.length,n=We?We(a):new e.constructor(a);return e.copy(n),n}function ki(e){var t=new e.constructor(e.byteLength);return new ze(t).set(new ze(e)),t}function Si(e,t){var a=t?ki(e.buffer):e.buffer;return new e.constructor(a,e.byteOffset,e.length)}function Ni(e,t){if(e!==t){var n=e!==a,i=null===e,r=e==e,s=so(e),o=t!==a,l=null===t,u=t==t,c=so(t);if(!l&&!c&&!s&&e>t||s&&o&&u&&!l&&!c||i&&o&&u||!n&&u||!r)return 1;if(!i&&!s&&!c&&e<t||c&&n&&r&&!i&&!s||l&&n&&r||!o&&r||!u)return-1}return 0}function Ti(e,t,a,n){for(var i=-1,r=e.length,s=a.length,o=-1,l=t.length,u=ya(r-s,0),c=ie(l+u),d=!n;++o<l;)c[o]=t[o];for(;++i<s;)(d||i<r)&&(c[a[i]]=e[i]);for(;u--;)c[o++]=e[i++];return c}function Mi(e,t,a,n){for(var i=-1,r=e.length,s=-1,o=a.length,l=-1,u=t.length,c=ya(r-o,0),d=ie(c+u),p=!n;++i<c;)d[i]=e[i];for(var h=i;++l<u;)d[h+l]=t[l];for(;++s<o;)(p||i<r)&&(d[h+a[s]]=e[i++]);return d}function xi(e,t){var a=-1,n=e.length;for(t||(t=ie(n));++a<n;)t[a]=e[a];return t}function Ci(e,t,n,i){var r=!n;n||(n={});for(var s=-1,o=t.length;++s<o;){var l=t[s],u=i?i(n[l],e[l],l,n,e):a;u===a&&(u=e[l]),r?nn(n,l,u):Qa(n,l,u)}return n}function Ii(e,t){return function(a,n){var i=js(a)?Nt:tn,r=t?t():{};return i(a,e,or(n,2),r)}}function Vi(e){return Zn((function(t,n){var i=-1,r=n.length,s=r>1?n[r-1]:a,o=r>2?n[2]:a;for(s=e.length>3&&"function"==typeof s?(r--,s):a,o&&br(n[0],n[1],o)&&(s=r<3?a:s,r=1),t=Ne(t);++i<r;){var l=n[i];l&&e(t,l,i,s)}return t}))}function Ei(e,t){return function(a,n){if(null==a)return a;if(!Ws(a))return e(a,n);for(var i=a.length,r=t?i:-1,s=Ne(a);(t?r--:++r<i)&&!1!==n(s[r],r,s););return a}}function Fi(e){return function(t,a,n){for(var i=-1,r=Ne(t),s=n(t),o=s.length;o--;){var l=s[e?o:++i];if(!1===a(r[l],l,r))break}return t}}function Di(e){return function(t){var n=ia(t=go(t))?da(t):a,i=n?n[0]:t.charAt(0),r=n?_i(n,1).join(""):t.slice(1);return i[e]()+r}}function Ri(e){return function(t){return Dt(Jo(jo(t).replace(Ke,"")),e,"")}}function Li(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var a=Oa(e.prototype),n=e.apply(a,t);return Xs(n)?n:a}}function Pi(e){return function(t,n,i){var r=Ne(t);if(!Ws(t)){var s=or(n,3);t=Io(t),n=function(e){return s(r[e],e,r)}}var o=e(t,n,i);return o>-1?r[s?t[o]:o]:a}}function Bi(e){return tr((function(t){var i=t.length,r=i,s=Ua.prototype.thru;for(e&&t.reverse();r--;){var o=t[r];if("function"!=typeof o)throw new xe(n);if(s&&!l&&"wrapper"==rr(o))var l=new Ua([],!0)}for(r=l?r:i;++r<i;){var u=rr(o=t[r]),c="wrapper"==u?ir(o):a;l=c&&_r(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?l[rr(c[0])].apply(l,c[3]):1==o.length&&_r(o)?l[u]():l.thru(o)}return function(){var e=arguments,a=e[0];if(l&&1==e.length&&js(a))return l.plant(a).value();for(var n=0,r=i?t[n].apply(this,e):a;++n<i;)r=t[n].call(this,r);return r}}))}function Oi(e,t,n,i,r,s,l,u,c,d){var p=t&o,h=1&t,f=2&t,m=24&t,y=512&t,g=f?a:Li(e);return function o(){for(var b=arguments.length,v=ie(b),_=b;_--;)v[_]=arguments[_];if(m)var w=sr(o),A=function(e,t){for(var a=e.length,n=0;a--;)e[a]===t&&++n;return n}(v,w);if(i&&(v=Ti(v,i,r,m)),s&&(v=Mi(v,s,l,m)),b-=A,m&&b<d){var k=oa(v,w);return Hi(e,t,Oi,o.placeholder,n,v,k,u,c,d-b)}var S=h?n:this,N=f?S[e]:e;return b=v.length,u?v=function(e,t){for(var n=e.length,i=ga(t.length,n),r=xi(e);i--;){var s=t[i];e[i]=gr(s,n)?r[s]:a}return e}(v,u):y&&b>1&&v.reverse(),p&&c<b&&(v.length=c),this&&this!==pt&&this instanceof o&&(N=g||Li(N)),N.apply(S,v)}}function $i(e,t){return function(a,n){return function(e,t,a,n){return vn(e,(function(e,i,r){t(n,a(e),i,r)})),n}(a,e,t(n),{})}}function Ui(e,t){return function(n,i){var r;if(n===a&&i===a)return t;if(n!==a&&(r=n),i!==a){if(r===a)return i;"string"==typeof n||"string"==typeof i?(n=li(n),i=li(i)):(n=oi(n),i=oi(i)),r=e(n,i)}return r}}function ji(e){return tr((function(t){return t=Et(t,Jt(or())),Zn((function(a){var n=this;return e(t,(function(e){return St(e,n,a)}))}))}))}function zi(e,t){var n=(t=t===a?" ":li(t)).length;if(n<2)return n?qn(t,e):t;var i=qn(t,ht(e/ca(t)));return ia(t)?_i(da(i),0,e).join(""):i.slice(0,e)}function Wi(e){return function(t,n,i){return i&&"number"!=typeof i&&br(t,n,i)&&(n=i=a),t=po(t),n===a?(n=t,t=0):n=po(n),function(e,t,a,n){for(var i=-1,r=ya(ht((t-e)/(a||1)),0),s=ie(r);r--;)s[n?r:++i]=e,e+=a;return s}(t,n,i=i===a?t<n?1:-1:po(i),e)}}function Yi(e){return function(t,a){return"string"==typeof t&&"string"==typeof a||(t=mo(t),a=mo(a)),e(t,a)}}function Hi(e,t,n,i,r,o,l,u,c,d){var p=8&t;t|=p?s:64,4&(t&=~(p?64:s))||(t&=-4);var h=[e,t,r,p?o:a,p?l:a,p?a:o,p?a:l,u,c,d],f=n.apply(a,h);return _r(e)&&xr(f,h),f.placeholder=i,Vr(f,e,t)}function Gi(e){var t=Se[e];return function(e,a){if(e=mo(e),(a=null==a?0:ga(ho(a),292))&&Pt(e)){var n=(go(e)+"e").split("e");return+((n=(go(t(n[0]+"e"+(+n[1]+a)))+"e").split("e"))[0]+"e"+(+n[1]-a))}return t(e)}}var qi=Na&&1/la(new Na([,-0]))[1]==u?function(e){return new Na(e)}:ol;function Zi(e){return function(t){var a=hr(t);return a==w?ra(t):a==T?ua(t):function(e,t){return Et(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Ji(e,t,i,u,c,d,p,h){var f=2&t;if(!f&&"function"!=typeof e)throw new xe(n);var m=u?u.length:0;if(m||(t&=-97,u=c=a),p=p===a?p:ya(ho(p),0),h=h===a?h:ho(h),m-=c?c.length:0,64&t){var y=u,g=c;u=c=a}var b=f?a:ir(e),v=[e,t,i,u,c,y,g,d,p,h];if(b&&function(e,t){var a=e[1],n=t[1],i=a|n,s=i<131,u=n==o&&8==a||n==o&&a==l&&e[7].length<=t[8]||384==n&&t[7].length<=t[8]&&8==a;if(!s&&!u)return e;1&n&&(e[2]=t[2],i|=1&a?0:4);var c=t[3];if(c){var d=e[3];e[3]=d?Ti(d,c,t[4]):c,e[4]=d?oa(e[3],r):t[4]}(c=t[5])&&(d=e[5],e[5]=d?Mi(d,c,t[6]):c,e[6]=d?oa(e[5],r):t[6]),(c=t[7])&&(e[7]=c),n&o&&(e[8]=null==e[8]?t[8]:ga(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(v,b),e=v[0],t=v[1],i=v[2],u=v[3],c=v[4],!(h=v[9]=v[9]===a?f?0:e.length:ya(v[9]-m,0))&&24&t&&(t&=-25),t&&1!=t)_=8==t||16==t?function(e,t,n){var i=Li(e);return function r(){for(var s=arguments.length,o=ie(s),l=s,u=sr(r);l--;)o[l]=arguments[l];var c=s<3&&o[0]!==u&&o[s-1]!==u?[]:oa(o,u);return(s-=c.length)<n?Hi(e,t,Oi,r.placeholder,a,o,c,a,a,n-s):St(this&&this!==pt&&this instanceof r?i:e,this,o)}}(e,t,h):t!=s&&33!=t||c.length?Oi.apply(a,v):function(e,t,a,n){var i=1&t,r=Li(e);return function t(){for(var s=-1,o=arguments.length,l=-1,u=n.length,c=ie(u+o),d=this&&this!==pt&&this instanceof t?r:e;++l<u;)c[l]=n[l];for(;o--;)c[l++]=arguments[++s];return St(d,i?a:this,c)}}(e,t,i,u);else var _=function(e,t,a){var n=1&t,i=Li(e);return function t(){return(this&&this!==pt&&this instanceof t?i:e).apply(n?a:this,arguments)}}(e,t,i);return Vr((b?Qn:xr)(_,v),e,t)}function Ki(e,t,n,i){return e===a||Bs(e,Ve[n])&&!De.call(i,n)?t:e}function Xi(e,t,n,i,r,s){return Xs(e)&&Xs(t)&&(s.set(t,e),Un(e,t,a,Xi,s),s.delete(t)),e}function Qi(e){return ao(e)?a:e}function er(e,t,n,i,r,s){var o=1&n,l=e.length,u=t.length;if(l!=u&&!(o&&u>l))return!1;var c=s.get(e),d=s.get(t);if(c&&d)return c==t&&d==e;var p=-1,h=!0,f=2&n?new Ha:a;for(s.set(e,t),s.set(t,e);++p<l;){var m=e[p],y=t[p];if(i)var g=o?i(y,m,p,t,e,s):i(m,y,p,e,t,s);if(g!==a){if(g)continue;h=!1;break}if(f){if(!Lt(t,(function(e,t){if(!Xt(f,t)&&(m===e||r(m,e,n,i,s)))return f.push(t)}))){h=!1;break}}else if(m!==y&&!r(m,y,n,i,s)){h=!1;break}}return s.delete(e),s.delete(t),h}function tr(e){return Ir(Nr(e,a,zr),e+"")}function ar(e){return kn(e,Io,dr)}function nr(e){return kn(e,Vo,pr)}var ir=xa?function(e){return xa.get(e)}:ol;function rr(e){for(var t=e.name+"",a=Ca[t],n=De.call(Ca,t)?a.length:0;n--;){var i=a[n],r=i.func;if(null==r||r==e)return i.name}return t}function sr(e){return(De.call(Ba,"placeholder")?Ba:e).placeholder}function or(){var e=Ba.iteratee||nl;return e=e===nl?Dn:e,arguments.length?e(arguments[0],arguments[1]):e}function lr(e,t){var a,n,i=e.__data__;return("string"==(n=typeof(a=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==a:null===a)?i["string"==typeof t?"string":"hash"]:i.map}function ur(e){for(var t=Io(e),a=t.length;a--;){var n=t[a],i=e[n];t[a]=[n,i,kr(i)]}return t}function cr(e,t){var n=function(e,t){return null==e?a:e[t]}(e,t);return Fn(n)?n:a}var dr=yt?function(e){return null==e?[]:(e=Ne(e),Ct(yt(e),(function(t){return Ge.call(e,t)})))}:fl,pr=yt?function(e){for(var t=[];e;)Ft(t,dr(e)),e=Ye(e);return t}:fl,hr=Sn;function fr(e,t,a){for(var n=-1,i=(t=bi(t,e)).length,r=!1;++n<i;){var s=Rr(t[n]);if(!(r=null!=e&&a(e,s)))break;e=e[s]}return r||++n!=i?r:!!(i=null==e?0:e.length)&&Ks(i)&&gr(s,i)&&(js(e)||Us(e))}function mr(e){return"function"!=typeof e.constructor||Ar(e)?{}:Oa(Ye(e))}function yr(e){return js(e)||Us(e)||!!(Ze&&e&&e[Ze])}function gr(e,t){var a=typeof e;return!!(t=null==t?c:t)&&("number"==a||"symbol"!=a&&ge.test(e))&&e>-1&&e%1==0&&e<t}function br(e,t,a){if(!Xs(a))return!1;var n=typeof t;return!!("number"==n?Ws(a)&&gr(t,a.length):"string"==n&&t in a)&&Bs(a[t],e)}function vr(e,t){if(js(e))return!1;var a=typeof e;return!("number"!=a&&"symbol"!=a&&"boolean"!=a&&null!=e&&!so(e))||Q.test(e)||!X.test(e)||null!=t&&e in Ne(t)}function _r(e){var t=rr(e),a=Ba[t];if("function"!=typeof a||!(t in ja.prototype))return!1;if(e===a)return!0;var n=ir(a);return!!n&&e===n[0]}(Aa&&hr(new Aa(new ArrayBuffer(1)))!=E||ka&&hr(new ka)!=w||Sa&&hr(Sa.resolve())!=S||Na&&hr(new Na)!=T||Ta&&hr(new Ta)!=C)&&(hr=function(e){var t=Sn(e),n=t==k?e.constructor:a,i=n?Lr(n):"";if(i)switch(i){case Ia:return E;case Va:return w;case Ea:return S;case Fa:return T;case Da:return C}return t});var wr=Ee?Zs:ml;function Ar(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ve)}function kr(e){return e==e&&!Xs(e)}function Sr(e,t){return function(n){return null!=n&&n[e]===t&&(t!==a||e in Ne(n))}}function Nr(e,t,n){return t=ya(t===a?e.length-1:t,0),function(){for(var a=arguments,i=-1,r=ya(a.length-t,0),s=ie(r);++i<r;)s[i]=a[t+i];i=-1;for(var o=ie(t+1);++i<t;)o[i]=a[i];return o[t]=n(s),St(e,this,o)}}function Tr(e,t){return t.length<2?e:An(e,ai(t,0,-1))}function Mr(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var xr=Er(Qn),Cr=dt||function(e,t){return pt.setTimeout(e,t)},Ir=Er(ei);function Vr(e,t,a){var n=t+"";return Ir(e,function(e,t){var a=t.length;if(!a)return e;var n=a-1;return t[n]=(a>1?"& ":"")+t[n],t=t.join(a>2?", ":" "),e.replace(re,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return Tt(h,(function(a){var n="_."+a[0];t&a[1]&&!It(e,n)&&e.push(n)})),e.sort()}(function(e){var t=e.match(se);return t?t[1].split(oe):[]}(n),a)))}function Er(e){var t=0,n=0;return function(){var i=ba(),r=16-(i-n);if(n=i,r>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(a,arguments)}}function Fr(e,t){var n=-1,i=e.length,r=i-1;for(t=t===a?i:t;++n<t;){var s=Gn(n,r),o=e[s];e[s]=e[n],e[n]=o}return e.length=t,e}var Dr=function(e){var t=Es(e,(function(e){return 500===a.size&&a.clear(),e})),a=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ee,(function(e,a,n,i){t.push(n?i.replace(ce,"$1"):a||e)})),t}));function Rr(e){if("string"==typeof e||so(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Lr(e){if(null!=e){try{return Fe.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Pr(e){if(e instanceof ja)return e.clone();var t=new Ua(e.__wrapped__,e.__chain__);return t.__actions__=xi(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Br=Zn((function(e,t){return Ys(e)?cn(e,yn(t,1,Ys,!0)):[]})),Or=Zn((function(e,t){var n=qr(t);return Ys(n)&&(n=a),Ys(e)?cn(e,yn(t,1,Ys,!0),or(n,2)):[]})),$r=Zn((function(e,t){var n=qr(t);return Ys(n)&&(n=a),Ys(e)?cn(e,yn(t,1,Ys,!0),a,n):[]}));function Ur(e,t,a){var n=null==e?0:e.length;if(!n)return-1;var i=null==a?0:ho(a);return i<0&&(i=ya(n+i,0)),Ot(e,or(t,3),i)}function jr(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var r=i-1;return n!==a&&(r=ho(n),r=n<0?ya(i+r,0):ga(r,i-1)),Ot(e,or(t,3),r,!0)}function zr(e){return null!=e&&e.length?yn(e,1):[]}function Wr(e){return e&&e.length?e[0]:a}var Yr=Zn((function(e){var t=Et(e,yi);return t.length&&t[0]===e[0]?xn(t):[]})),Hr=Zn((function(e){var t=qr(e),n=Et(e,yi);return t===qr(n)?t=a:n.pop(),n.length&&n[0]===e[0]?xn(n,or(t,2)):[]})),Gr=Zn((function(e){var t=qr(e),n=Et(e,yi);return(t="function"==typeof t?t:a)&&n.pop(),n.length&&n[0]===e[0]?xn(n,a,t):[]}));function qr(e){var t=null==e?0:e.length;return t?e[t-1]:a}var Zr=Zn(Jr);function Jr(e,t){return e&&e.length&&t&&t.length?Yn(e,t):e}var Kr=tr((function(e,t){var a=null==e?0:e.length,n=rn(e,t);return Hn(e,Et(t,(function(e){return gr(e,a)?+e:e})).sort(Ni)),n}));function Xr(e){return null==e?e:wa.call(e)}var Qr=Zn((function(e){return ui(yn(e,1,Ys,!0))})),es=Zn((function(e){var t=qr(e);return Ys(t)&&(t=a),ui(yn(e,1,Ys,!0),or(t,2))})),ts=Zn((function(e){var t=qr(e);return t="function"==typeof t?t:a,ui(yn(e,1,Ys,!0),a,t)}));function as(e){if(!e||!e.length)return[];var t=0;return e=Ct(e,(function(e){if(Ys(e))return t=ya(e.length,t),!0})),qt(t,(function(t){return Et(e,Wt(t))}))}function ns(e,t){if(!e||!e.length)return[];var n=as(e);return null==t?n:Et(n,(function(e){return St(t,a,e)}))}var is=Zn((function(e,t){return Ys(e)?cn(e,t):[]})),rs=Zn((function(e){return fi(Ct(e,Ys))})),ss=Zn((function(e){var t=qr(e);return Ys(t)&&(t=a),fi(Ct(e,Ys),or(t,2))})),os=Zn((function(e){var t=qr(e);return t="function"==typeof t?t:a,fi(Ct(e,Ys),a,t)})),ls=Zn(as),us=Zn((function(e){var t=e.length,n=t>1?e[t-1]:a;return n="function"==typeof n?(e.pop(),n):a,ns(e,n)}));function cs(e){var t=Ba(e);return t.__chain__=!0,t}function ds(e,t){return t(e)}var ps=tr((function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,r=function(t){return rn(t,e)};return!(t>1||this.__actions__.length)&&i instanceof ja&&gr(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:ds,args:[r],thisArg:a}),new Ua(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(a),e}))):this.thru(r)})),hs=Ii((function(e,t,a){De.call(e,a)?++e[a]:nn(e,a,1)})),fs=Pi(Ur),ms=Pi(jr);function ys(e,t){return(js(e)?Tt:dn)(e,or(t,3))}function gs(e,t){return(js(e)?Mt:pn)(e,or(t,3))}var bs=Ii((function(e,t,a){De.call(e,a)?e[a].push(t):nn(e,a,[t])})),vs=Zn((function(e,t,a){var n=-1,i="function"==typeof t,r=Ws(e)?ie(e.length):[];return dn(e,(function(e){r[++n]=i?St(t,e,a):Cn(e,t,a)})),r})),_s=Ii((function(e,t,a){nn(e,a,t)}));function ws(e,t){return(js(e)?Et:Bn)(e,or(t,3))}var As=Ii((function(e,t,a){e[a?0:1].push(t)}),(function(){return[[],[]]})),ks=Zn((function(e,t){if(null==e)return[];var a=t.length;return a>1&&br(e,t[0],t[1])?t=[]:a>2&&br(t[0],t[1],t[2])&&(t=[t[0]]),zn(e,yn(t,1),[])})),Ss=ct||function(){return pt.Date.now()};function Ns(e,t,n){return t=n?a:t,t=e&&null==t?e.length:t,Ji(e,o,a,a,a,a,t)}function Ts(e,t){var i;if("function"!=typeof t)throw new xe(n);return e=ho(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=a),i}}var Ms=Zn((function(e,t,a){var n=1;if(a.length){var i=oa(a,sr(Ms));n|=s}return Ji(e,n,t,a,i)})),xs=Zn((function(e,t,a){var n=3;if(a.length){var i=oa(a,sr(xs));n|=s}return Ji(t,n,e,a,i)}));function Cs(e,t,i){var r,s,o,l,u,c,d=0,p=!1,h=!1,f=!0;if("function"!=typeof e)throw new xe(n);function m(t){var n=r,i=s;return r=s=a,d=t,l=e.apply(i,n)}function y(e){var n=e-c;return c===a||n>=t||n<0||h&&e-d>=o}function g(){var e=Ss();if(y(e))return b(e);u=Cr(g,function(e){var a=t-(e-c);return h?ga(a,o-(e-d)):a}(e))}function b(e){return u=a,f&&r?m(e):(r=s=a,l)}function v(){var e=Ss(),n=y(e);if(r=arguments,s=this,c=e,n){if(u===a)return function(e){return d=e,u=Cr(g,t),p?m(e):l}(c);if(h)return wi(u),u=Cr(g,t),m(c)}return u===a&&(u=Cr(g,t)),l}return t=mo(t)||0,Xs(i)&&(p=!!i.leading,o=(h="maxWait"in i)?ya(mo(i.maxWait)||0,t):o,f="trailing"in i?!!i.trailing:f),v.cancel=function(){u!==a&&wi(u),d=0,r=c=s=u=a},v.flush=function(){return u===a?l:b(Ss())},v}var Is=Zn((function(e,t){return un(e,1,t)})),Vs=Zn((function(e,t,a){return un(e,mo(t)||0,a)}));function Es(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(n);var a=function(){var n=arguments,i=t?t.apply(this,n):n[0],r=a.cache;if(r.has(i))return r.get(i);var s=e.apply(this,n);return a.cache=r.set(i,s)||r,s};return a.cache=new(Es.Cache||Ya),a}function Fs(e){if("function"!=typeof e)throw new xe(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Es.Cache=Ya;var Ds=vi((function(e,t){var a=(t=1==t.length&&js(t[0])?Et(t[0],Jt(or())):Et(yn(t,1),Jt(or()))).length;return Zn((function(n){for(var i=-1,r=ga(n.length,a);++i<r;)n[i]=t[i].call(this,n[i]);return St(e,this,n)}))})),Rs=Zn((function(e,t){var n=oa(t,sr(Rs));return Ji(e,s,a,t,n)})),Ls=Zn((function(e,t){var n=oa(t,sr(Ls));return Ji(e,64,a,t,n)})),Ps=tr((function(e,t){return Ji(e,l,a,a,a,t)}));function Bs(e,t){return e===t||e!=e&&t!=t}var Os=Yi(Nn),$s=Yi((function(e,t){return e>=t})),Us=In(function(){return arguments}())?In:function(e){return Qs(e)&&De.call(e,"callee")&&!Ge.call(e,"callee")},js=ie.isArray,zs=bt?Jt(bt):function(e){return Qs(e)&&Sn(e)==V};function Ws(e){return null!=e&&Ks(e.length)&&!Zs(e)}function Ys(e){return Qs(e)&&Ws(e)}var Hs=gt||ml,Gs=vt?Jt(vt):function(e){return Qs(e)&&Sn(e)==g};function qs(e){if(!Qs(e))return!1;var t=Sn(e);return t==b||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ao(e)}function Zs(e){if(!Xs(e))return!1;var t=Sn(e);return t==v||t==_||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Js(e){return"number"==typeof e&&e==ho(e)}function Ks(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=c}function Xs(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Qs(e){return null!=e&&"object"==typeof e}var eo=_t?Jt(_t):function(e){return Qs(e)&&hr(e)==w};function to(e){return"number"==typeof e||Qs(e)&&Sn(e)==A}function ao(e){if(!Qs(e)||Sn(e)!=k)return!1;var t=Ye(e);if(null===t)return!0;var a=De.call(t,"constructor")&&t.constructor;return"function"==typeof a&&a instanceof a&&Fe.call(a)==Be}var no=wt?Jt(wt):function(e){return Qs(e)&&Sn(e)==N},io=At?Jt(At):function(e){return Qs(e)&&hr(e)==T};function ro(e){return"string"==typeof e||!js(e)&&Qs(e)&&Sn(e)==M}function so(e){return"symbol"==typeof e||Qs(e)&&Sn(e)==x}var oo=kt?Jt(kt):function(e){return Qs(e)&&Ks(e.length)&&!!rt[Sn(e)]},lo=Yi(Pn),uo=Yi((function(e,t){return e<=t}));function co(e){if(!e)return[];if(Ws(e))return ro(e)?da(e):xi(e);if(Je&&e[Je])return function(e){for(var t,a=[];!(t=e.next()).done;)a.push(t.value);return a}(e[Je]());var t=hr(e);return(t==w?ra:t==T?la:Oo)(e)}function po(e){return e?(e=mo(e))===u||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ho(e){var t=po(e),a=t%1;return t==t?a?t-a:t:0}function fo(e){return e?sn(ho(e),0,p):0}function mo(e){if("number"==typeof e)return e;if(so(e))return d;if(Xs(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Xs(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Zt(e);var a=fe.test(e);return a||ye.test(e)?ut(e.slice(2),a?2:8):he.test(e)?d:+e}function yo(e){return Ci(e,Vo(e))}function go(e){return null==e?"":li(e)}var bo=Vi((function(e,t){if(Ar(t)||Ws(t))Ci(t,Io(t),e);else for(var a in t)De.call(t,a)&&Qa(e,a,t[a])})),vo=Vi((function(e,t){Ci(t,Vo(t),e)})),_o=Vi((function(e,t,a,n){Ci(t,Vo(t),e,n)})),wo=Vi((function(e,t,a,n){Ci(t,Io(t),e,n)})),Ao=tr(rn),ko=Zn((function(e,t){e=Ne(e);var n=-1,i=t.length,r=i>2?t[2]:a;for(r&&br(t[0],t[1],r)&&(i=1);++n<i;)for(var s=t[n],o=Vo(s),l=-1,u=o.length;++l<u;){var c=o[l],d=e[c];(d===a||Bs(d,Ve[c])&&!De.call(e,c))&&(e[c]=s[c])}return e})),So=Zn((function(e){return e.push(a,Xi),St(Fo,a,e)}));function No(e,t,n){var i=null==e?a:An(e,t);return i===a?n:i}function To(e,t){return null!=e&&fr(e,t,Mn)}var Mo=$i((function(e,t,a){null!=t&&"function"!=typeof t.toString&&(t=Pe.call(t)),e[t]=a}),Qo(al)),xo=$i((function(e,t,a){null!=t&&"function"!=typeof t.toString&&(t=Pe.call(t)),De.call(e,t)?e[t].push(a):e[t]=[a]}),or),Co=Zn(Cn);function Io(e){return Ws(e)?qa(e):Rn(e)}function Vo(e){return Ws(e)?qa(e,!0):Ln(e)}var Eo=Vi((function(e,t,a){Un(e,t,a)})),Fo=Vi((function(e,t,a,n){Un(e,t,a,n)})),Do=tr((function(e,t){var a={};if(null==e)return a;var n=!1;t=Et(t,(function(t){return t=bi(t,e),n||(n=t.length>1),t})),Ci(e,nr(e),a),n&&(a=on(a,7,Qi));for(var i=t.length;i--;)ci(a,t[i]);return a})),Ro=tr((function(e,t){return null==e?{}:function(e,t){return Wn(e,t,(function(t,a){return To(e,a)}))}(e,t)}));function Lo(e,t){if(null==e)return{};var a=Et(nr(e),(function(e){return[e]}));return t=or(t),Wn(e,a,(function(e,a){return t(e,a[0])}))}var Po=Zi(Io),Bo=Zi(Vo);function Oo(e){return null==e?[]:Kt(e,Io(e))}var $o=Ri((function(e,t,a){return t=t.toLowerCase(),e+(a?Uo(t):t)}));function Uo(e){return Zo(go(e).toLowerCase())}function jo(e){return(e=go(e))&&e.replace(be,ta).replace(Xe,"")}var zo=Ri((function(e,t,a){return e+(a?"-":"")+t.toLowerCase()})),Wo=Ri((function(e,t,a){return e+(a?" ":"")+t.toLowerCase()})),Yo=Di("toLowerCase"),Ho=Ri((function(e,t,a){return e+(a?"_":"")+t.toLowerCase()})),Go=Ri((function(e,t,a){return e+(a?" ":"")+Zo(t)})),qo=Ri((function(e,t,a){return e+(a?" ":"")+t.toUpperCase()})),Zo=Di("toUpperCase");function Jo(e,t,n){return e=go(e),(t=n?a:t)===a?function(e){return at.test(e)}(e)?function(e){return e.match(et)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Ko=Zn((function(e,t){try{return St(e,a,t)}catch(e){return qs(e)?e:new Ae(e)}})),Xo=tr((function(e,t){return Tt(t,(function(t){t=Rr(t),nn(e,t,Ms(e[t],e))})),e}));function Qo(e){return function(){return e}}var el=Bi(),tl=Bi(!0);function al(e){return e}function nl(e){return Dn("function"==typeof e?e:on(e,1))}var il=Zn((function(e,t){return function(a){return Cn(a,e,t)}})),rl=Zn((function(e,t){return function(a){return Cn(e,a,t)}}));function sl(e,t,a){var n=Io(t),i=wn(t,n);null!=a||Xs(t)&&(i.length||!n.length)||(a=t,t=e,e=this,i=wn(t,Io(t)));var r=!(Xs(a)&&"chain"in a&&!a.chain),s=Zs(e);return Tt(i,(function(a){var n=t[a];e[a]=n,s&&(e.prototype[a]=function(){var t=this.__chain__;if(r||t){var a=e(this.__wrapped__);return(a.__actions__=xi(this.__actions__)).push({func:n,args:arguments,thisArg:e}),a.__chain__=t,a}return n.apply(e,Ft([this.value()],arguments))})})),e}function ol(){}var ll=ji(Et),ul=ji(xt),cl=ji(Lt);function dl(e){return vr(e)?Wt(Rr(e)):function(e){return function(t){return An(t,e)}}(e)}var pl=Wi(),hl=Wi(!0);function fl(){return[]}function ml(){return!1}var yl,gl=Ui((function(e,t){return e+t}),0),bl=Gi("ceil"),vl=Ui((function(e,t){return e/t}),1),_l=Gi("floor"),wl=Ui((function(e,t){return e*t}),1),Al=Gi("round"),kl=Ui((function(e,t){return e-t}),0);return Ba.after=function(e,t){if("function"!=typeof t)throw new xe(n);return e=ho(e),function(){if(--e<1)return t.apply(this,arguments)}},Ba.ary=Ns,Ba.assign=bo,Ba.assignIn=vo,Ba.assignInWith=_o,Ba.assignWith=wo,Ba.at=Ao,Ba.before=Ts,Ba.bind=Ms,Ba.bindAll=Xo,Ba.bindKey=xs,Ba.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return js(e)?e:[e]},Ba.chain=cs,Ba.chunk=function(e,t,n){t=(n?br(e,t,n):t===a)?1:ya(ho(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var r=0,s=0,o=ie(ht(i/t));r<i;)o[s++]=ai(e,r,r+=t);return o},Ba.compact=function(e){for(var t=-1,a=null==e?0:e.length,n=0,i=[];++t<a;){var r=e[t];r&&(i[n++]=r)}return i},Ba.concat=function(){var e=arguments.length;if(!e)return[];for(var t=ie(e-1),a=arguments[0],n=e;n--;)t[n-1]=arguments[n];return Ft(js(a)?xi(a):[a],yn(t,1))},Ba.cond=function(e){var t=null==e?0:e.length,a=or();return e=t?Et(e,(function(e){if("function"!=typeof e[1])throw new xe(n);return[a(e[0]),e[1]]})):[],Zn((function(a){for(var n=-1;++n<t;){var i=e[n];if(St(i[0],this,a))return St(i[1],this,a)}}))},Ba.conforms=function(e){return function(e){var t=Io(e);return function(a){return ln(a,e,t)}}(on(e,1))},Ba.constant=Qo,Ba.countBy=hs,Ba.create=function(e,t){var a=Oa(e);return null==t?a:an(a,t)},Ba.curry=function e(t,n,i){var r=Ji(t,8,a,a,a,a,a,n=i?a:n);return r.placeholder=e.placeholder,r},Ba.curryRight=function e(t,n,i){var r=Ji(t,16,a,a,a,a,a,n=i?a:n);return r.placeholder=e.placeholder,r},Ba.debounce=Cs,Ba.defaults=ko,Ba.defaultsDeep=So,Ba.defer=Is,Ba.delay=Vs,Ba.difference=Br,Ba.differenceBy=Or,Ba.differenceWith=$r,Ba.drop=function(e,t,n){var i=null==e?0:e.length;return i?ai(e,(t=n||t===a?1:ho(t))<0?0:t,i):[]},Ba.dropRight=function(e,t,n){var i=null==e?0:e.length;return i?ai(e,0,(t=i-(t=n||t===a?1:ho(t)))<0?0:t):[]},Ba.dropRightWhile=function(e,t){return e&&e.length?pi(e,or(t,3),!0,!0):[]},Ba.dropWhile=function(e,t){return e&&e.length?pi(e,or(t,3),!0):[]},Ba.fill=function(e,t,n,i){var r=null==e?0:e.length;return r?(n&&"number"!=typeof n&&br(e,t,n)&&(n=0,i=r),function(e,t,n,i){var r=e.length;for((n=ho(n))<0&&(n=-n>r?0:r+n),(i=i===a||i>r?r:ho(i))<0&&(i+=r),i=n>i?0:fo(i);n<i;)e[n++]=t;return e}(e,t,n,i)):[]},Ba.filter=function(e,t){return(js(e)?Ct:mn)(e,or(t,3))},Ba.flatMap=function(e,t){return yn(ws(e,t),1)},Ba.flatMapDeep=function(e,t){return yn(ws(e,t),u)},Ba.flatMapDepth=function(e,t,n){return n=n===a?1:ho(n),yn(ws(e,t),n)},Ba.flatten=zr,Ba.flattenDeep=function(e){return null!=e&&e.length?yn(e,u):[]},Ba.flattenDepth=function(e,t){return null!=e&&e.length?yn(e,t=t===a?1:ho(t)):[]},Ba.flip=function(e){return Ji(e,512)},Ba.flow=el,Ba.flowRight=tl,Ba.fromPairs=function(e){for(var t=-1,a=null==e?0:e.length,n={};++t<a;){var i=e[t];n[i[0]]=i[1]}return n},Ba.functions=function(e){return null==e?[]:wn(e,Io(e))},Ba.functionsIn=function(e){return null==e?[]:wn(e,Vo(e))},Ba.groupBy=bs,Ba.initial=function(e){return null!=e&&e.length?ai(e,0,-1):[]},Ba.intersection=Yr,Ba.intersectionBy=Hr,Ba.intersectionWith=Gr,Ba.invert=Mo,Ba.invertBy=xo,Ba.invokeMap=vs,Ba.iteratee=nl,Ba.keyBy=_s,Ba.keys=Io,Ba.keysIn=Vo,Ba.map=ws,Ba.mapKeys=function(e,t){var a={};return t=or(t,3),vn(e,(function(e,n,i){nn(a,t(e,n,i),e)})),a},Ba.mapValues=function(e,t){var a={};return t=or(t,3),vn(e,(function(e,n,i){nn(a,n,t(e,n,i))})),a},Ba.matches=function(e){return On(on(e,1))},Ba.matchesProperty=function(e,t){return $n(e,on(t,1))},Ba.memoize=Es,Ba.merge=Eo,Ba.mergeWith=Fo,Ba.method=il,Ba.methodOf=rl,Ba.mixin=sl,Ba.negate=Fs,Ba.nthArg=function(e){return e=ho(e),Zn((function(t){return jn(t,e)}))},Ba.omit=Do,Ba.omitBy=function(e,t){return Lo(e,Fs(or(t)))},Ba.once=function(e){return Ts(2,e)},Ba.orderBy=function(e,t,n,i){return null==e?[]:(js(t)||(t=null==t?[]:[t]),js(n=i?a:n)||(n=null==n?[]:[n]),zn(e,t,n))},Ba.over=ll,Ba.overArgs=Ds,Ba.overEvery=ul,Ba.overSome=cl,Ba.partial=Rs,Ba.partialRight=Ls,Ba.partition=As,Ba.pick=Ro,Ba.pickBy=Lo,Ba.property=dl,Ba.propertyOf=function(e){return function(t){return null==e?a:An(e,t)}},Ba.pull=Zr,Ba.pullAll=Jr,Ba.pullAllBy=function(e,t,a){return e&&e.length&&t&&t.length?Yn(e,t,or(a,2)):e},Ba.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Yn(e,t,a,n):e},Ba.pullAt=Kr,Ba.range=pl,Ba.rangeRight=hl,Ba.rearg=Ps,Ba.reject=function(e,t){return(js(e)?Ct:mn)(e,Fs(or(t,3)))},Ba.remove=function(e,t){var a=[];if(!e||!e.length)return a;var n=-1,i=[],r=e.length;for(t=or(t,3);++n<r;){var s=e[n];t(s,n,e)&&(a.push(s),i.push(n))}return Hn(e,i),a},Ba.rest=function(e,t){if("function"!=typeof e)throw new xe(n);return Zn(e,t=t===a?t:ho(t))},Ba.reverse=Xr,Ba.sampleSize=function(e,t,n){return t=(n?br(e,t,n):t===a)?1:ho(t),(js(e)?Ja:Kn)(e,t)},Ba.set=function(e,t,a){return null==e?e:Xn(e,t,a)},Ba.setWith=function(e,t,n,i){return i="function"==typeof i?i:a,null==e?e:Xn(e,t,n,i)},Ba.shuffle=function(e){return(js(e)?Ka:ti)(e)},Ba.slice=function(e,t,n){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&br(e,t,n)?(t=0,n=i):(t=null==t?0:ho(t),n=n===a?i:ho(n)),ai(e,t,n)):[]},Ba.sortBy=ks,Ba.sortedUniq=function(e){return e&&e.length?si(e):[]},Ba.sortedUniqBy=function(e,t){return e&&e.length?si(e,or(t,2)):[]},Ba.split=function(e,t,n){return n&&"number"!=typeof n&&br(e,t,n)&&(t=n=a),(n=n===a?p:n>>>0)?(e=go(e))&&("string"==typeof t||null!=t&&!no(t))&&!(t=li(t))&&ia(e)?_i(da(e),0,n):e.split(t,n):[]},Ba.spread=function(e,t){if("function"!=typeof e)throw new xe(n);return t=null==t?0:ya(ho(t),0),Zn((function(a){var n=a[t],i=_i(a,0,t);return n&&Ft(i,n),St(e,this,i)}))},Ba.tail=function(e){var t=null==e?0:e.length;return t?ai(e,1,t):[]},Ba.take=function(e,t,n){return e&&e.length?ai(e,0,(t=n||t===a?1:ho(t))<0?0:t):[]},Ba.takeRight=function(e,t,n){var i=null==e?0:e.length;return i?ai(e,(t=i-(t=n||t===a?1:ho(t)))<0?0:t,i):[]},Ba.takeRightWhile=function(e,t){return e&&e.length?pi(e,or(t,3),!1,!0):[]},Ba.takeWhile=function(e,t){return e&&e.length?pi(e,or(t,3)):[]},Ba.tap=function(e,t){return t(e),e},Ba.throttle=function(e,t,a){var i=!0,r=!0;if("function"!=typeof e)throw new xe(n);return Xs(a)&&(i="leading"in a?!!a.leading:i,r="trailing"in a?!!a.trailing:r),Cs(e,t,{leading:i,maxWait:t,trailing:r})},Ba.thru=ds,Ba.toArray=co,Ba.toPairs=Po,Ba.toPairsIn=Bo,Ba.toPath=function(e){return js(e)?Et(e,Rr):so(e)?[e]:xi(Dr(go(e)))},Ba.toPlainObject=yo,Ba.transform=function(e,t,a){var n=js(e),i=n||Hs(e)||oo(e);if(t=or(t,4),null==a){var r=e&&e.constructor;a=i?n?new r:[]:Xs(e)&&Zs(r)?Oa(Ye(e)):{}}return(i?Tt:vn)(e,(function(e,n,i){return t(a,e,n,i)})),a},Ba.unary=function(e){return Ns(e,1)},Ba.union=Qr,Ba.unionBy=es,Ba.unionWith=ts,Ba.uniq=function(e){return e&&e.length?ui(e):[]},Ba.uniqBy=function(e,t){return e&&e.length?ui(e,or(t,2)):[]},Ba.uniqWith=function(e,t){return t="function"==typeof t?t:a,e&&e.length?ui(e,a,t):[]},Ba.unset=function(e,t){return null==e||ci(e,t)},Ba.unzip=as,Ba.unzipWith=ns,Ba.update=function(e,t,a){return null==e?e:di(e,t,gi(a))},Ba.updateWith=function(e,t,n,i){return i="function"==typeof i?i:a,null==e?e:di(e,t,gi(n),i)},Ba.values=Oo,Ba.valuesIn=function(e){return null==e?[]:Kt(e,Vo(e))},Ba.without=is,Ba.words=Jo,Ba.wrap=function(e,t){return Rs(gi(t),e)},Ba.xor=rs,Ba.xorBy=ss,Ba.xorWith=os,Ba.zip=ls,Ba.zipObject=function(e,t){return mi(e||[],t||[],Qa)},Ba.zipObjectDeep=function(e,t){return mi(e||[],t||[],Xn)},Ba.zipWith=us,Ba.entries=Po,Ba.entriesIn=Bo,Ba.extend=vo,Ba.extendWith=_o,sl(Ba,Ba),Ba.add=gl,Ba.attempt=Ko,Ba.camelCase=$o,Ba.capitalize=Uo,Ba.ceil=bl,Ba.clamp=function(e,t,n){return n===a&&(n=t,t=a),n!==a&&(n=(n=mo(n))==n?n:0),t!==a&&(t=(t=mo(t))==t?t:0),sn(mo(e),t,n)},Ba.clone=function(e){return on(e,4)},Ba.cloneDeep=function(e){return on(e,5)},Ba.cloneDeepWith=function(e,t){return on(e,5,t="function"==typeof t?t:a)},Ba.cloneWith=function(e,t){return on(e,4,t="function"==typeof t?t:a)},Ba.conformsTo=function(e,t){return null==t||ln(e,t,Io(t))},Ba.deburr=jo,Ba.defaultTo=function(e,t){return null==e||e!=e?t:e},Ba.divide=vl,Ba.endsWith=function(e,t,n){e=go(e),t=li(t);var i=e.length,r=n=n===a?i:sn(ho(n),0,i);return(n-=t.length)>=0&&e.slice(n,r)==t},Ba.eq=Bs,Ba.escape=function(e){return(e=go(e))&&q.test(e)?e.replace(H,aa):e},Ba.escapeRegExp=function(e){return(e=go(e))&&ae.test(e)?e.replace(te,"\\$&"):e},Ba.every=function(e,t,n){var i=js(e)?xt:hn;return n&&br(e,t,n)&&(t=a),i(e,or(t,3))},Ba.find=fs,Ba.findIndex=Ur,Ba.findKey=function(e,t){return Bt(e,or(t,3),vn)},Ba.findLast=ms,Ba.findLastIndex=jr,Ba.findLastKey=function(e,t){return Bt(e,or(t,3),_n)},Ba.floor=_l,Ba.forEach=ys,Ba.forEachRight=gs,Ba.forIn=function(e,t){return null==e?e:gn(e,or(t,3),Vo)},Ba.forInRight=function(e,t){return null==e?e:bn(e,or(t,3),Vo)},Ba.forOwn=function(e,t){return e&&vn(e,or(t,3))},Ba.forOwnRight=function(e,t){return e&&_n(e,or(t,3))},Ba.get=No,Ba.gt=Os,Ba.gte=$s,Ba.has=function(e,t){return null!=e&&fr(e,t,Tn)},Ba.hasIn=To,Ba.head=Wr,Ba.identity=al,Ba.includes=function(e,t,a,n){e=Ws(e)?e:Oo(e),a=a&&!n?ho(a):0;var i=e.length;return a<0&&(a=ya(i+a,0)),ro(e)?a<=i&&e.indexOf(t,a)>-1:!!i&&$t(e,t,a)>-1},Ba.indexOf=function(e,t,a){var n=null==e?0:e.length;if(!n)return-1;var i=null==a?0:ho(a);return i<0&&(i=ya(n+i,0)),$t(e,t,i)},Ba.inRange=function(e,t,n){return t=po(t),n===a?(n=t,t=0):n=po(n),function(e,t,a){return e>=ga(t,a)&&e<ya(t,a)}(e=mo(e),t,n)},Ba.invoke=Co,Ba.isArguments=Us,Ba.isArray=js,Ba.isArrayBuffer=zs,Ba.isArrayLike=Ws,Ba.isArrayLikeObject=Ys,Ba.isBoolean=function(e){return!0===e||!1===e||Qs(e)&&Sn(e)==y},Ba.isBuffer=Hs,Ba.isDate=Gs,Ba.isElement=function(e){return Qs(e)&&1===e.nodeType&&!ao(e)},Ba.isEmpty=function(e){if(null==e)return!0;if(Ws(e)&&(js(e)||"string"==typeof e||"function"==typeof e.splice||Hs(e)||oo(e)||Us(e)))return!e.length;var t=hr(e);if(t==w||t==T)return!e.size;if(Ar(e))return!Rn(e).length;for(var a in e)if(De.call(e,a))return!1;return!0},Ba.isEqual=function(e,t){return Vn(e,t)},Ba.isEqualWith=function(e,t,n){var i=(n="function"==typeof n?n:a)?n(e,t):a;return i===a?Vn(e,t,a,n):!!i},Ba.isError=qs,Ba.isFinite=function(e){return"number"==typeof e&&Pt(e)},Ba.isFunction=Zs,Ba.isInteger=Js,Ba.isLength=Ks,Ba.isMap=eo,Ba.isMatch=function(e,t){return e===t||En(e,t,ur(t))},Ba.isMatchWith=function(e,t,n){return n="function"==typeof n?n:a,En(e,t,ur(t),n)},Ba.isNaN=function(e){return to(e)&&e!=+e},Ba.isNative=function(e){if(wr(e))throw new Ae("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Fn(e)},Ba.isNil=function(e){return null==e},Ba.isNull=function(e){return null===e},Ba.isNumber=to,Ba.isObject=Xs,Ba.isObjectLike=Qs,Ba.isPlainObject=ao,Ba.isRegExp=no,Ba.isSafeInteger=function(e){return Js(e)&&e>=-9007199254740991&&e<=c},Ba.isSet=io,Ba.isString=ro,Ba.isSymbol=so,Ba.isTypedArray=oo,Ba.isUndefined=function(e){return e===a},Ba.isWeakMap=function(e){return Qs(e)&&hr(e)==C},Ba.isWeakSet=function(e){return Qs(e)&&"[object WeakSet]"==Sn(e)},Ba.join=function(e,t){return null==e?"":Yt.call(e,t)},Ba.kebabCase=zo,Ba.last=qr,Ba.lastIndexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var r=i;return n!==a&&(r=(r=ho(n))<0?ya(i+r,0):ga(r,i-1)),t==t?function(e,t,a){for(var n=a+1;n--;)if(e[n]===t)return n;return n}(e,t,r):Ot(e,jt,r,!0)},Ba.lowerCase=Wo,Ba.lowerFirst=Yo,Ba.lt=lo,Ba.lte=uo,Ba.max=function(e){return e&&e.length?fn(e,al,Nn):a},Ba.maxBy=function(e,t){return e&&e.length?fn(e,or(t,2),Nn):a},Ba.mean=function(e){return zt(e,al)},Ba.meanBy=function(e,t){return zt(e,or(t,2))},Ba.min=function(e){return e&&e.length?fn(e,al,Pn):a},Ba.minBy=function(e,t){return e&&e.length?fn(e,or(t,2),Pn):a},Ba.stubArray=fl,Ba.stubFalse=ml,Ba.stubObject=function(){return{}},Ba.stubString=function(){return""},Ba.stubTrue=function(){return!0},Ba.multiply=wl,Ba.nth=function(e,t){return e&&e.length?jn(e,ho(t)):a},Ba.noConflict=function(){return pt._===this&&(pt._=Oe),this},Ba.noop=ol,Ba.now=Ss,Ba.pad=function(e,t,a){e=go(e);var n=(t=ho(t))?ca(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return zi(ft(i),a)+e+zi(ht(i),a)},Ba.padEnd=function(e,t,a){e=go(e);var n=(t=ho(t))?ca(e):0;return t&&n<t?e+zi(t-n,a):e},Ba.padStart=function(e,t,a){e=go(e);var n=(t=ho(t))?ca(e):0;return t&&n<t?zi(t-n,a)+e:e},Ba.parseInt=function(e,t,a){return a||null==t?t=0:t&&(t=+t),va(go(e).replace(ne,""),t||0)},Ba.random=function(e,t,n){if(n&&"boolean"!=typeof n&&br(e,t,n)&&(t=n=a),n===a&&("boolean"==typeof t?(n=t,t=a):"boolean"==typeof e&&(n=e,e=a)),e===a&&t===a?(e=0,t=1):(e=po(e),t===a?(t=e,e=0):t=po(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var r=_a();return ga(e+r*(t-e+lt("1e-"+((r+"").length-1))),t)}return Gn(e,t)},Ba.reduce=function(e,t,a){var n=js(e)?Dt:Ht,i=arguments.length<3;return n(e,or(t,4),a,i,dn)},Ba.reduceRight=function(e,t,a){var n=js(e)?Rt:Ht,i=arguments.length<3;return n(e,or(t,4),a,i,pn)},Ba.repeat=function(e,t,n){return t=(n?br(e,t,n):t===a)?1:ho(t),qn(go(e),t)},Ba.replace=function(){var e=arguments,t=go(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ba.result=function(e,t,n){var i=-1,r=(t=bi(t,e)).length;for(r||(r=1,e=a);++i<r;){var s=null==e?a:e[Rr(t[i])];s===a&&(i=r,s=n),e=Zs(s)?s.call(e):s}return e},Ba.round=Al,Ba.runInContext=e,Ba.sample=function(e){return(js(e)?Za:Jn)(e)},Ba.size=function(e){if(null==e)return 0;if(Ws(e))return ro(e)?ca(e):e.length;var t=hr(e);return t==w||t==T?e.size:Rn(e).length},Ba.snakeCase=Ho,Ba.some=function(e,t,n){var i=js(e)?Lt:ni;return n&&br(e,t,n)&&(t=a),i(e,or(t,3))},Ba.sortedIndex=function(e,t){return ii(e,t)},Ba.sortedIndexBy=function(e,t,a){return ri(e,t,or(a,2))},Ba.sortedIndexOf=function(e,t){var a=null==e?0:e.length;if(a){var n=ii(e,t);if(n<a&&Bs(e[n],t))return n}return-1},Ba.sortedLastIndex=function(e,t){return ii(e,t,!0)},Ba.sortedLastIndexBy=function(e,t,a){return ri(e,t,or(a,2),!0)},Ba.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var a=ii(e,t,!0)-1;if(Bs(e[a],t))return a}return-1},Ba.startCase=Go,Ba.startsWith=function(e,t,a){return e=go(e),a=null==a?0:sn(ho(a),0,e.length),t=li(t),e.slice(a,a+t.length)==t},Ba.subtract=kl,Ba.sum=function(e){return e&&e.length?Gt(e,al):0},Ba.sumBy=function(e,t){return e&&e.length?Gt(e,or(t,2)):0},Ba.template=function(e,t,n){var i=Ba.templateSettings;n&&br(e,t,n)&&(t=a),e=go(e),t=_o({},t,i,Ki);var r,s,o=_o({},t.imports,i.imports,Ki),l=Io(o),u=Kt(o,l),c=0,d=t.interpolate||ve,p="__p += '",h=Te((t.escape||ve).source+"|"+d.source+"|"+(d===K?de:ve).source+"|"+(t.evaluate||ve).source+"|$","g"),f="//# sourceURL="+(De.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++it+"]")+"\n";e.replace(h,(function(t,a,n,i,o,l){return n||(n=i),p+=e.slice(c,l).replace(_e,na),a&&(r=!0,p+="' +\n__e("+a+") +\n'"),o&&(s=!0,p+="';\n"+o+";\n__p += '"),n&&(p+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),c=l+t.length,t})),p+="';\n";var m=De.call(t,"variable")&&t.variable;if(m){if(ue.test(m))throw new Ae("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(s?p.replace(j,""):p).replace(z,"$1").replace(W,"$1;"),p="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(r?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var y=Ko((function(){return ke(l,f+"return "+p).apply(a,u)}));if(y.source=p,qs(y))throw y;return y},Ba.times=function(e,t){if((e=ho(e))<1||e>c)return[];var a=p,n=ga(e,p);t=or(t),e-=p;for(var i=qt(n,t);++a<e;)t(a);return i},Ba.toFinite=po,Ba.toInteger=ho,Ba.toLength=fo,Ba.toLower=function(e){return go(e).toLowerCase()},Ba.toNumber=mo,Ba.toSafeInteger=function(e){return e?sn(ho(e),-9007199254740991,c):0===e?e:0},Ba.toString=go,Ba.toUpper=function(e){return go(e).toUpperCase()},Ba.trim=function(e,t,n){if((e=go(e))&&(n||t===a))return Zt(e);if(!e||!(t=li(t)))return e;var i=da(e),r=da(t);return _i(i,Qt(i,r),ea(i,r)+1).join("")},Ba.trimEnd=function(e,t,n){if((e=go(e))&&(n||t===a))return e.slice(0,pa(e)+1);if(!e||!(t=li(t)))return e;var i=da(e);return _i(i,0,ea(i,da(t))+1).join("")},Ba.trimStart=function(e,t,n){if((e=go(e))&&(n||t===a))return e.replace(ne,"");if(!e||!(t=li(t)))return e;var i=da(e);return _i(i,Qt(i,da(t))).join("")},Ba.truncate=function(e,t){var n=30,i="...";if(Xs(t)){var r="separator"in t?t.separator:r;n="length"in t?ho(t.length):n,i="omission"in t?li(t.omission):i}var s=(e=go(e)).length;if(ia(e)){var o=da(e);s=o.length}if(n>=s)return e;var l=n-ca(i);if(l<1)return i;var u=o?_i(o,0,l).join(""):e.slice(0,l);if(r===a)return u+i;if(o&&(l+=u.length-l),no(r)){if(e.slice(l).search(r)){var c,d=u;for(r.global||(r=Te(r.source,go(pe.exec(r))+"g")),r.lastIndex=0;c=r.exec(d);)var p=c.index;u=u.slice(0,p===a?l:p)}}else if(e.indexOf(li(r),l)!=l){var h=u.lastIndexOf(r);h>-1&&(u=u.slice(0,h))}return u+i},Ba.unescape=function(e){return(e=go(e))&&G.test(e)?e.replace(Y,ha):e},Ba.uniqueId=function(e){var t=++Re;return go(e)+t},Ba.upperCase=qo,Ba.upperFirst=Zo,Ba.each=ys,Ba.eachRight=gs,Ba.first=Wr,sl(Ba,(yl={},vn(Ba,(function(e,t){De.call(Ba.prototype,t)||(yl[t]=e)})),yl),{chain:!1}),Ba.VERSION="4.17.21",Tt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ba[e].placeholder=Ba})),Tt(["drop","take"],(function(e,t){ja.prototype[e]=function(n){n=n===a?1:ya(ho(n),0);var i=this.__filtered__&&!t?new ja(this):this.clone();return i.__filtered__?i.__takeCount__=ga(n,i.__takeCount__):i.__views__.push({size:ga(n,p),type:e+(i.__dir__<0?"Right":"")}),i},ja.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Tt(["filter","map","takeWhile"],(function(e,t){var a=t+1,n=1==a||3==a;ja.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:or(e,3),type:a}),t.__filtered__=t.__filtered__||n,t}})),Tt(["head","last"],(function(e,t){var a="take"+(t?"Right":"");ja.prototype[e]=function(){return this[a](1).value()[0]}})),Tt(["initial","tail"],(function(e,t){var a="drop"+(t?"":"Right");ja.prototype[e]=function(){return this.__filtered__?new ja(this):this[a](1)}})),ja.prototype.compact=function(){return this.filter(al)},ja.prototype.find=function(e){return this.filter(e).head()},ja.prototype.findLast=function(e){return this.reverse().find(e)},ja.prototype.invokeMap=Zn((function(e,t){return"function"==typeof e?new ja(this):this.map((function(a){return Cn(a,e,t)}))})),ja.prototype.reject=function(e){return this.filter(Fs(or(e)))},ja.prototype.slice=function(e,t){e=ho(e);var n=this;return n.__filtered__&&(e>0||t<0)?new ja(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==a&&(n=(t=ho(t))<0?n.dropRight(-t):n.take(t-e)),n)},ja.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},ja.prototype.toArray=function(){return this.take(p)},vn(ja.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),r=Ba[i?"take"+("last"==t?"Right":""):t],s=i||/^find/.test(t);r&&(Ba.prototype[t]=function(){var t=this.__wrapped__,o=i?[1]:arguments,l=t instanceof ja,u=o[0],c=l||js(t),d=function(e){var t=r.apply(Ba,Ft([e],o));return i&&p?t[0]:t};c&&n&&"function"==typeof u&&1!=u.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,f=s&&!p,m=l&&!h;if(!s&&c){t=m?t:new ja(this);var y=e.apply(t,o);return y.__actions__.push({func:ds,args:[d],thisArg:a}),new Ua(y,p)}return f&&m?e.apply(this,o):(y=this.thru(d),f?i?y.value()[0]:y.value():y)})})),Tt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ce[e],a=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Ba.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(js(i)?i:[],e)}return this[a]((function(a){return t.apply(js(a)?a:[],e)}))}})),vn(ja.prototype,(function(e,t){var a=Ba[t];if(a){var n=a.name+"";De.call(Ca,n)||(Ca[n]=[]),Ca[n].push({name:t,func:a})}})),Ca[Oi(a,2).name]=[{name:"wrapper",func:a}],ja.prototype.clone=function(){var e=new ja(this.__wrapped__);return e.__actions__=xi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=xi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=xi(this.__views__),e},ja.prototype.reverse=function(){if(this.__filtered__){var e=new ja(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},ja.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,a=js(e),n=t<0,i=a?e.length:0,r=function(e,t,a){for(var n=-1,i=a.length;++n<i;){var r=a[n],s=r.size;switch(r.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=ga(t,e+s);break;case"takeRight":e=ya(e,t-s)}}return{start:e,end:t}}(0,i,this.__views__),s=r.start,o=r.end,l=o-s,u=n?o:s-1,c=this.__iteratees__,d=c.length,p=0,h=ga(l,this.__takeCount__);if(!a||!n&&i==l&&h==l)return hi(e,this.__actions__);var f=[];e:for(;l--&&p<h;){for(var m=-1,y=e[u+=t];++m<d;){var g=c[m],b=g.iteratee,v=g.type,_=b(y);if(2==v)y=_;else if(!_){if(1==v)continue e;break e}}f[p++]=y}return f},Ba.prototype.at=ps,Ba.prototype.chain=function(){return cs(this)},Ba.prototype.commit=function(){return new Ua(this.value(),this.__chain__)},Ba.prototype.next=function(){this.__values__===a&&(this.__values__=co(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?a:this.__values__[this.__index__++]}},Ba.prototype.plant=function(e){for(var t,n=this;n instanceof $a;){var i=Pr(n);i.__index__=0,i.__values__=a,t?r.__wrapped__=i:t=i;var r=i;n=n.__wrapped__}return r.__wrapped__=e,t},Ba.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof ja){var t=e;return this.__actions__.length&&(t=new ja(this)),(t=t.reverse()).__actions__.push({func:ds,args:[Xr],thisArg:a}),new Ua(t,this.__chain__)}return this.thru(Xr)},Ba.prototype.toJSON=Ba.prototype.valueOf=Ba.prototype.value=function(){return hi(this.__wrapped__,this.__actions__)},Ba.prototype.first=Ba.prototype.head,Je&&(Ba.prototype[Je]=function(){return this}),Ba}();ft?((ft.exports=fa)._=fa,ht._=fa):pt._=fa}).call(G)}(H,H.exports)),H.exports);class Z extends ${name="";displayName="";type=void 0;info;preload=!0;loadingManagerRule="load";item;itemRepo;condition;conditionFields=[];conditionFieldNames=[];dependantFields=[];dependenciesInitialized=!1;linkableTypes=[];collapsed=!1;presets=[];datatype=null;defaultValue=null;minValue=null;maxValue=null;language=null;widget=null;length=null;labelType=null;blocks=[];connections=[];_id="";_internalValue;_internalOptions=[];_updateConditions=!0;_hidden=!1;get hidden(){return!(!this.condition||!this.dependenciesInitialized)&&(this._updateConditions&&(this._hidden=!this._calculateConditionBlock(this.condition),this._updateConditions=!1),this._hidden)}get id(){return this._id}get options(){return this._internalOptions}set options(e){this._internalOptions=e,this.updateConditions()}get value(){return this._internalValue}set value(e){this._internalValue=e,this._processDependencies()}constructor(e,t=void 0,a=void 0,n=void 0,i=void 0,r=void 0){super(i),e instanceof O?(this._id=e.id,this.restoreFromSnapshot(e)):(h.assert(e,"Field has no name!"),h.assert(a,"Field has no type!"),this._id=h.createFieldID(),this.name=e,this.displayName=t||e,this.type=a,this._internalValue=n,this.item=i,this.itemRepo=r)}updateConditions(){this.condition&&this.dependenciesInitialized&&(this._updateConditions=!0,u.$emit("field:hiddenChanged",this.id))}getId(){return this.id}resetValue(){this.value=this.defaultValue}makeIdsUnique(e=new Map,t=!1){if(e.has(this._id)||t){const t=h.createFieldID();e.set(this._id,t),this._id=t}else e.set(this._id,this._id);for(const a of this.blocks)a.makeIdsUnique(e,t);return e}transformNodeIds(e){for(const t of this.blocks)t.transformNodeIds(e);"Attribute"===this.type&&"Node"===this.datatype&&this.value&&e.has(this.value)&&(this.value=e.get(this.value))}findBlock(e){for(const t of this.blocks){const a=t.findBlock(e);if(a)return a}return null}clone(e=void 0,t=!1){let a=new Z(this.name,this.displayName,this.type);void 0===this._internalValue?a._internalValue=void 0:null===this._internalValue?a._internalValue=null:"Link"===this.type?a._internalValue=this._internalValue:a._internalValue=q.cloneDeep(this._internalValue),a.info=this.info,a.preload=this.preload,a.loadingManagerRule=this.loadingManagerRule,a.item=this.item,a.ownerItem=this.ownerItem,a.itemRepo=this.itemRepo,a.condition=this.condition,a.conditionFields=this.conditionFields,a.conditionFieldNames=this.conditionFieldNames,a.dependantFields=this.dependantFields,a.collapsed=this.collapsed,a.presets=this.presets,a.labelType=this.labelType,a.datatype=this.datatype,a.defaultValue=this.defaultValue,a.minValue=this.minValue,a.maxValue=this.maxValue,a.options=this.options,a.language=this.language,a.widget=this.widget,a.length=this.length,a.linkableTypes=this.linkableTypes;for(const n of this.blocks){let i=n.clone(e,!0,{},t);e&&(i=g.instance.proxyBlock(i,e)),a.blocks.push(i)}for(const t of this.connections){let n=t.clone();e&&(n=g.instance.proxyConnection(n,e)),a.connections.push(n)}return a}_processDependencies(){for(const e of this.dependantFields)e.updateConditions()}_getConditionField(e){for(const t of this.conditionFields)if(t&&t.name===e)return t;return null}_calculateConditionField(e,t){if(!e.startsWith("$")){let a;e.includes(".")?(a=e.split("."),e=a.splice(0,1)[0]):a=[];let n=e.endsWith("?");n&&(e=e.substring(0,e.length-1));const i=this._getConditionField(e);if(!i)return n||console.error("Field to resolve condition not found: "+e),!1;let r=i.value;for(let t=0;t<a.length;t++){if(!r)return console.error(`Field path ${a.join(".")} not found in field ${e}!`),!1;r=r[a[t]]}return"object"==typeof t?void 0!==t.$isset?t.$isset===!!r:void 0!==t.$not?t.$not!==r:(console.error("Condition value cannot be interpreted: ",t,this),!1):i.value==t}switch(e){case"$isroot":return this.item._id===this.itemRepo.rootItemId===t;case"$parenttype":return console.log("$parenttype is not yet implemented!",this),!1;case"$optionsexist":return(Array.isArray(this.options)&&this.options.length>0)===t;case"$featureenabled":return this.itemRepo.apiClient.isFeatureEnabled(t);default:return console.error("Computed value unknown: "+e,this),!1}}_calculateConditionBlock(e){for(const t in e)if(e.hasOwnProperty(t)){const a=e[t];if("$or"===t)if(Array.isArray(a)){let e=!1;for(const t of a)if(this._calculateConditionBlock(t)){e=!0;break}if(!e)return!1}else console.error("Condition contains $or but its value is not an array!");else if("$not"===t){if("object"!=typeof a)console.error("When using the $not operator, the value needs to be an object");else if(this._calculateConditionBlock(a))return!1}else if(!this._calculateConditionField(t,a))return!1}return!0}refreshFieldDependencies(){for(const e of this.blocks)e.refreshFieldDependencies()}refreshDependantFields(e,t){const a=[];if(this.condition)for(let t of this.conditionFieldNames){const n=t.endsWith("?");n&&(t=t.substring(0,t.length-1));const i=e.get(t);i?a.push(i):n||console.warn("Condition field not found: "+t)}this.conditionFields=a,this.dependantFields=t||[],this.dependenciesInitialized=!0}setCondition(e){e?"object"==typeof e?this.condition=e:(console.error("Condition must be an object if set",e),this.condition=null):this.condition=null,this.conditionFieldNames=[],this.condition&&this._scanConditions(this.condition)}_scanConditions(e){for(let t in e)if(e.hasOwnProperty(t)){const a=e[t];if(Array.isArray(a))for(const e of a)this._scanConditions(e);else t.startsWith("$")||(t.includes(".")&&(t=t.split(".")[0]),this.conditionFieldNames.includes(t)||this.conditionFieldNames.push(t))}}forEachField(e){if(e(this),this.blocks)for(const t of this.blocks)t.forEachField(e)}setInfo(e){this.info=e}setPreload(e){this.preload=e}setLoadingManagerRule(e){this.loadingManagerRule=e}setLinkableTypes(e){this.linkableTypes=e}setDefaultValue(e){this.defaultValue=e,void 0!==this._internalValue&&null!==this._internalValue||(this._internalValue=e)}setMinValue(e){this.minValue=e}setMaxValue(e){this.maxValue=e}setOptions(e){this.options=e}setDatatype(e){this.datatype=e}setLanguage(e){this.language=e}setLength(e){this.length=e}setWidget(e){this.widget=e}setBlocks(e){this.blocks=e}setConnections(e){this.connections=e}setCollapsed(e){this.collapsed=!!e}setPresets(e){this.presets=e||[]}setLabelType(e){this.labelType=e||"info"}createSnapshot(e=!1){h.assert(this.id,"Field has no ID. Cannot create snapshot");const t=[];for(const a of this.blocks)t.push(a.createSnapshot(e));const a=[];for(const e of this.connections)a.push(e.createSnapshot());return new O(this.id,"field",{name:this.name,displayName:this.displayName,type:this.type,value:this._internalValue,preload:this.preload,info:this.info,loadingManagerRule:this.loadingManagerRule,item:this.item,itemRepo:this.itemRepo,condition:this.condition,conditionFields:this.conditionFields,conditionFieldNames:this.conditionFieldNames,dependantFields:this.dependantFields,linkableTypes:this.linkableTypes,collapsed:this.collapsed,presets:this.presets,datatype:this.datatype,defaultValue:this.defaultValue,minValue:this.minValue,maxValue:this.maxValue,options:this.options,language:this.language,widget:this.widget,length:this.length,labelType:this.labelType,blocks:t,connections:a})}restoreFromSnapshot(e){e.id===this.id?(this.name=e.data.name,this.displayName=e.data.displayName,this.type=e.data.type,this._internalValue=e.data.value,this.info=e.data.info,this.preload=e.data.preload,this.loadingManagerRule=e.data.loadingManagerRule,this.item=e.data.item,this.ownerItem=e.data.item,this.itemRepo=e.data.itemRepo,this.condition=e.data.condition,this.conditionFields=e.data.conditionFields,this.conditionFieldNames=e.data.conditionFieldNames,this.dependantFields=e.data.dependantFields,this.linkableTypes=e.data.linkableTypes,this.collapsed=e.data.collapsed,this.presets=e.data.presets,this.datatype=e.data.datatype,this.defaultValue=e.data.defaultValue,this.minValue=e.data.minValue,this.maxValue=e.data.maxValue,this.options=e.data.options,this.language=e.data.language,this.widget=e.data.widget,this.length=e.data.length,this.labelType=e.data.labelType,this.blocks=[],this.connections=[],this._rollbackArray(this.blocks,e.data.blocks,((e,t)=>g.instance.proxyBlock(new ae(e,t),this.ownerItem))),this._rollbackArray(this.connections,e.data.connections,((e,t)=>g.instance.proxyConnection(new U(e.data,t),this.ownerItem)))):console.error("Snapshot ID does not match! Cannot rollback!",this,e)}rollbackFromSnapshot(e){this.value=e.data.value,this._rollbackArray(this.blocks,e.data.blocks,((e,t)=>g.instance.proxyBlock(new ae(e,t),this.ownerItem))),this._rollbackArray(this.connections,e.data.connections,((e,t)=>g.instance.proxyConnection(new U(e.data,t),this.ownerItem)))}}class J extends ${id;name=void 0;displayName=void 0;value;type=void 0;datatype=void 0;linkableTypes=[];order=0;constructor(e=void 0,t=void 0,a=void 0){super(a),this.value=t,this.id=h.createItemOrBlockID(),this.name=e,this.displayName=e,this._updateDisplayName()}getId(){return this.id}setName(e){this.name=e,this._updateDisplayName()}setType(e){this.type=e}setOrder(e){this.order=e}clone(e=new Map){const t=new J;return t.ownerItem=this.ownerItem,t.value=e.get(this.value)??this.value,t.type=this.type,t.order=this.order,t.setName(this.name),t}clearDefinition(){this.type=void 0}setDefinition(e){const t=e.type.toLowerCase();switch(t){case"boolean":case"bool":this.type="Attribute",this.datatype="Boolean",this.value=void 0!==this.value?this._toBoolean(this.value):this._toBoolean(e.defaultValue);break;case"float":this.type="Attribute",this.datatype="Float",this.value=void 0!==this.value?Number(this.value):Number(e.defaultValue);break;case"int":this.type="Attribute",this.datatype="Integer",this.value=void 0!==this.value?parseInt(this.value):parseInt(e.defaultValue);break;case"string":this.type="Attribute",this.datatype="String",this.value=void 0!==this.value&&null!==this.value?this.value.toString():e.defaultValue?e.defaultValue.toString():"";break;case"vec2":this.type="Attribute",this.datatype="Vector2d";break;case"vec3":this.type="Attribute",this.datatype="Vector3d";break;case"vec4":this.type="Attribute",this.datatype="Vector4d";break;case"mat3":this.type="Attribute",this.datatype="Mat3";break;case"mat4":this.type="Attribute",this.datatype="Mat4";break;case"color":this.type="Attribute",this.datatype="Color";break;case"image":this.type="Link",this.linkableTypes=["Image"];break;default:console.error("Unknown script field type: "+t),this.type="Attribute",this.datatype="String",this.value=this.value?this.value.toString():e.defaultValue?e.defaultValue.toString():""}}_toBoolean(e){return null!=e&&(!0===e||!1===e?e:"false"!==e.toString().toLowerCase())}_updateDisplayName(){this.name?this.displayName=h.toUserFriendlyName(this.name):this.displayName=""}createSnapshot(){return new O(this.id,"customfield",{id:this.id,value:this.value})}rollbackFromSnapshot(e){this.value=e.data.value}}class K extends M{links;instanceId;isDirty=!1;fieldInstances;userFieldInstances;customFieldInstances;packageContent;packageType;public=!1;readOnly=!1;isPackaged=!1;isGenerated=!1;packageItem;isPreparedItem=!0;resultingAcl;userData={};constructor(e){if(super(e),this.instanceId=h.createItemOrBlockID(),this.links=[],Array.isArray(e.links))for(const t of e.links)this.links.push({to:t.to,usage:t.usage,stopRecursion:t.stopRecursion,item:t.item});this.fieldInstances=[],this.userFieldInstances=[],this.customFieldInstances=g.instance.proxyCustomFieldsArray([],this),this.public=!!e.public,this.packageContent=e.packageContent,this.packageType=e.packageType,this.packageItem=e.packageItem,this.readOnly=!!e.readOnly,this.isPackaged=!!e.isPackaged,this.isGenerated=!!e.isGenerated,this.resultingAcl=JSON.parse(JSON.stringify(e.resultingAcl||[]))}createCustomFieldInstances(e){function t(e,t){for(const a of e)if(a.name===t)return a;return null}for(const a of this.customFieldInstances)t(e,a.name)||a.clearDefinition();let a=0;for(const n of e){let e=t(this.customFieldInstances,n.name);e||(e=new J(n.name,n.defaultValue,this),this.addCustomField(e)),e.setOrder(a++),e.setDefinition(n)}this.customFieldInstances.sort((function(e,t){return e.order-t.order}))}addCustomField(e){this.customFieldInstances.push(g.instance.proxyCustomField(e,this))}markDirty(){this.isDirty||(this.isDirty=!0,u.$emit("itemRepo:itemBecameDirty",this._id))}makeIdsUnique(){const e=new Map;for(const t of this.fieldInstances)t.makeIdsUnique(e,!0);this.packageContent&&this.packageContent.makeIdsUnique()}clone(e=!1){let t=new K(this);const a=new Map;for(const n of this.fieldInstances){const i=n.clone(this,!0);e&&i.makeIdsUnique(a,!0),t.fieldInstances.push(i)}if(e)for(const e of t.fieldInstances)e.transformNodeIds(a);return t}findBlock(e){for(const t of this.fieldInstances){const a=t.findBlock(e);if(a)return a}return null}refreshFieldDependencies(){te.refreshFieldDependencies(this.fieldInstances);for(const e of this.fieldInstances)e.refreshFieldDependencies()}forEachItem(e){if(e(this),this.links)for(const t of this.links)t.item&&t.item.forEachItem(e)}forEachFieldInstance(e){if(this.fieldInstances)for(const t of this.fieldInstances)t.forEachField(e)}toString(){return`PreparedItem(${JSON.stringify({_id:this._id,name:this.name,type:this.type})})`}}function X(e,t,a){if(e.admin||e.superadmin)return!0;if(!Array.isArray(t))return!0;for(const n of t)if(n.can.includes(a)){if(!n.user&&!n.group)return!0;if(n.user&&n.user===e._id)return!0;if(n.group)for(const t of e.groups){if("object"==typeof t&&t._id===n.group)return!0;if(t===n.group)return!0}}}class Q{fields;constructor(e){if(!Array.isArray(e))throw"Template fields need to be an array!";this.fields=e}clone(){const e=[];for(const t of this.fields)e.push(t.clone());return new Q(e)}specialize(e){for(const t of this.fields)void 0!==e[t.name]&&(t.defaultValue=e[t.name]);return this}instantiate(e){if(e)return this.fields;{const e=[];for(const t of this.fields)e.push(t.clone());return e}}}class ee{templates=new Map;templatesByField=new Map;static _instance;static get instance(){return this._instance||(this._instance=new this)}_existsTemplate(e,t){for(const a of e)if(a.typeName===t)return!0;return!1}addTemplates(e,t,a){const n=`${e}_${t}`,i=this.templatesByField.get(n)||[];for(const e of a){const t=`${n}_${e.typeName}`;this.templates.set(t,e),this._existsTemplate(i,e.typeName)||i.push(e)}this.templatesByField.set(n,i)}getTemplate(e,t,a){const n=`${e}_${t}_${a}`;return this.templates.get(n)}getTemplates(e,t){const a=`${e}_${t}`;return this.templatesByField.get(a)||[]}}class te{itemRepo;itemFetcher;constructor(e){this.itemRepo=e,this.itemFetcher=function(e){return e}}setItemFetcher(e){this.itemFetcher=e}setFieldsFromDatatypes(e){const t=C(e.type,!0);e.fields=t?.fields||[],e.fieldSets=t?.fieldSets||[]}async prepare(e){return e instanceof K?(console.warn("Trying to prepare an already prepared item: ",e),e):this.itemRepo.undoManager.ignore((async()=>{const t=new K(e);return this.setFieldsFromDatatypes(t),t.fieldInstances=await this.createFieldInstances(t,t.fields,t.attributes,"","attributes",!1),t.userFieldInstances=await this.createFieldInstances(t,t.userFields,t.userAttributes,"","userAttributes",!1),t.customFieldInstances=await this.createCustomFieldInstances(t,t.userAttributes,"_"),t.allowConversation=!!t.allowConversation,t.packageContent&&(t.packageContent.name=t.name,await this.itemRepo.traverseItems((e=>{e.readOnly=!0,e.isPackaged=!0,e.packageItem=t}),t.packageContent)),t.packageItem?(t.readOnly=!0,t.isPackaged=!0):(t.isPackaged=!1,t.resultingAcl&&t.resultingAcl.length>0?t.readOnly=!X(await this.itemRepo.apiClient.me(!0),t.resultingAcl,"write"):t.readOnly=!0),t}))}async createCustomFieldInstances(e,t,a=""){if(!e)throw new w("createCustomFieldInstances(): Item cannot be null!");if(!t)throw new w("createCustomFieldInstances(): attributes cannot be null!");const n=[];for(const i in t)if(!a.length||i.startsWith(a)){const r=i.substring(a.length);let s=new J(r,t[i],e);s.setType("Attribute"),n.push(g.instance.proxyCustomField(s,e))}if(e.links)for(const t of e.links)if(!a.length||t.usage.startsWith(a)){const i=t.usage.substring(a.length);let r,{id:s,linkItem:o,stopRecursion:l}=await this.fetchLinkValue(e,t.usage);o?r=o:l&&(r=s);let u=new J(i,r,e);u.setType("Link"),n.push(g.instance.proxyCustomField(u,e))}return n}async createFieldInstances(e,t,a,n,i,r=!1){if(!e)throw new w("createFieldInstances(): Item cannot be null!");if(!t)throw new w("createFieldInstances(): Fields cannot be null!");const s=[],o=n.length?`${n}->`:n;for(let a=0;a<t.length;a++){const n=t[a];if("FieldSet"===n.type){const i=this.getFieldSet(e,n.name);i?(t.splice(a,1,...structuredClone(i.fields)),a+=i.fields.length-1):console.error("Fieldset not found: "+n.name)}}for(const n of t)switch(n.type){case"Separator":{const t=new Z("Separator",n.label,"Separator",null,e,this.itemRepo);t.setInfo(n.info),t.setCondition(n.if),t.setCollapsed(n.collapsed),t.setPresets(n.presets),s.push(t);break}case"Label":{const t=new Z("Label","","Label",n.text,e,this.itemRepo);t.setLabelType(n.labelType),t.setCondition(n.if),s.push(t);break}case"Link":{let t;if(!r){let{id:a,linkItem:i,stopRecursion:r}=await this.fetchLinkValue(e,n.usageAs);i?t=i:r&&(t=a)}let a=new Z(n.usageAs,n.displayName,n.type,t,e,this.itemRepo);a.setInfo(n.info),a.setCondition(n.if),a.setLinkableTypes(n.linkableTypes),void 0!==n.preload&&a.setPreload(n.preload),void 0!==n.loadingManager&&a.setLoadingManagerRule(n.loadingManager),s.push(g.instance.proxyItemField(a,e));break}case"Tree":{const t=`${o}${n.name}`,r=[];for(const s of n.childTypes){const n=new Q(await this.createFieldInstances(e,s.fields,a,t,i,!0));r.push({typeName:s.typeName,displayName:s.displayName||s.typeName,template:n,inputs:[],outputs:[]})}r.sort((function(e,t){return e.displayName.localeCompare(t.displayName)})),ee.instance.addTemplates(e.type,n.name,r);const l=new ae(void 0,void 0,"","Root",void 0,e),u=await this.readBlocks(e,l,n.name,t,a,!0,!0,"Tree");l.blocks=g.instance.proxyBlockArray(u,l,e);let c=new Z(n.name,n.displayName,n.type,null,e,this.itemRepo);c.setInfo(n.info),c.setCondition(n.if),c.setBlocks([l]),s.push(c);break}case"List":{const t=`${o}${n.name}`,r=new Q(await this.createFieldInstances(e,n.fields,a,t,i,!0)),l=[{typeName:"Entry",displayName:n.elementName,template:r,inputs:[],outputs:[]}];ee.instance.addTemplates(e.type,n.name,l);let u=new Z(n.name,n.displayName,n.type,null,e,this.itemRepo);const c=await this.readBlocks(e,void 0,n.name,t,a,!0,!0,"List"),d=g.instance.proxyListArray(c,u,e);u.setInfo(n.info),u.setCondition(n.if),u.setBlocks(d),s.push(u);break}case"NodeGraph":{const t=`${o}${n.name}`,r=[];for(const s of n.childTypes){const n=new Q(await this.createFieldInstances(e,s.fields,a,t,i,!0));r.push({typeName:s.typeName,displayName:s.displayName||s.typeName,template:n,inputs:s.inputs||[],outputs:s.outputs||[]})}r.sort((function(e,t){return e.displayName.localeCompare(t.displayName)})),ee.instance.addTemplates(e.type,n.name,r);let l=await this.readBlocks(e,void 0,n.name,t,a,!1,!1,"NodeGraph"),u=this.readConnections(e,t,a),c=new Z(n.name,n.displayName,n.type,null,e,this.itemRepo);c.setInfo(n.info),c.setCondition(n.if),c.setBlocks(g.instance.proxyGraphBlockArray(l,e)),c.setConnections(g.instance.proxyConnectionArray(u,e)),s.push(c);break}case"Attribute":{let t;r||(t=e[i]?e[i][n.name]:void 0,void 0===t&&(t=n.defaultValue));let a=new Z(n.name,n.displayName,n.type,t,e,this.itemRepo);a.setInfo(n.info),a.setCondition(n.if),a.setDefaultValue(n.defaultValue),a.setMinValue(n.minValue),a.setMaxValue(n.maxValue),a.setOptions(n.options),a.setDatatype(n.datatype),a.setLanguage(n.language),a.setWidget(n.widget),a.setLength(n.length),s.push(g.instance.proxyItemField(a,e));break}}return s}getFieldSet(e,t){if(Array.isArray(e.fieldSets))for(const a of e.fieldSets)if(a.name===t)return a;return null}async fetchLinkValue(e,t){if(!e)throw new w("fetchLinkValue(): Item cannot be null!");for(const a of e.links)if(a.usage===t)return{id:a.to,linkItem:a.item?await this.itemFetcher(a.item):null,stopRecursion:a.stopRecursion};return{id:null,linkItem:null}}async readBlocks(e,t,a,n,i,r,s,o){if(!e)throw new w("readBlocks(): Item cannot be null!");const l=[];let u=0;for(;;){const c=`${n}[${u}]`;if(!this.existsBlockNamespace(e,i,c))break;{const n=`${c}#id`,u=e.attributes[n],d=`${c}#subnodeid`,p=e.attributes[d],h=`${c}#type`;let f,m,y=e.attributes[h];switch(o){case"NodeGraph":{const t=`${c}#posx`,a=`${c}#posy`;f=e.attributes[t]||0,m=e.attributes[a]||0;break}case"List":r=!1,y="Entry"}const b=ee.instance.getTemplate(e.packageType||e.type,a,y);if(b){const n=b.typeName,d=b.displayName,h=new ae(u,t,n,n,d,e);p&&h.setSubNodeId(p);const y=await this.createFields(h,e,b.template,c,"NodeGraph"===o,i);if(h.setFields(y),"NodeGraph"===o&&(h.setPosition(f,m),h.setInputs(b.inputs),h.setOutputs(b.outputs)),r){const t=await this.readBlocks(e,h,a,c,i,r,s,o);h.blocks=g.instance.proxyBlockArray(t,h,e)}if(s){const t=await this.readScripts(e,h,c,i);h.scripts=g.instance.proxyScriptArray(t,h,e)}"NodeGraph"===o?l.push(g.instance.proxyGraphBlock(h,e)):l.push(g.instance.proxyBlock(h,e))}else console.error(`Block template not found: ${a}_${y}`)}u++}return l}async readScripts(e,t,a,n){if(!e)throw new w("readScripts(): Item cannot be null!");const i=[];let r=0;for(;;){const s=`${a}#scripts[${r}]`;if(!this.existsScriptNamespace(e,n,s))break;{const a=n[`${s}#id`],r=`${s}#item`,o=`${s}->`,l=o.length;let{linkItem:u}=await this.fetchLinkValue(e,r);const c=new W(a,t,e,u);i.push(c);for(const t in n)if(n.hasOwnProperty(t)&&t.startsWith(o)){const a=n[t],i=t.substring(l),r=new j(c,i,a,e);c.addField(r)}}r++}return i}existsScriptNamespace(e,t,a){if(!e)throw new w("existsScriptNamespace(): Item cannot be null!");return"Script"===t[`${a}#usage`]}readConnections(e,t,a){const n=[];let i=0;for(;;){const r=a[`${t}#connection[${i++}]`];if(!r)break;n.push(new U(r,e))}return n}existsBlockNamespace(e,t,a){if(!e)throw new w("existsBlockNamespace(): Item cannot be null!");const n=t[`${a}#usage`];if(n)return"Block"===n;for(const e in t)if(t.hasOwnProperty(e)&&e.startsWith(a))return!0;for(const t of e.links)if(t.usage.startsWith(a))return!0;return!1}async createFields(e,t,a,n,i,r,s=!1){let o=a.instantiate(s),l=[];for(const a of o)if(a.name){const s=`${n}->${a.name}`;switch(a.type){case"Link":if(n){let{id:e,linkItem:n,stopRecursion:i}=await this.fetchLinkValue(t,s);a.value=n||(i?e:null)}else a.value=a.defaultValue;break;case"List":{const e=await this.readBlocks(t,void 0,a.name,s,r,!0,!0,"List"),n=g.instance.proxyListArray(e,a,t);a.setBlocks(n);break}case"Attribute":n?(a.value=t.attributes[s],void 0===a.value&&(a.value=a.defaultValue)):a.value=a.defaultValue}i?l.push(g.instance.proxyGraphBlockField(a,e,t)):l.push(g.instance.proxyBlockField(a,e,t))}return l}static refreshFieldDependencies(e){const t=new Map,a=new Map;for(const a of e)t.set(a.name,a);for(const n of e)if(Array.isArray(n.conditionFieldNames))for(const e of n.conditionFieldNames){const i=t.get(e);if(i){const e=a.get(i);e?e.push(n):a.set(i,[n])}}for(const n of e)n.refreshDependantFields(t,a.get(n))}}class ae extends ${id="";parent=void 0;type=void 0;name="";displayName="";fields=[];blocks=[];isSelected=!1;isExpanded=!0;scripts=[];subNodeId=void 0;inputs=[];outputs=[];posX=0;posY=0;constructor(e=void 0,t=void 0,a=void 0,n=void 0,i=void 0,r=void 0){super(r),e instanceof O?this.restoreFromSnapshot(e,t):(this.id=e||h.createItemOrBlockID(),this.parent=t,this.type=a,this.name=n||this.type||"",this.displayName=i||this.name)}getId(){return this.id}setSubNodeId(e){this.subNodeId=e}getPositionInParent(){if(this.parent){let e=0;for(const t of this.parent.blocks){if(t.id===this.id)return e;e++}}return-1}refreshFieldDependencies(){te.refreshFieldDependencies(this.fields);for(const e of this.fields)e.refreshFieldDependencies();for(const e of this.blocks)e.refreshFieldDependencies()}resetFieldValues(e=!1){for(const e of this.fields)e.resetValue();if(e)for(const t of this.blocks)t.resetFieldValues(e)}makeIdsUnique(e=new Map,t=!1){if(e.has(this.id)||t){const t=h.createItemOrBlockID();e.set(this.id,t),this.id=t}else e.set(this.id,this.id);for(const a of this.fields)a.makeIdsUnique(e,t);for(const a of this.blocks)a.makeIdsUnique(e,t);for(const a of this.scripts)a.makeIdsUnique(e,t);return e}transformNodeIds(e){for(const t of this.fields)t.transformNodeIds(e);for(const t of this.blocks)t.transformNodeIds(e);for(const t of this.scripts)t.transformNodeIds(e)}clone(e,t=!0,a={},n=!1){const i=new ae;n&&(i.id=this.id),i.ownerItem=this.ownerItem,i.parent=this.parent,i.type=this.type,i.name=this.name,i.displayName=this.displayName,i.isSelected=!1,i.isExpanded=!0,i.inputs=this.inputs,i.outputs=this.outputs,i.subNodeId=this.subNodeId,i.posX=0,i.posY=0;for(const t of this.fields){let r=t.clone(e,n);void 0!==a[t.name]&&(r.value=a[t.name]),e&&(r=g.instance.proxyBlockField(r,i,e)),i.fields.push(r)}if(e&&(i.scripts=g.instance.proxyScriptArray(i.scripts,i,e)),t)for(const e of this.scripts){const t=e.clone();i.scripts.push(t)}const r=i.blocks;e&&(i.blocks=g.instance.proxyBlockArray(r,i,e));for(const a of this.blocks){let s=a.clone(e,t,{},n);s.parent=i,e&&(s=g.instance.proxyBlock(s,e)),r.push(s)}return i}getDescendantBlocks(e=[]){const t=this.blocks;return e.push(...t),t.forEach((t=>t.getDescendantBlocks(e))),e}setFields(e){this.fields=e}setInputs(e){this.inputs=e}setOutputs(e){this.outputs=e}setPosition(e,t){this.posX=e,this.posY=t}setSelected(e){this.isSelected=e}setExpanded(e){this.isExpanded=e}getRoot(){return this.parent?this.parent.getRoot():this}forEachField(e){if(this.fields)for(const t of this.fields)t.forEachField(e);if(this.blocks)for(const t of this.blocks)t.forEachField(e)}findField(e){for(const t of this.fields)if(t.name===e)return t;return null}findBlock(e){if(this.id===e)return this;for(const t of this.blocks){const a=t.findBlock(e);if(a)return a}return null}removeBlock(e){this.blocks.removeObject(e)}addBlock(e,t){this.blocks.includes(e)||(void 0===t?this.blocks.push(e):this.blocks.splice(t,0,e))}moveBlock(e,t){e.parent.blocks.moveObjectToArray(e,e.parent.blocks,t)}moveToPosition(e){this.parent.moveBlock(this,e)}moveBlockToParent(e,t){this.parent.blocks.moveObjectToArray(this,e.blocks,t),this.parent=e}moveToParent(e,t){if(this.findBlock(e))return void console.error("Cannot move block to a parent that is a child.");const a=this.getRoot();if(!a)return void console.error("Cannot find root block!");const n=a.findBlock(e);n?this.parent!==n?this.moveBlockToParent(n,t):console.warn(`Node is already in parent ${e}`):console.error(`Cannot find the new parent block: ${e}`)}getField(e){for(const t of this.fields)if(t.name===e)return t;return null}hasTag(e){const t=this.getField("Tags");return!(!t||!Array.isArray(t.value))&&t.value.includes(e)}hasOneTag(e){const t=this.getField("Tags");if(t&&Array.isArray(t.value))for(const a of e)if(t.value.includes(a))return!0;return!1}getNameFieldValue(){const e=this.getField("Name");return e?e.value:null}getActiveFieldValue(){const e=this.getField("Active");return!e||e.value}createSnapshot(e=!1){const t=[];for(const a of this.fields)a.createSnapshot&&t.push(a.createSnapshot(e));const a=[];if(!e)for(const t of this.blocks)a.push(t.createSnapshot(e));const n=[];for(const e of this.scripts)n.push(e.createSnapshot());return new O(this.id,"block",{id:this.id,ownerItem:this.ownerItem,subNodeId:this.subNodeId,type:this.type,name:this.name,displayName:this.displayName,fields:t,blocks:a,isExpanded:this.isExpanded,scripts:n,inputs:this.inputs,outputs:this.outputs,posX:this.posX,posY:this.posY})}restoreFromSnapshot(e,t){this.id=e.data.id,this.parent=t,this.subNodeId=e.data.subNodeId,this.type=e.data.type,this.ownerItem=e.data.ownerItem,this.name=e.data.name,this.displayName=e.data.displayName,this.isSelected=!1,this.isExpanded=e.data.isExpanded,this.inputs=e.data.inputs,this.outputs=e.data.outputs,this.posX=e.data.posX,this.posY=e.data.posY;const a=[];this._rollbackArray(a,e.data.fields,(e=>g.instance.proxyBlockField(new Z(e),this,this.ownerItem))),this.fields=a;const n=[];this._rollbackArray(n,e.data.blocks,((e,t)=>g.instance.proxyBlock(new ae(e,t),this.ownerItem))),this.blocks=g.instance.proxyBlockArray(n,this,this.ownerItem);const i=[];this._rollbackArray(i,e.data.scripts,((e,t)=>new W(e,t,this.ownerItem))),this.scripts=g.instance.proxyScriptArray(i,this,this.ownerItem)}rollbackFromSnapshot(e,t=!1){this._rollbackArray(this.fields,e.data.fields,(e=>g.instance.proxyBlockField(new Z(e),this,this.ownerItem))),this._rollbackArray(this.scripts,e.data.scripts,(e=>new W(e,this,this.ownerItem))),t||this._rollbackArray(this.blocks,e.data.blocks,((e,t)=>g.instance.proxyBlock(new ae(e,t),this.ownerItem)))}_getFieldByName(e,t){for(const a of t)if(a.id===e)return a;return null}}
12
+ /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function ne(e){let t=e.length;for(;--t>=0;)e[t]=0}const ie=256,re=286,se=30,oe=15,le=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),ue=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),ce=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),de=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),pe=new Array(576);ne(pe);const he=new Array(60);ne(he);const fe=new Array(512);ne(fe);const me=new Array(256);ne(me);const ye=new Array(29);ne(ye);const ge=new Array(se);function be(e,t,a,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=a,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}let ve,_e,we;function Ae(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}ne(ge);const ke=e=>e<256?fe[e]:fe[256+(e>>>7)],Se=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},Ne=(e,t,a)=>{e.bi_valid>16-a?(e.bi_buf|=t<<e.bi_valid&65535,Se(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=a-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=a)},Te=(e,t,a)=>{Ne(e,a[2*t],a[2*t+1])},Me=(e,t)=>{let a=0;do{a|=1&e,e>>>=1,a<<=1}while(--t>0);return a>>>1},xe=(e,t,a)=>{const n=new Array(16);let i,r,s=0;for(i=1;i<=oe;i++)s=s+a[i-1]<<1,n[i]=s;for(r=0;r<=t;r++){let t=e[2*r+1];0!==t&&(e[2*r]=Me(n[t]++,t))}},Ce=e=>{let t;for(t=0;t<re;t++)e.dyn_ltree[2*t]=0;for(t=0;t<se;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Ie=e=>{e.bi_valid>8?Se(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Ve=(e,t,a,n)=>{const i=2*t,r=2*a;return e[i]<e[r]||e[i]===e[r]&&n[t]<=n[a]},Ee=(e,t,a)=>{const n=e.heap[a];let i=a<<1;for(;i<=e.heap_len&&(i<e.heap_len&&Ve(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!Ve(t,n,e.heap[i],e.depth));)e.heap[a]=e.heap[i],a=i,i<<=1;e.heap[a]=n},Fe=(e,t,a)=>{let n,i,r,s,o=0;if(0!==e.sym_next)do{n=255&e.pending_buf[e.sym_buf+o++],n+=(255&e.pending_buf[e.sym_buf+o++])<<8,i=e.pending_buf[e.sym_buf+o++],0===n?Te(e,i,t):(r=me[i],Te(e,r+ie+1,t),s=le[r],0!==s&&(i-=ye[r],Ne(e,i,s)),n--,r=ke(n),Te(e,r,a),s=ue[r],0!==s&&(n-=ge[r],Ne(e,n,s)))}while(o<e.sym_next);Te(e,256,t)},De=(e,t)=>{const a=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,r=t.stat_desc.elems;let s,o,l,u=-1;for(e.heap_len=0,e.heap_max=573,s=0;s<r;s++)0!==a[2*s]?(e.heap[++e.heap_len]=u=s,e.depth[s]=0):a[2*s+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=u<2?++u:0,a[2*l]=1,e.depth[l]=0,e.opt_len--,i&&(e.static_len-=n[2*l+1]);for(t.max_code=u,s=e.heap_len>>1;s>=1;s--)Ee(e,a,s);l=r;do{s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Ee(e,a,1),o=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=o,a[2*l]=a[2*s]+a[2*o],e.depth[l]=(e.depth[s]>=e.depth[o]?e.depth[s]:e.depth[o])+1,a[2*s+1]=a[2*o+1]=l,e.heap[1]=l++,Ee(e,a,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const a=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,l=t.stat_desc.max_length;let u,c,d,p,h,f,m=0;for(p=0;p<=oe;p++)e.bl_count[p]=0;for(a[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)c=e.heap[u],p=a[2*a[2*c+1]+1]+1,p>l&&(p=l,m++),a[2*c+1]=p,c>n||(e.bl_count[p]++,h=0,c>=o&&(h=s[c-o]),f=a[2*c],e.opt_len+=f*(p+h),r&&(e.static_len+=f*(i[2*c+1]+h)));if(0!==m){do{for(p=l-1;0===e.bl_count[p];)p--;e.bl_count[p]--,e.bl_count[p+1]+=2,e.bl_count[l]--,m-=2}while(m>0);for(p=l;0!==p;p--)for(c=e.bl_count[p];0!==c;)d=e.heap[--u],d>n||(a[2*d+1]!==p&&(e.opt_len+=(p-a[2*d+1])*a[2*d],a[2*d+1]=p),c--)}})(e,t),xe(a,u,e.bl_count)},Re=(e,t,a)=>{let n,i,r=-1,s=t[1],o=0,l=7,u=4;for(0===s&&(l=138,u=3),t[2*(a+1)+1]=65535,n=0;n<=a;n++)i=s,s=t[2*(n+1)+1],++o<l&&i===s||(o<u?e.bl_tree[2*i]+=o:0!==i?(i!==r&&e.bl_tree[2*i]++,e.bl_tree[32]++):o<=10?e.bl_tree[34]++:e.bl_tree[36]++,o=0,r=i,0===s?(l=138,u=3):i===s?(l=6,u=3):(l=7,u=4))},Le=(e,t,a)=>{let n,i,r=-1,s=t[1],o=0,l=7,u=4;for(0===s&&(l=138,u=3),n=0;n<=a;n++)if(i=s,s=t[2*(n+1)+1],!(++o<l&&i===s)){if(o<u)do{Te(e,i,e.bl_tree)}while(0!=--o);else 0!==i?(i!==r&&(Te(e,i,e.bl_tree),o--),Te(e,16,e.bl_tree),Ne(e,o-3,2)):o<=10?(Te(e,17,e.bl_tree),Ne(e,o-3,3)):(Te(e,18,e.bl_tree),Ne(e,o-11,7));o=0,r=i,0===s?(l=138,u=3):i===s?(l=6,u=3):(l=7,u=4)}};let Pe=!1;const Be=(e,t,a,n)=>{Ne(e,0+(n?1:0),3),Ie(e),Se(e,a),Se(e,~a),a&&e.pending_buf.set(e.window.subarray(t,t+a),e.pending),e.pending+=a};var Oe=e=>{Pe||((()=>{let e,t,a,n,i;const r=new Array(16);for(a=0,n=0;n<28;n++)for(ye[n]=a,e=0;e<1<<le[n];e++)me[a++]=n;for(me[a-1]=n,i=0,n=0;n<16;n++)for(ge[n]=i,e=0;e<1<<ue[n];e++)fe[i++]=n;for(i>>=7;n<se;n++)for(ge[n]=i<<7,e=0;e<1<<ue[n]-7;e++)fe[256+i++]=n;for(t=0;t<=oe;t++)r[t]=0;for(e=0;e<=143;)pe[2*e+1]=8,e++,r[8]++;for(;e<=255;)pe[2*e+1]=9,e++,r[9]++;for(;e<=279;)pe[2*e+1]=7,e++,r[7]++;for(;e<=287;)pe[2*e+1]=8,e++,r[8]++;for(xe(pe,287,r),e=0;e<se;e++)he[2*e+1]=5,he[2*e]=Me(e,5);ve=new be(pe,le,257,re,oe),_e=new be(he,ue,0,se,oe),we=new be(new Array(0),ce,0,19,7)})(),Pe=!0),e.l_desc=new Ae(e.dyn_ltree,ve),e.d_desc=new Ae(e.dyn_dtree,_e),e.bl_desc=new Ae(e.bl_tree,we),e.bi_buf=0,e.bi_valid=0,Ce(e)},$e=(e,t,a,n)=>{let i,r,s=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,a=4093624447;for(t=0;t<=31;t++,a>>>=1)if(1&a&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<ie;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),De(e,e.l_desc),De(e,e.d_desc),s=(e=>{let t;for(Re(e,e.dyn_ltree,e.l_desc.max_code),Re(e,e.dyn_dtree,e.d_desc.max_code),De(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*de[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),i=e.opt_len+3+7>>>3,r=e.static_len+3+7>>>3,r<=i&&(i=r)):i=r=a+5,a+4<=i&&-1!==t?Be(e,t,a,n):4===e.strategy||r===i?(Ne(e,2+(n?1:0),3),Fe(e,pe,he)):(Ne(e,4+(n?1:0),3),((e,t,a,n)=>{let i;for(Ne(e,t-257,5),Ne(e,a-1,5),Ne(e,n-4,4),i=0;i<n;i++)Ne(e,e.bl_tree[2*de[i]+1],3);Le(e,e.dyn_ltree,t-1),Le(e,e.dyn_dtree,a-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),Fe(e,e.dyn_ltree,e.dyn_dtree)),Ce(e),n&&Ie(e)},Ue={_tr_init:Oe,_tr_stored_block:Be,_tr_flush_block:$e,_tr_tally:(e,t,a)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=a,0===t?e.dyn_ltree[2*a]++:(e.matches++,t--,e.dyn_ltree[2*(me[a]+ie+1)]++,e.dyn_dtree[2*ke(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{Ne(e,2,3),Te(e,256,pe),(e=>{16===e.bi_valid?(Se(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var je=(e,t,a,n)=>{let i=65535&e,r=e>>>16&65535,s=0;for(;0!==a;){s=a>2e3?2e3:a,a-=s;do{i=i+t[n++]|0,r=r+i|0}while(--s);i%=65521,r%=65521}return i|r<<16};const ze=new Uint32Array((()=>{let e,t=[];for(var a=0;a<256;a++){e=a;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[a]=e}return t})());var We=(e,t,a,n)=>{const i=ze,r=n+a;e^=-1;for(let a=n;a<r;a++)e=e>>>8^i[255&(e^t[a])];return~e},Ye={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},He={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Ge,_tr_stored_block:qe,_tr_flush_block:Ze,_tr_tally:Je,_tr_align:Ke}=Ue,{Z_NO_FLUSH:Xe,Z_PARTIAL_FLUSH:Qe,Z_FULL_FLUSH:et,Z_FINISH:tt,Z_BLOCK:at,Z_OK:nt,Z_STREAM_END:it,Z_STREAM_ERROR:rt,Z_DATA_ERROR:st,Z_BUF_ERROR:ot,Z_DEFAULT_COMPRESSION:lt,Z_FILTERED:ut,Z_HUFFMAN_ONLY:ct,Z_RLE:dt,Z_FIXED:pt,Z_DEFAULT_STRATEGY:ht,Z_UNKNOWN:ft,Z_DEFLATED:mt}=He,yt=258,gt=262,bt=42,vt=113,_t=666,wt=(e,t)=>(e.msg=Ye[t],t),At=e=>2*e-(e>4?9:0),kt=e=>{let t=e.length;for(;--t>=0;)e[t]=0},St=e=>{let t,a,n,i=e.w_size;t=e.hash_size,n=t;do{a=e.head[--n],e.head[n]=a>=i?a-i:0}while(--t);t=i,n=t;do{a=e.prev[--n],e.prev[n]=a>=i?a-i:0}while(--t)};let Nt=(e,t,a)=>(t<<e.hash_shift^a)&e.hash_mask;const Tt=e=>{const t=e.state;let a=t.pending;a>e.avail_out&&(a=e.avail_out),0!==a&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+a),e.next_out),e.next_out+=a,t.pending_out+=a,e.total_out+=a,e.avail_out-=a,t.pending-=a,0===t.pending&&(t.pending_out=0))},Mt=(e,t)=>{Ze(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Tt(e.strm)},xt=(e,t)=>{e.pending_buf[e.pending++]=t},Ct=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},It=(e,t,a,n)=>{let i=e.avail_in;return i>n&&(i=n),0===i?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),a),1===e.state.wrap?e.adler=je(e.adler,t,i,a):2===e.state.wrap&&(e.adler=We(e.adler,t,i,a)),e.next_in+=i,e.total_in+=i,i)},Vt=(e,t)=>{let a,n,i=e.max_chain_length,r=e.strstart,s=e.prev_length,o=e.nice_match;const l=e.strstart>e.w_size-gt?e.strstart-(e.w_size-gt):0,u=e.window,c=e.w_mask,d=e.prev,p=e.strstart+yt;let h=u[r+s-1],f=u[r+s];e.prev_length>=e.good_match&&(i>>=2),o>e.lookahead&&(o=e.lookahead);do{if(a=t,u[a+s]===f&&u[a+s-1]===h&&u[a]===u[r]&&u[++a]===u[r+1]){r+=2,a++;do{}while(u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&u[++r]===u[++a]&&r<p);if(n=yt-(p-r),r=p-yt,n>s){if(e.match_start=t,s=n,n>=o)break;h=u[r+s-1],f=u[r+s]}}}while((t=d[t&c])>l&&0!=--i);return s<=e.lookahead?s:e.lookahead},Et=e=>{const t=e.w_size;let a,n,i;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-gt)&&(e.window.set(e.window.subarray(t,t+t-n),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),St(e),n+=t),0===e.strm.avail_in)break;if(a=It(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=a,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Nt(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Nt(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<gt&&0!==e.strm.avail_in)},Ft=(e,t)=>{let a,n,i,r=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,s=0,o=e.strm.avail_in;do{if(a=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i)break;if(i=e.strm.avail_out-i,n=e.strstart-e.block_start,a>n+e.strm.avail_in&&(a=n+e.strm.avail_in),a>i&&(a=i),a<r&&(0===a&&t!==tt||t===Xe||a!==n+e.strm.avail_in))break;s=t===tt&&a===n+e.strm.avail_in?1:0,qe(e,0,0,s),e.pending_buf[e.pending-4]=a,e.pending_buf[e.pending-3]=a>>8,e.pending_buf[e.pending-2]=~a,e.pending_buf[e.pending-1]=~a>>8,Tt(e.strm),n&&(n>a&&(n=a),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+n),e.strm.next_out),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n,e.block_start+=n,a-=n),a&&(It(e.strm,e.strm.output,e.strm.next_out,a),e.strm.next_out+=a,e.strm.avail_out-=a,e.strm.total_out+=a)}while(0===s);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),s?4:t!==Xe&&t!==tt&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(It(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,r=i>e.w_size?e.w_size:i,n=e.strstart-e.block_start,(n>=r||(n||t===tt)&&t!==Xe&&0===e.strm.avail_in&&n<=i)&&(a=n>i?i:n,s=t===tt&&0===e.strm.avail_in&&a===n?1:0,qe(e,e.block_start,a,s),e.block_start+=a,Tt(e.strm)),s?3:1)},Dt=(e,t)=>{let a,n;for(;;){if(e.lookahead<gt){if(Et(e),e.lookahead<gt&&t===Xe)return 1;if(0===e.lookahead)break}if(a=0,e.lookahead>=3&&(e.ins_h=Nt(e,e.ins_h,e.window[e.strstart+3-1]),a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==a&&e.strstart-a<=e.w_size-gt&&(e.match_length=Vt(e,a)),e.match_length>=3)if(n=Je(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=Nt(e,e.ins_h,e.window[e.strstart+3-1]),a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Nt(e,e.ins_h,e.window[e.strstart+1]);else n=Je(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(Mt(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===tt?(Mt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Mt(e,!1),0===e.strm.avail_out)?1:2},Rt=(e,t)=>{let a,n,i;for(;;){if(e.lookahead<gt){if(Et(e),e.lookahead<gt&&t===Xe)return 1;if(0===e.lookahead)break}if(a=0,e.lookahead>=3&&(e.ins_h=Nt(e,e.ins_h,e.window[e.strstart+3-1]),a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==a&&e.prev_length<e.max_lazy_match&&e.strstart-a<=e.w_size-gt&&(e.match_length=Vt(e,a),e.match_length<=5&&(e.strategy===ut||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,n=Je(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=Nt(e,e.ins_h,e.window[e.strstart+3-1]),a=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(Mt(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(n=Je(e,0,e.window[e.strstart-1]),n&&Mt(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=Je(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===tt?(Mt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Mt(e,!1),0===e.strm.avail_out)?1:2};function Lt(e,t,a,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=a,this.max_chain=n,this.func=i}const Pt=[new Lt(0,0,0,0,Ft),new Lt(4,4,8,4,Dt),new Lt(4,5,16,8,Dt),new Lt(4,6,32,32,Dt),new Lt(4,4,16,16,Rt),new Lt(8,16,32,32,Rt),new Lt(8,16,128,128,Rt),new Lt(8,32,128,256,Rt),new Lt(32,128,258,1024,Rt),new Lt(32,258,258,4096,Rt)];function Bt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=mt,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),kt(this.dyn_ltree),kt(this.dyn_dtree),kt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),kt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),kt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Ot=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==bt&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==vt&&t.status!==_t?1:0},$t=e=>{if(Ot(e))return wt(e,rt);e.total_in=e.total_out=0,e.data_type=ft;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?bt:vt,e.adler=2===t.wrap?0:1,t.last_flush=-2,Ge(t),nt},Ut=e=>{const t=$t(e);var a;return t===nt&&((a=e.state).window_size=2*a.w_size,kt(a.head),a.max_lazy_match=Pt[a.level].max_lazy,a.good_match=Pt[a.level].good_length,a.nice_match=Pt[a.level].nice_length,a.max_chain_length=Pt[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0),t},jt=(e,t,a,n,i,r)=>{if(!e)return rt;let s=1;if(t===lt&&(t=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),i<1||i>9||a!==mt||n<8||n>15||t<0||t>9||r<0||r>pt||8===n&&1!==s)return wt(e,rt);8===n&&(n=9);const o=new Bt;return e.state=o,o.strm=e,o.status=bt,o.wrap=s,o.gzhead=null,o.w_bits=n,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=i+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new Uint8Array(2*o.w_size),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<i+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=3*(o.lit_bufsize-1),o.level=t,o.strategy=r,o.method=a,Ut(e)};var zt=(e,t)=>{if(Ot(e)||t>at||t<0)return e?wt(e,rt):rt;const a=e.state;if(!e.output||0!==e.avail_in&&!e.input||a.status===_t&&t!==tt)return wt(e,0===e.avail_out?ot:rt);const n=a.last_flush;if(a.last_flush=t,0!==a.pending){if(Tt(e),0===e.avail_out)return a.last_flush=-1,nt}else if(0===e.avail_in&&At(t)<=At(n)&&t!==tt)return wt(e,ot);if(a.status===_t&&0!==e.avail_in)return wt(e,ot);if(a.status===bt&&0===a.wrap&&(a.status=vt),a.status===bt){let t=mt+(a.w_bits-8<<4)<<8,n=-1;if(n=a.strategy>=ct||a.level<2?0:a.level<6?1:6===a.level?2:3,t|=n<<6,0!==a.strstart&&(t|=32),t+=31-t%31,Ct(a,t),0!==a.strstart&&(Ct(a,e.adler>>>16),Ct(a,65535&e.adler)),e.adler=1,a.status=vt,Tt(e),0!==a.pending)return a.last_flush=-1,nt}if(57===a.status)if(e.adler=0,xt(a,31),xt(a,139),xt(a,8),a.gzhead)xt(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),xt(a,255&a.gzhead.time),xt(a,a.gzhead.time>>8&255),xt(a,a.gzhead.time>>16&255),xt(a,a.gzhead.time>>24&255),xt(a,9===a.level?2:a.strategy>=ct||a.level<2?4:0),xt(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(xt(a,255&a.gzhead.extra.length),xt(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(e.adler=We(e.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=69;else if(xt(a,0),xt(a,0),xt(a,0),xt(a,0),xt(a,0),xt(a,9===a.level?2:a.strategy>=ct||a.level<2?4:0),xt(a,3),a.status=vt,Tt(e),0!==a.pending)return a.last_flush=-1,nt;if(69===a.status){if(a.gzhead.extra){let t=a.pending,n=(65535&a.gzhead.extra.length)-a.gzindex;for(;a.pending+n>a.pending_buf_size;){let i=a.pending_buf_size-a.pending;if(a.pending_buf.set(a.gzhead.extra.subarray(a.gzindex,a.gzindex+i),a.pending),a.pending=a.pending_buf_size,a.gzhead.hcrc&&a.pending>t&&(e.adler=We(e.adler,a.pending_buf,a.pending-t,t)),a.gzindex+=i,Tt(e),0!==a.pending)return a.last_flush=-1,nt;t=0,n-=i}let i=new Uint8Array(a.gzhead.extra);a.pending_buf.set(i.subarray(a.gzindex,a.gzindex+n),a.pending),a.pending+=n,a.gzhead.hcrc&&a.pending>t&&(e.adler=We(e.adler,a.pending_buf,a.pending-t,t)),a.gzindex=0}a.status=73}if(73===a.status){if(a.gzhead.name){let t,n=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>n&&(e.adler=We(e.adler,a.pending_buf,a.pending-n,n)),Tt(e),0!==a.pending)return a.last_flush=-1,nt;n=0}t=a.gzindex<a.gzhead.name.length?255&a.gzhead.name.charCodeAt(a.gzindex++):0,xt(a,t)}while(0!==t);a.gzhead.hcrc&&a.pending>n&&(e.adler=We(e.adler,a.pending_buf,a.pending-n,n)),a.gzindex=0}a.status=91}if(91===a.status){if(a.gzhead.comment){let t,n=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>n&&(e.adler=We(e.adler,a.pending_buf,a.pending-n,n)),Tt(e),0!==a.pending)return a.last_flush=-1,nt;n=0}t=a.gzindex<a.gzhead.comment.length?255&a.gzhead.comment.charCodeAt(a.gzindex++):0,xt(a,t)}while(0!==t);a.gzhead.hcrc&&a.pending>n&&(e.adler=We(e.adler,a.pending_buf,a.pending-n,n))}a.status=103}if(103===a.status){if(a.gzhead.hcrc){if(a.pending+2>a.pending_buf_size&&(Tt(e),0!==a.pending))return a.last_flush=-1,nt;xt(a,255&e.adler),xt(a,e.adler>>8&255),e.adler=0}if(a.status=vt,Tt(e),0!==a.pending)return a.last_flush=-1,nt}if(0!==e.avail_in||0!==a.lookahead||t!==Xe&&a.status!==_t){let n=0===a.level?Ft(a,t):a.strategy===ct?((e,t)=>{let a;for(;;){if(0===e.lookahead&&(Et(e),0===e.lookahead)){if(t===Xe)return 1;break}if(e.match_length=0,a=Je(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,a&&(Mt(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===tt?(Mt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Mt(e,!1),0===e.strm.avail_out)?1:2})(a,t):a.strategy===dt?((e,t)=>{let a,n,i,r;const s=e.window;for(;;){if(e.lookahead<=yt){if(Et(e),e.lookahead<=yt&&t===Xe)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=e.strstart-1,n=s[i],n===s[++i]&&n===s[++i]&&n===s[++i])){r=e.strstart+yt;do{}while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&i<r);e.match_length=yt-(r-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(a=Je(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(a=Je(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),a&&(Mt(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===tt?(Mt(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Mt(e,!1),0===e.strm.avail_out)?1:2})(a,t):Pt[a.level].func(a,t);if(3!==n&&4!==n||(a.status=_t),1===n||3===n)return 0===e.avail_out&&(a.last_flush=-1),nt;if(2===n&&(t===Qe?Ke(a):t!==at&&(qe(a,0,0,!1),t===et&&(kt(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),Tt(e),0===e.avail_out))return a.last_flush=-1,nt}return t!==tt?nt:a.wrap<=0?it:(2===a.wrap?(xt(a,255&e.adler),xt(a,e.adler>>8&255),xt(a,e.adler>>16&255),xt(a,e.adler>>24&255),xt(a,255&e.total_in),xt(a,e.total_in>>8&255),xt(a,e.total_in>>16&255),xt(a,e.total_in>>24&255)):(Ct(a,e.adler>>>16),Ct(a,65535&e.adler)),Tt(e),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?nt:it)},Wt={deflateInit:(e,t)=>jt(e,t,mt,15,8,ht),deflateInit2:jt,deflateReset:Ut,deflateResetKeep:$t,deflateSetHeader:(e,t)=>Ot(e)||2!==e.state.wrap?rt:(e.state.gzhead=t,nt),deflate:zt,deflateEnd:e=>{if(Ot(e))return rt;const t=e.state.status;return e.state=null,t===vt?wt(e,st):nt},deflateSetDictionary:(e,t)=>{let a=t.length;if(Ot(e))return rt;const n=e.state,i=n.wrap;if(2===i||1===i&&n.status!==bt||n.lookahead)return rt;if(1===i&&(e.adler=je(e.adler,t,a,0)),n.wrap=0,a>=n.w_size){0===i&&(kt(n.head),n.strstart=0,n.block_start=0,n.insert=0);let e=new Uint8Array(n.w_size);e.set(t.subarray(a-n.w_size,a),0),t=e,a=n.w_size}const r=e.avail_in,s=e.next_in,o=e.input;for(e.avail_in=a,e.next_in=0,e.input=t,Et(n);n.lookahead>=3;){let e=n.strstart,t=n.lookahead-2;do{n.ins_h=Nt(n,n.ins_h,n.window[e+3-1]),n.prev[e&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=e,e++}while(--t);n.strstart=e,n.lookahead=2,Et(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,e.next_in=s,e.input=o,e.avail_in=r,n.wrap=i,nt},deflateInfo:"pako deflate (from Nodeca project)"};const Yt=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Ht=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const a=t.shift();if(a){if("object"!=typeof a)throw new TypeError(a+"must be non-object");for(const t in a)Yt(a,t)&&(e[t]=a[t])}}return e},Gt=e=>{let t=0;for(let a=0,n=e.length;a<n;a++)t+=e[a].length;const a=new Uint8Array(t);for(let t=0,n=0,i=e.length;t<i;t++){let i=e[t];a.set(i,n),n+=i.length}return a};let qt=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){qt=!1}const Zt=new Uint8Array(256);for(let e=0;e<256;e++)Zt[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Zt[254]=Zt[254]=1;var Jt=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,a,n,i,r,s=e.length,o=0;for(i=0;i<s;i++)a=e.charCodeAt(i),55296==(64512&a)&&i+1<s&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(a=65536+(a-55296<<10)+(n-56320),i++)),o+=a<128?1:a<2048?2:a<65536?3:4;for(t=new Uint8Array(o),r=0,i=0;r<o;i++)a=e.charCodeAt(i),55296==(64512&a)&&i+1<s&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(a=65536+(a-55296<<10)+(n-56320),i++)),a<128?t[r++]=a:a<2048?(t[r++]=192|a>>>6,t[r++]=128|63&a):a<65536?(t[r++]=224|a>>>12,t[r++]=128|a>>>6&63,t[r++]=128|63&a):(t[r++]=240|a>>>18,t[r++]=128|a>>>12&63,t[r++]=128|a>>>6&63,t[r++]=128|63&a);return t},Kt=(e,t)=>{const a=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let n,i;const r=new Array(2*a);for(i=0,n=0;n<a;){let t=e[n++];if(t<128){r[i++]=t;continue}let s=Zt[t];if(s>4)r[i++]=65533,n+=s-1;else{for(t&=2===s?31:3===s?15:7;s>1&&n<a;)t=t<<6|63&e[n++],s--;s>1?r[i++]=65533:t<65536?r[i++]=t:(t-=65536,r[i++]=55296|t>>10&1023,r[i++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&qt)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let a="";for(let n=0;n<t;n++)a+=String.fromCharCode(e[n]);return a})(r,i)},Xt=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let a=t-1;for(;a>=0&&128==(192&e[a]);)a--;return a<0||0===a?t:a+Zt[e[a]]>t?a:t};var Qt=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const ea=Object.prototype.toString,{Z_NO_FLUSH:ta,Z_SYNC_FLUSH:aa,Z_FULL_FLUSH:na,Z_FINISH:ia,Z_OK:ra,Z_STREAM_END:sa,Z_DEFAULT_COMPRESSION:oa,Z_DEFAULT_STRATEGY:la,Z_DEFLATED:ua}=He;function ca(e){this.options=Ht({level:oa,method:ua,chunkSize:16384,windowBits:15,memLevel:8,strategy:la},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Qt,this.strm.avail_out=0;let a=Wt.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(a!==ra)throw new Error(Ye[a]);if(t.header&&Wt.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?Jt(t.dictionary):"[object ArrayBuffer]"===ea.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,a=Wt.deflateSetDictionary(this.strm,e),a!==ra)throw new Error(Ye[a]);this._dict_set=!0}}function da(e,t){const a=new ca(t);if(a.push(e,!0),a.err)throw a.msg||Ye[a.err];return a.result}ca.prototype.push=function(e,t){const a=this.strm,n=this.options.chunkSize;let i,r;if(this.ended)return!1;for(r=t===~~t?t:!0===t?ia:ta,"string"==typeof e?a.input=Jt(e):"[object ArrayBuffer]"===ea.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;;)if(0===a.avail_out&&(a.output=new Uint8Array(n),a.next_out=0,a.avail_out=n),(r===aa||r===na)&&a.avail_out<=6)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else{if(i=Wt.deflate(a,r),i===sa)return a.next_out>0&&this.onData(a.output.subarray(0,a.next_out)),i=Wt.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===ra;if(0!==a.avail_out){if(r>0&&a.next_out>0)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else if(0===a.avail_in)break}else this.onData(a.output)}return!0},ca.prototype.onData=function(e){this.chunks.push(e)},ca.prototype.onEnd=function(e){e===ra&&(this.result=Gt(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var pa=function(e,t){return(t=t||{}).raw=!0,da(e,t)},ha=function(e,t){return(t=t||{}).gzip=!0,da(e,t)},fa={Deflate:ca,deflate:da,deflateRaw:pa,gzip:ha};const ma=16209;var ya=function(e,t){let a,n,i,r,s,o,l,u,c,d,p,h,f,m,y,g,b,v,_,w,A,k,S,N;const T=e.state;a=e.next_in,S=e.input,n=a+(e.avail_in-5),i=e.next_out,N=e.output,r=i-(t-e.avail_out),s=i+(e.avail_out-257),o=T.dmax,l=T.wsize,u=T.whave,c=T.wnext,d=T.window,p=T.hold,h=T.bits,f=T.lencode,m=T.distcode,y=(1<<T.lenbits)-1,g=(1<<T.distbits)-1;e:do{h<15&&(p+=S[a++]<<h,h+=8,p+=S[a++]<<h,h+=8),b=f[p&y];t:for(;;){if(v=b>>>24,p>>>=v,h-=v,v=b>>>16&255,0===v)N[i++]=65535&b;else{if(!(16&v)){if(64&v){if(32&v){T.mode=16191;break e}e.msg="invalid literal/length code",T.mode=ma;break e}b=f[(65535&b)+(p&(1<<v)-1)];continue t}for(_=65535&b,v&=15,v&&(h<v&&(p+=S[a++]<<h,h+=8),_+=p&(1<<v)-1,p>>>=v,h-=v),h<15&&(p+=S[a++]<<h,h+=8,p+=S[a++]<<h,h+=8),b=m[p&g];;){if(v=b>>>24,p>>>=v,h-=v,v=b>>>16&255,16&v){if(w=65535&b,v&=15,h<v&&(p+=S[a++]<<h,h+=8,h<v&&(p+=S[a++]<<h,h+=8)),w+=p&(1<<v)-1,w>o){e.msg="invalid distance too far back",T.mode=ma;break e}if(p>>>=v,h-=v,v=i-r,w>v){if(v=w-v,v>u&&T.sane){e.msg="invalid distance too far back",T.mode=ma;break e}if(A=0,k=d,0===c){if(A+=l-v,v<_){_-=v;do{N[i++]=d[A++]}while(--v);A=i-w,k=N}}else if(c<v){if(A+=l+c-v,v-=c,v<_){_-=v;do{N[i++]=d[A++]}while(--v);if(A=0,c<_){v=c,_-=v;do{N[i++]=d[A++]}while(--v);A=i-w,k=N}}}else if(A+=c-v,v<_){_-=v;do{N[i++]=d[A++]}while(--v);A=i-w,k=N}for(;_>2;)N[i++]=k[A++],N[i++]=k[A++],N[i++]=k[A++],_-=3;_&&(N[i++]=k[A++],_>1&&(N[i++]=k[A++]))}else{A=i-w;do{N[i++]=N[A++],N[i++]=N[A++],N[i++]=N[A++],_-=3}while(_>2);_&&(N[i++]=N[A++],_>1&&(N[i++]=N[A++]))}break}if(64&v){e.msg="invalid distance code",T.mode=ma;break e}b=m[(65535&b)+(p&(1<<v)-1)]}}break}}while(a<n&&i<s);_=h>>3,a-=_,h-=_<<3,p&=(1<<h)-1,e.next_in=a,e.next_out=i,e.avail_in=a<n?n-a+5:5-(a-n),e.avail_out=i<s?s-i+257:257-(i-s),T.hold=p,T.bits=h};const ga=15,ba=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),va=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),_a=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),wa=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Aa=(e,t,a,n,i,r,s,o)=>{const l=o.bits;let u,c,d,p,h,f,m=0,y=0,g=0,b=0,v=0,_=0,w=0,A=0,k=0,S=0,N=null;const T=new Uint16Array(16),M=new Uint16Array(16);let x,C,I,V=null;for(m=0;m<=ga;m++)T[m]=0;for(y=0;y<n;y++)T[t[a+y]]++;for(v=l,b=ga;b>=1&&0===T[b];b--);if(v>b&&(v=b),0===b)return i[r++]=20971520,i[r++]=20971520,o.bits=1,0;for(g=1;g<b&&0===T[g];g++);for(v<g&&(v=g),A=1,m=1;m<=ga;m++)if(A<<=1,A-=T[m],A<0)return-1;if(A>0&&(0===e||1!==b))return-1;for(M[1]=0,m=1;m<ga;m++)M[m+1]=M[m]+T[m];for(y=0;y<n;y++)0!==t[a+y]&&(s[M[t[a+y]]++]=y);if(0===e?(N=V=s,f=20):1===e?(N=ba,V=va,f=257):(N=_a,V=wa,f=0),S=0,y=0,m=g,h=r,_=v,w=0,d=-1,k=1<<v,p=k-1,1===e&&k>852||2===e&&k>592)return 1;for(;;){x=m-w,s[y]+1<f?(C=0,I=s[y]):s[y]>=f?(C=V[s[y]-f],I=N[s[y]-f]):(C=96,I=0),u=1<<m-w,c=1<<_,g=c;do{c-=u,i[h+(S>>w)+c]=x<<24|C<<16|I}while(0!==c);for(u=1<<m-1;S&u;)u>>=1;if(0!==u?(S&=u-1,S+=u):S=0,y++,0==--T[m]){if(m===b)break;m=t[a+s[y]]}if(m>v&&(S&p)!==d){for(0===w&&(w=v),h+=g,_=m-w,A=1<<_;_+w<b&&(A-=T[_+w],!(A<=0));)_++,A<<=1;if(k+=1<<_,1===e&&k>852||2===e&&k>592)return 1;d=S&p,i[d]=v<<24|_<<16|h-r}}return 0!==S&&(i[h+S]=m-w<<24|64<<16),o.bits=v,0};const{Z_FINISH:ka,Z_BLOCK:Sa,Z_TREES:Na,Z_OK:Ta,Z_STREAM_END:Ma,Z_NEED_DICT:xa,Z_STREAM_ERROR:Ca,Z_DATA_ERROR:Ia,Z_MEM_ERROR:Va,Z_BUF_ERROR:Ea,Z_DEFLATED:Fa}=He,Da=16180,Ra=16190,La=16191,Pa=16192,Ba=16194,Oa=16199,$a=16200,Ua=16206,ja=16209,za=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Wa(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Ya=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<Da||t.mode>16211?1:0},Ha=e=>{if(Ya(e))return Ca;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Da,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Ta},Ga=e=>{if(Ya(e))return Ca;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Ha(e)},qa=(e,t)=>{let a;if(Ya(e))return Ca;const n=e.state;return t<0?(a=0,t=-t):(a=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Ca:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=a,n.wbits=t,Ga(e))},Za=(e,t)=>{if(!e)return Ca;const a=new Wa;e.state=a,a.strm=e,a.window=null,a.mode=Da;const n=qa(e,t);return n!==Ta&&(e.state=null),n};let Ja,Ka,Xa=!0;const Qa=e=>{if(Xa){Ja=new Int32Array(512),Ka=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Aa(1,e.lens,0,288,Ja,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Aa(2,e.lens,0,32,Ka,0,e.work,{bits:5}),Xa=!1}e.lencode=Ja,e.lenbits=9,e.distcode=Ka,e.distbits=5},en=(e,t,a,n)=>{let i;const r=e.state;return null===r.window&&(r.wsize=1<<r.wbits,r.wnext=0,r.whave=0,r.window=new Uint8Array(r.wsize)),n>=r.wsize?(r.window.set(t.subarray(a-r.wsize,a),0),r.wnext=0,r.whave=r.wsize):(i=r.wsize-r.wnext,i>n&&(i=n),r.window.set(t.subarray(a-n,a-n+i),r.wnext),(n-=i)?(r.window.set(t.subarray(a-n,a),0),r.wnext=n,r.whave=r.wsize):(r.wnext+=i,r.wnext===r.wsize&&(r.wnext=0),r.whave<r.wsize&&(r.whave+=i))),0};var tn=(e,t)=>{let a,n,i,r,s,o,l,u,c,d,p,h,f,m,y,g,b,v,_,w,A,k,S=0;const N=new Uint8Array(4);let T,M;const x=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ya(e)||!e.output||!e.input&&0!==e.avail_in)return Ca;a=e.state,a.mode===La&&(a.mode=Pa),s=e.next_out,i=e.output,l=e.avail_out,r=e.next_in,n=e.input,o=e.avail_in,u=a.hold,c=a.bits,d=o,p=l,k=Ta;e:for(;;)switch(a.mode){case Da:if(0===a.wrap){a.mode=Pa;break}for(;c<16;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}if(2&a.wrap&&35615===u){0===a.wbits&&(a.wbits=15),a.check=0,N[0]=255&u,N[1]=u>>>8&255,a.check=We(a.check,N,2,0),u=0,c=0,a.mode=16181;break}if(a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",a.mode=ja;break}if((15&u)!==Fa){e.msg="unknown compression method",a.mode=ja;break}if(u>>>=4,c-=4,A=8+(15&u),0===a.wbits&&(a.wbits=A),A>15||A>a.wbits){e.msg="invalid window size",a.mode=ja;break}a.dmax=1<<a.wbits,a.flags=0,e.adler=a.check=1,a.mode=512&u?16189:La,u=0,c=0;break;case 16181:for(;c<16;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}if(a.flags=u,(255&a.flags)!==Fa){e.msg="unknown compression method",a.mode=ja;break}if(57344&a.flags){e.msg="unknown header flags set",a.mode=ja;break}a.head&&(a.head.text=u>>8&1),512&a.flags&&4&a.wrap&&(N[0]=255&u,N[1]=u>>>8&255,a.check=We(a.check,N,2,0)),u=0,c=0,a.mode=16182;case 16182:for(;c<32;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}a.head&&(a.head.time=u),512&a.flags&&4&a.wrap&&(N[0]=255&u,N[1]=u>>>8&255,N[2]=u>>>16&255,N[3]=u>>>24&255,a.check=We(a.check,N,4,0)),u=0,c=0,a.mode=16183;case 16183:for(;c<16;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}a.head&&(a.head.xflags=255&u,a.head.os=u>>8),512&a.flags&&4&a.wrap&&(N[0]=255&u,N[1]=u>>>8&255,a.check=We(a.check,N,2,0)),u=0,c=0,a.mode=16184;case 16184:if(1024&a.flags){for(;c<16;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}a.length=u,a.head&&(a.head.extra_len=u),512&a.flags&&4&a.wrap&&(N[0]=255&u,N[1]=u>>>8&255,a.check=We(a.check,N,2,0)),u=0,c=0}else a.head&&(a.head.extra=null);a.mode=16185;case 16185:if(1024&a.flags&&(h=a.length,h>o&&(h=o),h&&(a.head&&(A=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(n.subarray(r,r+h),A)),512&a.flags&&4&a.wrap&&(a.check=We(a.check,n,h,r)),o-=h,r+=h,a.length-=h),a.length))break e;a.length=0,a.mode=16186;case 16186:if(2048&a.flags){if(0===o)break e;h=0;do{A=n[r+h++],a.head&&A&&a.length<65536&&(a.head.name+=String.fromCharCode(A))}while(A&&h<o);if(512&a.flags&&4&a.wrap&&(a.check=We(a.check,n,h,r)),o-=h,r+=h,A)break e}else a.head&&(a.head.name=null);a.length=0,a.mode=16187;case 16187:if(4096&a.flags){if(0===o)break e;h=0;do{A=n[r+h++],a.head&&A&&a.length<65536&&(a.head.comment+=String.fromCharCode(A))}while(A&&h<o);if(512&a.flags&&4&a.wrap&&(a.check=We(a.check,n,h,r)),o-=h,r+=h,A)break e}else a.head&&(a.head.comment=null);a.mode=16188;case 16188:if(512&a.flags){for(;c<16;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}if(4&a.wrap&&u!==(65535&a.check)){e.msg="header crc mismatch",a.mode=ja;break}u=0,c=0}a.head&&(a.head.hcrc=a.flags>>9&1,a.head.done=!0),e.adler=a.check=0,a.mode=La;break;case 16189:for(;c<32;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}e.adler=a.check=za(u),u=0,c=0,a.mode=Ra;case Ra:if(0===a.havedict)return e.next_out=s,e.avail_out=l,e.next_in=r,e.avail_in=o,a.hold=u,a.bits=c,xa;e.adler=a.check=1,a.mode=La;case La:if(t===Sa||t===Na)break e;case Pa:if(a.last){u>>>=7&c,c-=7&c,a.mode=Ua;break}for(;c<3;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}switch(a.last=1&u,u>>>=1,c-=1,3&u){case 0:a.mode=16193;break;case 1:if(Qa(a),a.mode=Oa,t===Na){u>>>=2,c-=2;break e}break;case 2:a.mode=16196;break;case 3:e.msg="invalid block type",a.mode=ja}u>>>=2,c-=2;break;case 16193:for(u>>>=7&c,c-=7&c;c<32;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",a.mode=ja;break}if(a.length=65535&u,u=0,c=0,a.mode=Ba,t===Na)break e;case Ba:a.mode=16195;case 16195:if(h=a.length,h){if(h>o&&(h=o),h>l&&(h=l),0===h)break e;i.set(n.subarray(r,r+h),s),o-=h,r+=h,l-=h,s+=h,a.length-=h;break}a.mode=La;break;case 16196:for(;c<14;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}if(a.nlen=257+(31&u),u>>>=5,c-=5,a.ndist=1+(31&u),u>>>=5,c-=5,a.ncode=4+(15&u),u>>>=4,c-=4,a.nlen>286||a.ndist>30){e.msg="too many length or distance symbols",a.mode=ja;break}a.have=0,a.mode=16197;case 16197:for(;a.have<a.ncode;){for(;c<3;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}a.lens[x[a.have++]]=7&u,u>>>=3,c-=3}for(;a.have<19;)a.lens[x[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,T={bits:a.lenbits},k=Aa(0,a.lens,0,19,a.lencode,0,a.work,T),a.lenbits=T.bits,k){e.msg="invalid code lengths set",a.mode=ja;break}a.have=0,a.mode=16198;case 16198:for(;a.have<a.nlen+a.ndist;){for(;S=a.lencode[u&(1<<a.lenbits)-1],y=S>>>24,g=S>>>16&255,b=65535&S,!(y<=c);){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}if(b<16)u>>>=y,c-=y,a.lens[a.have++]=b;else{if(16===b){for(M=y+2;c<M;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}if(u>>>=y,c-=y,0===a.have){e.msg="invalid bit length repeat",a.mode=ja;break}A=a.lens[a.have-1],h=3+(3&u),u>>>=2,c-=2}else if(17===b){for(M=y+3;c<M;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}u>>>=y,c-=y,A=0,h=3+(7&u),u>>>=3,c-=3}else{for(M=y+7;c<M;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}u>>>=y,c-=y,A=0,h=11+(127&u),u>>>=7,c-=7}if(a.have+h>a.nlen+a.ndist){e.msg="invalid bit length repeat",a.mode=ja;break}for(;h--;)a.lens[a.have++]=A}}if(a.mode===ja)break;if(0===a.lens[256]){e.msg="invalid code -- missing end-of-block",a.mode=ja;break}if(a.lenbits=9,T={bits:a.lenbits},k=Aa(1,a.lens,0,a.nlen,a.lencode,0,a.work,T),a.lenbits=T.bits,k){e.msg="invalid literal/lengths set",a.mode=ja;break}if(a.distbits=6,a.distcode=a.distdyn,T={bits:a.distbits},k=Aa(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,T),a.distbits=T.bits,k){e.msg="invalid distances set",a.mode=ja;break}if(a.mode=Oa,t===Na)break e;case Oa:a.mode=$a;case $a:if(o>=6&&l>=258){e.next_out=s,e.avail_out=l,e.next_in=r,e.avail_in=o,a.hold=u,a.bits=c,ya(e,p),s=e.next_out,i=e.output,l=e.avail_out,r=e.next_in,n=e.input,o=e.avail_in,u=a.hold,c=a.bits,a.mode===La&&(a.back=-1);break}for(a.back=0;S=a.lencode[u&(1<<a.lenbits)-1],y=S>>>24,g=S>>>16&255,b=65535&S,!(y<=c);){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}if(g&&!(240&g)){for(v=y,_=g,w=b;S=a.lencode[w+((u&(1<<v+_)-1)>>v)],y=S>>>24,g=S>>>16&255,b=65535&S,!(v+y<=c);){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}u>>>=v,c-=v,a.back+=v}if(u>>>=y,c-=y,a.back+=y,a.length=b,0===g){a.mode=16205;break}if(32&g){a.back=-1,a.mode=La;break}if(64&g){e.msg="invalid literal/length code",a.mode=ja;break}a.extra=15&g,a.mode=16201;case 16201:if(a.extra){for(M=a.extra;c<M;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}a.length+=u&(1<<a.extra)-1,u>>>=a.extra,c-=a.extra,a.back+=a.extra}a.was=a.length,a.mode=16202;case 16202:for(;S=a.distcode[u&(1<<a.distbits)-1],y=S>>>24,g=S>>>16&255,b=65535&S,!(y<=c);){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}if(!(240&g)){for(v=y,_=g,w=b;S=a.distcode[w+((u&(1<<v+_)-1)>>v)],y=S>>>24,g=S>>>16&255,b=65535&S,!(v+y<=c);){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}u>>>=v,c-=v,a.back+=v}if(u>>>=y,c-=y,a.back+=y,64&g){e.msg="invalid distance code",a.mode=ja;break}a.offset=b,a.extra=15&g,a.mode=16203;case 16203:if(a.extra){for(M=a.extra;c<M;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}a.offset+=u&(1<<a.extra)-1,u>>>=a.extra,c-=a.extra,a.back+=a.extra}if(a.offset>a.dmax){e.msg="invalid distance too far back",a.mode=ja;break}a.mode=16204;case 16204:if(0===l)break e;if(h=p-l,a.offset>h){if(h=a.offset-h,h>a.whave&&a.sane){e.msg="invalid distance too far back",a.mode=ja;break}h>a.wnext?(h-=a.wnext,f=a.wsize-h):f=a.wnext-h,h>a.length&&(h=a.length),m=a.window}else m=i,f=s-a.offset,h=a.length;h>l&&(h=l),l-=h,a.length-=h;do{i[s++]=m[f++]}while(--h);0===a.length&&(a.mode=$a);break;case 16205:if(0===l)break e;i[s++]=a.length,l--,a.mode=$a;break;case Ua:if(a.wrap){for(;c<32;){if(0===o)break e;o--,u|=n[r++]<<c,c+=8}if(p-=l,e.total_out+=p,a.total+=p,4&a.wrap&&p&&(e.adler=a.check=a.flags?We(a.check,i,p,s-p):je(a.check,i,p,s-p)),p=l,4&a.wrap&&(a.flags?u:za(u))!==a.check){e.msg="incorrect data check",a.mode=ja;break}u=0,c=0}a.mode=16207;case 16207:if(a.wrap&&a.flags){for(;c<32;){if(0===o)break e;o--,u+=n[r++]<<c,c+=8}if(4&a.wrap&&u!==(4294967295&a.total)){e.msg="incorrect length check",a.mode=ja;break}u=0,c=0}a.mode=16208;case 16208:k=Ma;break e;case ja:k=Ia;break e;case 16210:return Va;default:return Ca}return e.next_out=s,e.avail_out=l,e.next_in=r,e.avail_in=o,a.hold=u,a.bits=c,(a.wsize||p!==e.avail_out&&a.mode<ja&&(a.mode<Ua||t!==ka))&&en(e,e.output,e.next_out,p-e.avail_out),d-=e.avail_in,p-=e.avail_out,e.total_in+=d,e.total_out+=p,a.total+=p,4&a.wrap&&p&&(e.adler=a.check=a.flags?We(a.check,i,p,e.next_out-p):je(a.check,i,p,e.next_out-p)),e.data_type=a.bits+(a.last?64:0)+(a.mode===La?128:0)+(a.mode===Oa||a.mode===Ba?256:0),(0===d&&0===p||t===ka)&&k===Ta&&(k=Ea),k},an={inflateReset:Ga,inflateReset2:qa,inflateResetKeep:Ha,inflateInit:e=>Za(e,15),inflateInit2:Za,inflate:tn,inflateEnd:e=>{if(Ya(e))return Ca;let t=e.state;return t.window&&(t.window=null),e.state=null,Ta},inflateGetHeader:(e,t)=>{if(Ya(e))return Ca;const a=e.state;return 2&a.wrap?(a.head=t,t.done=!1,Ta):Ca},inflateSetDictionary:(e,t)=>{const a=t.length;let n,i,r;return Ya(e)?Ca:(n=e.state,0!==n.wrap&&n.mode!==Ra?Ca:n.mode===Ra&&(i=1,i=je(i,t,a,0),i!==n.check)?Ia:(r=en(e,t,a,a),r?(n.mode=16210,Va):(n.havedict=1,Ta)))},inflateInfo:"pako inflate (from Nodeca project)"};var nn=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const rn=Object.prototype.toString,{Z_NO_FLUSH:sn,Z_FINISH:on,Z_OK:ln,Z_STREAM_END:un,Z_NEED_DICT:cn,Z_STREAM_ERROR:dn,Z_DATA_ERROR:pn,Z_MEM_ERROR:hn}=He;function fn(e){this.options=Ht({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Qt,this.strm.avail_out=0;let a=an.inflateInit2(this.strm,t.windowBits);if(a!==ln)throw new Error(Ye[a]);if(this.header=new nn,an.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Jt(t.dictionary):"[object ArrayBuffer]"===rn.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(a=an.inflateSetDictionary(this.strm,t.dictionary),a!==ln)))throw new Error(Ye[a])}function mn(e,t){const a=new fn(t);if(a.push(e),a.err)throw a.msg||Ye[a.err];return a.result}fn.prototype.push=function(e,t){const a=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let r,s,o;if(this.ended)return!1;for(s=t===~~t?t:!0===t?on:sn,"[object ArrayBuffer]"===rn.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(n),a.next_out=0,a.avail_out=n),r=an.inflate(a,s),r===cn&&i&&(r=an.inflateSetDictionary(a,i),r===ln?r=an.inflate(a,s):r===pn&&(r=cn));a.avail_in>0&&r===un&&a.state.wrap>0&&0!==e[a.next_in];)an.inflateReset(a),r=an.inflate(a,s);switch(r){case dn:case pn:case cn:case hn:return this.onEnd(r),this.ended=!0,!1}if(o=a.avail_out,a.next_out&&(0===a.avail_out||r===un))if("string"===this.options.to){let e=Xt(a.output,a.next_out),t=a.next_out-e,i=Kt(a.output,e);a.next_out=t,a.avail_out=n-t,t&&a.output.set(a.output.subarray(e,e+t),0),this.onData(i)}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(r!==ln||0!==o){if(r===un)return r=an.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===a.avail_in)break}}return!0},fn.prototype.onData=function(e){this.chunks.push(e)},fn.prototype.onEnd=function(e){e===ln&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Gt(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var yn=function(e,t){return(t=t||{}).raw=!0,mn(e,t)},gn={Inflate:fn,inflate:mn,inflateRaw:yn,ungzip:mn};const{Deflate:bn,deflate:vn,deflateRaw:_n,gzip:wn}=fa,{Inflate:An,inflate:kn,inflateRaw:Sn,ungzip:Nn}=gn;var Tn={Deflate:bn,deflate:vn,deflateRaw:_n,gzip:wn,Inflate:An,inflate:kn,inflateRaw:Sn,ungzip:Nn,constants:He},Mn="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},xn=[],Cn=[],In="undefined"!=typeof Uint8Array?Uint8Array:Array,Vn=!1;function En(){Vn=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)xn[t]=e[t],Cn[e.charCodeAt(t)]=t;Cn["-".charCodeAt(0)]=62,Cn["_".charCodeAt(0)]=63}function Fn(e,t,a){for(var n,i,r=[],s=t;s<a;s+=3)n=(e[s]<<16)+(e[s+1]<<8)+e[s+2],r.push(xn[(i=n)>>18&63]+xn[i>>12&63]+xn[i>>6&63]+xn[63&i]);return r.join("")}function Dn(e){var t;Vn||En();for(var a=e.length,n=a%3,i="",r=[],s=16383,o=0,l=a-n;o<l;o+=s)r.push(Fn(e,o,o+s>l?l:o+s));return 1===n?(t=e[a-1],i+=xn[t>>2],i+=xn[t<<4&63],i+="=="):2===n&&(t=(e[a-2]<<8)+e[a-1],i+=xn[t>>10],i+=xn[t>>4&63],i+=xn[t<<2&63],i+="="),r.push(i),r.join("")}function Rn(e,t,a,n,i){var r,s,o=8*i-n-1,l=(1<<o)-1,u=l>>1,c=-7,d=a?i-1:0,p=a?-1:1,h=e[t+d];for(d+=p,r=h&(1<<-c)-1,h>>=-c,c+=o;c>0;r=256*r+e[t+d],d+=p,c-=8);for(s=r&(1<<-c)-1,r>>=-c,c+=n;c>0;s=256*s+e[t+d],d+=p,c-=8);if(0===r)r=1-u;else{if(r===l)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,n),r-=u}return(h?-1:1)*s*Math.pow(2,r-n)}function Ln(e,t,a,n,i,r){var s,o,l,u=8*r-i-1,c=(1<<u)-1,d=c>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:r-1,f=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+d>=1?p/l:p*Math.pow(2,1-d))*l>=2&&(s++,l/=2),s+d>=c?(o=0,s=c):s+d>=1?(o=(t*l-1)*Math.pow(2,i),s+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[a+h]=255&o,h+=f,o/=256,i-=8);for(s=s<<i|o,u+=i;u>0;e[a+h]=255&s,h+=f,s/=256,u-=8);e[a+h-f]|=128*m}var Pn={}.toString,Bn=Array.isArray||function(e){return"[object Array]"==Pn.call(e)};function On(){return Un.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function $n(e,t){if(On()<t)throw new RangeError("Invalid typed array length");return Un.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Un.prototype:(null===e&&(e=new Un(t)),e.length=t),e}function Un(e,t,a){if(!(Un.TYPED_ARRAY_SUPPORT||this instanceof Un))return new Un(e,t,a);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return Wn(this,e)}return jn(this,e,t,a)}function jn(e,t,a,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,a,n){if(t.byteLength,a<0||t.byteLength<a)throw new RangeError("'offset' is out of bounds");if(t.byteLength<a+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===a&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,a):new Uint8Array(t,a,n);Un.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Un.prototype:e=Yn(e,t);return e}(e,t,a,n):"string"==typeof t?function(e,t,a){"string"==typeof a&&""!==a||(a="utf8");if(!Un.isEncoding(a))throw new TypeError('"encoding" must be a valid string encoding');var n=0|qn(t,a);e=$n(e,n);var i=e.write(t,a);i!==n&&(e=e.slice(0,i));return e}(e,t,a):function(e,t){if(Gn(t)){var a=0|Hn(t.length);return 0===(e=$n(e,a)).length||t.copy(e,0,0,a),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?$n(e,0):Yn(e,t);if("Buffer"===t.type&&Bn(t.data))return Yn(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function zn(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function Wn(e,t){if(zn(t),e=$n(e,t<0?0:0|Hn(t)),!Un.TYPED_ARRAY_SUPPORT)for(var a=0;a<t;++a)e[a]=0;return e}function Yn(e,t){var a=t.length<0?0:0|Hn(t.length);e=$n(e,a);for(var n=0;n<a;n+=1)e[n]=255&t[n];return e}function Hn(e){if(e>=On())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+On().toString(16)+" bytes");return 0|e}function Gn(e){return!(null==e||!e._isBuffer)}function qn(e,t){if(Gn(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var a=e.length;if(0===a)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return a;case"utf8":case"utf-8":case void 0:return wi(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*a;case"hex":return a>>>1;case"base64":return Ai(e).length;default:if(n)return wi(e).length;t=(""+t).toLowerCase(),n=!0}}function Zn(e,t,a){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===a||a>this.length)&&(a=this.length),a<=0)return"";if((a>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return ci(this,t,a);case"utf8":case"utf-8":return si(this,t,a);case"ascii":return li(this,t,a);case"latin1":case"binary":return ui(this,t,a);case"base64":return ri(this,t,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return di(this,t,a);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function Jn(e,t,a){var n=e[t];e[t]=e[a],e[a]=n}function Kn(e,t,a,n,i){if(0===e.length)return-1;if("string"==typeof a?(n=a,a=0):a>2147483647?a=2147483647:a<-2147483648&&(a=-2147483648),a=+a,isNaN(a)&&(a=i?0:e.length-1),a<0&&(a=e.length+a),a>=e.length){if(i)return-1;a=e.length-1}else if(a<0){if(!i)return-1;a=0}if("string"==typeof t&&(t=Un.from(t,n)),Gn(t))return 0===t.length?-1:Xn(e,t,a,n,i);if("number"==typeof t)return t&=255,Un.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,a):Uint8Array.prototype.lastIndexOf.call(e,t,a):Xn(e,[t],a,n,i);throw new TypeError("val must be string, number or Buffer")}function Xn(e,t,a,n,i){var r,s=1,o=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,o/=2,l/=2,a/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(r=a;r<o;r++)if(u(e,r)===u(t,-1===c?0:r-c)){if(-1===c&&(c=r),r-c+1===l)return c*s}else-1!==c&&(r-=r-c),c=-1}else for(a+l>o&&(a=o-l),r=a;r>=0;r--){for(var d=!0,p=0;p<l;p++)if(u(e,r+p)!==u(t,p)){d=!1;break}if(d)return r}return-1}function Qn(e,t,a,n){a=Number(a)||0;var i=e.length-a;n?(n=Number(n))>i&&(n=i):n=i;var r=t.length;if(r%2!=0)throw new TypeError("Invalid hex string");n>r/2&&(n=r/2);for(var s=0;s<n;++s){var o=parseInt(t.substr(2*s,2),16);if(isNaN(o))return s;e[a+s]=o}return s}function ei(e,t,a,n){return ki(wi(t,e.length-a),e,a,n)}function ti(e,t,a,n){return ki(function(e){for(var t=[],a=0;a<e.length;++a)t.push(255&e.charCodeAt(a));return t}(t),e,a,n)}function ai(e,t,a,n){return ti(e,t,a,n)}function ni(e,t,a,n){return ki(Ai(t),e,a,n)}function ii(e,t,a,n){return ki(function(e,t){for(var a,n,i,r=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(a=e.charCodeAt(s))>>8,i=a%256,r.push(i),r.push(n);return r}(t,e.length-a),e,a,n)}function ri(e,t,a){return 0===t&&a===e.length?Dn(e):Dn(e.slice(t,a))}function si(e,t,a){a=Math.min(e.length,a);for(var n=[],i=t;i<a;){var r,s,o,l,u=e[i],c=null,d=u>239?4:u>223?3:u>191?2:1;if(i+d<=a)switch(d){case 1:u<128&&(c=u);break;case 2:128==(192&(r=e[i+1]))&&(l=(31&u)<<6|63&r)>127&&(c=l);break;case 3:r=e[i+1],s=e[i+2],128==(192&r)&&128==(192&s)&&(l=(15&u)<<12|(63&r)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:r=e[i+1],s=e[i+2],o=e[i+3],128==(192&r)&&128==(192&s)&&128==(192&o)&&(l=(15&u)<<18|(63&r)<<12|(63&s)<<6|63&o)>65535&&l<1114112&&(c=l)}null===c?(c=65533,d=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=d}return function(e){var t=e.length;if(t<=oi)return String.fromCharCode.apply(String,e);var a="",n=0;for(;n<t;)a+=String.fromCharCode.apply(String,e.slice(n,n+=oi));return a}(n)}Un.TYPED_ARRAY_SUPPORT=void 0===Mn.TYPED_ARRAY_SUPPORT||Mn.TYPED_ARRAY_SUPPORT,On(),Un.poolSize=8192,Un._augment=function(e){return e.__proto__=Un.prototype,e},Un.from=function(e,t,a){return jn(null,e,t,a)},Un.TYPED_ARRAY_SUPPORT&&(Un.prototype.__proto__=Uint8Array.prototype,Un.__proto__=Uint8Array),Un.alloc=function(e,t,a){return function(e,t,a,n){return zn(t),t<=0?$n(e,t):void 0!==a?"string"==typeof n?$n(e,t).fill(a,n):$n(e,t).fill(a):$n(e,t)}(null,e,t,a)},Un.allocUnsafe=function(e){return Wn(null,e)},Un.allocUnsafeSlow=function(e){return Wn(null,e)},Un.isBuffer=function(e){return null!=e&&(!!e._isBuffer||Si(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Si(e.slice(0,0))}(e))},Un.compare=function(e,t){if(!Gn(e)||!Gn(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var a=e.length,n=t.length,i=0,r=Math.min(a,n);i<r;++i)if(e[i]!==t[i]){a=e[i],n=t[i];break}return a<n?-1:n<a?1:0},Un.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Un.concat=function(e,t){if(!Bn(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Un.alloc(0);var a;if(void 0===t)for(t=0,a=0;a<e.length;++a)t+=e[a].length;var n=Un.allocUnsafe(t),i=0;for(a=0;a<e.length;++a){var r=e[a];if(!Gn(r))throw new TypeError('"list" argument must be an Array of Buffers');r.copy(n,i),i+=r.length}return n},Un.byteLength=qn,Un.prototype._isBuffer=!0,Un.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)Jn(this,t,t+1);return this},Un.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)Jn(this,t,t+3),Jn(this,t+1,t+2);return this},Un.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)Jn(this,t,t+7),Jn(this,t+1,t+6),Jn(this,t+2,t+5),Jn(this,t+3,t+4);return this},Un.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?si(this,0,e):Zn.apply(this,arguments)},Un.prototype.equals=function(e){if(!Gn(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Un.compare(this,e)},Un.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},Un.prototype.compare=function(e,t,a,n,i){if(!Gn(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===a&&(a=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||a>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=a)return 0;if(n>=i)return-1;if(t>=a)return 1;if(this===e)return 0;for(var r=(i>>>=0)-(n>>>=0),s=(a>>>=0)-(t>>>=0),o=Math.min(r,s),l=this.slice(n,i),u=e.slice(t,a),c=0;c<o;++c)if(l[c]!==u[c]){r=l[c],s=u[c];break}return r<s?-1:s<r?1:0},Un.prototype.includes=function(e,t,a){return-1!==this.indexOf(e,t,a)},Un.prototype.indexOf=function(e,t,a){return Kn(this,e,t,a,!0)},Un.prototype.lastIndexOf=function(e,t,a){return Kn(this,e,t,a,!1)},Un.prototype.write=function(e,t,a,n){if(void 0===t)n="utf8",a=this.length,t=0;else if(void 0===a&&"string"==typeof t)n=t,a=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(a)?(a|=0,void 0===n&&(n="utf8")):(n=a,a=void 0)}var i=this.length-t;if((void 0===a||a>i)&&(a=i),e.length>0&&(a<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var r=!1;;)switch(n){case"hex":return Qn(this,e,t,a);case"utf8":case"utf-8":return ei(this,e,t,a);case"ascii":return ti(this,e,t,a);case"latin1":case"binary":return ai(this,e,t,a);case"base64":return ni(this,e,t,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ii(this,e,t,a);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),r=!0}},Un.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var oi=4096;function li(e,t,a){var n="";a=Math.min(e.length,a);for(var i=t;i<a;++i)n+=String.fromCharCode(127&e[i]);return n}function ui(e,t,a){var n="";a=Math.min(e.length,a);for(var i=t;i<a;++i)n+=String.fromCharCode(e[i]);return n}function ci(e,t,a){var n=e.length;(!t||t<0)&&(t=0),(!a||a<0||a>n)&&(a=n);for(var i="",r=t;r<a;++r)i+=_i(e[r]);return i}function di(e,t,a){for(var n=e.slice(t,a),i="",r=0;r<n.length;r+=2)i+=String.fromCharCode(n[r]+256*n[r+1]);return i}function pi(e,t,a){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>a)throw new RangeError("Trying to access beyond buffer length")}function hi(e,t,a,n,i,r){if(!Gn(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<r)throw new RangeError('"value" argument is out of bounds');if(a+n>e.length)throw new RangeError("Index out of range")}function fi(e,t,a,n){t<0&&(t=65535+t+1);for(var i=0,r=Math.min(e.length-a,2);i<r;++i)e[a+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function mi(e,t,a,n){t<0&&(t=4294967295+t+1);for(var i=0,r=Math.min(e.length-a,4);i<r;++i)e[a+i]=t>>>8*(n?i:3-i)&255}function yi(e,t,a,n,i,r){if(a+n>e.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("Index out of range")}function gi(e,t,a,n,i){return i||yi(e,0,a,4),Ln(e,t,a,n,23,4),a+4}function bi(e,t,a,n,i){return i||yi(e,0,a,8),Ln(e,t,a,n,52,8),a+8}Un.prototype.slice=function(e,t){var a,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),Un.TYPED_ARRAY_SUPPORT)(a=this.subarray(e,t)).__proto__=Un.prototype;else{var i=t-e;a=new Un(i,void 0);for(var r=0;r<i;++r)a[r]=this[r+e]}return a},Un.prototype.readUIntLE=function(e,t,a){e|=0,t|=0,a||pi(e,t,this.length);for(var n=this[e],i=1,r=0;++r<t&&(i*=256);)n+=this[e+r]*i;return n},Un.prototype.readUIntBE=function(e,t,a){e|=0,t|=0,a||pi(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},Un.prototype.readUInt8=function(e,t){return t||pi(e,1,this.length),this[e]},Un.prototype.readUInt16LE=function(e,t){return t||pi(e,2,this.length),this[e]|this[e+1]<<8},Un.prototype.readUInt16BE=function(e,t){return t||pi(e,2,this.length),this[e]<<8|this[e+1]},Un.prototype.readUInt32LE=function(e,t){return t||pi(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Un.prototype.readUInt32BE=function(e,t){return t||pi(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Un.prototype.readIntLE=function(e,t,a){e|=0,t|=0,a||pi(e,t,this.length);for(var n=this[e],i=1,r=0;++r<t&&(i*=256);)n+=this[e+r]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},Un.prototype.readIntBE=function(e,t,a){e|=0,t|=0,a||pi(e,t,this.length);for(var n=t,i=1,r=this[e+--n];n>0&&(i*=256);)r+=this[e+--n]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},Un.prototype.readInt8=function(e,t){return t||pi(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Un.prototype.readInt16LE=function(e,t){t||pi(e,2,this.length);var a=this[e]|this[e+1]<<8;return 32768&a?4294901760|a:a},Un.prototype.readInt16BE=function(e,t){t||pi(e,2,this.length);var a=this[e+1]|this[e]<<8;return 32768&a?4294901760|a:a},Un.prototype.readInt32LE=function(e,t){return t||pi(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Un.prototype.readInt32BE=function(e,t){return t||pi(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Un.prototype.readFloatLE=function(e,t){return t||pi(e,4,this.length),Rn(this,e,!0,23,4)},Un.prototype.readFloatBE=function(e,t){return t||pi(e,4,this.length),Rn(this,e,!1,23,4)},Un.prototype.readDoubleLE=function(e,t){return t||pi(e,8,this.length),Rn(this,e,!0,52,8)},Un.prototype.readDoubleBE=function(e,t){return t||pi(e,8,this.length),Rn(this,e,!1,52,8)},Un.prototype.writeUIntLE=function(e,t,a,n){(e=+e,t|=0,a|=0,n)||hi(this,e,t,a,Math.pow(2,8*a)-1,0);var i=1,r=0;for(this[t]=255&e;++r<a&&(i*=256);)this[t+r]=e/i&255;return t+a},Un.prototype.writeUIntBE=function(e,t,a,n){(e=+e,t|=0,a|=0,n)||hi(this,e,t,a,Math.pow(2,8*a)-1,0);var i=a-1,r=1;for(this[t+i]=255&e;--i>=0&&(r*=256);)this[t+i]=e/r&255;return t+a},Un.prototype.writeUInt8=function(e,t,a){return e=+e,t|=0,a||hi(this,e,t,1,255,0),Un.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Un.prototype.writeUInt16LE=function(e,t,a){return e=+e,t|=0,a||hi(this,e,t,2,65535,0),Un.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):fi(this,e,t,!0),t+2},Un.prototype.writeUInt16BE=function(e,t,a){return e=+e,t|=0,a||hi(this,e,t,2,65535,0),Un.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):fi(this,e,t,!1),t+2},Un.prototype.writeUInt32LE=function(e,t,a){return e=+e,t|=0,a||hi(this,e,t,4,4294967295,0),Un.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):mi(this,e,t,!0),t+4},Un.prototype.writeUInt32BE=function(e,t,a){return e=+e,t|=0,a||hi(this,e,t,4,4294967295,0),Un.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):mi(this,e,t,!1),t+4},Un.prototype.writeIntLE=function(e,t,a,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*a-1);hi(this,e,t,a,i-1,-i)}var r=0,s=1,o=0;for(this[t]=255&e;++r<a&&(s*=256);)e<0&&0===o&&0!==this[t+r-1]&&(o=1),this[t+r]=(e/s|0)-o&255;return t+a},Un.prototype.writeIntBE=function(e,t,a,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*a-1);hi(this,e,t,a,i-1,-i)}var r=a-1,s=1,o=0;for(this[t+r]=255&e;--r>=0&&(s*=256);)e<0&&0===o&&0!==this[t+r+1]&&(o=1),this[t+r]=(e/s|0)-o&255;return t+a},Un.prototype.writeInt8=function(e,t,a){return e=+e,t|=0,a||hi(this,e,t,1,127,-128),Un.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Un.prototype.writeInt16LE=function(e,t,a){return e=+e,t|=0,a||hi(this,e,t,2,32767,-32768),Un.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):fi(this,e,t,!0),t+2},Un.prototype.writeInt16BE=function(e,t,a){return e=+e,t|=0,a||hi(this,e,t,2,32767,-32768),Un.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):fi(this,e,t,!1),t+2},Un.prototype.writeInt32LE=function(e,t,a){return e=+e,t|=0,a||hi(this,e,t,4,2147483647,-2147483648),Un.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):mi(this,e,t,!0),t+4},Un.prototype.writeInt32BE=function(e,t,a){return e=+e,t|=0,a||hi(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Un.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):mi(this,e,t,!1),t+4},Un.prototype.writeFloatLE=function(e,t,a){return gi(this,e,t,!0,a)},Un.prototype.writeFloatBE=function(e,t,a){return gi(this,e,t,!1,a)},Un.prototype.writeDoubleLE=function(e,t,a){return bi(this,e,t,!0,a)},Un.prototype.writeDoubleBE=function(e,t,a){return bi(this,e,t,!1,a)},Un.prototype.copy=function(e,t,a,n){if(a||(a=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<a&&(n=a),n===a)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(a<0||a>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-a&&(n=e.length-t+a);var i,r=n-a;if(this===e&&a<t&&t<n)for(i=r-1;i>=0;--i)e[i+t]=this[i+a];else if(r<1e3||!Un.TYPED_ARRAY_SUPPORT)for(i=0;i<r;++i)e[i+t]=this[i+a];else Uint8Array.prototype.set.call(e,this.subarray(a,a+r),t);return r},Un.prototype.fill=function(e,t,a,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,a=this.length):"string"==typeof a&&(n=a,a=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Un.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<a)throw new RangeError("Out of range index");if(a<=t)return this;var r;if(t>>>=0,a=void 0===a?this.length:a>>>0,e||(e=0),"number"==typeof e)for(r=t;r<a;++r)this[r]=e;else{var s=Gn(e)?e:wi(new Un(e,n).toString()),o=s.length;for(r=0;r<a-t;++r)this[r+t]=s[r%o]}return this};var vi=/[^+\/0-9A-Za-z-_]/g;function _i(e){return e<16?"0"+e.toString(16):e.toString(16)}function wi(e,t){var a;t=t||1/0;for(var n=e.length,i=null,r=[],s=0;s<n;++s){if((a=e.charCodeAt(s))>55295&&a<57344){if(!i){if(a>56319){(t-=3)>-1&&r.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&r.push(239,191,189);continue}i=a;continue}if(a<56320){(t-=3)>-1&&r.push(239,191,189),i=a;continue}a=65536+(i-55296<<10|a-56320)}else i&&(t-=3)>-1&&r.push(239,191,189);if(i=null,a<128){if((t-=1)<0)break;r.push(a)}else if(a<2048){if((t-=2)<0)break;r.push(a>>6|192,63&a|128)}else if(a<65536){if((t-=3)<0)break;r.push(a>>12|224,a>>6&63|128,63&a|128)}else{if(!(a<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;r.push(a>>18|240,a>>12&63|128,a>>6&63|128,63&a|128)}}return r}function Ai(e){return function(e){var t,a,n,i,r,s;Vn||En();var o=e.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");r="="===e[o-2]?2:"="===e[o-1]?1:0,s=new In(3*o/4-r),n=r>0?o-4:o;var l=0;for(t=0,a=0;t<n;t+=4,a+=3)i=Cn[e.charCodeAt(t)]<<18|Cn[e.charCodeAt(t+1)]<<12|Cn[e.charCodeAt(t+2)]<<6|Cn[e.charCodeAt(t+3)],s[l++]=i>>16&255,s[l++]=i>>8&255,s[l++]=255&i;return 2===r?(i=Cn[e.charCodeAt(t)]<<2|Cn[e.charCodeAt(t+1)]>>4,s[l++]=255&i):1===r&&(i=Cn[e.charCodeAt(t)]<<10|Cn[e.charCodeAt(t+1)]<<4|Cn[e.charCodeAt(t+2)]>>2,s[l++]=i>>8&255,s[l++]=255&i),s}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(vi,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ki(e,t,a,n){for(var i=0;i<n&&!(i+a>=t.length||i>=e.length);++i)t[i+a]=e[i];return i}function Si(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}const Ni={files:{},items:{},folders:{}};function Ti(e){return Ni.files[e]}function Mi(){return Ni.folders}function xi(e){return Ni.folders[e]}function Ci(e,t){for(const a of Object.values(Ni.folders))if(a.name===e&&a.parent===t)return a}function Ii(e,t){for(const a of Object.values(Ni.items))if(a.name===e&&a.folder._id===t)return a}function Vi(){return Ni.items}function Ei(e){return Ni.items[e]}function Fi(e,t){Ni.items[e]=t.rootItem;for(const[e,a]of Object.entries(t.metadata)){if(t.files[e]&&(Ni.files[e]={blob:new Blob([new Uint8Array(t.files[e])],{type:a.mimeType}),hash:a.hash,itemName:a.name,itemType:a.type,mimeType:a.mimeType}),a.attachments)for(const n of a.attachments){const a=Ri(e,n.name,n.queryParam,n.index);Ni.files[a]={blob:new Blob([new Uint8Array(t.files[a])],{type:n.mimeType}),hash:n.hash,itemName:n.name,itemType:n.type,mimeType:n.mimeType}}Ni.items[e]=a}for(const a of Object.values(t.folders))a._id=e+":"+a._id,a.parent=e+":"+a.parent,Ni.folders[a._id]=a}async function Di(e,t){const a=Un.from(await e.arrayBuffer());let n=0;n+=8;const i=a.readInt32LE(8);n+=4;const r=new TextDecoder,s=a.subarray(n,n+i);n+=i;const o=JSON.parse(r.decode(s));o.root=t+"/"+o.root;let l=0;const u=Tn.ungzip(a.subarray(n)),c=Un.from(u),d=c.subarray(l,l+o.metadataSize);l+=o.metadataSize;const p=JSON.parse(r.decode(d)),h={};Object.entries(p).forEach((([e,a])=>{const n=t+"/"+e;a._id=n,h[n]=a,a.folder._id=t+":"+a.folder._id;for(const e of a.links)e.to=t+"/"+e.to}));const f=c.subarray(l,l+o.foldersSize);l+=o.foldersSize;const m=JSON.parse(r.decode(f)),y={};for(const[,e]of Object.entries(h))if(e.filesize&&(y[e._id]={start:l+(e.packageFileOffset||0),end:l+(e.packageFileOffset||0)+e.filesize}),e.attachments)for(const t of e.attachments)y[Ri(e._id,t.name,t.queryParam,t.index)]={start:l+(t.packageFileOffset||0),end:l+(t.packageFileOffset||0)+t.filesize};const g={};for(const[e,t]of Object.entries(y)){const a=c.subarray(t.start,t.end);g[e]=a}const b=h[o.root],v=[],_=e=>{v.push(e._id);for(const t of e.links)t.item=structuredClone(h[t.to]),_(t.item)};return _(b),{rootItem:b,metadata:h,folders:m,files:g}}function Ri(e,t,a,n){return`${e}_${t}`+(null!=a?`_${a}`:"")+(null!=n?`_${n}`:"")}function Li(e,t,a,n){return Array.isArray(e.attachments)?e.attachments.filter((e=>e.name===t&&(void 0===n||e.index===n))).reduce(((e,t)=>Math.abs(t.queryParam-(a??0))<Math.abs(e.queryParam-(a??0))?t:e),{queryParam:1/0}):null}function Pi(e,t,a,n){const i=Ei(e);if(i){const r=Li(i,t,a,n);if(!r)return null;return Ti(Ri(e,r.name,r.queryParam,r.index))}}var Bi=Object.freeze({__proto__:null,addPackageToCache:Fi,createAttachmentID:Ri,findFolder:Ci,findItem:Ii,getAttachmentFromPackageCache:Pi,getFileFromCache:Ti,getFolder:xi,getFolders:Mi,getItemFromCache:Ei,getItems:Vi,parsePackage:Di,queryAttachments:Li});class Oi{id=h.createGUID();items=[]}class $i{itemRepo;undoEvents=[];redoEvents=[];maxUndoCount=100;enabled=!0;snapshots=new Map;_undoRedoPromise=Promise.resolve();constructor(e,t=100){this.itemRepo=e,this.maxUndoCount=t,g.instance.setUndoManager(this),u.$on("undoManager:undo",(e=>this.undo(e))),u.$on("undoManager:redo",(e=>this.redo(e)))}clear(){this.undoEvents=[],this.redoEvents=[],this.snapshots.clear(),u.$emit("undoManager:undoStepsChanged",0),u.$emit("undoManager:redoStepsChanged",0)}createSnapshot(){const e=new Oi;for(const t of this.itemRepo.itemInstances.values())for(const a of t.values())e.items.push({_id:a._id,instanceId:a.instanceId,data:this._grabSnapshot(a)});return this.snapshots.set(e.id,e),e.id}rollbackFromSnapshot(e){const t=this.snapshots.get(e);if(!t)throw new w("Snapshot not found");for(const e of t.items){const t=this.itemRepo.itemInstances.get(e._id);if(t){const a=t.get(e.instanceId);a?this._rollbackFromSnapshot(a,e.data):console.error(`[SNAPSHOT] - Trying to rollback snapshot for item but did not find the instance: ${e._id} -> ${e.instanceId}`)}else console.error(`[SNAPSHOT] - Trying to rollback snapshot for item but did not find the item map: ${e._id}`)}this.snapshots.delete(e)}_grabSnapshot(e){const t=[];for(const a of e.fieldInstances)try{t.push(a.createSnapshot())}catch(e){const t=`[SNAPSHOT] - Could not grab snapshot of field ${a.name}`;throw console.error(t,e),new Error(e.toString())}const a=[];for(const t of e.customFieldInstances)try{a.push(t.createSnapshot())}catch(e){const a=`[SNAPSHOT] - Could not grab snapshot of custom field ${t.name}`;throw console.error(a,e),new Error(e.toString())}return new O(e._id,"item",{fieldInstances:t,customFieldInstances:a})}_getFieldInstance(e,t){for(const a of e.fieldInstances)if(a.getId()===t)return a;return null}_getCustomFieldInstance(e,t){for(const a of e.customFieldInstances)if(a.getId()===t)return a;return null}_rollbackFromSnapshot(e,t){for(const a of t.data.fieldInstances){const t=this._getFieldInstance(e,a.id);t?t.rollbackFromSnapshot(a):console.warn("[SNAPSHOT] - Could not find field instance in snapshot: "+a.id)}for(const a of t.data.customFieldInstances){const t=this._getCustomFieldInstance(e,a.id);t?t.rollbackFromSnapshot(a):console.warn("[SNAPSHOT] - Could not find custom field instance in snapshot: "+a.id)}}getEnabled(){return this.enabled}setEnabled(e){this.enabled=!!e}ignore(e){const t=this.enabled;let a=!1;try{t&&this.setEnabled(!1);const n=e();if(n&&n.then)return a=!0,n.finally((()=>{t&&this.setEnabled(!0)}))}finally{t&&!a&&this.setEnabled(!0)}}undo(e){return this._undoRedoPromise=this._undoRedoPromise.then((()=>this._performUndo(e))),this._undoRedoPromise}redo(e){return this._undoRedoPromise=this._undoRedoPromise.then((()=>this._performRedo(e))),this._undoRedoPromise}async _performUndo(e){if(this.enabled&&this.undoEvents.length){for(e=e||1;this.undoEvents.length>0&&e>0;){const t=this.spliceLastEventBundle(this.undoEvents).reverse();for(const e of t)await e.undo(),this.redoEvents.push(e);e--}u.$emit("undoManager:undoStepsChanged",this.getNumberOfUndoBundles()),u.$emit("undoManager:redoStepsChanged",this.getNumberOfRedoBundles())}}async _performRedo(e){if(this.enabled&&this.redoEvents.length){for(e=e||1;this.redoEvents.length>0&&e>0;){const t=this.spliceLastEventBundle(this.redoEvents).reverse();for(const e of t)await e.redo(),this.undoEvents.push(e);e--}u.$emit("undoManager:undoStepsChanged",this.getNumberOfUndoBundles()),u.$emit("undoManager:redoStepsChanged",this.getNumberOfRedoBundles())}}getUndoSteps(){return this.undoEvents.map((function(e){return{type:e.type,itemId:e.itemId,prop:e.prop}}))}getRedoSteps(){return this.redoEvents.map((e=>({type:e.type,itemId:e.itemId,prop:e.prop})))}event(e){if(this.enabled){if(this.redoEvents=[],u.$emit("undoManager:redoStepsChanged",0),this.assignBundleIndexToEvent(e),0!==this.undoEvents.length){let t=!1;for(let a=this.undoEvents.length-1;a>=0;a--){const n=this.undoEvents[a];if(!e.isWithinMergeDeltaOf(n,300))break;const i=n.merge(e,300);if(i){t=!0,this.undoEvents.splice(a,1),this.undoEvents.push(i);break}}t||(this.undoEvents.push(e),u.$emit("undoManager:undoStepsChanged",this.getNumberOfUndoBundles()))}else this.undoEvents.push(e),u.$emit("undoManager:undoStepsChanged",this.getNumberOfUndoBundles());if(this.getNumberOfUndoBundles()>this.maxUndoCount){this.spliceFirstEventBundle(this.undoEvents);for(const e of this.undoEvents)e.bundleIndex-=1;u.$emit("undoManager:undoStepsChanged",this.getNumberOfUndoBundles())}}}getNumberOfUndoBundles(){return 0===this.undoEvents.length?0:this.undoEvents.at(-1).bundleIndex+1}getNumberOfRedoBundles(){if(0===this.redoEvents.length)return 0;const e=this.getNumberOfUndoBundles()-1;return this.redoEvents.at(0).bundleIndex-e}spliceLastEventBundle(e){if(0===e.length)return[];const t=e.at(-1).bundleIndex;let a=e.length-1;for(let n=e.length-1;n>=0&&e[n].bundleIndex===t;n--)a=n;return e.splice(a)}spliceFirstEventBundle(e){if(0===e.length)return[];const t=e.at(0).bundleIndex;for(let a=1;a<e.length;a++)if(e[a].bundleIndex!==t)return e.splice(0,a);return e.splice(0)}assignBundleIndexToEvent(e){if(0===this.undoEvents.length)return void(e.bundleIndex=0);const t=this.undoEvents.at(-1),a=Math.abs(e.createdAt-t.createdAt);e.bundleIndex=a>300?t.bundleIndex+1:t.bundleIndex}}class Ui{updateItemLinksAndAttributes(e,t,a){try{const n=[],i={},r={};this.getLinksAndAttributes(e,n,i,r,t,a),e.attributes=i,e.userAttributes=r,e.links=n}catch(e){throw console.error(e),new k(e)}}getLinksAndAttributes(e,t,a,n,i,r){e.fieldInstances.length&&this.retrieveLinksAndAttributesFromFieldInstances(e.fieldInstances,t,a,i,r),e.userFieldInstances.length&&this.retrieveLinksAndAttributesFromFieldInstances(e.userFieldInstances,t,n,i,r),e.customFieldInstances.length&&(console.log(e.customFieldInstances),this.retrieveLinksAndAttributesFromFieldInstances(e.customFieldInstances,t,n,i,r,"_"))}retrieveLinksAndAttributesFromFieldInstances(e,t,a,n,i,r=""){for(const s of e)switch(s.type){case"Link":if(s.value&&t){if(i&&s.hidden)continue;n?t.push({usage:r+s.name,to:s.value._id,item:s.value}):t.push({usage:r+s.name,to:s.value._id})}break;case"Attribute":a&&(a[r+s.name]=s.value);break;case"List":s.blocks&&this.traverseListFieldInstances(s.blocks,t,a,r+s.name,n);break;case"Tree":if(s.blocks){const e=s.blocks[0];e.blocks&&this.traverseTreeFieldInstance(e.blocks,t,a,r+s.name,n)}break;case"NodeGraph":if(s.blocks&&this.traverseTreeFieldInstance(s.blocks,t,a,r+s.name,n),a&&Array.isArray(s.connections)){let e=0;for(const t of s.connections){a[`${r}${s.name}#connection[${e++}]`]={srcNode:t.srcNode,srcSlot:t.srcSlot,destNode:t.destNode,destSlot:t.destSlot}}}}}traverseTreeFieldInstance(e,t,a,n,i){let r=0;for(const s of e){const e=`${n}[${r}]`,o=e+"#type",l=e+"#subnodeid",u=e+"#id",c=e+"#posx",d=e+"#posy";a&&(a[e+"#usage"]="Block",a[o]=s.type,a[u]=s.id,void 0!==s.subNodeId&&(a[l]=s.subNodeId),void 0!==s.posX&&(a[c]=s.posX||0),void 0!==s.posY&&(a[d]=s.posY||0));for(const n of s.fields){const r=`${e}->${n.name}`;switch(n.type){case"Link":n.value&&t&&(i?t.push({usage:r,to:n.value._id,item:n.value}):t.push({usage:r,to:n.value._id}));break;case"List":n.blocks&&this.traverseListFieldInstances(n.blocks,t,a,r,i);break;case"Attribute":a&&(a[r]=n.value)}}s.scripts&&this.processScripts(s.scripts,t,a,e,i),s.blocks&&this.traverseTreeFieldInstance(s.blocks,t,a,e,i),r++}}traverseListFieldInstances(e,t,a,n,i){let r=0;for(const s of e){const e=`${n}[${r}]`;for(const n of s.fields){const r=`${e}->${n.name}`;switch(n.type){case"Link":if(n.value&&t){const e={usage:r,to:"object"==typeof n.value?n.value._id:n.value,item:null};i&&"object"===n.value&&(e.item=n.value),t.push(e)}break;case"Attribute":a&&(a[r]=n.value)}}r++}}processScripts(e,t,a,n,i){let r=0;for(const s of e){const e=`${n}#scripts[${r}]`,o=e+"#id",l=e+"#item";a&&(a[e+"#usage"]="Script",a[o]=s.id),t&&s.item.value&&(i?t.push({usage:l,to:s.item.value._id,item:s.item.value}):t.push({usage:l,to:s.item.value._id}));for(const n of s.fields){const r=`${e}->${n.name}`;if("Link"===n.type)n.value&&t&&(i?t.push({usage:r,to:n.value._id,item:n.value}):t.push({usage:r,to:n.value._id}));else a&&(a[r]=n.value)}r++}}}class ji{apiClient;activeItem=void 0;rootItemId=void 0;loadingItems=new Map;loadedItems=new Map;itemInstances=new Map;resolvedPaths=new Map;jail;apiGateway;itemCache;undoManager=new $i(this);itemPreparator=new te(this);itemChangeProcessor=new Ui;usePublicApi;constructor(e,t){this.apiClient=t,this.apiGateway=new P(t),this.itemCache=new B(this.apiGateway),this.usePublicApi=!!e,this.jail={active:!1,mountedFolders:[]},u.$on("item:rename",(e=>this.handleRename(e)))}_logGroup(e){}_logGroupEnd(){}_log(e){}getLoadedItems(){return Array.from(this.loadedItems.values())}getItemInstances(){return this.itemInstances}findLoadedItem(e){return this.loadedItems.get(e)}_handleError(e,t){throw console.error(e),new k("ItemRepo: "+t)}getUndoManager(){return this.undoManager}async createFieldsForItem(e,t,a,n=!1){return this.itemPreparator.createFields(e,a,t,"",!1,a.attributes,n)}async createScriptsForItem(e,t=[],a,n=!0){const i=[];for(const n of t){if(!n.item)continue;const t=await this.loadItem(n.item);if(!t)continue;const r=new W(void 0,e,a,t);i.push(r);for(const e of n.fields){const t=new j(r,e.name,e.value,a);r.addField(t)}}e.scripts=n?g.instance.proxyScriptArray(i,e,a):i}clear(){this.rootItemId=void 0,this.activeItem=void 0,this.loadedItems.clear(),this.resolvedPaths.clear(),this.itemInstances.clear(),this.loadingItems.clear();const e=this.apiClient.getCollab();e&&e.endCollaboration()}removeBlock(e,t){t.blocks.removeObject(e),e.parent=void 0}traverseBlockPairs(e,t,a){a(e,t);for(let n=0;n<e.blocks.length&&n<t.blocks.length;n++)this.traverseBlockPairs(e.blocks[n],t.blocks[n],a)}copyScripts(e,t,a=!1){const n=new Map;this.traverseBlockPairs(e,t,((e,t)=>n.set(e.getId(),t.getId())));const i=[];return this.traverseBlockPairs(e,t,((e,t)=>{for(const r of e.scripts){const e=r.clone(n);a&&(e.deferInitCall=!0),t.scripts.push(e),i.push(e)}})),i}updateScriptFieldReferences(e,t){const a=new Map;this.traverseBlockPairs(e,t,((e,t)=>{a.set(e.id,t.id)})),this.updateScriptFieldReferencesFromMap(a,t)}updateScriptFieldReferencesFromMap(e,t){this.traverseBlocks((t=>{for(const a of t.scripts)for(const t of a.fields)e.has(t.value)&&(t.value=e.get(t.value))}),[t])}async createNewBlock(e,t,a,n){const i=new ae(void 0,t,e.typeName,void 0,void 0,a);n&&i.setSubNodeId(n);const r=await this.createFieldsForItem(i,e.template,a);return i.setFields(r),i.blocks=g.instance.proxyBlockArray(i.blocks,i,a),await this.createScriptsForItem(i,void 0,a),this.addBlockToParent(i,t,a)}addBlockToParent(e,t,a){e.parent=t;const n=g.instance.proxyBlock(e,a);return t.blocks.push(n),n}async createNewListEntry(e,t,a){const n=new ae(void 0,void 0,e.typeName,void 0,void 0,a),i=await this.createFieldsForItem(n,e.template,a);return n.setFields(i),n.blocks=g.instance.proxyListArray(n.blocks,t,a),g.instance.proxyBlock(n,a)}async createNewGraphNode(e,t,a,n,i){const r=new ae(void 0,void 0,e.typeName,void 0,e.displayName,i),s=await this.itemPreparator.createFields(r,i,e.template,"",!0,i.attributes);return r.setFields(s),r.setInputs(e.inputs),r.setOutputs(e.outputs),r.setPosition(a,n),r.blocks=g.instance.proxyGraphBlockArray(r.blocks,t),this.addNodeToGraph(r,t,i),r}addNodeToGraph(e,t,a){const n=g.instance.proxyGraphBlock(e,a);t.blocks.push(n)}removeGraphNode(e,t){const a=[];for(const n of e.connections)n.srcNode!==t.id&&n.destNode!==t.id||a.push(n);for(const t of a)e.connections.removeObject(t);e.blocks.removeObject(t)}addGraphLink(e,t,a,n,i,r){e.connections.push(new U({srcNode:t,srcSlot:a,destNode:n,destSlot:i},r))}removeGraphLink(e,t,a,n,i){for(const r of e.connections)if(r.srcNode===t&&r.srcSlot===a&&r.destNode===n&&r.destSlot===i)return void e.connections.removeObject(r)}createNewScript(e,t=-1,a){t=t>=0?t:e.scripts.length;const n=new W(void 0,e,a);return e.scripts.splice(t,0,n),n}removeScript(e,t){t.scripts.removeObject(e)}findBlock(e){for(const t of this.itemInstances.values())for(const a of t.values()){const t=a.findBlock(e);if(t)return t}return null}async loadPackage(e,t){const a=await h.downloadFile(e,((e,a,n)=>{t&&t({phase:"Loading",percent:e,bytesTotal:a,bytesLoaded:n})})),n=await a.data,i=this.apiClient.getCollab();i&&i.endCollaboration();const r=new K({_id:"root",name:"Root package",type:"Package",links:[],attributes:{},fields:[],readOnly:!0,isPackaged:!1}),s=await Di(n,r._id);Fi(r._id,structuredClone(s));const o=Object.values(s.metadata).reverse();for(const e of o)e._id===s.rootItem._id&&(r.packageContent=e,r.packageType=e.type);return await this._linkAndPrepareItems(o),r.packageContent=this.loadedItems.get(s.rootItem._id),this.activeItem=r,r}createPackageItemUrl(e){const t=Ti(e);return t?URL.createObjectURL(t.blob):null}revokePackageItemUrl(e){URL.revokeObjectURL(e)}async _loadPackageContentRecursively(e,t){t("Loading from cache",0);const a=await this.apiClient.itemCache.addItemToCache(e._id,void 0,e.hash,(function(e,a,n){t("Loading from cloud",.9*e,n,a)})),n=await(await fetch(a.objectUrl)).blob();t("Unpacking",90);const i=await Di(n,e._id);Fi(e._id,structuredClone(i));const r=Object.values(i.metadata).reverse();for(const t of r)t._id===i.rootItem._id&&(e.packageContent=t,e.packageType=t.type);return r}createNewItemInstance(e){const t=this.loadedItems.get(e);if(!t)return console.error(`Tried creating new instance of item, but it was not found: ${e}`),null;const a=t.clone(!0);return this._addItemInstance(a),a}_addLoadedItem(e){this.loadedItems.set(e._id,e),this._addItemInstance(e)}_addItemInstance(e){let t=this.itemInstances.get(e._id);t||(t=new Map,this.itemInstances.set(e._id,t)),t.set(e.instanceId,e)}async loadItemByRelativePath(e,t,a={}){try{const n=Ei(e);let i;if(n){const e=t.split("/"),a=e.pop();let r=xi(n.folder._id);for(const t of e)if(r=".."===t?xi(r.parent):Ci(t,r._id),!r)return;const s=Ii(a,r._id);i=s?._id}else i=await this.resolveRelativePath(t,e);return this.loadItem(i,a)}catch(e){this._handleError(e,`Unable to load item by relative path: ${t}: ${e}`)}}async _loadItemFromApi(e,t={}){let a;if(this.apiGateway.start(),t.recursive)if(this.usePublicApi)a=await this.apiGateway.call("_loadItemFromApi","getItemPublicRecursive",e,!0),a.forEach((e=>e.public=!0));else try{a=await this.apiGateway.call("_loadItemFromApi","getItemAggregatedRecursive",e,{withAttachmentInfo:!0,noFields:!0})}catch{a=await this.apiGateway.call("_loadItemFromApi","getItemPublicRecursive",e,!0),a.forEach((e=>e.public=!0))}else{let t;if(this.usePublicApi)t=await this.apiGateway.call("_loadItemFromApi","getItemPublicRecursive",e),t.public=!0;else try{t=await this.apiGateway.call("_loadItemFromApi","getItemAggregated",e,{noFields:!0})}catch{t=await this.apiGateway.call("_loadItemFromApi","getItemPublicRecursive",e),t.public=!0}a=[t]}return this.apiGateway.end(),a}_relinkItems(e,t){for(const a of e){if(Array.isArray(a.links))for(const e of a.links)e.item=t.get(e.to),e.item||e.stopRecursion||console.warn(`Missing link in item '${a.name}' (${a._id}) to: ${e.to} with usage ${e.usage}`);a.packageContent&&(a.packageContent=t.get(a.packageContent._id))}}createItem(e,t){const a={_id:h.createGeneratedItemId(),name:`Generated ${e}`,type:e,attributes:t||{},links:[],fields:[],fieldInstances:[],userFieldInstances:[],isGenerated:!0};return this.itemPreparator.prepare(a)}getLoadedItem(e){return this.loadedItems.get(e)}async loadItem(e,t={}){let a,n,i;if(i=this.loadedItems.get(e),i)return i;if(i=this.loadingItems.get(e),i)return i;try{const r=new Promise(((e,t)=>{a=e,n=t}));return this.loadingItems.set(e,r),i=await this._loadItemInternal(e,t),a(i),!this.activeItem&&i&&(this.rootItemId=e,this.activeItem=i,t.withCollaboration,await u.$emit("itemRepo:itemLoaded",i)),i}catch(t){return this._handleError(t,`Unable to load item ${e}: ${t}`),void n(void 0)}finally{this.loadingItems.delete(e)}}async _loadItemInternal(e,t={}){const a=(e,a,n=0,i=0)=>{"function"==typeof t.progressCallback&&t.progressCallback({phase:e,percent:a,bytesTotal:n,bytesLoaded:i})};a("Fetching metadata",1);let n=await this._loadItemFromApi(e,t);if(n=n.filter((e=>!this.loadedItems.has(e._id))),0===n.length)return console.log("After loading the item, it turns out we have them all already loaded! This should not happen!"),this.loadedItems.get(e);const i=n[0]._id;for(const e of n)if("Package"===e.type){const t=await this._loadPackageContentRecursively(e,a);for(const e of t)n.push(e)}a("Preparing data",100),await this._linkAndPrepareItems(n);return this.loadedItems.get(i)}async _linkAndPrepareItems(e){const t=new Map;for(const a of e)t.set(a._id,a);const a=new Map([...this.loadedItems,...t]);this._relinkItems(e,a);const n=[],i=()=>{const e=t.values().next().value;return t.delete(e._id),this._log(`- Fetched next item ${e.name} (${e._id})`),e},r=async e=>{this._logGroup(`- Preparing item ${e.name} (${e._id})`);const t=await this.itemPreparator.prepare(e);return n.push(t),this._addLoadedItem(t),this._logGroupEnd(),t};for(this.itemPreparator.setItemFetcher((async e=>{this._logGroup(`- Requesting item ${e.name} (${e._id})`);let a=this.loadedItems.get(e._id);if(a)return this._log("- Already prepared. Returning."),this._logGroupEnd(),a;const n=t.get(e._id);return n?(t.delete(e._id),this._log("- Don't have it yet. Preparing..."),a=await r(n),this._log("- Now prepared. Returning."),this._logGroupEnd(),a):(console.error("ItemFetcher: Could not find requested item: "+e._id,t,this.loadedItems),null)}));t.size>0;){let e=i();await r(e)}return this._relinkItems(n,this.loadedItems),n}async resolveRelativePath(e,t=null){if(!(t=t||this.activeItem?._id||null))return null;const a=`${t}#${e}`;let n;return n=this.resolvedPaths.has(a)?this.resolvedPaths.get(a):this.usePublicApi?await this.apiClient.publicResolveRelativeItem(t,e):await this.apiClient.resolveRelativeItem(t,e),this.resolvedPaths.set(a,n),n}async traverseItems(e,t=void 0){if("function"!=typeof e)return;const a=this,n=new Map;await async function t(i){if(!i)return;if(n.has(i._id))return;n.set(i._id,!0);const r=e(i);if(r&&r.then&&await r,Array.isArray(i.links))for(const e of i.links)if(e.item)await t(e.item);else if(e.to)try{const n=await a.loadItem(e.to);await t(n)}catch{console.warn(`Could not load additional item ${e.to} so cannot traverse it. Probably dead link!`)}}(t||this.activeItem)}async traverseBlocks(e,t){for(const a of t){const t=e(a);t&&t.then&&await t,Array.isArray(a.blocks)&&a.blocks?.length&&await this.traverseBlocks(e,a.blocks)}}async traverseFieldInstances(e,t){const a=this;t=t||this.activeItem?.fieldInstances||[];for(const n of t){const t=e(n);t&&t.then&&await t,Array.isArray(n.blocks)&&await this.traverseBlocks((async function(t){Array.isArray(t.fields)&&t.fields?.length&&await a.traverseFieldInstances(e,t.fields)}),n.blocks)}}async _updateLinkReferences(e,t,a,n){t?await this.traverseItems((async i=>{if(Array.isArray(i.fieldInstances)&&i.fieldInstances.length){await this.traverseFieldInstances((async a=>{"Link"===a.type&&a.value&&a.value._id===e&&(n&&(a.value=null),a.value=t)}),i.fieldInstances);for(const a of i.fieldInstances)Array.isArray(a.blocks)&&await this.traverseBlocks((async a=>{if(Array.isArray(a.scripts))for(const i of a.scripts)i.item?.value?._id===e&&(n&&(i.item.value=void 0),i.item.value=t)}),a.blocks)}if(i.links)for(const r of i.links)r.to===e&&(n&&(r.to=null,r.item=null),r.to=a,r.item=t)})):console.warn(`Aborting link update: Could not load item ${a}`)}async replaceLink(e,t){if(this.getLoadedItem(e)){const a=await this.loadItem(t,{recursive:!0});await this._updateLinkReferences(e,a,t,!1)}}async forceUpdateLink(e){const t=await this.loadItem(e,{recursive:!0});await this._updateLinkReferences(e,t,e,!0)}saveItem(e){return e._id&&e.isDirty?(this.itemChangeProcessor.updateItemLinksAndAttributes(e,!1,!0),e.version||(e.version={major:0,minor:0,revision:1}),this.apiClient.updateItem({_id:e._id,name:e.name,attributes:e.attributes,userAttributes:e.userAttributes,links:e.links,tags:e.tags,contributors:e.contributors,description:e.description,shortDescription:e.shortDescription,categories:e.categories,license:e.license,version:e.version,allowConversation:e.allowConversation,visibility:e.visibility}).then((t=>(JSON.stringify(e.version)===JSON.stringify(t.version)?console.log(`Saved item ${e.name}. New version: ${e.version.major}.${e.version.minor}.${e.version.revision}`):console.log(`Saved item ${e.name}. Version ${e.version.major}.${e.version.minor}.${e.version.revision} -> ${t.version.major}.${t.version.minor}.${t.version.revision}`),t&&t.version&&(e.version=t.version),e.isDirty=!1,this.itemChangeProcessor.updateItemLinksAndAttributes(e,!0,!1),e))).catch((function(t){throw console.error(`Error saving item ${e.name}`,t,e),t}))):null}async save(){console.log("Saving changes in loaded items...");const e=[];for(const t of this.loadedItems.values()){const a=this.saveItem(t);a&&e.push(a)}if(0!==e.length){let t=0;for(const a of e)a.then((function(a){u.$emit("itemRepo:itemSaved",{item:a,progress:++t,total:e.length})}));return Promise.all(e).then((function(){console.log("Saved successfully"),u.$emit("itemRepo:itemsSaved")})).catch((function(e){console.error("Error saving:",e)}))}console.log("No changes detected.")}async existsUnsavedChanges(){if(!this.activeItem)return!1;for(const e of this.loadedItems.values())if(e._id&&e.isDirty)return!0;return!1}handleRename({id:e,newName:t}){for(const a of this.itemInstances.values())for(const n of a.values())n._id===e&&(n.name=t)}isItemKnown(e){return this.loadedItems.has(e)||this.itemInstances.has(e)||this.loadingItems.has(e)}invalidateId(e){this.loadedItems.delete(e),this.itemInstances.delete(e),this.loadingItems.delete(e)}}var zi,Wi={exports:{}};
13
13
  /*!
14
14
  localForage -- Offline Storage, Improved
15
15
  Version 1.10.0